#ifndef RADAR_MANAGER_ICD_H /* prevent circular inclusions */
#define RADAR_MANAGER_ICD_H /* by using protection macros */

#define MAX_MSG_LENGTH	8192
#define MSG_TIMEOUT  	2000

void radar_manager_get_message( unsigned char * recv_buf, int n, unsigned char * msgBuffer, int * msg_ind, int * header_found);
void radar_manager_parse_message(u8 * msgBuffer);

#define FSYNC 			0xAABBCCDD

#define AXI_WRITE_REG 			1
#define AXI_READ_REG 			2
#define AXI_READ_RESP 			3
#define ACK_MSG 	 			4
#define NACK_MSG 	 			5
#define AXI_WRITE_REG_BURST 	6
#define RF_SPI_WRITE		 	7
#define CONFIG_FLASH_WRITE		8
#define SET_AD9081_DAC_NCO		128
#define SET_AD9081_ADC_NCO		129
#define SET_LANE_MAPPING		130
#define AD9081_REG_WRITE		131
#define AD9081_REG_READ			132

#define HDR_FLAG_REQ_ACK			0x01

#define ACK_VALID_PACKET	0x01
#define ACK_VALID_EXECUTION 0x02

#pragma pack(push, 1)
typedef struct {
	unsigned int   fsync;
	unsigned short type;
	unsigned short flags;
	unsigned short length;
} headerType;

typedef struct {
	headerType		header;
	unsigned int 	flags;
} ackType;

typedef struct {
	headerType		header;
	unsigned int 	addr;
	unsigned int 	data;
} writeRegType;

typedef struct {
	headerType		header;
	unsigned int 	addr;
	unsigned int 	length;
	unsigned int 	data[512];
} writeRegBurstType;

typedef struct {
	headerType		header;
	unsigned int 	addr;
	unsigned int 	length;
	uint8_t     	data[512];
} configFlashWriteType;

typedef struct {
	headerType		header;
	unsigned int 	addr;
} readRegType;

typedef struct {
	headerType		header;
	unsigned int 	data;
} readRespType;

typedef struct {
	headerType		header;
	unsigned int 	channel;
	int64_t		 	frequency;
} ncoConfigType;

typedef struct {
	headerType		header;
	unsigned int 	dev_sel;
	unsigned int 	num_bits;
	unsigned int 	data;
} rfSpiWriteType;

typedef struct {
	headerType		header;
	uint8_t 	lane_map[8];
} laneMappingType;

//typedef struct {
//	uint32_t	num_pulses;
//	uint32_t	num_pulses;
//	uint32_t	num_pulses;
//	uint32_t	num_pulses;
//	uint32_t	num_pulses;
//	uint32_t	num_pulses;
//} configCpiType;

#pragma pack(pop)

#endif /* end of protection macro */
