]> rtime.felk.cvut.cz Git - rpp-test-sw.git/blob - rpp/lib/rpp/include/sys/ti_drv_can.h
Yet another place to fix
[rpp-test-sw.git] / rpp / lib / rpp / include / sys / ti_drv_can.h
1 /** @file can.h
2 *   @brief CAN Driver Header File
3 *   @date 15.Mar.2012
4 *   @version 03.01.00
5 *
6 *   This file contains:
7 *   - Definitions
8 *   - Types
9 *   - Interface Prototypes
10 *   .
11 *   which are relevant for the CAN driver.
12 */
13
14 /* (c) Texas Instruments 2009-2012, All rights reserved. */
15
16 #include "base.h"
17
18 #ifndef __CAN_H__
19 #define __CAN_H__
20
21 /* USER CODE BEGIN (0) */
22 /* USER CODE END */
23
24
25 /* CAN General Definitions */
26
27 /** @def canLEVEL_ACTIVE
28 *   @brief Alias name for CAN error operation level active (Error couter 0-95)
29 */
30 #define canLEVEL_ACTIVE 0x00U
31
32 /** @def canLEVEL_WARNING
33 *   @brief Alias name for CAN error operation level warning (Error couter 96-127)
34 */
35 #define canLEVEL_WARNING 0x40U
36
37 /** @def canLEVEL_PASSIVE
38 *   @brief Alias name for CAN error operation level passive (Error couter 128-255)
39 */
40 #define canLEVEL_PASSIVE 0x20U
41
42 /** @def canLEVEL_BUS_OFF
43 *   @brief Alias name for CAN error operation level bus off (Error couter 256)
44 */
45 #define canLEVEL_BUS_OFF 0x80U
46
47 /** @def canERROR_NO
48 *   @brief Alias name for no CAN error occured
49 */
50 #define canERROR_OK 0U
51
52 /** @def canERROR_STUFF
53 *   @brief Alias name for CAN stuff error an RX message
54 */
55 #define canERROR_STUFF 1U
56
57 /** @def canERROR_FORMAT
58 *   @brief Alias name for CAN form/format error an RX message
59 */
60 #define canERROR_FORMAT 2U
61
62 /** @def canERROR_ACKNOWLEDGE
63 *   @brief Alias name for CAN TX message wasn't acknowledged
64 */
65 #define canERROR_ACKNOWLEDGE 3U
66
67 /** @def canERROR_BIT1
68 *   @brief Alias name for CAN TX message sendig recessive level but monitoring dominant
69 */
70 #define canERROR_BIT1 4U
71
72 /** @def canERROR_BIT0
73 *   @brief Alias name for CAN TX message sendig dominant level but monitoring recessive
74 */
75 #define canERROR_BIT0 5U
76
77 /** @def canERROR_CRC
78 *   @brief Alias name for CAN RX message received wrong CRC
79 */
80 #define canERROR_CRC 6U
81
82 /** @def canERROR_NO
83 *   @brief Alias name for CAN no message has send or received sinced last call of CANGetLastError
84 */
85 #define canERROR_NO 7U
86
87 /** @def canMESSAGE_BOX1
88 *   @brief Alias name for CAN message box 1
89 *
90 *   @note This value should be used for API argument @a messageBox
91 */
92 #define canMESSAGE_BOX1 1U
93
94 /** @def canMESSAGE_BOX2
95 *   @brief Alias name for CAN message box 2
96 *
97 *   @note This value should be used for API argument @a messageBox
98 */
99 #define canMESSAGE_BOX2 2U
100
101 /** @def canMESSAGE_BOX3
102 *   @brief Alias name for CAN message box 3
103 *
104 *   @note This value should be used for API argument @a messageBox
105 */
106 #define canMESSAGE_BOX3 3U
107
108 /** @def canMESSAGE_BOX4
109 *   @brief Alias name for CAN message box 4
110 *
111 *   @note This value should be used for API argument @a messageBox
112 */
113 #define canMESSAGE_BOX4 4U
114
115 /** @def canMESSAGE_BOX5
116 *   @brief Alias name for CAN message box 5
117 *
118 *   @note This value should be used for API argument @a messageBox
119 */
120 #define canMESSAGE_BOX5 5U
121
122 /** @def canMESSAGE_BOX6
123 *   @brief Alias name for CAN message box 6
124 *
125 *   @note This value should be used for API argument @a messageBox
126 */
127 #define canMESSAGE_BOX6 6U
128
129 /** @def canMESSAGE_BOX7
130 *   @brief Alias name for CAN message box 7
131 *
132 *   @note This value should be used for API argument @a messageBox
133 */
134 #define canMESSAGE_BOX7 7U
135
136 /** @def canMESSAGE_BOX8
137 *   @brief Alias name for CAN message box 8
138 *
139 *   @note This value should be used for API argument @a messageBox
140 */
141 #define canMESSAGE_BOX8 8U
142
143 /** @def canMESSAGE_BOX9
144 *   @brief Alias name for CAN message box 9
145 *
146 *   @note This value should be used for API argument @a messageBox
147 */
148 #define canMESSAGE_BOX9 9U
149
150 /** @def canMESSAGE_BOX10
151 *   @brief Alias name for CAN message box 10
152 *
153 *   @note This value should be used for API argument @a messageBox
154 */
155 #define canMESSAGE_BOX10 10U
156
157 /** @def canMESSAGE_BOX11
158 *   @brief Alias name for CAN message box 11
159 *
160 *   @note This value should be used for API argument @a messageBox
161 */
162 #define canMESSAGE_BOX11 11U
163
164 /** @def canMESSAGE_BOX12
165 *   @brief Alias name for CAN message box 12
166 *
167 *   @note This value should be used for API argument @a messageBox
168 */
169 #define canMESSAGE_BOX12 12U
170
171 /** @def canMESSAGE_BOX13
172 *   @brief Alias name for CAN message box 13
173 *
174 *   @note This value should be used for API argument @a messageBox
175 */
176 #define canMESSAGE_BOX13 13U
177
178 /** @def canMESSAGE_BOX14
179 *   @brief Alias name for CAN message box 14
180 *
181 *   @note This value should be used for API argument @a messageBox
182 */
183 #define canMESSAGE_BOX14 14U
184
185 /** @def canMESSAGE_BOX15
186 *   @brief Alias name for CAN message box 15
187 *
188 *   @note This value should be used for API argument @a messageBox
189 */
190 #define canMESSAGE_BOX15 15U
191
192 /** @def canMESSAGE_BOX16
193 *   @brief Alias name for CAN message box 16
194 *
195 *   @note This value should be used for API argument @a messageBox
196 */
197 #define canMESSAGE_BOX16 16U
198
199 /** @def canMESSAGE_BOX17
200 *   @brief Alias name for CAN message box 17
201 *
202 *   @note This value should be used for API argument @a messageBox
203 */
204 #define canMESSAGE_BOX17 17U
205
206 /** @def canMESSAGE_BOX18
207 *   @brief Alias name for CAN message box 18
208 *
209 *   @note This value should be used for API argument @a messageBox
210 */
211 #define canMESSAGE_BOX18 18U
212
213 /** @def canMESSAGE_BOX19
214 *   @brief Alias name for CAN message box 19
215 *
216 *   @note This value should be used for API argument @a messageBox
217 */
218 #define canMESSAGE_BOX19 19U
219
220 /** @def canMESSAGE_BOX20
221 *   @brief Alias name for CAN message box 20
222 *
223 *   @note This value should be used for API argument @a messageBox
224 */
225 #define canMESSAGE_BOX20 20U
226
227 /** @def canMESSAGE_BOX21
228 *   @brief Alias name for CAN message box 21
229 *
230 *   @note This value should be used for API argument @a messageBox
231 */
232 #define canMESSAGE_BOX21 21U
233
234 /** @def canMESSAGE_BOX22
235 *   @brief Alias name for CAN message box 22
236 *
237 *   @note This value should be used for API argument @a messageBox
238 */
239 #define canMESSAGE_BOX22 22U
240
241 /** @def canMESSAGE_BOX23
242 *   @brief Alias name for CAN message box 23
243 *
244 *   @note This value should be used for API argument @a messageBox
245 */
246 #define canMESSAGE_BOX23 23U
247
248 /** @def canMESSAGE_BOX24
249 *   @brief Alias name for CAN message box 24
250 *
251 *   @note This value should be used for API argument @a messageBox
252 */
253 #define canMESSAGE_BOX24 24U
254
255 /** @def canMESSAGE_BOX25
256 *   @brief Alias name for CAN message box 25
257 *
258 *   @note This value should be used for API argument @a messageBox
259 */
260 #define canMESSAGE_BOX25 25U
261
262 /** @def canMESSAGE_BOX26
263 *   @brief Alias name for CAN message box 26
264 *
265 *   @note This value should be used for API argument @a messageBox
266 */
267 #define canMESSAGE_BOX26 26U
268
269 /** @def canMESSAGE_BOX27
270 *   @brief Alias name for CAN message box 27
271 *
272 *   @note This value should be used for API argument @a messageBox
273 */
274 #define canMESSAGE_BOX27 27U
275
276 /** @def canMESSAGE_BOX28
277 *   @brief Alias name for CAN message box 28
278 *
279 *   @note This value should be used for API argument @a messageBox
280 */
281 #define canMESSAGE_BOX28 28U
282
283 /** @def canMESSAGE_BOX29
284 *   @brief Alias name for CAN message box 29
285 *
286 *   @note This value should be used for API argument @a messageBox
287 */
288 #define canMESSAGE_BOX29 29U
289
290 /** @def canMESSAGE_BOX30
291 *   @brief Alias name for CAN message box 30
292 *
293 *   @note This value should be used for API argument @a messageBox
294 */
295 #define canMESSAGE_BOX30 30U
296
297 /** @def canMESSAGE_BOX31
298 *   @brief Alias name for CAN message box 31
299 *
300 *   @note This value should be used for API argument @a messageBox
301 */
302 #define canMESSAGE_BOX31 31U
303
304 /** @def canMESSAGE_BOX32
305 *   @brief Alias name for CAN message box 32
306 *
307 *   @note This value should be used for API argument @a messageBox
308 */
309 #define canMESSAGE_BOX32 32U
310
311 /** @def canMESSAGE_BOX33
312 *   @brief Alias name for CAN message box 33
313 *
314 *   @note This value should be used for API argument @a messageBox
315 */
316 #define canMESSAGE_BOX33 33U
317
318 /** @def canMESSAGE_BOX34
319 *   @brief Alias name for CAN message box 34
320 *
321 *   @note This value should be used for API argument @a messageBox
322 */
323 #define canMESSAGE_BOX34 34U
324
325 /** @def canMESSAGE_BOX35
326 *   @brief Alias name for CAN message box 35
327 *
328 *   @note This value should be used for API argument @a messageBox
329 */
330 #define canMESSAGE_BOX35 35U
331
332 /** @def canMESSAGE_BOX36
333 *   @brief Alias name for CAN message box 36
334 *
335 *   @note This value should be used for API argument @a messageBox
336 */
337 #define canMESSAGE_BOX36 36U
338
339 /** @def canMESSAGE_BOX37
340 *   @brief Alias name for CAN message box 37
341 *
342 *   @note This value should be used for API argument @a messageBox
343 */
344 #define canMESSAGE_BOX37 37U
345
346 /** @def canMESSAGE_BOX38
347 *   @brief Alias name for CAN message box 38
348 *
349 *   @note This value should be used for API argument @a messageBox
350 */
351 #define canMESSAGE_BOX38 38U
352
353 /** @def canMESSAGE_BOX39
354 *   @brief Alias name for CAN message box 39
355 *
356 *   @note This value should be used for API argument @a messageBox
357 */
358 #define canMESSAGE_BOX39 39U
359
360 /** @def canMESSAGE_BOX40
361 *   @brief Alias name for CAN message box 40
362 *
363 *   @note This value should be used for API argument @a messageBox
364 */
365 #define canMESSAGE_BOX40 40U
366
367 /** @def canMESSAGE_BOX41
368 *   @brief Alias name for CAN message box 41
369 *
370 *   @note This value should be used for API argument @a messageBox
371 */
372 #define canMESSAGE_BOX41 41U
373
374 /** @def canMESSAGE_BOX42
375 *   @brief Alias name for CAN message box 42
376 *
377 *   @note This value should be used for API argument @a messageBox
378 */
379 #define canMESSAGE_BOX42 42U
380
381 /** @def canMESSAGE_BOX43
382 *   @brief Alias name for CAN message box 43
383 *
384 *   @note This value should be used for API argument @a messageBox
385 */
386 #define canMESSAGE_BOX43 43U
387
388 /** @def canMESSAGE_BOX44
389 *   @brief Alias name for CAN message box 44
390 *
391 *   @note This value should be used for API argument @a messageBox
392 */
393 #define canMESSAGE_BOX44 44U
394
395 /** @def canMESSAGE_BOX45
396 *   @brief Alias name for CAN message box 45
397 *
398 *   @note This value should be used for API argument @a messageBox
399 */
400 #define canMESSAGE_BOX45 45U
401
402 /** @def canMESSAGE_BOX46
403 *   @brief Alias name for CAN message box 46
404 *
405 *   @note This value should be used for API argument @a messageBox
406 */
407 #define canMESSAGE_BOX46 46U
408
409 /** @def canMESSAGE_BOX47
410 *   @brief Alias name for CAN message box 47
411 *
412 *   @note This value should be used for API argument @a messageBox
413 */
414 #define canMESSAGE_BOX47 47U
415
416 /** @def canMESSAGE_BOX48
417 *   @brief Alias name for CAN message box 48
418 *
419 *   @note This value should be used for API argument @a messageBox
420 */
421 #define canMESSAGE_BOX48 48U
422
423 /** @def canMESSAGE_BOX49
424 *   @brief Alias name for CAN message box 49
425 *
426 *   @note This value should be used for API argument @a messageBox
427 */
428 #define canMESSAGE_BOX49 49U
429
430 /** @def canMESSAGE_BOX50
431 *   @brief Alias name for CAN message box 50
432 *
433 *   @note This value should be used for API argument @a messageBox
434 */
435 #define canMESSAGE_BOX50 50U
436
437 /** @def canMESSAGE_BOX51
438 *   @brief Alias name for CAN message box 51
439 *
440 *   @note This value should be used for API argument @a messageBox
441 */
442 #define canMESSAGE_BOX51 51U
443
444 /** @def canMESSAGE_BOX52
445 *   @brief Alias name for CAN message box 52
446 *
447 *   @note This value should be used for API argument @a messageBox
448 */
449 #define canMESSAGE_BOX52 52U
450
451 /** @def canMESSAGE_BOX53
452 *   @brief Alias name for CAN message box 53
453 *
454 *   @note This value should be used for API argument @a messageBox
455 */
456 #define canMESSAGE_BOX53 53U
457
458 /** @def canMESSAGE_BOX54
459 *   @brief Alias name for CAN message box 54
460 *
461 *   @note This value should be used for API argument @a messageBox
462 */
463 #define canMESSAGE_BOX54 54U
464
465 /** @def canMESSAGE_BOX55
466 *   @brief Alias name for CAN message box 55
467 *
468 *   @note This value should be used for API argument @a messageBox
469 */
470 #define canMESSAGE_BOX55 55U
471
472 /** @def canMESSAGE_BOX56
473 *   @brief Alias name for CAN message box 56
474 *
475 *   @note This value should be used for API argument @a messageBox
476 */
477 #define canMESSAGE_BOX56 56U
478
479 /** @def canMESSAGE_BOX57
480 *   @brief Alias name for CAN message box 57
481 *
482 *   @note This value should be used for API argument @a messageBox
483 */
484 #define canMESSAGE_BOX57 57U
485
486 /** @def canMESSAGE_BOX58
487 *   @brief Alias name for CAN message box 58
488 *
489 *   @note This value should be used for API argument @a messageBox
490 */
491 #define canMESSAGE_BOX58 58U
492
493 /** @def canMESSAGE_BOX59
494 *   @brief Alias name for CAN message box 59
495 *
496 *   @note This value should be used for API argument @a messageBox
497 */
498 #define canMESSAGE_BOX59 59U
499
500 /** @def canMESSAGE_BOX60
501 *   @brief Alias name for CAN message box 60
502 *
503 *   @note This value should be used for API argument @a messageBox
504 */
505 #define canMESSAGE_BOX60 60U
506
507 /** @def canMESSAGE_BOX61
508 *   @brief Alias name for CAN message box 61
509 *
510 *   @note This value should be used for API argument @a messageBox
511 */
512 #define canMESSAGE_BOX61 61U
513
514 /** @def canMESSAGE_BOX62
515 *   @brief Alias name for CAN message box 62
516 *
517 *   @note This value should be used for API argument @a messageBox
518 */
519 #define canMESSAGE_BOX62 62U
520
521 /** @def canMESSAGE_BOX63
522 *   @brief Alias name for CAN message box 63
523 *
524 *   @note This value should be used for API argument @a messageBox
525 */
526 #define canMESSAGE_BOX63 63U
527
528 /** @def canMESSAGE_BOX64
529 *   @brief Alias name for CAN message box 64
530 *
531 *   @note This value should be used for API argument @a messageBox
532 */
533 #define canMESSAGE_BOX64 64U
534
535 /* USER CODE BEGIN (1) */
536 /* USER CODE END */
537
538
539 /** @struct CANBase
540 *   @brief CAN Register Frame Definition
541 *
542 *   This type is used to access the CAN Registers.
543 */
544 /** @typedef canBASE_t
545 *   @brief CAN Register Frame Type Definition
546 *
547 *   This type is used to access the CAN Registers.
548 */
549 typedef volatile struct CANBase
550 {
551     uint32_t      CTL;          /**< 0x0000: Control Register                       */
552     uint32_t      ES;           /**< 0x0004: Error and Status Register              */
553     uint32_t      EERC;         /**< 0x0008: Error Counter Register                 */
554     uint32_t      BTR;          /**< 0x000C: Bit Timing Register                    */
555     uint32_t      INT;          /**< 0x0010: Interrupt Register                     */
556     uint32_t      TEST;         /**< 0x0014: Test Register                          */
557     uint32_t      : 32U;        /**< 0x0018: Reserved                               */
558     uint32_t      PERR;         /**< 0x001C: Parity/SECDED Error Code Register      */
559     uint32_t      REL;          /**< 0x0020: Core Release Register                  */
560     uint32_t      ECCDIAG;      /**< 0x0024: ECC Diagnostic Register                */
561     uint32_t      ECCDIADSTAT;  /**< 0x0028: ECC Diagnostic Status Register         */
562     uint32_t      : 32U;        /**< 0x002C: Reserved                               */
563     uint32_t      : 32U;        /**< 0x0030: Reserved                               */
564     uint32_t      : 32U;        /**< 0x0034: Reserved                               */
565     uint32_t      : 32U;        /**< 0x0038: Reserved                               */
566     uint32_t      : 32U;        /**< 0x003C: Reserved                               */
567     uint32_t      : 32U;        /**< 0x0040: Reserved                               */
568     uint32_t      : 32U;        /**< 0x0044: Reserved                               */
569     uint32_t      : 32U;        /**< 0x0048: Reserved                               */
570     uint32_t      : 32U;        /**< 0x004C: Reserved                               */
571     uint32_t      : 32U;        /**< 0x0050: Reserved                               */
572     uint32_t      : 32U;        /**< 0x0054: Reserved                               */
573     uint32_t      : 32U;        /**< 0x0058: Reserved                               */
574     uint32_t      : 32U;        /**< 0x005C: Reserved                               */
575     uint32_t      : 32U;        /**< 0x0060: Reserved                               */
576     uint32_t      : 32U;        /**< 0x0064: Reserved                               */
577     uint32_t      : 32U;        /**< 0x0068: Reserved                               */
578     uint32_t      : 32U;        /**< 0x006C: Reserved                               */
579     uint32_t      : 32U;        /**< 0x0070: Reserved                               */
580     uint32_t      : 32U;        /**< 0x0074: Reserved                               */
581     uint32_t      : 32U;        /**< 0x0078: Reserved                               */
582     uint32_t      : 32U;        /**< 0x007C: Reserved                               */
583     uint32_t      ABOTR;        /**< 0x0080: Auto Bus On Time Register              */
584     uint32_t      TXRQX;        /**< 0x0084: Transmission Request X Register        */
585     uint32_t      TXRQx[4U];    /**< 0x0088-0x0094: Transmission Request Registers  */
586     uint32_t      NWDATX;       /**< 0x0098: New Data X Register                    */
587     uint32_t      NWDATx[4U];   /**< 0x009C-0x00A8: New Data Registers              */
588     uint32_t      INTPNDX;      /**< 0x00AC: Interrupt Pending X Register           */
589     uint32_t      INTPNDx[4U];  /**< 0x00B0-0x00BC: Interrupt Pending Registers     */
590     uint32_t      MSGVALX;      /**< 0x00C0: Message Valid X Register               */
591     uint32_t      MSGVALx[4U];  /**< 0x00C4-0x00D0: Message Valid Registers         */
592     uint32_t      : 32U;        /**< 0x00D4: Reserved                               */
593     uint32_t      INTMUXx[4U];  /**< 0x00D8-0x00E4: Interrupt Multiplexer Registers */
594     uint32_t      : 32U;        /**< 0x00E8: Reserved                               */
595     uint32_t      : 32U;        /**< 0x00EC: Reserved                               */
596     uint32_t      : 32U;        /**< 0x00F0: Reserved                               */
597     uint32_t      : 32U;        /**< 0x00F4: Reserved                               */
598     uint32_t      : 32U;        /**< 0x00F8: Reserved                               */
599     uint32_t      : 32U;        /**< 0x00FC: Reserved                               */
600 #if ((__little_endian__ == 1) || (__LITTLE_ENDIAN__ == 1))
601     uint8_t IF1NO;              /**< 0x0100: IF1 Command Register, Msg Number       */
602     uint8_t IF1STAT;            /**< 0x0100: IF1 Command Register, Status           */
603     uint8_t IF1CMD;             /**< 0x0100: IF1 Command Register, Command          */
604     uint32_t      : 8U;         /**< 0x0100: IF1 Command Register, Reserved         */
605 #else
606     uint32_t      : 8U;         /**< 0x0100: IF1 Command Register, Reserved         */
607     uint8_t IF1CMD;             /**< 0x0100: IF1 Command Register, Command          */
608     uint8_t IF1STAT;            /**< 0x0100: IF1 Command Register, Status           */
609     uint8_t IF1NO;              /**< 0x0100: IF1 Command Register, Msg Number       */
610 #endif
611     uint32_t      IF1MSK;       /**< 0x0104: IF1 Mask Register                      */
612     uint32_t      IF1ARB;       /**< 0x0108: IF1 Arbitration Register               */
613     uint32_t      IF1MCTL;      /**< 0x010C: IF1 Message Control Register           */
614     uint8_t IF1DATx[8U];        /**< 0x0110-0x0114: IF1 Data A and B Registers      */
615     uint32_t      : 32U;        /**< 0x0118: Reserved                               */
616     uint32_t      : 32U;        /**< 0x011C: Reserved                               */
617 #if ((__little_endian__ == 1) || (__LITTLE_ENDIAN__ == 1))
618     uint8_t IF2NO;              /**< 0x0120: IF2 Command Register, Msg No           */
619     uint8_t IF2STAT;            /**< 0x0120: IF2 Command Register, Status           */
620     uint8_t IF2CMD;             /**< 0x0120: IF2 Command Register, Command          */
621     uint32_t      : 8U;         /**< 0x0120: IF2 Command Register, Reserved         */
622 #else
623     uint32_t      : 8U;         /**< 0x0120: IF2 Command Register, Reserved         */
624     uint8_t IF2CMD;             /**< 0x0120: IF2 Command Register, Command          */
625     uint8_t IF2STAT;            /**< 0x0120: IF2 Command Register, Status           */
626     uint8_t IF2NO;              /**< 0x0120: IF2 Command Register, Msg Number       */
627 #endif
628     uint32_t      IF2MSK;       /**< 0x0124: IF2 Mask Register                      */
629     uint32_t      IF2ARB;       /**< 0x0128: IF2 Arbitration Register               */
630     uint32_t      IF2MCTL;      /**< 0x012C: IF2 Message Control Register           */
631     uint8_t IF2DATx[8U];        /**< 0x0130-0x0134: IF2 Data A and B Registers      */
632     uint32_t      : 32U;        /**< 0x0138: Reserved                               */
633     uint32_t      : 32U;        /**< 0x013C: Reserved                               */
634     uint32_t      IF3OBS;       /**< 0x0140: IF3 Observation Register               */
635     uint32_t      IF3MSK;       /**< 0x0144: IF3 Mask Register                      */
636     uint32_t      IF3ARB;       /**< 0x0148: IF3 Arbitration Register               */
637     uint32_t      IF3MCTL;      /**< 0x014C: IF3 Message Control Register           */
638     uint8_t IF3DATx[8U];        /**< 0x0150-0x0154: IF3 Data A and B Registers      */
639     uint32_t      : 32U;        /**< 0x0158: Reserved                               */
640     uint32_t      : 32U;        /**< 0x015C: Reserved                               */
641     uint32_t      IF3UEy[4U];   /**< 0x0160-0x016C: IF3 Update Enable Registers     */
642     uint32_t      : 32U;        /**< 0x0170: Reserved                               */
643     uint32_t      : 32U;        /**< 0x0174: Reserved                               */
644     uint32_t      : 32U;        /**< 0x0178: Reserved                               */
645     uint32_t      : 32U;        /**< 0x017C: Reserved                               */
646     uint32_t      : 32U;        /**< 0x0180: Reserved                               */
647     uint32_t      : 32U;        /**< 0x0184: Reserved                               */
648     uint32_t      : 32U;        /**< 0x0188: Reserved                               */
649     uint32_t      : 32U;        /**< 0x018C: Reserved                               */
650     uint32_t      : 32U;        /**< 0x0190: Reserved                               */
651     uint32_t      : 32U;        /**< 0x0194: Reserved                               */
652     uint32_t      : 32U;        /**< 0x0198: Reserved                               */
653     uint32_t      : 32U;        /**< 0x019C: Reserved                               */
654     uint32_t      : 32U;        /**< 0x01A0: Reserved                               */
655     uint32_t      : 32U;        /**< 0x01A4: Reserved                               */
656     uint32_t      : 32U;        /**< 0x01A8: Reserved                               */
657     uint32_t      : 32U;        /**< 0x01AC: Reserved                               */
658     uint32_t      : 32U;        /**< 0x01B0: Reserved                               */
659     uint32_t      : 32U;        /**< 0x01B4: Reserved                               */
660     uint32_t      : 32U;        /**< 0x01B8: Reserved                               */
661     uint32_t      : 32U;        /**< 0x01BC: Reserved                               */
662     uint32_t      : 32U;        /**< 0x01C0: Reserved                               */
663     uint32_t      : 32U;        /**< 0x01C4: Reserved                               */
664     uint32_t      : 32U;        /**< 0x01C8: Reserved                               */
665     uint32_t      : 32U;        /**< 0x01CC: Reserved                               */
666     uint32_t      : 32U;        /**< 0x01D0: Reserved                               */
667     uint32_t      : 32U;        /**< 0x01D4: Reserved                               */
668     uint32_t      : 32U;        /**< 0x01D8: Reserved                               */
669     uint32_t      : 32U;        /**< 0x01DC: Reserved                               */
670     uint32_t      TIOC;         /**< 0x01E0: TX IO Control Register                 */
671     uint32_t      RIOC;         /**< 0x01E4: RX IO Control Register                 */
672 } canBASE_t;
673
674
675 /** @def canREG1
676 *   @brief CAN1 Register Frame Pointer
677 *
678 *   This pointer is used by the CAN driver to access the CAN1 registers.
679 */
680 #define canREG1 ((canBASE_t *)0xFFF7DC00U)
681
682 /** @def canREG2
683 *   @brief CAN2 Register Frame Pointer
684 *
685 *   This pointer is used by the CAN driver to access the CAN2 registers.
686 */
687 #define canREG2 ((canBASE_t *)0xFFF7DE00U)
688
689 /** @def canREG3
690 *   @brief CAN3 Register Frame Pointer
691 *
692 *   This pointer is used by the CAN driver to access the CAN3 registers.
693 */
694 #define canREG3 ((canBASE_t *)0xFFF7E000U)
695
696 /** @def canRAM1
697 *   @brief CAN1 Mailbox RAM Pointer
698 *
699 *   This pointer is used by the CAN driver to access the CAN1 RAM.
700 */
701 #define canRAM1 (*(unsigned int *)0xFF1E0000U)
702
703 /** @def canRAM2
704 *   @brief CAN2 Mailbox RAM Pointer
705 *
706 *   This pointer is used by the CAN driver to access the CAN2 RAM.
707 */
708 #define canRAM2 (*(unsigned int *)0xFF1C0000U)
709
710 /** @def canRAM3
711 *   @brief CAN3 Mailbox RAM Pointer
712 *
713 *   This pointer is used by the CAN driver to access the CAN3 RAM.
714 */
715 #define canRAM3 (*(unsigned int *)0xFF1A0000U)
716
717 /** @def canPARRAM1
718 *   @brief CAN1 Mailbox Parity RAM Pointer
719 *
720 *   This pointer is used by the CAN driver to access the CAN1 Parity RAM
721 *   for testing RAM parity error detect logic.
722 */
723 #define canPARRAM1 (*(unsigned int *)(0xFF1E0000U + 0x10))
724
725 /** @def canPARRAM2
726 *   @brief CAN2 Mailbox Pairyt RAM Pointer
727 *
728 *   This pointer is used by the CAN driver to access the CAN2 Parity RAM
729 *   for testing RAM parity error detect logic.
730 */
731 #define canPARRAM2 (*(unsigned int *)(0xFF1C0000U + 0x10))
732
733 /** @def canPARRAM3
734 *   @brief CAN3 Mailbox Parity RAM Pointer
735 *
736 *   This pointer is used by the CAN driver to access the CAN3 Parity RAM
737 *   for testing RAM parity error detect logic.
738 */
739 #define canPARRAM3 (*(unsigned int *)(0xFF1A0000U + 0x10))
740
741 /* USER CODE BEGIN (2) */
742 /* USER CODE END */
743
744
745 /* CAN Interface Functions */
746
747 void     canInit(void);
748 uint32_t canTransmit(canBASE_t *node, uint32_t messageBox, const uint8_t *data);
749 uint32_t canGetData(canBASE_t *node, uint32_t messageBox, uint8_t * const data);
750 uint32_t canIsTxMessagePending(canBASE_t *node, uint32_t messageBox);
751 uint32_t canIsRxMessageArrived(canBASE_t *node, uint32_t messageBox);
752 uint32_t canIsMessageBoxValid(canBASE_t *node, uint32_t messageBox);
753 uint32_t canGetLastError(canBASE_t *node);
754 uint32_t canGetErrorLevel(canBASE_t *node);
755 void     canEnableErrorNotification(canBASE_t *node);
756 void     canDisableErrorNotification(canBASE_t *node);
757 void canIoSetDirection(canBASE_t *node,uint32_t TxDir,uint32_t RxDir);
758 void canIoSetPort(canBASE_t *node, uint32_t TxValue, uint32_t RxValue);
759 uint32_t canIoTxGetBit(canBASE_t *node);
760 uint32_t canIoRxGetBit(canBASE_t *node);
761
762 /** @fn void canErrorNotification(canBASE_t *node, uint32_t notification)
763 *   @brief Error notification
764 *   @param[in] node Pointer to CAN node:
765 *              - canREG1: CAN1 node pointer
766 *              - canREG2: CAN2 node pointer
767 *              - canREG3: CAN3 node pointer
768 *   @param[in] notification Error notification code:
769 *           - canLEVEL_WARNING (0x40): When RX- or TX error counter are between 96 and 127
770 *           - canLEVEL_BUS_OFF (0x80): When RX- or TX error counter are above 255
771 *
772 *   @note This function has to be provide by the user.
773 */
774 void canErrorNotification(canBASE_t *node, uint32_t notification);
775
776 /** @fn void canMessageNotification(canBASE_t *node, uint32_t messageBox)
777 *   @brief Message notification
778 *   @param[in] node Pointer to CAN node:
779 *              - canREG1: CAN1 node pointer
780 *              - canREG2: CAN2 node pointer
781 *              - canREG3: CAN3 node pointer
782 *   @param[in] messageBox Message box number of CAN node:
783 *              - canMESSAGE_BOX1: CAN message box 1
784 *              - canMESSAGE_BOXn: CAN message box n [n: 1-64]
785 *              - canMESSAGE_BOX64: CAN message box 64
786 *
787 *   @note This function has to be provide by the user.
788 */
789 void canMessageNotification(canBASE_t *node, uint32_t messageBox);
790
791 /* USER CODE BEGIN (3) */
792 /* USER CODE END */
793
794
795 #endif