CELIS/UDS/diagnosis_mid.h

118 lines
4.1 KiB
C
Raw Normal View History

#ifndef __DIAGNOSIS_MID_H__
#define __DIAGNOSIS_MID_H__
#include "uds_config.h"
#pragma anon_unions
#define PROGRAMMING_PASS_TIMEOUT_TIME 500 //5s
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>uds
typedef struct {
uint8_t IgnSts : 1; //ign״̬ 0:OFF 1:ON
// uint8_t IgnOff2On : 1; //ign״̬<D7B4><CCAC>OFF<46><46>ΪON<4F><4E><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ
uint8_t BattLow : 1; //<2F><>ƿ<EFBFBD><C6BF>ѹ
uint8_t BattHigh : 1; //<2F><>ƿ<EFBFBD><C6BF>ѹ
uint8_t Limphome : 1; //
uint8_t InOverVoltFault : 1; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѹ<EFBFBD><D1B9><EFBFBD><EFBFBD>
uint8_t InUnderVoltFault : 1; //<2F><><EFBFBD><EFBFBD>Ƿѹ<C7B7><D1B9><EFBFBD><EFBFBD>
uint8_t OutOverVoltFault : 1; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѹ<EFBFBD><D1B9><EFBFBD><EFBFBD>
uint8_t OutUnderVoltFault : 1; //<2F><><EFBFBD><EFBFBD>Ƿѹ<C7B7><D1B9><EFBFBD><EFBFBD>
uint8_t InOverCurFault : 1; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
uint8_t OutOverCurFault : 1; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
uint8_t OverTemperture : 1; //<2F><><EFBFBD>¹<EFBFBD><C2B9><EFBFBD>
uint8_t InputShort : 1; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD><C2B7><EFBFBD><EFBFBD>
uint8_t OutputShort : 1; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD><C2B7><EFBFBD><EFBFBD>
uint8_t PrechargeFault : 1; //Ԥ<><D4A4>ʧ<EFBFBD>ܹ<EFBFBD><DCB9><EFBFBD>
uint8_t FCDC_HardFault : 1; //FCDCӲ<43><D3B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
uint8_t ChargeOverTemp : 1; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¹<EFBFBD><C2B9><EFBFBD>
uint8_t FCDC_FanFault : 1; //FCDC<44><43><EFBFBD>ȹ<EFBFBD><C8B9><EFBFBD>
uint8_t FCDC_CC1Fault : 1; //FCDC<44><43><EFBFBD><EFBFBD>CC1<43><31>ǹ<EFBFBD><C7B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
uint8_t FCDC_InAstVoltFault : 1;//FCDC<44><43><EFBFBD><EFBFBD><EBB8A8><EFBFBD><EFBFBD>Դ<EFBFBD><D4B4>ѹ<EFBFBD><EFBFBD><ECB3A3><EFBFBD><EFBFBD>
uint8_t FCDCIGBT_OverTempFault : 1;//FCDCIGBT<42><54><EFBFBD>±<EFBFBD><C2B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
uint8_t BusoffCnt; //busoff<66><66><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>busoff<66><66>ÿ<EFBFBD>ָ<EFBFBD>һ<EFBFBD>ξ<EFBFBD><CEBE>ۼ<EFBFBD>1<EFBFBD><31>CAN<41><4E><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˳<EFBFBD>busoff<66><66><EFBFBD><EFBFBD><EFBFBD>
DTC_SnapshotType Snapshot;
}VehicleInfo2UdsType;
typedef struct {
uint8_t NcmRxEnable : 1;
uint8_t NcmTxEnable : 1;
uint8_t NmcmRxEnable : 1;
uint8_t NmcmTxEnable : 1;
uint8_t UdsOffLine : 1;
uint8_t EcuConfig;
}UdsInfo2VehicleType;
extern VehicleInfo2UdsType vehicleInfo2uds;
extern UdsInfo2VehicleType udsInfo2Vehicle;
extern INT32U g_ulRand;
extern uint32_t g_ulCanStatus;
extern uint8_t UdsSelfCheckFlag;
extern uint8_t UdsCalibrationFlag;
extern uint8_t EraseFlashMemory(uint32_t addr,uint32_t length);
extern uint8_t EraseEepromMemory(uint32_t addr,uint32_t length);
extern void GenRand(void);
extern INT8U Get0x19SerDiagData(INT8U *pOut,INT8U Type,INT8U *pdata);
extern INT16U Get0x22SerDiagData(INT8U *pOut);
extern INT8U Set0x2EDidDiagData(INT8U *pIn,INT16U PLen);
extern void SaveDtcRecode(INT16U Addr,INT32U DtcCode,INT8U Status,INT8U Acccnt);
extern void CheckDtcHsCanError(void);
extern void UdsQueueCanOut(void);
extern uint8_t GenerateSID27SeedValue(uint8_t *seed);
extern uint8_t GenerateSID27KeyValue(uint8_t levelType,uint8_t *seed,uint8_t *key);
extern INT8U Set0x2FDiagData(INT8U *pIn,INT16U PLen,INT8U *pOut,INT16U *RLen);
extern INT8U Set0x31DiagData(INT8U *pIn,INT16U PLen,INT8U *pOut,INT16U *RLen);
extern INT8U Set0x36DiagData(INT8U *pIn,INT16U PLen,INT8U *pOut,INT16U *RLen);
extern uint8_t EE_Write(uint8_t *pImage, const uint8_t *pData, uint32_t Len, void (*pCbFn)(uint32_t));
extern uint8_t EE_Read(uint8_t *pImage, uint8_t **pData);
extern void SetUdsUpdataFlag(void);
extern void DTC_SignalRecover(void);
extern uint8_t ClearCurrentDTCData(uint8_t i);
extern void ClearDtc(void);
extern void IO_InputOutputRelease(void);
extern void Uds_SetMsgMonitorTimer(uint16_t msgid);
extern void SnapshotRecordNumberGet(DTC_RecordDataBufType *record_data, uint16_t *dataBuf, uint8_t *num);
extern void UdsEncryptDate_Crc32Cal_Init(void);
extern void UdsEncryptDate_Crc32Cal_Update(const u8 *pData, u32 size);
extern uint32_t UdsEncryptDate_Crc32Cal_Final(void);
extern uint16_t UdsEncryptDate_Decrypt(uint8_t *src,uint16_t size_src);
extern void UdsEncryptDate_Xor(uint8_t *src,uint16_t size_src);
bool CheckVechileStatus(void);
bool CheckIsBatteryLow(void);
bool CheckIsBatteryHigh(void);
bool CheckIsIgnON(void);
bool CheckIsIgnOff2ON(void);
bool CheckIsTurnLeft_Short2Gnd(void);
bool CheckIsTurnLeft_Openload(void);
bool CheckIsTurnLeft_Normal(void);
bool CheckIsTurnRight_Short2Gnd(void);
bool CheckIsTurnRight_Openload(void);
bool CheckIsTurnRight_Normal(void);
bool CheckIsDRL_Short2Gnd(void);
bool CheckIsDRL_Openload(void);
bool CheckIsDRL_Normal(void);
bool CheckIsPosition_Short2Gnd(void);
bool CheckIsPosition_Openload(void);
bool CheckIsPosition_Normal(void);
bool CheckIsCanBusoff(void);
bool CheckIsNM_Limphome(void);
bool CheckIsFobUnlearn(void);
bool CheckIsVinUnwrite(void);
#endif