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
37 
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, struct can_frame *frame, uint32_t timeout);
104 
116 int conn_can_raw_send(conn_can_raw_t *conn, const struct can_frame *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 
138 #ifdef __cplusplus
139 }
140 #endif
141 
142 #endif /* CAN_CONN_RAW_H */
143 
conn_can_raw
RAW CAN connection.
Definition: raw.h:54
conn_can_raw_recv
int conn_can_raw_recv(conn_can_raw_t *conn, struct can_frame *frame, uint32_t timeout)
Generic can receive.
conn_can_raw::ifnum
int ifnum
Interface number of the can device.
Definition: raw.h:55
conn_can_raw_set_filter
int conn_can_raw_set_filter(conn_can_raw_t *conn, struct can_filter *filter, size_t count)
Set raw CAN filters.
can.h
Definitions high-level CAN interface.
can_filter
Controller Area Network filter.
Definition: can.h:101
conn_can_raw::filter
struct can_filter * filter
list of filter
Definition: raw.h:58
conn_can_raw::count
size_t count
number of filters set
Definition: raw.h:57
conn_can_raw_send
int conn_can_raw_send(conn_can_raw_t *conn, const struct can_frame *frame, int flags)
Generic can send.
mbox_t
Mailbox struct definition.
Definition: mbox.h:41
mbox.h
Mailbox API.
conn_can_raw::flags
int flags
Config flags for that conn object.
Definition: raw.h:56
can_frame
Controller Area Network frame.
Definition: can.h:88
CONN_CAN_RAW_MBOX_SIZE
#define CONN_CAN_RAW_MBOX_SIZE
Mailbox size of a conn_can_raw_t.
Definition: raw.h:40
raw.h
Definitions high-level RAW CAN interface.
conn_can_raw_t
struct conn_can_raw conn_can_raw_t
RAW CAN connection.
conn_can_raw_create
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.
msg_t
Describes a message object which can be sent between threads.
Definition: msg.h:185
conn_can_raw::mbox
mbox_t mbox
mbox
Definition: raw.h:59
conn_can_raw_close
int conn_can_raw_close(conn_can_raw_t *conn)
Close can connection socket.