isotp-c
Platform-independent ISO 15765-2 transport for embedded C
Loading...
Searching...
No Matches
Compile-time configuration

Macros controlling frame sizes, timing, optional APIs, and platform integration. More...

Macros

#define ISO_TP_DEFAULT_BLOCK_SIZE   8
#define ISO_TP_DEFAULT_ST_MIN_US   0
#define ISO_TP_MAX_WFT_NUMBER   1
#define ISO_TP_DEFAULT_RESPONSE_TIMEOUT_US   100000
#define ISO_TP_FRAME_PADDING
#define ISO_TP_NO_FORMATTED_ERRORS
#define ISO_TP_FRAME_PADDING_VALUE   0xAA
#define ISO_TP_USER_SEND_CAN_ARG
#define ISO_TP_USER_SEND_CAN_FLAGS
#define ISO_TP_CAN_FD_USE_BRS
#define ISO_TP_TRANSMIT_COMPLETE_CALLBACK
#define ISO_TP_RECEIVE_COMPLETE_CALLBACK
#define ISO_TP_ENABLE_STREAMING

Detailed Description

Macros controlling frame sizes, timing, optional APIs, and platform integration.

Macro Definition Documentation

◆ ISO_TP_CAN_FD_USE_BRS

#define ISO_TP_CAN_FD_USE_BRS

Add ISOTP_CAN_FRAME_FLAG_BRS to CAN FD transmissions. This has an effect only with ISO_TP_USER_SEND_CAN_FLAGS.

Definition at line 128 of file isotp_config.h.

◆ ISO_TP_DEFAULT_BLOCK_SIZE

#define ISO_TP_DEFAULT_BLOCK_SIZE   8

The maximum amount of data bytes a single CAN frame may carry (CAN_DL). Classical CAN is limited to 8 bytes; CAN FD additionally allows frames of 12, 16, 20, 24, 32, 48 and 64 bytes.

Set this to one of the CAN FD lengths to enable CAN FD support. This increases the size of the internal frame buffers accordingly, so leave it at 8 on platforms without CAN FD. The CAN_DL (TX_DL) used by a freshly initialised link. This may be reduced per link at runtime using isotp_set_tx_dl(), e.g. when a peer only supports Classical CAN frame lengths. Flow Control block size advertised by the receiver. A value of 0 asks the sender not to wait for further block acknowledgements.

Definition at line 54 of file isotp_config.h.

◆ ISO_TP_DEFAULT_RESPONSE_TIMEOUT_US

#define ISO_TP_DEFAULT_RESPONSE_TIMEOUT_US   100000

Timeout for required Flow Control or Consecutive Frames, in microseconds. Keep this below half the range of the 32-bit microsecond clock so wrapping deadline comparisons remain unambiguous.

Definition at line 74 of file isotp_config.h.

◆ ISO_TP_DEFAULT_ST_MIN_US

#define ISO_TP_DEFAULT_ST_MIN_US   0

Minimum Consecutive Frame separation requested by the receiver, in microseconds.

Definition at line 60 of file isotp_config.h.

◆ ISO_TP_ENABLE_STREAMING

#define ISO_TP_ENABLE_STREAMING

Add isotp_receive_streaming() and link state for receiving messages larger than the receive buffer in application-consumable chunks.

Definition at line 150 of file isotp_config.h.

◆ ISO_TP_FRAME_PADDING

#define ISO_TP_FRAME_PADDING

Pad transmitted Classical CAN frames to TX_DL. CAN FD frames larger than eight bytes are always padded to a legal CAN FD data length.

Definition at line 82 of file isotp_config.h.

◆ ISO_TP_FRAME_PADDING_VALUE

#define ISO_TP_FRAME_PADDING_VALUE   0xAA

Byte written into unused padded frame positions.

Definition at line 102 of file isotp_config.h.

◆ ISO_TP_MAX_WFT_NUMBER

#define ISO_TP_MAX_WFT_NUMBER   1

Maximum number of Flow Control Wait frames accepted during transmission.

Definition at line 66 of file isotp_config.h.

◆ ISO_TP_NO_FORMATTED_ERRORS

#define ISO_TP_NO_FORMATTED_ERRORS

Omit the two formatted error messages, which are the library's only use of snprintf(). Define this on a target whose libc has no snprintf, or where the 128-byte ISOTP_MAX_ERROR_MSG_SIZE stack buffer is unwelcome. The errors are still reported through isotp_user_debug(), without the values.

Measured on Cortex-M4, -Os -DNDEBUG: .text 2235 -> 2091 bytes, and the largest stack frame 160 -> 32 bytes. With this and NDEBUG the object needs nothing from libc but memcpy and memset.

Definition at line 96 of file isotp_config.h.

◆ ISO_TP_RECEIVE_COMPLETE_CALLBACK

#define ISO_TP_RECEIVE_COMPLETE_CALLBACK

Add the receive callback type, registration API, and link state.

Definition at line 142 of file isotp_config.h.

◆ ISO_TP_TRANSMIT_COMPLETE_CALLBACK

#define ISO_TP_TRANSMIT_COMPLETE_CALLBACK

Add the transmit callback type, registration API, and link state.

Definition at line 135 of file isotp_config.h.

◆ ISO_TP_USER_SEND_CAN_ARG

#define ISO_TP_USER_SEND_CAN_ARG

Append the link's user_send_can_arg value to isotp_user_send_can(). This changes the shim signature and the public IsoTpLink layout.

Definition at line 110 of file isotp_config.h.

◆ ISO_TP_USER_SEND_CAN_FLAGS

#define ISO_TP_USER_SEND_CAN_FLAGS

Add a frame-flags argument to isotp_user_send_can(), telling the driver whether a frame has to be transmitted as a CAN FD frame. Enable this if the driver cannot derive the frame format from the frame length. When combined with ISO_TP_USER_SEND_CAN_ARG, the flags argument comes first.

Definition at line 120 of file isotp_config.h.