forked from espressif/esp-idf
openthread: add 802.15.4 and Thread support lib for ESP32-C6
This commit is contained in:
Submodule components/ieee802154/lib updated: 7c691d705b...6ddc1b2d80
@@ -203,6 +203,16 @@ if(CONFIG_OPENTHREAD_ENABLED)
|
|||||||
"${CMAKE_CURRENT_SOURCE_DIR}/lib/${idf_target}/rev2/libopenthread_port.a"
|
"${CMAKE_CURRENT_SOURCE_DIR}/lib/${idf_target}/rev2/libopenthread_port.a"
|
||||||
REQUIRES openthread)
|
REQUIRES openthread)
|
||||||
endif()
|
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()
|
else()
|
||||||
add_prebuilt_library(openthread_port "${CMAKE_CURRENT_SOURCE_DIR}/lib/${idf_target}/libopenthread_port.a"
|
add_prebuilt_library(openthread_port "${CMAKE_CURRENT_SOURCE_DIR}/lib/${idf_target}/libopenthread_port.a"
|
||||||
REQUIRES openthread)
|
REQUIRES openthread)
|
||||||
|
@@ -47,7 +47,7 @@ menu "OpenThread"
|
|||||||
choice OPENTHREAD_RADIO_TYPE
|
choice OPENTHREAD_RADIO_TYPE
|
||||||
prompt "Config the Thread radio type"
|
prompt "Config the Thread radio type"
|
||||||
depends on OPENTHREAD_ENABLED
|
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
|
default OPENTHREAD_RADIO_SPINEL_UART
|
||||||
help
|
help
|
||||||
Configure how OpenThread connects to the 15.4 radio
|
Configure how OpenThread connects to the 15.4 radio
|
||||||
|
@@ -1,16 +1,8 @@
|
|||||||
// Copyright 2021 Espressif Systems (Shanghai) CO LTD
|
/*
|
||||||
//
|
* SPDX-FileCopyrightText: 2021-2022 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.
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
// 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
|
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
@@ -41,7 +33,7 @@ esp_err_t esp_openthread_lock_init(void);
|
|||||||
void esp_openthread_lock_deinit(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
|
* @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.
|
* 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);
|
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
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
Submodule components/openthread/lib updated: d1cf81e6b0...009faca9f0
Submodule components/openthread/openthread updated: 507d1b7971...19e18753c1
@@ -6,16 +6,22 @@ examples/openthread/ot_br:
|
|||||||
temporary: true
|
temporary: true
|
||||||
reason: target(s) not supported yet
|
reason: target(s) not supported yet
|
||||||
disable_test:
|
disable_test:
|
||||||
- if: IDF_TARGET in ["esp32", "esp32c3", "esp32s2"]
|
- if: IDF_TARGET in ["esp32", "esp32c3", "esp32s2", "esp32c6"]
|
||||||
temporary: true
|
temporary: true
|
||||||
reason: only test on esp32s3
|
reason: only test on esp32s3
|
||||||
|
|
||||||
examples/openthread/ot_cli:
|
examples/openthread/ot_cli:
|
||||||
enable:
|
enable:
|
||||||
- if: IDF_TARGET == "esp32h4"
|
- if: IDF_TARGET in ["esp32h4", "esp32c6"]
|
||||||
|
disable_test:
|
||||||
|
- if: IDF_TARGET == "esp32c6"
|
||||||
|
temporary: true
|
||||||
reason: only test on esp32h4
|
reason: only test on esp32h4
|
||||||
|
|
||||||
examples/openthread/ot_rcp:
|
examples/openthread/ot_rcp:
|
||||||
enable:
|
enable:
|
||||||
- if: IDF_TARGET == "esp32h4"
|
- if: IDF_TARGET in ["esp32h4", "esp32c6"]
|
||||||
|
disable_test:
|
||||||
|
- if: IDF_TARGET == "esp32c6"
|
||||||
|
temporary: true
|
||||||
reason: only test on esp32h4
|
reason: only test on esp32h4
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
| Supported Targets | ESP32-H4 |
|
| Supported Targets | ESP32-C6 | ESP32-H4 |
|
||||||
| ----------------- | -------- |
|
| ----------------- | -------- | -------- |
|
||||||
|
|
||||||
# OpenThread Command Line Example
|
# OpenThread Command Line Example
|
||||||
|
|
||||||
|
@@ -32,6 +32,7 @@
|
|||||||
#include "freertos/FreeRTOS.h"
|
#include "freertos/FreeRTOS.h"
|
||||||
#include "freertos/task.h"
|
#include "freertos/task.h"
|
||||||
#include "hal/uart_types.h"
|
#include "hal/uart_types.h"
|
||||||
|
#include "nvs_flash.h"
|
||||||
#include "openthread/cli.h"
|
#include "openthread/cli.h"
|
||||||
#include "openthread/instance.h"
|
#include "openthread/instance.h"
|
||||||
#include "openthread/logging.h"
|
#include "openthread/logging.h"
|
||||||
@@ -101,6 +102,7 @@ void app_main(void)
|
|||||||
.max_fds = 3,
|
.max_fds = 3,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
ESP_ERROR_CHECK(nvs_flash_init());
|
||||||
ESP_ERROR_CHECK(esp_event_loop_create_default());
|
ESP_ERROR_CHECK(esp_event_loop_create_default());
|
||||||
ESP_ERROR_CHECK(esp_netif_init());
|
ESP_ERROR_CHECK(esp_netif_init());
|
||||||
ESP_ERROR_CHECK(esp_vfs_eventfd_register(&eventfd_config));
|
ESP_ERROR_CHECK(esp_vfs_eventfd_register(&eventfd_config));
|
||||||
|
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
#include "esp_openthread_types.h"
|
#include "esp_openthread_types.h"
|
||||||
|
|
||||||
#if CONFIG_IDF_TARGET_ESP32H4
|
#if SOC_IEEE802154_SUPPORTED
|
||||||
#define ESP_OPENTHREAD_DEFAULT_RADIO_CONFIG() \
|
#define ESP_OPENTHREAD_DEFAULT_RADIO_CONFIG() \
|
||||||
{ \
|
{ \
|
||||||
.radio_mode = RADIO_MODE_NATIVE, \
|
.radio_mode = RADIO_MODE_NATIVE, \
|
||||||
|
@@ -1,4 +1,3 @@
|
|||||||
CONFIG_IDF_TARGET="esp32h4"
|
|
||||||
#
|
#
|
||||||
# libsodium
|
# libsodium
|
||||||
#
|
#
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
| Supported Targets | ESP32-H4 |
|
| Supported Targets | ESP32-C6 | ESP32-H4 |
|
||||||
| ----------------- | -------- |
|
| ----------------- | -------- | -------- |
|
||||||
|
|
||||||
# OpenThread Radio Co-Processor (RCP) Example
|
# OpenThread Radio Co-Processor (RCP) Example
|
||||||
|
|
||||||
|
@@ -16,13 +16,14 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "esp_event.h"
|
#include "esp_event.h"
|
||||||
|
#include "nvs_flash.h"
|
||||||
#include "esp_openthread.h"
|
#include "esp_openthread.h"
|
||||||
#include "esp_ot_config.h"
|
#include "esp_ot_config.h"
|
||||||
#include "esp_vfs_eventfd.h"
|
#include "esp_vfs_eventfd.h"
|
||||||
#include "driver/uart.h"
|
#include "driver/uart.h"
|
||||||
|
|
||||||
#if !CONFIG_IDF_TARGET_ESP32H4
|
#if !SOC_IEEE802154_SUPPORTED
|
||||||
#error "RCP is only supported for esp32h4"
|
#error "RCP is only supported for the SoCs which have IEEE 802.15.4 module"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define TAG "ot_esp_rcp"
|
#define TAG "ot_esp_rcp"
|
||||||
@@ -60,6 +61,7 @@ void app_main(void)
|
|||||||
.max_fds = 2,
|
.max_fds = 2,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
ESP_ERROR_CHECK(nvs_flash_init());
|
||||||
ESP_ERROR_CHECK(esp_event_loop_create_default());
|
ESP_ERROR_CHECK(esp_event_loop_create_default());
|
||||||
ESP_ERROR_CHECK(esp_vfs_eventfd_register(&eventfd_config));
|
ESP_ERROR_CHECK(esp_vfs_eventfd_register(&eventfd_config));
|
||||||
xTaskCreate(ot_task_worker, "ot_rcp_main", 10240, xTaskGetCurrentTaskHandle(), 5, NULL);
|
xTaskCreate(ot_task_worker, "ot_rcp_main", 10240, xTaskGetCurrentTaskHandle(), 5, NULL);
|
||||||
|
@@ -1,4 +1,3 @@
|
|||||||
CONFIG_IDF_TARGET="esp32h4"
|
|
||||||
#
|
#
|
||||||
# libsodium
|
# libsodium
|
||||||
#
|
#
|
||||||
|
@@ -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_cxx_api.cpp
|
||||||
components/nvs_flash/test_nvs_host/test_nvs_initialization.cpp
|
components/nvs_flash/test_nvs_host/test_nvs_initialization.cpp
|
||||||
components/nvs_flash/test_nvs_host/test_nvs_storage.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_console.h
|
||||||
components/protocomm/include/transports/protocomm_httpd.h
|
components/protocomm/include/transports/protocomm_httpd.h
|
||||||
components/pthread/pthread_cond_var.c
|
components/pthread/pthread_cond_var.c
|
||||||
|
Reference in New Issue
Block a user