diff --git a/peripherals/Kconfig b/peripherals/Kconfig index b45effcdaf..cc39e998ad 100644 --- a/peripherals/Kconfig +++ b/peripherals/Kconfig @@ -84,6 +84,7 @@ source "$PKGS_DIR/packages/peripherals/sean_ws2812b/Kconfig" source "$PKGS_DIR/packages/peripherals/ic74hc165/Kconfig" source "$PKGS_DIR/packages/peripherals/ist8310/Kconfig" source "$PKGS_DIR/packages/peripherals/ST7789_SPI/Kconfig" +source "$PKGS_DIR/packages/peripherals/rtt_isotp-c/Kconfig" if RT_VER_NUM > 0x40101 source "$PKGS_DIR/packages/peripherals/spi-tools/Kconfig" diff --git a/peripherals/rtt_isotp-c/Kconfig b/peripherals/rtt_isotp-c/Kconfig new file mode 100644 index 0000000000..24a98f255f --- /dev/null +++ b/peripherals/rtt_isotp-c/Kconfig @@ -0,0 +1,113 @@ +menuconfig PKG_USING_ISOTP_C + bool "ISO-TP:ISO 15765-2 (also known as ISO-TP) protocol with CAN multi-link and event-driven support" + default n + select RT_USING_HEAP + select RT_USING_CAN + help + A C library that implements the ISO 15765-2 (also known as ISO-TP) protocol. + This package provides an adapter layer for RT-Thread with multi-link and event-driven support. + +if PKG_USING_ISOTP_C + + menu "Adapter Layer Configuration" + config PKG_ISOTP_C_POLL_THREAD_STACK_SIZE + int "Stack size for the isotp-c polling thread" + default 1024 + help + This thread periodically calls isotp_poll() for all active links. + + config PKG_ISOTP_C_POLL_THREAD_PRIORITY + int "Priority for the isotp-c polling thread" + default 20 + help + Priority of the polling thread. + + config PKG_ISOTP_C_POLL_INTERVAL_MS + int "Polling interval in milliseconds" + default 5 + help + The interval at which the polling thread runs to update link states. + A smaller value gives faster response but higher CPU usage. + endmenu + + menu "ISO-TP Protocol Parameters" + config ISO_TP_DEFAULT_BLOCK_SIZE + int "Block Size (BS)" + default 8 + help + ISO-TP Block Size (BS). Max number of consecutive frames the receiver + can receive without sending a new Flow Control frame. (0 = infinite) + + config ISO_TP_DEFAULT_ST_MIN_US + int "Minimum Separation Time (STmin) in microseconds" + default 0 + help + ISO-TP Separation Time (STmin). Specifies the minimum time gap + allowed between the transmission of consecutive frames. + + config ISO_TP_MAX_WFT_NUMBER + int "Max number of Wait Frame Transmissions (WFTmax)" + default 1 + help + ISO-TP WFTmax. Indicates how many Wait Frames (FC.WT) can be + transmitted by the receiver in a row if it's not ready to receive. + + config ISO_TP_DEFAULT_RESPONSE_TIMEOUT_US + int "Response timeout in microseconds (Ar/As, Br/Bs, Cr/Cs)" + default 100000 + help + Default timeout for waiting for a response during a multi-frame + send or receive (e.g., waiting for a Flow Control frame). + + config ISO_TP_FRAME_PADDING + bool "Enable CAN frame padding" + default n + help + If enabled, all transmitted CAN frames will be padded to 8 bytes. + This is required by some ECUs. + + if ISO_TP_FRAME_PADDING + config ISO_TP_FRAME_PADDING_VALUE + hex "Padding value" + default 0xAA + help + The byte value used for padding CAN frames if padding is enabled. + endif + + # The following options are mandatory for the event-driven adapter + config ISO_TP_USER_SEND_CAN_ARG + bool "Enable user argument for send_can function" + default y + help + Adds a 'void *user_send_can_arg' to isotp_user_send_can. + This is ESSENTIAL for multi-link/multi-CAN support. DO NOT DISABLE. + + config ISO_TP_TRANSMIT_COMPLETE_CALLBACK + bool "Enable transmit complete callback" + default y + help + Enables the isotp_set_tx_done_cb function. + This is ESSENTIAL for the event-driven adapter. DO NOT DISABLE. + + config ISO_TP_RECEIVE_COMPLETE_CALLBACK + bool "Enable receive complete callback" + default y + help + Enables the isotp_set_rx_done_cb function. + This is ESSENTIAL for the event-driven adapter. DO NOT DISABLE. + endmenu + + config PKG_ISOTP_C_EXAMPLES + bool "Enable isotp-c examples" + default n + select BSP_USING_CAN1 + select BSP_USING_CAN2 + help + Enable examples for isotp-c package, demonstrating communication + between two CAN interfaces. + + config PKG_ISOTP_C_VERSION + string "isotp-c version" + default "latest" + +endif \ No newline at end of file diff --git a/peripherals/rtt_isotp-c/package.json b/peripherals/rtt_isotp-c/package.json new file mode 100644 index 0000000000..598f2283e9 --- /dev/null +++ b/peripherals/rtt_isotp-c/package.json @@ -0,0 +1,29 @@ +{ + "name": "rtt_isotp-c", + "description": "Adapter layer for CAN TP (ISO 15765-2). Designed for scenarios involving multi-frame transmission (can be interfaced to implement protocols such as YMODEM).", + "description_zh": "用于CAN-TP(ISO15765-2)的适配层。用于多帧传输的场景而设计(可对接实现ymodem等协议)", + "enable": "PKG_USING_ISOTP_C", + "keywords": [ + "rtt_isotp-c" + ], + "category": "peripherals", + "author": { + "name": "hly", + "email": "1425075683@qq.com", + "github": "wdfk-prog" + }, + "license": "LGPL-2.1", + "repository": "https://github.com/wdfk-prog/rtt_isotp-c.git", + "icon": "unknown", + "homepage": "https://github.com/wdfk-prog/rtt_isotp-c.git#readme", + "doc": "https://github.com/wdfk-prog/rtt_isotp-c.git#readme", + "readme": "Adapter layer for CAN TP (ISO 15765-2). Designed for scenarios involving multi-frame transmission (can be interfaced to implement protocols such as YMODEM).", + "site": [ + { + "version": "latest", + "URL": "https://github.com/wdfk-prog/rtt_isotp-c.git", + "filename": "get_irq_priority.zip", + "VER_SHA": "master" + } + ] +} \ No newline at end of file