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 
9 #pragma once
10 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
31 #include "can/can.h"
32 #include "can/raw.h"
33 #include "mbox.h"
34 
35 #ifndef CONN_CAN_RAW_MBOX_SIZE
39 #define CONN_CAN_RAW_MBOX_SIZE (16)
40 #endif
41 
46 #define CONN_CAN_DONTWAIT (1)
47 #define CONN_CAN_RECVONLY (2)
53 typedef struct conn_can_raw {
54  int ifnum;
55  int flags;
56  size_t count;
57  struct can_filter *filter;
64 
79 int conn_can_raw_create(conn_can_raw_t *conn, struct can_filter *filter, size_t count,
80  int ifnum, int flags);
81 
91 
102 int conn_can_raw_recv(conn_can_raw_t *conn, can_frame_t *frame, uint32_t timeout);
103 
115 int conn_can_raw_send(conn_can_raw_t *conn, const can_frame_t *frame, int flags);
116 
134 int conn_can_raw_set_filter(conn_can_raw_t *conn, struct can_filter *filter, size_t count);
135 
136 #ifdef __cplusplus
137 }
138 #endif
139 
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:39
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:128
Controller Area Network frame.
Definition: can.h:100
RAW CAN connection.
Definition: raw.h:53
struct can_filter * filter
list of filter
Definition: raw.h:57
msg_t mbox_queue[CONN_CAN_RAW_MBOX_SIZE]
message queue
Definition: raw.h:62
size_t count
number of filters set
Definition: raw.h:56
mbox_t mbox
mbox
Definition: raw.h:58
int flags
Config flags for that conn object.
Definition: raw.h:55
int ifnum
Interface number of the can device.
Definition: raw.h:54
Mailbox struct definition.
Definition: mbox.h:40
Describes a message object which can be sent between threads.
Definition: msg.h:195
Definitions high-level CAN interface.