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