Merge branch 'backport/support_openthread_feature_on_512' into 'release/v5.1'

Backport/support openthread feature for release v5.1.2(backport5.1)

See merge request espressif/esp-idf!26203
This commit is contained in:
Shu Chen 2023-09-26 16:40:47 +08:00
commit af4cb757a2
5 changed files with 157 additions and 12 deletions

View File

@ -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
@ -277,4 +329,13 @@ menu "OpenThread"
default n
help
Only used for Thread1.2 certification
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.
endmenu

@ -1 +1 @@
Subproject commit 64c77643c92b76fff36bd13211f6b821c4beb8ef
Subproject commit 12f563ee490236f7332eb22f568e71c7c1d4a3b7

View File

@ -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
/**
@ -517,7 +551,6 @@
#define OPENTHREAD_CONFIG_OPERATIONAL_DATASET_AUTO_INIT 1
#endif
/**
*
* Define as 1 to enable support for allocating message pool buffer in PSRAM
@ -536,4 +569,14 @@
#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
#define OPENTHREAD_FTD 1

View File

@ -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
/**
@ -242,4 +253,14 @@
*/
#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
#define OPENTHREAD_MTD 1

View File

@ -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)
@ -711,15 +713,33 @@ void IRAM_ATTR esp_ieee802154_receive_sfd_done(void)
void IRAM_ATTR esp_ieee802154_transmit_sfd_done(uint8_t *frame)
{
assert(frame == (uint8_t *)&s_transmit_psdu || frame == s_enhack);
#if OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE
otRadioFrame ot_frame;
ot_frame.mPsdu = frame + 1;
ot_frame.mLength = frame[0];
#if OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE
if (s_csl_period > 0) {
otRadioFrame ot_frame;
ot_frame.mPsdu = frame + 1;
ot_frame.mLength = frame[0];
otMacFrameSetCslIe(&ot_frame, s_csl_period, get_csl_phase());
}
#endif
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
if (frame == (uint8_t *)&s_transmit_psdu && s_transmit_frame.mInfo.mTxInfo.mIeInfo->mTimeIeOffset != 0)
{
uint8_t *p_time_ie = s_transmit_frame.mPsdu + s_transmit_frame.mInfo.mTxInfo.mIeInfo->mTimeIeOffset;
uint64_t time = (uint64_t)((int64_t)otPlatTimeGet() + s_transmit_frame.mInfo.mTxInfo.mIeInfo->mNetworkTimeOffset);
*p_time_ie = s_transmit_frame.mInfo.mTxInfo.mIeInfo->mTimeSyncSeq;
*(++p_time_ie) = (uint8_t)(time & 0xff);
for (uint8_t i = 1; i < sizeof(uint64_t); i++)
{
time = time >> 8;
*(++p_time_ie) = (uint8_t)(time & 0xff);
}
}
#endif // OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
}
void IRAM_ATTR esp_ieee802154_energy_detect_done(int8_t power)