Lely core libraries 2.3.4
vcan.h
Go to the documentation of this file.
1
30#ifndef LELY_IO2_VCAN_H_
31#define LELY_IO2_VCAN_H_
32
33#include <lely/io2/can.h>
34#include <lely/io2/clock.h>
35
36#ifdef __cplusplus
37extern "C" {
38#endif
39
40void *io_vcan_ctrl_alloc(void);
41void io_vcan_ctrl_free(void *ptr);
42io_can_ctrl_t *io_vcan_ctrl_init(io_can_ctrl_t *ctrl, io_clock_t *clock,
43 int flags, int nominal, int data, int state);
44void io_vcan_ctrl_fini(io_can_ctrl_t *ctrl);
45
69 io_clock_t *clock, int flags, int nominal, int data, int state);
70
73
91void io_vcan_ctrl_set_state(io_can_ctrl_t *ctrl, int state);
92
110 io_can_ctrl_t *ctrl, const struct can_msg *msg, int timeout);
111
131 io_can_ctrl_t *ctrl, const struct can_err *err, int timeout);
132
133void *io_vcan_chan_alloc(void);
134void io_vcan_chan_free(void *ptr);
135io_can_chan_t *io_vcan_chan_init(io_can_chan_t *chan, io_ctx_t *ctx,
136 ev_exec_t *exec, size_t rxlen);
137void io_vcan_chan_fini(io_can_chan_t *chan);
138
153 io_ctx_t *ctx, ev_exec_t *exec, size_t rxlen);
154
157
163
172
177int io_vcan_chan_is_open(const io_can_chan_t *chan);
178
186
187#ifdef __cplusplus
188}
189#endif
190
191#endif // !LELY_IO2_VCAN_H_
This header file is part of the I/O library; it contains the abstract clock interface.
const struct io_clock_vtbl *const io_clock_t
An abstract clock.
Definition: clock.h:36
const struct ev_exec_vtbl *const ev_exec_t
An abstract task executor.
Definition: ev.h:29
This header file is part of the I/O library; it contains the abstract CAN bus interface.
const struct io_can_chan_vtbl *const io_can_chan_t
An abstract CAN channel.
Definition: can.h:59
const struct io_can_ctrl_vtbl *const io_can_ctrl_t
An abstract CAN controller.
Definition: can.h:56
A CAN error frame.
Definition: err.h:28
A CAN or CAN FD format frame.
Definition: msg.h:87
Definition: ctx.c:38
void io_vcan_chan_destroy(io_can_chan_t *chan)
Destroys a virtual CAN channel.
Definition: vcan.c:600
void io_vcan_ctrl_set_state(io_can_ctrl_t *ctrl, int state)
Sets the state of a virtual CAN bus: one of CAN_STATE_ACTIVE, CAN_STATE_PASSIVE, CAN_STATE_BUSOFF,...
Definition: vcan.c:390
io_can_ctrl_t * io_vcan_ctrl_create(io_clock_t *clock, int flags, int nominal, int data, int state)
Creates a new virtual CAN controller.
Definition: vcan.c:352
void io_vcan_chan_close(io_can_chan_t *chan)
Closes a virtual CAN channel.
Definition: vcan.c:639
int io_vcan_ctrl_write_err(io_can_ctrl_t *ctrl, const struct can_err *err, int timeout)
Writes a CAN error frame to a all virtual CAN channels registered with a virtual CAN controller.
Definition: vcan.c:426
void io_vcan_chan_open(io_can_chan_t *chan, io_can_ctrl_t *ctrl)
Opens a virtual CAN channel by registering it with the specified virtual CAN controller.
Definition: vcan.c:625
int io_vcan_chan_is_open(const io_can_chan_t *chan)
Returns 1 if the CAN channel is open and 0 if not.
Definition: vcan.c:633
int io_vcan_ctrl_write_msg(io_can_ctrl_t *ctrl, const struct can_msg *msg, int timeout)
Writes a CAN frame to a all virtual CAN channels registered with a virtual CAN controller.
Definition: vcan.c:419
io_can_chan_t * io_vcan_chan_create(io_ctx_t *ctx, ev_exec_t *exec, size_t rxlen)
Creates a new virtual CAN channel.
Definition: vcan.c:573
io_can_ctrl_t * io_vcan_chan_get_ctrl(const io_can_chan_t *chan)
Returns a pointer to the virtual CAN controller with which a virtual CAN channel is registered,...
Definition: vcan.c:609
void io_vcan_ctrl_destroy(io_can_ctrl_t *ctrl)
Destroys a virtual CAN controller.
Definition: vcan.c:381