Connection

conn interface for CAN stack

This is the user interface to send and receive raw CAN frames or ISO-TP datagrams

CONN_CAN_DONTWAIT

Do not wait for Tx confirmation when sending.

1
(1)
CONN_CAN_RECVONLY

Do not send anything on the bus.

1
(2)
struct conn_can_raw conn_can_raw_t

RAW CAN connection.

int conn_can_raw_create(can/conn/raw.h::conn_can_raw_t * conn, struct can_filter * filter, msp430_types.h::size_t count, int ifnum, int flags)

Create can connection socket.

Parameters

conn:CAN connection
filter:list of filters to set
count:number of filters in filter
ifnum:can device Interface
flags:conn flags to set (CONN_CAN_RECVONLY)

Return values

  • 0 if socket was successfully connected
  • any other negative number in case of an error
int conn_can_raw_close(can/conn/raw.h::conn_can_raw_t * conn)

Close can connection socket.

Parameters

conn:CAN connection

Return values

  • 0 if conn is closed correctly
  • any other negative number in case of an error.
int conn_can_raw_recv(can/conn/raw.h::conn_can_raw_t * conn, struct can_frame * frame, uint32_t timeout)

Generic can receive.

Parameters

conn:CAN connection
frame:CAN frame to receive
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_raw_send(can/conn/raw.h::conn_can_raw_t * conn, const struct can_frame * frame, int flags)

Generic can send.

Parameters

conn:CAN connection
frame:frame to send
flags:make function blocked or not (CONN_CAN_DONTWAIT to ignore tx confirmation)

Return values

  • the number of bytes sent
  • any other negative number in case of an error
int conn_can_raw_set_filter(can/conn/raw.h::conn_can_raw_t * conn, struct can_filter * filter, msp430_types.h::size_t count)

Set raw CAN filters.

If filters were already set for this connection, it first unsets the previous filters and sets the new ones.

Parameters

conn:CAN connection
filter:list of filters to set
count:number of filters in filter

Return values

  • 0 if can filters were successfully set
  • any other negative number in case of an error
CONN_CAN_RAW_MBOX_SIZE

Mailbox size of a conn_can_raw_t.

1
(16)
struct conn_can_raw

RAW CAN connection.

int ifnum

Interface number of the can device.

int flags

Config flags for that conn object.

msp430_types.h::size_t count

number of filters set

struct can_filter * filter

list of filter

mbox_t mbox

mbox

msg_t mbox_queue()

message queue