Statistics
| Branch: | Tag: | Revision:

amiro-os / core / inc / aos_rtcan.h @ e7131d09

History | View | Annotate | Download (1.264 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 e7131d09 Julian Leichert
#include <hal_can_lld.h>
9 d2931db9 Julian L
10
#include <stdint.h>
11
12
13
/* include msg_types */
14
15
/* include rtcanconfig */
16
17
typedef uint16_t rtcan_id_t;
18
19 e7131d09 Julian Leichert
typedef struct rtcan_msg_t{
20 d2931db9 Julian L
    rtcan_id_t id;
21
    uint8_t* payload;
22
    uint8_t laxity:5;
23
    uint8_t fragmentCounter:7;
24
    uint8_t payloadSize;
25 e7131d09 Julian Leichert
    uint8_t msgType:2;
26
    systime_t deadline;
27
    struct rtcan_msg_t *next;
28
29 d2931db9 Julian L
30
}rtcan_msg_t;
31
32
typedef struct {
33 e7131d09 Julian Leichert
    rtcan_msg_t *head;
34
    rtcan_msg_t *tail;
35 d2931db9 Julian L
    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 e7131d09 Julian Leichert
  bool enqueueMsg(uint8_t *payload,uint8_t msgType,systime_t deadline);
60 d2931db9 Julian L
#ifdef __cplusplus
61
}
62
#endif
63
64
65
66
//TODO: public methods