2024-02-29 09:18:12 +00:00
|
|
|
|
#ifndef __DIAGNOSIS_MID_H__
|
|
|
|
|
#define __DIAGNOSIS_MID_H__
|
|
|
|
|
|
|
|
|
|
#include "uds_config.h"
|
|
|
|
|
|
|
|
|
|
#pragma anon_unions
|
|
|
|
|
|
2024-05-07 09:04:36 +00:00
|
|
|
|
#define PROGRAMMING_PASS_TIMEOUT_TIME 500 //5s base:10ms
|
|
|
|
|
#define OTA_TIMEOUT_TIME (6) //30min base:5min
|
2024-02-29 09:18:12 +00:00
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
INPUT_OVERVOLTAGE) \
|
|
|
|
|
INPUT_UNDERVOLTAGE) \
|
|
|
|
|
CHARGE_TEMP_DERATE) \
|
|
|
|
|
INTER_TEMP_DERATE) \
|
|
|
|
|
INTER_OVERTEMP) \
|
|
|
|
|
CHARGE_OVERTEMP) \
|
|
|
|
|
DC_POS_RELAY_ADH) \
|
|
|
|
|
DC_NEG_RELAY_ADH) \
|
|
|
|
|
AC_POS_RELAY_ADH) \
|
|
|
|
|
AC_NEG_RELAY_ADH) \
|
|
|
|
|
HV_INTERLOCK) \
|
|
|
|
|
CC_CC2_RELAY_CTRL_INV) \
|
|
|
|
|
CP_CC1_RELAY_CTRL_INV) \
|
|
|
|
|
DCU_VOL_ABN)
|
|
|
|
|
*/
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>uds
|
|
|
|
|
typedef struct {
|
|
|
|
|
uint8_t IgnSts : 1; //ign״̬ 0:OFF 1:ON
|
|
|
|
|
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> 0:<3A><><EFBFBD><EFBFBD> 1:<3A><><EFBFBD><EFBFBD>
|
|
|
|
|
uint8_t InUnderVoltFault : 1; //<2F><><EFBFBD><EFBFBD>Ƿѹ<C7B7><D1B9><EFBFBD><EFBFBD> 0:<3A><><EFBFBD><EFBFBD> 1:<3A><><EFBFBD><EFBFBD>
|
|
|
|
|
uint8_t ChargeTempDerateFault : 1; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¶Ƚ<C2B6><C8BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 0:<3A><><EFBFBD><EFBFBD> 1:<3A><><EFBFBD><EFBFBD>
|
|
|
|
|
uint8_t InterTempDerateFault : 1; //<2F>ڲ<EFBFBD><DAB2>¶Ƚ<C2B6><C8BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 0:<3A><><EFBFBD><EFBFBD> 1:<3A><><EFBFBD><EFBFBD>
|
|
|
|
|
uint8_t InterOverTempFault : 1; //<2F>ڲ<EFBFBD><DAB2>¶ȹ<C2B6><C8B9>¹<EFBFBD><C2B9><EFBFBD> 0:<3A><><EFBFBD><EFBFBD> 1:<3A><><EFBFBD><EFBFBD>
|
|
|
|
|
uint8_t ChargeOverTempFault : 1; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¹<EFBFBD><C2B9><EFBFBD> 0:<3A><><EFBFBD><EFBFBD> 1:<3A><><EFBFBD><EFBFBD>
|
|
|
|
|
uint8_t DcPosRelayAdhFault : 1; //ֱ<><D6B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̵<EFBFBD><CCB5><EFBFBD>ճ<EFBFBD><D5B3> 0:<3A><><EFBFBD><EFBFBD> 1:<3A><><EFBFBD><EFBFBD>
|
|
|
|
|
uint8_t DcNegRelayAdhFault : 1; //ֱ<><D6B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̵<EFBFBD><CCB5><EFBFBD>ճ<EFBFBD><D5B3> 0:<3A><><EFBFBD><EFBFBD> 1:<3A><><EFBFBD><EFBFBD>
|
|
|
|
|
uint8_t AcPosRelayAdhFault : 1; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̵<EFBFBD><CCB5><EFBFBD>ճ<EFBFBD><D5B3> 0:<3A><><EFBFBD><EFBFBD> 1:<3A><><EFBFBD><EFBFBD>
|
|
|
|
|
uint8_t AcNegRelayAdhFault : 1; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̵<EFBFBD><CCB5><EFBFBD>ճ<EFBFBD><D5B3> 0:<3A><><EFBFBD><EFBFBD> 1:<3A><><EFBFBD><EFBFBD>
|
|
|
|
|
uint8_t HvInterlockFault : 1; //<2F><>ѹ<EFBFBD><D1B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 0:<3A><><EFBFBD><EFBFBD> 1:<3A><><EFBFBD><EFBFBD>
|
|
|
|
|
uint8_t CcCc2RelayCtrlInv : 1; //CC/CC2<43><32><EFBFBD>Ƽ̵<C6BC><CCB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧЧ 0:<3A><><EFBFBD><EFBFBD> 1:<3A><><EFBFBD><EFBFBD>
|
|
|
|
|
uint8_t CpCc1RelayCtrlInv : 1; //CC/CC2<43><32><EFBFBD>Ƽ̵<C6BC><CCB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧЧ 0:<3A><><EFBFBD><EFBFBD> 1:<3A><><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
uint16_t CurrDcVolt; //<2F><>ǰֱ<C7B0><D6B1><EFBFBD><EFBFBD>ѹ 0.1V
|
|
|
|
|
uint8_t ChargeTemp; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¶<EFBFBD>ֵ <20><>C
|
|
|
|
|
uint8_t BoardTemp; //<2F><><EFBFBD><EFBFBD><EFBFBD>¶<EFBFBD>ֵ <20><>C
|
2024-05-07 09:04:36 +00:00
|
|
|
|
// uint8_t OtaModeSts; //OTA ģʽ״̬ 0:not in ota 1:in transition ota 2:in ota
|
2024-02-29 09:18:12 +00:00
|
|
|
|
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;
|
|
|
|
|
uint8_t DCDCEnable; //0x00:ENABLE 0x01:DISABLE
|
|
|
|
|
uint8_t ChargeTempProtVal; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¶ȱ<C2B6><C8B1><EFBFBD>ֵ <20><>C ƫ<><C6AB>-40
|
|
|
|
|
uint8_t BoardTempProtVal; //<2F><><EFBFBD><EFBFBD><EFBFBD>¶ȱ<C2B6><C8B1><EFBFBD>ֵ <20><>C ƫ<><C6AB>-40
|
|
|
|
|
uint16_t DCVoltProtVal; //ֱ<><D6B1><EFBFBD><EFBFBD>ѹ<EFBFBD><D1B9><EFBFBD><EFBFBD>ֵ 0.1V
|
|
|
|
|
uint16_t InsulDetVoltVal; // <20><>Ե<EFBFBD><D4B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѹ 0.1V
|
|
|
|
|
uint8_t DTCNum; //DTC<54><43><EFBFBD><EFBFBD>
|
|
|
|
|
uint8_t DTCList[DTC_ID_NUM];
|
2024-05-07 09:04:36 +00:00
|
|
|
|
uint8_t OtaModeSts; //OTA ģʽ״̬ 0:not in ota 1:in transition ota 2:in ota
|
2024-02-29 09:18:12 +00:00
|
|
|
|
}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
|
|
|
|
|
|