amiro-os / core / inc / aos_rtcan.h @ d2931db9
History | View | Annotate | Download (1.096 KB)
1 | d2931db9 | Julian L | #ifndef AOS_RTCAN
|
---|---|---|---|
2 | #define AOS_RTCAN
|
||
3 | |||
4 | #endif // AOS_RTCAN |
||
5 | |||
6 | #include <hal.h> |
||
7 | #include <hal_can.h> |
||
8 | |||
9 | #include <stdint.h> |
||
10 | |||
11 | |||
12 | /* include msg_types */
|
||
13 | |||
14 | /* include rtcanconfig */
|
||
15 | |||
16 | typedef uint16_t rtcan_id_t;
|
||
17 | |||
18 | typedef struct { |
||
19 | rtcan_id_t id; |
||
20 | uint8_t* payload; |
||
21 | uint8_t laxity:5;
|
||
22 | uint8_t fragmentCounter:7;
|
||
23 | uint8_t payloadSize; |
||
24 | |||
25 | }rtcan_msg_t; |
||
26 | |||
27 | typedef struct { |
||
28 | struct rtcan_msg_t *head;
|
||
29 | struct rtcan_msg_t *tail;
|
||
30 | uint8_t size; |
||
31 | |||
32 | }msgqueue_t; |
||
33 | |||
34 | typedef struct{ |
||
35 | uint8_t fragment:7;
|
||
36 | |||
37 | }rtcan_frame_t; |
||
38 | |||
39 | |||
40 | |||
41 | /*===========================================================================*/
|
||
42 | /* External declarations. */
|
||
43 | /*===========================================================================*/
|
||
44 | |||
45 | #ifdef __cplusplus
|
||
46 | extern "C" { |
||
47 | #endif
|
||
48 | msg_t rtcan_transmit(CANDriver *canp, |
||
49 | canmbx_t mailbox, |
||
50 | const CANTxFrame *ctfp);
|
||
51 | msg_t rtcan_receive(CANDriver *canp, |
||
52 | canmbx_t mailbox, |
||
53 | CANRxFrame *crfp); |
||
54 | #ifdef __cplusplus
|
||
55 | } |
||
56 | #endif
|
||
57 | |||
58 | |||
59 | |||
60 | //TODO: public methods |