#ifndef SOURCE_COMM_H_ #define SOURCE_COMM_H_ typedef struct ClassCommCheck { Uint16 CarComputer; Uint16 Gcu; Uint16 Ecu; } CCommCheck; typedef struct ClassTx100 { struct { Uint16 Heartbit : 16; Uint16 : 8; Uint16 : 8; Uint16 : 8; Uint16 VersionMajor : 8; Uint16 VersionMinor : 8; Uint16 VersionPatch : 8; } ApuData; } CTx100; typedef struct ClassTx101 { struct { /* byte 0 */ Uint16 PlayState : 3; Uint16 : 5; /* byte 1 */ Uint16 AlarmOccured : 1; Uint16 Emergency : 1; Uint16 PowerSwitch : 1; Uint16 : 5; /* byte 2 */ Uint16 GcuPlayState : 3; Uint16 : 5; /* byte 3 */ Uint16 GcuAlarmOccured : 1; Uint16 GcuShutdown : 1; Uint16 : 6; /* byte 4 */ Uint16 EcuAlarmOccured : 1; Uint16 EcuPlayState : 3; Uint16 OverrideActive : 1; Uint16 GlowPlugActive : 1; Uint16 HeaterActive : 1; Uint16 OilPressureMissing : 1; } ApuData; } CTx101; typedef struct ClassTx102 { struct { Uint16 PlayCommand : 4; // 0:3 bit Uint16 rsvd_padding1 : 4; // 4:7 bit Uint16 rsvd_padding2 : 8; // 1 byte Uint16 rsvd_padding3 : 16; // 2:3 byte Uint16 rsvd_padding4 : 16; // 4:5 byte Uint16 rsvd_padding5 : 16; // 6:7 byte } GcuCommand; } CTx102; typedef struct ClassTx103 { struct { Uint16 EngineStart : 8; // 0 byte Uint16 EngineStop : 8; // 1 byte Uint16 rsvd_padding1 : 8; // 2 byte Uint16 rsvd_padding2 : 8; // 3 byte Uint16 RpmSetpoint : 16; // 4:5 byte Uint16 Override : 8; // 6 byte Uint16 Emergency : 8; // 7 byte } EcuCommand; } CTx103; typedef struct ClassTx110 { union { Uint16 uiTotal; struct { Uint16 PcbOverHeat : 1; // 0 bit Uint16 FetOverHeat : 1; // 1 bit Uint16 GenOverHeat1 : 1; // 2 bit Uint16 GenOverHeat2 : 1; // 3 bit Uint16 rsvd_padding : 12; // 16bit Á¤·ÄÀ» À§ÇÑ ÆÐµù } bit; } GcuWarning; union { Uint16 uiTotal; struct { Uint16 EngineOverHeat : 1; // 0 bit Uint16 LowOilLevel : 1; // 1 bit Uint16 IntakeOverHeat : 1; // 2 bit Uint16 IntakeLoPressure : 1; // 3 bit Uint16 EngineLoTemperature : 1; // 4 bit Uint16 EngineSensor : 1; // 5 bit Uint16 DefaltValueActive : 1; // 6 bit Uint16 rsvd_padding : 1; // 16bit Á¤·ÄÀ» À§ÇÑ ÆÐµù } bit; } EcuWarning; struct { CFaultBitValue ApuFault; }; union { Uint16 uiTotal; struct { Uint16 HwTrip : 1; // 0 bit Uint16 HwIgbt : 1; // 1 bit Uint16 HwDc : 1; // 2 bit Uint16 GenOverCurrentU : 1; // 3 bit Uint16 GenOverCurrentV : 1; // 4 bit Uint16 GenOverCurrentW : 1; // 5 bit Uint16 DcOverVoltage : 1; // 6 bit Uint16 DcOverCurrent : 1; // 7 bit Uint16 CrankningOverCurrent : 1; // 0 bit Uint16 PcbOverHeat : 1; // 1 bit Uint16 FetOverHeat : 1; // 2 bit Uint16 GenTempOverHeat1 : 1; // 3 bit Uint16 GenTempOverHeat2 : 1; // 4 bit Uint16 GenOverSpeed : 1; // 5 bit Uint16 ResolverIC : 1; // 6 bit Uint16 ResolverParity : 1; // 7 bit } bit; } GcuFault; union { Uint16 uiTotal; struct { Uint16 EngineOverHeat : 1; // 0 bit Uint16 LowOilPressure : 1; // 1 bit Uint16 Actuator : 1; // 2 bit Uint16 RpmSignal : 1; // 3 bit Uint16 EngineStartFail : 1; // 4 bit Uint16 rsvd_padding : 11; // 16bit Á¤·ÄÀ» À§ÇÑ ÆÐµù } bit; } EcuFault; } CTx110; typedef struct ClassTx120 { struct { Uint16 DcVoltage : 16; // 0:1 byte Uint16 DcCurrent : 16; // 2:3 byte Uint16 Rpm : 16; // 4:5 byte Uint16 rsvd_padding3 : 8; // 6 byte Uint16 rsvd_padding4 : 8; // 7 byte } GcuData; } CTx120; typedef struct ClassTx121 { struct { Uint16 PcbTemperature : 8; // 0 byte Uint16 FetTemperature : 8; // 1 byte Uint16 GenTemperature1 : 8; // 2 byte Uint16 GenTemperature2 : 8; // 3 byte Uint16 rsvd_padding1 : 8; // 4 byte Uint16 rsvd_padding2 : 8; // 5 byte Uint16 rsvd_padding3 : 8; // 6 byte Uint16 rsvd_padding4 : 8; // 7 byte } GcuData; } CTx121; typedef struct ClassTx130 { struct { Uint16 ActualRpm : 16; // 0:1 byte Uint16 SetRpm : 16; // 2:3 byte Uint16 ActualTorque : 8; // 4 byte Uint16 SetTorque : 8; // 5 byte Uint16 SystemVoltage : 16; // 6:7 byte } EcuData; } CTx130; typedef struct ClassTx131 { struct { Uint16 CoolantTemperature : 8; // 0 byte Uint16 Fan1Speed : 8; // 1 byte Uint16 Fan2Speed : 8; // 2 byte Uint16 CoolantPumpSpeed : 8; // 3 byte Uint16 BarometicPressure : 16; // 4:5 byte Uint16 rsvd_padding1 : 8; // 6 byte Uint16 rsvd_padding2 : 8; // 7 byte } EcuData; } CTx131; typedef struct ClassTx132 { struct { Uint16 TotalOperTimeL : 16; // 0:1 byte Uint16 TotalOperTimeH : 16; // 2:3 byte Uint16 rsvd_padding1 : 8; // 4 byte Uint16 rsvd_padding2 : 8; // 5 byte Uint16 rsvd_padding3 : 8; // 6 byte Uint16 rsvd_padding4 : 8; // 7 byte } EcuData; } CTx132; typedef struct ClassRx200 { struct { Uint16 HeartBit : 16; // 0:1 byte Uint16 rsvd_padding1 : 8; // 2 byte Uint16 rsvd_padding2 : 8; // 3 byte Uint16 rsvd_padding3 : 8; // 4 byte Uint16 VersionMajor : 8; // 5 byte Uint16 VersionMinor : 8; // 6 byte Uint16 VersionPatch : 8; // 7 byte } GcuData; } CRx200; typedef struct ClassRx201 { struct { Uint16 PlayState : 3; // 0:3 bit Uint16 rsvd_padding1 : 5; // 4:7 bit Uint16 AlarmOccured : 1; // 0 bit Uint16 Shutdown : 1; // 1 bit Uint16 rsvd_padding2 : 6; // 2:7 bit } GcuData; } CRx201; typedef struct ClassRx210 { union { Uint16 uiTotal; struct { Uint16 PcbOverHeat : 1; // 0 bit Uint16 FetOverHeat : 1; // 1 bit Uint16 GenOverHeat1 : 1; // 2 bit Uint16 GenOverHeat2 : 1; // 3 bit Uint16 rsvd_padding : 12; // 16bit Á¤·ÄÀ» À§ÇÑ ÆÐµù } bit; } GcuWarning; union { Uint16 uiTotal; struct { Uint16 HwTrip : 1; // 0 bit Uint16 HwIgbt : 1; // 1 bit Uint16 HwDc : 1; // 2 bit Uint16 GenOverCurrentU : 1; // 3 bit Uint16 GenOverCurrentV : 1; // 4 bit Uint16 GenOverCurrentW : 1; // 5 bit Uint16 DcOverVoltage : 1; // 6 bit Uint16 DcOverCurrent : 1; // 7 bit Uint16 CrankningOverCurrent : 1; // 0 bit Uint16 PcbOverHeat : 1; // 1 bit Uint16 FetOverHeat : 1; // 2 bit Uint16 GenTempOverHeat1 : 1; // 3 bit Uint16 GenTempOverHeat2 : 1; // 4 bit Uint16 GenOverSpeed : 1; // 5 bit Uint16 ResolverIC : 1; // 6 bit Uint16 ResolverParity : 1; // 7 bit } bit; }GcuFault; } CRx210; typedef struct ClassRx220 { struct { Uint16 DcVoltage : 16; // 0:1 byte Uint16 DcCurrent : 16; // 2:3 byte Uint16 Rpm : 16; // 4:5 byte Uint16 rsvd_padding : 16; // 6:7 byte } GcuData; } CRx220; typedef struct ClassRx221 { struct { Uint16 PcbTemperature : 8; // 0 byte Uint16 FetTemperature : 8; // 1 byte Uint16 GenTemperature1 : 8; // 2 byte Uint16 GenTemperature2 : 8; // 3 byte Uint16 rsvd_padding1 : 16; // 4:5 byte Uint16 rsvd_padding2 : 16; // 6:7 byte } GcuData; } CRx221; typedef struct ClassRx300 { struct { Uint16 VersionMajor : 8; // 0 byte Uint16 VersionMinor : 8; // 1 byte Uint16 VersionPatch : 8; // 2 byte Uint16 rsvd_padding1 : 8; // 3 byte Uint16 rsvd_padding2 : 16; // 4:5 byte Uint16 rsvd_padding3 : 16; // 6:7 byte } EcuData; } CRx300; typedef struct ClassRx301 { struct { Uint16 AlarmOccured : 1; // 0 bit Uint16 PlayState : 3; // 1:3 bit Uint16 OverrideActive : 1; // 4 bit Uint16 GlowPlugActive : 1; // 5 bit Uint16 HeaterActive : 1; // 6 bit Uint16 OilPressureMissing : 1; // 7 bit Uint16 rsvd_padding : 8; // 16bit Á¤·ÄÀ» À§ÇÑ ÆÐµù } OperationInfo; } CRx301; typedef struct ClassRx310 { union { Uint16 uiTotal; struct { Uint16 EngineOverHeat : 1; // 0 bit Uint16 reserved : 1; // 1 bit Uint16 LowOilLevel : 1; // 2 bit Uint16 IntakeOverHeat : 1; // 3 bit Uint16 IntakeLoPressure : 1; // 4 bit Uint16 EngineLoTemperature : 1; // 5 bit Uint16 EngineSensor : 1; // 6 bit Uint16 DefaltValueActive : 1; // 7 bit Uint16 rsvd_padding : 8; // 16bit Á¤·ÄÀ» À§ÇÑ ÆÐµù } bit; } EcuWarning; union { Uint16 uiTotal; struct { Uint16 OilPressureMissing : 1; // 0 bit Uint16 IntakeOverHeat : 1; // 1 bit Uint16 EngineOverHeat : 1; // 2 bit Uint16 Actuator : 1; // 3 bit Uint16 RpmSignal : 1; // 4 bit Uint16 EngineStartFail : 1; // 5 bit Uint16 rsvd_padding : 10; // 16bit Á¤·ÄÀ» À§ÇÑ ÆÐµù } bit; } EcuFault; } CRx310; typedef struct ClassRx320 { struct { Uint16 ActualRpm : 16; // 0:1 byte Uint16 SetRpm : 16; // 2:3 byte Uint16 ActualTorque : 8; // 4 byte Uint16 SetTorque : 8; // 5 byte Uint16 SystemVoltage : 16; // 6:7 byte } EcuData; } CRx320; typedef struct ClassRx321 { struct { Uint16 CoolantTemperature : 8; // 0 byte Uint16 Fan1Speed : 8; // 1 byte Uint16 Fan2Speed : 8; // 2 byte Uint16 CoolantPumpSpeed : 8; // 3 byte Uint16 BarometicPressure : 16; // 4:5 byte Uint16 rsvd_padding : 16; // 6:7 byte } EcuData; } CRx321; typedef struct ClassRx322 { struct { Uint16 TotalOperTimeL : 16; // 0:1 byte Uint16 TotalOperTimeH : 16; // 2:3 byte Uint16 rsvd_padding1 : 16; // 4:5 byte Uint16 rsvd_padding2 : 16; // 6:7 byte } EcuData; } CRx322; interrupt void CECanInterruptA(void); interrupt void CECanInterruptB(void); void CSendECanDataA(void); void CSendECanDataB(void); void CInitEcan(void); extern CCommCheck CommCheck; extern CTx102 Tx102; extern CTx103 Tx103; extern CRx210 Rx210; extern CRx220 Rx220; extern CRx221 Rx221; extern CRx310 Rx310; extern CRx320 Rx320; extern CRx321 Rx321; extern CRx322 Rx322; #endif /* SOURCE_COMM_H_ */