raw.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2016 OTA keys S.A.
3  * SPDX-License-Identifier: LGPL-2.1-only
4  */
5 
6 #pragma once
7 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
28 #include "can/can.h"
29 #include "can/raw.h"
30 #include "mbox.h"
31 
32 #ifndef CONN_CAN_RAW_MBOX_SIZE
36 #define CONN_CAN_RAW_MBOX_SIZE (16)
37 #endif
38 
43 #define CONN_CAN_DONTWAIT (1)
44 #define CONN_CAN_RECVONLY (2)
50 typedef struct conn_can_raw {
51  int ifnum;
52  int flags;
53  size_t count;
54  struct can_filter *filter;
61 
76 int conn_can_raw_create(conn_can_raw_t *conn, struct can_filter *filter, size_t count,
77  int ifnum, int flags);
78 
88 
99 int conn_can_raw_recv(conn_can_raw_t *conn, can_frame_t *frame, uint32_t timeout);
100 
112 int conn_can_raw_send(conn_can_raw_t *conn, const can_frame_t *frame, int flags);
113 
131 int conn_can_raw_set_filter(conn_can_raw_t *conn, struct can_filter *filter, size_t count);
132 
133 #ifdef __cplusplus
134 }
135 #endif
136 
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:36
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:125
Controller Area Network frame.
Definition: can.h:97
RAW CAN connection.
Definition: raw.h:50
struct can_filter * filter
list of filter
Definition: raw.h:54
msg_t mbox_queue[CONN_CAN_RAW_MBOX_SIZE]
message queue
Definition: raw.h:59
size_t count
number of filters set
Definition: raw.h:53
mbox_t mbox
mbox
Definition: raw.h:55
int flags
Config flags for that conn object.
Definition: raw.h:52
int ifnum
Interface number of the can device.
Definition: raw.h:51
Mailbox struct definition.
Definition: mbox.h:37
Describes a message object which can be sent between threads.
Definition: msg.h:192
Definitions high-level CAN interface.