diff --git a/components/bt/controller/esp32c3/bt.c b/components/bt/controller/esp32c3/bt.c index 5d98444792..1bab7da38c 100644 --- a/components/bt/controller/esp32c3/bt.c +++ b/components/bt/controller/esp32c3/bt.c @@ -38,7 +38,7 @@ #include "esp32c3/rom/rom_layout.h" #include "esp_timer.h" #include "esp_sleep.h" -#include "phy.h" +#include "esp_private/phy.h" #if CONFIG_BT_ENABLED diff --git a/components/esp_phy/CMakeLists.txt b/components/esp_phy/CMakeLists.txt index e9459c9a4b..28b060f024 100644 --- a/components/esp_phy/CMakeLists.txt +++ b/components/esp_phy/CMakeLists.txt @@ -21,6 +21,10 @@ else() list(APPEND srcs "src/phy_init.c") endif() +if(CONFIG_SOC_BT_SUPPORTED OR CONFIG_SOC_IEEE802154_SUPPORTED) + list(APPEND srcs "src/btbb_init.c") +endif() + idf_build_get_property(build_dir BUILD_DIR) if(CONFIG_ESP_PHY_MULTIPLE_INIT_DATA_BIN) diff --git a/components/esp_phy/include/esp_phy_init.h b/components/esp_phy/include/esp_phy_init.h index bcf3e289d3..4f30c7795f 100644 --- a/components/esp_phy/include/esp_phy_init.h +++ b/components/esp_phy/include/esp_phy_init.h @@ -170,6 +170,16 @@ void esp_phy_enable(void); */ void esp_phy_disable(void); +/** + * @brief Enable BTBB module + * + * BTBB module should be enabled in order to use IEEE802154 or BT. + * Now BTBB enabling job is done automatically when start IEEE802154 or BT. Users should not + * call this API in their application. + * + */ +void esp_btbb_enable(void); + /** * @brief Load calibration data from NVS and initialize PHY and RF module */ diff --git a/components/esp_phy/include/esp_private/btbb.h b/components/esp_phy/include/esp_private/btbb.h new file mode 100644 index 0000000000..74b0908723 --- /dev/null +++ b/components/esp_phy/include/esp_private/btbb.h @@ -0,0 +1,23 @@ +/* + * SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#pragma once +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Set btbb enable for BT/ieee802154 + * @param[in] print_version enable btbb version print. + * @return NULL + */ +void bt_bb_v2_init_cmplx(int print_version); + +#ifdef __cplusplus +} +#endif diff --git a/components/esp_phy/include/phy.h b/components/esp_phy/include/esp_private/phy.h similarity index 100% rename from components/esp_phy/include/phy.h rename to components/esp_phy/include/esp_private/phy.h diff --git a/components/esp_phy/src/btbb_init.c b/components/esp_phy/src/btbb_init.c new file mode 100644 index 0000000000..5ae016391a --- /dev/null +++ b/components/esp_phy/src/btbb_init.c @@ -0,0 +1,25 @@ +/* + * SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include "freertos/FreeRTOS.h" +#include "esp_private/btbb.h" + +#define BTBB_ENABLE_VERSION_PRINT 1 + +static _lock_t s_btbb_access_lock; +/* Reference count of enabling BT BB */ +static uint8_t s_btbb_access_ref = 0; + +void esp_btbb_enable(void) +{ + _lock_acquire(&s_btbb_access_lock); + if (s_btbb_access_ref == 0) { + bt_bb_v2_init_cmplx(BTBB_ENABLE_VERSION_PRINT); + } + s_btbb_access_ref++; + _lock_release(&s_btbb_access_lock); +} diff --git a/components/esp_phy/src/phy_init.c b/components/esp_phy/src/phy_init.c index 61f610b0c5..05d8e66b02 100644 --- a/components/esp_phy/src/phy_init.c +++ b/components/esp_phy/src/phy_init.c @@ -23,7 +23,7 @@ #include "freertos/FreeRTOS.h" #include "freertos/portmacro.h" #include "endian.h" -#include "phy.h" +#include "esp_private/phy.h" #include "phy_init_data.h" #include "esp_coexist_internal.h" #include "esp_private/periph_ctrl.h" diff --git a/components/esp_phy/src/phy_init_esp32hxx.c b/components/esp_phy/src/phy_init_esp32hxx.c index 3c09b77cf2..db6c257fcd 100644 --- a/components/esp_phy/src/phy_init_esp32hxx.c +++ b/components/esp_phy/src/phy_init_esp32hxx.c @@ -7,7 +7,7 @@ #include "esp_attr.h" #include "freertos/portmacro.h" #include "esp_phy_init.h" -#include "phy.h" +#include "esp_private/phy.h" #define PHY_ENABLE_VERSION_PRINT 1 diff --git a/components/esp_wifi/src/wifi_init.c b/components/esp_wifi/src/wifi_init.c index e14f399087..437d1af2c6 100644 --- a/components/esp_wifi/src/wifi_init.c +++ b/components/esp_wifi/src/wifi_init.c @@ -17,7 +17,7 @@ #include "esp_netif.h" #include "esp_coexist_internal.h" #include "esp_phy_init.h" -#include "phy.h" +#include "esp_private/phy.h" #if (CONFIG_ESP32_WIFI_RX_BA_WIN > CONFIG_ESP32_WIFI_DYNAMIC_RX_BUFFER_NUM) #error "WiFi configuration check: WARNING, WIFI_RX_BA_WIN should not be larger than WIFI_DYNAMIC_RX_BUFFER_NUM!" diff --git a/components/ieee802154/Kconfig b/components/ieee802154/Kconfig index 7112d2aa98..ecfffc9eb4 100644 --- a/components/ieee802154/Kconfig +++ b/components/ieee802154/Kconfig @@ -1,8 +1,8 @@ menu "IEEE 802.15.4" - visible if IDF_TARGET_ESP32H4 + visible if SOC_IEEE802154_SUPPORTED config IEEE802154_ENABLED bool - default "y" if IDF_TARGET_ESP32H4 + default "y" if SOC_IEEE802154_SUPPORTED endmenu # IEEE 802.15.4 diff --git a/components/ieee802154/lib b/components/ieee802154/lib index 5c51d657d4..7c691d705b 160000 --- a/components/ieee802154/lib +++ b/components/ieee802154/lib @@ -1 +1 @@ -Subproject commit 5c51d657d4d34f60890540587663925462ababa4 +Subproject commit 7c691d705b491c1dbb53fa6a15e23b1c4ccb287f diff --git a/components/soc/esp32c6/ld/esp32c6.peripherals.ld b/components/soc/esp32c6/ld/esp32c6.peripherals.ld index 2a9acb4b10..8635a430cb 100644 --- a/components/soc/esp32c6/ld/esp32c6.peripherals.ld +++ b/components/soc/esp32c6/ld/esp32c6.peripherals.ld @@ -74,3 +74,4 @@ PROVIDE ( LPPERI = 0x600B2800 ); PROVIDE ( LP_ANA_PERI = 0x600B2C00 ); PROVIDE ( LP_APM = 0x600B3800 ); PROVIDE ( OTP_DEBUG = 0x600B3C00 ); +PROVIDE ( IEEE802154 = 0x600A3000 );