Jelajahi Sumber

Merge branch 'support/openthread_custom_config' into 'master'

feat(openthread): Add some configuration for customer using

Closes TZ-68

See merge request espressif/esp-idf!25774
Shu Chen 2 tahun lalu
induk
melakukan
5bced24b13

+ 52 - 0
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
             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.
             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
     config OPENTHREAD_JOINER
         bool "Enable Joiner"
         bool "Enable Joiner"
         depends on OPENTHREAD_ENABLED
         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
             Select this option to enable SRP Client in OpenThread. This allows a device to register SRP services to SRP
             Server.
             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
     config OPENTHREAD_DNS_CLIENT
         bool "Enable DNS Client"
         bool "Enable DNS Client"
         depends on OPENTHREAD_ENABLED
         depends on OPENTHREAD_ENABLED
@@ -221,6 +235,24 @@ menu "OpenThread"
         range 10 100 if !OPENTHREAD_PLATFORM_MSGPOOL_MANAGEMENT
         range 10 100 if !OPENTHREAD_PLATFORM_MSGPOOL_MANAGEMENT
         range 10 8191 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
     config OPENTHREAD_DNS64_CLIENT
         bool "Use dns64 client"
         bool "Use dns64 client"
         depends on OPENTHREAD_ENABLED && LWIP_IPV4
         depends on OPENTHREAD_ENABLED && LWIP_IPV4
@@ -264,6 +296,26 @@ menu "OpenThread"
         help
         help
             Select this option to enable CSL feature
             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
     config OPENTHREAD_CSL_DEBUG_ENABLE
         bool "Enable CSL debug"
         bool "Enable CSL debug"
         depends on OPENTHREAD_CSL_ENABLE
         depends on OPENTHREAD_CSL_ENABLE

+ 35 - 1
components/openthread/private_include/openthread-core-esp32x-ftd-config.h

@@ -361,7 +361,7 @@
  * `RadioSpinel` platform is used.
  * `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
  * @def OPENTHREAD_CONFIG_PLATFORM_USEC_TIMER_ENABLE
@@ -381,6 +381,22 @@
  */
  */
 #define OPENTHREAD_CONFIG_PING_SENDER_ENABLE 1
 #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
 #if CONFIG_OPENTHREAD_DUA_ENABLE
 /**
 /**
  * @def OPENTHREAD_CONFIG_DUA_ENABLE
  * @def OPENTHREAD_CONFIG_DUA_ENABLE
@@ -418,6 +434,14 @@
  */
  */
 #if CONFIG_OPENTHREAD_COMMISSIONER
 #if CONFIG_OPENTHREAD_COMMISSIONER
 #define OPENTHREAD_CONFIG_COMMISSIONER_ENABLE 1
 #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
 #endif
 
 
 #if CONFIG_OPENTHREAD_MACFILTER_ENABLE
 #if CONFIG_OPENTHREAD_MACFILTER_ENABLE
@@ -440,6 +464,16 @@
 #ifndef OPENTHREAD_CONFIG_SRP_CLIENT_ENABLE
 #ifndef OPENTHREAD_CONFIG_SRP_CLIENT_ENABLE
 #define OPENTHREAD_CONFIG_SRP_CLIENT_ENABLE 1
 #define OPENTHREAD_CONFIG_SRP_CLIENT_ENABLE 1
 #endif
 #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
 #endif
 
 
 /**
 /**

+ 12 - 1
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
  * SPDX-License-Identifier: Apache-2.0
  */
  */
@@ -232,6 +232,17 @@
 #ifndef OPENTHREAD_CONFIG_SRP_CLIENT_ENABLE
 #ifndef OPENTHREAD_CONFIG_SRP_CLIENT_ENABLE
 #define OPENTHREAD_CONFIG_SRP_CLIENT_ENABLE 1
 #define OPENTHREAD_CONFIG_SRP_CLIENT_ENABLE 1
 #endif
 #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
 #endif
 
 
 /**
 /**

+ 6 - 4
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
  * SPDX-License-Identifier: Apache-2.0
  */
  */
@@ -32,9 +32,11 @@
 #include "utils/mac_frame.h"
 #include "utils/mac_frame.h"
 
 
 #define ESP_RECEIVE_SENSITIVITY -120
 #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_DONE (1 << 0)
 #define EVENT_TX_FAILED (1 << 1)
 #define EVENT_TX_FAILED (1 << 1)