tao_z
2022-05-25 1044ba0d2286698d0da28112bffc0f114bef2134
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#ifndef UDS_H_
#define UDS_H_
 
#include "did.h"
#include "uds_user.h"
 
/***************************************************
 *  Global Defines
 ***************************************************/
 
/***************************************************
 *  Forward declarations
 ***************************************************/
struct CAN_Message;
 
/***************************************************
 *  External Declarations (for Internal Signals)
 **************************************************/
 
#if 0 /* ²ð·Ö */
typedef enum
{
  READONLY = 0,
  READWRITE = 1
} UDS_DID_AccessType_e;
 
typedef enum
{
  DID_UDS_NS_CoreAssemblyId_sz = 0xF111u,
  DID_UDS_NS_EcuDeliveryAssemblyId_sz = 0xF113u,
  DID_UDS_NS_EcuMainSwId_sz = 0xF188u,
  DID_UDS_NS_GsmPartNum_sz = 0xF192u,
  DID_UDS_NS_UnitSerialNum_sz = 0xF193u,
  DID_UDS_NS_Version_sz = 0xF194u,
  DID_UDS_NS_HGID_sz = 0xF195u,
  DID_UDS_NS_PcbSerialNum_sz = 0xF196u,
 
  DID_UDS_NS_VINDataIdentifier = 0xF190u,
  DID_UDS_NS_SystemNameDataIdentifier = 0xF197u,
  DID_UDS_NS_VehiclePowerMode = 0xF1A0u,
  DID_UDS_NS_BatteryVoltage = 0xF1A2u,
  DID_UDS_NS_CompressedVPPS = 0xF1B0u,
  DID_UDS_NS_DUNSIdentification = 0xF1B1u,
  DID_UDS_NS_MTC = 0xF1B2u,
  DID_UDS_NS_ECUSourceID = 0xF1C0u,
  DID_UDS_NS_BootSoftwareIdentificationDataIdentifier = 0xF180u,
  DID_UDS_NS_ApplicationSoftwareIdentificationDataIdentifier = 0xF181u,
  DID_UDS_NS_ApplicationDataIdentificationDataIdentifier = 0xF182u,
  DID_UDS_NS_BaseModelPartNumber = 0xF1D0u,
  DID_UDS_NS_BaseModelPartNumberVersionCode = 0xF1D1u,
  DID_UDS_NS_EndModelPartNumber = 0xF1D2u,
  DID_UDS_NS_EndModelPartNumberVersionCode = 0xF1D3u,
  DID_UDS_NS_ManufacturersModeFlag = 0xF1DFu,
  DID_UDS_NS_ProgramState = 0xF1E0u,
  DID_UDS_UDS_NS_FingerprintRead = 0xF15Bu,
  DIDMAX
 
} UDS_DIDList_e;
 
typedef struct
{
  UDS_DIDList_e DidEnum;
  void *address;
  uint8_t nvBlockID;
  uint16_t size;
  UDS_DID_AccessType_e access;
  uint16_t crc;
} UDS_DIDtableEntry;
#endif
 
/*
// AddressAndLengthFormatIdentifier
typedef union AddrAndLenFmtId {
  uint8_t frame;
 
  struct
  {
    unsigned int AddressLength : 4;
    unsigned int SizeLength : 4;
  } AddressSizeLength;
 
} AddrAndLenFmtId_t;
*/
 
typedef enum
{
  EnableRxAndTx = 0x00,
  EnableRxAndDisableTx = 0x01,
  DisableRxAndTx = 0x03
} UDS_CONTOL_TYPE_e;
 
typedef enum
{
  NormalCommunicationMessage = 0x01,
  NetManageCommMessage = 0x02,
  BothCommunicationMessage = 0x03
} UDS_CommunicationType_e;
 
typedef void (*RegDID_WR_FUNC_t)(uint16_t DIDitem, uint8_t nvBlockID, void *address, uint16_t size);
typedef void (*RegDID_RO_FUNC_t)(uint16_t DIDitem, const void *address, uint16_t size);
struct USD_RegDID
{
  RegDID_WR_FUNC_t Reg_RW_DID;
  RegDID_RO_FUNC_t Reg_RO_DID;
};
/*****************************************************************************/
/* Output signal                                                             */
/*****************************************************************************/
/* UDS_StreamCmd_e is expeceted to be set to STREAM_NONE
 * by it's consumer when it's finished with the signal.   */
 
/*****************************************************************************/
/* External function prototypes                                              */
/*****************************************************************************/
extern void UDS_Init(void);
extern void UDS_Task_10ms(void *p);
extern void UDS_Task_1ms(void *p);
 
extern void UDS_RxMessage(TP_PDU_t *msg);
extern void UDS_RxFunIdMessage(TP_PDU_t *msg);
 
extern void UDS_InitDIDMapRW(UDS_DIDList_e DIDitem, uint16_t nvBlockID, void *address, uint16_t size);
extern void UDS_InitDIDMapRO(UDS_DIDList_e DIDitem, const void *address, uint16_t size);
 
extern void UDS_SwitchtoProgrammingSession(void);
 
extern void UDS_ResponseEntryProgrammingSession(void);
#endif