-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathCanTp_Types.h
287 lines (232 loc) · 6.81 KB
/
CanTp_Types.h
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
/**
* @file CanTp_Types.h
* @author Guillaume Sottas
* @date 15/01/2018
*/
#ifndef CANTP_TYPES_H
#define CANTP_TYPES_H
#ifdef __cplusplus
extern "C" {
#endif /* ifdef __cplusplus */
/*------------------------------------------------------------------------------------------------*/
/* included files (#include). */
/*------------------------------------------------------------------------------------------------*/
/**
* @addtogroup CANTP_TYPES_H
* @{
*/
#ifndef COMSTACK_TYPES_H
#include "ComStack_Types.h"
#endif /* #ifndef COMSTACK_TYPES_H */
/** @} */
/*------------------------------------------------------------------------------------------------*/
/* global data type definitions (typedef, struct). */
/*------------------------------------------------------------------------------------------------*/
/**
* @addtogroup CANTP_H_GTDEF
* @{
*/
typedef enum
{
/**
* @brief full duplex channel
*/
CANTP_MODE_FULL_DUPLEX,
/**
* @brief half duplex channel
*/
CANTP_MODE_HALF_DUPLEX
} CanTp_ChannelMode; /* CanTpChannelMode. */
typedef enum
{
/**
* @brief extended addressing format
*/
CANTP_EXTENDED,
/**
* @brief mixed 11 bit addressing format
*/
CANTP_MIXED,
/**
* @brief mixed 29 bit addressing format
*/
CANTP_MIXED29BIT,
/**
* @brief normal fixed addressing format
*/
CANTP_NORMALFIXED,
/**
* @brief normal addressing format
*/
CANTP_STANDARD
} CanTp_AddressingFormatType;
typedef enum
{
/**
* @brief padding is used
*/
CANTP_OFF,
/**
* @brief padding is not used
*/
CANTP_ON
} CanTp_StateType;
typedef CanTp_StateType CanTp_RxPaddingActivationType;
typedef CanTp_StateType CanTp_TxPaddingActivationType;
typedef enum
{
/**
* @brief functional request type
*/
CANTP_FUNCTIONAL,
/**
* @brief physical request type
*/
CANTP_PHYSICAL
} CanTp_ComTypeType;
typedef struct
{
uint8 nSa; /* CanTpNSa. */
} CanTp_NSaType; /* CanTpNSa. */
typedef struct
{
uint8 nTa; /* CanTpNTa. */
} CanTp_NTaType; /* CanTpNTa. */
typedef struct
{
uint8 nAe; /* CanTpNAe. */
} CanTp_NAeType; /* CanTpNAe. */
typedef struct
{
const uint32 rxFcNPduRef; /* CanTpRxFcNPduRef. */
const uint16 rxFcNPduId; /* CanTpRxFcNPduId. */
} CanTp_RxFcNPduType; /* CanTpRxFcNPdu. */
typedef struct
{
/**
* @brief reference to a Pdu in the COM stack
*/
const uint32 fcNPduRef; /* CanTpTxFcNPduRef. */
/**
* @brief used for grouping of the ID of a PDU and the reference to a PDU. this N-PDU produces
* a meta data item of type CAN_ID_32
*/
const uint16 fcNPduId; /* CanTpTxFcNPduConfirmationPduId. */
} CanTp_TxFcNPduType; /* CanTpTxFcNPdu. */
typedef struct
{
/**
* @brief unique identifier to a structure that contains all useful information to process the
* reception of a network SDU.
*
* @warning this identifier must be unique in the scope of CanTp configuration module (both
* directions).
*/
const uint16 nSduId; /* CanTpRxNSduId. */
const CanTp_NSaType *pNSa;
const CanTp_NTaType *pNTa;
const CanTp_NAeType *pNAe;
const uint8 bs; /* CanTpBs. */
const uint32 nar; /* CanTpNar. */
const uint32 nbr; /* CanTpNbr. */
const uint32 ncr; /* CanTpNcr. */
const uint16 wftMax; /* CanTpRxWftMax. */
/**
* @brief separation time minimum between two consecutive frames [us].
*/
const uint32 sTMin; /* CanTpSTmin. */
const CanTp_AddressingFormatType af; /* CanTpRxAddressingFormat. */
const CanTp_RxPaddingActivationType padding; /* CanTpRxPaddingActivation. */
const CanTp_ComTypeType taType; /* CanTpRxTaType. */
const PduIdType rxNSduRef; /* CanTpRxNSduRef. */
} CanTp_RxNSduType; /* CanTpRxNSdu. */
typedef struct
{
/**
* @brief unique identifier to a structure that contains all useful information to process the
* transmission of a network SDU.
*
* @warning this identifier must be unique in the scope of CanTp configuration module (both
* directions).
*/
const uint16 nSduId; /* CanTpTxNSduId. */
const CanTp_NSaType *pNSa;
const CanTp_NTaType *pNTa;
const CanTp_NAeType *pNAe;
/**
* @brief value [us] of the N_As timeout. N_As is the time for transmission of a CAN frame (any
* N-PDU) on the part of the sender
*/
const uint32 nas; /* CanTpNas. */
/**
* @brief value [us] of the N_Bs timeout. N_Bs is the time of transmission until reception of
* the next flow control N-PDU
*/
const uint32 nbs; /* CanTpNbs. */
/**
* @brief value [us] of the performance requirement of (N_Cs + N_As). N_Cs is the time in which
* CanTp is allowed to request the tx data of a consecutive frame N-PDU
*/
const uint32 ncs; /* CanTpNcs. */
/**
* @brief switch for enabling transmit cancellation
*/
const boolean tc; /* CanTpTc. */
/**
* @brief declares which communication addressing format is supported for this TxNSdu
*/
const CanTp_AddressingFormatType af; /* CanTpTxAddressingFormat. */
/**
* @brief defines if the transmit frame use padding or not. this parameter is restricted to 8
* byte N-PDUs.
*/
const CanTp_TxPaddingActivationType padding; /* CanTpTxPaddingActivation. */
/**
* @brief declares the communication type of this TxNSdu
*/
const CanTp_ComTypeType taType; /* CanTpTxTaType. */
/**
* @brief reference to a PDU in the COM stack
*/
const uint32 txNSduRef; /* CanTpTxNSduRef. */
} CanTp_TxNSduType; /* CanTpTxNSdu. */
typedef struct
{
const uint16 id; /* CanTpRxNPduId. */
const uint32 rxNPduId; /* CanTpRxNPduRef. */
} CanTp_RxNPduType; /* CanTpRxNPdu. */
typedef struct
{
const uint32 pduRef; /* CanTpTxNPduRef. */
const uint16 pduConfirmationPduId; /* CanTpTxNPduConfirmationPduId. */
} CanTp_TxNPduType; /* CanTpTxNPdu. */
typedef struct
{
struct
{
const CanTp_RxNSduType *rx;
const uint32 rxNSduCnt;
const CanTp_TxNSduType *tx;
const uint32 txNSduCnt;
} nSdu;
const CanTp_ChannelMode channelMode;
} CanTp_ChannelType; /* CanTpChannel. */
/**
* @brief data structure type for the post-build configuration parameters.
*/
typedef struct
{
/**
* @brief period between two calls of CanTp_MainFunction [us].
* @note see CanTpMainFunctionPeriod parameter
*/
const uint32 mainFunctionPeriod;
const uint32 maxChannelCnt; /* CanTpMaxChannelCnt. */
const CanTp_ChannelType *pChannel;
const uint8 paddingByte; /* CanTpPaddingByte. */
} CanTp_ConfigType;
/** @} */
#ifdef __cplusplus
};
#endif /* ifdef __cplusplus */
#endif /* define CANTP_TYPES_H */