diff --git a/device/esp_tinyusb/CHANGELOG.md b/device/esp_tinyusb/CHANGELOG.md index b7805b1e..a12544bb 100644 --- a/device/esp_tinyusb/CHANGELOG.md +++ b/device/esp_tinyusb/CHANGELOG.md @@ -1,3 +1,7 @@ +## [Unreleased] + +- esp_tinyusb: Added possibility to configure NCM Transfer Blocks (NTB) via menuconfig + ## 1.6.0 - CDC-ACM: Fixed memory leak on deinit diff --git a/device/esp_tinyusb/Kconfig b/device/esp_tinyusb/Kconfig index 0247e50d..dc86a0e1 100644 --- a/device/esp_tinyusb/Kconfig +++ b/device/esp_tinyusb/Kconfig @@ -285,6 +285,43 @@ menu "TinyUSB Stack" config TINYUSB_NET_MODE_NONE bool "None" endchoice + + config TINYUSB_NCM_OUT_NTB_BUFFS_COUNT + int "Number of NCM NTB buffers for reception side" + depends on TINYUSB_NET_MODE_NCM + default 2 + range 1 4 + help + Number of NTB buffers for reception side. + Can be increased to improve performance and stability with the cost of additional RAM requirements. + Helps to mitigate "tud_network_can_xmit: request blocked" warning message when running NCM device. + + config TINYUSB_NCM_IN_NTB_BUFFS_COUNT + int "Number of NCM NTB buffers for transmission side" + depends on TINYUSB_NET_MODE_NCM + default 2 + range 1 4 + help + Number of NTB buffers for transmission side. + Can be increased to improve performance and stability with the cost of additional RAM requirements. + Helps to mitigate "tud_network_can_xmit: request blocked" warning message when running NCM device. + + config TINYUSB_NCM_OUT_NTB_BUFF_MAX_SIZE + int "NCM NTB Buffer size for reception size" + depends on TINYUSB_NET_MODE_NCM + default 3200 + range 2048 4096 + help + Size of NTB buffers for reception side. Linux uses 2048 as minimal size. + + config TINYUSB_NCM_IN_NTB_BUFF_MAX_SIZE + int "NCM NTB Buffer size for transmission size" + depends on TINYUSB_NET_MODE_NCM + default 3200 + range 2048 4096 + help + Size of NTB buffers for transmission side. Linux uses 2048 as minimal size. + endmenu # "Network driver (ECM/NCM/RNDIS)" menu "Vendor Specific Interface" diff --git a/device/esp_tinyusb/include/tusb_config.h b/device/esp_tinyusb/include/tusb_config.h index 32afa788..6fb564a9 100644 --- a/device/esp_tinyusb/include/tusb_config.h +++ b/device/esp_tinyusb/include/tusb_config.h @@ -1,6 +1,6 @@ /* * SPDX-FileCopyrightText: 2019 Ha Thach (tinyusb.org), - * SPDX-FileContributor: 2020-2024 Espressif Systems (Shanghai) CO LTD + * SPDX-FileContributor: 2020-2025 Espressif Systems (Shanghai) CO LTD * SPDX-License-Identifier: MIT * * Copyright (c) 2019 Ha Thach (tinyusb.org), @@ -173,6 +173,12 @@ extern "C" { #define CFG_TUD_DFU_RUNTIME CONFIG_TINYUSB_DFU_MODE_DFU_RUNTIME #define CFG_TUD_BTH CONFIG_TINYUSB_BTH_ENABLED +// NCM NET Mode NTB buffers configuration +#define CFG_TUD_NCM_OUT_NTB_N CONFIG_TINYUSB_NCM_OUT_NTB_BUFFS_COUNT +#define CFG_TUD_NCM_IN_NTB_N CONFIG_TINYUSB_NCM_IN_NTB_BUFFS_COUNT +#define CFG_TUD_NCM_OUT_NTB_MAX_SIZE CONFIG_TINYUSB_NCM_OUT_NTB_BUFF_MAX_SIZE +#define CFG_TUD_NCM_IN_NTB_MAX_SIZE CONFIG_TINYUSB_NCM_IN_NTB_BUFF_MAX_SIZE + #ifdef __cplusplus } #endif