diff --git a/components/ieee802154/lib b/components/ieee802154/lib index 7c691d705b..6ddc1b2d80 160000 --- a/components/ieee802154/lib +++ b/components/ieee802154/lib @@ -1 +1 @@ -Subproject commit 7c691d705b491c1dbb53fa6a15e23b1c4ccb287f +Subproject commit 6ddc1b2d80d7db565f144f76e60f77a0f98a2cbd diff --git a/components/openthread/CMakeLists.txt b/components/openthread/CMakeLists.txt index f9dbc241c4..a43dbf7f86 100644 --- a/components/openthread/CMakeLists.txt +++ b/components/openthread/CMakeLists.txt @@ -203,6 +203,16 @@ if(CONFIG_OPENTHREAD_ENABLED) "${CMAKE_CURRENT_SOURCE_DIR}/lib/${idf_target}/rev2/libopenthread_port.a" REQUIRES openthread) endif() + elseif(IDF_TARGET STREQUAL "esp32c6") + if(CONFIG_OPENTHREAD_BORDER_ROUTER) + add_prebuilt_library(openthread_port + "${CMAKE_CURRENT_SOURCE_DIR}/lib/${idf_target}/br/libopenthread_port.a" + REQUIRES openthread) + else() + add_prebuilt_library(openthread_port + "${CMAKE_CURRENT_SOURCE_DIR}/lib/${idf_target}/cli/libopenthread_port.a" + REQUIRES openthread) + endif() else() add_prebuilt_library(openthread_port "${CMAKE_CURRENT_SOURCE_DIR}/lib/${idf_target}/libopenthread_port.a" REQUIRES openthread) diff --git a/components/openthread/Kconfig b/components/openthread/Kconfig index 811df85792..ba0ce85f7b 100644 --- a/components/openthread/Kconfig +++ b/components/openthread/Kconfig @@ -47,7 +47,7 @@ menu "OpenThread" choice OPENTHREAD_RADIO_TYPE prompt "Config the Thread radio type" depends on OPENTHREAD_ENABLED - default OPENTHREAD_RADIO_NATIVE if IDF_TARGET_ESP32H4 + default OPENTHREAD_RADIO_NATIVE if SOC_IEEE802154_SUPPORTED default OPENTHREAD_RADIO_SPINEL_UART help Configure how OpenThread connects to the 15.4 radio diff --git a/components/openthread/include/esp_openthread_lock.h b/components/openthread/include/esp_openthread_lock.h index 96da77b70c..61c74ad0ed 100644 --- a/components/openthread/include/esp_openthread_lock.h +++ b/components/openthread/include/esp_openthread_lock.h @@ -1,16 +1,8 @@ -// Copyright 2021 Espressif Systems (Shanghai) CO LTD -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at - -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License +/* + * SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ #pragma once @@ -41,7 +33,7 @@ esp_err_t esp_openthread_lock_init(void); void esp_openthread_lock_deinit(void); /** - * @brief This functions acquires the OpenThread API lock. + * @brief This function acquires the OpenThread API lock. * * @note Every OT APIs that takes an otInstance argument MUST be protected with this API lock * except that the call site is in OT callbacks. @@ -61,6 +53,28 @@ bool esp_openthread_lock_acquire(TickType_t block_ticks); */ void esp_openthread_lock_release(void); +/** + * @brief This function acquires the OpenThread API task switching lock. + * + * @note In OpenThread API context, it waits for some actions to be done in other tasks (like lwip), + * after task switching, it needs to call OpenThread API again. Normally it's not allowed, + * since the previous OpenThread API lock is not released yet. This task_switching lock allows + * the OpenThread API can be called in this case. + * + * @note Please use esp_openthread_lock_acquire() for normal cases. + * + * @return + * - True on lock acquired + * - False on failing to acquire the lock with the timeout. + * + */ +bool esp_openthread_task_switching_lock_acquire(void); + +/** + * @brief This function releases the OpenThread API task switching lock. + * + */ +void esp_openthread_task_switching_lock_release(void); #ifdef __cplusplus } diff --git a/components/openthread/lib b/components/openthread/lib index d1cf81e6b0..009faca9f0 160000 --- a/components/openthread/lib +++ b/components/openthread/lib @@ -1 +1 @@ -Subproject commit d1cf81e6b04828a7480d43bbaf73bb6b5b154e9d +Subproject commit 009faca9f091a1dec4508dbaaff95fa01a1abc2f diff --git a/components/openthread/openthread b/components/openthread/openthread index 507d1b7971..19e18753c1 160000 --- a/components/openthread/openthread +++ b/components/openthread/openthread @@ -1 +1 @@ -Subproject commit 507d1b79712bba1ea3033fa4116577f668818e80 +Subproject commit 19e18753c1ca97ffc68566f4852444f341e0319c diff --git a/examples/openthread/.build-test-rules.yml b/examples/openthread/.build-test-rules.yml index 4d12dad671..069989ac1d 100644 --- a/examples/openthread/.build-test-rules.yml +++ b/examples/openthread/.build-test-rules.yml @@ -6,16 +6,22 @@ examples/openthread/ot_br: temporary: true reason: target(s) not supported yet disable_test: - - if: IDF_TARGET in ["esp32", "esp32c3", "esp32s2"] + - if: IDF_TARGET in ["esp32", "esp32c3", "esp32s2", "esp32c6"] temporary: true reason: only test on esp32s3 examples/openthread/ot_cli: enable: - - if: IDF_TARGET == "esp32h4" + - if: IDF_TARGET in ["esp32h4", "esp32c6"] + disable_test: + - if: IDF_TARGET == "esp32c6" + temporary: true reason: only test on esp32h4 examples/openthread/ot_rcp: enable: - - if: IDF_TARGET == "esp32h4" + - if: IDF_TARGET in ["esp32h4", "esp32c6"] + disable_test: + - if: IDF_TARGET == "esp32c6" + temporary: true reason: only test on esp32h4 diff --git a/examples/openthread/ot_cli/README.md b/examples/openthread/ot_cli/README.md index 99a90e451c..24bf10569f 100644 --- a/examples/openthread/ot_cli/README.md +++ b/examples/openthread/ot_cli/README.md @@ -1,5 +1,5 @@ -| Supported Targets | ESP32-H4 | -| ----------------- | -------- | +| Supported Targets | ESP32-C6 | ESP32-H4 | +| ----------------- | -------- | -------- | # OpenThread Command Line Example diff --git a/examples/openthread/ot_cli/main/esp_ot_cli.c b/examples/openthread/ot_cli/main/esp_ot_cli.c index 0d4e3ad379..bf7de1e2f5 100644 --- a/examples/openthread/ot_cli/main/esp_ot_cli.c +++ b/examples/openthread/ot_cli/main/esp_ot_cli.c @@ -32,6 +32,7 @@ #include "freertos/FreeRTOS.h" #include "freertos/task.h" #include "hal/uart_types.h" +#include "nvs_flash.h" #include "openthread/cli.h" #include "openthread/instance.h" #include "openthread/logging.h" @@ -101,6 +102,7 @@ void app_main(void) .max_fds = 3, }; + ESP_ERROR_CHECK(nvs_flash_init()); ESP_ERROR_CHECK(esp_event_loop_create_default()); ESP_ERROR_CHECK(esp_netif_init()); ESP_ERROR_CHECK(esp_vfs_eventfd_register(&eventfd_config)); diff --git a/examples/openthread/ot_cli/main/esp_ot_config.h b/examples/openthread/ot_cli/main/esp_ot_config.h index 036cb37c5f..c1defedae5 100644 --- a/examples/openthread/ot_cli/main/esp_ot_config.h +++ b/examples/openthread/ot_cli/main/esp_ot_config.h @@ -16,7 +16,7 @@ #include "esp_openthread_types.h" -#if CONFIG_IDF_TARGET_ESP32H4 +#if SOC_IEEE802154_SUPPORTED #define ESP_OPENTHREAD_DEFAULT_RADIO_CONFIG() \ { \ .radio_mode = RADIO_MODE_NATIVE, \ diff --git a/examples/openthread/ot_cli/sdkconfig.defaults b/examples/openthread/ot_cli/sdkconfig.defaults index 817e75dafe..d5886c63ac 100644 --- a/examples/openthread/ot_cli/sdkconfig.defaults +++ b/examples/openthread/ot_cli/sdkconfig.defaults @@ -1,4 +1,3 @@ -CONFIG_IDF_TARGET="esp32h4" # # libsodium # diff --git a/examples/openthread/ot_rcp/README.md b/examples/openthread/ot_rcp/README.md index 446555c8de..49b76464d8 100644 --- a/examples/openthread/ot_rcp/README.md +++ b/examples/openthread/ot_rcp/README.md @@ -1,5 +1,5 @@ -| Supported Targets | ESP32-H4 | -| ----------------- | -------- | +| Supported Targets | ESP32-C6 | ESP32-H4 | +| ----------------- | -------- | -------- | # OpenThread Radio Co-Processor (RCP) Example diff --git a/examples/openthread/ot_rcp/main/esp_ot_rcp.c b/examples/openthread/ot_rcp/main/esp_ot_rcp.c index 96eaee39df..67a17f3fd5 100644 --- a/examples/openthread/ot_rcp/main/esp_ot_rcp.c +++ b/examples/openthread/ot_rcp/main/esp_ot_rcp.c @@ -16,13 +16,14 @@ #include #include "esp_event.h" +#include "nvs_flash.h" #include "esp_openthread.h" #include "esp_ot_config.h" #include "esp_vfs_eventfd.h" #include "driver/uart.h" -#if !CONFIG_IDF_TARGET_ESP32H4 -#error "RCP is only supported for esp32h4" +#if !SOC_IEEE802154_SUPPORTED +#error "RCP is only supported for the SoCs which have IEEE 802.15.4 module" #endif #define TAG "ot_esp_rcp" @@ -60,6 +61,7 @@ void app_main(void) .max_fds = 2, }; + ESP_ERROR_CHECK(nvs_flash_init()); ESP_ERROR_CHECK(esp_event_loop_create_default()); ESP_ERROR_CHECK(esp_vfs_eventfd_register(&eventfd_config)); xTaskCreate(ot_task_worker, "ot_rcp_main", 10240, xTaskGetCurrentTaskHandle(), 5, NULL); diff --git a/examples/openthread/ot_rcp/sdkconfig.defaults b/examples/openthread/ot_rcp/sdkconfig.defaults index 991cd96db2..744223185e 100644 --- a/examples/openthread/ot_rcp/sdkconfig.defaults +++ b/examples/openthread/ot_rcp/sdkconfig.defaults @@ -1,4 +1,3 @@ -CONFIG_IDF_TARGET="esp32h4" # # libsodium # diff --git a/tools/ci/check_copyright_ignore.txt b/tools/ci/check_copyright_ignore.txt index 812c7e17f3..fc5c2b16ba 100644 --- a/tools/ci/check_copyright_ignore.txt +++ b/tools/ci/check_copyright_ignore.txt @@ -813,7 +813,6 @@ components/nvs_flash/test_nvs_host/test_intrusive_list.cpp components/nvs_flash/test_nvs_host/test_nvs_cxx_api.cpp components/nvs_flash/test_nvs_host/test_nvs_initialization.cpp components/nvs_flash/test_nvs_host/test_nvs_storage.cpp -components/openthread/include/esp_openthread_lock.h components/protocomm/include/transports/protocomm_console.h components/protocomm/include/transports/protocomm_httpd.h components/pthread/pthread_cond_var.c