openthread: add 802.15.4 and Thread support lib for ESP32-C6

pull/10469/head
Xu Si Yu 2022-12-19 10:50:08 +08:00
rodzic 3e2f414214
commit c35759448a
15 zmienionych plików z 62 dodań i 31 usunięć

@ -1 +1 @@
Subproject commit 7c691d705b491c1dbb53fa6a15e23b1c4ccb287f
Subproject commit 6ddc1b2d80d7db565f144f76e60f77a0f98a2cbd

Wyświetl plik

@ -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)

Wyświetl plik

@ -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

Wyświetl plik

@ -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
}

@ -1 +1 @@
Subproject commit d1cf81e6b04828a7480d43bbaf73bb6b5b154e9d
Subproject commit 009faca9f091a1dec4508dbaaff95fa01a1abc2f

@ -1 +1 @@
Subproject commit 507d1b79712bba1ea3033fa4116577f668818e80
Subproject commit 19e18753c1ca97ffc68566f4852444f341e0319c

Wyświetl plik

@ -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

Wyświetl plik

@ -1,5 +1,5 @@
| Supported Targets | ESP32-H4 |
| ----------------- | -------- |
| Supported Targets | ESP32-C6 | ESP32-H4 |
| ----------------- | -------- | -------- |
# OpenThread Command Line Example

Wyświetl plik

@ -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));

Wyświetl plik

@ -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, \

Wyświetl plik

@ -1,4 +1,3 @@
CONFIG_IDF_TARGET="esp32h4"
#
# libsodium
#

Wyświetl plik

@ -1,5 +1,5 @@
| Supported Targets | ESP32-H4 |
| ----------------- | -------- |
| Supported Targets | ESP32-C6 | ESP32-H4 |
| ----------------- | -------- | -------- |
# OpenThread Radio Co-Processor (RCP) Example

Wyświetl plik

@ -16,13 +16,14 @@
#include <unistd.h>
#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);

Wyświetl plik

@ -1,4 +1,3 @@
CONFIG_IDF_TARGET="esp32h4"
#
# libsodium
#

Wyświetl plik

@ -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