1e7070334c
Signed-off-by: lidun <1084178170@qq.com>
118 lines
4.1 KiB
C
118 lines
4.1 KiB
C
#ifndef __DIAGNOSIS_MID_H__
|
||
#define __DIAGNOSIS_MID_H__
|
||
|
||
#include "uds_config.h"
|
||
|
||
#pragma anon_unions
|
||
|
||
#define PROGRAMMING_PASS_TIMEOUT_TIME 500 //5s
|
||
|
||
//车身信息给到uds
|
||
typedef struct {
|
||
uint8_t IgnSts : 1; //ign状态 0:OFF 1:ON
|
||
// uint8_t IgnOff2On : 1; //ign状态由OFF变为ON后就置位
|
||
uint8_t BattLow : 1; //电瓶低压
|
||
uint8_t BattHigh : 1; //电瓶高压
|
||
uint8_t Limphome : 1; //
|
||
uint8_t InOverVoltFault : 1; //输入过压故障
|
||
uint8_t InUnderVoltFault : 1; //输入欠压故障
|
||
uint8_t OutOverVoltFault : 1; //输出过压故障
|
||
uint8_t OutUnderVoltFault : 1; //输出欠压故障
|
||
uint8_t InOverCurFault : 1; //输入过流故障
|
||
uint8_t OutOverCurFault : 1; //输出过流故障
|
||
uint8_t OverTemperture : 1; //过温故障
|
||
uint8_t InputShort : 1; //输入短路故障
|
||
uint8_t OutputShort : 1; //输出短路故障
|
||
uint8_t PrechargeFault : 1; //预充失败故障
|
||
uint8_t FCDC_HardFault : 1; //FCDC硬件故障
|
||
uint8_t ChargeOverTemp : 1; //充电座过温故障
|
||
uint8_t FCDC_FanFault : 1; //FCDC风扇故障
|
||
uint8_t FCDC_CC1Fault : 1; //FCDC检测CC1插枪检测故障
|
||
uint8_t FCDC_InAstVoltFault : 1;//FCDC输入辅助电源电压异常故障
|
||
uint8_t FCDCIGBT_OverTempFault : 1;//FCDCIGBT过温保护故障
|
||
|
||
uint8_t BusoffCnt; //busoff计数器,进入busoff后每恢复一次就累加1。CAN总线正常后退出busoff就清零。
|
||
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
|
||
|