Loading...
Searching...
No Matches
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
23
24#ifdef __cplusplus
25extern "C" {
26#endif
27
28#include "compiler_hints.h"
29#include "can/can.h"
30#include "can/raw.h"
31#include "mbox.h"
32
33#ifndef CONN_CAN_RAW_MBOX_SIZE
37#define CONN_CAN_RAW_MBOX_SIZE (16)
38#endif
39
44#define CONN_CAN_DONTWAIT (1)
45#define CONN_CAN_RECVONLY (2)
47
62
77ACCESS(read_only, 2, 3)
78int conn_can_raw_create(conn_can_raw_t *conn, const struct can_filter *filter, size_t count,
79 int ifnum, int flags);
80
90
101int conn_can_raw_recv(conn_can_raw_t *conn, can_frame_t *frame, uint32_t timeout);
102
114int conn_can_raw_send(conn_can_raw_t *conn, const can_frame_t *frame, int flags);
115
133ACCESS(read_only, 2, 3)
134int conn_can_raw_set_filter(conn_can_raw_t *conn, const struct can_filter *filter, size_t count);
135
136#ifdef __cplusplus
137}
138#endif
139
Definitions high-level RAW CAN interface.
Common macros and compiler attributes/pragmas configuration.
#define ACCESS(mode, ptr_idx, size_idx)
Emit an attribute (if supported by the compiler) that declares how a function will access its paramet...
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:37
int conn_can_raw_set_filter(conn_can_raw_t *conn, const struct can_filter *filter, size_t count)
Set raw CAN filters.
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_create(conn_can_raw_t *conn, const struct can_filter *filter, size_t count, int ifnum, int flags)
Create can connection socket.
int conn_can_raw_recv(conn_can_raw_t *conn, can_frame_t *frame, uint32_t timeout)
Generic can receive.
struct can_frame can_frame_t
CAN frame.
Definition can.h:175
Mailbox API.
Controller Area Network filter.
Definition can.h:125
RAW CAN connection.
Definition raw.h:51
msg_t mbox_queue[CONN_CAN_RAW_MBOX_SIZE]
message queue
Definition raw.h:60
size_t count
number of filters set
Definition raw.h:54
mbox_t mbox
mbox
Definition raw.h:56
const struct can_filter * filter
list of filter
Definition raw.h:55
int flags
Config flags for that conn object.
Definition raw.h:53
int ifnum
Interface number of the can device.
Definition raw.h:52
Mailbox struct definition.
Definition mbox.h:38
Describes a message object which can be sent between threads.
Definition msg.h:193
Definitions high-level CAN interface.