Skip to content

File isotp_protocol.c

FileList > src > isotp_protocol.c

Go to the source code of this file

ISO-TP frame codec: decoding, encoding and STmin conversion. More...

  • #include <stdbool.h>
  • #include <string.h>
  • #include "isotp_protocol.h"

Public Static Functions

Type Name
bool isotp_decode_consecutive (const uint8_t * frame, size_t length, struct isotp_pdu * pdu)
bool isotp_decode_first (const uint8_t * frame, size_t length, struct isotp_pdu * pdu)
bool isotp_decode_flow_control (const uint8_t * frame, size_t length, struct isotp_pdu * pdu)
bool isotp_decode_single (const uint8_t * frame, size_t length, struct isotp_pdu * pdu)
void isotp_pdu_clear (struct isotp_pdu * pdu)

Macros

Type Name
define ISOTP_FF_ESCAPE_OFFSET 6U /\* first payload byte with the 32-bit FF\_DL \*/
define ISOTP_FF_SHORT_OFFSET 2U /\* first payload byte with the 12-bit FF\_DL \*/
define ISOTP_LOW_NIBBLE 0x0FU /\* SF\_DL, FF\_DL high bits, SN and FS \*/
define ISOTP_PCI_TYPE_SHIFT 4U /\* frame type is the high nibble of byte 0 \*/
define ISOTP_ST_MIN_MS_MAX 0x7FU /\* 0x00..0x7F: milliseconds \*/
define ISOTP_ST_MIN_US_BASE 0xF0U
define ISOTP_ST_MIN_US_FIRST 0xF1U
define ISOTP_ST_MIN_US_LAST 0xF9U
define ISOTP_ST_MIN_US_STEPS_MAX 900U
define ISOTP_US_PER_MS 1000U
define ISOTP_US_PER_STEP 100U

Detailed Description

Project: ISOTP-C - Hardware-Agnostic ISO 15765-2 (ISO-TP) Library Author: Anton Vynohradov Email: avynohradov@systemfromscratch.com

Copyright:

Copyright (c) 2026 Anton Vynohradov @license MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

SPDX-License-Identifier: MIT

Public Static Functions Documentation

function isotp_decode_consecutive

static bool isotp_decode_consecutive (
    const uint8_t * frame,
    size_t length,
    struct isotp_pdu * pdu
) 

function isotp_decode_first

static bool isotp_decode_first (
    const uint8_t * frame,
    size_t length,
    struct isotp_pdu * pdu
) 

function isotp_decode_flow_control

static bool isotp_decode_flow_control (
    const uint8_t * frame,
    size_t length,
    struct isotp_pdu * pdu
) 

function isotp_decode_single

static bool isotp_decode_single (
    const uint8_t * frame,
    size_t length,
    struct isotp_pdu * pdu
) 

function isotp_pdu_clear

static void isotp_pdu_clear (
    struct isotp_pdu * pdu
) 

Macro Definition Documentation

define ISOTP_FF_ESCAPE_OFFSET

#define ISOTP_FF_ESCAPE_OFFSET `6U /* first payload byte with the 32-bit FF_DL */`

define ISOTP_FF_SHORT_OFFSET

#define ISOTP_FF_SHORT_OFFSET `2U  /* first payload byte with the 12-bit FF_DL */`

define ISOTP_LOW_NIBBLE

#define ISOTP_LOW_NIBBLE `0x0FU    /* SF_DL, FF_DL high bits, SN and FS */`

define ISOTP_PCI_TYPE_SHIFT

#define ISOTP_PCI_TYPE_SHIFT `4U   /* frame type is the high nibble of byte 0 */`

define ISOTP_ST_MIN_MS_MAX

#define ISOTP_ST_MIN_MS_MAX `0x7FU /* 0x00..0x7F: milliseconds */`

define ISOTP_ST_MIN_US_BASE

#define ISOTP_ST_MIN_US_BASE `0xF0U`

define ISOTP_ST_MIN_US_FIRST

#define ISOTP_ST_MIN_US_FIRST `0xF1U`

define ISOTP_ST_MIN_US_LAST

#define ISOTP_ST_MIN_US_LAST `0xF9U`

define ISOTP_ST_MIN_US_STEPS_MAX

#define ISOTP_ST_MIN_US_STEPS_MAX `900U`

define ISOTP_US_PER_MS

#define ISOTP_US_PER_MS `1000U`

define ISOTP_US_PER_STEP

#define ISOTP_US_PER_STEP `100U`


The documentation for this class was generated from the following file src/isotp_protocol.c