Skip to content

File syn_isotp.c

FileList > proto > syn_isotp.c

Go to the source code of this file

ISO 15765-2 (ISO-TP) Multi-Frame CAN Transport implementation.

  • #include "../util/syn_assert.h"
  • #include "../util/syn_pack.h"
  • #include "syn_isotp.h"
  • #include <string.h>

Public Functions

Type Name
bool syn_isotp_get_tx_frame (SYN_ISOTP_Link * link, SYN_CAN_Frame * frame)
Retrieve next pending outgoing CAN frame from ISO-TP engine.
void syn_isotp_init (SYN_ISOTP_Link * link, uint32_t rx_id, uint32_t tx_id, uint8_t * rx_buf, size_t rx_buf_size, uint8_t * tx_buf, size_t tx_buf_size)
Initialize ISO-TP Link in Classic CAN mode (8-byte frames).
void syn_isotp_process_rx_frame (SYN_ISOTP_Link * link, const SYN_CAN_Frame * frame)
Process an incoming CAN frame into the ISO-TP engine.
ssize_t syn_isotp_receive (SYN_ISOTP_Link * link, uint8_t * out_buf, size_t max_len)
Read completed assembled message from ISO-TP receiver.
SYN_Status syn_isotp_send (SYN_ISOTP_Link * link, const uint8_t * payload, size_t payload_len)
Initiate transmission of a multi-byte payload.
void syn_isotp_set_timeouts (SYN_ISOTP_Link * link, uint32_t n_bs_ms, uint32_t n_cr_ms)
Configure custom ISO 15765-2 network layer timeouts.
void syn_isotp_step (SYN_ISOTP_Link * link, uint32_t dt_ms)
Step ISO-TP timers (milliseconds).
void syn_isotp_step_us (SYN_ISOTP_Link * link, uint32_t dt_us)
Step ISO-TP timers (microseconds for fine STmin pacing).

Public Static Functions

Type Name
uint32_t syn_isotp_decode_stmin_us (uint8_t st_min)

Public Functions Documentation

function syn_isotp_get_tx_frame

Retrieve next pending outgoing CAN frame from ISO-TP engine.

bool syn_isotp_get_tx_frame (
    SYN_ISOTP_Link * link,
    SYN_CAN_Frame * frame
) 

Parameters:

  • link Link handle.
  • frame Output CAN frame buffer.

Returns:

true if a frame was generated, false otherwise.


function syn_isotp_init

Initialize ISO-TP Link in Classic CAN mode (8-byte frames).

void syn_isotp_init (
    SYN_ISOTP_Link * link,
    uint32_t rx_id,
    uint32_t tx_id,
    uint8_t * rx_buf,
    size_t rx_buf_size,
    uint8_t * tx_buf,
    size_t tx_buf_size
) 

Parameters:

  • link Link handle.
  • rx_id Incoming CAN identifier.
  • tx_id Outgoing CAN identifier.
  • rx_buf Receive assembly buffer.
  • rx_buf_size Receive buffer capacity.
  • tx_buf Transmit buffer.
  • tx_buf_size Transmit buffer capacity.

function syn_isotp_process_rx_frame

Process an incoming CAN frame into the ISO-TP engine.

void syn_isotp_process_rx_frame (
    SYN_ISOTP_Link * link,
    const SYN_CAN_Frame * frame
) 

Parameters:

  • link Link handle.
  • frame Incoming CAN frame.

function syn_isotp_receive

Read completed assembled message from ISO-TP receiver.

ssize_t syn_isotp_receive (
    SYN_ISOTP_Link * link,
    uint8_t * out_buf,
    size_t max_len
) 

Parameters:

  • link Link handle.
  • out_buf Output buffer.
  • max_len Capacity of out_buf.

Returns:

Number of bytes copied, or -1 if no message ready.


function syn_isotp_send

Initiate transmission of a multi-byte payload.

SYN_Status syn_isotp_send (
    SYN_ISOTP_Link * link,
    const uint8_t * payload,
    size_t payload_len
) 

Parameters:

  • link Link handle.
  • payload Payload buffer.
  • payload_len Length of payload (1 to max buffer capacity).

Returns:

SYN_OK on success, error code on busy/invalid params.


function syn_isotp_set_timeouts

Configure custom ISO 15765-2 network layer timeouts.

void syn_isotp_set_timeouts (
    SYN_ISOTP_Link * link,
    uint32_t n_bs_ms,
    uint32_t n_cr_ms
) 

Parameters:

  • link Link handle.
  • n_bs_ms N_Bs max timeout in milliseconds (0 = use default 1000ms).
  • n_cr_ms N_Cr max timeout in milliseconds (0 = use default 1000ms).

function syn_isotp_step

Step ISO-TP timers (milliseconds).

void syn_isotp_step (
    SYN_ISOTP_Link * link,
    uint32_t dt_ms
) 

Parameters:

  • link Link handle.
  • dt_ms Elapsed time in milliseconds.

function syn_isotp_step_us

Step ISO-TP timers (microseconds for fine STmin pacing).

void syn_isotp_step_us (
    SYN_ISOTP_Link * link,
    uint32_t dt_us
) 

Parameters:

  • link Link handle.
  • dt_us Elapsed time in microseconds.

Public Static Functions Documentation

function syn_isotp_decode_stmin_us

static uint32_t syn_isotp_decode_stmin_us (
    uint8_t st_min
) 


The documentation for this class was generated from the following file src/syntropic/proto/syn_isotp.c