tao_z
2022-05-29 fa8669b0092240642af78e84c0e89f596444fdad
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/**
 * @file did.h
 * @author Ethan.Tao (tzj0429@163.com)
 * @brief
 * @version 0.1
 * @date 2022-01-04
 *
 * @copyright Copyright (c) 2022 Äþ²¨ÕýÀÊÆû³µÁ㲿¼þÓÐÏÞ¹«Ë¾
 *
 */
#ifndef DID_H
#define DID_H
 
#include "typedef.h"
 
typedef enum
{
    READONLY = 0,
    READWRITE = 1
} UDS_DID_AccessType_e;
 
typedef enum
{
    DID_NS_ProgrammingCounter = 0x2100,
    DID_NS_ProAtpCounter = 0x2101,
    DID_NS_BackupConfig = 0x2102,
    DID_NS_VehicleName = 0x2103,
    DID_NS_DiagVersion = 0x2104,
    DID_NS_BootSoftId = 0x2105,
    DID_NS_ActiveDiagSession = 0x2106,
    DID_NS_DFLZMPartNum = 0xF187,
    DID_NS_VehiclEECUSoftwareVersion = 0x2108,
    DIS_NS_SupplierID = 0xF18A,
    DID_NS_ECUManufacturingDate = 0x210B,
    DID_NS_ECUSerialNumID = 0xf18c,
    DID_NS_VINDataIdentifier = 0xF190u,
    DID_NS_ECUHardwareVersion = 0xF193,
    DID_NS_ECUSoftwareVersion = 0xF195,
    DID_NS_SystemNameOrEngineType = 0x2110,
    DID_NS_RepairShopCodeOrTester = 0x2111,
    DID_NS_ECUProgtammingDate = 0x2112,
    DID_NS_InstallDate = 0x2113,
    DID_NS_NetConfig = 0xf019,
    DID_NS_FunctionConfig = 0xf010,
    DID_NS_EGSMSensorPositon = 0x2116,
    DID_NS_ReleaseButtonState = 0x2118,
    DID_NS_PButtionState = 0x2119,
    DID_NS_PaddleState = 0x211A,
    DID_NS_ECUPowerVoltage = 0x211B,
    DID_NS_VehicleSpeed = 0x211c,
    DID_NS_SystemName = 0xF197,
    DID_NS_WriteFingerPrint = 0xF15A,
    DID_NS_ReadFingerPrint = 0xf15b,
    DID_NS_IndicationLEDControl = 0x8101
 
#ifdef ENABLE_FAULT_TRIGGERING_VIA_DID
    DID_DIAG_NS_EnableFaultCondition = 0xFEC3,
#endif
} UDS_DIDList_e;
 
typedef struct
{
    UDS_DIDList_e DidEnum;
    void *address;      // RAM ADDRESS
    uint16_t nvBlockID; // NVM ADDRESS
    uint16_t size;
    UDS_DID_AccessType_e access;
    uint16_t crc;
} UDS_DIDtableEntry;
 
#define UDS_DID_TABLE_SIZE 30u
 
extern uint16_t DIDTable_Entry_Count_u16;
extern UDS_DIDtableEntry DIDtable[UDS_DID_TABLE_SIZE];
 
void did_init(void);
extern int8_t FblReadProgramBlock(void);
extern int8_t FblWriteProgramBlock(void);
extern void DID_UpdateProgramCnt(void);
extern void DID_UpdateAtpProgramCnt(void);
extern int8_t DID_SaveProgamDataToNvm(void);
extern void DID_SetWriteSaveFlag(void);
#endif /* DID_H */