Lely core libraries  2.2.5
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
37 extern "C" {
38 #endif
39 
40 void *io_vcan_ctrl_alloc(void);
41 void io_vcan_ctrl_free(void *ptr);
42 io_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);
44 void 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 
91 void 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 
133 void *io_vcan_chan_alloc(void);
134 void io_vcan_chan_free(void *ptr);
135 io_can_chan_t *io_vcan_chan_init(io_can_chan_t *chan, io_ctx_t *ctx,
136  ev_exec_t *exec, size_t rxlen);
137 void 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 
177 int 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_
io_vcan_chan_get_ctrl
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:592
ev_exec_t
const struct ev_exec_vtbl *const ev_exec_t
An abstract task executor.
Definition: ev.h:29
io_vcan_ctrl_write_err
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:415
can_msg
A CAN or CAN FD format frame.
Definition: msg.h:87
io_vcan_chan_destroy
void io_vcan_chan_destroy(io_can_chan_t *chan)
Destroys a virtual CAN channel.
Definition: vcan.c:583
io_vcan_chan_create
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:556
can_err
A CAN error frame.
Definition: err.h:28
io_vcan_ctrl_create
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:341
clock.h
io_vcan_ctrl_set_state
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:379
io_can_chan_t
const struct io_can_chan_vtbl *const io_can_chan_t
An abstract CAN channel.
Definition: can.h:59
io_vcan_chan_close
void io_vcan_chan_close(io_can_chan_t *chan)
Closes a virtual CAN channel.
Definition: vcan.c:622
io_vcan_ctrl_write_msg
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:408
io_vcan_chan_open
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:608
io_vcan_ctrl_destroy
void io_vcan_ctrl_destroy(io_can_ctrl_t *ctrl)
Destroys a virtual CAN controller.
Definition: vcan.c:370
can.h
io_ctx
Definition: ctx.c:35
io_clock_t
const struct io_clock_vtbl *const io_clock_t
An abstract clock.
Definition: clock.h:36
io_vcan_chan_is_open
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:616
io_can_ctrl_t
const struct io_can_ctrl_vtbl *const io_can_ctrl_t
An abstract CAN controller.
Definition: can.h:56