129 lines
3.9 KiB
C
Raw Permalink Normal View History

2023-08-21 16:48:00 +08:00
//DCM_DTC.h
#ifndef DCM_DTC_H
#define DCM_DTC_H
#include "DCM_Types.h"
#define DCM_19SUPDTCEXTDATARECORD_COUNT (4U)
/* 19 06֧<36>ֵ<EFBFBD>DTCExtDataRecord <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
#define DCM_SUPDTC_COUNT ( 14U )
/* <20><>Ʒ֧<C6B7>ֵ<EFBFBD>DTC<54><43><EFBFBD><EFBFBD> */
#define DTC_TEST_CYCLE_TIM 40U // 40mSһ<53><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
#define ISO_15031_6_DTC_FORMAT 0U
#define ISO_14229_1_DTC_FORMAT 1U
#define DTC_STATUS_AVAILABILITY_MASK 0x09U
typedef uint8 (*ReportDTCExtDataFun)(uint8* LeDemDtcNum,uint8 LeDemParameter,uint8* LeDemDataRecord);
/*19 06 <20><><EFBFBD><EFBFBD>֧<EFBFBD>ֵ<EFBFBD> DTCExtDataRecordNumber <20>б<EFBFBD><D0B1><EFBFBD><E1B9B9>*/
typedef struct
{
uint8 DTCExtDataRecordNumber; /*<2A><>չ<EFBFBD><D5B9><EFBFBD><EFBFBD>number*/
ReportDTCExtDataFun Function; /*<2A><>չ<EFBFBD><D5B9><EFBFBD><EFBFBD>number <20><>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD>Ĵ<EFBFBD><C4B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
}DTCExtDataRecordType;
typedef struct
{
uint8 DtcIndex;
uint8 DtcHigh; /*DTC <20><><EFBFBD>ֽ<EFBFBD>*/
uint8 DtcMiddle; /*DTC <20>м<EFBFBD><D0BC>ֽ<EFBFBD>*/
uint8 DtcLow; /*DTC <20><><EFBFBD>ֽ<EFBFBD>*/
}TsDcm_h_DtcGroupType;
typedef enum
{
TestFailed = 0x01,
TestFailedThisOperationCycle = 0x02,
PendingDTC = 0x04,
ConfirmedDTC = 0x08,
TestNotCompletedSinceLastClea = 0x10,
TestFailedSinceLastClear = 0x20,
TestNotCompletedThisOperationCycle = 0x40,
WarningIndicatorRequested =0x80,
}StatusOfDtc_T;
/******************************************************************************
* Description: : Global Variable Declaration Section
******************************************************************************/
extern const TsDcm_h_DtcGroupType CaDcm_u_DtcTable[DCM_SUPDTC_COUNT];
extern const DTCExtDataRecordType CaDcm_h_19DTCExtDataRecordTable[DCM_19SUPDTCEXTDATARECORD_COUNT];
typedef struct{
uint8 DtcStutas;
bool1 EepWrtEnable;
}DtcStutas_T;
extern DtcStutas_T DtcStutas[DCM_SUPDTC_COUNT];
#if 0
#define AC_BusOff 0
#define AC_CommunicationLostWithHMI 1
#define AC_CommunicationLostWithVCU 2
#define AC_CommunicationLostWithComp 3
#define AC_PTC_PressureSensorShortCircuit 4
#define AC_PTC_PressureSensorOpenCircuit 5
#define AC_BlowermotorShortCircuit 6
#define AC_BlowermotorOpenCircuit 7
#define AC_PressureSensorShortCircuit 8
#define AC_PressureSensorOpenCircuit 9
#define AC_CoolingPressureTooHight 10
#define AC_CoolingPressureTooLow 11
#define AC_COMP_InternalVoltageFault 12
#define AC_COMP_UnderVoltageFault 13
#define AC_COMP_OverVoltageFault 14
#define AC_COMP_OverCurrentFault 15
#define AC_COMP_TemperatureFault 16
#define AC_COMP_BusOff 17
#define AC_COMP_LossCommunicationWithAC 18
#define AC_EvaporatorTemperatureSensorOpenCircuit 19
#define AC_EvaporatorTemperatureSensorShortCircuit 20
#define AC_ServoMotorShortCircuit 21
#define AC_ServoMotorPositionFault 22
#define AC_LoopMotorShortCircuit 23
#define AC_LoopMotorPositionFault 24
#endif
#define AC_LOW_VOLTAGE 0
#define AC_OVER_VOLTAGE 1
#define AC_TEMP_MOTOR_SHORT_CUT_TO_VCC 2
#define AC_TEMP_MOTOR_SHORT_CUT_TO_GND 3
#define AC_TEMP_MOTOR_LOCK 4
#define AC_MODE_MOTOR_SHORT_CUT_TO_VCC 5
#define AC_MODE_MOTOR_SHORT_CUT_TO_GND 6
#define AC_MODE_MOTOR_LOCK 7
#define AC_REC_MOTOR_SHORT_CUT_TO_VCC 8
#define AC_REC_MOTOR_SHORT_CUT_TO_GND 9
#define AC_REC_MOTOR_LOCK 10
#define AC_EVA_SENSOR_SHORT_CUT_TO_VCC 11
#define AC_EVA_SENSOR_SHORT_CUT_TO_GND 12
#define AC_BusOff 13
extern uint8_t BusOffCnt ;
extern void CanDTC_Task(void);
extern uint8 MngDcm_ReportNumberOfDTCByStatusMask(void);
extern uint8 MngDcm_ReportDTCByStatusMask(void);
//extern uint8 MngDcm_ReportDTCSnapshotRecordByDTCNumber(void);
//extern uint8 MngDcm_ReportDTCExtendedDataRecordByDTCNumber(void);
extern uint8 MngDcm_ReportSupportedDTC(void);
extern bool1 MngDcm_CleanDtc(void);
extern void DtcInit(void);
extern void DtcStutasInit(void);
extern void DtcDiagConditionChk(void);
void ClearDtcStutas(uint8 DtcIndex);
#endif