ISO transport protocol over CAN

ISO transport protocol over CAN (ISO15765) More...

Detailed Description

ISO transport protocol over CAN (ISO15765)

Files

file  isotp.h
 ISO TP high level interface.
 

Data Structures

struct  isotp_fc_options
 The isotp_fc_options struct. More...
 
struct  isotp_options
 The isotp_options struct. More...
 
struct  tpcon
 The tpcon struct. More...
 
struct  isotp
 The isotp struct. More...
 

Functions

kernel_pid_t isotp_init (char *stack, int stacksize, char priority, const char *name)
 Initialize the isotp layer. More...
 
int isotp_send (struct isotp *isotp, const void *buf, int len, int flags)
 Send data through an isotp channel. More...
 
int isotp_bind (struct isotp *isotp, can_reg_entry_t *entry, void *arg)
 Bind an isotp channel. More...
 
int isotp_release (struct isotp *isotp)
 Release a bound isotp channel. More...
 
void isotp_free_rx (can_rx_data_t *rx)
 Free a received buffer. More...
 

flags for isotp behaviour

#define CAN_ISOTP_RX_FLAGS_MASK   0x0000FFFF
 rx flags mask
 
#define CAN_ISOTP_LISTEN_MODE   0x0001
 listen only flag (do not send FC)
 
#define CAN_ISOTP_EXTEND_ADDR   0x0002
 enable extended addressing
 
#define CAN_ISOTP_TX_PADDING   0x0004
 enable CAN frame padding tx path
 
#define CAN_ISOTP_HALF_DUPLEX   0x0040
 half duplex error state handling
 
#define CAN_ISOTP_RX_EXT_ADDR   0x0200
 different rx extended addressing
 
#define CAN_ISOTP_TX_FLAGS_MASK   0xFFFF0000
 tx flags mask
 
#define CAN_ISOTP_TX_DONT_WAIT   0x00010000
 do not send a tx confirmation msg
 

default configuration values

#define CAN_ISOTP_DEFAULT_FLAGS   0
 
#define CAN_ISOTP_DEFAULT_EXT_ADDRESS   0x00
 
#define CAN_ISOTP_DEFAULT_PAD_CONTENT   0xCC /* prevent bit-stuffing */
 
#define CAN_ISOTP_DEFAULT_FRAME_TXTIME   0
 
#define CAN_ISOTP_DEFAULT_RECV_BS   0
 
#define CAN_ISOTP_DEFAULT_RECV_STMIN   0x00
 
#define CAN_ISOTP_DEFAULT_RECV_WFTMAX   0
 

Function Documentation

◆ isotp_bind()

int isotp_bind ( struct isotp isotp,
can_reg_entry_t entry,
void *  arg 
)

Bind an isotp channel.

Initialize the channel, set the filter on the DLL and add the channel to the list of bound channels

Parameters
isotpthe channel to bind
entryentry identifying the CAN ifnum and the upper layer either by its pid or its mailbox
argupper layer private parameter
Returns
0 on success, < 0 on error

◆ isotp_free_rx()

void isotp_free_rx ( can_rx_data_t rx)

Free a received buffer.

This MUST be called by the upper layer when the received data are read

Parameters
rxthe received data

◆ isotp_init()

kernel_pid_t isotp_init ( char *  stack,
int  stacksize,
char  priority,
const char *  name 
)

Initialize the isotp layer.

Parameters
stackstack for the isotp thread
stacksizesize of stack
prioritypriority of the isotp thread
namename of the isotp thread
Returns
the pid of the isotp thread

◆ isotp_release()

int isotp_release ( struct isotp isotp)

Release a bound isotp channel.

Unset the filter on the DLL and remove the channel from the list of bound channels

Parameters
isotpthe channel to relase
Returns
0 on success, < 0 on error

◆ isotp_send()

int isotp_send ( struct isotp isotp,
const void *  buf,
int  len,
int  flags 
)

Send data through an isotp channel.

Parameters
isotpthe channel to use
bufthe data to send
lenlength of the data to send
flagsflags for sending
Returns
the number of bytes sent
< 0 if an error occured (-EBUSY, -ENOMEM)