Loading...
Searching...
No Matches
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...
 

Macros

#define CAN_ISOTP_BS   (10)
 Default Block Size for RX Flow Control frames.
 
#define CAN_ISOTP_STMIN   (5)
 Default STmin for RX Flow Control frames.
 
#define CAN_ISOTP_WFTMAX   (1)
 Default maximum WFT for TX Flow Control.
 

Functions

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

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
 

Macro Definition Documentation

◆ CAN_ISOTP_BS

#define CAN_ISOTP_BS   (10)

Default Block Size for RX Flow Control frames.

Definition at line 38 of file isotp.h.

◆ CAN_ISOTP_DEFAULT_EXT_ADDRESS

#define CAN_ISOTP_DEFAULT_EXT_ADDRESS   0x00

Definition at line 141 of file isotp.h.

◆ CAN_ISOTP_DEFAULT_FLAGS

#define CAN_ISOTP_DEFAULT_FLAGS   0

Definition at line 140 of file isotp.h.

◆ CAN_ISOTP_DEFAULT_FRAME_TXTIME

#define CAN_ISOTP_DEFAULT_FRAME_TXTIME   0

Definition at line 143 of file isotp.h.

◆ CAN_ISOTP_DEFAULT_PAD_CONTENT

#define CAN_ISOTP_DEFAULT_PAD_CONTENT   0xCC /* prevent bit-stuffing */

Definition at line 142 of file isotp.h.

◆ CAN_ISOTP_DEFAULT_RECV_BS

#define CAN_ISOTP_DEFAULT_RECV_BS   0

Definition at line 144 of file isotp.h.

◆ CAN_ISOTP_DEFAULT_RECV_STMIN

#define CAN_ISOTP_DEFAULT_RECV_STMIN   0x00

Definition at line 145 of file isotp.h.

◆ CAN_ISOTP_DEFAULT_RECV_WFTMAX

#define CAN_ISOTP_DEFAULT_RECV_WFTMAX   0

Definition at line 146 of file isotp.h.

◆ CAN_ISOTP_EXTEND_ADDR

#define CAN_ISOTP_EXTEND_ADDR   0x0002

enable extended addressing

Definition at line 127 of file isotp.h.

◆ CAN_ISOTP_HALF_DUPLEX

#define CAN_ISOTP_HALF_DUPLEX   0x0040

half duplex error state handling

Definition at line 129 of file isotp.h.

◆ CAN_ISOTP_LISTEN_MODE

#define CAN_ISOTP_LISTEN_MODE   0x0001

listen only flag (do not send FC)

Definition at line 126 of file isotp.h.

◆ CAN_ISOTP_RX_EXT_ADDR

#define CAN_ISOTP_RX_EXT_ADDR   0x0200

different rx extended addressing

Definition at line 130 of file isotp.h.

◆ CAN_ISOTP_RX_FLAGS_MASK

#define CAN_ISOTP_RX_FLAGS_MASK   0x0000FFFF

rx flags mask

Definition at line 125 of file isotp.h.

◆ CAN_ISOTP_STMIN

#define CAN_ISOTP_STMIN   (5)

Default STmin for RX Flow Control frames.

Definition at line 45 of file isotp.h.

◆ CAN_ISOTP_TX_DONT_WAIT

#define CAN_ISOTP_TX_DONT_WAIT   0x00010000

do not send a tx confirmation msg

Definition at line 133 of file isotp.h.

◆ CAN_ISOTP_TX_FLAGS_MASK

#define CAN_ISOTP_TX_FLAGS_MASK   0xFFFF0000

tx flags mask

Definition at line 132 of file isotp.h.

◆ CAN_ISOTP_TX_PADDING

#define CAN_ISOTP_TX_PADDING   0x0004

enable CAN frame padding tx path

Definition at line 128 of file isotp.h.

◆ CAN_ISOTP_WFTMAX

#define CAN_ISOTP_WFTMAX   (1)

Default maximum WFT for TX Flow Control.

Definition at line 52 of file isotp.h.

Function Documentation

◆ isotp_bind()

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

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
fc_optionsflow control parameters, bs and stmin for rx, wftmax for tx, if NULL, default values will be used
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 release
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 occurred (-EBUSY, -ENOMEM)