conn/isotp.h

Definitions of generic CAN interface.

CONN_CAN_ISOTP_MBOX_SIZE

Mailbox size of a conn_can_isotp_t.

1
(16)
struct conn_can_isotp_master 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

struct conn_can_isotp_slave 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.

void conn_can_isotp_init_slave(conn/isotp.h::conn_can_isotp_t * master, conn/isotp.h::conn_can_isotp_slave_t * 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

master:the master connection
slave:the slave connection to initialize

int conn_can_isotp_create(conn/isotp.h::conn_can_isotp_t * conn, struct isotp_options * options, int ifnum)

Create can isotp connection socket.

Parameters

conn:ISO-TP connection
options:ISO-TP options
ifnum:can device Interface

Return values

  • 0 if socket was successfully connected
  • any other negative number in case of an error
int conn_can_isotp_bind(conn/isotp.h::conn_can_isotp_t * conn)

Bind a can isotp connection.

Parameters

conn:ISO-TP connection

Return values

  • 0 on success
  • any other negative number in case of an error
int conn_can_isotp_close(conn/isotp.h::conn_can_isotp_t * conn)

Close can isotp connection socket.

Parameters

conn:ISO-TP connection

Return values

  • 0 if conn is closed correctly
  • any other negative number in case of an error
int conn_can_isotp_recv(conn/isotp.h::conn_can_isotp_t * conn, void * buf, msp430_types.h::size_t size, uint32_t timeout)

Receive isotp data.

Parameters

conn:ISO-TP connection
buf:buf to fill in with received data
size:size of the buffer in bytes
timeout:timeout in us, 0 for infinite

Return values

  • the number of bytes received
  • any other negative number in case of an error
int conn_can_isotp_send(conn/isotp.h::conn_can_isotp_t * conn, const void * buf, msp430_types.h::size_t size, int flags)

Generic can send.

Parameters

conn:ISO-TP connection
buf:data to send
size:size of the buffer in bytes
flags:make function blocked or not (CAN_ISOTP_TX_DONT_WAIT to ignore tx confirmation)

Return values

  • the number of bytes sent
  • any other negative number in case of an error
int conn_can_isotp_select(conn/isotp.h::conn_can_isotp_slave_t ** conn, conn/isotp.h::conn_can_isotp_t * master, uint32_t timeout)

Wait for reception from multiple connections.

Parameters

conn:ISO-TP connection which received data
master:the master connection
timeout:timeout in us, 0 for infinite wait

Return values

  • 0 if OK, < 0 if error
struct conn_can_isotp_slave

ISO-TP salve connection.

This is a slave connection which exists only when conn_can_isotp_multi module is used.

struct conn_can_isotp_slave * next

Next slave in the list.

struct conn_can_isotp_master * master

Master connection holding the mailbox.

struct isotp isotp

ISO-TP parameters and status.

int ifnum

interface number

int bound

1 if connection is bound

sys/include/can/common.h::can_rx_data_t * rx

Buffered rx data.

struct conn_can_isotp_master

ISO-TP master connection.

struct conn_can_isotp_slave * next

First slave in the list.

struct conn_can_isotp_master * master

Master connection.

struct isotp isotp

ISO-TP parameters and status.

int ifnum

interface number

int bound

1 if connection is bound

sys/include/can/common.h::can_rx_data_t * rx

Buffered rx data.

mutex_t lock

Master lock.

mbox_t mbox

mailbox for the connection list

msg_t mbox_queue()

Connection list message queue.