Definitions of generic CAN interface.
More...
Definitions of generic CAN interface.
- Author
- Vincent Dupont vince.nosp@m.nt@o.nosp@m.takey.nosp@m.s.co.nosp@m.m
Definition in file isotp.h.
#include "can/can.h"
#include "can/isotp.h"
#include "mbox.h"
#include "mutex.h"
Go to the source code of this file.
|
struct | conn_can_isotp_slave |
| ISO-TP salve connection. More...
|
|
struct | conn_can_isotp_master |
| ISO-TP master connection. More...
|
|
#define | CONN_CAN_ISOTP_MBOX_SIZE (16) |
| Mailbox size of a conn_can_isotp_t.
|
|
typedef struct conn_can_isotp_master | conn_can_isotp_t |
| ISO-TP connection.
|
|
typedef struct conn_can_isotp_slave | conn_can_isotp_slave_t |
| ISO-TP salve connection.
|
|
static void | conn_can_isotp_init_slave (conn_can_isotp_t *master, conn_can_isotp_slave_t *slave) |
| Initialize a slave connection.
|
|
int | conn_can_isotp_create (conn_can_isotp_t *conn, struct isotp_options *options, int ifnum) |
| Create can isotp connection socket.
|
|
int | conn_can_isotp_bind (conn_can_isotp_t *conn, struct isotp_fc_options *fc_options) |
| Bind a can isotp connection.
|
|
int | conn_can_isotp_close (conn_can_isotp_t *conn) |
| Close can isotp connection socket.
|
|
int | conn_can_isotp_recv (conn_can_isotp_t *conn, void *buf, size_t size, uint32_t timeout) |
| Receive isotp data.
|
|
int | conn_can_isotp_send (conn_can_isotp_t *conn, const void *buf, size_t size, int flags) |
| Generic can send.
|
|
int | conn_can_isotp_select (conn_can_isotp_slave_t **conn, conn_can_isotp_t *master, uint32_t timeout) |
| Wait for reception from multiple connections.
|
|
◆ CONN_CAN_ISOTP_MBOX_SIZE
#define CONN_CAN_ISOTP_MBOX_SIZE (16) |
Mailbox size of a conn_can_isotp_t.
Definition at line 38 of file isotp.h.
◆ conn_can_isotp_slave_t
ISO-TP salve connection.
This is a slave connection which exists only when conn_can_isotp_multi module is used.
◆ conn_can_isotp_t
ISO-TP connection.
When conn_can_isotp_multi module is used, this is a 'master' connection which can be used to send and receive with multiple connections within a single thread.
If conn_can_isotp_multi is not used, this is a simple ISO-TP connection
Definition at line 50 of file isotp.h.
◆ conn_can_isotp_bind()
Bind a can isotp connection.
- Parameters
-
[in,out] | conn | ISO-TP connection |
[in] | fc_options | ISO-TP flow control options, can be NULL for default parameters |
- Returns
- 0 on success
-
any other negative number in case of an error
◆ conn_can_isotp_close()
Close can isotp connection socket.
- Parameters
-
[in] | conn | ISO-TP connection |
- Returns
- 0 if conn is closed correctly
-
any other negative number in case of an error
◆ conn_can_isotp_create()
Create can isotp connection socket.
- Parameters
-
[in,out] | conn | ISO-TP connection |
[in] | options | ISO-TP options |
[in] | ifnum | can device Interface |
- Returns
- 0 if socket was successfully connected
-
any other negative number in case of an error
◆ conn_can_isotp_init_slave()
Initialize a slave connection.
This initializes a slave connection.
This must be called on slave connections when conn_can_isotp_multi is used. Does not exist otherwise.
- Parameters
-
[in] | master | the master connection |
[in,out] | slave | the slave connection to initialize |
Definition at line 96 of file isotp.h.
◆ conn_can_isotp_recv()
int conn_can_isotp_recv |
( |
conn_can_isotp_t * |
conn, |
|
|
void * |
buf, |
|
|
size_t |
size, |
|
|
uint32_t |
timeout |
|
) |
| |
Receive isotp data.
- Parameters
-
[in] | conn | ISO-TP connection |
[out] | buf | buf to fill in with received data |
[in] | size | size of the buffer in bytes |
[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_isotp_select()
Wait for reception from multiple connections.
- Parameters
-
[out] | conn | ISO-TP connection which received data |
[in] | master | the master connection |
[in] | timeout | timeout in us, 0 for infinite wait |
- Returns
- 0 if OK, < 0 if error
◆ conn_can_isotp_send()
int conn_can_isotp_send |
( |
conn_can_isotp_t * |
conn, |
|
|
const void * |
buf, |
|
|
size_t |
size, |
|
|
int |
flags |
|
) |
| |
Generic can send.
- Parameters
-
[in] | conn | ISO-TP connection |
[in] | buf | data to send |
[in] | size | size of the buffer in bytes |
[in] | flags | make function blocked or not (CAN_ISOTP_TX_DONT_WAIT to ignore tx confirmation) |
- Returns
- the number of bytes sent
-
any other negative number in case of an error