Commit 8abe98e1 authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

ptalog: Add GPIO-based synchronization functions

parent ec36f93e
Loading
Loading
Loading
Loading
+17 −5
Original line number Diff line number Diff line
@@ -13,25 +13,26 @@ class PTALog {
		log_entry log[32];
		uint8_t log_index;

		PTALog() : log_index(0) {}
		PTALog(uint8_t pin_number) : log_index(0), sync_pin(pin_number) {}

		void passTransition(uint8_t transition_id)
		inline void passTransition(uint8_t transition_id)
		{
			log[log_index].transition_id = transition_id;
			log_index++;
		}

		void reset()
		inline void reset()
		{
			log_index = 0;
		}

		void startBenchmark(uint8_t id)
		inline void startBenchmark(uint8_t id)
		{
			kout << "[PTA] benchmark start, id=" << dec << id << endl;
			gpio.output(sync_pin);
		}

		void stopBenchmark()
		inline void stopBenchmark()
		{
			kout << "[PTA] benchmark stop" << endl;
		}
@@ -44,8 +45,19 @@ class PTALog {
			}
		}

		inline void startTransition()
		{
			gpio.write(sync_pin, 1);
		}

		inline void stopTransition()
		{
			gpio.write(sync_pin, 0);
		}

	private:
		PTALog(const PTALog& copy);
		uint8_t sync_pin;
};

#endif