From 3c6ee5a9574866194d1c4dff06506d0a484cec95 Mon Sep 17 00:00:00 2001 From: Xu Si Yu Date: Sun, 4 Feb 2024 11:22:33 +0800 Subject: [PATCH] fix(openthread): fix openthread configurations for radio spinle on 5.1 --- components/openthread/CMakeLists.txt | 3 +++ components/openthread/include/esp_radio_spinel.h | 11 ++++++----- .../src/spinel/esp_radio_spinel_uart_interface.cpp | 4 +++- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/components/openthread/CMakeLists.txt b/components/openthread/CMakeLists.txt index 72d3f9320b..7e63836f80 100644 --- a/components/openthread/CMakeLists.txt +++ b/components/openthread/CMakeLists.txt @@ -9,6 +9,9 @@ if(CONFIG_OPENTHREAD_ENABLED OR CONFIG_IDF_DOC_BUILD OR CONFIG_OPENTHREAD_SPINEL set(public_include_dirs "include" "openthread/include") +endif() + +if(CONFIG_OPENTHREAD_ENABLED) set(private_include_dirs "openthread/examples/platforms" diff --git a/components/openthread/include/esp_radio_spinel.h b/components/openthread/include/esp_radio_spinel.h index e8edef1fa6..b3acb66496 100644 --- a/components/openthread/include/esp_radio_spinel.h +++ b/components/openthread/include/esp_radio_spinel.h @@ -6,15 +6,16 @@ #pragma once +#include +#include "esp_err.h" +#include "esp_ieee802154_types.h" +#include "hal/gpio_types.h" +#include "hal/uart_types.h" + #ifdef __cplusplus extern "C" { #endif -#include -#include "esp_ieee802154_types.h" -#include "driver/uart.h" -#include "soc/gpio_num.h" - #define ESP_SPINEL_LOG_TAG "ESP_RADIO_SPINEL" #define SPINEL_PROP_VENDOR_ESP_SET_COORDINATOR (SPINEL_PROP_VENDOR_ESP__BEGIN + 1) /* Vendor command for coordinator.*/ diff --git a/components/openthread/src/spinel/esp_radio_spinel_uart_interface.cpp b/components/openthread/src/spinel/esp_radio_spinel_uart_interface.cpp index d07a67065b..35a536100c 100644 --- a/components/openthread/src/spinel/esp_radio_spinel_uart_interface.cpp +++ b/components/openthread/src/spinel/esp_radio_spinel_uart_interface.cpp @@ -11,6 +11,8 @@ #include "esp_openthread_common_macro.h" #include "openthread/platform/time.h" #include "hdlc.hpp" +#include "esp_heap_caps.h" +#include "driver/uart.h" namespace esp { namespace radio_spinel { @@ -105,7 +107,7 @@ void UartSpinelInterface::Process(const void *aMainloopContext) int UartSpinelInterface::TryReadAndDecode(void) { - uint8_t buffer[UART_HW_FIFO_LEN(m_uart_config.port)]; + uint8_t buffer[UART_FIFO_LEN]; ssize_t rval; do { rval = read(m_uart_fd, buffer, sizeof(buffer));