/************************************************************
 * FILE:	control.h
 * AUTHOR:	Kenny Huang
 * Descp:	This file is the agreement between RTLinux
 * 		modules and normal Linux processes. The 
 * 		communication is established here. It 
 * 		also consists of the commands used to transmit
 * 		between the top and the vehicle.
 ************************************************************/

#define PNG 		"PNG"
#define ACK_PNG		"ACK_PNG\n"
#define REQ		"REQ"
#define SEND_RDY	"SEND_RDY\n"
#define ACK_AUTO	"ACK_AUTO"
#define ACK_CAM 	"ACK_CAM"
#define ACK_ARM 	"ACK_ARM"
#define ACK  		"ACK"



#define GENERATE_ERR "GENERATE_ERR\n"



enum FIFOS { RTCOM_FIFO = 1, SUB_OUT_FIFO = 2 };	

enum TEL_SEND {    OUT_GESOUT = 0, OUT_MPL = 1, OUT_GESDAC = 2, CLEAR_ALARM_ARRAY = 3, OUT_GESDAC_STR = 4,
		   	// the following is used to set up ind. gain/offsets
		   IN_ANALOG_GAINOFF = 5,  SELECT_MAN_GF = 6,
		   DIG_DEFAULTS = 8, ANA_DEFAULTS = 9, TELEOS_ENABLE = 10, LATITUDE = 11,
		   RPM_SETUP = 12, ARM_SAMPLE_SETUP = 13, CAM_SAMPLE_SETUP = 14,
		   PILOT_SETPT = 94, ARM_SETPT = 95, CAM_SETPT = 96,
		   	// the following are the control loop set points
		   SET_PILOT = 97, SET_ARM = 98, SET_CAM = 99,
		   SET_ARM_ENABLE = 100, SET_CAM_ENABLE = 101,
		   AUTO_HEADING_ = 102,
		   AUTO_DEPTH_ = 103,
		   AUTO_ALTITUDE_ = 104,
		   AUTO_CRUISE_ = 105,
		
		   };

enum TEL_RECEIVE {	// 0 - 3 is reserved so we can send the same packet
		// back with an "ACK" appended to the end.
		// This way the top will know what state on or off
		// the last output was. This way, we should not 
		// have the top showing on while the sub is off
		// or vice versa. 
		ACK_GESOUT = 0, ACK_OUT_MPL = 1, ACK_OUT_GESDAC = 2, ACK_ALARM_POLL = 3,
		ANALOGS = 4, DEPTH = 5, OTHER_ALARM = 6, PITCHROLL = 7, 
		DIGITAL_ALARM = 8, HEADING = 9,	
		PILOT_FB = 10, ARM_FB= 11, CAM_FB = 12, GROUND_FAULT = 13,
		ALL_ANALOGS = 14, ALL_DIGITALS = 15, RPM_SPEED = 16,
		NORTH_VEL = 17, DVL_ALTITUDE = 18, DVL_HEADING = 19,
		ACK_GF_SELECT = 50, ACK_DIG_DEFAULTS = 52, ACK_ANA_DEFAULTS = 53, ACK_TELEOS_ENABLE = 54,
		ACK_LATITUDE_SETUP = 55, ACK_RPM_SETUP = 56, ACK_ARM_ENABLE = 57,
		ACK_CAM_ENABLE = 58, ACK_AUTO_HEADING = 59, ACK_AUTO_DEPTH = 60,
		ACK_AUTO_CRUISE = 61, ACK_AUTO_VISION = 62, ACK_DEPTH_JOG = 64, ACK_CAM_SAMPLES_SETUP = 65, ACK_IN_ANALOG_GAINOFF = 66,
		ACK_ARM_SAMPLES_SETUP = 67, ACK_AUTO_CRUISE_SETPOINT = 68, ACK_AUTO_ALTITUDE = 69,
		AUTO_CNTL_BYTE = 93, CAM_CNTL_BYTE = 94, ARM_CNTL_BYTE = 95,
		TEL_TIMEDOUT = 100, TEL_PARSE_ERROR = 101, TEL_CRC_ERROR = 102, 
		TEL_FIFO_ERROR  = 103};

struct toBoardMsg {
	int command;	
	//int channel_num;
	//int digital_val;
	//float analog_val;	
};

struct fromBoardMsg {
	int board_num;
	int channel_num;
	int digital_val;
	float analog_val;
};



