1.5wuling_zhuanjietou/UDS/diagnosis_mid.h
2024-10-17 09:06:51 +08:00

108 lines
3.4 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#ifndef __DIAGNOSIS_MID_H__
#define __DIAGNOSIS_MID_H__
#include "uds_config.h"
#pragma anon_unions
//车身信息给到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 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 seed_value[2];
extern uint8_t key_value[2];
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 uint16_t GenerateSID27KeyValue(uint16_t seed);
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 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