123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423 |
- /********************************************************************************
- * 常州易控汽车电子股份有限公司
- * (c) Copyright 2009-2017 ECTEK
- * 保留所有权利
- ********************************************************************************
- * 工程名称:整车控制器
- * 文件名: HardwareLib.h
- * 功能描述 : 底层硬件驱总库
- * 引用记录:该文件被GlobalDef.h包含
- * 备注:
- * 修订记录:
- * 日期 版本 作者 描述
- * 2017.05.08 00.01.00 李中
- *******************************************************************************/
- #ifndef __HARDWARELIB_H
- #define __HARDWARELIB_H
- #include "Std_Types.h"
- #include "string.h"
- /*******************************************************************************************
- 公用函数库
- ********************************************************************************************/
- #define getbit(x, y) ((x) >> (y)&1) //获取x的第y位的数值
- #define setbit(x, y) x |= (1 << y) // x的第y位置1
- #define clrbit(x, y) x &= ~(1 << y) // x的第y位置0
- //一维查表插值
- uint16 Intpol_u16u16(uint16 *addrTablePUW, uint16 dataXUW); // 1维查表插值,X,Y都是16位无符号整数
- uint16 Intpol_s16u16(uint16 *addrTablePUW, sint16 dataXW); // 1维查表插值,X是有符号整数,Y是无符号整数
- sint16 Intpol_u16s16(uint16 *addrTablePUW, uint16 dataXUW); // 1维查表插值,X是无符号整数,Y是有符号整数
- sint16 Intpol_s16s16(uint16 *addrTablePUW, sint16 dataXW); // 1维查表插值,X,Y都是16位有符号整数
- uint32 Intpol_u16u32(uint16 *addrTablePUW, uint16 dataXUW); // 1维查表插值,X都是16位无符号整数,Y是无符号32位整数
- uint32 Intpol_u32u32(uint16 *addrTablePUW, uint32 dataXUI); // 1维查表插值,X,Y都是32位无符号整数
- //二维查表插值
- uint16 Intpol_u16u16u16(uint16 *addrTablePUW, uint16 dataXUW, uint16 dataYUW); // 2维查表插值,X,Y,Z都是16位无符号整数
- sint16 Intpol_u16u16s16(uint16 *addrTablePUW, uint16 dataXUW, uint16 dataYUW); // 2维查表插值,X,Y都是16位无符号,Z是有符号
- uint16 Intpol_u16s16u16(uint16 *addrTablePUW, uint16 dataXUW, sint16 dataYW); // 2维查表插值,X,Z都是16位无符号,Y是有符号
- sint16 Intpol_s16u16s16(uint16 *addrTablePUW, sint16 dataXW, uint16 dataYUW); // 2维查表插值,X,Z都是16位有符号,Y是无符号
- uint32 Intpol_u16u16u32(uint16 *addrTablePUW, uint16 dataXUW, uint16 dataYUW); // 2维查表插值,X,Y是无符号16位整数,Z是32位无符号整数
- // PT1滤波
- #define _COMLIB_FACTOR_PT1 1000
- void ComLib_PT1U8(uint8 valRawUB, uint16 K, uint16 T1, uint8 *valLstUB);
- void ComLib_PT1S8(sint8 valRawB, uint16 K, uint16 T1, sint8 *valLstB);
- void ComLib_PT1U16(uint16 valRawUW, uint16 K, uint16 T1, uint16 *valLstUW);
- void ComLib_PT1S16(sint16 valRawW, uint16 K, uint16 T1, sint16 *valLstW);
- void ComLib_PT1U32(uint32 valRawUI, uint16 K, uint16 T1, uint32 *valLstUI);
- void ComLib_PT1S32(sint32 valRawI, uint16 K, uint16 T1, sint32 *valLstI);
- /*******************************************************************************************
- 底层驱动接口
- ********************************************************************************************/
- typedef enum
- {
- DSM_DIAG_OPENLOAD = 0, /*开路*/
- DSM_DIAG_SHORTCIRCUIT, /*短路*/
- DSM_DIAG_SHORTTOGND, /*短路到地*/
- DSM_DIAG_SHORTTOPWR /*短路到电源*/
- } DSM_idxDiagTypeE_TYPE;
- typedef enum
- {
- DSM_STATUS_OK = 0x0, /*无故障*/
- DSM_STATUS_ERR = 0x1, /*有故障*/
- DSM_STATUS_NVA = 0xFF, /*故障状态未知或无效*/
- } DSM_stDiagE_TYPE;
- #define _PWM_DUTYCYCLE_FULL 10000U // 10000表示占空比为100.00%
- #define _PWM_DUTYCYCLE_FACTOR 100U
- #define _PWM_FREQ_FACTOR 10U //频率精度0.1Hz
- //模拟量输入********************************************************************************************
- #define _ATD_NUM_CHAN 24
- #define _ATD_INDEX_BAK1_CHAN 0 // BAK1信号,对应接插件X64
- #define _ATD_INDEX_BAK2_CHAN 1 // BAK2信号,对应接插件X26
- #define _ATD_INDEX_BAK3_CHAN 2 // BAK3信号,对应接插件X27
- #define _ATD_INDEX_BAK4_CHAN 3 // BAK4信号,对应接插件X35
- #define _ATD_INDEX_BAK5_CHAN 4 // BAK5信号,对应接插件X30
- #define _ATD_INDEX_BAK6_CHAN 5 // BAK6信号,对应接插件X31
- #define _ATD_INDEX_DI9_CHAN 6 // DI9信号,对应接插件X15
- #define _ATD_INDEX_DI8_CHAN 7 // DI8信号,对应接插件X11
- #define _ATD_INDEX_DI10_CHAN 8 // DI10信号,对应接插件X4
- #define _ATD_INDEX_BRAKE1_CHAN 10 //制动1,对应接插件X58
- #define _ATD_INDEX_ACCPED2_CHAN 11 //加速踏板2,对应接插件X63
- #define _ATD_INDEX_DI7_CHAN 12 // DI7信号,对应接插件X5
- #define _ATD_INDEX_DI1_CHAN 14 // DI1信号,对应接插件X10
- #define _ATD_INDEX_DI6_CHAN 15 // DI6信号,对应接插件X9
- #define _ATD_INDEX_BRAKE2_CHAN 16 //制动2,对应接插件X61
- #define _ATD_INDEX_ACCPED1_CHAN 17 //加速踏板1,对应接插件X62
- #define _ATD_INDEX_DI5_CHAN 19 // DI5信号,对应接插件X14
- #define _ATD_INDEX_DI4_CHAN 20 // DI4信号,对应接插件X13
- #define _ATD_INDEX_DI3_CHAN 21 // DI3信号,对应接插件X18
- #define _ATD_INDEX_DI2_CHAN 22 // DI2信号,对应接插件X17
- #define _ATD_INDEX_UBATTERY_CHAN 23 //蓄电池电压,内部连接
- /*应用层序号重新定义*/
- #define _ATD_INDEX_PLUGINTEMP1 2 //接插件温度1,对应接插件XK27
- #define _ATD_INDEX_PLUGINTEMP2 3 //接插件温度2,对应接插件XK35
- #define _ATD_INDEX_PLUGINTEMP3 4 //接插件温度3,对应接插件XK30
- #define _ATD_INDEX_PLUGINTEMP4 5 //接插件温度4,对应接插件XK31
- uint16 ATDDrv_GetChanResult(uint8 idxChanUB); //得到上述通道的电压值,电压值精度1/4095V/bit
- //********************************************************************************************
- //数字量输入********************************************************************************************
- #define _DIN_NUM_CHAN 16
- #define _DIN_NUM_ADCHAN 10 //前10路通过AD通道实现软件可配置上下拉
- #define _DIN_OPENLVL_LOW_STATE 0
- #define _DIN_OPENLVL_HIGH_STATE 1
- #define _DIN_INDEX_BAK1_CHAN 0 //开关1信号,对应接插件X10
- #define _DIN_INDEX_BAK2_CHAN 1 //开关2信号,对应接插件X17
- #define _DIN_INDEX_BAK3_CHAN 2 //开关3信号,对应接插件X18
- #define _DIN_INDEX_BAK4_CHAN 3 //开关4信号,对应接插件X13
- #define _DIN_INDEX_BAK5_CHAN 4 //开关5信号,对应接插件X14
- #define _DIN_INDEX_BAK6_CHAN 5 //开关6信号,对应接插件X9
- #define _DIN_INDEX_BAK7_CHAN 6 //开关7信号,对应接插件X5
- #define _DIN_INDEX_BAK8_CHAN 7 //开关8信号,对应接插件X11
- #define _DIN_INDEX_BAK9_CHAN 8 //开关9信号,对应接插件X15
- #define _DIN_INDEX_BAK10_CHAN 9 //开关10信号,对应接插件X4
- #define _DIN_INDEX_BAK11_CHAN 10 //开关11信号,对应接插件X7
- #define _DIN_INDEX_BAK12_CHAN 11 //开关12信号,对应接插件X6
- #define _DIN_INDEX_BAK13_CHAN 12 //开关13信号,对应接插件X3
- #define _DIN_INDEX_BAK14_CHAN 13 //开关14信号,对应接插件X19
- #define _DIN_INDEX_BAK15_CHAN 14 //开关15信号,对应接插件X22
- #define _DIN_INDEX_BAK16_CHAN 15 //开关16信号,对应接插件X23
- /*应用层序号重新定义*/
- #define _DIN_INDEX_X10 0 //开关1信号,对应接插件X10,输入交流接触器
- #define _DIN_INDEX_X17 1 //开关2信号,对应接插件X17,并充正负接触器
- #define _DIN_INDEX_X18 2 //开关3信号,对应接插件X18,A路至底座输出接触器
- #define _DIN_INDEX_X13 3 //开关4信号,对应接插件X13,A路至充电枪接触器
- #define _DIN_INDEX_X14 4 //开关5信号,对应接插件X14,B路至底座接触器
- #define _DIN_INDEX_X9 5 //开关6信号,对应接插件X9,B路至充电枪接触器
- #define _DIN_INDEX_X5 6 //开关7信号,对应接插件X5,A路熔断器
- #define _DIN_INDEX_X11 7 //开关8信号,对应接插件X11,B路熔断器
- #define _DIN_INDEX_X15 8 //开关9信号,对应接插件X15
- #define _DIN_INDEX_X4 9 //开关10信号,对应接插件X4
- #define _DIN_INDEX_X7 10 //开关11信号,对应接插件X7,A路辅助电源输出检测
- #define _DIN_INDEX_X6 11 //开关12信号,对应接插件X6,B路辅助电源输出检测
- #define _DIN_INDEX_X3 12 //开关13信号,对应接插件X3
- #define _DIN_INDEX_X19 13 //开关14信号,对应接插件X19
- #define _DIN_INDEX_X22 14 //开关15信号,对应接插件X22 互锁1
- #define _DIN_INDEX_X23 15 //开关16信号,对应接插件X23 互锁2
- void DINDrv_SetChanThres(uint8 idxChanUB, uint8 stOpenLvlUB, uint16 uThresUW);
- uint8 DINDrv_GetChanState(uint8 idxChanUB); //得到上述通道开关状态
- //********************************************************************************************
- //数字量输出********************************************************************************************
- #define _DO_NUM_CHAN 1
- #define _DO_INDEX_CPCTL_CHAN 0 // CP采样回路下拉电阻控制
- void DODrv_SetChanState(uint8 idxChanUB, uint8 bLvlUB); // bLvlUB表示电平状态,0为低电平,1为高电平
- //********************************************************************************************
- //频率量采集********************************************************************************************
- #define _PULSEACQ_NUM_CHAN 2
- #define _PULSEACQ_INDEX_CP_CHAN 0 //充电头CP信号采集,对应接插件X21
- #define _PULSEACQ_INDEX_BAK2_CHAN 1 //频率信号1采集,对应接插件X39
- //频率量采集重新定义(APP)
- #define _PULSEACQ_INDEX_HVLOCK2 1 //高压互锁的PWM采集,对应接插件XK39
- void PulseAcqDrv_GetChanFreq(uint8 idxChanUB, uint32 *fFreqUIP, uint16 *rDutyUWP); //获取通道的频率信息,频率精度0.1Hz/bit,占空比精度0.01%/bit
- void PulseAcqDrv_GetChanDura(uint8 idxChanUB, uint32 *tiPeriodUIP, uint32 *tiPosUIP); //获取通道的时间信息,时间精度0.02us/bit
- //********************************************************************************************
- //模拟量输出********************************************************************************************
- #define _AO_NUM_CHAN 2
- #define _AO_INDEX_ACCPED1_CHAN 0 //模拟油门信号1,对应接插件X27
- #define _AO_INDEX_ACCPED2_CHAN 1 //模拟油门信号2,对应接插件X31
- void AODrv_Interface(uint8 idxChanUB, uint16 uSetpointUW); //输出模拟量,输入目标电压值,电压值精度1/4095V/bit
- //********************************************************************************************
- // PWM型信号输出及频率型低边驱动********************************************************************************************
- #define _PPWM_NUM_CHAN 12
- #define _PPWM_INDEX_FHBAK1_CHAN 0 //高边驱动1,对应接插件X36
- #define _PPWM_INDEX_FHBAK2_CHAN 1 //高边驱动2,对应接插件X32
- #define _PPWM_INDEX_FHBAK3_CHAN 2 //高边驱动3,对应接插件X28
- #define _PPWM_INDEX_FHBAK4_CHAN 3 //高边驱动4,对应接插件X24
- #define _PPWM_INDEX_FHBAK5_CHAN 4 //高边驱动5,对应接插件X20
- #define _PPWM_INDEX_FHBAK6_CHAN 5 //高边驱动6,对应接插件X16
- #define _PPWM_INDEX_FHBAK7_CHAN 6 //高边驱动7,对应接插件X12
- #define _PPWM_INDEX_FHBAK8_CHAN 7 //高边驱动8,对应接插件X8
- #define _PPWM_INDEX_FBAK1_CHAN 8 //频率低边驱动1,对应接插件X38
- #define _PPWM_INDEX_FBAK2_CHAN 9 //频率低边驱动2,对应接插件X40
- #define _PPWM_INDEX_FBAK3_CHAN 10 //频率低边驱动3,对应接插件X45
- #define _PPWM_INDEX_FBAK4_CHAN 11 //频率低边驱动4,对应接插件X46
- //频率输出重新定义(APP)
- #define _PPWM_INDEX_HVLOCK2 8 //高压互锁PWM输出,对应接插件XK38
- //该函数须放在10ms任务中调用
- void PPWMDrv_Interface(uint8 idxChanUB, uint32 fSetUI, uint16 rSetUW); //输出上述通道的低边驱动频率及占空比,频率精度0.1Hz/bit,占空比精度0.01%/bit
- DSM_stDiagE_TYPE PPWMDrv_GetChanDiagInfo(uint8 idxChanUB, DSM_idxDiagTypeE_TYPE idxDiagTypeE);
- //********************************************************************************************
- //高低边驱动********************************************************************************************
- #define _PSWT_NUM_CHAN 17
- #define _PSWT_INDEX_HBAK1_CHAN 0 //高边驱动1,对应接插件X36
- #define _PSWT_INDEX_HBAK2_CHAN 1 //高边驱动2,对应接插件X32
- #define _PSWT_INDEX_HBAK3_CHAN 2 //高边驱动3,对应接插件X28
- #define _PSWT_INDEX_HBAK4_CHAN 3 //高边驱动4,对应接插件X24
- #define _PSWT_INDEX_HBAK5_CHAN 4 //高边驱动5,对应接插件X20
- #define _PSWT_INDEX_HBAK6_CHAN 5 //高边驱动6,对应接插件X16
- #define _PSWT_INDEX_HBAK7_CHAN 6 //高边驱动7,对应接插件X12
- #define _PSWT_INDEX_HBAK8_CHAN 7 //高边驱动8,对应接插件X8
- #define _PSWT_INDEX_LBAK1_CHAN 8 //低边驱动1,对应接插件X34
- #define _PSWT_INDEX_LBAK2_CHAN 9 //低边驱动2,对应接插件X44
- #define _PSWT_INDEX_LBAK3_CHAN 10 //低边驱动3,对应接插件X41
- #define _PSWT_INDEX_LBAK4_CHAN 11 //低边驱动4,对应接插件X43
- #define _PSWT_INDEX_LBAK5_CHAN 12 //低边驱动5,对应接插件X37
- #define _PSWT_INDEX_LBAK6_CHAN 13 //低边驱动6,对应接插件X42
- #define _PSWT_INDEX_LBAK7_CHAN 14 //低边驱动7,对应接插件X47
- #define _PSWT_INDEX_LBAK8_CHAN 15 //低边驱动8,对应接插件X48
- #define _PSWT_INDEX_MAINRELAY_CHAN 16 //功率电主继电器,对应接插件X33
- /*应用层序号重新定义*/
- #define _PSWT_INDEX_X36 0 //高边驱动1,对应接插件X36,输入交流接触器控制
- #define _PSWT_INDEX_X32 1 //高边驱动2,对应接插件X32,A路BMS电源供电切换-B路
- #define _PSWT_INDEX_X28 2 //高边驱动3,对应接插件X28,A路24V常供电电源控制
- #define _PSWT_INDEX_X24 3 //高边驱动4,对应接插件X24,B路24V常供电电源控制
- #define _PSWT_INDEX_X20 4 //高边驱动5,对应接插件X20,A/B路控制输出切换
- #define _PSWT_INDEX_X16 5 //高边驱动6,对应接插件X16,A/B路 S+/S-切换
- #define _PSWT_INDEX_X12 6 //高边驱动7,对应接插件X12,A/B路电子锁控制切换
- #define _PSWT_INDEX_X8 7 //高边驱动8,对应接插件X8,A/B路辅助电源切换
- //该函数须放在10ms任务中调用
- void PSwtDrv_Interface(uint8 idxChanUB, uint8 bOpenUB); //输出上述通道的低边驱动状态, bOpen=1时为打开, 否则为关闭
- DSM_stDiagE_TYPE PSwtDrv_GetChanDiagInfo(uint8 idxChanUB, DSM_idxDiagTypeE_TYPE idxDiagTypeE);
- //********************************************************************************************
- // CAN通讯接口********************************************************************************************
- #define _MCAN_NUM_CHAN 3
- /*
- * CAN0具备32个收发缓存,带电源隔离
- * CAN1具备64个收发缓存,带CAN唤醒
- * CAN2具备32个收发缓存,其中MO24~31由底层CCP、UDS等协议占用
- */
- #define _MCAN_DIR_RX 0
- #define _MCAN_DIR_TX 1
- #define _MCAN_IDE_STD 0
- #define _MCAN_IDE_EXT 1
- typedef enum
- {
- MCAN_Status_ok = 0x00000000,
- MCAN_Status_notInitialised = 0x00000001,
- MCAN_Status_wrongParam = 0x00000002,
- MCAN_Status_wrongPin = 0x00000004,
- MCAN_Status_busHeavy = 0x00000008,
- MCAN_Status_busOff = 0x00000010,
- MCAN_Status_notSentBusy = 0x00000020,
- MCAN_Status_receiveEmpty = 0x00000040,
- MCAN_Status_messageLost = 0x00000080,
- MCAN_Status_newData = 0x00000100,
- MCAN_Status_newDataButOneLost = MCAN_Status_messageLost | MCAN_Status_newData
- } MCAN_stRetE_TYPE;
- typedef enum
- {
- MCAN_NODEMODE_MO = 0, // MO模式下,每个MO对应一个具体的报文
- MCAN_NODEMODE_BUF = 1, // BUF模式,接收使用一个MO处理,其它MO成为发送缓存
- MCAN_NODEMODE_UNKNOWN = 0xFF,
- } MCANDrv_idxNodeModeE_TYPE;
- typedef union
- {
- uint32 U;
- struct
- {
- uint32 DLC : 8; //数据长度
- uint32 DIR : 1; // 0为接收,1为发送
- uint32 IDE : 1; // 0为标准帧,1为扩展帧
- uint32 Reserved : 6;
- uint32 CAN : 8; // CAN通道号
- uint32 MO : 8; // MO序号
- } B;
- } MCANDrv_infoMsgParU_TYPE;
- typedef struct
- {
- MCANDrv_infoMsgParU_TYPE infoMsgParU;
- uint32 infoMsgIDUI;
- } MCANDrv_infoMsgConfS_TYPE;
- typedef struct
- {
- MCANDrv_infoMsgConfS_TYPE infoConfS;
- uint8 datMsgUBA[8];
- } MCANDrv_infoMsgS_TYPE;
- typedef void (*pFunc_TxMsgCallback)(void);
- typedef void (*pFunc_RxMsgCallback)(MCANDrv_infoMsgS_TYPE infoMsgS);
- /*CAN设置函数*/
- uint8 MCANDrv_SetBaudrate(uint8 idxCANUB, uint32 baudrateUI);
- uint8 MCANDrv_SetCANMode(uint8 idxCANUB, MCANDrv_idxNodeModeE_TYPE idxNodeModeE);
- uint8 MCANDrv_SetMsgObj(const MCANDrv_infoMsgConfS_TYPE infoMsgConfS, void *pFunc);
- uint8 MCANDrv_SetCallbackFunc(uint8 idxCANUB, const pFunc_RxMsgCallback pRxFunc, const pFunc_TxMsgCallback pTxFunc);
- /*CAN操作函数*/
- MCAN_stRetE_TYPE MCANDrv_SendMsg(const MCANDrv_infoMsgS_TYPE infMsgS);
- uint8 MCANDrv_CheckIfBusOff(uint8 idxCANUB); //返回1表示有busoff错误
- //********************************************************************************************
- /*EEPROM处理接口*/
- extern uint8 EEPROMDrv_bSaveInstantUB; //用于立即触发EEPROM的存储,置1后可查询其值为0时表示存储完成
- /*******************************************************************************************
- 底层已处理物理量
- ********************************************************************************************/
- extern uint16 BattCD_uFltUW; //蓄电池电压,1/100V/bit
- extern uint16 BattCD_tPwrChipUW; //电源芯片温度
- extern uint32 SysCon_tiRunHighResiUI; //系统运行时间
- typedef union
- {
- uint8 U;
- struct
- {
- uint8 bCAN : 1;
- uint8 bLogic : 1;
- uint8 bWkpSig1 : 1;
- uint8 bWkpSig2 : 1;
- uint8 : 4;
- } B;
- } BattCD_stWakeupU_TYPE;
- extern BattCD_stWakeupU_TYPE BattCD_stWakeupU;
- extern uint8 HardwareDrv_bBootloaderReqUB; //进入Bootloader请求,当出现该请求时会将BattCD_stWakeupU清零,在进入Afterrun时,进行进入安全状态的操作
- /*******************************************************************************************
- 整车控制状态
- *******************************************************************************************/
- extern uint32 SysCon_tiRunLowUI; //从上次复位到现在系统的运行时间,单位s
- /*******************************************************************************************
- * 故障管理模块接口
- ******************************************************************************************/
- /*******************************************************************************************
- 故障诊断
- ********************************************************************************************/
- #define _DSM_NUM_CONF_DFC_CHECKS 100 /*最大允许的故障号数*/
- #define _DSM_NUM_CONF_DINH_FIDS 32 /*最大允许的故障禁止操作数*/
- #define _DSM_NUM_CONF_DFES_ENTRIES 20 /*最大存储并向外报送的故障数*/
- #define _DINH_NUM_DFC_FID_MAX 6 /*每个故障号最多可关联的故障禁止操作数*/
- /*故障号定义DFC*/
- /*********************************************************************************************/
- /*样例代码*/
- #ifdef _SAMPLE_CODE_
- #define _DFC_INDEX_ACCPED_SIGHIGH 0 /*油门1信号ACCPED高*/
- #define _DFC_INDEX_ACCPED_SIGLOW 1 /*油门1信号ACCPED低*/
- #define _DFC_INDEX_ACCPED_SIGHNPL 2 /*油门信号ACCPED不合理*/
- #define _DFC_INDEX_ACCPED2_SIGHIGH 3 /*油门2信号ACCPED高*/
- #define _DFC_INDEX_ACCPED2_SIGLOW 4 /*油门2信号ACCPED低*/
- #endif //_SAMPLE_CODE_
- /*********************************************************************************************/
- /*故障禁止操作定义FID*/
- /*底层用FID*/
- #define _DINH_INDEX_FID_DSM_WUC 0 /*故障诊断系统的暖机循环计数是否禁止*/
- #define _DINH_INDEX_FID_DSM_TST 1 /*下线检测故障屏蔽功能是否使用*/
- /*********************************************************************************************/
- /*样例代码*/
- #ifdef _SAMPLE_CODE_
- #define _DINH_INDEX_FID_APP1 2 /*加速踏板1信号故障失效模式*/
- #define _DINH_INDEX_FID_APP2 3 /*加速踏板2信号故障失效模式*/
- #define _DINH_INDEX_FID_ACCPED_NPL 4 /*油门1和油门2 进行互捡*/
- #endif //_SAMPLE_CODE_
- /*********************************************************************************************/
- extern uint8 DFES_numMilUB; /*点亮故障灯的Memory Entry数目*/
- extern uint8 DFES_numSvsUB; /*点亮维修灯的Memory Entry数目*/
- extern uint8 DFES_bMilOnUB; /*故障灯是否点亮*/
- extern uint8 DFES_bMilBlinkUB; /*故障灯是否闪烁*/
- /*向DFC报告故障状*/
- /*使用举例:*/
- /*DFC_ReportFaultLevel(_DFC_INDEX_FTS_SIGHIGH,_DDRC_MASK_ANA_FT_LV_OK);*/
- /*DFC_ReportFaultLevel(_DFC_INDEX_FTS_SIGLOW,_DDRC_MASK_ANA_FT_LV_ERROR);*/
- #define _DDRC_MASK_ANA_FT_LV_OK 0x0
- #define _DDRC_MASK_ANA_FT_LV_ERROR 0xF
- void DFC_ReportFaultLevel(uint16 idxDFCUW, uint8 stFaultLevelUB);
- /*获取DFC的故障状态*/
- /*返回值为0时,表示该DFC无故障;返回值为1时,表示该DFC故障*/
- uint8 DFC_GetErrState(uint16 idxDFCUW);
- /*获取DFC的故障累积状态*/
- #define _DFC_INDEX_PRELIMINARILY_DEFECTIVE_STATUS 1
- #define _DFC_INDEX_FINALLY_DEFECTIVE_STATUS 2
- #define _DFC_INDEX_PRELIMINARILY_HEALED_STATUS 3
- #define _DFC_INDEX_FINALLY_HEALED_STATUS 4
- uint8 DFC_GetDebState(uint16 idxDFCUW);
- /*获取FID的状态*/
- /*返回值为0时,表示未触发该FID;为1时,表示触发了该FID*/
- uint8 DINH_GetFIDState(uint8 idxFIDUB);
- #endif
|