213 lines
8.1 KiB
C
Raw Permalink Normal View History

2023-08-21 16:48:00 +08:00
/*@处根据实际情况填写相关信息,将@字符以及这条提示语句去掉*/
/******************************************************************************
| File Name : Dcm_Cfg.h
| Description:
******************************************************************************/
#ifndef DCM_CFG_H
#define DCM_CFG_H
/******************************************************************************
* Description: : Include File Section
******************************************************************************/
#include "Dcm_App.h"
/******************************************************************************
* Description: : Macro Description Section
******************************************************************************/
#define YES 1
#define NO 0
#define DID_RECORD ( NO )
#define SID_RECORD ( YES )
#define DAMING_CAN_BOOT ( NO )
#define DCM_SUPPORTSID_COUNT 12U /*支持的SID数目*/
#define DCM_10SUB_COUNT 3U /*10服务子服务个数*/
#define DCM_11SUB_COUNT 2U /*11服务子服务个数*/
#define DCM_19SUB_COUNT 3U /*19服务子服务个数*/
#define DCM_27SUB_COUNT 2U /*27服务子服务个数*/
#define DCM_28SUB_COUNT 3U /*28服务子服务个数*/
#define DCM_31RID_COUNT 1U /*31服务子服务个数*/
#define DCM_RIDFF02_SUB_COUNT 3U /*31 FF02 支持的子服务个数*/
#define DCM_RIDFF00_SUB_COUNT 3U /*31 FF00 支持的子服务个数*/
#define DCM_RIDFF01_SUB_COUNT 3U /*31 FF01 支持的子服务个数*/
#define DCM_RIDF001_SUB_COUNT 3U /* 31 F001 支持的子服务个数 */
#define DCM_3ESUB_COUNT 1U /*3E服务子服务个数*/
#define DCM_85SUB_COUNT 2U /*85服务子服务个数*/
#define DCM_2CSUB_COUNT 2U /*2C服务子服务个数*/
#define DCM_14DTCGROUP_COUNT 3U /*14服务支持的DTC组个数*/
#if (defined (DAMING_CAN_BOOT) && (DAMING_CAN_BOOT == YES))
#define DCM_READ_DIDSUP_COUNT 15U /*22 服务支持的DID 个数 */
#else
#define DCM_READ_DIDSUP_COUNT 24U /* 22 服务支持的DID 个数 */
#endif
#define DCM_IO_DIDSUP_COUNT 5U /*2F 服务支持的DID 个数*/
#define DCM_PERIODIC_DATA_COUNT 0U /*2A 服务支持DID个数 */
#define DCM_WRITE_DIDSUP_COUNT 7U /*2E 服务支持的DID 个数*/
#define DCM_ONEDID_MAXDATALENGTH 20U /*22 单个DID 数据最大长度*/
/******************************************************************************
* Description: : Structure Type Declaration Section
******************************************************************************/
#define ROUTINECTRL_DID_CheckProgrammingIntegrity 0x0202
#define ROUTINECTRL_DID_CheckProgrammingPreconditions 0x0203
#define ROUTINECTRL_DID_CheckProgrammingDependencies 0xFF01
#define ROUTINECTRL_DID_EraseMemory 0xFF00
typedef TeDcm_h_ResultType (*ServerDealfunc)(void);
/*SID 条件检查项*/
typedef struct
{
uint8 SupportSession; /*支持的会话模式*/
uint8 SupportSecurityAccess; /*支持的安全权限*/
uint8 SupportRequestAddress; /*支持的请求方式*/
uint8 MinDL; /*SID 对应的最小DL*/
uint8 SubCount; /*子服务个数 */
uint8 Sid; /*SID */
ServerDealfunc SidFunction;
}TsDcm_h_SidCheckInfoType;
typedef TeDcm_h_ResultType (*SubDealfunc)(void );
typedef TeDcm_h_ResultType (*SubDealfuncWithPara)(uint8 );
/*子服务信息列表结构体*/
typedef struct
{
uint8 Sub; /*子服务*/
uint8 DL; /*子服务 对应的正确DL*/
SubDealfunc SubFunction; /*子服务 对应函数的处理函数*/
}TsDcm_h_SubCheckType;
typedef struct
{
uint8 Sub; /*子服务*/
uint8 DL; /*子服务 对应的正确DL*/
SubDealfuncWithPara SubFunction; /*子服务 对应函数的处理函数*/
}TsDcm_h_WithParaSubCheckType;
/*子服务信息列表结构体*/
typedef struct
{
uint8 Sub; /*子服务*/
uint8 DL; /*子服务 对应的正确DL*/
SubDealfunc SubFunction; /*子服务 对应函数的处理函数*/
}TsDcm_h_DtcCheckType;
typedef uint8 (*DidDealfunc)(uint8* LeDcm_u_DataAddress,uint8* LeDcm_u_DataLength);
/* 22 2E 2A服务 DID 信息列表结构体*/
typedef struct
{
uint8 SupportSession; /*支持的会话模式*/
uint8 SupportSecurityAccess; /*支持的安全权限*/
uint8 DataLength; /*数据长度*/
uint16 Did; /*具体DID*/
DidDealfunc Function; /*DID 对应函数的处理函数*/
}TsDcm_h_DidCheckType;
typedef struct
{
uint8 Did;
uint8 TransmissionMode;
uint16 TmCount;
}TsDcm_h_2APeriodicDidServe;
typedef TeDcm_h_ResultType (*DtcDealfunc)(uint32 LeDcm_DtcGroup);
/*14 服务信息列表结构体*/
#if 0
typedef struct
{
uint32 Dtc; /* DTC组 */
DtcDealfunc CleanFunction; /* 子服务 对应函数的处理函数 */
}TsDcm_h_DtcCheckType;
#endif
typedef TeDcm_h_ResultType (*RidDealfunc)(void);
/*Rid 支持的子服务及处理函数信息的列表结构体*/
typedef struct
{
uint8 Sub; /*子服务*/
uint8 DL; /*服务 对应的正确DL*/
RidDealfunc Function; /*服务 对应函数的处理函数*/
}TsDcm_h_RidSubCheckType;
/* 31服务 RID 信息列表结构体*/
typedef struct
{
uint8 SupportSession; /*支持的会话模式*/
uint8 SupportSecurityAccess; /*支持的安全权限*/
uint16 Rid; /*Rid*/
const TsDcm_h_RidSubCheckType* RidSubTable; /*Rid 支持的子服务列表*/
}TsDcm_h_RidCheckType;
typedef struct
{
uint8 write;
uint8 data;
}TsDcm_h_IO_parameter_t;
/******************************************************************************
* Description: : Global Variable Declaration Section
******************************************************************************/
extern const TsDcm_h_SidCheckInfoType CaDcm_h_SidCheckInfoTable[DCM_SUPPORTSID_COUNT];
/******************************************************************************
* Description: : Global Function Prototype Declaration
******************************************************************************/
extern uint8 MngDcm_SIDCheckAvailable(uint8 LeDcm_u_Sid);
extern uint8 MngDcm_SIDCheckSession(uint8 LeDcm_u_SidIndex);
extern uint8 MngDcm_SIDCheckSecurityAccess(uint8 LeDcm_u_SidIndex);
extern uint8 MngDcm_SIDFuncAddressAvailable(uint8 LeDcm_u_SidIndex);
extern uint8 MngDcm_SIDCheckMinDL(uint8 LeDcm_u_SidIndex,uint16 LeDcm_u_DL);
extern TeDcm_h_ResultType MngDcm_SessionControlService(void);
extern TeDcm_h_ResultType MngDcm_ECUResetService(void);
extern TeDcm_h_ResultType MngDcm_CleanDTCService(void);
extern TeDcm_h_ResultType MngDcm_ReportDTCService(void);
extern TeDcm_h_ResultType MngDcm_ReadDidDataService(void);
extern TeDcm_h_ResultType MngDcm_SecurityAccessService(void);
extern TeDcm_h_ResultType MngDcm_CommunicationControlService(void);
extern TeDcm_h_ResultType MngDcm_WriteDidDataService(void);
extern TeDcm_h_ResultType MngDcm_RoutineControlService(void);
extern TeDcm_h_ResultType MngDcm_TesterPresentService(void);
extern TeDcm_h_ResultType MngDcm_DTCSettingControlService(void);
extern TeDcm_h_ResultType MngDcm_ReadMemoryDataService(void);
extern TeDcm_h_ResultType MngDcm_SecurityAccessService(void);
extern TeDcm_h_ResultType MngDcm_WriteMemoryDataService(void);
extern TeDcm_h_ResultType MngDcm_ReadDataByIdentifier(void);
extern TeDcm_h_ResultType MngDcm_ReadDTCInfoService(void);
extern TeDcm_h_ResultType MngDcm_DynamicaDefineIdentifier(void);
extern TeDcm_h_ResultType MngDcm_IOCtrlDIDService(void);
extern TeDcm_h_ResultType MngDcm_DynamicaDefineIdentifier(void);
#endif