conn interface for CAN stack
More...
conn interface for CAN stack
This is the user interface to send and receive raw CAN frames or ISO-TP datagrams
|
file | isotp.h |
| Definitions of generic CAN interface.
|
|
file | raw.h |
| Definitions of generic CAN interface.
|
|
|
typedef struct conn_can_raw | conn_can_raw_t |
| RAW CAN connection.
|
|
|
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.
|
|
int | conn_can_raw_close (conn_can_raw_t *conn) |
| Close can connection socket.
|
|
int | conn_can_raw_recv (conn_can_raw_t *conn, struct can_frame *frame, uint32_t timeout) |
| Generic can receive.
|
|
int | conn_can_raw_send (conn_can_raw_t *conn, const struct can_frame *frame, int flags) |
| Generic can send.
|
|
int | conn_can_raw_set_filter (conn_can_raw_t *conn, struct can_filter *filter, size_t count) |
| Set raw CAN filters.
|
|
◆ CONN_CAN_DONTWAIT
#define CONN_CAN_DONTWAIT (1) |
Do not wait for Tx confirmation when sending.
Definition at line 47 of file raw.h.
◆ CONN_CAN_RAW_MBOX_SIZE
#define CONN_CAN_RAW_MBOX_SIZE (16) |
Mailbox size of a conn_can_raw_t.
Definition at line 40 of file raw.h.
◆ CONN_CAN_RECVONLY
#define CONN_CAN_RECVONLY (2) |
Do not send anything on the bus.
Definition at line 48 of file raw.h.
◆ conn_can_raw_close()
Close can connection socket.
- Parameters
-
- Returns
- 0 if conn is closed correctly
-
any other negative number in case of an error.
◆ conn_can_raw_create()
Create can connection socket.
- Parameters
-
[in,out] | conn | CAN connection |
[in] | filter | list of filters to set |
[in] | count | number of filters in filter |
[in] | ifnum | can device Interface |
[in] | flags | conn flags to set (CONN_CAN_RECVONLY) |
- Postcondition
filter
must remain allocated until conn
is closed
- Returns
- 0 if socket was successfully connected
-
any other negative number in case of an error
◆ conn_can_raw_recv()
Generic can receive.
- Parameters
-
[in] | conn | CAN connection |
[out] | frame | CAN frame to receive |
[in] | timeout | timeout in us, 0 for infinite |
- Returns
- the number of bytes received
-
any other negative number in case of an error
◆ conn_can_raw_send()
Generic can send.
- Parameters
-
[in] | conn | CAN connection |
[in] | frame | frame to send |
[in] | flags | make function blocked or not (CONN_CAN_DONTWAIT to ignore tx confirmation) |
- Returns
- the number of bytes sent
-
any other negative number in case of an error
◆ conn_can_raw_set_filter()
Set raw CAN filters.
If filters were already set for this connection, it first unsets the previous filters and sets the new ones.
- Parameters
-
[in] | conn | CAN connection |
[in] | filter | list of filters to set |
[in] | count | number of filters in filter |
- Precondition
- previously set filters must be allocated until the end of the call
- Postcondition
filter
must remain allocated until conn
is closed or conn_can_raw_set_filter() is called
- Returns
- 0 if can filters were successfully set
-
any other negative number in case of an error