/** * @file yfve_did_tbl.h * @author Yfve Team * @date January 30, 2018 * @brief DID table * * - This file contains: * - DID table * * @copyright Copyright 2018 Yanfeng Visteon Electronics Technology (Nanjing) Co., Ltd. All rights reserved. */ //#ifndef _YFVE_DID_TBL_H_ //#define _YFVE_DID_TBL_H_ #ifndef __UDS_DID_H__ #define __UDS_DID_H__ #ifdef __cplusplus extern "C" { #endif #include "uds_config.h" #define DID_FOREACH(func)\ /*01*/ func(0xF187,ECUManufacturerSparePartNumber,12,STORE_IN_RAM)\ /*02*/ func(0xF18A,SystemSupplierIdentifierData,10,STORE_IN_RAM)\ /*03*/ func(0xF197,SystemName,10,STORE_IN_RAM)\ /*04*/ func(0xF189,VehicleManufacturerECUSoftwareNumber,24,STORE_IN_RAM) \ /*05*/ func(0xF089,VehicleManufacturerECUHardwareNumber,8,STORE_IN_RAM) \ /*06*/ func(0xF193,SystemSupplierECUHardwareNumber,8,STORE_IN_RAM) \ /*07*/ func(0xF195,SystemSupplierECUSoftwareNumber,21,STORE_IN_RAM) \ /*08*/ func(0xF180,BootSoftwareNumber,8,STORE_IN_RAM)\ /*09*/ func(0xF190,VehicleIdentificationNumber,17,STORE_IN_FLASH) \ /*10*/ func(0xF010,EOLData,64,STORE_IN_FLASH) \ /*11*/ func(0xF18C,ECUSerialNumber,8,STORE_IN_FLASH) \ /*12*/ func(0xF184,FingerPrint,10,STORE_IN_FLASH) \ /*13*/ func(0xA000,ProgramTryCounter,2,STORE_IN_FLASH) \ /*14*/ func(0xA001,ProgramPassCounter,2,STORE_IN_FLASH) \ /*15*/ func(0x2F80,CurrentDCVolt,2,STORE_IN_RAM) \ /*16*/ func(0x2F81,DCUVariousTempProtectVal,2,STORE_IN_FLASH) \ /*17*/ func(0x2F82,DCVoltProtectVal,2,STORE_IN_FLASH) \ /*18*/ func(0x2F83,InsulationDectVolt,2,STORE_IN_FLASH) \ /*19*/ func(0x2F84,DCUVariousCurrentTempVal,2,STORE_IN_RAM) \ #define GENERATE_DID_INDEX(id,name,len,store) name, typedef enum _DID_INDEX { DID_FOREACH(GENERATE_DID_INDEX) DID_NUM, }DID_INDEX; /* this line below for yfve internal */ #define GENERATE_DID_ID(id,name,len,store) id , #define GENERATE_DID_LEN(id,name,len,store) eDID_LEN_##name = len, #define GENERATE_ARRAY(id,name,len,store) uint8_t DID_##name [len + 2]; #define GENERATE_DID_OFFSETS(id,name,len,store) offsetof(DIDs,DID_##name) , #define GENERATE_DID_SIZE(id,name,len,store) len , #define GENERATE_DID_STORE_FLAG(id,name,len,store) store##_GEN_FLAG(id,name,len) #define STORE_IN_FLASH_GEN_FLAG(id,name,len) 1, #define STORE_IN_RAM_GEN_FLAG(id,name,len) 0, typedef enum _DID_LEN { DID_FOREACH(GENERATE_DID_LEN) }eDID_LEN; typedef struct _DIDs { DID_FOREACH(GENERATE_ARRAY) }DIDs; //以下是仅需要存储的did #define GENERATE_DID_STORE_IN_FLASH_ID(id,name,len,store) store##_GEN_ID(id,name,len) #define GENERATE_DID_STORE_IN_FLASH_OFFSETS(id,name,len,store) store##_GEN_OFFSETS(id,name,len) #define GENERATE_DID_STORE_IN_FLASH_SIZE(id,name,len,store) store##_GEN_SIZE(id,name,len) #define GENERATE_DID_STORE_IN_FLASH_ARRAY(id,name,len,store) store##_GEN_ARRAY(id,name,len) #define GENERATE_DID_STORE_IN_FLASH_LEN(id,name,len,store) store##_GEN_LEN(id,name,len) #define GENERATE_DID_STORE_IN_FLASH_INDEX(id,name,len,store) store##_GEN_INDEX(id,name,len) #define STORE_IN_FLASH_GEN_ID(id,name,len) id , #define STORE_IN_RAM_GEN_ID(id,name,len) #define STORE_IN_FLASH_GEN_OFFSETS(id,name,len) offsetof(DIDS_NvmType,DID_##name) , #define STORE_IN_RAM_GEN_OFFSETS(id,name,len) #define STORE_IN_FLASH_GEN_SIZE(id,name,len) len , #define STORE_IN_RAM_GEN_SIZE(id,name,len) #define STORE_IN_FLASH_GEN_ARRAY(id,name,len) uint8_t DID_##name [len + 2]; #define STORE_IN_RAM_GEN_ARRAY(id,name,len) #define STORE_IN_FLASH_GEN_LEN(id,name,len) eDID_LEN_##name##_StoreInFlash = len, #define STORE_IN_RAM_GEN_LEN(id,name,len) #define STORE_IN_FLASH_GEN_INDEX(id,name,len) name##_StoreInFlash, #define STORE_IN_RAM_GEN_INDEX(id,name,len) typedef enum _DID_STORE_IN_FLASH_INDEX { DID_FOREACH(GENERATE_DID_STORE_IN_FLASH_INDEX) DID_StoreInFlash_NUM, }DID_STORE_IN_FLASH_INDEX; typedef enum _DID_STORE_IN_FLASH_LEN { DID_FOREACH(GENERATE_DID_STORE_IN_FLASH_LEN) }DID_STORE_IN_FLASH_LEN; typedef struct { DID_FOREACH(GENERATE_DID_STORE_IN_FLASH_ARRAY) }DIDS_NvmType; extern const uint16_t DIDOffset[]; extern const uint8_t DIDSize[]; extern const uint16_t DIDId[]; extern const uint16_t DIDStoreInFlashOffset[]; extern const uint16_t DIDStoreInFlashSize[]; extern const uint16_t DIDStoreInFlashId[]; uint8_t GetDIDIndexByID(uint16_t id); uint8_t GetDIDStoreInFlashIndexByID(uint16_t id); #define GetDIDIdByName(name) name #ifdef __cplusplus } #endif #endif /* _YFVE_DID_TBL_H_ */