From cb8a8d3e036dd3f3182bc3f1cbe669990468e30b Mon Sep 17 00:00:00 2001 From: zhangwenxu Date: Mon, 4 Sep 2023 16:42:10 +0800 Subject: [PATCH] feat(openthread): Add some configuration for customer using --- components/openthread/Kconfig | 52 +++++++++++++++++++ .../openthread-core-esp32x-ftd-config.h | 36 ++++++++++++- .../openthread-core-esp32x-mtd-config.h | 13 ++++- .../src/port/esp_openthread_radio.c | 10 ++-- 4 files changed, 105 insertions(+), 6 deletions(-) diff --git a/components/openthread/Kconfig b/components/openthread/Kconfig index 1742ccd239..48dfdf7baf 100644 --- a/components/openthread/Kconfig +++ b/components/openthread/Kconfig @@ -177,6 +177,12 @@ menu "OpenThread" 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_COMM_MAX_JOINER_ENTRIES + int "The size of max commissioning joiner entries" + depends on OPENTHREAD_COMMISSIONER + default 2 + range 2 50 + config OPENTHREAD_JOINER bool "Enable Joiner" depends on OPENTHREAD_ENABLED @@ -193,6 +199,14 @@ menu "OpenThread" 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 + range 2 20 + 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 @@ -221,6 +235,24 @@ menu "OpenThread" range 10 100 if !OPENTHREAD_PLATFORM_MSGPOOL_MANAGEMENT range 10 8191 if OPENTHREAD_PLATFORM_MSGPOOL_MANAGEMENT + config OPENTHREAD_SPINEL_RX_FRAME_BUFFER_SIZE + int "The size of openthread spinel rx frame buffer" + depends on OPENTHREAD_ENABLED + default 1024 + range 512 8192 + + config OPENTHREAD_MLE_MAX_CHILDREN + int "The size of max MLE children entries" + depends on OPENTHREAD_ENABLED + default 10 + range 5 50 + + config OPENTHREAD_TMF_ADDR_CACHE_ENTRIES + int "The size of max TMF address cache entries" + depends on OPENTHREAD_ENABLED + default 20 + range 5 50 + config OPENTHREAD_DNS64_CLIENT bool "Use dns64 client" depends on OPENTHREAD_ENABLED && LWIP_IPV4 @@ -264,6 +296,26 @@ menu "OpenThread" help Select this option to enable CSL feature + config OPENTHREAD_XTAL_ACCURACY + int "The accuracy of the XTAL" + default 130 + help + The device's XTAL accuracy, in ppm. + + 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 + + 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_CSL_DEBUG_ENABLE bool "Enable CSL debug" depends on OPENTHREAD_CSL_ENABLE 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 166edab9aa..564271bf77 100644 --- a/components/openthread/private_include/openthread-core-esp32x-ftd-config.h +++ b/components/openthread/private_include/openthread-core-esp32x-ftd-config.h @@ -361,7 +361,7 @@ * `RadioSpinel` platform is used. * */ -#define OPENTHREAD_CONFIG_PLATFORM_RADIO_SPINEL_RX_FRAME_BUFFER_SIZE 1024 +#define OPENTHREAD_CONFIG_PLATFORM_RADIO_SPINEL_RX_FRAME_BUFFER_SIZE CONFIG_OPENTHREAD_SPINEL_RX_FRAME_BUFFER_SIZE /** * @def OPENTHREAD_CONFIG_PLATFORM_USEC_TIMER_ENABLE @@ -381,6 +381,22 @@ */ #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 @@ -418,6 +434,14 @@ */ #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 @@ -440,6 +464,16 @@ #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 /** 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 f84a6f80eb..e74f6e0ba5 100644 --- a/components/openthread/private_include/openthread-core-esp32x-mtd-config.h +++ b/components/openthread/private_include/openthread-core-esp32x-mtd-config.h @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2021-2023 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -232,6 +232,17 @@ #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_CONFIG_SRP_CLIENT_BUFFERS_MAX_SERVICES + #endif /** diff --git a/components/openthread/src/port/esp_openthread_radio.c b/components/openthread/src/port/esp_openthread_radio.c index 6ad310fd03..630ca44621 100644 --- a/components/openthread/src/port/esp_openthread_radio.c +++ b/components/openthread/src/port/esp_openthread_radio.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2021-2023 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -32,9 +32,11 @@ #include "utils/mac_frame.h" #define ESP_RECEIVE_SENSITIVITY -120 -#define ESP_OPENTHREAD_XTAL_ACCURACY 130 -#define ESP_OPENTHREAD_CSL_ACCURACY 1 -#define ESP_OPENTHREAD_CSL_UNCERTAIN 1 +#define ESP_OPENTHREAD_XTAL_ACCURACY CONFIG_OPENTHREAD_XTAL_ACCURACY +#if OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE +#define ESP_OPENTHREAD_CSL_ACCURACY CONFIG_OPENTHREAD_CSL_ACCURACY +#define ESP_OPENTHREAD_CSL_UNCERTAIN CONFIG_OPENTHREAD_CSL_UNCERTAIN +#endif #define EVENT_TX_DONE (1 << 0) #define EVENT_TX_FAILED (1 << 1)