mirror of
https://github.com/espressif/esp-idf.git
synced 2026-09-22 13:01:16 +03:00
Merge branch 'fix/fix_some_issues_found_in_ot_sdk' into 'master'
fix(openthread): fix configuration-related issues See merge request espressif/esp-idf!51617
This commit is contained in:
@@ -333,7 +333,7 @@ menu "OpenThread"
|
||||
bool "Enable link metrics feature"
|
||||
default n
|
||||
select IEEE802154_TIMING_OPTIMIZATION if IEEE802154_ENABLED
|
||||
select OPENTHREAD_TIMING_OPTIMIZATION
|
||||
select OPENTHREAD_TIMING_OPTIMIZATION if OPENTHREAD_RADIO_NATIVE
|
||||
help
|
||||
Select this option to enable link metrics feature
|
||||
|
||||
@@ -437,17 +437,16 @@ menu "OpenThread"
|
||||
endmenu
|
||||
|
||||
menu "Thread Memory Allocation"
|
||||
depends on (SPIRAM_USE_CAPS_ALLOC || SPIRAM_USE_MALLOC)
|
||||
config OPENTHREAD_PLATFORM_MALLOC_CAP_SPIRAM
|
||||
depends on (SPIRAM_USE_CAPS_ALLOC || SPIRAM_USE_MALLOC)
|
||||
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'
|
||||
depends on OPENTHREAD_PLATFORM_MALLOC_CAP_SPIRAM
|
||||
default y
|
||||
bool 'Allocate message pool buffer from platform'
|
||||
default n
|
||||
help
|
||||
If enabled, the message pool is managed by platform defined logic.
|
||||
endmenu
|
||||
@@ -481,8 +480,8 @@ menu "OpenThread"
|
||||
|
||||
config OPENTHREAD_NUM_MESSAGE_BUFFERS
|
||||
int "The number of openthread message buffers"
|
||||
default 65 if !OPENTHREAD_PLATFORM_MSGPOOL_MANAGEMENT
|
||||
default 1024 if OPENTHREAD_PLATFORM_MSGPOOL_MANAGEMENT
|
||||
default 65 if !OPENTHREAD_PLATFORM_MALLOC_CAP_SPIRAM
|
||||
default 1024 if OPENTHREAD_PLATFORM_MALLOC_CAP_SPIRAM
|
||||
|
||||
config OPENTHREAD_XTAL_ACCURACY
|
||||
int "The accuracy of the XTAL"
|
||||
|
||||
@@ -241,7 +241,9 @@ esp_err_t esp_openthread_launch_mainloop(void)
|
||||
|
||||
esp_err_t esp_openthread_deinit(void)
|
||||
{
|
||||
esp_openthread_lock_acquire(portMAX_DELAY);
|
||||
esp_openthread_instances_deinit(esp_openthread_get_instance());
|
||||
esp_openthread_lock_release();
|
||||
return esp_openthread_platform_deinit();
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,10 @@ bool esp_openthread_instances_init(void)
|
||||
|
||||
void esp_openthread_instances_deinit(otInstance *instance)
|
||||
{
|
||||
otInstanceFinalize(instance);
|
||||
(void)instance;
|
||||
for (int i = 0; i < OT_INSTANCE_COUNT; i++) {
|
||||
otInstanceFinalize(s_instances[i]);
|
||||
}
|
||||
}
|
||||
|
||||
bool esp_openthread_tasklets_are_pending(otInstance *instance)
|
||||
|
||||
@@ -28,11 +28,13 @@ void otPlatMessagePoolInit(otInstance *aInstance, uint16_t aMinNumFreeBuffers, s
|
||||
|
||||
uint16_t num_buffers = aMinNumFreeBuffers;
|
||||
|
||||
#if CONFIG_OPENTHREAD_PLATFORM_MALLOC_CAP_SPIRAM
|
||||
if (!esp_psram_is_initialized() && num_buffers > OT_MSGPOOL_NUM_BUFFERS_NO_PSRAM) {
|
||||
ESP_LOGW(OT_PLAT_LOG_TAG, "PSRAM not available, reducing message pool from %u to %u buffers",
|
||||
num_buffers, OT_MSGPOOL_NUM_BUFFERS_NO_PSRAM);
|
||||
num_buffers = OT_MSGPOOL_NUM_BUFFERS_NO_PSRAM;
|
||||
}
|
||||
#endif
|
||||
|
||||
otMessageBuffer *buffer_pool = (otMessageBuffer *)heap_caps_calloc_prefer(num_buffers, aBufferSize, 3, esp_openthread_get_alloc_caps(), MALLOC_CAP_SPIRAM | MALLOC_CAP_8BIT, MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT);
|
||||
s_buffer_pool_pointer = (otMessageBuffer **)heap_caps_calloc_prefer(num_buffers, sizeof(otMessageBuffer **), 3, esp_openthread_get_alloc_caps(), MALLOC_CAP_SPIRAM | MALLOC_CAP_8BIT, MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT);
|
||||
|
||||
Reference in New Issue
Block a user