From de5e57d29670376a309975f8f82da5cd630c83e8 Mon Sep 17 00:00:00 2001 From: wuzhenghui Date: Fri, 12 Dec 2025 19:41:52 +0800 Subject: [PATCH 1/2] feat(esp_hal_pmu): graduate pmu/rtc_cntl hal driver into a new component: esp_hal_pmu --- components/esp_hal_pmu/CMakeLists.txt | 22 ++++++ components/esp_hal_pmu/README.md | 68 +++++++++++++++++++ .../esp32/include/hal/rtc_cntl_ll.h | 6 +- .../esp32c2/include/hal/rtc_cntl_ll.h | 0 .../esp32c2/rtc_cntl_hal.c | 2 +- .../esp32c3/include/hal/rtc_cntl_ll.h | 0 .../esp32c3/rtc_cntl_hal.c | 2 +- .../esp32c5/include/hal/pmu_hal.h | 0 .../esp32c5/include/hal/pmu_ll.h | 4 -- .../{hal => esp_hal_pmu}/esp32c5/pmu_hal.c | 0 .../esp32c6/include/hal/pmu_hal.h | 0 .../esp32c6/include/hal/pmu_ll.h | 3 - .../{hal => esp_hal_pmu}/esp32c6/pmu_hal.c | 0 .../esp32c61/include/hal/pmu_hal.h | 0 .../esp32c61/include/hal/pmu_ll.h | 4 -- .../{hal => esp_hal_pmu}/esp32c61/pmu_hal.c | 0 .../esp32h2/include/hal/pmu_hal.h | 0 .../esp32h2/include/hal/pmu_ll.h | 0 .../{hal => esp_hal_pmu}/esp32h2/pmu_hal.c | 0 .../esp32h21/include/hal/pmu_hal.h | 0 .../esp32h21/include/hal/pmu_ll.h | 1 - .../{hal => esp_hal_pmu}/esp32h21/pmu_hal.c | 0 .../esp32h4/include/hal/pmu_hal.h | 0 .../esp32h4/include/hal/pmu_ll.h | 0 .../{hal => esp_hal_pmu}/esp32h4/pmu_hal.c | 0 .../esp32p4/include/hal/pmu_hal.h | 0 .../esp32p4/include/hal/pmu_ll.h | 3 - .../{hal => esp_hal_pmu}/esp32p4/pmu_hal.c | 0 .../esp32s2/include/hal/rtc_cntl_ll.h | 4 +- .../esp32s3/include/hal/rtc_cntl_ll.h | 4 +- .../esp32s3/rtc_cntl_hal.c | 24 +++---- .../esp32s31/include/hal/pmu_hal.h | 23 +++++++ .../esp_hal_pmu/esp32s31/include/hal/pmu_ll.h | 29 ++++++++ components/esp_hal_pmu/esp32s31/pmu_hal.c | 9 +++ .../include/hal/pmu_types.h | 0 .../include/hal/rtc_hal.h | 0 components/esp_hal_pmu/linker.lf | 5 ++ components/esp_hw_support/CMakeLists.txt | 2 +- components/esp_pm/linker.lf | 8 ++- components/hal/CMakeLists.txt | 9 --- components/hal/linker.lf | 2 - components/ulp/CMakeLists.txt | 3 +- .../system/g1_components/CMakeLists.txt | 1 + 43 files changed, 187 insertions(+), 51 deletions(-) create mode 100644 components/esp_hal_pmu/CMakeLists.txt create mode 100644 components/esp_hal_pmu/README.md rename components/{hal => esp_hal_pmu}/esp32/include/hal/rtc_cntl_ll.h (95%) rename components/{hal => esp_hal_pmu}/esp32c2/include/hal/rtc_cntl_ll.h (100%) rename components/{hal => esp_hal_pmu}/esp32c2/rtc_cntl_hal.c (97%) rename components/{hal => esp_hal_pmu}/esp32c3/include/hal/rtc_cntl_ll.h (100%) rename components/{hal => esp_hal_pmu}/esp32c3/rtc_cntl_hal.c (98%) rename components/{hal => esp_hal_pmu}/esp32c5/include/hal/pmu_hal.h (100%) rename components/{hal => esp_hal_pmu}/esp32c5/include/hal/pmu_ll.h (99%) rename components/{hal => esp_hal_pmu}/esp32c5/pmu_hal.c (100%) rename components/{hal => esp_hal_pmu}/esp32c6/include/hal/pmu_hal.h (100%) rename components/{hal => esp_hal_pmu}/esp32c6/include/hal/pmu_ll.h (99%) rename components/{hal => esp_hal_pmu}/esp32c6/pmu_hal.c (100%) rename components/{hal => esp_hal_pmu}/esp32c61/include/hal/pmu_hal.h (100%) rename components/{hal => esp_hal_pmu}/esp32c61/include/hal/pmu_ll.h (99%) rename components/{hal => esp_hal_pmu}/esp32c61/pmu_hal.c (100%) rename components/{hal => esp_hal_pmu}/esp32h2/include/hal/pmu_hal.h (100%) rename components/{hal => esp_hal_pmu}/esp32h2/include/hal/pmu_ll.h (100%) rename components/{hal => esp_hal_pmu}/esp32h2/pmu_hal.c (100%) rename components/{hal => esp_hal_pmu}/esp32h21/include/hal/pmu_hal.h (100%) rename components/{hal => esp_hal_pmu}/esp32h21/include/hal/pmu_ll.h (99%) rename components/{hal => esp_hal_pmu}/esp32h21/pmu_hal.c (100%) rename components/{hal => esp_hal_pmu}/esp32h4/include/hal/pmu_hal.h (100%) rename components/{hal => esp_hal_pmu}/esp32h4/include/hal/pmu_ll.h (100%) rename components/{hal => esp_hal_pmu}/esp32h4/pmu_hal.c (100%) rename components/{hal => esp_hal_pmu}/esp32p4/include/hal/pmu_hal.h (100%) rename components/{hal => esp_hal_pmu}/esp32p4/include/hal/pmu_ll.h (99%) rename components/{hal => esp_hal_pmu}/esp32p4/pmu_hal.c (100%) rename components/{hal => esp_hal_pmu}/esp32s2/include/hal/rtc_cntl_ll.h (96%) rename components/{hal => esp_hal_pmu}/esp32s3/include/hal/rtc_cntl_ll.h (98%) rename components/{hal => esp_hal_pmu}/esp32s3/rtc_cntl_hal.c (89%) create mode 100644 components/esp_hal_pmu/esp32s31/include/hal/pmu_hal.h create mode 100644 components/esp_hal_pmu/esp32s31/include/hal/pmu_ll.h create mode 100644 components/esp_hal_pmu/esp32s31/pmu_hal.c rename components/{hal => esp_hal_pmu}/include/hal/pmu_types.h (100%) rename components/{hal => esp_hal_pmu}/include/hal/rtc_hal.h (100%) create mode 100644 components/esp_hal_pmu/linker.lf diff --git a/components/esp_hal_pmu/CMakeLists.txt b/components/esp_hal_pmu/CMakeLists.txt new file mode 100644 index 00000000000..875d338cf96 --- /dev/null +++ b/components/esp_hal_pmu/CMakeLists.txt @@ -0,0 +1,22 @@ +idf_build_get_property(target IDF_TARGET) +if(${target} STREQUAL "linux") + return() # This component is not supported by the POSIX/Linux simulator +endif() + +set(srcs) +set(public_include "include" "${target}/include") + +# New chips with PMU peripheral +if(CONFIG_SOC_PMU_SUPPORTED) + list(APPEND srcs "${target}/pmu_hal.c") +endif() + +# Legacy chips with RTC_CNTL peripheral +if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/${target}/rtc_cntl_hal.c") + list(APPEND srcs "${target}/rtc_cntl_hal.c") +endif() + +idf_component_register(SRCS ${srcs} + INCLUDE_DIRS ${public_include} + REQUIRES soc hal esp_rom + LDFRAGMENTS linker.lf) diff --git a/components/esp_hal_pmu/README.md b/components/esp_hal_pmu/README.md new file mode 100644 index 00000000000..090030970d2 --- /dev/null +++ b/components/esp_hal_pmu/README.md @@ -0,0 +1,68 @@ +# ESP Hardware Abstraction Layer for PMU and RTC Control Peripherals + +> [!NOTE] +> This component is currently in beta. Its API, behavior, and compatibility may change at any time and without notice; backward compatibility is not guaranteed. Use caution when integrating into production systems. + +## Overview + +The `esp_hal_pmu` component provides a **Hardware Abstraction Layer** for Power Management Unit (PMU) and legacy RTC Control (RTC_CNTL) peripherals across ESP-IDF supported targets. This HAL enables unified power management operations including sleep mode control, power domain management, wakeup configuration, and retention control across different ESP chip families. + +The component consolidates power management functionality from two different peripheral implementations: +- **PMU**: Modern power management unit in newer ESP chips +- **RTC_CNTL**: Legacy RTC control peripheral in older ESP chips + +## Architecture + +The HAL architecture consists of two primary layers: + +1. **HAL Layer (Upper)**: Defines the operational sequences and data structures required to interact with PMU/RTC_CNTL peripherals, including: + - Power domain configuration and control + - Sleep mode management + - Wakeup source configuration + - Retention control (CPU, tagmem) + - Power-up/down wait cycle configuration + - Backup enable/disable operations + +2. **Low-Level Layer (Bottom)**: Acts as a translation layer between the HAL and the register definitions in the `soc` component, handling: + - Register access abstractions + - Chip-specific register configurations + - Hardware feature compatibility + - Power domain and clock control + +## Features + +### Power Management +- Power domain control (HP/LP system power domains) +- Digital power supply and power-up wait cycle configuration +- Control ready wait cycle configuration (isolate/reset) +- Power mode transitions (active, sleep, modem) + +### Sleep and Wakeup +- Sleep mode configuration +- Wakeup source management +- Sleep rejection handling +- Wakeup cause detection + +### Retention Control +- CPU retention enable/disable +- Tagmem retention support (on supported chips) +- DMA link buffer configuration for retention + +### Backup Operations +- Sleep-to-active backup enable/disable +- Sleep-to-modem backup enable/disable +- Modem-to-active backup enable/disable + +## Usage +This component is primarily used by ESP-IDF system services such as: +- **esp_pm**: Power management framework +- **esp_hw_support**: Hardware support layer for sleep modes and power management +- **ulp**: Ultra-low-power coprocessor support + +For advanced developers implementing custom power management solutions, the HAL functions can be used directly. However, please note that the interfaces provided by this component are internal to ESP-IDF and are subject to change. + +## Dependencies + +- `soc`: Provides chip-specific register definitions and peripheral capabilities +- `hal`: Core hardware abstraction utilities and macros +- `esp_rom`: ROM function interfaces (where applicable) diff --git a/components/hal/esp32/include/hal/rtc_cntl_ll.h b/components/esp_hal_pmu/esp32/include/hal/rtc_cntl_ll.h similarity index 95% rename from components/hal/esp32/include/hal/rtc_cntl_ll.h rename to components/esp_hal_pmu/esp32/include/hal/rtc_cntl_ll.h index 387c73f2887..a30c657637a 100644 --- a/components/hal/esp32/include/hal/rtc_cntl_ll.h +++ b/components/esp_hal_pmu/esp32/include/hal/rtc_cntl_ll.h @@ -8,7 +8,7 @@ #include "soc/soc.h" #include "esp_attr.h" -#include "clk_tree_ll.h" +#include "hal/clk_tree_ll.h" #include "esp_rom_sys.h" #include "hal/assert.h" @@ -39,10 +39,10 @@ FORCE_INLINE_ATTR void rtc_cntl_ll_ext1_set_wakeup_pins(uint32_t io_mask, uint32 REG_SET_FIELD(RTC_CNTL_EXT_WAKEUP1_REG, RTC_CNTL_EXT_WAKEUP1_SEL, io_mask); if ((io_mask & mode_mask) == io_mask) { SET_PERI_REG_BITS(RTC_CNTL_EXT_WAKEUP_CONF_REG, 0x1, - 1, RTC_CNTL_EXT_WAKEUP1_LV_S); + 1, RTC_CNTL_EXT_WAKEUP1_LV_S); } else { SET_PERI_REG_BITS(RTC_CNTL_EXT_WAKEUP_CONF_REG, 0x1, - 0, RTC_CNTL_EXT_WAKEUP1_LV_S); + 0, RTC_CNTL_EXT_WAKEUP1_LV_S); } } diff --git a/components/hal/esp32c2/include/hal/rtc_cntl_ll.h b/components/esp_hal_pmu/esp32c2/include/hal/rtc_cntl_ll.h similarity index 100% rename from components/hal/esp32c2/include/hal/rtc_cntl_ll.h rename to components/esp_hal_pmu/esp32c2/include/hal/rtc_cntl_ll.h diff --git a/components/hal/esp32c2/rtc_cntl_hal.c b/components/esp_hal_pmu/esp32c2/rtc_cntl_hal.c similarity index 97% rename from components/hal/esp32c2/rtc_cntl_hal.c rename to components/esp_hal_pmu/esp32c2/rtc_cntl_hal.c index 7ee75a484dd..877953a48b5 100644 --- a/components/hal/esp32c2/rtc_cntl_hal.c +++ b/components/esp_hal_pmu/esp32c2/rtc_cntl_hal.c @@ -48,7 +48,7 @@ void rtc_cntl_hal_enable_cpu_retention(void *addr) pbuf->cfg[0] = 0; pbuf->cfg[1] = 0; pbuf->cfg[2] = 0; - pbuf->cfg[3] = (uint32_t)-1; + pbuf->cfg[3] = (uint32_t) -1; rtc_cntl_ll_enable_cpu_retention((uint32_t)addr); } diff --git a/components/hal/esp32c3/include/hal/rtc_cntl_ll.h b/components/esp_hal_pmu/esp32c3/include/hal/rtc_cntl_ll.h similarity index 100% rename from components/hal/esp32c3/include/hal/rtc_cntl_ll.h rename to components/esp_hal_pmu/esp32c3/include/hal/rtc_cntl_ll.h diff --git a/components/hal/esp32c3/rtc_cntl_hal.c b/components/esp_hal_pmu/esp32c3/rtc_cntl_hal.c similarity index 98% rename from components/hal/esp32c3/rtc_cntl_hal.c rename to components/esp_hal_pmu/esp32c3/rtc_cntl_hal.c index aa7f90a442d..8c92189f7b3 100644 --- a/components/hal/esp32c3/rtc_cntl_hal.c +++ b/components/esp_hal_pmu/esp32c3/rtc_cntl_hal.c @@ -53,7 +53,7 @@ void rtc_cntl_hal_enable_cpu_retention(void *addr) pbuf->cfg[0] = 0; pbuf->cfg[1] = 0; pbuf->cfg[2] = 0; - pbuf->cfg[3] = (uint32_t)-1; + pbuf->cfg[3] = (uint32_t) -1; rtc_cntl_ll_set_cpu_retention_link_addr((uint32_t)plink); rtc_cntl_ll_enable_cpu_retention_clock(); diff --git a/components/hal/esp32c5/include/hal/pmu_hal.h b/components/esp_hal_pmu/esp32c5/include/hal/pmu_hal.h similarity index 100% rename from components/hal/esp32c5/include/hal/pmu_hal.h rename to components/esp_hal_pmu/esp32c5/include/hal/pmu_hal.h diff --git a/components/hal/esp32c5/include/hal/pmu_ll.h b/components/esp_hal_pmu/esp32c5/include/hal/pmu_ll.h similarity index 99% rename from components/hal/esp32c5/include/hal/pmu_ll.h rename to components/esp_hal_pmu/esp32c5/include/hal/pmu_ll.h index 8e188cba458..0c331f5f729 100644 --- a/components/hal/esp32c5/include/hal/pmu_ll.h +++ b/components/esp_hal_pmu/esp32c5/include/hal/pmu_ll.h @@ -239,7 +239,6 @@ FORCE_INLINE_ATTR void pmu_ll_hp_set_regulator_driver_bar(pmu_dev_t *hw, pmu_hp_ hw->hp_sys[mode].regulator1.drv_b = drv_b; } - FORCE_INLINE_ATTR void pmu_ll_lp_set_regulator_slp_xpd(pmu_dev_t *hw, pmu_lp_mode_t mode, bool slp_xpd) { hw->lp_sys[mode].regulator0.slp_xpd = slp_xpd; @@ -271,7 +270,6 @@ FORCE_INLINE_ATTR void pmu_ll_lp_set_xtal_xpd(pmu_dev_t *hw, pmu_lp_mode_t mode, hw->lp_sys[mode].xtal.xpd_xtal = xpd_xtal; } - FORCE_INLINE_ATTR void pmu_ll_lp_set_dig_power(pmu_dev_t *hw, pmu_lp_mode_t mode, uint32_t flag) { hw->lp_sys[mode].dig_power.val = flag; @@ -311,7 +309,6 @@ FORCE_INLINE_ATTR void pmu_ll_lp_set_bias_sleep_enable(pmu_dev_t *hw, pmu_lp_mod hw->lp_sys[mode].bias.bias_sleep = en; } - /****/ FORCE_INLINE_ATTR void pmu_ll_imm_set_clk_power(pmu_dev_t *hw, uint32_t flag) { @@ -697,7 +694,6 @@ FORCE_INLINE_ATTR uint32_t pmu_ll_get_sysclk_sleep_select_state(pmu_dev_t *hw) return hw->clk_state0.sysclk_slp_sel; } - FORCE_INLINE_ATTR uint32_t pmu_ll_lp_get_interrupt_raw(pmu_dev_t *hw) { return hw->lp_ext.int_raw.val; diff --git a/components/hal/esp32c5/pmu_hal.c b/components/esp_hal_pmu/esp32c5/pmu_hal.c similarity index 100% rename from components/hal/esp32c5/pmu_hal.c rename to components/esp_hal_pmu/esp32c5/pmu_hal.c diff --git a/components/hal/esp32c6/include/hal/pmu_hal.h b/components/esp_hal_pmu/esp32c6/include/hal/pmu_hal.h similarity index 100% rename from components/hal/esp32c6/include/hal/pmu_hal.h rename to components/esp_hal_pmu/esp32c6/include/hal/pmu_hal.h diff --git a/components/hal/esp32c6/include/hal/pmu_ll.h b/components/esp_hal_pmu/esp32c6/include/hal/pmu_ll.h similarity index 99% rename from components/hal/esp32c6/include/hal/pmu_ll.h rename to components/esp_hal_pmu/esp32c6/include/hal/pmu_ll.h index ed55a8c0f91..24f31334aa8 100644 --- a/components/hal/esp32c6/include/hal/pmu_ll.h +++ b/components/esp_hal_pmu/esp32c6/include/hal/pmu_ll.h @@ -239,7 +239,6 @@ FORCE_INLINE_ATTR void pmu_ll_hp_set_regulator_driver_bar(pmu_dev_t *hw, pmu_hp_ hw->hp_sys[mode].regulator1.drv_b = drv_b; } - FORCE_INLINE_ATTR void pmu_ll_lp_set_regulator_slp_xpd(pmu_dev_t *hw, pmu_lp_mode_t mode, bool slp_xpd) { hw->lp_sys[mode].regulator0.slp_xpd = slp_xpd; @@ -271,7 +270,6 @@ FORCE_INLINE_ATTR void pmu_ll_lp_set_xtal_xpd(pmu_dev_t *hw, pmu_lp_mode_t mode, hw->lp_sys[mode].xtal.xpd_xtal = xpd_xtal; } - FORCE_INLINE_ATTR void pmu_ll_lp_set_dig_power(pmu_dev_t *hw, pmu_lp_mode_t mode, uint32_t flag) { hw->lp_sys[mode].dig_power.val = flag; @@ -311,7 +309,6 @@ FORCE_INLINE_ATTR void pmu_ll_lp_set_bias_sleep_enable(pmu_dev_t *hw, pmu_lp_mod hw->lp_sys[mode].bias.bias_sleep = en; } - /****/ FORCE_INLINE_ATTR void pmu_ll_imm_set_clk_power(pmu_dev_t *hw, uint32_t flag) { diff --git a/components/hal/esp32c6/pmu_hal.c b/components/esp_hal_pmu/esp32c6/pmu_hal.c similarity index 100% rename from components/hal/esp32c6/pmu_hal.c rename to components/esp_hal_pmu/esp32c6/pmu_hal.c diff --git a/components/hal/esp32c61/include/hal/pmu_hal.h b/components/esp_hal_pmu/esp32c61/include/hal/pmu_hal.h similarity index 100% rename from components/hal/esp32c61/include/hal/pmu_hal.h rename to components/esp_hal_pmu/esp32c61/include/hal/pmu_hal.h diff --git a/components/hal/esp32c61/include/hal/pmu_ll.h b/components/esp_hal_pmu/esp32c61/include/hal/pmu_ll.h similarity index 99% rename from components/hal/esp32c61/include/hal/pmu_ll.h rename to components/esp_hal_pmu/esp32c61/include/hal/pmu_ll.h index 62e045c6db1..2353926ad59 100644 --- a/components/hal/esp32c61/include/hal/pmu_ll.h +++ b/components/esp_hal_pmu/esp32c61/include/hal/pmu_ll.h @@ -17,7 +17,6 @@ #include "hal/pmu_types.h" #include "hal/misc.h" - #ifdef __cplusplus extern "C" { #endif @@ -240,7 +239,6 @@ FORCE_INLINE_ATTR void pmu_ll_hp_set_regulator_driver_bar(pmu_dev_t *hw, pmu_hp_ hw->hp_sys[mode].regulator1.drv_b = drv_b; } - FORCE_INLINE_ATTR void pmu_ll_lp_set_regulator_slp_xpd(pmu_dev_t *hw, pmu_lp_mode_t mode, bool slp_xpd) { hw->lp_sys[mode].regulator0.slp_xpd = slp_xpd; @@ -272,7 +270,6 @@ FORCE_INLINE_ATTR void pmu_ll_lp_set_xtal_xpd(pmu_dev_t *hw, pmu_lp_mode_t mode, hw->lp_sys[mode].xtal.xpd_xtal = xpd_xtal; } - FORCE_INLINE_ATTR void pmu_ll_lp_set_dig_power(pmu_dev_t *hw, pmu_lp_mode_t mode, uint32_t flag) { hw->lp_sys[mode].dig_power.val = flag; @@ -312,7 +309,6 @@ FORCE_INLINE_ATTR void pmu_ll_lp_set_bias_sleep_enable(pmu_dev_t *hw, pmu_lp_mod hw->lp_sys[mode].bias.bias_sleep = en; } - /****/ FORCE_INLINE_ATTR void pmu_ll_imm_set_clk_power(pmu_dev_t *hw, uint32_t flag) { diff --git a/components/hal/esp32c61/pmu_hal.c b/components/esp_hal_pmu/esp32c61/pmu_hal.c similarity index 100% rename from components/hal/esp32c61/pmu_hal.c rename to components/esp_hal_pmu/esp32c61/pmu_hal.c diff --git a/components/hal/esp32h2/include/hal/pmu_hal.h b/components/esp_hal_pmu/esp32h2/include/hal/pmu_hal.h similarity index 100% rename from components/hal/esp32h2/include/hal/pmu_hal.h rename to components/esp_hal_pmu/esp32h2/include/hal/pmu_hal.h diff --git a/components/hal/esp32h2/include/hal/pmu_ll.h b/components/esp_hal_pmu/esp32h2/include/hal/pmu_ll.h similarity index 100% rename from components/hal/esp32h2/include/hal/pmu_ll.h rename to components/esp_hal_pmu/esp32h2/include/hal/pmu_ll.h diff --git a/components/hal/esp32h2/pmu_hal.c b/components/esp_hal_pmu/esp32h2/pmu_hal.c similarity index 100% rename from components/hal/esp32h2/pmu_hal.c rename to components/esp_hal_pmu/esp32h2/pmu_hal.c diff --git a/components/hal/esp32h21/include/hal/pmu_hal.h b/components/esp_hal_pmu/esp32h21/include/hal/pmu_hal.h similarity index 100% rename from components/hal/esp32h21/include/hal/pmu_hal.h rename to components/esp_hal_pmu/esp32h21/include/hal/pmu_hal.h diff --git a/components/hal/esp32h21/include/hal/pmu_ll.h b/components/esp_hal_pmu/esp32h21/include/hal/pmu_ll.h similarity index 99% rename from components/hal/esp32h21/include/hal/pmu_ll.h rename to components/esp_hal_pmu/esp32h21/include/hal/pmu_ll.h index 0f6bed916a9..3a547620ddb 100644 --- a/components/hal/esp32h21/include/hal/pmu_ll.h +++ b/components/esp_hal_pmu/esp32h21/include/hal/pmu_ll.h @@ -139,7 +139,6 @@ FORCE_INLINE_ATTR void pmu_ll_hp_set_discnnt_dig_rtc(pmu_dev_t *hw, pmu_hp_mode_ hw->hp_sys[mode].bias.discnnt_dig_rtc = discnnt; } - FORCE_INLINE_ATTR void pmu_ll_hp_set_current_power_off(pmu_dev_t *hw, pmu_hp_mode_t mode, bool off) { hw->hp_sys[mode].bias.pd_cur = off; diff --git a/components/hal/esp32h21/pmu_hal.c b/components/esp_hal_pmu/esp32h21/pmu_hal.c similarity index 100% rename from components/hal/esp32h21/pmu_hal.c rename to components/esp_hal_pmu/esp32h21/pmu_hal.c diff --git a/components/hal/esp32h4/include/hal/pmu_hal.h b/components/esp_hal_pmu/esp32h4/include/hal/pmu_hal.h similarity index 100% rename from components/hal/esp32h4/include/hal/pmu_hal.h rename to components/esp_hal_pmu/esp32h4/include/hal/pmu_hal.h diff --git a/components/hal/esp32h4/include/hal/pmu_ll.h b/components/esp_hal_pmu/esp32h4/include/hal/pmu_ll.h similarity index 100% rename from components/hal/esp32h4/include/hal/pmu_ll.h rename to components/esp_hal_pmu/esp32h4/include/hal/pmu_ll.h diff --git a/components/hal/esp32h4/pmu_hal.c b/components/esp_hal_pmu/esp32h4/pmu_hal.c similarity index 100% rename from components/hal/esp32h4/pmu_hal.c rename to components/esp_hal_pmu/esp32h4/pmu_hal.c diff --git a/components/hal/esp32p4/include/hal/pmu_hal.h b/components/esp_hal_pmu/esp32p4/include/hal/pmu_hal.h similarity index 100% rename from components/hal/esp32p4/include/hal/pmu_hal.h rename to components/esp_hal_pmu/esp32p4/include/hal/pmu_hal.h diff --git a/components/hal/esp32p4/include/hal/pmu_ll.h b/components/esp_hal_pmu/esp32p4/include/hal/pmu_ll.h similarity index 99% rename from components/hal/esp32p4/include/hal/pmu_ll.h rename to components/esp_hal_pmu/esp32p4/include/hal/pmu_ll.h index 35c7629ebe9..b43ef8f40c4 100644 --- a/components/hal/esp32p4/include/hal/pmu_ll.h +++ b/components/esp_hal_pmu/esp32p4/include/hal/pmu_ll.h @@ -156,7 +156,6 @@ FORCE_INLINE_ATTR void pmu_ll_hp_set_sleep_to_active_backup_disable(pmu_dev_t *h hw->hp_sys[PMU_MODE_HP_ACTIVE].backup.hp_sleep2active_backup_en = 0; } - FORCE_INLINE_ATTR void pmu_ll_hp_set_active_to_sleep_backup_enable(pmu_dev_t *hw) { hw->hp_sys[PMU_MODE_HP_SLEEP].backup.hp_active2sleep_backup_en = 1; @@ -234,7 +233,6 @@ FORCE_INLINE_ATTR void pmu_ll_hp_set_regulator_driver_bar(pmu_dev_t *hw, pmu_hp_ hw->hp_sys[mode].regulator1.drv_b = drv_b; } - FORCE_INLINE_ATTR void pmu_ll_lp_set_regulator_slp_xpd(pmu_dev_t *hw, pmu_lp_mode_t mode, bool slp_xpd) { hw->lp_sys[mode].regulator0.slp_xpd = slp_xpd; @@ -266,7 +264,6 @@ FORCE_INLINE_ATTR void pmu_ll_lp_set_xtal_xpd(pmu_dev_t *hw, pmu_lp_mode_t mode, hw->lp_sys[mode].xtal.xpd_xtal = xpd_xtal; } - FORCE_INLINE_ATTR void pmu_ll_lp_set_dig_power(pmu_dev_t *hw, pmu_lp_mode_t mode, uint32_t flag) { hw->lp_sys[mode].dig_power.val = flag; diff --git a/components/hal/esp32p4/pmu_hal.c b/components/esp_hal_pmu/esp32p4/pmu_hal.c similarity index 100% rename from components/hal/esp32p4/pmu_hal.c rename to components/esp_hal_pmu/esp32p4/pmu_hal.c diff --git a/components/hal/esp32s2/include/hal/rtc_cntl_ll.h b/components/esp_hal_pmu/esp32s2/include/hal/rtc_cntl_ll.h similarity index 96% rename from components/hal/esp32s2/include/hal/rtc_cntl_ll.h rename to components/esp_hal_pmu/esp32s2/include/hal/rtc_cntl_ll.h index d1f1817e52b..9e5d028ad95 100644 --- a/components/hal/esp32s2/include/hal/rtc_cntl_ll.h +++ b/components/esp_hal_pmu/esp32s2/include/hal/rtc_cntl_ll.h @@ -41,10 +41,10 @@ FORCE_INLINE_ATTR void rtc_cntl_ll_ext1_set_wakeup_pins(uint32_t io_mask, uint32 REG_SET_FIELD(RTC_CNTL_EXT_WAKEUP1_REG, RTC_CNTL_EXT_WAKEUP1_SEL, io_mask); if ((io_mask & mode_mask) == io_mask) { SET_PERI_REG_BITS(RTC_CNTL_EXT_WAKEUP_CONF_REG, 0x1, - 1, RTC_CNTL_EXT_WAKEUP1_LV_S); + 1, RTC_CNTL_EXT_WAKEUP1_LV_S); } else { SET_PERI_REG_BITS(RTC_CNTL_EXT_WAKEUP_CONF_REG, 0x1, - 0, RTC_CNTL_EXT_WAKEUP1_LV_S); + 0, RTC_CNTL_EXT_WAKEUP1_LV_S); } } diff --git a/components/hal/esp32s3/include/hal/rtc_cntl_ll.h b/components/esp_hal_pmu/esp32s3/include/hal/rtc_cntl_ll.h similarity index 98% rename from components/hal/esp32s3/include/hal/rtc_cntl_ll.h rename to components/esp_hal_pmu/esp32s3/include/hal/rtc_cntl_ll.h index 027dd79d7ba..83c851eb317 100644 --- a/components/hal/esp32s3/include/hal/rtc_cntl_ll.h +++ b/components/esp_hal_pmu/esp32s3/include/hal/rtc_cntl_ll.h @@ -45,10 +45,10 @@ FORCE_INLINE_ATTR void rtc_cntl_ll_ext1_set_wakeup_pins(uint32_t io_mask, uint32 REG_SET_FIELD(RTC_CNTL_EXT_WAKEUP1_REG, RTC_CNTL_EXT_WAKEUP1_SEL, io_mask); if ((io_mask & mode_mask) == io_mask) { SET_PERI_REG_BITS(RTC_CNTL_EXT_WAKEUP_CONF_REG, 0x1, - 1, RTC_CNTL_EXT_WAKEUP1_LV_S); + 1, RTC_CNTL_EXT_WAKEUP1_LV_S); } else { SET_PERI_REG_BITS(RTC_CNTL_EXT_WAKEUP_CONF_REG, 0x1, - 0, RTC_CNTL_EXT_WAKEUP1_LV_S); + 0, RTC_CNTL_EXT_WAKEUP1_LV_S); } } diff --git a/components/hal/esp32s3/rtc_cntl_hal.c b/components/esp_hal_pmu/esp32s3/rtc_cntl_hal.c similarity index 89% rename from components/hal/esp32s3/rtc_cntl_hal.c rename to components/esp_hal_pmu/esp32s3/rtc_cntl_hal.c index 94c74908b7c..42ce5eca073 100644 --- a/components/hal/esp32s3/rtc_cntl_hal.c +++ b/components/esp_hal_pmu/esp32s3/rtc_cntl_hal.c @@ -62,10 +62,10 @@ void rtc_cntl_hal_enable_cpu_retention(void *addr) rtc_cntl_ll_set_cpu_retention_link_addr((uint32_t)plink); rtc_cntl_ll_config_cpu_retention_timing( - DEFAULT_RETENTION_WAIT_CYCLES, - DEFAULT_RETENTION_CLKOFF_WAIT_CYCLES, - DEFAULT_RETENTION_DONE_WAIT_CYCLES - ); + DEFAULT_RETENTION_WAIT_CYCLES, + DEFAULT_RETENTION_CLKOFF_WAIT_CYCLES, + DEFAULT_RETENTION_DONE_WAIT_CYCLES + ); rtc_cntl_ll_enable_cpu_retention_clock(); rtc_cntl_ll_enable_cpu_retention(); #if SOC_PM_SUPPORT_TAGMEM_PD @@ -119,17 +119,17 @@ void rtc_cntl_hal_enable_tagmem_retention(void *addr) rtc_cntl_ll_enable_tagmem_retention(); if (retent->tagmem.icache.enable) { rtc_cntl_ll_enable_icache_tagmem_retention( - retent->tagmem.icache.start_point, - retent->tagmem.icache.vld_size, - retent->tagmem.icache.size - ); + retent->tagmem.icache.start_point, + retent->tagmem.icache.vld_size, + retent->tagmem.icache.size + ); } if (retent->tagmem.dcache.enable) { rtc_cntl_ll_enable_dcache_tagmem_retention( - retent->tagmem.dcache.start_point, - retent->tagmem.dcache.vld_size, - retent->tagmem.dcache.size - ); + retent->tagmem.dcache.start_point, + retent->tagmem.dcache.vld_size, + retent->tagmem.dcache.size + ); } } } diff --git a/components/esp_hal_pmu/esp32s31/include/hal/pmu_hal.h b/components/esp_hal_pmu/esp32s31/include/hal/pmu_hal.h new file mode 100644 index 00000000000..310e1e5d2d8 --- /dev/null +++ b/components/esp_hal_pmu/esp32s31/include/hal/pmu_hal.h @@ -0,0 +1,23 @@ +/* + * SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ + +// The HAL layer for PMU + +#pragma once + +#include "soc/soc_caps.h" +#include "hal/pmu_ll.h" +#include "hal/pmu_types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +// TODO: ["ESP32S31"] IDF-14653 + +#ifdef __cplusplus +} +#endif diff --git a/components/esp_hal_pmu/esp32s31/include/hal/pmu_ll.h b/components/esp_hal_pmu/esp32s31/include/hal/pmu_ll.h new file mode 100644 index 00000000000..df367ee7acb --- /dev/null +++ b/components/esp_hal_pmu/esp32s31/include/hal/pmu_ll.h @@ -0,0 +1,29 @@ +/* + * SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ + +// The LL layer for ESP32-S31 PMU register operations + +#pragma once + +#include +#include +#include "soc/soc.h" +#include "esp_attr.h" +#include "hal/assert.h" +#include "soc/pmu_struct.h" +#include "hal/pmu_types.h" +#include "hal/misc.h" +#include "hal/config.h" + +#ifdef __cplusplus +extern "C" { +#endif + +// TODO: ["ESP32S31"] IDF-14653 + +#ifdef __cplusplus +} +#endif diff --git a/components/esp_hal_pmu/esp32s31/pmu_hal.c b/components/esp_hal_pmu/esp32s31/pmu_hal.c new file mode 100644 index 00000000000..260f27086e7 --- /dev/null +++ b/components/esp_hal_pmu/esp32s31/pmu_hal.c @@ -0,0 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ + +// The HAL layer for PMU (ESP32-S31 specific part) + +// TODO: ["ESP32S31"] IDF-14653 diff --git a/components/hal/include/hal/pmu_types.h b/components/esp_hal_pmu/include/hal/pmu_types.h similarity index 100% rename from components/hal/include/hal/pmu_types.h rename to components/esp_hal_pmu/include/hal/pmu_types.h diff --git a/components/hal/include/hal/rtc_hal.h b/components/esp_hal_pmu/include/hal/rtc_hal.h similarity index 100% rename from components/hal/include/hal/rtc_hal.h rename to components/esp_hal_pmu/include/hal/rtc_hal.h diff --git a/components/esp_hal_pmu/linker.lf b/components/esp_hal_pmu/linker.lf new file mode 100644 index 00000000000..68cf8a27200 --- /dev/null +++ b/components/esp_hal_pmu/linker.lf @@ -0,0 +1,5 @@ +[mapping:esp_hal_pmu] +archive: libesp_hal_pmu.a +entries: + if SOC_PMU_SUPPORTED = y: + pmu_hal (noflash) diff --git a/components/esp_hw_support/CMakeLists.txt b/components/esp_hw_support/CMakeLists.txt index 2df8c2553f4..23b8e5a240f 100644 --- a/components/esp_hw_support/CMakeLists.txt +++ b/components/esp_hw_support/CMakeLists.txt @@ -9,7 +9,7 @@ if(${target} STREQUAL "linux") return() endif() -set(requires esp_hal_dma esp_hal_gpio esp_hal_usb) +set(requires esp_hal_dma esp_hal_gpio esp_hal_usb esp_hal_pmu) # only esp_hw_support/adc_share_hw_ctrl.c requires efuse component set(priv_requires efuse spi_flash bootloader_support esp_hal_wdt) diff --git a/components/esp_pm/linker.lf b/components/esp_pm/linker.lf index 07237e3d968..02855c31d5a 100644 --- a/components/esp_pm/linker.lf +++ b/components/esp_pm/linker.lf @@ -81,14 +81,18 @@ entries: esp_time_impl:esp_time_impl_get_boot_time (noflash) esp_time_impl:esp_set_time_from_rtc (noflash) -[mapping:hal_pm] -archive: libhal.a +[mapping:esp_hal_pmu_pm] +archive: libesp_hal_pmu.a entries: if SOC_PM_CPU_RETENTION_BY_RTCCNTL = y: if PM_SLP_IRAM_OPT = y && PM_POWER_DOWN_CPU_IN_LIGHT_SLEEP = y: rtc_cntl_hal:rtc_cntl_hal_enable_cpu_retention (noflash) if PM_SLP_IRAM_OPT = y && PM_RESTORE_CACHE_TAGMEM_AFTER_LIGHT_SLEEP = y: rtc_cntl_hal:rtc_cntl_hal_enable_tagmem_retention (noflash) + +[mapping:hal_pm] +archive: libhal.a +entries: if SOC_TEMP_SENSOR_SUPPORTED = y: if PM_SLP_IRAM_OPT = y: temperature_sensor_hal:temperature_sensor_hal_get_raw_value (noflash) diff --git a/components/hal/CMakeLists.txt b/components/hal/CMakeLists.txt index 35b6b3bc985..368c8d984bf 100644 --- a/components/hal/CMakeLists.txt +++ b/components/hal/CMakeLists.txt @@ -140,10 +140,6 @@ elseif(NOT BOOTLOADER_BUILD) list(APPEND srcs "sdio_slave_hal.c") endif() - if(CONFIG_SOC_PMU_SUPPORTED) - list(APPEND srcs "${target}/pmu_hal.c") - endif() - if(CONFIG_SOC_APM_SUPPORTED) list(APPEND srcs "apm_hal.c") endif() @@ -161,11 +157,6 @@ elseif(NOT BOOTLOADER_BUILD) if(CONFIG_SOC_TEMP_SENSOR_SUPPORTED) list(APPEND srcs "temperature_sensor_hal.c") endif() - - if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/${target}/rtc_cntl_hal.c") - list(APPEND srcs "${target}/rtc_cntl_hal.c") - endif() - endif() idf_component_register(SRCS ${srcs} diff --git a/components/hal/linker.lf b/components/hal/linker.lf index c9116c144ce..ae63d55e2e6 100644 --- a/components/hal/linker.lf +++ b/components/hal/linker.lf @@ -9,5 +9,3 @@ entries: cache_hal (noflash) if SOC_SYSTIMER_SUPPORTED = y && HAL_SYSTIMER_USE_ROM_IMPL = n: systimer_hal (noflash) - if SOC_PMU_SUPPORTED = y: - pmu_hal (noflash) diff --git a/components/ulp/CMakeLists.txt b/components/ulp/CMakeLists.txt index 41ee4bbd5f9..c9098f9a808 100644 --- a/components/ulp/CMakeLists.txt +++ b/components/ulp/CMakeLists.txt @@ -97,5 +97,6 @@ endif() idf_component_register( SRCS ${srcs} INCLUDE_DIRS ${includes} - REQUIRES esp_adc esp_driver_gpio esp_driver_uart esp_driver_i2s esp_hal_i2c esp_hal_touch_sens esp_hal_gpspi + REQUIRES esp_adc esp_driver_gpio esp_driver_uart esp_driver_i2s + esp_hal_i2c esp_hal_touch_sens esp_hal_gpspi esp_hal_pmu ) diff --git a/tools/test_apps/system/g1_components/CMakeLists.txt b/tools/test_apps/system/g1_components/CMakeLists.txt index f0774c2f347..d902b0184f0 100644 --- a/tools/test_apps/system/g1_components/CMakeLists.txt +++ b/tools/test_apps/system/g1_components/CMakeLists.txt @@ -21,6 +21,7 @@ set(esp_hal_components esp_hal_usb esp_hal_wdt esp_hal_gpspi + esp_hal_pmu ) set(COMPONENTS ${g0_components} ${g1_components} ${esp_hal_components} main) From af70253507b885b8e6b24cc98a43637b41b6a103 Mon Sep 17 00:00:00 2001 From: wuzhenghui Date: Mon, 22 Dec 2025 16:03:27 +0800 Subject: [PATCH 2/2] feat(esp_hal_pmu): move pau_hal driver into esp_hal_pmu component --- components/esp_hal_pmu/CMakeLists.txt | 5 +++++ components/esp_hal_pmu/README.md | 16 +++++++++++++--- .../esp32c5/include/hal/pau_ll.h | 1 - .../{hal => esp_hal_pmu}/esp32c5/pau_hal.c | 0 .../esp32c6/include/hal/pau_ll.h | 0 .../{hal => esp_hal_pmu}/esp32c6/pau_hal.c | 0 .../esp32c61/include/hal/pau_ll.h | 0 .../{hal => esp_hal_pmu}/esp32c61/pau_hal.c | 0 .../esp32h2/include/hal/pau_ll.h | 0 .../{hal => esp_hal_pmu}/esp32h2/pau_hal.c | 0 .../esp32h21/include/hal/pau_ll.h | 0 .../{hal => esp_hal_pmu}/esp32h21/pau_hal.c | 0 .../esp32h4/include/hal/pau_ll.h | 0 .../{hal => esp_hal_pmu}/esp32h4/pau_hal.c | 0 .../esp32p4/include/hal/pau_ll.h | 0 .../{hal => esp_hal_pmu}/esp32p4/pau_hal.c | 0 .../{hal => esp_hal_pmu}/include/hal/pau_hal.h | 1 - .../{hal => esp_hal_pmu}/include/hal/pau_types.h | 0 components/hal/CMakeLists.txt | 4 ---- 19 files changed, 18 insertions(+), 9 deletions(-) rename components/{hal => esp_hal_pmu}/esp32c5/include/hal/pau_ll.h (99%) rename components/{hal => esp_hal_pmu}/esp32c5/pau_hal.c (100%) rename components/{hal => esp_hal_pmu}/esp32c6/include/hal/pau_ll.h (100%) rename components/{hal => esp_hal_pmu}/esp32c6/pau_hal.c (100%) rename components/{hal => esp_hal_pmu}/esp32c61/include/hal/pau_ll.h (100%) rename components/{hal => esp_hal_pmu}/esp32c61/pau_hal.c (100%) rename components/{hal => esp_hal_pmu}/esp32h2/include/hal/pau_ll.h (100%) rename components/{hal => esp_hal_pmu}/esp32h2/pau_hal.c (100%) rename components/{hal => esp_hal_pmu}/esp32h21/include/hal/pau_ll.h (100%) rename components/{hal => esp_hal_pmu}/esp32h21/pau_hal.c (100%) rename components/{hal => esp_hal_pmu}/esp32h4/include/hal/pau_ll.h (100%) rename components/{hal => esp_hal_pmu}/esp32h4/pau_hal.c (100%) rename components/{hal => esp_hal_pmu}/esp32p4/include/hal/pau_ll.h (100%) rename components/{hal => esp_hal_pmu}/esp32p4/pau_hal.c (100%) rename components/{hal => esp_hal_pmu}/include/hal/pau_hal.h (99%) rename components/{hal => esp_hal_pmu}/include/hal/pau_types.h (100%) diff --git a/components/esp_hal_pmu/CMakeLists.txt b/components/esp_hal_pmu/CMakeLists.txt index 875d338cf96..75f9e18bb95 100644 --- a/components/esp_hal_pmu/CMakeLists.txt +++ b/components/esp_hal_pmu/CMakeLists.txt @@ -16,6 +16,11 @@ if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/${target}/rtc_cntl_hal.c") list(APPEND srcs "${target}/rtc_cntl_hal.c") endif() +# Chips with PAU (Power Assist Unit) peripheral +if(CONFIG_SOC_PAU_SUPPORTED) + list(APPEND srcs "${target}/pau_hal.c") +endif() + idf_component_register(SRCS ${srcs} INCLUDE_DIRS ${public_include} REQUIRES soc hal esp_rom diff --git a/components/esp_hal_pmu/README.md b/components/esp_hal_pmu/README.md index 090030970d2..b9912eda538 100644 --- a/components/esp_hal_pmu/README.md +++ b/components/esp_hal_pmu/README.md @@ -7,21 +7,23 @@ The `esp_hal_pmu` component provides a **Hardware Abstraction Layer** for Power Management Unit (PMU) and legacy RTC Control (RTC_CNTL) peripherals across ESP-IDF supported targets. This HAL enables unified power management operations including sleep mode control, power domain management, wakeup configuration, and retention control across different ESP chip families. -The component consolidates power management functionality from two different peripheral implementations: +The component consolidates power management functionality from three different peripheral implementations: - **PMU**: Modern power management unit in newer ESP chips - **RTC_CNTL**: Legacy RTC control peripheral in older ESP chips +- **PAU**: Power Assist Unit for register retention and backup/restore operations ## Architecture The HAL architecture consists of two primary layers: -1. **HAL Layer (Upper)**: Defines the operational sequences and data structures required to interact with PMU/RTC_CNTL peripherals, including: +1. **HAL Layer (Upper)**: Defines the operational sequences and data structures required to interact with PMU/RTC_CNTL/PAU peripherals, including: - Power domain configuration and control - Sleep mode management - Wakeup source configuration - Retention control (CPU, tagmem) - Power-up/down wait cycle configuration - Backup enable/disable operations + - REGDMA link configuration and control 2. **Low-Level Layer (Bottom)**: Acts as a translation layer between the HAL and the register definitions in the `soc` component, handling: - Register access abstractions @@ -53,10 +55,18 @@ The HAL architecture consists of two primary layers: - Sleep-to-modem backup enable/disable - Modem-to-active backup enable/disable +### REGDMA (Register DMA) Support +- REGDMA entry link address configuration +- REGDMA modem link control (backup/restore) +- REGDMA system link control +- REGDMA extra link control +- REGDMA timeout configuration +- REGDMA clock configuration + ## Usage This component is primarily used by ESP-IDF system services such as: - **esp_pm**: Power management framework -- **esp_hw_support**: Hardware support layer for sleep modes and power management +- **esp_hw_support**: Hardware support layer for sleep modes, power management, and register retention - **ulp**: Ultra-low-power coprocessor support For advanced developers implementing custom power management solutions, the HAL functions can be used directly. However, please note that the interfaces provided by this component are internal to ESP-IDF and are subject to change. diff --git a/components/hal/esp32c5/include/hal/pau_ll.h b/components/esp_hal_pmu/esp32c5/include/hal/pau_ll.h similarity index 99% rename from components/hal/esp32c5/include/hal/pau_ll.h rename to components/esp_hal_pmu/esp32c5/include/hal/pau_ll.h index 8235ddf0fdd..877bb992b46 100644 --- a/components/hal/esp32c5/include/hal/pau_ll.h +++ b/components/esp_hal_pmu/esp32c5/include/hal/pau_ll.h @@ -104,7 +104,6 @@ static inline void pau_ll_clear_regdma_backup_error_intr_state(pau_dev_t *dev) dev->int_clr.val = 0x2; } - /** * @brief Set the maximum number of linked lists supported by REGDMA * @param count: the maximum number of regdma link diff --git a/components/hal/esp32c5/pau_hal.c b/components/esp_hal_pmu/esp32c5/pau_hal.c similarity index 100% rename from components/hal/esp32c5/pau_hal.c rename to components/esp_hal_pmu/esp32c5/pau_hal.c diff --git a/components/hal/esp32c6/include/hal/pau_ll.h b/components/esp_hal_pmu/esp32c6/include/hal/pau_ll.h similarity index 100% rename from components/hal/esp32c6/include/hal/pau_ll.h rename to components/esp_hal_pmu/esp32c6/include/hal/pau_ll.h diff --git a/components/hal/esp32c6/pau_hal.c b/components/esp_hal_pmu/esp32c6/pau_hal.c similarity index 100% rename from components/hal/esp32c6/pau_hal.c rename to components/esp_hal_pmu/esp32c6/pau_hal.c diff --git a/components/hal/esp32c61/include/hal/pau_ll.h b/components/esp_hal_pmu/esp32c61/include/hal/pau_ll.h similarity index 100% rename from components/hal/esp32c61/include/hal/pau_ll.h rename to components/esp_hal_pmu/esp32c61/include/hal/pau_ll.h diff --git a/components/hal/esp32c61/pau_hal.c b/components/esp_hal_pmu/esp32c61/pau_hal.c similarity index 100% rename from components/hal/esp32c61/pau_hal.c rename to components/esp_hal_pmu/esp32c61/pau_hal.c diff --git a/components/hal/esp32h2/include/hal/pau_ll.h b/components/esp_hal_pmu/esp32h2/include/hal/pau_ll.h similarity index 100% rename from components/hal/esp32h2/include/hal/pau_ll.h rename to components/esp_hal_pmu/esp32h2/include/hal/pau_ll.h diff --git a/components/hal/esp32h2/pau_hal.c b/components/esp_hal_pmu/esp32h2/pau_hal.c similarity index 100% rename from components/hal/esp32h2/pau_hal.c rename to components/esp_hal_pmu/esp32h2/pau_hal.c diff --git a/components/hal/esp32h21/include/hal/pau_ll.h b/components/esp_hal_pmu/esp32h21/include/hal/pau_ll.h similarity index 100% rename from components/hal/esp32h21/include/hal/pau_ll.h rename to components/esp_hal_pmu/esp32h21/include/hal/pau_ll.h diff --git a/components/hal/esp32h21/pau_hal.c b/components/esp_hal_pmu/esp32h21/pau_hal.c similarity index 100% rename from components/hal/esp32h21/pau_hal.c rename to components/esp_hal_pmu/esp32h21/pau_hal.c diff --git a/components/hal/esp32h4/include/hal/pau_ll.h b/components/esp_hal_pmu/esp32h4/include/hal/pau_ll.h similarity index 100% rename from components/hal/esp32h4/include/hal/pau_ll.h rename to components/esp_hal_pmu/esp32h4/include/hal/pau_ll.h diff --git a/components/hal/esp32h4/pau_hal.c b/components/esp_hal_pmu/esp32h4/pau_hal.c similarity index 100% rename from components/hal/esp32h4/pau_hal.c rename to components/esp_hal_pmu/esp32h4/pau_hal.c diff --git a/components/hal/esp32p4/include/hal/pau_ll.h b/components/esp_hal_pmu/esp32p4/include/hal/pau_ll.h similarity index 100% rename from components/hal/esp32p4/include/hal/pau_ll.h rename to components/esp_hal_pmu/esp32p4/include/hal/pau_ll.h diff --git a/components/hal/esp32p4/pau_hal.c b/components/esp_hal_pmu/esp32p4/pau_hal.c similarity index 100% rename from components/hal/esp32p4/pau_hal.c rename to components/esp_hal_pmu/esp32p4/pau_hal.c diff --git a/components/hal/include/hal/pau_hal.h b/components/esp_hal_pmu/include/hal/pau_hal.h similarity index 99% rename from components/hal/include/hal/pau_hal.h rename to components/esp_hal_pmu/include/hal/pau_hal.h index 5311e6bc617..522889a85b6 100644 --- a/components/hal/include/hal/pau_hal.h +++ b/components/esp_hal_pmu/include/hal/pau_hal.h @@ -17,7 +17,6 @@ extern "C" { #include "hal/pau_ll.h" #include "hal/pau_types.h" - typedef struct { pau_dev_t *dev; } pau_hal_context_t; diff --git a/components/hal/include/hal/pau_types.h b/components/esp_hal_pmu/include/hal/pau_types.h similarity index 100% rename from components/hal/include/hal/pau_types.h rename to components/esp_hal_pmu/include/hal/pau_types.h diff --git a/components/hal/CMakeLists.txt b/components/hal/CMakeLists.txt index 368c8d984bf..60c3356a424 100644 --- a/components/hal/CMakeLists.txt +++ b/components/hal/CMakeLists.txt @@ -120,10 +120,6 @@ elseif(NOT BOOTLOADER_BUILD) list(APPEND srcs "${target}/modem_clock_hal.c") endif() - if(CONFIG_SOC_PAU_SUPPORTED) - list(APPEND srcs "${target}/pau_hal.c") - endif() - if(CONFIG_SOC_BOD_SUPPORTED) list(APPEND srcs "brownout_hal.c") endif()