diff --git a/Comm.h b/Comm.h deleted file mode 100644 index 5fcdbd5..0000000 --- a/Comm.h +++ /dev/null @@ -1,696 +0,0 @@ -#ifndef SOURCE_COMM_H_ -#define SOURCE_COMM_H_ - -typedef struct ClassCommCheck -{ - Uint16 CarComputer; - Uint16 Gcu; - Uint16 Ecu; -} CCommCheck; - -typedef struct ClassTx100 -{ - /* BYTE 0~1 */ - Uint16 Heartbit; - - /* BYTE 2~4 Reserved */ - - /* BYTE 5 */ - Uint16 VersionMajor; - - /* BYTE 6 */ - Uint16 VersionMinor; - - /* BYTE 7 */ - Uint16 VersionPatch; -} CTx100; - -typedef struct ClassTx101 -{ - /* BYTE 0 */ - Uint16 PlayState; // 0~3 bit - - /* BYTE 1 */ - Uint16 DcuState; // bit 0:AlarmOccured, 1:Emergency, 2:PowerSwitch, 3:EcuFailSafe - - /* BYTE 2~7 Reserved */ - -} CTx101; - -typedef struct ClassTx102 -{ - /* BYTE 0 */ - Uint16 GcuCommand; // bit 0~3:PlayCommand, 4:FaultReset, 5:Emergency - - /* BYTE 1~7 Reserved */ - -} CTx102; - - -typedef struct ClassTx103 -{ - /* BYTE 0 */ - Uint16 EngineStart; - - /* BYTE 1 */ - Uint16 EngineStop; - - /* BYTE 2 */ - Uint16 FaultReset; - - /* BYTE 3 Reserved */ - - /* BYTE 4~5 */ - Uint16 RpmSetpoint; - - /* BYTE 6 */ - Uint16 ActiveOverride; - - /* BYTE 7 */ - Uint16 EmergencyStop; - -} CTx103; - -typedef struct ClassTx110 -{ - /* BYTE 0~3 */ - Uint16 DcuFaultB0; - Uint16 DcuFaultB1; - Uint16 DcuFaultB2; - Uint16 DcuFaultB3; - - /* BYTE 4~7 - Reserved */ - -} CTx110; - -typedef struct ClassTx120 -{ - /* BYTE 0 */ - Uint16 AuxTotal; // bit 0:EngineHeater, 1:GlowPlug, 2:Solenoid, 3:FuelPump, 4:CoolantPump, 5:Fan1, 6:Fan2 - - /* BYTE 1~7 - Reserved */ - -} CTx120; - -typedef struct ClassTx121 -{ - /* BYTE 0~1 */ - Uint16 EngHeatVoltage; - - /* BYTE 2~3 */ - Uint16 EngHeatCurrent; - - /* BYTE 4~5 */ - Uint16 GlowPlugVoltage; - - /* BYTE 6~7 */ - Uint16 GlowPlugCurrent; -} CTx121; - -typedef struct ClassTx122 -{ - /* BYTE 0~1 */ - Uint16 SolenoidVoltage; - - /* BYTE 2~3 */ - Uint16 SolenoidCurrent; - - /* BYTE 4~5 */ - Uint16 FuelPumpVoltage; - - /* BYTE 6~7 */ - Uint16 FuelPumpCurrent; -} CTx122; - -typedef struct ClassTx123 -{ - /* BYTE 0~1 */ - Uint16 CoolantPumpVoltage; - - /* BYTE 2~3 */ - Uint16 CoolantPumpCurrent; - - /* BYTE 4~5 */ - Uint16 Fan1Voltage; - - /* BYTE 6~7 */ - Uint16 Fan1Current; -} CTx123; - -typedef struct ClassTx124 -{ - /* BYTE 0~1 */ - Uint16 Fan2Voltage; - - /* BYTE 2~3 */ - Uint16 Fan2Current; - - /* BYTE 4~7 - Reserved */ - -} CTx124; - -typedef struct ClassRx200 -{ - /* BYTE 0~1 */ - Uint16 HeartBit; - - /* BYTE 2~4 - Reserved */ - - /* BYTE 5 */ - Uint16 VersionMajor; - - /* BYTE 6 */ - Uint16 VersionMinor; - - /* BYTE 7 */ - Uint16 VersionPatch; -} CRx200; - -typedef struct ClassRx201 -{ - /* BYTE 0 */ - Uint16 PlayState; // 0:3 bit PlayState - - /* BYTE 1 */ - Uint16 State; // bit 0:AlarmOccured, 1:Shutdown - - /* BYTE 2~7 - Reserved */ - -} CRx201; - -typedef struct ClassRx210 -{ - /* BYTE 0~1 */ - /* - * bit description - * 0:PcbOverHeat - * 1:FetOverHeat - * 2:GenOverHeat1 - * 3:GenOverHeat2 - */ - Uint16 GcuWarning; - - /* BYTE 2~3 */ - /* - * bit description - * 0:HwTrip - * 1:HwIgbt - * 2:HwDc - * 3:GenOverCurrentU - * 4:GenOverCurrentV - * 5:GenOverCurrentW - * 6:DcOverVoltage - * 7:DcOverCurrent - * - * 8:CrankningOverCurrent - * 9:PcbOverHeat - * 10:FetOverHeat - * 11:GenTempOverHeat1 - * 12:GenTempOverHeat2 - * 13:GenOverSpeed - * 14:ResolverIC - * 15:ResolverParity - */ - Uint16 GcuFault; - - /* BYTE 4~7 - Reserved*/ - -} CRx210; - -typedef struct ClassRx220 -{ - /* BYTE 0~1 */ - Uint16 DcVoltage; - - /* BYTE 2~3 */ - Uint16 DcCurrent; - - /* BYTE 4~5 */ - Uint16 Rpm; - - /* BYTE 6~7 */ - Uint16 Power; -} CRx220; - -typedef struct ClassRx221 -{ - /* BYTE 0 */ - Uint16 PcbTemperature; - - /* BYTE 1 */ - Uint16 FetTemperature; - - /* BYTE 2 */ - Uint16 GenTemperature1; - - /* BYTE 3 */ - Uint16 GenTemperature2; - - /* BYTE 4~7 - Reserved */ - -} CRx221; - -typedef struct ClassRx300 -{ - /* BYTE 0 */ - Uint16 VersionMajor; - - /* BYTE 1 */ - Uint16 VersionMinor; - - /* BYTE 2 */ - Uint16 VersionPatch; - - /* BYTE 3~7 - Reserved */ - -} CRx300; - -typedef struct ClassRx301 -{ - - /* BYTE 0 */ - /* - * bit description - * 0:AlarmOccured - * 1~3:PlayState - * 4:OverrideActive - * 5:GlowPlugActive - * 6:HeaterActive - * 7:OilPressureMissing - */ - Uint16 State; - - /* BYTE 1~7 - Reserved */ - -} CRx301; - -typedef struct ClassRx310 -{ - /* BYTE 0 */ - /* - * bit description - * 0:EngineOverHeat - * 1:Reserved - * 2:LoOilPressure - * 3:IntakeOverHeat - * 4:IntakeLoPressure - * 5:EngineLoTemperature - * 6:EngineSensor - * 7:DefaltValueActive - */ - Uint16 EcuWarning; - - /* BYTE 1 - Reserved */ - - /* BYTE 2 */ - /* - * bit description - * 0:OilPressureMissing - * 1:IntakeOverHeat - * 2:EngineOverHeat - * 3:Actuator - * 4:RpmSignal - * 5:EngineStartFail - * 6:Reserved - * 7:Reserved - */ - Uint16 EcuFault; - - /* BYTE 3~7 - Reserved */ - -} CRx310; - -typedef struct ClassRx320 -{ - /* BYTE 0~1 */ - Uint16 ActualRpm; - - /* BYTE 2~3 */ - Uint16 SetRpm; - - /* BYTE 4 */ - Uint16 ActualTorque; - - /* BYTE 5 */ - Uint16 SetTorque; - - /* BYTE 6~7 */ - Uint16 SystemVoltage; -} CRx320; - -typedef struct ClassRx321 -{ - /* BYTE 0 */ - Uint16 CoolantTemperature; - - /* BYTE 1 */ - Uint16 Fan1Speed; - - /* BYTE 2 */ - Uint16 Fan2Speed; - - /* BYTE 3 */ - Uint16 CoolantPumpSpeed; - - /* BYTE 4~5 */ - Uint16 BarometricPressure; - - /* BYTE 6~7 - Reserved */ - -} CRx321; - -typedef struct ClassRx322 -{ - /* BYTE 0~1 */ - Uint16 TotalOperTimeL : 16; - - /* BYTE 2~3 */ - Uint16 TotalOperTimeH : 16; - - /* BYTE 4~7 - Reserved*/ - -} CRx322; - -typedef struct ClassTx700 -{ - /* BYTE 0~1 */ - Uint16 HeartBit; - - /* BYTE 2 */ - Uint16 DCUversionMajor; - - /* BYTE 3 */ - Uint16 DCUversionMinor; - - /* BYTE 4 */ - Uint16 GCUversionMajor; - - /* BYTE 5 */ - Uint16 GCUversionMinor; - - /* BYTE 6 */ - Uint16 ECUversionMajor; - - /* BYTE 7 */ - Uint16 ECUversionMinor; -} CTx700; - -typedef struct ClassTx701 -{ - /* BYTE 0 */ - Uint16 DcuPlayState; // bit 0~3:PlayState - - /* BYTE 1 */ - /* - * bit description - * 0:DcuAlarmOccured - * 1:DcuEmergencyStop - * 2:PowerSwitchPush - * 3:EcuFailSafe - */ - Uint16 DcuState; - - /* BYTE 2 */ - Uint16 GcuPlayState; // bit 0~2:GcuPlayState - - /* BYTE 3 */ - /* - * bit description - * 0:GcuAlarmOccured - * 1:GcuShutdown - */ - Uint16 GcuState; - - /* BYTE 4 */ - /* - * bit description - * 0:EcuAlarmOccured - * 1~3:EcuPlayState - * 4:ActiveOverride - * 5:ActiveGlowPlug - * 6:ActiveEngHeater - * 7:OilPressureMissing - */ - Uint16 EcuState; - - /* BYTE 5~7 - Reserved */ - -} CTx701; - -typedef struct ClassTx710 -{ - /* BYTE 0 - GCU Warning */ - /* - * bit description - * 0:PcbOverHeat - * 1:FetOverHeat - * 2:Winding1OverHeat - * 3:Winding2OverHeat - */ - Uint16 GcuWarning; - - /* BYTE 1 - ECU Warning */ - /* - * bit description - * 0:EngineOverHeat - * 1:Reserved - * 2:LoOilPressure - * 3:IntakeOverHeat - * 4:IntakeLoPressure - * 5:EngineLoTemperature - * 6:EngineSensorFault - * 7:DefaultValueActive - */ - Uint16 EcuWarning; - - /* BYTE 2~7 - Reserved */ - -} CTx710; - -typedef struct ClassTx720 -{ - /* BYTE 0~3 - DCU Fault */ - Uint16 DcuFault0; - Uint16 DcuFault1; - Uint16 DcuFault2; - Uint16 DcuFault3; - - /* BYTE 4~5 - GCU Fault */ - Uint16 GcuFault0; - Uint16 GcuFault1; - - /* BYTE 6 - Reserved */ - - /* BYTE 7 */ - Uint16 EcuFault; -} CTx720; - -typedef struct ClassTx730 -{ - /* BYTE 0 */ - /* - * bit description - * 0:EngineHeater - * 1:GlowPlug - * 2:Solenoid - * 3:FuelPump - * 4:CoolantPump - * 5:Fan1 - * 6:Fan2 - * 7:Reserved - */ - Uint16 AuxState; - - /* BYTE 1~7 - Reserved */ - -} CTx730; - -typedef struct ClassTx731 -{ - /* BYTE 0~1 */ - Uint16 EngineHeaterVoltage; - - /* BYTE 2~3 */ - Uint16 EngineHeaterCurrent; - - /* BYTE 4~5 */ - Uint16 GlowPlugVoltage; - - /* BYTE 6~7 */ - Uint16 GlowPlugCurrent; -} CTx731; - -typedef struct ClassTx732 -{ - /* BYTE 0~1 */ - Uint16 SolenoidVoltage; - - /* BYTE 2~3 */ - Uint16 SolenoidCurrent; - - /* BYTE 4~5 */ - Uint16 FuelPumpVoltage; - - /* BYTE 6~7 */ - Uint16 FuelPumpCurrent; -} CTx732; - -typedef struct ClassTx733 -{ - /* BYTE 0~1 */ - Uint16 CoolantPumpVoltage; - - /* BYTE 2~3 */ - Uint16 CoolantPumpCurrent; - - /* BYTE 4~5 */ - Uint16 Fan1Voltage; - - /* BYTE 6~7 */ - Uint16 Fan1Current; -} CTx733; - -typedef struct ClassTx734 -{ - /* BYTE 0~1 */ - Uint16 Fan2Voltage; - - /* BYTE 2~3 */ - Uint16 Fan2Current; - - /* BYTE 4~7 - Reserved */ - -} CTx734; - -typedef struct ClassTx740 -{ - /* BYTE 0~1 */ - Uint16 Voltage; - - /* BYTE 2~3 */ - Uint16 Current; - - /* BYTE 4~5 */ - Uint16 Rpm; - - /* BYTE 6~7 */ - Uint16 Power; -} CTx740; - -typedef struct ClassTx741 -{ - /* BYTE 0 */ - Uint16 PcbTemperature; - - /* BYTE 1 */ - Uint16 FetTemperature; - - /* BYTE 2 */ - Uint16 Winding1Temperature; - - /* BYTE 3 */ - Uint16 Winding2Temperature; - - /* BYTE 4~7 - Reserved */ - -} CTx741; - -typedef struct ClassTx750 -{ - /* BYTE 0~1 */ - Uint16 ActualRpm; - - /* BYTE 2~3 */ - Uint16 SetRpm; - - /* BYTE 4 */ - Uint16 ActualTorque; - - /* BYTE 5 */ - Uint16 SetTorque; - - /* BYTE 6~7 */ - Uint16 SystemVoltage; -} CTx750; - -typedef struct ClassTx751 -{ - /* BYTE 0 */ - Uint16 CoolantTemperature; - - /* BYTE 1 */ - Uint16 Fan1Speed; - - /* BYTE 2 */ - Uint16 Fan2Speed; - - /* BYTE 3 */ - Uint16 CoolantPumpSpeed; - - /* BYTE 4~5 */ - Uint16 Barometric; - - /* BYTE 6~7 - Reserved */ - -} CTx751; - -typedef struct ClassTx752 -{ - /* BYTE 0~1 */ - Uint16 OperationTimeL; - - /* BYTE 2~3 */ - Uint16 OperationTimeH; - - /* BYTE 4~7 - Reserved */ - -} CTx752; - -interrupt void CECanInterruptA(void); -interrupt void CECanInterruptB(void); -void CSendECanDataA(void); -void CSendECanDataB(void); -void CInitEcan(void); - -extern CCommCheck CommCheck; -extern CRx200 Rx200; -extern CRx210 Rx210; -extern CRx220 Rx220; -extern CRx221 Rx221; -extern CRx300 Rx300; -extern CRx301 Rx301; -extern CRx310 Rx310; -extern CRx320 Rx320; -extern CRx321 Rx321; -extern CRx322 Rx322; - -typedef struct ClassRx400 -{ - struct - { - Uint16 BYTE0 : 8; - Uint16 BYTE1 : 8; - Uint16 BYTE2 : 8; - Uint16 BYTE3 : 8; - Uint16 BYTE4 : 8; - Uint16 BYTE5 : 8; - Uint16 BYTE6 : 8; - Uint16 BYTE7 : 8; - } Bytes; - struct - { - Uint16 EngineHeater : 1; - Uint16 GlowPlug : 1; - Uint16 Solenoid : 1; - Uint16 FuelPump : 1; - Uint16 CoolantPump : 1; - Uint16 Fan1 : 1; - Uint16 Fan2 : 1; - Uint16 AuxTestStart : 1; - Uint16 rsvd_padding : 8; - } AuxControl; -} CRx400; - -extern CRx400 Rx400; - -#endif /* SOURCE_COMM_H_ */