Lely core libraries 2.3.4
can_net.h
Go to the documentation of this file.
1
28#ifndef LELY_IO2_CAN_NET_H_
29#define LELY_IO2_CAN_NET_H_
30
31#include <lely/io2/can.h>
32#include <lely/io2/tqueue.h>
33
35typedef struct io_can_net io_can_net_t;
36
37// Avoid including <lely/can/net.h>.
38struct __can_net;
39
40#ifdef __cplusplus
41extern "C" {
42#endif
43
54typedef void io_can_net_on_error_func_t(int errc, size_t errcnt, void *arg);
55
73 int new_state, int old_state, void *arg);
74
87typedef void io_can_net_on_can_error_func_t(int error, void *arg);
88
89void *io_can_net_alloc(void);
90void io_can_net_free(void *ptr);
91io_can_net_t *io_can_net_init(io_can_net_t *net, ev_exec_t *exec,
92 io_timer_t *timer, io_can_chan_t *chan, size_t txlen,
93 int txtimeo);
94void io_can_net_fini(io_can_net_t *net);
95
117 io_can_chan_t *chan, size_t txlen, int txtimeo);
118
121
128
134
140
143
146
160 io_can_net_on_error_func_t **pfunc, void **parg);
161
175 io_can_net_t *net, io_can_net_on_error_func_t *func, void *arg);
176
191 io_can_net_on_error_func_t **pfunc, void **parg);
192
207 io_can_net_t *net, io_can_net_on_error_func_t *func, void *arg);
208
222 io_can_net_on_error_func_t **pfunc, void **parg);
223
237 io_can_net_t *net, io_can_net_on_error_func_t *func, void *arg);
238
251 io_can_net_on_can_state_func_t **pfunc, void **parg);
252
265 io_can_net_on_can_state_func_t *func, void *arg);
266
279 io_can_net_on_can_error_func_t **pfunc, void **parg);
280
293 io_can_net_on_can_error_func_t *func, void *arg);
294
304
314
323struct __can_net *io_can_net_get_net(const io_can_net_t *net);
324
337
338#ifdef __cplusplus
339}
340#endif
341
342#endif // !LELY_IO2_CAN_NET_H_
io_clock_t * io_can_net_get_clock(const io_can_net_t *net)
Returns a pointer to the clock used by the CAN network interface.
Definition can_net.c:463
void io_can_net_set_on_read_error_func(io_can_net_t *net, io_can_net_on_error_func_t *func, void *arg)
Sets the function invoked when a new CAN frame read error occurs, or when a read operation completes ...
Definition can_net.c:497
void io_can_net_set_on_can_state_func(io_can_net_t *net, io_can_net_on_can_state_func_t *func, void *arg)
Sets the function to be invoked when a CAN bus state change is detected.
Definition can_net.c:599
io_tqueue_t * io_can_net_get_tqueue(const io_can_net_t *net)
Returns a pointer to the internal timer queue of a CAN network interface.
Definition can_net.c:471
io_ctx_t * io_can_net_get_ctx(const io_can_net_t *net)
Returns a pointer to the I/O context with which the CAN network interface is registered.
Definition can_net.c:447
void io_can_net_get_on_read_error_func(const io_can_net_t *net, io_can_net_on_error_func_t **pfunc, void **parg)
Retrieves the function invoked when a new CAN frame read error occurs, or when a read operation compl...
Definition can_net.c:479
void io_can_net_start(io_can_net_t *net)
Starts a CAN network interface and begins processing CAN frames.
Definition can_net.c:422
int io_can_net_unlock(io_can_net_t *net)
Unlocks the mutex protecting the CAN network interface.
Definition can_net.c:663
io_can_net_t * io_can_net_create(ev_exec_t *exec, io_timer_t *timer, io_can_chan_t *chan, size_t txlen, int txtimeo)
Creates a new CAN network interface.
Definition can_net.c:384
void io_can_net_set_on_queue_error_func(io_can_net_t *net, io_can_net_on_error_func_t *func, void *arg)
Sets the function invoked when a CAN frame is dropped because the transmit queue is full,...
Definition can_net.c:531
void io_can_net_get_on_write_error_func(const io_can_net_t *net, io_can_net_on_error_func_t **pfunc, void **parg)
Retrieves the function invoked when a new CAN frame write error occurs, or when a write operation com...
Definition can_net.c:547
void io_can_net_get_on_queue_error_func(const io_can_net_t *net, io_can_net_on_error_func_t **pfunc, void **parg)
Retrieves the function invoked when a CAN frame is dropped because the transmit queue is full,...
Definition can_net.c:513
void io_can_net_get_on_can_state_func(const io_can_net_t *net, io_can_net_on_can_state_func_t **pfunc, void **parg)
Retrieves the function invoked when a CAN bus state change is detected.
Definition can_net.c:581
int io_can_net_set_time(io_can_net_t *net)
Updates the CAN network time.
Definition can_net.c:686
void io_can_net_destroy(io_can_net_t *net)
Destroys a CAN network interface.
Definition can_net.c:413
ev_exec_t * io_can_net_get_exec(const io_can_net_t *net)
Returns a pointer to the executor used by the CAN network interface to execute asynchronous tasks.
Definition can_net.c:455
void io_can_net_set_on_can_error_func(io_can_net_t *net, io_can_net_on_can_error_func_t *func, void *arg)
Sets the function to be invoked when a CAN bus error is detected.
Definition can_net.c:633
void io_can_net_get_on_can_error_func(const io_can_net_t *net, io_can_net_on_can_error_func_t **pfunc, void **parg)
Retrieves the function invoked when a CAN bus error is detected.
Definition can_net.c:615
void io_can_net_on_can_state_func_t(int new_state, int old_state, void *arg)
The type of function invoked when a CAN bus state change is detected by a CAN network interface.
Definition can_net.h:72
struct __can_net * io_can_net_get_net(const io_can_net_t *net)
Returns a pointer to the internal interface of a CAN network interface.
Definition can_net.c:678
void io_can_net_on_error_func_t(int errc, size_t errcnt, void *arg)
The type of function invoked when an error occurs during a CAN network interface operations,...
Definition can_net.h:54
int io_can_net_lock(io_can_net_t *net)
Locks the mutex protecting the CAN network interface.
Definition can_net.c:649
void io_can_net_on_can_error_func_t(int error, void *arg)
The type of function invoked when a CAN bus error is detected by an CAN network interface.
Definition can_net.h:87
void io_can_net_set_on_write_error_func(io_can_net_t *net, io_can_net_on_error_func_t *func, void *arg)
Sets the function invoked when a new CAN frame write error occurs, or when a write operation complete...
Definition can_net.c:565
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_timer_vtbl *const io_timer_t
An abstract timer.
Definition timer.h:38
A CAN network interface.
Definition net.c:37
The implementation of a CAN network interface.
Definition can_net.c:68
Definition ctx.c:38
This header file is part of the I/O library; it contains the timer queue declarations.