From 3466f70e993b2bd618a6888cdce476238437d5ca Mon Sep 17 00:00:00 2001 From: Xu Si Yu Date: Thu, 18 Jul 2024 14:35:00 +0800 Subject: [PATCH 1/2] feat(openthread): support using custom header file --- components/openthread/CMakeLists.txt | 8 +- components/openthread/Kconfig | 826 ++++++++------- .../openthread-core-esp32x-ftd-config.h | 988 ++++++++++-------- .../openthread-core-esp32x-mtd-config.h | 409 +++++--- .../openthread-core-esp32x-radio-config.h | 290 ++--- .../openthread-core-esp32x-spinel-config.h | 93 +- .../src/spinel/esp_radio_spinel.cpp | 2 +- docs/en/api-guides/openthread.rst | 16 + .../api-reference/network/esp_openthread.rst | 6 + docs/zh_CN/api-guides/openthread.rst | 15 + .../api-reference/network/esp_openthread.rst | 6 + 11 files changed, 1464 insertions(+), 1195 deletions(-) diff --git a/components/openthread/CMakeLists.txt b/components/openthread/CMakeLists.txt index 6e03dbea2f..b3d0247608 100644 --- a/components/openthread/CMakeLists.txt +++ b/components/openthread/CMakeLists.txt @@ -23,7 +23,7 @@ if(CONFIG_OPENTHREAD_ENABLED) "openthread/src/ncp" "private_include") - set(src_dirs + set(src_dirs "src" "src/port" "openthread/examples/platforms/utils" @@ -244,6 +244,12 @@ elseif(CONFIG_OPENTHREAD_SPINEL_ONLY) endif() +if(CONFIG_OPENTHREAD_HEADER_CUSTOM) + idf_build_get_property(project_dir PROJECT_DIR) + list(APPEND private_include_dirs + "${project_dir}/${CONFIG_OPENTHREAD_CUSTOM_HEADER_PATH}") +endif() + execute_process( COMMAND git rev-parse --short HEAD WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} diff --git a/components/openthread/Kconfig b/components/openthread/Kconfig index a739f70163..9217d55c39 100644 --- a/components/openthread/Kconfig +++ b/components/openthread/Kconfig @@ -6,189 +6,7 @@ menu "OpenThread" help Select this option to enable OpenThread and show the submenu with OpenThread configuration choices. - config OPENTHREAD_LOG_LEVEL_DYNAMIC - bool "Enable dynamic log level control" - depends on OPENTHREAD_ENABLED - default y - help - Select this option to enable dynamic log level control for OpenThread - - choice OPENTHREAD_CONSOLE_TYPE - prompt "OpenThread console type" - depends on OPENTHREAD_ENABLED - default OPENTHREAD_CONSOLE_TYPE_UART - help - Select OpenThread console type - - config OPENTHREAD_CONSOLE_TYPE_UART - depends on ESP_CONSOLE_UART_DEFAULT || ESP_CONSOLE_UART_CUSTOM - bool "OpenThread console type UART" - config OPENTHREAD_CONSOLE_TYPE_USB_SERIAL_JTAG - depends on ESP_CONSOLE_USB_SERIAL_JTAG || ESP_CONSOLE_SECONDARY_USB_SERIAL_JTAG - bool "OpenThread console type USB Serial/JTAG Controller" - endchoice #OPENTHREAD_CONSOLE_TYPE - - choice OPENTHREAD_LOG_LEVEL - prompt "OpenThread log verbosity" - depends on OPENTHREAD_ENABLED && !OPENTHREAD_LOG_LEVEL_DYNAMIC - default OPENTHREAD_LOG_LEVEL_INFO - help - Select OpenThread log level. - - config OPENTHREAD_LOG_LEVEL_NONE - bool "No logs" - config OPENTHREAD_LOG_LEVEL_CRIT - bool "Error logs" - config OPENTHREAD_LOG_LEVEL_WARN - bool "Warning logs" - config OPENTHREAD_LOG_LEVEL_NOTE - bool "Notice logs" - config OPENTHREAD_LOG_LEVEL_INFO - bool "Info logs" - config OPENTHREAD_LOG_LEVEL_DEBG - bool "Debug logs" - endchoice #OPENTHREAD_LOG_LEVEL - - menu "Thread Operational Dataset" - config OPENTHREAD_NETWORK_NAME - string "OpenThread network name" - default "OpenThread-ESP" - - config OPENTHREAD_MESH_LOCAL_PREFIX - string "OpenThread mesh local prefix, format
/" - default "fd00:db8:a0:0::/64" - help - A string in the format "
/", where `
` is an IPv6 - address and `` is a prefix length. For example "fd00:db8:a0:0::/64" - - config OPENTHREAD_NETWORK_CHANNEL - int "OpenThread network channel" - range 11 26 - default 15 - - config OPENTHREAD_NETWORK_PANID - hex "OpenThread network pan id" - range 0 0xFFFE - default 0x1234 - - config OPENTHREAD_NETWORK_EXTPANID - string "OpenThread extended pan id" - default "dead00beef00cafe" - help - The OpenThread network extended pan id in hex string format - - config OPENTHREAD_NETWORK_MASTERKEY - string "OpenThread network key" - default "00112233445566778899aabbccddeeff" - help - The OpenThread network network key in hex string format - - config OPENTHREAD_NETWORK_PSKC - string "OpenThread pre-shared commissioner key" - default "104810e2315100afd6bc9215a6bfac53" - help - The OpenThread pre-shared commissioner key in hex string format - endmenu - - config OPENTHREAD_LOG_LEVEL - int - depends on OPENTHREAD_ENABLED && !OPENTHREAD_LOG_LEVEL_DYNAMIC - default 0 if OPENTHREAD_LOG_LEVEL_NONE - default 1 if OPENTHREAD_LOG_LEVEL_CRIT - default 2 if OPENTHREAD_LOG_LEVEL_WARN - default 3 if OPENTHREAD_LOG_LEVEL_NOTE - default 4 if OPENTHREAD_LOG_LEVEL_INFO - default 5 if OPENTHREAD_LOG_LEVEL_DEBG - - choice OPENTHREAD_RADIO_TYPE - prompt "Config the Thread radio type with 15.4 link" - depends on OPENTHREAD_ENABLED - default OPENTHREAD_RADIO_NATIVE if SOC_IEEE802154_SUPPORTED - default OPENTHREAD_RADIO_SPINEL_UART - help - Configure how OpenThread connects to the 15.4 radio - - config OPENTHREAD_RADIO_NATIVE - bool "Native 15.4 radio" - help - Select this to use the native 15.4 radio. - - config OPENTHREAD_RADIO_SPINEL_UART - select UART_ISR_IN_IRAM - bool "Connect via UART" - help - Select this to connect to a Radio Co-Processor via UART. - - config OPENTHREAD_RADIO_SPINEL_SPI - bool "Connect via SPI" - help - Select this to connect to a Radio Co-Processor via SPI. - - config OPENTHREAD_RADIO_154_NONE - bool "Disable the Thread radio based on 15.4 link" - help - Select this to disable the Thread radio based on 15.4 link. - endchoice - - config OPENTHREAD_RADIO_TREL - bool "Enable Thread Radio Encapsulation Link (TREL)" - depends on EXAMPLE_CONNECT_WIFI || EXAMPLE_CONNECT_ETHERNET - default n - help - Select this option to enable Thread Radio Encapsulation Link. - - config OPENTHREAD_TREL_PORT - int "The port of openthread trel service" - depends on OPENTHREAD_RADIO_TREL - default 12390 - help - Configure the port number of TREL service. - - choice OPENTHREAD_DEVICE_TYPE - prompt "Config the Thread device type" - depends on OPENTHREAD_ENABLED - default OPENTHREAD_FTD - help - OpenThread can be configured to different device types (FTD, MTD, Radio) - - config OPENTHREAD_FTD - bool "Full Thread Device" - help - Select this to enable Full Thread Device which can act as router and leader in a Thread network. - - config OPENTHREAD_MTD - bool "Minimal Thread Device" - help - Select this to enable Minimal Thread Device which can only act as end device in a Thread network. - This will reduce the code size of the OpenThread stack. - - config OPENTHREAD_RADIO - bool "Radio Only Device" - help - Select this to enable Radio Only Device which can only forward 15.4 packets to the host. - The OpenThread stack will be run on the host and OpenThread will have minimal footprint on the - radio only device. - endchoice - - choice OPENTHREAD_RCP_TRANSPORT - prompt "The RCP transport type" - depends on OPENTHREAD_RADIO - default OPENTHREAD_RCP_UART - - config OPENTHREAD_RCP_UART - select UART_ISR_IN_IRAM - bool "UART RCP" - help - Select this to enable UART connection to host. - - config OPENTHREAD_RCP_SPI - bool "SPI RCP" - select GPIO_CTRL_FUNC_IN_IRAM - help - Select this to enable SPI connection to host. - endchoice - - menu "OpenThread version message" + menu "Thread Version Message" depends on OPENTHREAD_ENABLED config OPENTHREAD_PACKAGE_NAME @@ -204,246 +22,472 @@ menu "OpenThread" The OpenThread platform information. endmenu - config OPENTHREAD_NCP_VENDOR_HOOK - bool "Enable vendor command for RCP" - depends on OPENTHREAD_RADIO - default y - help - Select this to enable OpenThread NCP vendor commands. - - config OPENTHREAD_CLI - bool "Enable Openthread Command-Line Interface" + menu "Thread Console" depends on OPENTHREAD_ENABLED - default y - help - Select this option to enable Command-Line Interface in OpenThread. - config OPENTHREAD_DIAG - bool "Enable diag" - depends on OPENTHREAD_ENABLED - default y - help - Select this option to enable Diag in OpenThread. This will enable diag mode and a series of diag commands - in the OpenThread command line. These commands allow users to manipulate low-level features of the storage - and 15.4 radio. + choice OPENTHREAD_CONSOLE_TYPE + prompt "OpenThread console type" + default OPENTHREAD_CONSOLE_TYPE_UART + help + Select OpenThread console type - config OPENTHREAD_COMMISSIONER - bool "Enable Commissioner" - depends on OPENTHREAD_ENABLED - default n - help - Select this option to enable commissioner in OpenThread. This will enable the device to act as a - commissioner in the Thread network. A commissioner checks the pre-shared key from a joining device with - the Thread commissioning protocol and shares the network parameter with the joining device upon success. + config OPENTHREAD_CONSOLE_TYPE_UART + depends on ESP_CONSOLE_UART_DEFAULT || ESP_CONSOLE_UART_CUSTOM + bool "OpenThread console type UART" + config OPENTHREAD_CONSOLE_TYPE_USB_SERIAL_JTAG + depends on ESP_CONSOLE_USB_SERIAL_JTAG || ESP_CONSOLE_SECONDARY_USB_SERIAL_JTAG + bool "OpenThread console type USB Serial/JTAG Controller" + endchoice #OPENTHREAD_CONSOLE_TYPE - config OPENTHREAD_COMM_MAX_JOINER_ENTRIES - int "The size of max commissioning joiner entries" - depends on OPENTHREAD_COMMISSIONER - default 2 - - config OPENTHREAD_JOINER - bool "Enable Joiner" - depends on OPENTHREAD_ENABLED - default n - help - Select this option to enable Joiner in OpenThread. This allows a device to join the Thread network with a - pre-shared key using the Thread commissioning protocol. - - config OPENTHREAD_SRP_CLIENT - bool "Enable SRP Client" - depends on OPENTHREAD_ENABLED - default y - help - Select this option to enable SRP Client in OpenThread. This allows a device to register SRP services to SRP - Server. - - config OPENTHREAD_SRP_CLIENT_MAX_SERVICES - int "Specifies number of service entries in the SRP client service pool" - depends on OPENTHREAD_SRP_CLIENT - default 5 - help - Set the max buffer size of service entries in the SRP client service pool. - - config OPENTHREAD_DNS_CLIENT - bool "Enable DNS Client" - depends on OPENTHREAD_ENABLED - default y - help - Select this option to enable DNS Client in OpenThread. - - config OPENTHREAD_BORDER_ROUTER - bool "Enable Border Router" - depends on OPENTHREAD_ENABLED - default n - help - Select this option to enable border router features in OpenThread. - - menu "Thread Memory Allocation Config" - depends on OPENTHREAD_ENABLED && (SPIRAM_USE_CAPS_ALLOC || SPIRAM_USE_MALLOC) - config OPENTHREAD_MEM_ALLOC_EXTERNAL - bool 'Allocate memory from PSRAM' + config OPENTHREAD_CLI + bool "Enable Openthread Command-Line Interface" default y help - Select this option to allocate buffer from PSRAM for Thread - - config OPENTHREAD_PLATFORM_MSGPOOL_MANAGEMENT - bool 'Allocate message pool buffer from PSRAM' - default n - help - If enabled, the message pool is managed by platform defined logic. + Select this option to enable Command-Line Interface in OpenThread. endmenu - config OPENTHREAD_NUM_MESSAGE_BUFFERS - int "The number of openthread message buffers" + menu "Thread Core Features" depends on OPENTHREAD_ENABLED - default 65 - config OPENTHREAD_SPINEL_RX_FRAME_BUFFER_SIZE - int "The size of openthread spinel rx frame buffer" - depends on OPENTHREAD_ENABLED || OPENTHREAD_SPINEL_ONLY - default 1024 if OPENTHREAD_MTD || OPENTHREAD_RADIO - default 2048 if OPENTHREAD_FTD || OPENTHREAD_SPINEL_ONLY + menu "Thread Operational Dataset" + config OPENTHREAD_NETWORK_NAME + string "OpenThread network name" + default "OpenThread-ESP" - config OPENTHREAD_MAC_MAX_CSMA_BACKOFFS_DIRECT - int "Maximum backoffs times before declaring a channel access failure." - depends on OPENTHREAD_ENABLED || OPENTHREAD_SPINEL_ONLY - default 4 - help - The maximum number of backoffs the CSMA-CA algorithm will attempt before declaring a channel access - failure. + config OPENTHREAD_MESH_LOCAL_PREFIX + string "OpenThread mesh local prefix, format
/" + default "fd00:db8:a0:0::/64" + help + A string in the format "
/", where `
` is an IPv6 + address and `` is a prefix length. For example "fd00:db8:a0:0::/64" - config OPENTHREAD_MLE_MAX_CHILDREN - int "The size of max MLE children entries" - depends on OPENTHREAD_ENABLED - default 10 + config OPENTHREAD_NETWORK_CHANNEL + int "OpenThread network channel" + range 11 26 + default 15 - config OPENTHREAD_TMF_ADDR_CACHE_ENTRIES - int "The size of max TMF address cache entries" - depends on OPENTHREAD_ENABLED - default 20 + config OPENTHREAD_NETWORK_PANID + hex "OpenThread network pan id" + range 0 0xFFFE + default 0x1234 - config OPENTHREAD_DNS64_CLIENT - bool "Use dns64 client" - depends on OPENTHREAD_ENABLED && LWIP_IPV4 - select LWIP_HOOK_DNS_EXTERNAL_RESOLVE_SELECT_CUSTOM - default n - help - Select this option to acquire NAT64 address from dns servers. + config OPENTHREAD_NETWORK_EXTPANID + string "OpenThread extended pan id" + default "dead00beef00cafe" + help + The OpenThread network extended pan id in hex string format - config OPENTHREAD_DNS_SERVER_ADDR - string "DNS server address (IPv4)" - depends on OPENTHREAD_DNS64_CLIENT - default "8.8.8.8" - help - Set the DNS server IPv4 address. + config OPENTHREAD_NETWORK_MASTERKEY + string "OpenThread network key" + default "00112233445566778899aabbccddeeff" + help + The OpenThread network network key in hex string format - config OPENTHREAD_UART_BUFFER_SIZE - int "The uart received buffer size of openthread" - depends on OPENTHREAD_ENABLED - default 2048 - help - Set the OpenThread UART buffer size. + config OPENTHREAD_NETWORK_PSKC + string "OpenThread pre-shared commissioner key" + default "104810e2315100afd6bc9215a6bfac53" + help + The OpenThread pre-shared commissioner key in hex string format + endmenu - config OPENTHREAD_LINK_METRICS - bool "Enable link metrics feature" - depends on OPENTHREAD_ENABLED - default n - help - Select this option to enable link metrics feature + choice OPENTHREAD_DEVICE_TYPE + prompt "Thread device type" + default OPENTHREAD_FTD + help + OpenThread can be configured to different device types (FTD, MTD, Radio) - config OPENTHREAD_MACFILTER_ENABLE - bool "Enable mac filter feature" - depends on OPENTHREAD_ENABLED - default n - help - Select this option to enable mac filter feature + config OPENTHREAD_FTD + bool "Full Thread Device" + help + Select this to enable Full Thread Device which can act as router and leader in a Thread network. - config OPENTHREAD_CSL_ENABLE - bool "Enable CSL feature" - depends on OPENTHREAD_ENABLED - default n - help - Select this option to enable CSL feature + config OPENTHREAD_MTD + bool "Minimal Thread Device" + help + Select this to enable Minimal Thread Device which can only act as end device in a Thread network. + This will reduce the code size of the OpenThread stack. - config OPENTHREAD_XTAL_ACCURACY - int "The accuracy of the XTAL" - default 130 - help - The device's XTAL accuracy, in ppm. + config OPENTHREAD_RADIO + bool "Radio Only Device" + help + Select this to enable Radio Only Device which can only forward 15.4 packets to the host. + The OpenThread stack will be run on the host and OpenThread will have minimal footprint on the + radio only device. + endchoice - config OPENTHREAD_CSL_ACCURACY - int "The current CSL rx/tx scheduling drift, in units of ± ppm" - depends on OPENTHREAD_CSL_ENABLE - default 1 - help - The current accuracy of the clock used for scheduling CSL operations + menu "Thread Trel Radio Link" + depends on EXAMPLE_CONNECT_WIFI || EXAMPLE_CONNECT_ETHERNET - config OPENTHREAD_CSL_UNCERTAIN - int "The CSL Uncertainty in units of 10 us." - depends on OPENTHREAD_CSL_ENABLE - default 1 - help - The fixed uncertainty of the Device for scheduling CSL Transmissions in units of 10 microseconds. + config OPENTHREAD_RADIO_TREL + bool "Enable Thread Radio Encapsulation Link (TREL)" + default n + help + Select this option to enable Thread Radio Encapsulation Link. - config OPENTHREAD_CSL_DEBUG_ENABLE - bool "Enable CSL debug" - depends on OPENTHREAD_CSL_ENABLE - default n - help - Select this option to set rx on when sleep in CSL feature, only for debug + config OPENTHREAD_TREL_PORT + int "The port of openthread trel service" + depends on OPENTHREAD_RADIO_TREL + default 12390 + help + Configure the port number of TREL service. + endmenu - config OPENTHREAD_DUA_ENABLE - bool "Enable Domain Unicast Address feature" - depends on OPENTHREAD_ENABLED - default n - help - Only used for Thread1.2 certification + menu "Thread 15.4 Radio Link" + choice OPENTHREAD_RADIO_TYPE + prompt "Config the Thread radio type with 15.4 link" + default OPENTHREAD_RADIO_NATIVE if SOC_IEEE802154_SUPPORTED + default OPENTHREAD_RADIO_SPINEL_UART + help + Configure how OpenThread connects to the 15.4 radio - config OPENTHREAD_TIME_SYNC - bool "Enable the time synchronization service feature" - depends on OPENTHREAD_ENABLED - default n - help - Select this option to enable time synchronization feature, the devices in the same Thread network could - sync to the same network time. + config OPENTHREAD_RADIO_NATIVE + bool "Native 15.4 radio" + help + Select this to use the native 15.4 radio. - config OPENTHREAD_RADIO_STATS_ENABLE - bool "Enable Radio Statistics feature" - depends on OPENTHREAD_FTD || OPENTHREAD_MTD - default n - help - Select this option to enable the radio statistics feature, you can use radio command to print some radio - Statistics information. + config OPENTHREAD_RADIO_SPINEL_UART + select UART_ISR_IN_IRAM + bool "Connect via UART" + help + Select this to connect to a Radio Co-Processor via UART. - config OPENTHREAD_SPINEL_ONLY - bool "Enable OpenThread External Radio Spinel feature" - default n - help - Select this option to enable the OpenThread Radio Spinel for external protocol stack, such as Zigbee. + config OPENTHREAD_RADIO_SPINEL_SPI + bool "Connect via SPI" + help + Select this to connect to a Radio Co-Processor via SPI. - config OPENTHREAD_RX_ON_WHEN_IDLE - bool "Enable OpenThread radio capability rx on when idle" - default y if !ESP_COEX_SW_COEXIST_ENABLE - default n if ESP_COEX_SW_COEXIST_ENABLE - help - Select this option to enable OpenThread radio capability rx on when idle. Do not support this feature when - SW coexistence is enabled. + config OPENTHREAD_RADIO_154_NONE + bool "Disable the Thread radio based on 15.4 link" + help + Select this to disable the Thread radio based on 15.4 link. + endchoice + endmenu - menu "Thread Address Query Config" - config OPENTHREAD_ADDRESS_QUERY_TIMEOUT - int "Timeout value (in seconds) for a address notification response after sending an address query." + menu "Thread Radio Co-Processor Feature" + depends on OPENTHREAD_RADIO + + choice OPENTHREAD_RCP_TRANSPORT + prompt "The RCP transport type" + default OPENTHREAD_RCP_UART + + config OPENTHREAD_RCP_UART + select UART_ISR_IN_IRAM + bool "UART RCP" + help + Select this to enable UART connection to host. + + config OPENTHREAD_RCP_SPI + bool "SPI RCP" + select GPIO_CTRL_FUNC_IN_IRAM + help + Select this to enable SPI connection to host. + endchoice + + config OPENTHREAD_NCP_VENDOR_HOOK + bool "Enable vendor command for RCP" + default y + help + Select this to enable OpenThread NCP vendor commands. + endmenu + + config OPENTHREAD_BORDER_ROUTER + bool "Enable Border Router" + depends on OPENTHREAD_FTD + default n + help + Select this option to enable border router features in OpenThread. + + config OPENTHREAD_COMMISSIONER + bool "Enable Commissioner" + default n + help + Select this option to enable commissioner in OpenThread. This will enable the device to act as a + commissioner in the Thread network. A commissioner checks the pre-shared key from a joining device + with the Thread commissioning protocol and shares the network parameter with the joining device + upon success. + menu "Commissioner Configurations" + depends on OPENTHREAD_COMMISSIONER + config OPENTHREAD_COMM_MAX_JOINER_ENTRIES + int "The size of max commissioning joiner entries" + default 2 + endmenu + + config OPENTHREAD_JOINER + bool "Enable Joiner" + default n + help + Select this option to enable Joiner in OpenThread. This allows a device to join the + Thread network with a pre-shared key using the Thread commissioning protocol. + + config OPENTHREAD_SRP_CLIENT + bool "Enable SRP Client" + default y + help + Select this option to enable SRP Client in OpenThread. + This allows a device to register SRP services to SRP Server. + menu "SRP Client Configurations" + depends on OPENTHREAD_SRP_CLIENT + config OPENTHREAD_SRP_CLIENT_MAX_SERVICES + int "Specifies number of service entries in the SRP client service pool" + default 5 + help + Set the max buffer size of service entries in the SRP client service pool. + endmenu + + config OPENTHREAD_DNS_CLIENT + bool "Enable DNS Client" + default y + help + Select this option to enable DNS Client in OpenThread. + + config OPENTHREAD_DNS64_CLIENT + bool "Enable DNS64 Client" + depends on LWIP_IPV4 + select LWIP_HOOK_DNS_EXTERNAL_RESOLVE_SELECT_CUSTOM + default n + help + Select this option to acquire NAT64 address from dns servers. + menu "DNS64 Client Configurations" + depends on OPENTHREAD_DNS64_CLIENT + config OPENTHREAD_DNS_SERVER_ADDR + string "DNS server address (IPv4)" + default "8.8.8.8" + help + Set the DNS server IPv4 address. + endmenu + + config OPENTHREAD_LINK_METRICS + bool "Enable link metrics feature" + default n + help + Select this option to enable link metrics feature + + config OPENTHREAD_MACFILTER_ENABLE + bool "Enable mac filter feature" + default n + help + Select this option to enable mac filter feature + + config OPENTHREAD_CSL_ENABLE + bool "Enable CSL feature" + default n + help + Select this option to enable CSL feature + menu "CSL Configurations" + depends on OPENTHREAD_CSL_ENABLE + config OPENTHREAD_CSL_ACCURACY + int "The current CSL rx/tx scheduling drift, in units of ± ppm" + + default 1 + help + The current accuracy of the clock used for scheduling CSL operations + + config OPENTHREAD_CSL_UNCERTAIN + int "The CSL Uncertainty in units of 10 us." + default 1 + help + The fixed uncertainty of the Device for scheduling CSL Transmissions in units of 10 microseconds. + + config OPENTHREAD_CSL_DEBUG_ENABLE + bool "Enable CSL debug" + default n + help + Select this option to set rx on when sleep in CSL feature, only for debug + endmenu + + config OPENTHREAD_TIME_SYNC + bool "Enable the time synchronization service feature" + default n + help + Select this option to enable time synchronization feature, the devices in the same Thread network could + sync to the same network time. + + config OPENTHREAD_RADIO_STATS_ENABLE + bool "Enable Radio Statistics feature" depends on OPENTHREAD_FTD || OPENTHREAD_MTD - default 3 + default n + help + Select this option to enable the radio statistics feature, you can use radio + command to print some radio Statistics information. - config OPENTHREAD_ADDRESS_QUERY_RETRY_DELAY - int "Initial retry delay for address query (in seconds)." - depends on OPENTHREAD_FTD || OPENTHREAD_MTD - default 15 + config OPENTHREAD_RX_ON_WHEN_IDLE + bool "Enable OpenThread radio capability rx on when idle" + default y if !ESP_COEX_SW_COEXIST_ENABLE + default n if ESP_COEX_SW_COEXIST_ENABLE + help + Select this option to enable OpenThread radio capability rx on when idle. + Do not support this feature when SW coexistence is enabled. - config OPENTHREAD_ADDRESS_QUERY_MAX_RETRY_DELAY - int "Maximum retry delay for address query (in seconds)." - depends on OPENTHREAD_FTD || OPENTHREAD_MTD - default 120 + config OPENTHREAD_DIAG + bool "Enable diag" + default y + help + Select this option to enable Diag in OpenThread. This will enable diag mode and a series of diag + commands in the OpenThread command line. These commands allow users to manipulate low-level + features of the storage and 15.4 radio. + + menu "Thread Memory Allocation" + depends on (SPIRAM_USE_CAPS_ALLOC || SPIRAM_USE_MALLOC) + config OPENTHREAD_MEM_ALLOC_EXTERNAL + bool 'Allocate memory from PSRAM' + default y + help + Select this option to allocate buffer from PSRAM for Thread + + config OPENTHREAD_PLATFORM_MSGPOOL_MANAGEMENT + bool 'Allocate message pool buffer from PSRAM' + default n + help + If enabled, the message pool is managed by platform defined logic. + endmenu + + menu "OpenThread Stack Parameters" + + menu "Thread Address Query Config" + config OPENTHREAD_ADDRESS_QUERY_TIMEOUT + int "Timeout (in seconds) for a address notification response after sending an address query." + depends on OPENTHREAD_FTD || OPENTHREAD_MTD + default 3 + + config OPENTHREAD_ADDRESS_QUERY_RETRY_DELAY + int "Initial retry delay for address query (in seconds)." + depends on OPENTHREAD_FTD || OPENTHREAD_MTD + default 15 + + config OPENTHREAD_ADDRESS_QUERY_MAX_RETRY_DELAY + int "Maximum retry delay for address query (in seconds)." + depends on OPENTHREAD_FTD || OPENTHREAD_MTD + default 120 + endmenu + + config OPENTHREAD_NUM_MESSAGE_BUFFERS + int "The number of openthread message buffers" + default 65 + + config OPENTHREAD_XTAL_ACCURACY + int "The accuracy of the XTAL" + default 130 + help + The device's XTAL accuracy, in ppm. + + config OPENTHREAD_MLE_MAX_CHILDREN + int "The size of max MLE children entries" + default 10 + + config OPENTHREAD_TMF_ADDR_CACHE_ENTRIES + int "The size of max TMF address cache entries" + default 20 + + config OPENTHREAD_UART_BUFFER_SIZE + int "The uart received buffer size of openthread" + default 2048 + help + Set the OpenThread UART buffer size. + + config OPENTHREAD_MAC_MAX_CSMA_BACKOFFS_DIRECT + int "Maximum backoffs times before declaring a channel access failure." + default 4 + help + The maximum number of backoffs the CSMA-CA algorithm will attempt before declaring a channel access + failure. + endmenu + + endmenu + + menu "Thread Log" + depends on OPENTHREAD_ENABLED + config OPENTHREAD_LOG_LEVEL_DYNAMIC + bool "Enable dynamic log level control" + default y + help + Select this option to enable dynamic log level control for OpenThread + + choice OPENTHREAD_LOG_LEVEL + prompt "OpenThread log verbosity" + depends on !OPENTHREAD_LOG_LEVEL_DYNAMIC + default OPENTHREAD_LOG_LEVEL_INFO + help + Select OpenThread log level. + + config OPENTHREAD_LOG_LEVEL_NONE + bool "No logs" + config OPENTHREAD_LOG_LEVEL_CRIT + bool "Error logs" + config OPENTHREAD_LOG_LEVEL_WARN + bool "Warning logs" + config OPENTHREAD_LOG_LEVEL_NOTE + bool "Notice logs" + config OPENTHREAD_LOG_LEVEL_INFO + bool "Info logs" + config OPENTHREAD_LOG_LEVEL_DEBG + bool "Debug logs" + endchoice #OPENTHREAD_LOG_LEVEL + + config OPENTHREAD_LOG_LEVEL + int + depends on !OPENTHREAD_LOG_LEVEL_DYNAMIC + default 0 if OPENTHREAD_LOG_LEVEL_NONE + default 1 if OPENTHREAD_LOG_LEVEL_CRIT + default 2 if OPENTHREAD_LOG_LEVEL_WARN + default 3 if OPENTHREAD_LOG_LEVEL_NOTE + default 4 if OPENTHREAD_LOG_LEVEL_INFO + default 5 if OPENTHREAD_LOG_LEVEL_DEBG + endmenu + + menu "Thread Extensioned Features" + depends on OPENTHREAD_ENABLED + config OPENTHREAD_HEADER_CUSTOM + bool "Use a header file defined by customer" + default n + help + This option allows users to tailor the values of openthread macros according to their requirements. + The openthread submodule contains numerous macros, each with a default value set. In the Kconfig of + ESP openthread, users can set specific openthread parameters, which will be applied for certain + openthread macros in the openthread-core-esp32x-xxx-config.h file. During compilation, the values + specified in openthread-core-esp32x-xxx-config.h will replace the default settings in the openthread + submodule. However, Kconfig does not cover all openthread macros, particularly those typically + using default values. For such macros, users can enable the OPENTHREAD_HEADER_CUSTOM option in the + Kconfig and provide a custom header file. Macros defined in the custom header file will have the + highest priority. + menu "OpenThread Custom Header Config" + depends on OPENTHREAD_HEADER_CUSTOM + + config OPENTHREAD_CUSTOM_HEADER_PATH + string "Path of custom header file" + depends on OPENTHREAD_HEADER_CUSTOM + default "" + help + Please use relative paths with respect to the project folder. + + config OPENTHREAD_CUSTOM_HEADER_FILE_NAME + string "Name of custom header file" + depends on OPENTHREAD_HEADER_CUSTOM + default "esp_ot_custom_config.h" + help + Name of custom header file. + endmenu + endmenu + + menu "OpenThread Spinel" + config OPENTHREAD_SPINEL_ONLY + bool "Enable OpenThread External Radio Spinel feature" + default n + help + Select this option to enable the OpenThread Radio Spinel for external protocol stack, such as Zigbee. + + config OPENTHREAD_SPINEL_RX_FRAME_BUFFER_SIZE + int "The size of openthread spinel rx frame buffer" + depends on OPENTHREAD_ENABLED || OPENTHREAD_SPINEL_ONLY + default 1024 if OPENTHREAD_MTD || OPENTHREAD_RADIO + default 2048 if OPENTHREAD_FTD || OPENTHREAD_SPINEL_ONLY + + config OPENTHREAD_SPINEL_MAC_MAX_CSMA_BACKOFFS_DIRECT + int "Maximum backoffs times before declaring a channel access failure." + depends on OPENTHREAD_SPINEL_ONLY + default 4 + help + The maximum number of backoffs the CSMA-CA algorithm will attempt before declaring a channel access + failure. endmenu endmenu diff --git a/components/openthread/private_include/openthread-core-esp32x-ftd-config.h b/components/openthread/private_include/openthread-core-esp32x-ftd-config.h index 42ea9d9546..56e7d0c0cb 100644 --- a/components/openthread/private_include/openthread-core-esp32x-ftd-config.h +++ b/components/openthread/private_include/openthread-core-esp32x-ftd-config.h @@ -8,38 +8,44 @@ #include "sdkconfig.h" +#if CONFIG_OPENTHREAD_HEADER_CUSTOM +#include CONFIG_OPENTHREAD_CUSTOM_HEADER_FILE_NAME +#endif + +#define OPENTHREAD_FTD 1 + /** * @def OPENTHREAD_CONFIG_PLATFORM_INFO * * The platform-specific string to insert into the OpenThread version string. * */ +#ifdef OPENTHREAD_CONFIG_PLATFORM_INFO +#error `OPENTHREAD_CONFIG_PLATFORM_INFO` is redefined. +#endif #define OPENTHREAD_CONFIG_PLATFORM_INFO CONFIG_OPENTHREAD_PLATFORM_INFO /** - * @def OPENTHREAD_CONFIG_PLATFORM_ASSERT_MANAGEMENT + * @def PACKAGE_NAME * - * The assert is managed by platform defined logic when this flag is set. + * Define to the full name of this package. * */ -#define OPENTHREAD_CONFIG_PLATFORM_ASSERT_MANAGEMENT 1 +#ifdef PACKAGE_NAME +#error `PACKAGE_NAME` is redefined. +#endif +#define PACKAGE_NAME CONFIG_OPENTHREAD_PACKAGE_NAME /** - * @def OPENTHREAD_CONFIG_PLATFORM_FLASH_API_ENABLE + * @def PACKAGE_STRING * - * Define to 1 to enable otPlatFlash* APIs to support non-volatile storage. - * - * When defined to 1, the platform MUST implement the otPlatFlash* APIs instead of the otPlatSettings* APIs. + * Define to the full name and version of this package. * */ -#define OPENTHREAD_CONFIG_PLATFORM_FLASH_API_ENABLE 0 - -/** - * @def OPENTHREAD_CONFIG_LOG_OUTPUT - * - * The ESP-IDF platform provides an otPlatLog() function. - */ -#define OPENTHREAD_CONFIG_LOG_OUTPUT OPENTHREAD_CONFIG_LOG_OUTPUT_PLATFORM_DEFINED +#ifdef PACKAGE_STRING +#error `PACKAGE_STRING` is redefined. +#endif +#define PACKAGE_STRING (PACKAGE_NAME " - " PACKAGE_VERSION) /** * @def OPENTHREAD_CONFIG_LOG_LEVEL_DYNAMIC_ENABLE @@ -47,6 +53,9 @@ * Configuration option to enable dynamic log level control. * */ +#ifdef OPENTHREAD_CONFIG_LOG_LEVEL_DYNAMIC_ENABLE +#error `OPENTHREAD_CONFIG_LOG_LEVEL_DYNAMIC_ENABLE` is redefined. +#endif #define OPENTHREAD_CONFIG_LOG_LEVEL_DYNAMIC_ENABLE CONFIG_OPENTHREAD_LOG_LEVEL_DYNAMIC /** @@ -56,30 +65,539 @@ * verbose log level possible. See `OPENTHREAD_CONFIG_LOG_LEVEL_INIT` to set the initial log level. * */ -#if OPENTHREAD_CONFIG_LOG_LEVEL_DYNAMIC_ENABLE +#ifdef OPENTHREAD_CONFIG_LOG_LEVEL +#error `OPENTHREAD_CONFIG_LOG_LEVEL` is redefined. +#endif +#if CONFIG_OPENTHREAD_LOG_LEVEL_DYNAMIC #define OPENTHREAD_CONFIG_LOG_LEVEL OT_LOG_LEVEL_DEBG #else #define OPENTHREAD_CONFIG_LOG_LEVEL CONFIG_OPENTHREAD_LOG_LEVEL #endif -#define OPENTHREAD_CONFIG_LOG_CLI 1 -#define OPENTHREAD_CONFIG_LOG_PKT_DUMP 1 -#define OPENTHREAD_CONFIG_LOG_PLATFORM 1 - /** * @def OPENTHREAD_CONFIG_NUM_MESSAGE_BUFFERS * * The number of message buffers in buffer pool */ +#ifdef OPENTHREAD_CONFIG_NUM_MESSAGE_BUFFERS +#error `OPENTHREAD_CONFIG_NUM_MESSAGE_BUFFERS` is redefined. +#endif #define OPENTHREAD_CONFIG_NUM_MESSAGE_BUFFERS CONFIG_OPENTHREAD_NUM_MESSAGE_BUFFERS + +#if CONFIG_OPENTHREAD_BORDER_ROUTER + +/** + * @def OPENTHREAD_CONFIG_BORDER_AGENT_ENABLE + * + * Define to 1 to enable Border Agent support. + * + */ +#ifdef OPENTHREAD_CONFIG_BORDER_AGENT_ENABLE +#error `OPENTHREAD_CONFIG_BORDER_AGENT_ENABLE` is redefined. +#endif +#define OPENTHREAD_CONFIG_BORDER_AGENT_ENABLE 1 + +/** + * @def OPENTHREAD_CONFIG_BORDER_AGENT_ID_ENABLE + * + * Define to 1 to enable Border Agent ID support. + * + */ +#ifdef OPENTHREAD_CONFIG_BORDER_AGENT_ID_ENABLE +#error `OPENTHREAD_CONFIG_BORDER_AGENT_ID_ENABLE` is redefined. +#endif +#define OPENTHREAD_CONFIG_BORDER_AGENT_ID_ENABLE 1 + +/** + * @def OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE + * + * Define to 1 to enable Border Routing support. + * + */ +#ifdef OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE +#error `OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE` is redefined. +#endif +#define OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE 1 + +/** + * @def OPENTHREAD_CONFIG_PLATFORM_UDP_ENABLE + * + * Define to 1 to enable platform UDP support. + * + */ +#ifdef OPENTHREAD_CONFIG_PLATFORM_UDP_ENABLE +#error `OPENTHREAD_CONFIG_PLATFORM_UDP_ENABLE` is redefined. +#endif +#define OPENTHREAD_CONFIG_PLATFORM_UDP_ENABLE 1 + +/** + * @def OPENTHREAD_CONFIG_NAT64_BORDER_ROUTING_ENABLE + * + * Define to 1 to enable Border Routing NAT64 support. + * + */ +#ifdef OPENTHREAD_CONFIG_NAT64_BORDER_ROUTING_ENABLE +#error `OPENTHREAD_CONFIG_NAT64_BORDER_ROUTING_ENABLE` is redefined. +#endif +#define OPENTHREAD_CONFIG_NAT64_BORDER_ROUTING_ENABLE 1 + +/** + * @def OPENTHREAD_CONFIG_SRP_SERVER_ENABLE + * + * Define to 1 to enable SRP Server support. + * + */ +#ifdef OPENTHREAD_CONFIG_SRP_SERVER_ENABLE +#error `OPENTHREAD_CONFIG_SRP_SERVER_ENABLE` is redefined. +#endif +#define OPENTHREAD_CONFIG_SRP_SERVER_ENABLE 1 + +/** + * @def OPENTHREAD_CONFIG_DNSSD_SERVER_ENABLE + * + * Define to 1 to enable DNS-SD Server support. + * + */ +#ifdef OPENTHREAD_CONFIG_DNSSD_SERVER_ENABLE +#error `OPENTHREAD_CONFIG_DNSSD_SERVER_ENABLE` is redefined. +#endif +#define OPENTHREAD_CONFIG_DNSSD_SERVER_ENABLE 1 + +/** + * @def OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE + * + * Define to 1 to enable Backbone Router support. + * + */ +#ifdef OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE +#error `OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE` is redefined. +#endif +#define OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE 1 + +/** + * @def OPENTHREAD_SPINEL_CONFIG_COMPATIBILITY_ERROR_CALLBACK_ENABLE + * + * Enables compatibility error callback in Spinel + */ +#ifdef OPENTHREAD_SPINEL_CONFIG_COMPATIBILITY_ERROR_CALLBACK_ENABLE +#error `OPENTHREAD_SPINEL_CONFIG_COMPATIBILITY_ERROR_CALLBACK_ENABLE` is redefined. +#endif +#define OPENTHREAD_SPINEL_CONFIG_COMPATIBILITY_ERROR_CALLBACK_ENABLE 1 + +#endif // CONFIG_OPENTHREAD_BORDER_ROUTER + +/** + * @def OPENTHREAD_CONFIG_RADIO_LINK_TREL_ENABLE + * + * Set to 1 to enable support for Thread Radio Encapsulation Link (TREL). + * + */ +#ifdef OPENTHREAD_CONFIG_RADIO_LINK_TREL_ENABLE +#error `OPENTHREAD_CONFIG_RADIO_LINK_TREL_ENABLE` is redefined. +#endif +#if CONFIG_OPENTHREAD_RADIO_TREL +#define OPENTHREAD_CONFIG_RADIO_LINK_TREL_ENABLE 1 +#endif // CONFIG_OPENTHREAD_RADIO_TREL + +/** + * @def OPENTHREAD_CONFIG_RADIO_LINK_IEEE_802_15_4_ENABLE + * + * Set to 1 to enable support for IEEE802.15.4 radio link. + * + */ +#ifdef OPENTHREAD_CONFIG_RADIO_LINK_IEEE_802_15_4_ENABLE +#error `OPENTHREAD_CONFIG_RADIO_LINK_IEEE_802_15_4_ENABLE` is redefined. +#endif +#if CONFIG_OPENTHREAD_RADIO_154_NONE +#define OPENTHREAD_CONFIG_RADIO_LINK_IEEE_802_15_4_ENABLE 0 +#else +#define OPENTHREAD_CONFIG_RADIO_LINK_IEEE_802_15_4_ENABLE 1 +#endif + +#if !CONFIG_OPENTHREAD_RADIO_NATIVE +/** + * @def OPENTHREAD_SPINEL_CONFIG_RCP_RESTORATION_MAX_COUNT + * + * Defines the max count of RCP failures allowed to be recovered. + * 0 means to disable RCP failure recovering. + * + */ +#ifdef OPENTHREAD_SPINEL_CONFIG_RCP_RESTORATION_MAX_COUNT +#error `OPENTHREAD_SPINEL_CONFIG_RCP_RESTORATION_MAX_COUNT` is redefined. +#endif +#define OPENTHREAD_SPINEL_CONFIG_RCP_RESTORATION_MAX_COUNT 3 + +/** + * @def OPENTHREAD_POSIX_CONFIG_RCP_TIME_SYNC_INTERVAL + * + * This setting configures the interval (in units of microseconds) for host-rcp + * time sync. The host will recalculate the time offset between host and RCP + * every interval. + * + */ +#ifdef OPENTHREAD_POSIX_CONFIG_RCP_TIME_SYNC_INTERVAL +#error `OPENTHREAD_POSIX_CONFIG_RCP_TIME_SYNC_INTERVAL` is redefined. +#endif +#define OPENTHREAD_POSIX_CONFIG_RCP_TIME_SYNC_INTERVAL (60 * 1000 * 1000) + +#endif // !CONFIG_OPENTHREAD_RADIO_NATIVE + +/** + * @def OPENTHREAD_LIB_SPINEL_RX_FRAME_BUFFER_SIZE + * + * Specifies the rx frame buffer size used by `SpinelInterface` in RCP host code. This is applicable/used when + * `RadioSpinel` platform is used. + * + */ +#ifdef OPENTHREAD_LIB_SPINEL_RX_FRAME_BUFFER_SIZE +#error `OPENTHREAD_LIB_SPINEL_RX_FRAME_BUFFER_SIZE` is redefined. +#endif +#define OPENTHREAD_LIB_SPINEL_RX_FRAME_BUFFER_SIZE CONFIG_OPENTHREAD_SPINEL_RX_FRAME_BUFFER_SIZE + +/** + * @def OPENTHREAD_CONFIG_MLE_MAX_CHILDREN + * + * The maximum number of children. + * + */ +#ifdef OPENTHREAD_CONFIG_MLE_MAX_CHILDREN +#error `OPENTHREAD_CONFIG_MLE_MAX_CHILDREN` is redefined. +#endif +#define OPENTHREAD_CONFIG_MLE_MAX_CHILDREN CONFIG_OPENTHREAD_MLE_MAX_CHILDREN + +/** + * @def OPENTHREAD_CONFIG_TMF_ADDRESS_CACHE_ENTRIES + * + * The number of EID-to-RLOC cache entries. + * + */ +#ifdef OPENTHREAD_CONFIG_TMF_ADDRESS_CACHE_ENTRIES +#error `OPENTHREAD_CONFIG_TMF_ADDRESS_CACHE_ENTRIES` is redefined. +#endif +#define OPENTHREAD_CONFIG_TMF_ADDRESS_CACHE_ENTRIES CONFIG_OPENTHREAD_TMF_ADDR_CACHE_ENTRIES + +#ifdef OPENTHREAD_CONFIG_COMMISSIONER_ENABLE +#error `OPENTHREAD_CONFIG_COMMISSIONER_ENABLE` is redefined. +#endif +#if CONFIG_OPENTHREAD_COMMISSIONER + +/** + * @def OPENTHREAD_CONFIG_COMMISSIONER_ENABLE + * + * Define to 1 to enable Commissioner support. + * + */ +#define OPENTHREAD_CONFIG_COMMISSIONER_ENABLE 1 + +/** + * @def OPENTHREAD_CONFIG_COMMISSIONER_MAX_JOINER_ENTRIES + * + * The maximum number of Joiner entries maintained by the Commissioner + * + */ +#ifdef OPENTHREAD_CONFIG_COMMISSIONER_MAX_JOINER_ENTRIES +#error `OPENTHREAD_CONFIG_COMMISSIONER_MAX_JOINER_ENTRIES` is redefined. +#endif +#define OPENTHREAD_CONFIG_COMMISSIONER_MAX_JOINER_ENTRIES CONFIG_OPENTHREAD_COMM_MAX_JOINER_ENTRIES + +#else // OPENTHREAD_CONFIG_COMMISSIONER_ENABLE +#define OPENTHREAD_CONFIG_COMMISSIONER_ENABLE 0 +#endif // CONFIG_OPENTHREAD_COMMISSIONER + +#ifdef OPENTHREAD_CONFIG_MAC_FILTER_ENABLE +#error `OPENTHREAD_CONFIG_MAC_FILTER_ENABLE` is redefined. +#endif +#if CONFIG_OPENTHREAD_MACFILTER_ENABLE +#define OPENTHREAD_CONFIG_MAC_FILTER_ENABLE 1 +#else +#define OPENTHREAD_CONFIG_MAC_FILTER_ENABLE 0 +#endif + +#ifdef OPENTHREAD_CONFIG_JOINER_ENABLE +#error `OPENTHREAD_CONFIG_JOINER_ENABLE` is redefined. +#endif +#if CONFIG_OPENTHREAD_JOINER +#define OPENTHREAD_CONFIG_JOINER_ENABLE 1 +#else +#define OPENTHREAD_CONFIG_JOINER_ENABLE 0 +#endif + +#ifdef OPENTHREAD_CONFIG_DIAG_ENABLE +#error `OPENTHREAD_CONFIG_DIAG_ENABLE` is redefined. +#endif +#if CONFIG_OPENTHREAD_DIAG +#define OPENTHREAD_CONFIG_DIAG_ENABLE 1 +#else +#define OPENTHREAD_CONFIG_DIAG_ENABLE 0 +#endif + +#ifdef OPENTHREAD_CONFIG_SRP_CLIENT_ENABLE +#error `OPENTHREAD_CONFIG_SRP_CLIENT_ENABLE` is redefined. +#endif +#if CONFIG_OPENTHREAD_SRP_CLIENT + +#define OPENTHREAD_CONFIG_SRP_CLIENT_ENABLE 1 + +/** + * @def OPENTHREAD_CONFIG_SRP_CLIENT_BUFFERS_MAX_SERVICES + * + * Specifies number of service entries in the SRP client service pool. + * + * This config is applicable only when `OPENTHREAD_CONFIG_SRP_CLIENT_BUFFERS_ENABLE` is enabled. + * + */ +#ifdef OPENTHREAD_CONFIG_SRP_CLIENT_BUFFERS_MAX_SERVICES +#error `OPENTHREAD_CONFIG_SRP_CLIENT_BUFFERS_MAX_SERVICES` is redefined. +#endif +#define OPENTHREAD_CONFIG_SRP_CLIENT_BUFFERS_MAX_SERVICES CONFIG_OPENTHREAD_SRP_CLIENT_MAX_SERVICES + +#else + +#define OPENTHREAD_CONFIG_SRP_CLIENT_ENABLE 0 +#endif // CONFIG_OPENTHREAD_SRP_CLIENT + +/** + * @def OPENTHREAD_CONFIG_DNS_CLIENT_ENABLE + * + * Define to 1 to enable DNS Client support. + * + */ +#ifdef OPENTHREAD_CONFIG_DNS_CLIENT_ENABLE +#error `OPENTHREAD_CONFIG_DNS_CLIENT_ENABLE` is redefined. +#endif +#define OPENTHREAD_CONFIG_DNS_CLIENT_ENABLE CONFIG_OPENTHREAD_DNS_CLIENT + +#ifdef OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE +#error `OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE` is redefined. +#endif +#if CONFIG_OPENTHREAD_CSL_ENABLE + +/** + * @def OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE + * + * Define as 1 to support Thread 1.2 CSL feature. + * + */ +#define OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE 1 + +/** + * @def OPENTHREAD_CONFIG_MAC_CSL_DEBUG_ENABLE + * + * Define as 1 to enable support Thread 1.2 CSL debug. + * + */ +#ifdef OPENTHREAD_CONFIG_MAC_CSL_DEBUG_ENABLE +#error `OPENTHREAD_CONFIG_MAC_CSL_DEBUG_ENABLE` is redefined. +#endif +#define OPENTHREAD_CONFIG_MAC_CSL_DEBUG_ENABLE CONFIG_OPENTHREAD_CSL_DEBUG_ENABLE + +#else + +#define OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE 0 +#endif // CONFIG_OPENTHREAD_CSL_ENABLE + +#ifdef OPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE +#error `OPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE` is redefined. +#endif +#ifdef OPENTHREAD_CONFIG_MLE_LINK_METRICS_INITIATOR_ENABLE +#error `OPENTHREAD_CONFIG_MLE_LINK_METRICS_INITIATOR_ENABLE` is redefined. +#endif +#if CONFIG_OPENTHREAD_LINK_METRICS +/** + * @def OPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE + * + * Define as 1 to support Thread 1.2 Link Metrics Subject feature. + * + */ +#define OPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE 1 + +/** + * @def OPENTHREAD_CONFIG_MLE_LINK_METRICS_INITIATOR_ENABLE + * + * Define as 1 to support Thread 1.2 Link Metrics feature. + * + */ +#define OPENTHREAD_CONFIG_MLE_LINK_METRICS_INITIATOR_ENABLE 1 + +#else +#define OPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE 0 +#define OPENTHREAD_CONFIG_MLE_LINK_METRICS_INITIATOR_ENABLE 0 +#endif //CONFIG_OPENTHREAD_LINK_METRICS + +/** + * + * Define as 1 to enable support for allocating message pool buffer in PSRAM + * + */ +#ifdef OPENTHREAD_CONFIG_PLATFORM_MESSAGE_MANAGEMENT +#error `OPENTHREAD_CONFIG_PLATFORM_MESSAGE_MANAGEMENT` is redefined. +#endif +#if CONFIG_OPENTHREAD_PLATFORM_MSGPOOL_MANAGEMENT +/** + * @def OPENTHREAD_CONFIG_PLATFORM_MESSAGE_MANAGEMENT + * + * The message pool is managed by platform defined logic when this flag is set. + * This feature would typically be used when operating in a multi-threaded system + * and multiple threads need to access the message pool. + * + */ +#define OPENTHREAD_CONFIG_PLATFORM_MESSAGE_MANAGEMENT 1 +#else +#define OPENTHREAD_CONFIG_PLATFORM_MESSAGE_MANAGEMENT 0 +#endif + +/** + * @def OPENTHREAD_CONFIG_TIME_SYNC_ENABLE + * + * Define as 1 to enable the time synchronization service feature. + * + */ +#ifdef OPENTHREAD_CONFIG_TIME_SYNC_ENABLE +#error `OPENTHREAD_CONFIG_TIME_SYNC_ENABLE` is redefined. +#endif +#if CONFIG_OPENTHREAD_TIME_SYNC +#define OPENTHREAD_CONFIG_TIME_SYNC_ENABLE 1 +#else +#define OPENTHREAD_CONFIG_TIME_SYNC_ENABLE 0 +#endif + +/** + * @def OPENTHREAD_CONFIG_RADIO_STATS_ENABLE + * + * Set to 1 to enable support for Radio Statistics. Note that this option only works for OPENTHREAD_FTD and + * OPENTHREAD_MTD. + * + */ +#ifdef OPENTHREAD_CONFIG_RADIO_STATS_ENABLE +#error `OPENTHREAD_CONFIG_RADIO_STATS_ENABLE` is redefined. +#endif +#if CONFIG_OPENTHREAD_RADIO_STATS_ENABLE +#define OPENTHREAD_CONFIG_RADIO_STATS_ENABLE 1 +#else +#define OPENTHREAD_CONFIG_RADIO_STATS_ENABLE 0 +#endif + +/** + * @def OPENTHREAD_CONFIG_TMF_ADDRESS_QUERY_TIMEOUT + * + * The timeout value (in seconds) waiting for a address notification response after sending an address query. + * + */ +#ifdef OPENTHREAD_CONFIG_TMF_ADDRESS_QUERY_TIMEOUT +#error `OPENTHREAD_CONFIG_TMF_ADDRESS_QUERY_TIMEOUT` is redefined. +#endif +#define OPENTHREAD_CONFIG_TMF_ADDRESS_QUERY_TIMEOUT CONFIG_OPENTHREAD_ADDRESS_QUERY_TIMEOUT + +/** + * @def OPENTHREAD_CONFIG_TMF_ADDRESS_QUERY_INITIAL_RETRY_DELAY + * + * Initial retry delay for address query (in seconds). + * + */ +#ifdef OPENTHREAD_CONFIG_TMF_ADDRESS_QUERY_INITIAL_RETRY_DELAY +#error `OPENTHREAD_CONFIG_TMF_ADDRESS_QUERY_INITIAL_RETRY_DELAY` is redefined. +#endif +#define OPENTHREAD_CONFIG_TMF_ADDRESS_QUERY_INITIAL_RETRY_DELAY CONFIG_OPENTHREAD_ADDRESS_QUERY_RETRY_DELAY + +/** + * @def OPENTHREAD_CONFIG_TMF_ADDRESS_QUERY_MAX_RETRY_DELAY + * + * Maximum retry delay for address query (in seconds). + * + */ +#ifdef OPENTHREAD_CONFIG_TMF_ADDRESS_QUERY_MAX_RETRY_DELAY +#error `OPENTHREAD_CONFIG_TMF_ADDRESS_QUERY_MAX_RETRY_DELAY` is redefined. +#endif +#define OPENTHREAD_CONFIG_TMF_ADDRESS_QUERY_MAX_RETRY_DELAY CONFIG_OPENTHREAD_ADDRESS_QUERY_MAX_RETRY_DELAY + +/** + * @def OPENTHREAD_CONFIG_MAC_MAX_CSMA_BACKOFFS_DIRECT + * + * The maximum number of backoffs the CSMA-CA algorithm will attempt before declaring a channel access failure. + * + * Equivalent to macMaxCSMABackoffs in IEEE 802.15.4-2006, default value is 4. + * + */ +#ifdef OPENTHREAD_CONFIG_MAC_MAX_CSMA_BACKOFFS_DIRECT +#error `OPENTHREAD_CONFIG_MAC_MAX_CSMA_BACKOFFS_DIRECT` is redefined. +#endif +#define OPENTHREAD_CONFIG_MAC_MAX_CSMA_BACKOFFS_DIRECT CONFIG_OPENTHREAD_MAC_MAX_CSMA_BACKOFFS_DIRECT + +/** + * @def OPENTHREAD_CONFIG_ECDSA_ENABLE + * + * Define to 1 to enable ECDSA support. + * + */ +#ifdef OPENTHREAD_CONFIG_ECDSA_ENABLE +#error `OPENTHREAD_CONFIG_ECDSA_ENABLE` is redefined. +#endif +#if CONFIG_OPENTHREAD_BORDER_ROUTER || CONFIG_OPENTHREAD_SRP_CLIENT +#define OPENTHREAD_CONFIG_ECDSA_ENABLE 1 +#else +#define OPENTHREAD_CONFIG_ECDSA_ENABLE 0 +#endif + +/*----The following options set fixed default values but can be overridden by the user header file.----*/ + +/** + * @def OPENTHREAD_CONFIG_DUA_ENABLE + * + * Define as 1 to support Thread 1.2 Domain Unicast Address feature. + */ +#ifndef OPENTHREAD_CONFIG_DUA_ENABLE +#define OPENTHREAD_CONFIG_DUA_ENABLE 1 +#endif + +/** + * @def OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE + * + * Define to 1 to enable Border Router support. + * + */ +#ifndef OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE +#define OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE 1 +#endif + +/** + * @def OPENTHREAD_CONFIG_BORDER_AGENT_ENABLE + * + * Define to 1 to enable Border Agent support. + * + */ +#ifndef OPENTHREAD_CONFIG_BORDER_AGENT_ENABLE +#define OPENTHREAD_CONFIG_BORDER_AGENT_ENABLE 1 +#endif + +/** + * @def OPENTHREAD_CONFIG_LOG_OUTPUT + * + * The ESP-IDF platform provides an otPlatLog() function. + */ +#ifndef OPENTHREAD_CONFIG_LOG_OUTPUT +#define OPENTHREAD_CONFIG_LOG_OUTPUT OPENTHREAD_CONFIG_LOG_OUTPUT_PLATFORM_DEFINED +#endif + +/** + * @def OPENTHREAD_CONFIG_PLATFORM_ASSERT_MANAGEMENT + * + * The assert is managed by platform defined logic when this flag is set. + * + */ +#ifndef OPENTHREAD_CONFIG_PLATFORM_ASSERT_MANAGEMENT +#define OPENTHREAD_CONFIG_PLATFORM_ASSERT_MANAGEMENT 1 +#endif + /** * @def OPENTHREAD_CONFIG_COAP_API_ENABLE * * Define to 1 to enable the CoAP API. * */ +#ifndef OPENTHREAD_CONFIG_COAP_API_ENABLE #define OPENTHREAD_CONFIG_COAP_API_ENABLE 1 +#endif /** * @def OPENTHREAD_CONFIG_PLATFORM_NETIF_ENABLE @@ -111,175 +629,15 @@ #define OPENTHREAD_CONFIG_TCP_ENABLE 0 #endif -#if CONFIG_OPENTHREAD_BORDER_ROUTER - -/** - * @def OPENTHREAD_CONFIG_BORDER_AGENT_ENABLE - * - * Define to 1 to enable Border Agent support. - * - */ -#ifndef OPENTHREAD_CONFIG_BORDER_AGENT_ENABLE -#define OPENTHREAD_CONFIG_BORDER_AGENT_ENABLE 1 -#endif - -/** - * @def OPENTHREAD_CONFIG_BORDER_AGENT_ID_ENABLE - * - * Define to 1 to enable Border Agent ID support. - * - */ -#ifndef OPENTHREAD_CONFIG_BORDER_AGENT_ID_ENABLE -#define OPENTHREAD_CONFIG_BORDER_AGENT_ID_ENABLE 1 -#endif - -/** - * @def OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE - * - * Define to 1 to enable Border Router support. - * - */ -#ifndef OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE -#define OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE 1 -#endif - -/** - * @def OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE - * - * Define to 1 to enable Border Routing support. - * - */ -#ifndef OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE -#define OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE 1 -#endif - -/** - * @def OPENTHREAD_CONFIG_PLATFORM_UDP_ENABLE - * - * Define to 1 to enable platform UDP support. - * - */ -#ifndef OPENTHREAD_CONFIG_PLATFORM_UDP_ENABLE -#define OPENTHREAD_CONFIG_PLATFORM_UDP_ENABLE 1 -#endif - -/** - * @def OPENTHREAD_CONFIG_NAT64_BORDER_ROUTING_ENABLE - * - * Define to 1 to enable Border Routing NAT64 support. - * - */ -#ifndef OPENTHREAD_CONFIG_NAT64_BORDER_ROUTING_ENABLE -#define OPENTHREAD_CONFIG_NAT64_BORDER_ROUTING_ENABLE 1 -#endif - -/** - * @def OPENTHREAD_CONFIG_ECDSA_ENABLE - * - * Define to 1 to enable ECDSA support. - * - */ -#ifndef OPENTHREAD_CONFIG_ECDSA_ENABLE -#define OPENTHREAD_CONFIG_ECDSA_ENABLE 1 -#endif - -/** - * @def OPENTHREAD_CONFIG_SRP_SERVER_ENABLE - * - * Define to 1 to enable SRP Server support. - * - */ -#ifndef OPENTHREAD_CONFIG_SRP_SERVER_ENABLE -#define OPENTHREAD_CONFIG_SRP_SERVER_ENABLE 1 -#endif - -/** - * @def OPENTHREAD_CONFIG_DNSSD_SERVER_ENABLE - * - * Define to 1 to enable DNS-SD Server support. - * - */ -#ifndef OPENTHREAD_CONFIG_DNSSD_SERVER_ENABLE -#define OPENTHREAD_CONFIG_DNSSD_SERVER_ENABLE 1 -#endif - -/** - * @def OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE - * - * Define to 1 to enable Backbone Router support. - * - */ -#ifndef OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE -#define OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE 1 -#endif - -#endif // CONFIG_OPENTHREAD_BORDER_ROUTER - -/** - * @def OPENTHREAD_CONFIG_RADIO_LINK_TREL_ENABLE - * - * Set to 1 to enable support for Thread Radio Encapsulation Link (TREL). - * - */ -#if CONFIG_OPENTHREAD_RADIO_TREL -#define OPENTHREAD_CONFIG_RADIO_LINK_TREL_ENABLE 1 -#endif // CONFIG_OPENTHREAD_RADIO_TREL - -/** - * @def OPENTHREAD_CONFIG_RADIO_LINK_IEEE_802_15_4_ENABLE - * - * Set to 1 to enable support for IEEE802.15.4 radio link. - * - */ -#if !CONFIG_OPENTHREAD_RADIO_154_NONE -#define OPENTHREAD_CONFIG_RADIO_LINK_IEEE_802_15_4_ENABLE 1 -#else -#define OPENTHREAD_CONFIG_RADIO_LINK_IEEE_802_15_4_ENABLE 0 -#endif - -#if !CONFIG_OPENTHREAD_RADIO_NATIVE -/** - * @def OPENTHREAD_SPINEL_CONFIG_RCP_RESTORATION_MAX_COUNT - * - * Defines the max count of RCP failures allowed to be recovered. - * 0 means to disable RCP failure recovering. - * - */ -#ifndef OPENTHREAD_SPINEL_CONFIG_RCP_RESTORATION_MAX_COUNT -#define OPENTHREAD_SPINEL_CONFIG_RCP_RESTORATION_MAX_COUNT 3 -#endif - -/** - * @def OPENTHREAD_POSIX_CONFIG_RCP_TIME_SYNC_INTERVAL - * - * This setting configures the interval (in units of microseconds) for host-rcp - * time sync. The host will recalculate the time offset between host and RCP - * every interval. - * - */ -#ifndef OPENTHREAD_POSIX_CONFIG_RCP_TIME_SYNC_INTERVAL -#define OPENTHREAD_POSIX_CONFIG_RCP_TIME_SYNC_INTERVAL (60 * 1000 * 1000) -#endif - -/** - * @def OPENTHREAD_SPINEL_CONFIG_COMPATIBILITY_ERROR_CALLBACK_ENABLE - * - * Enables compatibility error callback in Spinel - */ -#ifndef OPENTHREAD_SPINEL_CONFIG_COMPATIBILITY_ERROR_CALLBACK_ENABLE -#define OPENTHREAD_SPINEL_CONFIG_COMPATIBILITY_ERROR_CALLBACK_ENABLE 1 -#endif - - -#endif - /** * @def OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE * * Define to 1 to enable Thread Test Harness reference device support. * */ +#ifndef OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE #define OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE 1 +#endif /** * @def OPENTHREAD_CONFIG_DHCP6_CLIENT_ENABLE @@ -301,29 +659,15 @@ #define OPENTHREAD_CONFIG_DHCP6_SERVER_ENABLE 1 #endif -/** - * @def OPENTHREAD_CONFIG_NCP_SPI_ENABLE - * - * Define to 1 to enable NCP SPI support. - * - */ -#define OPENTHREAD_CONFIG_NCP_SPI_ENABLE 0 - -/** - * @def OPENTHREAD_ENABLE_NCP_SPINEL_ENCRYPTER - * - * Define to 1 to enable NCP Spinel Encrypter. - * - */ -#define OPENTHREAD_ENABLE_NCP_SPINEL_ENCRYPTER 0 - /** * @def OPENTHREAD_CONFIG_NCP_HDLC_ENABLE * * Define to 1 to enable NCP HDLC support. * */ +#ifndef OPENTHREAD_CONFIG_NCP_HDLC_ENABLE #define OPENTHREAD_CONFIG_NCP_HDLC_ENABLE 1 +#endif /** * @def OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE @@ -331,23 +675,9 @@ * Define to 1 to support injecting Service entries into the Thread Network Data. * */ +#ifndef OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE #define OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE 1 - -/** - * @def PACKAGE_NAME - * - * Define to the full name of this package. - * - */ -#define PACKAGE_NAME CONFIG_OPENTHREAD_PACKAGE_NAME - -/** - * @def PACKAGE_STRING - * - * Define to the full name and version of this package. - * - */ -#define PACKAGE_STRING (PACKAGE_NAME " - " PACKAGE_VERSION) +#endif /** * @def OPENTHREAD_CONFIG_ENABLE_BUILTIN_MBEDTLS @@ -358,7 +688,9 @@ * whether to manage mbedTLS internally, such as memory allocation and debug. * */ +#ifndef OPENTHREAD_CONFIG_ENABLE_BUILTIN_MBEDTLS #define OPENTHREAD_CONFIG_ENABLE_BUILTIN_MBEDTLS 0 +#endif /** * @def OPENTHREAD_CONFIG_IP6_SLAAC_ENABLE @@ -366,7 +698,9 @@ * Define as 1 to enable support for adding of auto-configured SLAAC addresses by OpenThread. * */ +#ifndef OPENTHREAD_CONFIG_IP6_SLAAC_ENABLE #define OPENTHREAD_CONFIG_IP6_SLAAC_ENABLE 1 +#endif /** * @def OPENTHREAD_CONFIG_MAX_STATECHANGE_HANDLERS @@ -374,16 +708,9 @@ * The maximum number of state-changed callback handlers (set using `otSetStateChangedCallback()`). * */ +#ifndef OPENTHREAD_CONFIG_MAX_STATECHANGE_HANDLERS #define OPENTHREAD_CONFIG_MAX_STATECHANGE_HANDLERS 3 - -/** - * @def OPENTHREAD_LIB_SPINEL_RX_FRAME_BUFFER_SIZE - * - * Specifies the rx frame buffer size used by `SpinelInterface` in RCP host code. This is applicable/used when - * `RadioSpinel` platform is used. - * - */ -#define OPENTHREAD_LIB_SPINEL_RX_FRAME_BUFFER_SIZE CONFIG_OPENTHREAD_SPINEL_RX_FRAME_BUFFER_SIZE +#endif /** * @def OPENTHREAD_CONFIG_PLATFORM_USEC_TIMER_ENABLE @@ -391,7 +718,9 @@ * Define as 1 to enable microsecond timer. * */ +#ifndef OPENTHREAD_CONFIG_PLATFORM_USEC_TIMER_ENABLE #define OPENTHREAD_CONFIG_PLATFORM_USEC_TIMER_ENABLE 1 +#endif /** * @def OPENTHREAD_CONFIG_PING_SENDER_ENABLE @@ -401,35 +730,9 @@ * Ping sender module implements sending ICMPv6 Echo Request messages and processing ICMPv6 Echo Reply messages. * */ +#ifndef OPENTHREAD_CONFIG_PING_SENDER_ENABLE #define OPENTHREAD_CONFIG_PING_SENDER_ENABLE 1 - -/** - * @def OPENTHREAD_CONFIG_MLE_MAX_CHILDREN - * - * The maximum number of children. - * - */ -#define OPENTHREAD_CONFIG_MLE_MAX_CHILDREN CONFIG_OPENTHREAD_MLE_MAX_CHILDREN - -/** - * @def OPENTHREAD_CONFIG_TMF_ADDRESS_CACHE_ENTRIES - * - * The number of EID-to-RLOC cache entries. - * - */ -#define OPENTHREAD_CONFIG_TMF_ADDRESS_CACHE_ENTRIES CONFIG_OPENTHREAD_TMF_ADDR_CACHE_ENTRIES - -#if CONFIG_OPENTHREAD_DUA_ENABLE -/** - * @def OPENTHREAD_CONFIG_DUA_ENABLE - * - * Define as 1 to support Thread 1.2 Domain Unicast Address feature. - * - */ -#ifndef OPENTHREAD_CONFIG_DUA_ENABLE -#define OPENTHREAD_CONFIG_DUA_ENABLE 1 #endif -#endif //CONFIG_OPENTHREAD_DUA_ENABLE /** * @def OPENTHREAD_CONFIG_MLR_ENABLE @@ -451,85 +754,6 @@ #define OPENTHREAD_CONFIG_DTLS_MAX_CONTENT_LEN 768 #endif -/** - * The configurable definitions via Kconfig - */ -#if CONFIG_OPENTHREAD_COMMISSIONER -#define OPENTHREAD_CONFIG_COMMISSIONER_ENABLE 1 - -/** - * @def OPENTHREAD_CONFIG_COMMISSIONER_MAX_JOINER_ENTRIES - * - * The maximum number of Joiner entries maintained by the Commissioner - * - */ -#define OPENTHREAD_CONFIG_COMMISSIONER_MAX_JOINER_ENTRIES CONFIG_OPENTHREAD_COMM_MAX_JOINER_ENTRIES -#endif - -#if CONFIG_OPENTHREAD_MACFILTER_ENABLE -#define OPENTHREAD_CONFIG_MAC_FILTER_ENABLE 1 -#endif - -#if CONFIG_OPENTHREAD_JOINER -#define OPENTHREAD_CONFIG_JOINER_ENABLE 1 -#endif - -#if CONFIG_OPENTHREAD_DIAG -#define OPENTHREAD_CONFIG_DIAG_ENABLE 1 -#endif - -#if CONFIG_OPENTHREAD_SRP_CLIENT -#ifndef OPENTHREAD_CONFIG_ECDSA_ENABLE -#define OPENTHREAD_CONFIG_ECDSA_ENABLE 1 -#endif - -#ifndef OPENTHREAD_CONFIG_SRP_CLIENT_ENABLE -#define OPENTHREAD_CONFIG_SRP_CLIENT_ENABLE 1 -#endif - -/** - * @def OPENTHREAD_CONFIG_SRP_CLIENT_BUFFERS_MAX_SERVICES - * - * Specifies number of service entries in the SRP client service pool. - * - * This config is applicable only when `OPENTHREAD_CONFIG_SRP_CLIENT_BUFFERS_ENABLE` is enabled. - * - */ -#define OPENTHREAD_CONFIG_SRP_CLIENT_BUFFERS_MAX_SERVICES CONFIG_OPENTHREAD_SRP_CLIENT_MAX_SERVICES -#endif - -/** - * @def OPENTHREAD_CONFIG_DNS_CLIENT_ENABLE - * - * Define to 1 to enable DNS Client support. - * - */ -#define OPENTHREAD_CONFIG_DNS_CLIENT_ENABLE CONFIG_OPENTHREAD_DNS_CLIENT - -#if CONFIG_OPENTHREAD_CSL_ENABLE - -/** - * @def OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE - * - * Define as 1 to support Thread 1.2 CSL feature. - * - */ -#ifndef OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE -#define OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE 1 -#endif - -/** - * @def OPENTHREAD_CONFIG_MAC_CSL_DEBUG_ENABLE - * - * Define as 1 to enable support Thread 1.2 CSL debug. - * - */ -#ifndef OPENTHREAD_CONFIG_MAC_CSL_DEBUG_ENABLE -#define OPENTHREAD_CONFIG_MAC_CSL_DEBUG_ENABLE CONFIG_OPENTHREAD_CSL_DEBUG_ENABLE -#endif - -#endif // CONFIG_OPENTHREAD_CSL_ENABLE - /** * @def OPENTHREAD_CONFIG_MAC_CSL_REQUEST_AHEAD_US * @@ -540,29 +764,6 @@ #define OPENTHREAD_CONFIG_MAC_CSL_REQUEST_AHEAD_US 20000 #endif -#if CONFIG_OPENTHREAD_LINK_METRICS - -/** - * @def OPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE - * - * Define as 1 to support Thread 1.2 Link Metrics Subject feature. - * - */ -#ifndef OPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE -#define OPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE 1 -#endif - -/** - * @def OPENTHREAD_CONFIG_MLE_LINK_METRICS_INITIATOR_ENABLE - * - * Define as 1 to support Thread 1.2 Link Metrics feature. - * - */ -#ifndef OPENTHREAD_CONFIG_MLE_LINK_METRICS_INITIATOR_ENABLE -#define OPENTHREAD_CONFIG_MLE_LINK_METRICS_INITIATOR_ENABLE 1 -#endif -#endif //CONFIG_OPENTHREAD_LINK_METRICS - /** * @def OPENTHREAD_CONFIG_OPERATIONAL_DATASET_AUTO_INIT * @@ -573,89 +774,6 @@ #define OPENTHREAD_CONFIG_OPERATIONAL_DATASET_AUTO_INIT 1 #endif -/** - * - * Define as 1 to enable support for allocating message pool buffer in PSRAM - * - */ -#if CONFIG_OPENTHREAD_PLATFORM_MSGPOOL_MANAGEMENT - -/** - * @def OPENTHREAD_CONFIG_PLATFORM_MESSAGE_MANAGEMENT - * - * The message pool is managed by platform defined logic when this flag is set. - * This feature would typically be used when operating in a multi-threaded system - * and multiple threads need to access the message pool. - * - */ -#define OPENTHREAD_CONFIG_PLATFORM_MESSAGE_MANAGEMENT 1 -#endif - -/** - * @def OPENTHREAD_CONFIG_TIME_SYNC_ENABLE - * - * Define as 1 to enable the time synchronization service feature. - * - */ -#if CONFIG_OPENTHREAD_TIME_SYNC -#define OPENTHREAD_CONFIG_TIME_SYNC_ENABLE 1 -#endif - -/** - * @def OPENTHREAD_CONFIG_RADIO_STATS_ENABLE - * - * Set to 1 to enable support for Radio Statistics. Note that this option only works for OPENTHREAD_FTD and - * OPENTHREAD_MTD. - * - */ -#if CONFIG_OPENTHREAD_RADIO_STATS_ENABLE -#define OPENTHREAD_CONFIG_RADIO_STATS_ENABLE 1 -#endif - -/** - * @def OPENTHREAD_CONFIG_TMF_ADDRESS_QUERY_TIMEOUT - * - * The timeout value (in seconds) waiting for a address notification response after sending an address query. - * - */ -#ifndef OPENTHREAD_CONFIG_TMF_ADDRESS_QUERY_TIMEOUT -#define OPENTHREAD_CONFIG_TMF_ADDRESS_QUERY_TIMEOUT CONFIG_OPENTHREAD_ADDRESS_QUERY_TIMEOUT -#endif - -/** - * @def OPENTHREAD_CONFIG_TMF_ADDRESS_QUERY_INITIAL_RETRY_DELAY - * - * Initial retry delay for address query (in seconds). - * - */ -#ifndef OPENTHREAD_CONFIG_TMF_ADDRESS_QUERY_INITIAL_RETRY_DELAY -#define OPENTHREAD_CONFIG_TMF_ADDRESS_QUERY_INITIAL_RETRY_DELAY CONFIG_OPENTHREAD_ADDRESS_QUERY_RETRY_DELAY -#endif - -/** - * @def OPENTHREAD_CONFIG_TMF_ADDRESS_QUERY_MAX_RETRY_DELAY - * - * Maximum retry delay for address query (in seconds). - * - */ -#ifndef OPENTHREAD_CONFIG_TMF_ADDRESS_QUERY_MAX_RETRY_DELAY -#define OPENTHREAD_CONFIG_TMF_ADDRESS_QUERY_MAX_RETRY_DELAY CONFIG_OPENTHREAD_ADDRESS_QUERY_MAX_RETRY_DELAY -#endif - -/** - * @def OPENTHREAD_CONFIG_MAC_MAX_CSMA_BACKOFFS_DIRECT - * - * The maximum number of backoffs the CSMA-CA algorithm will attempt before declaring a channel access failure. - * - * Equivalent to macMaxCSMABackoffs in IEEE 802.15.4-2006, default value is 4. - * - */ -#ifndef OPENTHREAD_CONFIG_MAC_MAX_CSMA_BACKOFFS_DIRECT -#define OPENTHREAD_CONFIG_MAC_MAX_CSMA_BACKOFFS_DIRECT CONFIG_OPENTHREAD_MAC_MAX_CSMA_BACKOFFS_DIRECT -#endif - #ifndef OPENTHREAD_CONFIG_THREAD_VERSION #define OPENTHREAD_CONFIG_THREAD_VERSION OT_THREAD_VERSION_1_4 #endif - -#define OPENTHREAD_FTD 1 diff --git a/components/openthread/private_include/openthread-core-esp32x-mtd-config.h b/components/openthread/private_include/openthread-core-esp32x-mtd-config.h index dd247037d7..aa937b6868 100644 --- a/components/openthread/private_include/openthread-core-esp32x-mtd-config.h +++ b/components/openthread/private_include/openthread-core-esp32x-mtd-config.h @@ -8,38 +8,44 @@ #include "sdkconfig.h" +#if CONFIG_OPENTHREAD_HEADER_CUSTOM +#include CONFIG_OPENTHREAD_CUSTOM_HEADER_FILE_NAME +#endif + +#define OPENTHREAD_MTD 1 + /** * @def OPENTHREAD_CONFIG_PLATFORM_INFO * * The platform-specific string to insert into the OpenThread version string. * */ +#ifdef OPENTHREAD_CONFIG_PLATFORM_INFO +#error `OPENTHREAD_CONFIG_PLATFORM_INFO` is redefined. +#endif #define OPENTHREAD_CONFIG_PLATFORM_INFO CONFIG_OPENTHREAD_PLATFORM_INFO /** - * @def OPENTHREAD_CONFIG_PLATFORM_ASSERT_MANAGEMENT + * @def PACKAGE_NAME * - * The assert is managed by platform defined logic when this flag is set. + * Define to the full name of this package. * */ -#define OPENTHREAD_CONFIG_PLATFORM_ASSERT_MANAGEMENT 1 +#ifdef PACKAGE_NAME +#error `PACKAGE_NAME` is redefined. +#endif +#define PACKAGE_NAME CONFIG_OPENTHREAD_PACKAGE_NAME /** - * @def OPENTHREAD_CONFIG_PLATFORM_FLASH_API_ENABLE + * @def PACKAGE_STRING * - * Define to 1 to enable otPlatFlash* APIs to support non-volatile storage. - * - * When defined to 1, the platform MUST implement the otPlatFlash* APIs instead of the otPlatSettings* APIs. + * Define to the full name and version of this package. * */ -#define OPENTHREAD_CONFIG_PLATFORM_FLASH_API_ENABLE 0 - -/** - * @def OPENTHREAD_CONFIG_LOG_OUTPUT - * - * The ESP-IDF platform provides an otPlatLog() function. - */ -#define OPENTHREAD_CONFIG_LOG_OUTPUT OPENTHREAD_CONFIG_LOG_OUTPUT_PLATFORM_DEFINED +#ifdef PACKAGE_STRING +#error `PACKAGE_STRING` is redefined. +#endif +#define PACKAGE_STRING (PACKAGE_NAME " - " PACKAGE_VERSION) /** * @def OPENTHREAD_CONFIG_LOG_LEVEL_DYNAMIC_ENABLE @@ -47,6 +53,9 @@ * Configuration option to enable dynamic log level control. * */ +#ifdef OPENTHREAD_CONFIG_LOG_LEVEL_DYNAMIC_ENABLE +#error `OPENTHREAD_CONFIG_LOG_LEVEL_DYNAMIC_ENABLE` is redefined. +#endif #define OPENTHREAD_CONFIG_LOG_LEVEL_DYNAMIC_ENABLE CONFIG_OPENTHREAD_LOG_LEVEL_DYNAMIC /** @@ -56,30 +65,203 @@ * verbose log level possible. See `OPENTHREAD_CONFIG_LOG_LEVEL_INIT` to set the initial log level. * */ -#if OPENTHREAD_CONFIG_LOG_LEVEL_DYNAMIC_ENABLE +#ifdef OPENTHREAD_CONFIG_LOG_LEVEL +#error `OPENTHREAD_CONFIG_LOG_LEVEL` is redefined. +#endif +#if CONFIG_OPENTHREAD_LOG_LEVEL_DYNAMIC #define OPENTHREAD_CONFIG_LOG_LEVEL OT_LOG_LEVEL_DEBG #else #define OPENTHREAD_CONFIG_LOG_LEVEL CONFIG_OPENTHREAD_LOG_LEVEL #endif -#define OPENTHREAD_CONFIG_LOG_CLI 1 -#define OPENTHREAD_CONFIG_LOG_PKT_DUMP 1 -#define OPENTHREAD_CONFIG_LOG_PLATFORM 1 - /** * @def OPENTHREAD_CONFIG_NUM_MESSAGE_BUFFERS * * The number of message buffers in buffer pool */ +#ifdef OPENTHREAD_CONFIG_NUM_MESSAGE_BUFFERS +#error `OPENTHREAD_CONFIG_NUM_MESSAGE_BUFFERS` is redefined. +#endif #define OPENTHREAD_CONFIG_NUM_MESSAGE_BUFFERS CONFIG_OPENTHREAD_NUM_MESSAGE_BUFFERS +/** + * @def OPENTHREAD_CONFIG_HEAP_EXTERNAL_ENABLE + * + * Specifies the rx frame buffer size used by `SpinelInterface` in RCP host code. This is applicable/used when + * `RadioSpinel` platform is used. + * + */ +#ifdef OPENTHREAD_LIB_SPINEL_RX_FRAME_BUFFER_SIZE +#error `OPENTHREAD_LIB_SPINEL_RX_FRAME_BUFFER_SIZE` is redefined. +#endif +#define OPENTHREAD_LIB_SPINEL_RX_FRAME_BUFFER_SIZE CONFIG_OPENTHREAD_SPINEL_RX_FRAME_BUFFER_SIZE + +#ifdef OPENTHREAD_CONFIG_COMMISSIONER_ENABLE +#error `OPENTHREAD_CONFIG_COMMISSIONER_ENABLE` is redefined. +#endif +#if CONFIG_OPENTHREAD_COMMISSIONER +#define OPENTHREAD_CONFIG_COMMISSIONER_ENABLE 1 +#else +#define OPENTHREAD_CONFIG_COMMISSIONER_ENABLE 0 +#endif + +#ifdef OPENTHREAD_CONFIG_MAC_FILTER_ENABLE +#error `OPENTHREAD_CONFIG_MAC_FILTER_ENABLE` is redefined. +#endif +#if CONFIG_OPENTHREAD_MACFILTER_ENABLE +#define OPENTHREAD_CONFIG_MAC_FILTER_ENABLE 1 +#else +#define OPENTHREAD_CONFIG_MAC_FILTER_ENABLE 0 +#endif // CONFIG_OPENTHREAD_MACFILTER_ENABLE + +#ifdef OPENTHREAD_CONFIG_JOINER_ENABLE +#error `OPENTHREAD_CONFIG_JOINER_ENABLE` is redefined. +#endif +#if CONFIG_OPENTHREAD_JOINER +#define OPENTHREAD_CONFIG_JOINER_ENABLE 1 +#else +#define OPENTHREAD_CONFIG_JOINER_ENABLE 0 +#endif + +#ifdef OPENTHREAD_CONFIG_DIAG_ENABLE +#error `OPENTHREAD_CONFIG_DIAG_ENABLE` is redefined. +#endif +#if CONFIG_OPENTHREAD_DIAG +#define OPENTHREAD_CONFIG_DIAG_ENABLE 1 +#else +#define OPENTHREAD_CONFIG_DIAG_ENABLE 0 +#endif + +#ifdef OPENTHREAD_CONFIG_SRP_CLIENT_ENABLE +#error `OPENTHREAD_CONFIG_SRP_CLIENT_ENABLE` is redefined. +#endif +#if CONFIG_OPENTHREAD_SRP_CLIENT + +#ifdef OPENTHREAD_CONFIG_ECDSA_ENABLE +#error `OPENTHREAD_CONFIG_ECDSA_ENABLE` is redefined. +#endif +#define OPENTHREAD_CONFIG_ECDSA_ENABLE 1 + +#define OPENTHREAD_CONFIG_SRP_CLIENT_ENABLE 1 + +/** + * @def OPENTHREAD_CONFIG_SRP_CLIENT_BUFFERS_MAX_SERVICES + * + * Specifies number of service entries in the SRP client service pool. + * + * This config is applicable only when `OPENTHREAD_CONFIG_SRP_CLIENT_BUFFERS_ENABLE` is enabled. + * + */ +#ifdef OPENTHREAD_CONFIG_SRP_CLIENT_BUFFERS_MAX_SERVICES +#error `OPENTHREAD_CONFIG_SRP_CLIENT_BUFFERS_MAX_SERVICES` is redefined. +#endif +#define OPENTHREAD_CONFIG_SRP_CLIENT_BUFFERS_MAX_SERVICES CONFIG_OPENTHREAD_SRP_CLIENT_MAX_SERVICES + +#else + +#define OPENTHREAD_CONFIG_SRP_CLIENT_ENABLE 0 + +#endif // CONFIG_OPENTHREAD_SRP_CLIENT + +/** + * @def OPENTHREAD_CONFIG_DNS_CLIENT_ENABLE + * + * Define to 1 to enable DNS Client support. + * + */ +#ifdef OPENTHREAD_CONFIG_DNS_CLIENT_ENABLE +#error `OPENTHREAD_CONFIG_DNS_CLIENT_ENABLE` is redefined. +#endif +#define OPENTHREAD_CONFIG_DNS_CLIENT_ENABLE CONFIG_OPENTHREAD_DNS_CLIENT + +/** + * @def OPENTHREAD_CONFIG_TIME_SYNC_ENABLE + * + * Define as 1 to enable the time synchronization service feature. + * + */ +#ifdef OPENTHREAD_CONFIG_TIME_SYNC_ENABLE +#error `OPENTHREAD_CONFIG_TIME_SYNC_ENABLE` is redefined. +#endif +#if CONFIG_OPENTHREAD_TIME_SYNC +#define OPENTHREAD_CONFIG_TIME_SYNC_ENABLE 1 +#else +#define OPENTHREAD_CONFIG_TIME_SYNC_ENABLE 0 +#endif + +/** + * @def OPENTHREAD_CONFIG_RADIO_STATS_ENABLE + * + * Set to 1 to enable support for Radio Statistics. Note that this option only works for OPENTHREAD_FTD and + * OPENTHREAD_MTD. + * + */ +#ifdef OPENTHREAD_CONFIG_RADIO_STATS_ENABLE +#error `OPENTHREAD_CONFIG_RADIO_STATS_ENABLE` is redefined. +#endif +#if CONFIG_OPENTHREAD_RADIO_STATS_ENABLE +#define OPENTHREAD_CONFIG_RADIO_STATS_ENABLE 1 +#else +#define OPENTHREAD_CONFIG_RADIO_STATS_ENABLE 0 +#endif + +/** + * @def OPENTHREAD_CONFIG_TMF_ADDRESS_QUERY_TIMEOUT + * + * The timeout value (in seconds) waiting for a address notification response after sending an address query. + * + */ +#ifdef OPENTHREAD_CONFIG_TMF_ADDRESS_QUERY_TIMEOUT +#error `OPENTHREAD_CONFIG_TMF_ADDRESS_QUERY_TIMEOUT` is redefined. +#endif +#define OPENTHREAD_CONFIG_TMF_ADDRESS_QUERY_TIMEOUT CONFIG_OPENTHREAD_ADDRESS_QUERY_TIMEOUT + +/** + * @def OPENTHREAD_CONFIG_TMF_ADDRESS_QUERY_INITIAL_RETRY_DELAY + * + * Initial retry delay for address query (in seconds). + * + */ +#ifdef OPENTHREAD_CONFIG_TMF_ADDRESS_QUERY_INITIAL_RETRY_DELAY +#error `OPENTHREAD_CONFIG_TMF_ADDRESS_QUERY_INITIAL_RETRY_DELAY` is redefined. +#endif +#define OPENTHREAD_CONFIG_TMF_ADDRESS_QUERY_INITIAL_RETRY_DELAY CONFIG_OPENTHREAD_ADDRESS_QUERY_RETRY_DELAY + +/** + * @def OPENTHREAD_CONFIG_TMF_ADDRESS_QUERY_MAX_RETRY_DELAY + * + * Maximum retry delay for address query (in seconds). + * + */ +#ifdef OPENTHREAD_CONFIG_TMF_ADDRESS_QUERY_MAX_RETRY_DELAY +#error `OPENTHREAD_CONFIG_TMF_ADDRESS_QUERY_MAX_RETRY_DELAY` is redefined. +#endif +#define OPENTHREAD_CONFIG_TMF_ADDRESS_QUERY_MAX_RETRY_DELAY CONFIG_OPENTHREAD_ADDRESS_QUERY_MAX_RETRY_DELAY + +/** + * @def OPENTHREAD_CONFIG_MAC_MAX_CSMA_BACKOFFS_DIRECT + * + * The maximum number of backoffs the CSMA-CA algorithm will attempt before declaring a channel access failure. + * + * Equivalent to macMaxCSMABackoffs in IEEE 802.15.4-2006, default value is 4. + * + */ +#ifdef OPENTHREAD_CONFIG_MAC_MAX_CSMA_BACKOFFS_DIRECT +#error `OPENTHREAD_CONFIG_MAC_MAX_CSMA_BACKOFFS_DIRECT` is redefined. +#endif +#define OPENTHREAD_CONFIG_MAC_MAX_CSMA_BACKOFFS_DIRECT CONFIG_OPENTHREAD_MAC_MAX_CSMA_BACKOFFS_DIRECT + +/*----The following options set fixed default values but can be overridden by the user header file.----*/ + /** * @def OPENTHREAD_CONFIG_COAP_API_ENABLE * * Define to 1 to enable the CoAP API. * */ +#ifndef OPENTHREAD_CONFIG_COAP_API_ENABLE #define OPENTHREAD_CONFIG_COAP_API_ENABLE 1 +#endif /** * @def OPENTHREAD_CONFIG_PLATFORM_NETIF_ENABLE @@ -91,6 +273,25 @@ #define OPENTHREAD_CONFIG_PLATFORM_NETIF_ENABLE 1 #endif +/** + * @def OPENTHREAD_CONFIG_PLATFORM_ASSERT_MANAGEMENT + * + * The assert is managed by platform defined logic when this flag is set. + * + */ +#ifndef OPENTHREAD_CONFIG_PLATFORM_ASSERT_MANAGEMENT +#define OPENTHREAD_CONFIG_PLATFORM_ASSERT_MANAGEMENT 1 +#endif + +/** + * @def OPENTHREAD_CONFIG_LOG_OUTPUT + * + * The ESP-IDF platform provides an otPlatLog() function. + */ +#ifndef OPENTHREAD_CONFIG_LOG_OUTPUT +#define OPENTHREAD_CONFIG_LOG_OUTPUT OPENTHREAD_CONFIG_LOG_OUTPUT_PLATFORM_DEFINED +#endif + /** * @def OPENTHREAD_CONFIG_HEAP_EXTERNAL_ENABLE * @@ -117,23 +318,9 @@ * Define to 1 to enable Thread Test Harness reference device support. * */ +#ifndef OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE #define OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE 1 - -/** - * @def OPENTHREAD_CONFIG_NCP_SPI_ENABLE - * - * Define to 1 to enable NCP SPI support. - * - */ -#define OPENTHREAD_CONFIG_NCP_SPI_ENABLE 0 - -/** - * @def OPENTHREAD_ENABLE_NCP_SPINEL_ENCRYPTER - * - * Define to 1 to enable NCP Spinel Encrypter. - * - */ -#define OPENTHREAD_ENABLE_NCP_SPINEL_ENCRYPTER 0 +#endif /** * @def OPENTHREAD_CONFIG_NCP_HDLC_ENABLE @@ -141,23 +328,9 @@ * Define to 1 to enable NCP HDLC support. * */ +#ifndef OPENTHREAD_CONFIG_NCP_HDLC_ENABLE #define OPENTHREAD_CONFIG_NCP_HDLC_ENABLE 1 - -/** - * @def PACKAGE_NAME - * - * Define to the full name of this package. - * - */ -#define PACKAGE_NAME CONFIG_OPENTHREAD_PACKAGE_NAME - -/** - * @def PACKAGE_STRING - * - * Define to the full name and version of this package. - * - */ -#define PACKAGE_STRING (PACKAGE_NAME " - " PACKAGE_VERSION) +#endif /** * @def OPENTHREAD_CONFIG_ENABLE_BUILTIN_MBEDTLS @@ -168,7 +341,9 @@ * whether to manage mbedTLS internally, such as memory allocation and debug. * */ +#ifndef OPENTHREAD_CONFIG_ENABLE_BUILTIN_MBEDTLS #define OPENTHREAD_CONFIG_ENABLE_BUILTIN_MBEDTLS 0 +#endif /** * @def OPENTHREAD_CONFIG_IP6_SLAAC_ENABLE @@ -176,7 +351,9 @@ * Define as 1 to enable support for adding of auto-configured SLAAC addresses by OpenThread. * */ +#ifndef OPENTHREAD_CONFIG_IP6_SLAAC_ENABLE #define OPENTHREAD_CONFIG_IP6_SLAAC_ENABLE 1 +#endif /** * @def OPENTHREAD_CONFIG_MAX_STATECHANGE_HANDLERS @@ -184,16 +361,9 @@ * The maximum number of state-changed callback handlers (set using `otSetStateChangedCallback()`). * */ +#ifndef OPENTHREAD_CONFIG_MAX_STATECHANGE_HANDLERS #define OPENTHREAD_CONFIG_MAX_STATECHANGE_HANDLERS 3 - -/** - * @def OPENTHREAD_LIB_SPINEL_RX_FRAME_BUFFER_SIZE - * - * Specifies the rx frame buffer size used by `SpinelInterface` in RCP host code. This is applicable/used when - * `RadioSpinel` platform is used. - * - */ -#define OPENTHREAD_LIB_SPINEL_RX_FRAME_BUFFER_SIZE CONFIG_OPENTHREAD_SPINEL_RX_FRAME_BUFFER_SIZE +#endif /** * @def OPENTHREAD_CONFIG_PLATFORM_USEC_TIMER_ENABLE @@ -201,7 +371,9 @@ * Define as 1 to enable microsecond timer. * */ +#ifndef OPENTHREAD_CONFIG_PLATFORM_USEC_TIMER_ENABLE #define OPENTHREAD_CONFIG_PLATFORM_USEC_TIMER_ENABLE 1 +#endif /** * @def OPENTHREAD_CONFIG_PING_SENDER_ENABLE @@ -211,7 +383,9 @@ * Ping sender module implements sending ICMPv6 Echo Request messages and processing ICMPv6 Echo Reply messages. * */ +#ifndef OPENTHREAD_CONFIG_PING_SENDER_ENABLE #define OPENTHREAD_CONFIG_PING_SENDER_ENABLE 1 +#endif /** * @def OPENTHREAD_CONFIG_DTLS_MAX_CONTENT_LEN @@ -222,116 +396,3 @@ #ifndef OPENTHREAD_CONFIG_DTLS_MAX_CONTENT_LEN #define OPENTHREAD_CONFIG_DTLS_MAX_CONTENT_LEN 768 #endif - -/** - * The configurable definitions via Kconfig - */ -#if CONFIG_OPENTHREAD_COMMISSIONER -#define OPENTHREAD_CONFIG_COMMISSIONER_ENABLE 0 -#endif - -#if CONFIG_OPENTHREAD_MACFILTER_ENABLE -#define OPENTHREAD_CONFIG_MAC_FILTER_ENABLE 1 -#endif // CONFIG_OPENTHREAD_MACFILTER_ENABLE - -#if CONFIG_OPENTHREAD_JOINER -#define OPENTHREAD_CONFIG_JOINER_ENABLE 1 -#endif - -#if CONFIG_OPENTHREAD_DIAG -#define OPENTHREAD_CONFIG_DIAG_ENABLE 1 -#endif - -#if CONFIG_OPENTHREAD_SRP_CLIENT -#ifndef OPENTHREAD_CONFIG_ECDSA_ENABLE -#define OPENTHREAD_CONFIG_ECDSA_ENABLE 1 -#endif - -#ifndef OPENTHREAD_CONFIG_SRP_CLIENT_ENABLE -#define OPENTHREAD_CONFIG_SRP_CLIENT_ENABLE 1 -#endif - -/** - * @def OPENTHREAD_CONFIG_SRP_CLIENT_BUFFERS_MAX_SERVICES - * - * Specifies number of service entries in the SRP client service pool. - * - * This config is applicable only when `OPENTHREAD_CONFIG_SRP_CLIENT_BUFFERS_ENABLE` is enabled. - * - */ -#define OPENTHREAD_CONFIG_SRP_CLIENT_BUFFERS_MAX_SERVICES CONFIG_OPENTHREAD_SRP_CLIENT_MAX_SERVICES - -#endif - -/** - * @def OPENTHREAD_CONFIG_DNS_CLIENT_ENABLE - * - * Define to 1 to enable DNS Client support. - * - */ -#define OPENTHREAD_CONFIG_DNS_CLIENT_ENABLE CONFIG_OPENTHREAD_DNS_CLIENT - -/** - * @def OPENTHREAD_CONFIG_TIME_SYNC_ENABLE - * - * Define as 1 to enable the time synchronization service feature. - * - */ -#if CONFIG_OPENTHREAD_TIME_SYNC -#define OPENTHREAD_CONFIG_TIME_SYNC_ENABLE 1 -#endif - -/** - * @def OPENTHREAD_CONFIG_RADIO_STATS_ENABLE - * - * Set to 1 to enable support for Radio Statistics. Note that this option only works for OPENTHREAD_FTD and - * OPENTHREAD_MTD. - * - */ -#if CONFIG_OPENTHREAD_RADIO_STATS_ENABLE -#define OPENTHREAD_CONFIG_RADIO_STATS_ENABLE 1 -#endif - -/** - * @def OPENTHREAD_CONFIG_TMF_ADDRESS_QUERY_TIMEOUT - * - * The timeout value (in seconds) waiting for a address notification response after sending an address query. - * - */ -#ifndef OPENTHREAD_CONFIG_TMF_ADDRESS_QUERY_TIMEOUT -#define OPENTHREAD_CONFIG_TMF_ADDRESS_QUERY_TIMEOUT CONFIG_OPENTHREAD_ADDRESS_QUERY_TIMEOUT -#endif - -/** - * @def OPENTHREAD_CONFIG_TMF_ADDRESS_QUERY_INITIAL_RETRY_DELAY - * - * Initial retry delay for address query (in seconds). - * - */ -#ifndef OPENTHREAD_CONFIG_TMF_ADDRESS_QUERY_INITIAL_RETRY_DELAY -#define OPENTHREAD_CONFIG_TMF_ADDRESS_QUERY_INITIAL_RETRY_DELAY CONFIG_OPENTHREAD_ADDRESS_QUERY_RETRY_DELAY -#endif - -/** - * @def OPENTHREAD_CONFIG_TMF_ADDRESS_QUERY_MAX_RETRY_DELAY - * - * Maximum retry delay for address query (in seconds). - * - */ -#ifndef OPENTHREAD_CONFIG_TMF_ADDRESS_QUERY_MAX_RETRY_DELAY -#define OPENTHREAD_CONFIG_TMF_ADDRESS_QUERY_MAX_RETRY_DELAY CONFIG_OPENTHREAD_ADDRESS_QUERY_MAX_RETRY_DELAY -#endif - -/** - * @def OPENTHREAD_CONFIG_MAC_MAX_CSMA_BACKOFFS_DIRECT - * - * The maximum number of backoffs the CSMA-CA algorithm will attempt before declaring a channel access failure. - * - * Equivalent to macMaxCSMABackoffs in IEEE 802.15.4-2006, default value is 4. - * - */ -#ifndef OPENTHREAD_CONFIG_MAC_MAX_CSMA_BACKOFFS_DIRECT -#define OPENTHREAD_CONFIG_MAC_MAX_CSMA_BACKOFFS_DIRECT CONFIG_OPENTHREAD_MAC_MAX_CSMA_BACKOFFS_DIRECT -#endif - -#define OPENTHREAD_MTD 1 diff --git a/components/openthread/private_include/openthread-core-esp32x-radio-config.h b/components/openthread/private_include/openthread-core-esp32x-radio-config.h index c06dcf526a..f98c28ed92 100644 --- a/components/openthread/private_include/openthread-core-esp32x-radio-config.h +++ b/components/openthread/private_include/openthread-core-esp32x-radio-config.h @@ -7,38 +7,45 @@ #pragma once #include "sdkconfig.h" + +#if CONFIG_OPENTHREAD_HEADER_CUSTOM +#include CONFIG_OPENTHREAD_CUSTOM_HEADER_FILE_NAME +#endif + +#define OPENTHREAD_RADIO 1 + /** * @def OPENTHREAD_CONFIG_PLATFORM_INFO * * The platform-specific string to insert into the OpenThread version string. * */ +#ifdef OPENTHREAD_CONFIG_PLATFORM_INFO +#error `OPENTHREAD_CONFIG_PLATFORM_INFO` is redefined. +#endif #define OPENTHREAD_CONFIG_PLATFORM_INFO CONFIG_OPENTHREAD_PLATFORM_INFO /** - * @def OPENTHREAD_CONFIG_PLATFORM_ASSERT_MANAGEMENT + * @def PACKAGE_NAME * - * The assert is managed by platform defined logic when this flag is set. + * Define to the full name of this package. * */ -#define OPENTHREAD_CONFIG_PLATFORM_ASSERT_MANAGEMENT 1 +#ifdef PACKAGE_NAME +#error `PACKAGE_NAME` is redefined. +#endif +#define PACKAGE_NAME CONFIG_OPENTHREAD_PACKAGE_NAME /** - * @def OPENTHREAD_CONFIG_PLATFORM_FLASH_API_ENABLE + * @def PACKAGE_STRING * - * Define to 1 to enable otPlatFlash* APIs to support non-volatile storage. - * - * When defined to 1, the platform MUST implement the otPlatFlash* APIs instead of the otPlatSettings* APIs. + * Define to the full name and version of this package. * */ -#define OPENTHREAD_CONFIG_PLATFORM_FLASH_API_ENABLE 0 - -/** - * @def OPENTHREAD_CONFIG_LOG_OUTPUT - * - * The ESP-IDF platform provides an otPlatLog() function. - */ -#define OPENTHREAD_CONFIG_LOG_OUTPUT OPENTHREAD_CONFIG_LOG_OUTPUT_PLATFORM_DEFINED +#ifdef PACKAGE_STRING +#error `PACKAGE_STRING` is redefined. +#endif +#define PACKAGE_STRING (PACKAGE_NAME " - " PACKAGE_VERSION) /** * @def OPENTHREAD_CONFIG_LOG_LEVEL @@ -47,7 +54,9 @@ * verbose log level possible. See `OPENTHREAD_CONFIG_LOG_LEVEL_INIT` to set the initial log level. * */ -#ifndef OPENTHREAD_CONFIG_LOG_LEVEL +#ifdef OPENTHREAD_CONFIG_LOG_LEVEL +#error `OPENTHREAD_CONFIG_LOG_LEVEL` is redefined. +#endif #if CONFIG_LOG_DEFAULT_LEVEL_NONE #define OPENTHREAD_CONFIG_LOG_LEVEL OT_LOG_LEVEL_NONE #elif CONFIG_LOG_DEFAULT_LEVEL_ERROR @@ -61,26 +70,6 @@ #elif CONFIG_LOG_DEFAULT_LEVEL_VERBOSE #define OPENTHREAD_CONFIG_LOG_LEVEL OT_LOG_LEVEL_DEBG #endif -#endif - -#define OPENTHREAD_CONFIG_LOG_CLI 1 -#define OPENTHREAD_CONFIG_LOG_PKT_DUMP 1 -#define OPENTHREAD_CONFIG_LOG_PLATFORM 1 - -/** - * @def OPENTHREAD_CONFIG_NUM_MESSAGE_BUFFERS - * - * The number of message buffers in buffer pool - */ -#define OPENTHREAD_CONFIG_NUM_MESSAGE_BUFFERS 50 - -/** - * @def OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE - * - * Define to 1 to enable Thread Test Harness reference device support. - * - */ -#define OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE 0 /** * @def OPENTHREAD_CONFIG_NCP_SPI_ENABLE @@ -88,59 +77,22 @@ * Define to 1 to enable NCP SPI support. * */ +#ifdef OPENTHREAD_CONFIG_NCP_SPI_ENABLE +#error `OPENTHREAD_CONFIG_NCP_SPI_ENABLE` is redefined. +#endif #define OPENTHREAD_CONFIG_NCP_SPI_ENABLE CONFIG_OPENTHREAD_RCP_SPI -/** - * @def OPENTHREAD_ENABLE_NCP_SPINEL_ENCRYPTER - * - * Define to 1 to enable NCP Spinel Encrypter. - * - */ -#define OPENTHREAD_ENABLE_NCP_SPINEL_ENCRYPTER 0 - /** * @def OPENTHREAD_CONFIG_NCP_HDLC_ENABLE * * Define to 1 to enable NCP HDLC support. * */ +#ifdef OPENTHREAD_CONFIG_NCP_HDLC_ENABLE +#error `OPENTHREAD_CONFIG_NCP_HDLC_ENABLE` is redefined. +#endif #define OPENTHREAD_CONFIG_NCP_HDLC_ENABLE CONFIG_OPENTHREAD_RCP_UART -/** - * @def PACKAGE_NAME - * - * Define to the full name of this package. - * - */ -#define PACKAGE_NAME CONFIG_OPENTHREAD_PACKAGE_NAME - -/** - * @def PACKAGE_STRING - * - * Define to the full name and version of this package. - * - */ -#define PACKAGE_STRING (PACKAGE_NAME " - " PACKAGE_VERSION) - -/** - * @def OPENTHREAD_CONFIG_ENABLE_BUILTIN_MBEDTLS - * - * Define as 1 to enable bultin-mbedtls. - * - * Note that the OPENTHREAD_CONFIG_ENABLE_BUILTIN_MBEDTLS determines whether to use bultin-mbedtls as well as - * whether to manage mbedTLS internally, such as memory allocation and debug. - * - */ -#define OPENTHREAD_CONFIG_ENABLE_BUILTIN_MBEDTLS 0 - -/** - * @def OPENTHREAD_CONFIG_MAX_STATECHANGE_HANDLERS - * - * The maximum number of state-changed callback handlers (set using `otSetStateChangedCallback()`). - * - */ -#define OPENTHREAD_CONFIG_MAX_STATECHANGE_HANDLERS 3 - /** * @def OPENTHREAD_LIB_SPINEL_RX_FRAME_BUFFER_SIZE * @@ -148,51 +100,11 @@ * `RadioSpinel` platform is used. * */ +#ifdef OPENTHREAD_LIB_SPINEL_RX_FRAME_BUFFER_SIZE +#error `OPENTHREAD_LIB_SPINEL_RX_FRAME_BUFFER_SIZE` is redefined. +#endif #define OPENTHREAD_LIB_SPINEL_RX_FRAME_BUFFER_SIZE CONFIG_OPENTHREAD_SPINEL_RX_FRAME_BUFFER_SIZE -/** - * @def OPENTHREAD_CONFIG_PLATFORM_USEC_TIMER_ENABLE - * - * Define as 1 to enable microsecond timer. - * - */ -#define OPENTHREAD_CONFIG_PLATFORM_USEC_TIMER_ENABLE 1 - -/** - * @def OPENTHREAD_CONFIG_MAC_SOFTWARE_CSMA_BACKOFF_ENABLE - * - * Define to 1 to enable software CSMA-CA backoff logic. - * - */ -#define OPENTHREAD_CONFIG_MAC_SOFTWARE_CSMA_BACKOFF_ENABLE 1 - -/** - * @def OPENTHREAD_CONFIG_MAC_SOFTWARE_RETRANSMIT_ENABLE - * - * Define to 1 to enable software retransmission logic. - * - */ -#define OPENTHREAD_CONFIG_MAC_SOFTWARE_RETRANSMIT_ENABLE 1 - -/** - * @def OPENTHREAD_CONFIG_MAC_SOFTWARE_TX_SECURITY_ENABLE - * - * Define to 1 to enable software transmission security logic. - * - */ -#define OPENTHREAD_CONFIG_MAC_SOFTWARE_TX_SECURITY_ENABLE 1 - -/** - * @def OPENTHREAD_CONFIG_MAC_SOFTWARE_TX_TIMING_ENABLE - * - * Define to 1 to enable software transmission target time logic. - * - */ -#define OPENTHREAD_CONFIG_MAC_SOFTWARE_TX_TIMING_ENABLE 1 - -/** - * The configurable definitions via Kconfig - */ #if CONFIG_OPENTHREAD_COMMISSIONER #error "Commissioner shouldn't be enabled for RCP" #endif @@ -201,12 +113,18 @@ #error "Joiner shouldn't be enabled for RCP" #endif +#ifdef OPENTHREAD_CONFIG_DIAG_ENABLE +#error `OPENTHREAD_CONFIG_DIAG_ENABLE` is redefined. +#endif #if CONFIG_OPENTHREAD_DIAG #define OPENTHREAD_CONFIG_DIAG_ENABLE 1 +#else +#define OPENTHREAD_CONFIG_DIAG_ENABLE 0 #endif -#define OPENTHREAD_RADIO 1 - +#ifdef OPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE +#error `OPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE` is redefined. +#endif #if CONFIG_OPENTHREAD_LINK_METRICS /** * @def OPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE @@ -214,11 +132,14 @@ * Define as 1 to support Thread 1.2 Link Metrics Subject feature. * */ -#ifndef OPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE #define OPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE 1 -#endif +#else +#define OPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE 0 #endif //CONFIG_OPENTHREAD_LINK_METRICS +#ifdef OPENTHREAD_ENABLE_NCP_VENDOR_HOOK +#error `OPENTHREAD_ENABLE_NCP_VENDOR_HOOK` is redefined. +#endif #if CONFIG_OPENTHREAD_NCP_VENDOR_HOOK /** * @def OPENTHREAD_ENABLE_NCP_VENDOR_HOOK @@ -226,9 +147,9 @@ * Define as 1 to support ESP OpenThread NCP vendor commands * */ -#ifndef OPENTHREAD_ENABLE_NCP_VENDOR_HOOK #define OPENTHREAD_ENABLE_NCP_VENDOR_HOOK 1 -#endif +#else +#define OPENTHREAD_ENABLE_NCP_VENDOR_HOOK 0 #endif //CONFIG_OPENTHREAD_NCP_VENDOR_HOOK /** @@ -239,9 +160,10 @@ * Equivalent to macMaxCSMABackoffs in IEEE 802.15.4-2006, default value is 4. * */ -#ifndef OPENTHREAD_CONFIG_MAC_MAX_CSMA_BACKOFFS_DIRECT -#define OPENTHREAD_CONFIG_MAC_MAX_CSMA_BACKOFFS_DIRECT CONFIG_OPENTHREAD_MAC_MAX_CSMA_BACKOFFS_DIRECT +#ifdef OPENTHREAD_CONFIG_MAC_MAX_CSMA_BACKOFFS_DIRECT +#error `OPENTHREAD_CONFIG_MAC_MAX_CSMA_BACKOFFS_DIRECT` is redefined. #endif +#define OPENTHREAD_CONFIG_MAC_MAX_CSMA_BACKOFFS_DIRECT CONFIG_OPENTHREAD_MAC_MAX_CSMA_BACKOFFS_DIRECT /** * @def OPENTHREAD_CONFIG_TIME_SYNC_ENABLE @@ -249,6 +171,114 @@ * Define as 1 to enable the time synchronization service feature. * */ +#ifdef OPENTHREAD_CONFIG_TIME_SYNC_ENABLE +#error `OPENTHREAD_CONFIG_TIME_SYNC_ENABLE` is redefined. +#endif #if CONFIG_OPENTHREAD_TIME_SYNC #define OPENTHREAD_CONFIG_TIME_SYNC_ENABLE 1 +#else +#define OPENTHREAD_CONFIG_TIME_SYNC_ENABLE 0 +#endif + +/*----The following options set fixed default values but can be overridden by the user header file.----*/ + +/** + * @def OPENTHREAD_CONFIG_PLATFORM_ASSERT_MANAGEMENT + * + * The assert is managed by platform defined logic when this flag is set. + * + */ +#ifndef OPENTHREAD_CONFIG_PLATFORM_ASSERT_MANAGEMENT +#define OPENTHREAD_CONFIG_PLATFORM_ASSERT_MANAGEMENT 1 +#endif + +/** + * @def OPENTHREAD_CONFIG_LOG_OUTPUT + * + * The ESP-IDF platform provides an otPlatLog() function. + */ +#ifndef OPENTHREAD_CONFIG_LOG_OUTPUT +#define OPENTHREAD_CONFIG_LOG_OUTPUT OPENTHREAD_CONFIG_LOG_OUTPUT_PLATFORM_DEFINED +#endif + +/** + * @def OPENTHREAD_CONFIG_NUM_MESSAGE_BUFFERS + * + * The number of message buffers in buffer pool + */ +#ifndef OPENTHREAD_CONFIG_NUM_MESSAGE_BUFFERS +#define OPENTHREAD_CONFIG_NUM_MESSAGE_BUFFERS 50 +#endif + +/** + * @def OPENTHREAD_CONFIG_ENABLE_BUILTIN_MBEDTLS + * + * Define as 1 to enable bultin-mbedtls. + * + * Note that the OPENTHREAD_CONFIG_ENABLE_BUILTIN_MBEDTLS determines whether to use bultin-mbedtls as well as + * whether to manage mbedTLS internally, such as memory allocation and debug. + * + */ +#ifndef OPENTHREAD_CONFIG_ENABLE_BUILTIN_MBEDTLS +#define OPENTHREAD_CONFIG_ENABLE_BUILTIN_MBEDTLS 0 +#endif + +/** + * @def OPENTHREAD_CONFIG_MAX_STATECHANGE_HANDLERS + * + * The maximum number of state-changed callback handlers (set using `otSetStateChangedCallback()`). + * + */ +#ifndef OPENTHREAD_CONFIG_MAX_STATECHANGE_HANDLERS +#define OPENTHREAD_CONFIG_MAX_STATECHANGE_HANDLERS 3 +#endif + +/** + * @def OPENTHREAD_CONFIG_PLATFORM_USEC_TIMER_ENABLE + * + * Define as 1 to enable microsecond timer. + * + */ +#ifndef OPENTHREAD_CONFIG_PLATFORM_USEC_TIMER_ENABLE +#define OPENTHREAD_CONFIG_PLATFORM_USEC_TIMER_ENABLE 1 +#endif + +/** + * @def OPENTHREAD_CONFIG_MAC_SOFTWARE_CSMA_BACKOFF_ENABLE + * + * Define to 1 to enable software CSMA-CA backoff logic. + * + */ +#ifndef OPENTHREAD_CONFIG_MAC_SOFTWARE_CSMA_BACKOFF_ENABLE +#define OPENTHREAD_CONFIG_MAC_SOFTWARE_CSMA_BACKOFF_ENABLE 1 +#endif + +/** + * @def OPENTHREAD_CONFIG_MAC_SOFTWARE_RETRANSMIT_ENABLE + * + * Define to 1 to enable software retransmission logic. + * + */ +#ifndef OPENTHREAD_CONFIG_MAC_SOFTWARE_RETRANSMIT_ENABLE +#define OPENTHREAD_CONFIG_MAC_SOFTWARE_RETRANSMIT_ENABLE 1 +#endif + +/** + * @def OPENTHREAD_CONFIG_MAC_SOFTWARE_TX_SECURITY_ENABLE + * + * Define to 1 to enable software transmission security logic. + * + */ +#ifndef OPENTHREAD_CONFIG_MAC_SOFTWARE_TX_SECURITY_ENABLE +#define OPENTHREAD_CONFIG_MAC_SOFTWARE_TX_SECURITY_ENABLE 1 +#endif + +/** + * @def OPENTHREAD_CONFIG_MAC_SOFTWARE_TX_TIMING_ENABLE + * + * Define to 1 to enable software transmission target time logic. + * + */ +#ifndef OPENTHREAD_CONFIG_MAC_SOFTWARE_TX_TIMING_ENABLE +#define OPENTHREAD_CONFIG_MAC_SOFTWARE_TX_TIMING_ENABLE 1 #endif diff --git a/components/openthread/private_include/openthread-core-esp32x-spinel-config.h b/components/openthread/private_include/openthread-core-esp32x-spinel-config.h index 0b257baeba..a2562f3faf 100644 --- a/components/openthread/private_include/openthread-core-esp32x-spinel-config.h +++ b/components/openthread/private_include/openthread-core-esp32x-spinel-config.h @@ -7,32 +7,38 @@ #pragma once #include "sdkconfig.h" -/** - * @def OPENTHREAD_CONFIG_PLATFORM_INFO - * - * The platform-specific string to insert into the OpenThread version string. - * - */ -#define OPENTHREAD_CONFIG_PLATFORM_INFO CONFIG_OPENTHREAD_PLATFORM_INFO -/** - * @def PACKAGE_NAME - * - * Define to the full name of this package. - * - */ -#define PACKAGE_NAME CONFIG_OPENTHREAD_PACKAGE_NAME - -/** - * @def OPENTHREAD_SPINEL_CONFIG_OPENTHREAD_MESSAGE_ENABLE - * - * Define 1 to enable feeding an OpenThread message to encoder/decoder. - * - */ -#ifndef OPENTHREAD_SPINEL_CONFIG_OPENTHREAD_MESSAGE_ENABLE -#define OPENTHREAD_SPINEL_CONFIG_OPENTHREAD_MESSAGE_ENABLE 0 +#if CONFIG_OPENTHREAD_HEADER_CUSTOM +#include CONFIG_OPENTHREAD_CUSTOM_HEADER_FILE_NAME #endif +/** + * @def OPENTHREAD_LIB_SPINEL_RX_FRAME_BUFFER_SIZE + * + * Specifies the rx frame buffer size used by `SpinelInterface` in RCP host code. This is applicable/used when + * `RadioSpinel` platform is used. + * + */ +#ifdef OPENTHREAD_LIB_SPINEL_RX_FRAME_BUFFER_SIZE +#error `OPENTHREAD_LIB_SPINEL_RX_FRAME_BUFFER_SIZE` is redefined. +#endif +#define OPENTHREAD_LIB_SPINEL_RX_FRAME_BUFFER_SIZE CONFIG_OPENTHREAD_SPINEL_RX_FRAME_BUFFER_SIZE + +/** + * @def OPENTHREAD_CONFIG_MAC_MAX_CSMA_BACKOFFS_DIRECT + * + * The maximum number of backoffs the CSMA-CA algorithm will attempt before declaring a channel access failure. + * + * Equivalent to macMaxCSMABackoffs in IEEE 802.15.4-2006, default value is 4. + * + */ +#ifdef OPENTHREAD_CONFIG_MAC_MAX_CSMA_BACKOFFS_DIRECT +#error `OPENTHREAD_CONFIG_MAC_MAX_CSMA_BACKOFFS_DIRECT` is redefined. +#endif +#define OPENTHREAD_CONFIG_MAC_MAX_CSMA_BACKOFFS_DIRECT CONFIG_OPENTHREAD_SPINEL_MAC_MAX_CSMA_BACKOFFS_DIRECT + +/*----The following options set fixed default values but can be overridden by the user header file.----*/ + /** * @def OPENTHREAD_SPINEL_CONFIG_RCP_RESTORATION_MAX_COUNT * @@ -44,37 +50,8 @@ #define OPENTHREAD_SPINEL_CONFIG_RCP_RESTORATION_MAX_COUNT 3 #endif +#ifndef OPENTHREAD_SPINEL_CONFIG_VENDOR_HOOK_ENABLE #define OPENTHREAD_SPINEL_CONFIG_VENDOR_HOOK_ENABLE 1 - -/** - * @def OPENTHREAD_SPINEL_CONFIG_RCP_CUSTOM_RESTORATION - * - * Define 1 to call the custom RCP failure handler on RCP failure. - * - */ -#ifndef OPENTHREAD_SPINEL_CONFIG_RCP_CUSTOM_RESTORATION -#define OPENTHREAD_SPINEL_CONFIG_RCP_CUSTOM_RESTORATION 0 -#endif - -/** - * @def OPENTHREAD_LIB_SPINEL_RX_FRAME_BUFFER_SIZE - * - * Specifies the rx frame buffer size used by `SpinelInterface` in RCP host code. This is applicable/used when - * `RadioSpinel` platform is used. - * - */ -#define OPENTHREAD_LIB_SPINEL_RX_FRAME_BUFFER_SIZE CONFIG_OPENTHREAD_SPINEL_RX_FRAME_BUFFER_SIZE - -/** - * @def OPENTHREAD_CONFIG_MAC_MAX_CSMA_BACKOFFS_DIRECT - * - * The maximum number of backoffs the CSMA-CA algorithm will attempt before declaring a channel access failure. - * - * Equivalent to macMaxCSMABackoffs in IEEE 802.15.4-2006, default value is 4. - * - */ -#ifndef OPENTHREAD_CONFIG_MAC_MAX_CSMA_BACKOFFS_DIRECT -#define OPENTHREAD_CONFIG_MAC_MAX_CSMA_BACKOFFS_DIRECT CONFIG_OPENTHREAD_MAC_MAX_CSMA_BACKOFFS_DIRECT #endif @@ -86,13 +63,3 @@ #ifndef OPENTHREAD_SPINEL_CONFIG_COMPATIBILITY_ERROR_CALLBACK_ENABLE #define OPENTHREAD_SPINEL_CONFIG_COMPATIBILITY_ERROR_CALLBACK_ENABLE 1 #endif - -/** - * @def OPENTHREAD_SPINEL_CONFIG_MAX_SRC_MATCH_ENTRIES - * - * Defines size of the local source match table used by RadioSpinel - * when OPENTHREAD_SPINEL_CONFIG_RCP_RESTORATION_MAX_COUNT is used. - */ -#ifndef OPENTHREAD_SPINEL_CONFIG_MAX_SRC_MATCH_ENTRIES -#define OPENTHREAD_SPINEL_CONFIG_MAX_SRC_MATCH_ENTRIES 12 -#endif diff --git a/components/openthread/src/spinel/esp_radio_spinel.cpp b/components/openthread/src/spinel/esp_radio_spinel.cpp index 4674e77312..aba599e355 100644 --- a/components/openthread/src/spinel/esp_radio_spinel.cpp +++ b/components/openthread/src/spinel/esp_radio_spinel.cpp @@ -315,7 +315,7 @@ esp_err_t esp_radio_spinel_transmit(uint8_t *frame, uint8_t channel, bool cca, e s_transmit_frame.mLength = frame[0]; s_transmit_frame.mPsdu = frame + 1; s_transmit_frame.mInfo.mTxInfo.mCsmaCaEnabled = cca; - s_transmit_frame.mInfo.mTxInfo.mMaxCsmaBackoffs = CONFIG_OPENTHREAD_MAC_MAX_CSMA_BACKOFFS_DIRECT; + s_transmit_frame.mInfo.mTxInfo.mMaxCsmaBackoffs = CONFIG_OPENTHREAD_SPINEL_MAC_MAX_CSMA_BACKOFFS_DIRECT; s_transmit_frame.mChannel = channel; s_transmit_frame.mInfo.mTxInfo.mRxChannelAfterTxDone = channel; return (s_radio[idx].Transmit(s_transmit_frame) == OT_ERROR_NONE) ? ESP_OK : ESP_FAIL; diff --git a/docs/en/api-guides/openthread.rst b/docs/en/api-guides/openthread.rst index 7e154fc754..fef40dc6ce 100644 --- a/docs/en/api-guides/openthread.rst +++ b/docs/en/api-guides/openthread.rst @@ -102,6 +102,22 @@ The following steps are required to deinitialize the OpenThread stack: - Call :cpp:func:`esp_netif_destroy` and :cpp:func:`esp_openthread_netif_glue_deinit` to deinitialize the OpenThread network interface if you have created one. - Call :cpp:func:`esp_openthread_deinit` to deinitialize the OpenThread stack. + +OpenThread Macro Definitions +---------------------------- + +In the OpenThread protocol stack, defining macros to enable features and configure parameters is a common practice. Users can define macro values to enable or disable specific features and adjust parameters. ESP provides the following methods for defining OpenThread macros: + +- Using configuration menu (``menuconfig``): Some macros are mapped to Kconfig files and can be configured through ``idf.py menuconfig → Component config → OpenThread``. This allows enabling or disabling features and setting related parameters. +- Using user-defined header files: Users can create a custom header file and enable it via ``idf.py menuconfig → Component config → OpenThread → Thread Extended Features → Use a header file defined by customer``. The priority of the custom header file is second only to the ``menuconfig``. +- Using ``openthread-core-esp32x-xxx-config.h`` for configuration: Some macros have default values set in the OpenThread private header files. These cannot currently be modified through the ``menuconfig``, but can be modified via user-defined header files. +- Using OpenThread stack default configurations: Other macros are assigned default values when defined in the OpenThread stack. + +.. note:: + + The priority of the above configuration methods, from highest to lowest, is as follows: + Configuration Menu → User-defined Header File → openthread-core-esp32x-xxx-config.h → OpenThread Stack Default Configuration + The OpenThread Border Router ---------------------------- diff --git a/docs/en/api-reference/network/esp_openthread.rst b/docs/en/api-reference/network/esp_openthread.rst index e976c3e974..7947fb4cbc 100644 --- a/docs/en/api-reference/network/esp_openthread.rst +++ b/docs/en/api-reference/network/esp_openthread.rst @@ -18,6 +18,12 @@ The :example:`openthread` directory of ESP-IDF examples contains the following a - The Thread Radio Co-Processor :example:`openthread/ot_rcp` +- :example:`openthread/ot_trel` demonstrates Thread Radio Encapsulation Link (TREL) function. This requires a board equipped with a Wi-Fi module. + +- :example:`openthread/ot_sleepy_device/deep_sleep` demonstrates Thread Deep-sleep function. + +- :example:`openthread/ot_sleepy_device/light_sleep` demonstrates Thread Light-sleep function. + API Reference ------------- diff --git a/docs/zh_CN/api-guides/openthread.rst b/docs/zh_CN/api-guides/openthread.rst index bce0aa8d3d..29bf559453 100644 --- a/docs/zh_CN/api-guides/openthread.rst +++ b/docs/zh_CN/api-guides/openthread.rst @@ -102,6 +102,21 @@ OpenThread API 非线程安全。当从其他任务中调用 OpenThread API 时 - 如果创建了 OpenThread 网络接口,请调用 :cpp:func:`esp_netif_destroy` 和 :cpp:func:`esp_openthread_netif_glue_deinit` 卸载 OpenThread 协议栈。 - 调用 :cpp:func:`esp_openthread_deinit` 卸载 OpenThread 协议栈。 + +OpenThread 宏定义 +----------------- + +在 OpenThread 协议栈中,定义宏来进行功能启用以及参数配置是常见行为。在实际使用中,用户可以通过定义宏的值来启用/禁用相关功能和修改参数。乐鑫提供以下方式来进行 OpenThread 宏定义: + +- 使用配置菜单配置 (``menuconfig``):部分宏已经映射到 Kconfig 文件,可通过 ``idf.py menuconfig → Component config → OpenThread`` 启用/关闭相应功能,并配置相关参数。 +- 使用用户自定义头文件配置:用户可编写头文件,并启用 ``idf.py menuconfig → Component config → OpenThread → Thread Extensioned Features → Use a header file defined by customer`` 来应用自定义头文件。自定义头文件的优先级将仅次于配置菜单。 +- 使用 ``openthread-core-esp32x-xxx-config.h`` 的配置:部分宏在 OpenThread private 头文件中已经设置默认值,暂不支持通过 menuconfig 修改,但可以通过用户自定义头文件修改。 +- 使用 OpenThread 协议栈默认配置:对于其他宏,OpenThread 协议栈在定义时已设置默认值。 + +.. 注意:: + + 以上四种配置方式,优先级由高到低为:配置菜单 → 用户自定义头文件 → openthread-core-esp32x-xxx-config.h → OpenThread 协议栈默认配置 + OpenThread 边界路由器 --------------------- diff --git a/docs/zh_CN/api-reference/network/esp_openthread.rst b/docs/zh_CN/api-reference/network/esp_openthread.rst index fdbfb5b5ec..b67b2b3d35 100644 --- a/docs/zh_CN/api-reference/network/esp_openthread.rst +++ b/docs/zh_CN/api-reference/network/esp_openthread.rst @@ -18,6 +18,12 @@ ESP-IDF 示例目录 :example:`openthread` 包含以下应用程序: - Thread 无线电协处理器 (Thread Radio Co-Processor)::example:`openthread/ot_rcp` +- :example:`openthread/ot_trel` 演示了 Thread Radio Encapsulation Link (TREL) 功能。该示例需要在配备 Wi-Fi 模块的开发板上运行。 + +- :example:`openthread/ot_sleepy_device/deep_sleep` 演示了 Thread 深度睡眠功能。 + +- :example:`openthread/ot_sleepy_device/light_sleep` 演示了 Thread 浅睡眠功能。 + API参考 ------------- From c0c8335994f3f70ae8854b06e2e37ee1716ce5ac Mon Sep 17 00:00:00 2001 From: Xu Si Yu Date: Fri, 22 Nov 2024 13:59:01 +0800 Subject: [PATCH 2/2] feat(openthread): adjusted the default macro configurations of openthread --- .../openthread-core-esp32x-ftd-config.h | 334 ++++++++---------- .../openthread-core-esp32x-mtd-config.h | 20 +- .../openthread-core-esp32x-radio-config.h | 27 +- 3 files changed, 180 insertions(+), 201 deletions(-) diff --git a/components/openthread/private_include/openthread-core-esp32x-ftd-config.h b/components/openthread/private_include/openthread-core-esp32x-ftd-config.h index 56e7d0c0cb..8f0ffdc996 100644 --- a/components/openthread/private_include/openthread-core-esp32x-ftd-config.h +++ b/components/openthread/private_include/openthread-core-esp32x-ftd-config.h @@ -84,109 +84,6 @@ #endif #define OPENTHREAD_CONFIG_NUM_MESSAGE_BUFFERS CONFIG_OPENTHREAD_NUM_MESSAGE_BUFFERS - -#if CONFIG_OPENTHREAD_BORDER_ROUTER - -/** - * @def OPENTHREAD_CONFIG_BORDER_AGENT_ENABLE - * - * Define to 1 to enable Border Agent support. - * - */ -#ifdef OPENTHREAD_CONFIG_BORDER_AGENT_ENABLE -#error `OPENTHREAD_CONFIG_BORDER_AGENT_ENABLE` is redefined. -#endif -#define OPENTHREAD_CONFIG_BORDER_AGENT_ENABLE 1 - -/** - * @def OPENTHREAD_CONFIG_BORDER_AGENT_ID_ENABLE - * - * Define to 1 to enable Border Agent ID support. - * - */ -#ifdef OPENTHREAD_CONFIG_BORDER_AGENT_ID_ENABLE -#error `OPENTHREAD_CONFIG_BORDER_AGENT_ID_ENABLE` is redefined. -#endif -#define OPENTHREAD_CONFIG_BORDER_AGENT_ID_ENABLE 1 - -/** - * @def OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE - * - * Define to 1 to enable Border Routing support. - * - */ -#ifdef OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE -#error `OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE` is redefined. -#endif -#define OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE 1 - -/** - * @def OPENTHREAD_CONFIG_PLATFORM_UDP_ENABLE - * - * Define to 1 to enable platform UDP support. - * - */ -#ifdef OPENTHREAD_CONFIG_PLATFORM_UDP_ENABLE -#error `OPENTHREAD_CONFIG_PLATFORM_UDP_ENABLE` is redefined. -#endif -#define OPENTHREAD_CONFIG_PLATFORM_UDP_ENABLE 1 - -/** - * @def OPENTHREAD_CONFIG_NAT64_BORDER_ROUTING_ENABLE - * - * Define to 1 to enable Border Routing NAT64 support. - * - */ -#ifdef OPENTHREAD_CONFIG_NAT64_BORDER_ROUTING_ENABLE -#error `OPENTHREAD_CONFIG_NAT64_BORDER_ROUTING_ENABLE` is redefined. -#endif -#define OPENTHREAD_CONFIG_NAT64_BORDER_ROUTING_ENABLE 1 - -/** - * @def OPENTHREAD_CONFIG_SRP_SERVER_ENABLE - * - * Define to 1 to enable SRP Server support. - * - */ -#ifdef OPENTHREAD_CONFIG_SRP_SERVER_ENABLE -#error `OPENTHREAD_CONFIG_SRP_SERVER_ENABLE` is redefined. -#endif -#define OPENTHREAD_CONFIG_SRP_SERVER_ENABLE 1 - -/** - * @def OPENTHREAD_CONFIG_DNSSD_SERVER_ENABLE - * - * Define to 1 to enable DNS-SD Server support. - * - */ -#ifdef OPENTHREAD_CONFIG_DNSSD_SERVER_ENABLE -#error `OPENTHREAD_CONFIG_DNSSD_SERVER_ENABLE` is redefined. -#endif -#define OPENTHREAD_CONFIG_DNSSD_SERVER_ENABLE 1 - -/** - * @def OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE - * - * Define to 1 to enable Backbone Router support. - * - */ -#ifdef OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE -#error `OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE` is redefined. -#endif -#define OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE 1 - -/** - * @def OPENTHREAD_SPINEL_CONFIG_COMPATIBILITY_ERROR_CALLBACK_ENABLE - * - * Enables compatibility error callback in Spinel - */ -#ifdef OPENTHREAD_SPINEL_CONFIG_COMPATIBILITY_ERROR_CALLBACK_ENABLE -#error `OPENTHREAD_SPINEL_CONFIG_COMPATIBILITY_ERROR_CALLBACK_ENABLE` is redefined. -#endif -#define OPENTHREAD_SPINEL_CONFIG_COMPATIBILITY_ERROR_CALLBACK_ENABLE 1 - -#endif // CONFIG_OPENTHREAD_BORDER_ROUTER - /** * @def OPENTHREAD_CONFIG_RADIO_LINK_TREL_ENABLE * @@ -198,6 +95,8 @@ #endif #if CONFIG_OPENTHREAD_RADIO_TREL #define OPENTHREAD_CONFIG_RADIO_LINK_TREL_ENABLE 1 +#else +#define OPENTHREAD_CONFIG_RADIO_LINK_TREL_ENABLE 0 #endif // CONFIG_OPENTHREAD_RADIO_TREL /** @@ -215,34 +114,6 @@ #define OPENTHREAD_CONFIG_RADIO_LINK_IEEE_802_15_4_ENABLE 1 #endif -#if !CONFIG_OPENTHREAD_RADIO_NATIVE -/** - * @def OPENTHREAD_SPINEL_CONFIG_RCP_RESTORATION_MAX_COUNT - * - * Defines the max count of RCP failures allowed to be recovered. - * 0 means to disable RCP failure recovering. - * - */ -#ifdef OPENTHREAD_SPINEL_CONFIG_RCP_RESTORATION_MAX_COUNT -#error `OPENTHREAD_SPINEL_CONFIG_RCP_RESTORATION_MAX_COUNT` is redefined. -#endif -#define OPENTHREAD_SPINEL_CONFIG_RCP_RESTORATION_MAX_COUNT 3 - -/** - * @def OPENTHREAD_POSIX_CONFIG_RCP_TIME_SYNC_INTERVAL - * - * This setting configures the interval (in units of microseconds) for host-rcp - * time sync. The host will recalculate the time offset between host and RCP - * every interval. - * - */ -#ifdef OPENTHREAD_POSIX_CONFIG_RCP_TIME_SYNC_INTERVAL -#error `OPENTHREAD_POSIX_CONFIG_RCP_TIME_SYNC_INTERVAL` is redefined. -#endif -#define OPENTHREAD_POSIX_CONFIG_RCP_TIME_SYNC_INTERVAL (60 * 1000 * 1000) - -#endif // !CONFIG_OPENTHREAD_RADIO_NATIVE - /** * @def OPENTHREAD_LIB_SPINEL_RX_FRAME_BUFFER_SIZE * @@ -397,34 +268,6 @@ #define OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE 0 #endif // CONFIG_OPENTHREAD_CSL_ENABLE -#ifdef OPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE -#error `OPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE` is redefined. -#endif -#ifdef OPENTHREAD_CONFIG_MLE_LINK_METRICS_INITIATOR_ENABLE -#error `OPENTHREAD_CONFIG_MLE_LINK_METRICS_INITIATOR_ENABLE` is redefined. -#endif -#if CONFIG_OPENTHREAD_LINK_METRICS -/** - * @def OPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE - * - * Define as 1 to support Thread 1.2 Link Metrics Subject feature. - * - */ -#define OPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE 1 - -/** - * @def OPENTHREAD_CONFIG_MLE_LINK_METRICS_INITIATOR_ENABLE - * - * Define as 1 to support Thread 1.2 Link Metrics feature. - * - */ -#define OPENTHREAD_CONFIG_MLE_LINK_METRICS_INITIATOR_ENABLE 1 - -#else -#define OPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE 0 -#define OPENTHREAD_CONFIG_MLE_LINK_METRICS_INITIATOR_ENABLE 0 -#endif //CONFIG_OPENTHREAD_LINK_METRICS - /** * * Define as 1 to enable support for allocating message pool buffer in PSRAM @@ -524,32 +367,80 @@ #endif #define OPENTHREAD_CONFIG_MAC_MAX_CSMA_BACKOFFS_DIRECT CONFIG_OPENTHREAD_MAC_MAX_CSMA_BACKOFFS_DIRECT -/** - * @def OPENTHREAD_CONFIG_ECDSA_ENABLE - * - * Define to 1 to enable ECDSA support. - * - */ -#ifdef OPENTHREAD_CONFIG_ECDSA_ENABLE -#error `OPENTHREAD_CONFIG_ECDSA_ENABLE` is redefined. -#endif -#if CONFIG_OPENTHREAD_BORDER_ROUTER || CONFIG_OPENTHREAD_SRP_CLIENT -#define OPENTHREAD_CONFIG_ECDSA_ENABLE 1 -#else -#define OPENTHREAD_CONFIG_ECDSA_ENABLE 0 -#endif - /*----The following options set fixed default values but can be overridden by the user header file.----*/ +#if CONFIG_OPENTHREAD_BORDER_ROUTER /** - * @def OPENTHREAD_CONFIG_DUA_ENABLE + * @def OPENTHREAD_CONFIG_BORDER_AGENT_ID_ENABLE + * + * Define to 1 to enable Border Agent ID support. * - * Define as 1 to support Thread 1.2 Domain Unicast Address feature. */ -#ifndef OPENTHREAD_CONFIG_DUA_ENABLE -#define OPENTHREAD_CONFIG_DUA_ENABLE 1 +#ifndef OPENTHREAD_CONFIG_BORDER_AGENT_ID_ENABLE +#define OPENTHREAD_CONFIG_BORDER_AGENT_ID_ENABLE 1 #endif +/** + * @def OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE + * + * Define to 1 to enable Border Routing support. + * + */ +#ifndef OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE +#define OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE 1 +#endif + +/** + * @def OPENTHREAD_CONFIG_PLATFORM_UDP_ENABLE + * + * Define to 1 to enable platform UDP support. + * + */ +#ifndef OPENTHREAD_CONFIG_PLATFORM_UDP_ENABLE +#define OPENTHREAD_CONFIG_PLATFORM_UDP_ENABLE 1 +#endif + +/** + * @def OPENTHREAD_CONFIG_NAT64_BORDER_ROUTING_ENABLE + * + * Define to 1 to enable Border Routing NAT64 support. + * + */ +#ifndef OPENTHREAD_CONFIG_NAT64_BORDER_ROUTING_ENABLE +#define OPENTHREAD_CONFIG_NAT64_BORDER_ROUTING_ENABLE 1 +#endif + +/** + * @def OPENTHREAD_CONFIG_SRP_SERVER_ENABLE + * + * Define to 1 to enable SRP Server support. + * + */ +#ifndef OPENTHREAD_CONFIG_SRP_SERVER_ENABLE +#define OPENTHREAD_CONFIG_SRP_SERVER_ENABLE 1 +#endif + +/** + * @def OPENTHREAD_CONFIG_DNSSD_SERVER_ENABLE + * + * Define to 1 to enable DNS-SD Server support. + * + */ +#ifndef OPENTHREAD_CONFIG_DNSSD_SERVER_ENABLE +#define OPENTHREAD_CONFIG_DNSSD_SERVER_ENABLE 1 +#endif + +/** + * @def OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE + * + * Define to 1 to enable Backbone Router support. + * + */ +#ifndef OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE +#define OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE 1 +#endif +#endif // CONFIG_OPENTHREAD_BORDER_ROUTER + /** * @def OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE * @@ -570,6 +461,83 @@ #define OPENTHREAD_CONFIG_BORDER_AGENT_ENABLE 1 #endif +#if !CONFIG_OPENTHREAD_RADIO_NATIVE +/** + * @def OPENTHREAD_SPINEL_CONFIG_COMPATIBILITY_ERROR_CALLBACK_ENABLE + * + * Enables compatibility error callback in Spinel + */ +#ifndef OPENTHREAD_SPINEL_CONFIG_COMPATIBILITY_ERROR_CALLBACK_ENABLE +#define OPENTHREAD_SPINEL_CONFIG_COMPATIBILITY_ERROR_CALLBACK_ENABLE 1 +#endif + +/** + * @def OPENTHREAD_SPINEL_CONFIG_RCP_RESTORATION_MAX_COUNT + * + * Defines the max count of RCP failures allowed to be recovered. + * 0 means to disable RCP failure recovering. + * + */ +#ifndef OPENTHREAD_SPINEL_CONFIG_RCP_RESTORATION_MAX_COUNT +#define OPENTHREAD_SPINEL_CONFIG_RCP_RESTORATION_MAX_COUNT 3 +#endif + +/** + * @def OPENTHREAD_POSIX_CONFIG_RCP_TIME_SYNC_INTERVAL + * + * This setting configures the interval (in units of microseconds) for host-rcp + * time sync. The host will recalculate the time offset between host and RCP + * every interval. + * + */ +#ifndef OPENTHREAD_POSIX_CONFIG_RCP_TIME_SYNC_INTERVAL +#define OPENTHREAD_POSIX_CONFIG_RCP_TIME_SYNC_INTERVAL (60 * 1000 * 1000) +#endif +#endif // !CONFIG_OPENTHREAD_RADIO_NATIVE + +#if CONFIG_OPENTHREAD_LINK_METRICS +/** + * @def OPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE + * + * Define as 1 to support Thread 1.2 Link Metrics Subject feature. + * + */ +#ifndef OPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE +#define OPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE 1 +#endif + +/** + * @def OPENTHREAD_CONFIG_MLE_LINK_METRICS_INITIATOR_ENABLE + * + * Define as 1 to support Thread 1.2 Link Metrics feature. + * + */ +#ifndef OPENTHREAD_CONFIG_MLE_LINK_METRICS_INITIATOR_ENABLE +#define OPENTHREAD_CONFIG_MLE_LINK_METRICS_INITIATOR_ENABLE 1 +#endif +#endif //CONFIG_OPENTHREAD_LINK_METRICS + +/** + * @def OPENTHREAD_CONFIG_ECDSA_ENABLE + * + * Define to 1 to enable ECDSA support. + * + */ +#if CONFIG_OPENTHREAD_BORDER_ROUTER || CONFIG_OPENTHREAD_SRP_CLIENT +#ifndef OPENTHREAD_CONFIG_ECDSA_ENABLE +#define OPENTHREAD_CONFIG_ECDSA_ENABLE 1 +#endif +#endif + +/** + * @def OPENTHREAD_CONFIG_DUA_ENABLE + * + * Define as 1 to support Thread 1.2 Domain Unicast Address feature. + */ +#ifndef OPENTHREAD_CONFIG_DUA_ENABLE +#define OPENTHREAD_CONFIG_DUA_ENABLE 1 +#endif + /** * @def OPENTHREAD_CONFIG_LOG_OUTPUT * @@ -774,6 +742,16 @@ #define OPENTHREAD_CONFIG_OPERATIONAL_DATASET_AUTO_INIT 1 #endif +/** + * @OPENTHREAD_CONFIG_DELAY_AWARE_QUEUE_MANAGEMENT_MARK_ECN_INTERVAL + * + * Specifies the time-in-queue threshold interval in milliseconds to mark ECN on a message if it is ECN-capable or + * drop the message if not ECN-capable. + */ +#ifndef OPENTHREAD_CONFIG_DELAY_AWARE_QUEUE_MANAGEMENT_MARK_ECN_INTERVAL +#define OPENTHREAD_CONFIG_DELAY_AWARE_QUEUE_MANAGEMENT_MARK_ECN_INTERVAL 1000 +#endif + #ifndef OPENTHREAD_CONFIG_THREAD_VERSION #define OPENTHREAD_CONFIG_THREAD_VERSION OT_THREAD_VERSION_1_4 #endif diff --git a/components/openthread/private_include/openthread-core-esp32x-mtd-config.h b/components/openthread/private_include/openthread-core-esp32x-mtd-config.h index aa937b6868..2bad19b27e 100644 --- a/components/openthread/private_include/openthread-core-esp32x-mtd-config.h +++ b/components/openthread/private_include/openthread-core-esp32x-mtd-config.h @@ -137,10 +137,9 @@ #endif #if CONFIG_OPENTHREAD_SRP_CLIENT -#ifdef OPENTHREAD_CONFIG_ECDSA_ENABLE -#error `OPENTHREAD_CONFIG_ECDSA_ENABLE` is redefined. -#endif +#ifndef OPENTHREAD_CONFIG_ECDSA_ENABLE #define OPENTHREAD_CONFIG_ECDSA_ENABLE 1 +#endif #define OPENTHREAD_CONFIG_SRP_CLIENT_ENABLE 1 @@ -156,11 +155,6 @@ #error `OPENTHREAD_CONFIG_SRP_CLIENT_BUFFERS_MAX_SERVICES` is redefined. #endif #define OPENTHREAD_CONFIG_SRP_CLIENT_BUFFERS_MAX_SERVICES CONFIG_OPENTHREAD_SRP_CLIENT_MAX_SERVICES - -#else - -#define OPENTHREAD_CONFIG_SRP_CLIENT_ENABLE 0 - #endif // CONFIG_OPENTHREAD_SRP_CLIENT /** @@ -396,3 +390,13 @@ #ifndef OPENTHREAD_CONFIG_DTLS_MAX_CONTENT_LEN #define OPENTHREAD_CONFIG_DTLS_MAX_CONTENT_LEN 768 #endif + +/** + * @OPENTHREAD_CONFIG_DELAY_AWARE_QUEUE_MANAGEMENT_MARK_ECN_INTERVAL + * + * Specifies the time-in-queue threshold interval in milliseconds to mark ECN on a message if it is ECN-capable or + * drop the message if not ECN-capable. + */ +#ifndef OPENTHREAD_CONFIG_DELAY_AWARE_QUEUE_MANAGEMENT_MARK_ECN_INTERVAL +#define OPENTHREAD_CONFIG_DELAY_AWARE_QUEUE_MANAGEMENT_MARK_ECN_INTERVAL 1000 +#endif diff --git a/components/openthread/private_include/openthread-core-esp32x-radio-config.h b/components/openthread/private_include/openthread-core-esp32x-radio-config.h index f98c28ed92..009635bac7 100644 --- a/components/openthread/private_include/openthread-core-esp32x-radio-config.h +++ b/components/openthread/private_include/openthread-core-esp32x-radio-config.h @@ -122,21 +122,6 @@ #define OPENTHREAD_CONFIG_DIAG_ENABLE 0 #endif -#ifdef OPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE -#error `OPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE` is redefined. -#endif -#if CONFIG_OPENTHREAD_LINK_METRICS -/** - * @def OPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE - * - * Define as 1 to support Thread 1.2 Link Metrics Subject feature. - * - */ -#define OPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE 1 -#else -#define OPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE 0 -#endif //CONFIG_OPENTHREAD_LINK_METRICS - #ifdef OPENTHREAD_ENABLE_NCP_VENDOR_HOOK #error `OPENTHREAD_ENABLE_NCP_VENDOR_HOOK` is redefined. #endif @@ -182,6 +167,18 @@ /*----The following options set fixed default values but can be overridden by the user header file.----*/ +#if CONFIG_OPENTHREAD_LINK_METRICS +/** + * @def OPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE + * + * Define as 1 to support Thread 1.2 Link Metrics Subject feature. + * + */ +#ifndef OPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE +#define OPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE 1 +#endif +#endif //CONFIG_OPENTHREAD_LINK_METRICS + /** * @def OPENTHREAD_CONFIG_PLATFORM_ASSERT_MANAGEMENT *