/** * @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)\ /*00*/ func(0xF180,BootSoftware,32,STORE_IN_RAM)\ /*01*/ func(0xF186,ActiveDiagnosticSession,1,STORE_IN_RAM)\ /*02*/ func(0xF187,ECUManufacturerSparePartNumber,13,STORE_IN_RAM)\ /*03*/ func(0xF188,VehicleManufacturerECUSoftwareNumber,16,STORE_IN_RAM) \ /*04*/ func(0xF18A,SystemSupplierIdentifierData,3,STORE_IN_RAM)\ /*05*/ func(0xF18C,ECUSerialNumber,12,STORE_IN_RAM) \ /*06*/ func(0xF190,VehicleIdentificationNumber,17,STORE_IN_FLASH) \ /*07*/ func(0xF191,VehicleManufacturerECUHardwareNumber,12,STORE_IN_RAM) \ /*08*/ func(0xF198,TesterSerialNumber,12,STORE_IN_FLASH) \ /*09*/ func(0xF199,ProgrammingDate,4,STORE_IN_FLASH) \ /*10*/ func(0xFE10,InputOvervoltageValue,2,STORE_IN_FLASH) \ /*11*/ func(0xFE11,InputUndervoltageValue,2,STORE_IN_FLASH) \ /*12*/ func(0xFE12,OutputOvervoltageValue,2,STORE_IN_FLASH) \ /*13*/ func(0xFE13,OutputUndervoltageValue,2,STORE_IN_FLASH) \ /*14*/ func(0xFE14,OutputOvercurrentFaultValue,1,STORE_IN_FLASH) \ /*15*/ func(0xFE15,InputOvercurrentFaultValue,1,STORE_IN_FLASH) \ /*16*/ func(0xFE16,OverTempertureProtectValue,1,STORE_IN_FLASH) #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_ */