-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ECAN.def
386 lines (385 loc) · 9.29 KB
/
ECAN.def
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
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
/*###########################################################################
*###########################################################################*/
#ifndef _ECAN_DEF
#define _ECAN_DEF
//
// 125Kbps
// 87.5% sample point
// Five receive buffers RX0, RX1, RX2, B0, B1
// Five transmit buffers TX0, TX1, B3,B4,B5
// Filter/mask
// Receive all control events
// Receive Sync request. Class=0x1E Type=0x1A CONTROL:SYNC
//
// ECAN Routine Mode:
// Possible values are ECAN_LIB_MODE_FIXED, ECAN_LIB_MODE_RUN_TIME
// Use ECAN_LIB_MODE_FIXED if run-time selection of mode is not required.
// Use ECAN_LIB_MODE_RUN_TIME if run-time selection is required.
#define ECAN_LIB_MODE_VAL ECAN_LIB_MODE_RUN_TIME
//
// ECAN Functional Mode to be used in ECANInitialize().
// Possible values are ECAN_MODE_0, ECAN_MODE_1, ECAN_MODE_2
#define ECAN_FUNC_MODE_VAL ECAN_MODE_2
//
// Mode to leave ECAN after ECANInit.
// Possible values are ECAN_INIT_NORMAL, ECAN_INIT_CONFIGURATION, ECAN_INIT_LOOPBACK, ECAN_INIT_DISABLE
#define ECAN_INIT_MODE ECAN_INIT_NORMAL
//
// http://www.port.de/en/bit-timing.html
// Use http://www.port.de/cgi-bin/tq.cgi?ctype=Pic18&CLK=20&sample_point=87.5
// Note: Oscillator frequency 20 MHz even if 40MHz
//
// SJW value - Value must be between 1-4 inclusive.
#define ECAN_SJW_VAL 1
//
// BRP value - Value must be between 1-64 inclusive.
#define ECAN_BRP_VAL 10
//
// PHSEG1 value - Value must be between 1-8 inclusive.
#define ECAN_PHSEG1_VAL 8
//
// PHSEG2 value - Value must be between 1-8 inclusive.
#define ECAN_PHSEG2_VAL 2
//
// PROPSEG value - Value must be between 1-8 inclusive.
#define ECAN_PROPSEG_VAL 5
//
// Use freely progrmable PHSEG2 or calculated value.
#define ECAN_PHSEG2_MODE_VAL ECAN_PHSEG2_MODE_PROGRAMMABLE
//
// Bus Sample Mode
#define ECAN_BUS_SAMPLE_MODE_VAL ECAN_BUS_SAMPLE_MODE_THRICE
//
// Wakeup Mode
#define ECAN_WAKEUP_MODE_VAL ECAN_WAKEUP_MODE_ENABLE
//
// Filter Mode
#define ECAN_FILTER_MODE_VAL ECAN_FILTER_MODE_DISABLE
//
// CANTX1 Drive Mode
#define ECAN_TXDRIVE_MODE_VAL ECAN_TXDRIVE_MODE_VDD
//
// CANTX2 pin mode
#define ECAN_TX2_MODE_VAL ECAN_TX2_MODE_DISABLE
//
// CANTX2 Source
#define ECAN_TX2_SOURCE_VAL ECAN_TX2_SOURCE_COMP
//
// CAN Capture Mode
#define ECAN_CAPTURE_MODE_VAL ECAN_CAPTURE_MODE_DISABLE
//
// RXB0 Recieve Mode
#define ECAN_RXB0_MODE_VAL ECAN_RECEIVE_EXTENDED
//
// RXB0 Double Buffer Mode
#define ECAN_RXB0_DBL_BUFFER_MODE_VAL ECAN_DBL_BUFFER_MODE_DISABLE
//
// RXB1 Recieve Mode
#define ECAN_RXB1_MODE_VAL ECAN_RECEIVE_EXTENDED
//
// B0 Tx/Rx mode Mode
#define ECAN_B0_TXRX_MODE_VAL ECAN_BUFFER_RX
//
// B0 Recieve Mode
#define ECAN_B0_MODE_VAL ECAN_RECEIVE_EXTENDED
//
// B0 Auto RTR Mode
#define ECAN_B0_AUTORTR_MODE ECAN_AUTORTR_MODE_DISABLE
//
// B1 Tx/Rx mode Mode
#define ECAN_B1_TXRX_MODE_VAL ECAN_BUFFER_RX
//
// B1 Recieve Mode
#define ECAN_B1_MODE_VAL ECAN_RECEIVE_EXTENDED
//
// B1 Auto RTR Mode
#define ECAN_B1_AUTORTR_MODE ECAN_AUTORTR_MODE_DISABLE
//
// B2 Tx/Rx mode Mode
#define ECAN_B2_TXRX_MODE_VAL ECAN_BUFFER_RX
//
// B2 Recieve Mode
#define ECAN_B2_MODE_VAL ECAN_RECEIVE_EXTENDED
//
// B2 Auto RTR Mode
#define ECAN_B2_AUTORTR_MODE ECAN_AUTORTR_MODE_DISABLE
//
// B3 Tx/Rx mode Mode
#define ECAN_B3_TXRX_MODE_VAL ECAN_BUFFER_TX
//
// B3 Recieve Mode
#define ECAN_B3_MODE_VAL ECAN_RECEIVE_EXTENDED
//
// B3 Auto RTR Mode
#define ECAN_B3_AUTORTR_MODE ECAN_AUTORTR_MODE_DISABLE
//
// B4 Tx/Rx mode Mode
#define ECAN_B4_TXRX_MODE_VAL ECAN_BUFFER_TX
//
// B4 Recieve Mode
#define ECAN_B4_MODE_VAL ECAN_RECEIVE_EXTENDED
//
// B4 Auto RTR Mode
#define ECAN_B4_AUTORTR_MODE ECAN_AUTORTR_MODE_DISABLE
//
// B5 Tx/Rx mode Mode
#define ECAN_B5_TXRX_MODE_VAL ECAN_BUFFER_TX
//
// B5 Recieve Mode
#define ECAN_B5_MODE_VAL ECAN_RECEIVE_EXTENDED
//
// B5 Auto RTR Mode
#define ECAN_B5_AUTORTR_MODE ECAN_AUTORTR_MODE_DISABLE
//
// RXF0 Filter Enable/Disable
#define ECAN_RXF0_MODE_VAL ECAN_RXFn_ENABLE
//
// RXF0 Filter Type
#define ECAN_RXF0_MSG_TYPE_VAL ECAN_MSG_XTD
//
// RXF0 Value CLASS=0x00
#define ECAN_RXF0_VAL 0x00000000L
//
// RXF0 Buffer Link
#define ECAN_RXF0_BUFFER_VAL RXB0
//
// RXF0 Mask Link
#define ECAN_RXF0_MASK_VAL ECAN_RXM0
//
// RXF1 Filter Enable/Disable
#define ECAN_RXF1_MODE_VAL ECAN_RXFn_ENABLE
//
// RXF1 Filter Type
#define ECAN_RXF1_MSG_TYPE_VAL ECAN_MSG_XTD
//
// RXF1 Value CLASS=0x1E, TYPE=0x1A CONTROL, SYNC
#define ECAN_RXF1_VAL 0x001E1A00L
//
// RXF1 Buffer Link
#define ECAN_RXF1_BUFFER_VAL RXB0
//
// RXF1 Mask Link
#define ECAN_RXF1_MASK_VAL ECAN_RXM1
//
// RXF2 Filter Enable/Disable
#define ECAN_RXF2_MODE_VAL ECAN_RXFn_DISABLE
//
// RXF2 Filter Type
#define ECAN_RXF2_MSG_TYPE_VAL ECAN_MSG_STD
//
// RXF2 Value
#define ECAN_RXF2_VAL 0x0L
//
// RXF2 Buffer Link
#define ECAN_RXF2_BUFFER_VAL RXB1
//
// RXF2 Mask Link
#define ECAN_RXF2_MASK_VAL ECAN_RXM1
//
// RXF3 Filter Enable/Disable
#define ECAN_RXF3_MODE_VAL ECAN_RXFn_DISABLE
//
// RXF3 Filter Type
#define ECAN_RXF3_MSG_TYPE_VAL ECAN_MSG_STD
//
// RXF3 Value
#define ECAN_RXF3_VAL 0x0L
//
// RXF3 Buffer Link
#define ECAN_RXF3_BUFFER_VAL RXB1
//
// RXF3 Mask Link
#define ECAN_RXF3_MASK_VAL ECAN_RXM1
//
// RXF4 Filter Enable/Disable
#define ECAN_RXF4_MODE_VAL ECAN_RXFn_DISABLE
//
// RXF4 Filter Type
#define ECAN_RXF4_MSG_TYPE_VAL ECAN_MSG_STD
//
// RXF4 Value
#define ECAN_RXF4_VAL 0x0L
//
// RXF4 Buffer Link
#define ECAN_RXF4_BUFFER_VAL RXB1
//
// RXF4 Mask Link
#define ECAN_RXF4_MASK_VAL ECAN_RXM1
//
// RXF5 Filter Enable/Disable
#define ECAN_RXF5_MODE_VAL ECAN_RXFn_DISABLE
//
// RXF5 Filter Type
#define ECAN_RXF5_MSG_TYPE_VAL ECAN_MSG_STD
//
// RXF5 Value
#define ECAN_RXF5_VAL 0x0L
//
// RXF5 Buffer Link
#define ECAN_RXF5_BUFFER_VAL RXB1
//
// RXF5 Mask Link
#define ECAN_RXF5_MASK_VAL ECAN_RXM1
//
// RXF6 Filter Enable/Disable
#define ECAN_RXF6_MODE_VAL ECAN_RXFn_DISABLE
//
// RXF6 Filter Type
#define ECAN_RXF6_MSG_TYPE_VAL ECAN_MSG_STD
//
// RXF6 Value
#define ECAN_RXF6_VAL 0x0L
//
// RXF6 Buffer Link
#define ECAN_RXF6_BUFFER_VAL RXB0
//
// RXF6 Mask Link
#define ECAN_RXF6_MASK_VAL ECAN_RXM0
//
// RXF7 Filter Enable/Disable
#define ECAN_RXF7_MODE_VAL ECAN_RXFn_DISABLE
//
// RXF7 Filter Type
#define ECAN_RXF7_MSG_TYPE_VAL ECAN_MSG_STD
//
// RXF7 Value
#define ECAN_RXF7_VAL 0x0L
//
// RXF7 Buffer Link
#define ECAN_RXF7_BUFFER_VAL RXB0
//
// RXF7 Mask Link
#define ECAN_RXF7_MASK_VAL ECAN_RXM0
//
// RXF8 Filter Enable/Disable
#define ECAN_RXF8_MODE_VAL ECAN_RXFn_DISABLE
//
// RXF8 Filter Type
#define ECAN_RXF8_MSG_TYPE_VAL ECAN_MSG_STD
//
// RXF8 Value
#define ECAN_RXF8_VAL 0x0L
//
// RXF8 Buffer Link
#define ECAN_RXF8_BUFFER_VAL RXB0
//
// RXF8 Mask Link
#define ECAN_RXF8_MASK_VAL ECAN_RXM0
//
// RXF9 Filter Enable/Disable
#define ECAN_RXF9_MODE_VAL ECAN_RXFn_DISABLE
//
// RXF9 Filter Type
#define ECAN_RXF9_MSG_TYPE_VAL ECAN_MSG_STD
//
// RXF9 Value
#define ECAN_RXF9_VAL 0x0L
//
// RXF9 Buffer Link
#define ECAN_RXF9_BUFFER_VAL RXB0
//
// RXF9 Mask Link
#define ECAN_RXF9_MASK_VAL ECAN_RXM0
//
// RXF10 Filter Enable/Disable
#define ECAN_RXF10_MODE_VAL ECAN_RXFn_DISABLE
//
// RXF10 Filter Type
#define ECAN_RXF10_MSG_TYPE_VAL ECAN_MSG_STD
//
// RXF10 Value
#define ECAN_RXF10_VAL 0x0L
//
// RXF10 Buffer Link
#define ECAN_RXF10_BUFFER_VAL RXB0
//
// RXF10 Mask Link
#define ECAN_RXF10_MASK_VAL ECAN_RXM0
//
// RXF11 Filter Enable/Disable
#define ECAN_RXF11_MODE_VAL ECAN_RXFn_DISABLE
//
// RXF11 Filter Type
#define ECAN_RXF11_MSG_TYPE_VAL ECAN_MSG_STD
//
// RXF11 Value
#define ECAN_RXF11_VAL 0x0L
//
// RXF11 Buffer Link
#define ECAN_RXF11_BUFFER_VAL RXB0
//
// RXF11 Mask Link
#define ECAN_RXF11_MASK_VAL ECAN_RXM0
//
// RXF12 Filter Enable/Disable
#define ECAN_RXF12_MODE_VAL ECAN_RXFn_DISABLE
//
// RXF12 Filter Type
#define ECAN_RXF12_MSG_TYPE_VAL ECAN_MSG_STD
//
// RXF12 Value
#define ECAN_RXF12_VAL 0x0L
//
// RXF12 Buffer Link
#define ECAN_RXF12_BUFFER_VAL RXB0
//
// RXF12 Mask Link
#define ECAN_RXF12_MASK_VAL ECAN_RXM0
//
// RXF13 Filter Enable/Disable
#define ECAN_RXF13_MODE_VAL ECAN_RXFn_DISABLE
//
// RXF13 Filter Type
#define ECAN_RXF13_MSG_TYPE_VAL ECAN_MSG_STD
//
// RXF13 Value
#define ECAN_RXF13_VAL 0x0L
//
// RXF13 Buffer Link
#define ECAN_RXF13_BUFFER_VAL RXB0
//
// RXF13 Mask Link
#define ECAN_RXF13_MASK_VAL ECAN_RXM0
//
// RXF14 Filter Enable/Disable
#define ECAN_RXF14_MODE_VAL ECAN_RXFn_DISABLE
//
// RXF14 Filter Type
#define ECAN_RXF14_MSG_TYPE_VAL ECAN_MSG_STD
//
// RXF14 Value
#define ECAN_RXF14_VAL 0x0L
//
// RXF14 Buffer Link
#define ECAN_RXF14_BUFFER_VAL RXB0
//
// RXF14 Mask Link
#define ECAN_RXF14_MASK_VAL ECAN_RXM0
//
// RXF15 Filter Enable/Disable
#define ECAN_RXF15_MODE_VAL ECAN_RXFn_DISABLE
//
// RXF15 Filter Type
#define ECAN_RXF15_MSG_TYPE_VAL ECAN_MSG_STD
//
// RXF15 Value
#define ECAN_RXF15_VAL 0x0L
//
// RXF15 Buffer Link
#define ECAN_RXF15_BUFFER_VAL RXB0
//
// RXF15 Mask Link
#define ECAN_RXF15_MASK_VAL ECAN_RXM0
//
// RXM0 Type All protocol events - CLASS=0x00 Type=all
#define ECAN_RXM0_MSG_TYPE ECAN_MSG_XTD
//
// RXM0 Value
#define ECAN_RXM0_VAL 0x01FF0000L
//
// RXM1 Type Sync request - CLASS=0x1E Type=0x1A
#define ECAN_RXM1_MSG_TYPE ECAN_MSG_XTD
//
// RXM1 Value
#define ECAN_RXM1_VAL 0x01FFFF00L
#endif