From 47af508b7abf584fd5278ffcd5aff7a1ff7bc3b0 Mon Sep 17 00:00:00 2001 From: zwx Date: Wed, 7 Jan 2026 15:28:05 +0800 Subject: [PATCH] feat(ieee802154): separated the 802.15.4 HAL codes from the HAL component --- .gitlab/CODEOWNERS | 1 + components/esp_hal_ieee802154/CMakeLists.txt | 15 +++++++++++++++ .../esp32c5/ieee802154_periph.c | 12 ++++++++++++ .../esp32c5/include/hal/ieee802154_ll.h | 3 +-- .../esp32c6/ieee802154_periph.c | 12 ++++++++++++ .../esp32c6/include/hal/ieee802154_ll.h | 3 +-- .../esp32h2/ieee802154_periph.c | 12 ++++++++++++ .../esp32h2/include/hal/ieee802154_ll.h | 3 +-- .../esp32h4/ieee802154_periph.c | 12 ++++++++++++ .../esp32h4/include/hal/ieee802154_ll.h | 3 +-- .../include/hal/ieee802154_common_ll.h | 2 +- .../include/hal}/ieee802154_periph.h | 4 ++-- components/ieee802154/CMakeLists.txt | 2 +- components/ieee802154/driver/esp_ieee802154_dev.c | 2 +- components/soc/CMakeLists.txt | 3 --- components/soc/esp32c5/ieee802154_periph.c | 12 ------------ components/soc/esp32c6/ieee802154_periph.c | 12 ------------ components/soc/esp32h2/ieee802154_periph.c | 12 ------------ components/soc/esp32h4/ieee802154_periph.c | 12 ------------ 19 files changed, 73 insertions(+), 64 deletions(-) create mode 100644 components/esp_hal_ieee802154/CMakeLists.txt create mode 100644 components/esp_hal_ieee802154/esp32c5/ieee802154_periph.c rename components/{hal => esp_hal_ieee802154}/esp32c5/include/hal/ieee802154_ll.h (76%) create mode 100644 components/esp_hal_ieee802154/esp32c6/ieee802154_periph.c rename components/{hal => esp_hal_ieee802154}/esp32c6/include/hal/ieee802154_ll.h (76%) create mode 100644 components/esp_hal_ieee802154/esp32h2/ieee802154_periph.c rename components/{hal => esp_hal_ieee802154}/esp32h2/include/hal/ieee802154_ll.h (81%) create mode 100644 components/esp_hal_ieee802154/esp32h4/ieee802154_periph.c rename components/{hal => esp_hal_ieee802154}/esp32h4/include/hal/ieee802154_ll.h (88%) rename components/{hal => esp_hal_ieee802154}/include/hal/ieee802154_common_ll.h (99%) rename components/{soc/include/soc => esp_hal_ieee802154/include/hal}/ieee802154_periph.h (77%) delete mode 100644 components/soc/esp32c5/ieee802154_periph.c delete mode 100644 components/soc/esp32c6/ieee802154_periph.c delete mode 100644 components/soc/esp32h2/ieee802154_periph.c delete mode 100644 components/soc/esp32h4/ieee802154_periph.c diff --git a/.gitlab/CODEOWNERS b/.gitlab/CODEOWNERS index b03595c686..e19ed1157b 100644 --- a/.gitlab/CODEOWNERS +++ b/.gitlab/CODEOWNERS @@ -95,6 +95,7 @@ /components/esp_event/ @esp-idf-codeowners/system /components/esp_gdbstub/ @esp-idf-codeowners/debugging /components/esp_hal_*/ @esp-idf-codeowners/peripherals +/components/esp_hal_ieee802154/ @esp-idf-codeowners/ieee802154 /components/esp_hal_pmu/ @esp-idf-codeowners/power-management @esp-idf-codeowners/peripherals /components/esp_hal_rtc_timer/ @esp-idf-codeowners/power-management @esp-idf-codeowners/peripherals /components/esp_hid/ @esp-idf-codeowners/bluetooth diff --git a/components/esp_hal_ieee802154/CMakeLists.txt b/components/esp_hal_ieee802154/CMakeLists.txt new file mode 100644 index 0000000000..a73de4d326 --- /dev/null +++ b/components/esp_hal_ieee802154/CMakeLists.txt @@ -0,0 +1,15 @@ +idf_build_get_property(target IDF_TARGET) + +set(includes "include") +set(srcs "") + +if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/${target}/include") + list(APPEND includes "${target}/include") +endif() + +if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/${target}/ieee802154_periph.c") + list(APPEND srcs "${target}/ieee802154_periph.c") +endif() + +idf_component_register(SRCS ${srcs} + INCLUDE_DIRS ${includes}) diff --git a/components/esp_hal_ieee802154/esp32c5/ieee802154_periph.c b/components/esp_hal_ieee802154/esp32c5/ieee802154_periph.c new file mode 100644 index 0000000000..c6aa36edba --- /dev/null +++ b/components/esp_hal_ieee802154/esp32c5/ieee802154_periph.c @@ -0,0 +1,12 @@ +/* + * SPDX-FileCopyrightText: 2026 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "hal/ieee802154_periph.h" + +const ieee802154_conn_t ieee802154_periph = { + .module = PERIPH_IEEE802154_MODULE, + .irq_id = ETS_ZB_MAC_INTR_SOURCE, +}; diff --git a/components/hal/esp32c5/include/hal/ieee802154_ll.h b/components/esp_hal_ieee802154/esp32c5/include/hal/ieee802154_ll.h similarity index 76% rename from components/hal/esp32c5/include/hal/ieee802154_ll.h rename to components/esp_hal_ieee802154/esp32c5/include/hal/ieee802154_ll.h index f480050ccd..d867995893 100644 --- a/components/hal/esp32c5/include/hal/ieee802154_ll.h +++ b/components/esp_hal_ieee802154/esp32c5/include/hal/ieee802154_ll.h @@ -1,12 +1,11 @@ /* - * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2026 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ #pragma once -#include #include "hal/ieee802154_common_ll.h" #define IEEE802154_TXPOWER_VALUE_MAX 20 diff --git a/components/esp_hal_ieee802154/esp32c6/ieee802154_periph.c b/components/esp_hal_ieee802154/esp32c6/ieee802154_periph.c new file mode 100644 index 0000000000..39d8c24c3d --- /dev/null +++ b/components/esp_hal_ieee802154/esp32c6/ieee802154_periph.c @@ -0,0 +1,12 @@ +/* + * SPDX-FileCopyrightText: 2026 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "hal/ieee802154_periph.h" + +const ieee802154_conn_t ieee802154_periph = { + .module = PERIPH_IEEE802154_MODULE, + .irq_id = ETS_ZB_MAC_SOURCE, +}; diff --git a/components/hal/esp32c6/include/hal/ieee802154_ll.h b/components/esp_hal_ieee802154/esp32c6/include/hal/ieee802154_ll.h similarity index 76% rename from components/hal/esp32c6/include/hal/ieee802154_ll.h rename to components/esp_hal_ieee802154/esp32c6/include/hal/ieee802154_ll.h index 14e548a1d3..d867995893 100644 --- a/components/hal/esp32c6/include/hal/ieee802154_ll.h +++ b/components/esp_hal_ieee802154/esp32c6/include/hal/ieee802154_ll.h @@ -1,12 +1,11 @@ /* - * SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2026 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ #pragma once -#include #include "hal/ieee802154_common_ll.h" #define IEEE802154_TXPOWER_VALUE_MAX 20 diff --git a/components/esp_hal_ieee802154/esp32h2/ieee802154_periph.c b/components/esp_hal_ieee802154/esp32h2/ieee802154_periph.c new file mode 100644 index 0000000000..c6aa36edba --- /dev/null +++ b/components/esp_hal_ieee802154/esp32h2/ieee802154_periph.c @@ -0,0 +1,12 @@ +/* + * SPDX-FileCopyrightText: 2026 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "hal/ieee802154_periph.h" + +const ieee802154_conn_t ieee802154_periph = { + .module = PERIPH_IEEE802154_MODULE, + .irq_id = ETS_ZB_MAC_INTR_SOURCE, +}; diff --git a/components/hal/esp32h2/include/hal/ieee802154_ll.h b/components/esp_hal_ieee802154/esp32h2/include/hal/ieee802154_ll.h similarity index 81% rename from components/hal/esp32h2/include/hal/ieee802154_ll.h rename to components/esp_hal_ieee802154/esp32h2/include/hal/ieee802154_ll.h index 2795fc4896..ab1ad15e2a 100644 --- a/components/hal/esp32h2/include/hal/ieee802154_ll.h +++ b/components/esp_hal_ieee802154/esp32h2/include/hal/ieee802154_ll.h @@ -1,12 +1,11 @@ /* - * SPDX-FileCopyrightText: 2023-2025 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2026 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ #pragma once -#include #include "hal/ieee802154_common_ll.h" #ifdef __cplusplus diff --git a/components/esp_hal_ieee802154/esp32h4/ieee802154_periph.c b/components/esp_hal_ieee802154/esp32h4/ieee802154_periph.c new file mode 100644 index 0000000000..c6aa36edba --- /dev/null +++ b/components/esp_hal_ieee802154/esp32h4/ieee802154_periph.c @@ -0,0 +1,12 @@ +/* + * SPDX-FileCopyrightText: 2026 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "hal/ieee802154_periph.h" + +const ieee802154_conn_t ieee802154_periph = { + .module = PERIPH_IEEE802154_MODULE, + .irq_id = ETS_ZB_MAC_INTR_SOURCE, +}; diff --git a/components/hal/esp32h4/include/hal/ieee802154_ll.h b/components/esp_hal_ieee802154/esp32h4/include/hal/ieee802154_ll.h similarity index 88% rename from components/hal/esp32h4/include/hal/ieee802154_ll.h rename to components/esp_hal_ieee802154/esp32h4/include/hal/ieee802154_ll.h index 1011512659..9e1c3b6b75 100644 --- a/components/hal/esp32h4/include/hal/ieee802154_ll.h +++ b/components/esp_hal_ieee802154/esp32h4/include/hal/ieee802154_ll.h @@ -1,12 +1,11 @@ /* - * SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2026 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ #pragma once -#include #include "hal/ieee802154_common_ll.h" #ifdef __cplusplus diff --git a/components/hal/include/hal/ieee802154_common_ll.h b/components/esp_hal_ieee802154/include/hal/ieee802154_common_ll.h similarity index 99% rename from components/hal/include/hal/ieee802154_common_ll.h rename to components/esp_hal_ieee802154/include/hal/ieee802154_common_ll.h index 4efdf20893..883697b04e 100644 --- a/components/hal/include/hal/ieee802154_common_ll.h +++ b/components/esp_hal_ieee802154/include/hal/ieee802154_common_ll.h @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2023-2025 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2026 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ diff --git a/components/soc/include/soc/ieee802154_periph.h b/components/esp_hal_ieee802154/include/hal/ieee802154_periph.h similarity index 77% rename from components/soc/include/soc/ieee802154_periph.h rename to components/esp_hal_ieee802154/include/hal/ieee802154_periph.h index 74954abee4..29dde05d7c 100644 --- a/components/soc/include/soc/ieee802154_periph.h +++ b/components/esp_hal_ieee802154/include/hal/ieee802154_periph.h @@ -1,7 +1,7 @@ /* - * SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2026 Espressif Systems (Shanghai) CO LTD * - * SPDX-License-Identifier: Apache-2.0 OR MIT + * SPDX-License-Identifier: Apache-2.0 */ #pragma once diff --git a/components/ieee802154/CMakeLists.txt b/components/ieee802154/CMakeLists.txt index 2b556a12cf..5f410b3e9b 100644 --- a/components/ieee802154/CMakeLists.txt +++ b/components/ieee802154/CMakeLists.txt @@ -37,5 +37,5 @@ idf_component_register( PRIV_INCLUDE_DIRS "${private_include}" LDFRAGMENTS linker.lf REQUIRES esp_coex - PRIV_REQUIRES esp_phy esp_timer soc hal esp_pm + PRIV_REQUIRES esp_phy esp_timer soc hal esp_pm esp_hal_ieee802154 ) diff --git a/components/ieee802154/driver/esp_ieee802154_dev.c b/components/ieee802154/driver/esp_ieee802154_dev.c index 594a79d24f..a122bcb338 100644 --- a/components/ieee802154/driver/esp_ieee802154_dev.c +++ b/components/ieee802154/driver/esp_ieee802154_dev.c @@ -9,7 +9,7 @@ #include "freertos/portmacro.h" #include "soc/periph_defs.h" #include "soc/soc.h" -#include "soc/ieee802154_periph.h" +#include "hal/ieee802154_periph.h" #include "esp_private/esp_modem_clock.h" #include "esp_check.h" #include "esp_coex_i154.h" diff --git a/components/soc/CMakeLists.txt b/components/soc/CMakeLists.txt index 626d9bc8ba..96cb12dfcc 100644 --- a/components/soc/CMakeLists.txt +++ b/components/soc/CMakeLists.txt @@ -78,9 +78,6 @@ if(CONFIG_SOC_SDMMC_HOST_SUPPORTED) list(APPEND srcs "${target_folder}/sdmmc_periph.c") endif() -if(CONFIG_SOC_IEEE802154_SUPPORTED) - list(APPEND srcs "${target_folder}/ieee802154_periph.c") -endif() if(CONFIG_SOC_SDIO_SLAVE_SUPPORTED) list(APPEND srcs "${target_folder}/sdio_slave_periph.c") diff --git a/components/soc/esp32c5/ieee802154_periph.c b/components/soc/esp32c5/ieee802154_periph.c deleted file mode 100644 index b89cec29ab..0000000000 --- a/components/soc/esp32c5/ieee802154_periph.c +++ /dev/null @@ -1,12 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - */ - -#include "soc/ieee802154_periph.h" - -const ieee802154_conn_t ieee802154_periph = { - .module = PERIPH_IEEE802154_MODULE, - .irq_id = ETS_ZB_MAC_INTR_SOURCE, -}; diff --git a/components/soc/esp32c6/ieee802154_periph.c b/components/soc/esp32c6/ieee802154_periph.c deleted file mode 100644 index 2a80d5689a..0000000000 --- a/components/soc/esp32c6/ieee802154_periph.c +++ /dev/null @@ -1,12 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - */ - -#include "soc/ieee802154_periph.h" - -const ieee802154_conn_t ieee802154_periph = { - .module = PERIPH_IEEE802154_MODULE, - .irq_id = ETS_ZB_MAC_SOURCE, -}; diff --git a/components/soc/esp32h2/ieee802154_periph.c b/components/soc/esp32h2/ieee802154_periph.c deleted file mode 100644 index b89cec29ab..0000000000 --- a/components/soc/esp32h2/ieee802154_periph.c +++ /dev/null @@ -1,12 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - */ - -#include "soc/ieee802154_periph.h" - -const ieee802154_conn_t ieee802154_periph = { - .module = PERIPH_IEEE802154_MODULE, - .irq_id = ETS_ZB_MAC_INTR_SOURCE, -}; diff --git a/components/soc/esp32h4/ieee802154_periph.c b/components/soc/esp32h4/ieee802154_periph.c deleted file mode 100644 index b89cec29ab..0000000000 --- a/components/soc/esp32h4/ieee802154_periph.c +++ /dev/null @@ -1,12 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - */ - -#include "soc/ieee802154_periph.h" - -const ieee802154_conn_t ieee802154_periph = { - .module = PERIPH_IEEE802154_MODULE, - .irq_id = ETS_ZB_MAC_INTR_SOURCE, -};