/*
 * ghost_ipc.h
 *
 */

#ifndef GHOST_IPC_H_
#define GHOST_IPC_H_


#include <stdint.h>


class GhostDspIpc
{
public:
	static void* sharedInputMemory();

	static int waitReadyInput(int timeout_ms=-1);

	static bool signalReadyInput(int ping_pong);
	static bool signalReadyOutput();

	static bool waitBatch();

	static void writeHeader(int ping_pong, const void* data, unsigned int len=0);
};



class GhostEifIpc
{
public:
	struct avionics_adaptor_message_t
	{
		//uint32_t gap[17];

		uint32_t tag;
		//RX
		uint32_t att[9];
		uint16_t a1[32];//icd1553::msg_rdr_settings_and_parameters_trait::wc];
		uint16_t a2[32];//icd1553::msg_rdr_operation_command_trait::wc];
		uint16_t a3[32];//icd1553::msg_graphic_setting_trait::wc];
		uint16_t a4[32];//icd1553::msg_nav_data_and_cursor_trait::wc];
		uint16_t a5[32];//icd1553::msg_inu_high_speed_trait::wc];
		uint16_t a7[32];//icd1553::msg1_data_link_target_trait::wc];
		uint16_t a8[32];//icd1553::msg2_data_link_target_trait::wc];
		uint16_t x1[32];//icd1553::msg_dev0_reserved_trait::wc];

		uint32_t btt[32];

		uint16_t b1[32];//icd1553::tws_status_and_targets_01_02_trait::wc];
		uint16_t b2[32];//icd1553::tws_status_and_targets_03_04_05_trait::wc];
		uint16_t b3[32];//icd1553::tws_status_and_targets_06_07_08_trait::wc];
		uint16_t b4[32];//icd1553::spt_target_message_trait::wc];
		uint16_t b5[32];//icd1553::hpt_target_message_trait::wc];

		uint16_t b6[32];//icd1553::msg_settings_tellback_trait::wc];
		uint16_t b7[32];//icd1553::msg_rdr_status_tellback_trait::wc];
		uint16_t b8[32];//icd1553::bit_report_message_trait::wc];

		uint16_t b9[32];//icd1553::msg_b09_trait::wc];
		uint16_t b10[32];//icd1553::msg_b10_trait::wc];

		uint16_t b11[32];//icd1553::msg_b10_trait::wc];
		uint16_t b12[32];//icd1553::msg_b10_trait::wc];
		uint16_t b13[32];//icd1553::msg_b10_trait::wc];
		uint16_t b14[32];//icd1553::msg_b10_trait::wc];
		uint16_t b15[32];//icd1553::msg_b10_trait::wc];
		uint16_t b16[32];//icd1553::msg_b10_trait::wc];
		uint16_t b17[32];//icd1553::msg_b10_trait::wc];
		uint16_t b18[32];//icd1553::msg_b10_trait::wc];
	};

	struct avionics_adaptor_message_store_t
	{
		//uint32_t gap[17];
		avionics_adaptor_message_t d;
	};

	static void update1553(const avionics_adaptor_message_t* msg);
	static void update1553(const avionics_adaptor_message_t* msg, bool only_nav);

};

#endif /* GHOST_IPC_H_ */
