/*==================================================================================================

FILE INFORMATION HEADER

USED IN PROJECT:			S1003065-01 PPS-TX/S1003067-01 PPS-RX software application
ITEM TYPE:					Source Code
ITEM NAME:					xlru_bytes_def.h
ITEM DESCRIPTION:			This file contains definition's for byte information between pps/psm/lcu and rep
TARGET:						ATSAM4LC8B / ATSAM4LS8B
DOC REFERENCES:				SWDS1003065-01/SWDS1003065-01
PROGRAMMER NAME(S):			A.Chessa, L.Vallongo
COPYRIGHT:					LEONARDO-FINMECCANICA S.p.A
REVISION HISTORY:
- 01.00: first release

====================================================================================================
© Copyright LEONARDO S.p.A.. All rights reserved
Any right of industrial and intellectual property on this document,
and of technical Know-how herein contained, belongs to
LEONARDO S.p.A. and/or third parties.
According to the law, it is forbidden to disclose, reproduce or however
use this document and any data herein contained for any use without
previous written authorization by LEONARDO S.p.A.
==================================================================================================*/

#ifndef XLRU_BYTES_DEF_H
#define XLRU_BYTES_DEF_H

//LCU BIT DEFINITIONS
//**************************************************
//BYTE INFORMATION

/*Byte 1*/
#define Bit_PhaseA_failure			(uint8_t)(0x01)
#define Bit_PhaseB_failure			(uint8_t)(0x02)
#define Bit_PhaseC_failure			(uint8_t)(0x04)
#define Bit_Phase_Sequence_failure	(uint8_t)(0x08)
#define Bit_Pressure_Sensor_fail	(uint8_t)(0x40)

/*Byte 2*/
#define Bit_Temperature_Hazard		(uint8_t)(0x01)
#define Bit_Temperature_Warning		(uint8_t)(0x02)
#define	Bit_NVM_Access_Warning		(uint8_t)(0x04)
#define Bit_Board_Error_failure		(uint8_t)(0x08)
#define Bit_Link_failure			(uint8_t)(0x10)

/*Byte 3*/
#define Bit_motor_speed_sensor_fail		(uint8_t)(0x01)
#define Bit_motor_temperature_hazard2	(uint8_t)(0x02)
#define Bit_motor_temperature_hazard	(uint8_t)(0x04)
#define Bit_motor_failure				(uint8_t)(0x08)
#define Bit_motor_temp_sensor_fail		(uint8_t)(0x80)

/*Byte 4*/
#define Bit_inlet_temp_sensor_fail_AESA_TS1		(uint8_t)(0x01)
#define Bit_inlet_temp_sensor_fail_PPS_TS2		(uint8_t)(0x02)
#define Bit_inlet_temp_sensor_fail_Combo_TS3	(uint8_t)(0x04)
#define Bit_outlet_temp_sensor_fail_TS4			(uint8_t)(0x08)
#define Bit_inlet_air_temp_sensor_fail_TS5		(uint8_t)(0x10)
#define Bit_outlet_air_temp_sensor_fail_TS6		(uint8_t)(0x20)
#define Bit_inlet_flow_sensor_AESA_FS1			(uint8_t)(0x40)
#define Bit_inlet_flow_sensor_PPS_FS2			(uint8_t)(0x80)

/*Byte 5*/
#define Bit_Dirty_filter_HE_warning				(uint8_t)(0x01)
#define Bit_Dirty_AESA_Stream_warning			(uint8_t)(0x02)
#define Bit_Dirty_PPS_Stream_warning			(uint8_t)(0x04)
#define Bit_Dirty_filter_HE_failure				(uint8_t)(0x10)
#define Bit_Dirty_AESA_stream_failure			(uint8_t)(0x20)
#define Bit_Dirty_PPS_stream_failure			(uint8_t)(0x40)
#define Bit_By_Pass_failure						(uint8_t)(0x80)


//PPS BIT DEFINITIONS
//**************************************************
//BYTE INFORMATION

/*Byte 1*/
#define PPS1_Bit1_HoldUp_LP_Under_Voltage_Fail	(uint8_t)(0x01)
#define PPS1_Bit2_HoldUp_HP_Under_Voltage_Fail	(uint8_t)(0x02)
//#define PPS1_Bit3_HoldUp_LP_Under_Voltage_Fail	(uint8_t)(0x04)
//#define PPS1_Bit4_HoldUp_LP_Charging_Time_Fail	(uint8_t)(0x08)
#define PPS1_Bit6_AC_Power_Unbalance_Fail_Ph1	(uint8_t)(0x20)
#define PPS1_Bit7_AC_Power_Unbalance_Fail_Ph2	(uint8_t)(0x40)
#define PPS1_Bit7_AC_Power_Unbalance_Fail_Ph3	(uint8_t)(0x80)

/*Byte 2*/
#define PPS2_Bit1_RX_Link_Fail                                      (uint8_t)(0x01)
#define PPS2_Bit2_RX_Input_DC_Overcurrent_Fail                      (uint8_t)(0x02)
#define PPS2_Bit3_RX_Rectified_DC_Under_Voltage_Fail_Ac_Power_Loss	(uint8_t)(0x04)
#define PPS2_Bit5_Output_RX_Over_Voltage_Fail                       (uint8_t)(0x10)
#define PPS2_Bit6_Output_RX_Under_Voltage_Fail                      (uint8_t)(0x20)
#define PPS2_Bit7_RX_Hazard1                                        (uint8_t)(0x40)
#define PPS2_Bit8_RX_Hazard2                                        (uint8_t)(0x80)

/*Byte 3*/
#define PPS3_Bit1_TX1_link_with_RX                                  (uint8_t)(0x01)
#define PPS3_Bit2_TX1_Input_DC_Over_Current_Fail                    (uint8_t)(0x02)
#define PPS3_Bit3_TX1_Rectified_DC_Under_Voltage_Fail_270_uv        (uint8_t)(0x04)
//#define PPS3_Bit4_TX1_Rectified_DC_Over_Voltage_Fail              (uint8_t)(0x08)
#define PPS3_Bit5_Output_TX1_Over_Voltage_Fail                      (uint8_t)(0x10)
#define PPS3_Bit6_Output_TX1_Over_Voltage_Fail                      (uint8_t)(0x20)
#define PPS3_Bit7_TX1_Hazard1                                       (uint8_t)(0x40)
#define PPS3_Bit8_TX1_Hazard2                                       (uint8_t)(0x80)

/*Byte 4*/
#define PPS4_Bit1_TX2_link_with_RX                                  (uint8_t)(0x01)
#define PPS4_Bit2_TX2_Input_DC_Over_Current_Fail                    (uint8_t)(0x02)
#define PPS4_Bit3_TX2_Rectified_DC_Under_Voltage_Fail_270_uv        (uint8_t)(0x04)
//#define PPS4_Bit4_TX2_Rectified_DC_Over_Voltage_Fail	(uint8_t)(0x08)
#define PPS4_Bit5_Output_TX2_Over_Voltage_Fail                      (uint8_t)(0x10)
#define PPS4_Bit6_Output_TX2_Over_Voltage_Fail                      (uint8_t)(0x20)
#define PPS4_Bit7_TX2_Hazard1                                       (uint8_t)(0x40)
#define PPS4_Bit8_TX2_Hazard2                                       (uint8_t)(0x80)

/*Byte 5*/
#define PPS5_Bit1_TX3_link_with_RX                                  (uint8_t)(0x01)
#define PPS5_Bit2_TX3_Input_DC_Over_Current_Fail                    (uint8_t)(0x02)
#define PPS5_Bit3_TX3_Rectified_DC_Under_Voltage_Fail_270_uv        (uint8_t)(0x04)
//#define PPS5_Bit4_TX3_Rectified_DC_Over_Voltage_Fail                (uint8_t)(0x08)
#define PPS5_Bit5_Output_TX3_Over_Voltage_Fail                      (uint8_t)(0x10)
#define PPS5_Bit6_Output_TX3_Over_Voltage_Fail                      (uint8_t)(0x20)
#define PPS5_Bit7_TX3_Hazard1                                       (uint8_t)(0x40)
#define PPS5_Bit8_TX3_Hazard2                                       (uint8_t)(0x80)

/*Byte 6*/
#define PPS6_Bit1_WOW_Tellback_1    (uint8_t)(0x01)
#define PPS6_Bit2_WOW_Tellback_2    (uint8_t)(0x02)
#define PPS6_Bit3_WOW_Tellback_3  	(uint8_t)(0x04)

//PSM BIT DEFINITIONS
//**************************************************
//BYTE INFORMATION

/*Byte 4*/

#define PSM4_Bit7_battle_short_cmd		(uint8_t)(0x80)
#define PSM4_Bit6_uv_270v				(uint8_t)(0x40)
#define PSM4_Bit5_ov_temp_haz			(uint8_t)(0x20)
#define PSM4_Bit4_ps_interlock_n 		(uint8_t)(0x10)
#define PSM4_Bit3_ac_loss				(uint8_t)(0x08)
#define PSM4_Bit2_uc_interlock_o		(uint8_t)(0x04)
#define PSM4_Bit1_lcu_rdy_uc			(uint8_t)(0x02)
#define PSM4_Bit0_rdr_on_sts			(uint8_t)(0x01)

/*Byte 3*/
#define PSM3_Bit7_pwr_err				(uint8_t)(0x80)
#define PSM3_Bit6_blko_tst				(uint8_t)(0x40)
#define PSM3_Bit5_ov_350v				(uint8_t)(0x20)
#define PSM3_Bit4_uv_350v				(uint8_t)(0x10)
#define PSM3_Bit3_3sec_in				(uint8_t)(0x08)
#define PSM3_Bit2_wow_out				(uint8_t)(0x04)
#define PSM3_Bit1_uv_13v_b				(uint8_t)(0x02)
#define PSM3_Bit0_ov_13v_b				(uint8_t)(0x01)

/*Byte 2*/
#define PSM2_Bit7_uv_3v3				(uint8_t)(0x80)
#define PSM2_Bit6_ov_3v3				(uint8_t)(0x40)
#define PSM2_Bit5_uv_5v					(uint8_t)(0x20)
#define PSM2_Bit4_ov_5v					(uint8_t)(0x10)
#define PSM2_Bit3_uv_15v				(uint8_t)(0x08)
#define PSM2_Bit2_ov_15v				(uint8_t)(0x04)
#define PSM2_Bit1_uv_m15v				(uint8_t)(0x02)
#define PSM2_Bit0_ov_m15v				(uint8_t)(0x01)

/*Byte 1*/
#define PSM1_Bit7_ov_dc_bus_current		(uint8_t)(0x80)
#define PSM1_Bit6_ov_board_temp			(uint8_t)(0x40)
#define PSM1_Bit5_ov_temp_haz_2			(uint8_t)(0x20)
#define PSM1_Bit4_rs232_comm			(uint8_t)(0x10)
#define PSM1_Bit3_rs485_comm			(uint8_t)(0x08)
#define PSM1_Bit2_rs422_comm			(uint8_t)(0x04)
#define PSM1_Bit1_PSM_EIF_comm			(uint8_t)(0x02)


#endif // XLRU_BYTES_DEF_H
