raw.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2016 OTA keys S.A.
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
25 #ifndef CAN_CONN_RAW_H
26 #define CAN_CONN_RAW_H
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
32 #include "can/can.h"
33 #include "can/raw.h"
34 #include "mbox.h"
35 
36 #ifndef CONN_CAN_RAW_MBOX_SIZE
40 #define CONN_CAN_RAW_MBOX_SIZE (16)
41 #endif
42 
47 #define CONN_CAN_DONTWAIT (1)
48 #define CONN_CAN_RECVONLY (2)
54 typedef struct conn_can_raw {
55  int ifnum;
56  int flags;
57  size_t count;
58  struct can_filter *filter;
65 
80 int conn_can_raw_create(conn_can_raw_t *conn, struct can_filter *filter, size_t count,
81  int ifnum, int flags);
82 
92 
103 int conn_can_raw_recv(conn_can_raw_t *conn, can_frame_t *frame, uint32_t timeout);
104 
116 int conn_can_raw_send(conn_can_raw_t *conn, const can_frame_t *frame, int flags);
117 
135 int conn_can_raw_set_filter(conn_can_raw_t *conn, struct can_filter *filter, size_t count);
136 
137 #ifdef __cplusplus
138 }
139 #endif
140 
141 #endif /* CAN_CONN_RAW_H */
Definitions high-level RAW CAN interface.
int conn_can_raw_create(conn_can_raw_t *conn, struct can_filter *filter, size_t count, int ifnum, int flags)
Create can connection socket.
struct conn_can_raw conn_can_raw_t
RAW CAN connection.
#define CONN_CAN_RAW_MBOX_SIZE
Mailbox size of a conn_can_raw_t.
Definition: raw.h:40
int conn_can_raw_send(conn_can_raw_t *conn, const can_frame_t *frame, int flags)
Generic can send.
int conn_can_raw_close(conn_can_raw_t *conn)
Close can connection socket.
int conn_can_raw_set_filter(conn_can_raw_t *conn, struct can_filter *filter, size_t count)
Set raw CAN filters.
int conn_can_raw_recv(conn_can_raw_t *conn, can_frame_t *frame, uint32_t timeout)
Generic can receive.
Mailbox API.
Controller Area Network filter.
Definition: can.h:129
Controller Area Network frame.
Definition: can.h:101
RAW CAN connection.
Definition: raw.h:54
struct can_filter * filter
list of filter
Definition: raw.h:58
msg_t mbox_queue[CONN_CAN_RAW_MBOX_SIZE]
message queue
Definition: raw.h:63
size_t count
number of filters set
Definition: raw.h:57
mbox_t mbox
mbox
Definition: raw.h:59
int flags
Config flags for that conn object.
Definition: raw.h:56
int ifnum
Interface number of the can device.
Definition: raw.h:55
Mailbox struct definition.
Definition: mbox.h:41
Describes a message object which can be sent between threads.
Definition: msg.h:196
Definitions high-level CAN interface.