diff --git a/components/esp_hw_support/CMakeLists.txt b/components/esp_hw_support/CMakeLists.txt index e6ad10abd1..9eccf90b55 100644 --- a/components/esp_hw_support/CMakeLists.txt +++ b/components/esp_hw_support/CMakeLists.txt @@ -38,7 +38,7 @@ if(NOT BOOTLOADER_BUILD) endif() if(CONFIG_SOC_PAU_SUPPORTED) - list(APPEND srcs "sleep_retention.c" "sleep_peripheral.c" "sleep_clock.c") + list(APPEND srcs "sleep_retention.c" "sleep_system_peripheral.c" "sleep_clock.c") endif() # [refactor-todo]: requires "driver" for GPIO and RTC (by sleep_gpio and sleep_modes) diff --git a/components/esp_hw_support/include/esp_private/sleep_peripheral.h b/components/esp_hw_support/include/esp_private/sleep_sys_periph.h similarity index 87% rename from components/esp_hw_support/include/esp_private/sleep_peripheral.h rename to components/esp_hw_support/include/esp_private/sleep_sys_periph.h index 5c16a5110a..ee4af519ce 100644 --- a/components/esp_hw_support/include/esp_private/sleep_peripheral.h +++ b/components/esp_hw_support/include/esp_private/sleep_sys_periph.h @@ -14,7 +14,7 @@ extern "C" { #endif /** - * @file sleep_peripheral.h + * @file sleep_sys_periph.h * * This file contains declarations of digital peripheral retention related functions in light sleep mode. */ @@ -30,13 +30,13 @@ extern "C" { bool peripheral_domain_pd_allowed(void); /** - * @brief Digital peripheral power down initialize\ + * @brief Digital peripheral power down initialize * * @return ESP_OK on success * ESP_ERR_INVALID_ARG on invalid sleep_retention_entries_create args * No memory for the retention link */ -void sleep_peripheral_retention_init(void); +void sleep_sys_periph_retention_init(void); #ifdef __cplusplus } diff --git a/components/esp_hw_support/sleep_modes.c b/components/esp_hw_support/sleep_modes.c index d2f36ee43a..5701d898e2 100644 --- a/components/esp_hw_support/sleep_modes.c +++ b/components/esp_hw_support/sleep_modes.c @@ -78,7 +78,7 @@ #include "esp32c6/rom/rtc.h" #include "hal/lp_timer_hal.h" #include "esp_private/esp_pmu.h" -#include "esp_private/sleep_peripheral.h" +#include "esp_private/sleep_sys_periph.h" #include "esp_private/sleep_clock.h" #elif CONFIG_IDF_TARGET_ESP32H2 #include "esp32h2/rom/rtc.h" diff --git a/components/esp_hw_support/sleep_peripheral.c b/components/esp_hw_support/sleep_system_peripheral.c similarity index 93% rename from components/esp_hw_support/sleep_peripheral.c rename to components/esp_hw_support/sleep_system_peripheral.c index 6448f2dae7..f98d0719ba 100644 --- a/components/esp_hw_support/sleep_peripheral.c +++ b/components/esp_hw_support/sleep_system_peripheral.c @@ -29,11 +29,11 @@ #include "soc/io_mux_reg.h" #include "soc/interrupt_matrix_reg.h" -static __attribute__((unused)) const char *TAG = "sleep_peripheral"; +static __attribute__((unused)) const char *TAG = "sleep_sys_periph"; #define SLEEP_RETENTION_PERIPHERALS_PRIORITY_DEFAULT (REGDMA_LINK_PRI_6) -esp_err_t sleep_peripheral_intr_matrix_retention_init(void) +esp_err_t sleep_sys_periph_intr_matrix_retention_init(void) { #define N_REGS_INTR_MATRIX() (((INTMTX_CORE0_CLOCK_GATE_REG - DR_REG_INTERRUPT_MATRIX_BASE) / 4) + 1) @@ -47,7 +47,7 @@ esp_err_t sleep_peripheral_intr_matrix_retention_init(void) return ESP_OK; } -esp_err_t sleep_peripheral_hp_system_retention_init(void) +esp_err_t sleep_sys_periph_hp_system_retention_init(void) { #define N_REGS_HP_SYSTEM() (((HP_SYSTEM_MEM_TEST_CONF_REG - DR_REG_HP_SYSTEM_BASE) / 4) + 1) @@ -61,14 +61,14 @@ esp_err_t sleep_peripheral_hp_system_retention_init(void) return ESP_OK; } -esp_err_t sleep_peripheral_tee_apm_retention_init(void) +esp_err_t sleep_sys_periph_tee_apm_retention_init(void) { #define N_REGS_TEE() (((TEE_CLOCK_GATE_REG - DR_REG_TEE_BASE) / 4) + 1) #define N_REGS_APM() (((HP_APM_CLOCK_GATE_REG - DR_REG_HP_APM_BASE) / 4) + 1) const static sleep_retention_entries_config_t tee_apm_regs_retention[] = { [0] = { .config = REGDMA_LINK_CONTINUOUS_INIT(REGDMA_TEEAPM_LINK(0), DR_REG_TEE_BASE, DR_REG_TEE_BASE, N_REGS_TEE(), 0, 0), .owner = ENTRY(0) | ENTRY(2) }, /* tee */ - [1] = { .config = REGDMA_LINK_CONTINUOUS_INIT(REGDMA_TEEAPM_LINK(0), DR_REG_HP_APM_BASE, DR_REG_HP_APM_BASE, N_REGS_APM(), 0, 0), .owner = ENTRY(0) | ENTRY(2) } /* apm */ + [1] = { .config = REGDMA_LINK_CONTINUOUS_INIT(REGDMA_TEEAPM_LINK(1), DR_REG_HP_APM_BASE, DR_REG_HP_APM_BASE, N_REGS_APM(), 0, 0), .owner = ENTRY(0) | ENTRY(2) } /* apm */ }; esp_err_t err = sleep_retention_entries_create(tee_apm_regs_retention, ARRAY_SIZE(tee_apm_regs_retention), REGDMA_LINK_PRI_4, SLEEP_RETENTION_MODULE_TEE_APM); @@ -77,7 +77,7 @@ esp_err_t sleep_peripheral_tee_apm_retention_init(void) return ESP_OK; } -esp_err_t sleep_peripheral_uart0_retention_init(void) +esp_err_t sleep_sys_periph_uart0_retention_init(void) { #define N_REGS_UART() (((UART_ID_REG(0) - REG_UART_BASE(0)) / 4) + 1) @@ -94,7 +94,7 @@ esp_err_t sleep_peripheral_uart0_retention_init(void) return ESP_OK; } -esp_err_t sleep_peripheral_tg0_retention_init(void) +esp_err_t sleep_sys_periph_tg0_retention_init(void) { #define N_REGS_TG() (((TIMG_REGCLK_REG(0) - REG_TIMG_BASE(0)) / 4) + 1) @@ -116,7 +116,7 @@ esp_err_t sleep_peripheral_tg0_retention_init(void) return ESP_OK; } -esp_err_t sleep_peripheral_iomux_retention_init(void) +esp_err_t sleep_sys_periph_iomux_retention_init(void) { #define N_REGS_IOMUX_0() (((PERIPHS_IO_MUX_SPID_U - REG_IO_MUX_BASE) / 4) + 1) #define N_REGS_IOMUX_1() (((GPIO_FUNC34_OUT_SEL_CFG_REG - GPIO_FUNC0_OUT_SEL_CFG_REG) / 4) + 1) @@ -136,7 +136,7 @@ esp_err_t sleep_peripheral_iomux_retention_init(void) return ESP_OK; } -esp_err_t sleep_peripheral_spimem_retention_init(void) +esp_err_t sleep_sys_periph_spimem_retention_init(void) { #define N_REGS_SPI1_MEM_0() (((SPI_MEM_SPI_SMEM_DDR_REG(1) - REG_SPI_MEM_BASE(1)) / 4) + 1) #define N_REGS_SPI1_MEM_1() (((SPI_MEM_SPI_SMEM_AC_REG(1) - SPI_MEM_SPI_FMEM_PMS0_ATTR_REG(1)) / 4) + 1) @@ -168,7 +168,7 @@ esp_err_t sleep_peripheral_spimem_retention_init(void) return ESP_OK; } -esp_err_t sleep_peripheral_systimer_retention_init(void) +esp_err_t sleep_sys_periph_systimer_retention_init(void) { #define N_REGS_SYSTIMER_0() (((SYSTIMER_TARGET2_CONF_REG - SYSTIMER_TARGET0_HI_REG) / 4) + 1) @@ -207,24 +207,24 @@ esp_err_t sleep_peripheral_systimer_retention_init(void) return ESP_OK; } -esp_err_t sleep_peripheral_retention_init(void) +esp_err_t sleep_sys_periph_retention_init(void) { esp_err_t err; - err = sleep_peripheral_intr_matrix_retention_init(); + err = sleep_sys_periph_intr_matrix_retention_init(); if(err) goto error; - err = sleep_peripheral_hp_system_retention_init(); + err = sleep_sys_periph_hp_system_retention_init(); if(err) goto error; - err = sleep_peripheral_tee_apm_retention_init(); + err = sleep_sys_periph_tee_apm_retention_init(); if(err) goto error; - err = sleep_peripheral_uart0_retention_init(); + err = sleep_sys_periph_uart0_retention_init(); if(err) goto error; - err = sleep_peripheral_tg0_retention_init(); + err = sleep_sys_periph_tg0_retention_init(); if(err) goto error; - err = sleep_peripheral_iomux_retention_init(); + err = sleep_sys_periph_iomux_retention_init(); if(err) goto error; - err = sleep_peripheral_spimem_retention_init(); + err = sleep_sys_periph_spimem_retention_init(); if(err) goto error; - err = sleep_peripheral_systimer_retention_init(); + err = sleep_sys_periph_systimer_retention_init(); error: return err; @@ -246,9 +246,9 @@ bool IRAM_ATTR peripheral_domain_pd_allowed(void) } #if CONFIG_PM_POWER_DOWN_PERIPHERAL_IN_LIGHT_SLEEP -ESP_SYSTEM_INIT_FN(sleep_peripheral_startup_init, BIT(0), 107) +ESP_SYSTEM_INIT_FN(sleep_sys_periph_startup_init, BIT(0), 107) { - sleep_peripheral_retention_init(); + sleep_sys_periph_retention_init(); return ESP_OK; } #endif diff --git a/components/esp_system/system_init_fn.txt b/components/esp_system/system_init_fn.txt index 1b699c3fa8..2f8557962a 100644 --- a/components/esp_system/system_init_fn.txt +++ b/components/esp_system/system_init_fn.txt @@ -19,7 +19,7 @@ # esp_sleep doesn't have init dependencies 105: esp_sleep_startup_init in components/esp_hw_support/sleep_gpio.c on BIT(0) 106: sleep_clock_startup_init in components/esp_hw_support/sleep_clock.c on BIT(0) -107: sleep_peripheral_startup_init in components/esp_hw_support/sleep_peripheral.c on BIT(0) +107: sleep_sys_periph_startup_init in components/esp_hw_support/sleep_system_peripheral.c on BIT(0) # app_trace has to be initialized before systemview 115: esp_apptrace_init in components/app_trace/app_trace.c on ESP_SYSTEM_INIT_ALL_CORES diff --git a/examples/wifi/itwt/main/itwt.c b/examples/wifi/itwt/main/itwt.c index 77c51b41c4..5d2488882b 100644 --- a/examples/wifi/itwt/main/itwt.c +++ b/examples/wifi/itwt/main/itwt.c @@ -250,7 +250,7 @@ void app_main(void) #if CONFIG_PM_ENABLE && 0 sleep_clock_system_retention_init(); sleep_clock_modem_retention_init(); - sleep_peripheral_retention_init(); + sleep_sys_periph_retention_init(); sleep_modem_wifi_modem_state_init(); // Configure dynamic frequency scaling: