Skip to content

Commit

Permalink
Merge branch 'refactor/pm_use_unified_esp_pm_config_t' into 'master'
Browse files Browse the repository at this point in the history
pm: refactor pm codes to use unified esp_pm_config_t

See merge request espressif/esp-idf!22472
  • Loading branch information
Jing Li committed Feb 24, 2023
2 parents c2f9392 + 3a648e8 commit a529771
Show file tree
Hide file tree
Showing 57 changed files with 81 additions and 1,034 deletions.
1 change: 1 addition & 0 deletions components/esp_hw_support/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ if(NOT BOOTLOADER_BUILD)
"adc_share_hw_ctrl.c" # TODO: IDF-6215
"sleep_cpu.c" # TODO: IDF-6267
"sleep_modes.c" # TODO: IDF-6267
"sleep_wake_stub.c" # TODO: IDF-6267
)
endif()
else()
Expand Down
1 change: 0 additions & 1 deletion components/esp_hw_support/linker.lf
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ entries:
if SOC_CONFIGURABLE_VDDSDIO_SUPPORTED:
rtc_init:rtc_vddsdio_set_config (noflash)
if IDF_TARGET_ESP32C6 = n && IDF_TARGET_ESP32H2 = n: # TODO: IDF-5645
rtc_pm (noflash_text)
rtc_sleep (noflash_text)
rtc_time (noflash_text)
if SOC_PMU_SUPPORTED = y:
Expand Down
1 change: 0 additions & 1 deletion components/esp_hw_support/port/esp32/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ set(srcs
"rtc_clk.c"
"rtc_clk_init.c"
"rtc_init.c"
"rtc_pm.c"
"rtc_sleep.c"
"rtc_time.c"
"chip_info.c")
Expand Down
58 changes: 0 additions & 58 deletions components/esp_hw_support/port/esp32/rtc_pm.c

This file was deleted.

5 changes: 0 additions & 5 deletions components/esp_hw_support/port/esp32/rtc_sleep.c
Original file line number Diff line number Diff line change
Expand Up @@ -241,11 +241,6 @@ void rtc_sleep_low_init(uint32_t slowclk_period)
REG_SET_FIELD(RTC_CNTL_TIMER1_REG, RTC_CNTL_CK8M_WAIT, RTC_CNTL_CK8M_WAIT_SLP_CYCLES);
}

void rtc_sleep_set_wakeup_time(uint64_t t)
{
rtc_cntl_ll_set_wakeup_timer(t);
}

/* Read back 'reject' status when waking from light or deep sleep */
static uint32_t rtc_sleep_finish(void);

Expand Down
1 change: 0 additions & 1 deletion components/esp_hw_support/port/esp32c2/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
set(srcs "rtc_clk_init.c"
"rtc_clk.c"
"rtc_init.c"
"rtc_pm.c"
"rtc_sleep.c"
"rtc_time.c"
"chip_info.c")
Expand Down
57 changes: 0 additions & 57 deletions components/esp_hw_support/port/esp32c2/rtc_pm.c

This file was deleted.

6 changes: 0 additions & 6 deletions components/esp_hw_support/port/esp32c2/rtc_sleep.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,6 @@ void rtc_sleep_low_init(uint32_t slowclk_period)
REG_SET_FIELD(RTC_CNTL_TIMER1_REG, RTC_CNTL_CK8M_WAIT, RTC_CNTL_CK8M_WAIT_SLP_CYCLES);
}

void rtc_sleep_set_wakeup_time(uint64_t t)
{
WRITE_PERI_REG(RTC_CNTL_SLP_TIMER0_REG, t & UINT32_MAX);
WRITE_PERI_REG(RTC_CNTL_SLP_TIMER1_REG, t >> 32);
}

static uint32_t rtc_sleep_finish(uint32_t lslp_mem_inf_fpu);

uint32_t rtc_sleep_start(uint32_t wakeup_opt, uint32_t reject_opt, uint32_t lslp_mem_inf_fpu)
Expand Down
17 changes: 0 additions & 17 deletions components/esp_hw_support/port/esp32c2/rtc_time.c
Original file line number Diff line number Diff line change
Expand Up @@ -170,23 +170,6 @@ uint64_t rtc_time_get(void)
return rtc_cntl_ll_get_rtc_time();
}

uint64_t rtc_light_slp_time_get(void)
{
uint64_t t_wake = READ_PERI_REG(RTC_CNTL_TIME_LOW0_REG);
t_wake |= ((uint64_t) READ_PERI_REG(RTC_CNTL_TIME_HIGH0_REG)) << 32;
uint64_t t_slp = READ_PERI_REG(RTC_CNTL_TIME_LOW1_REG);
t_slp |= ((uint64_t) READ_PERI_REG(RTC_CNTL_TIME_HIGH1_REG)) << 32;
return (t_wake - t_slp);
}

uint64_t rtc_deep_slp_time_get(void)
{
uint64_t t_slp = READ_PERI_REG(RTC_CNTL_TIME_LOW1_REG);
t_slp |= ((uint64_t) READ_PERI_REG(RTC_CNTL_TIME_HIGH1_REG)) << 32;
uint64_t t_wake = rtc_time_get();
return (t_wake - t_slp);
}

void rtc_clk_wait_for_slow_cycle(void) //This function may not by useful any more
{
SET_PERI_REG_MASK(RTC_CNTL_SLOW_CLK_CONF_REG, RTC_CNTL_SLOW_CLK_NEXT_EDGE);
Expand Down
1 change: 0 additions & 1 deletion components/esp_hw_support/port/esp32c3/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
set(srcs "rtc_clk_init.c"
"rtc_clk.c"
"rtc_init.c"
"rtc_pm.c"
"rtc_sleep.c"
"rtc_time.c"
"chip_info.c"
Expand Down
59 changes: 0 additions & 59 deletions components/esp_hw_support/port/esp32c3/rtc_pm.c

This file was deleted.

6 changes: 0 additions & 6 deletions components/esp_hw_support/port/esp32c3/rtc_sleep.c
Original file line number Diff line number Diff line change
Expand Up @@ -190,12 +190,6 @@ void rtc_sleep_low_init(uint32_t slowclk_period)
REG_SET_FIELD(RTC_CNTL_TIMER1_REG, RTC_CNTL_CK8M_WAIT, RTC_CNTL_CK8M_WAIT_SLP_CYCLES);
}

void rtc_sleep_set_wakeup_time(uint64_t t)
{
WRITE_PERI_REG(RTC_CNTL_SLP_TIMER0_REG, t & UINT32_MAX);
WRITE_PERI_REG(RTC_CNTL_SLP_TIMER1_REG, t >> 32);
}

static uint32_t rtc_sleep_finish(uint32_t lslp_mem_inf_fpu);

uint32_t rtc_sleep_start(uint32_t wakeup_opt, uint32_t reject_opt, uint32_t lslp_mem_inf_fpu)
Expand Down
17 changes: 0 additions & 17 deletions components/esp_hw_support/port/esp32c3/rtc_time.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,23 +173,6 @@ uint64_t rtc_time_get(void)
return rtc_cntl_ll_get_rtc_time();
}

uint64_t rtc_light_slp_time_get(void)
{
uint64_t t_wake = READ_PERI_REG(RTC_CNTL_TIME_LOW0_REG);
t_wake |= ((uint64_t) READ_PERI_REG(RTC_CNTL_TIME_HIGH0_REG)) << 32;
uint64_t t_slp = READ_PERI_REG(RTC_CNTL_TIME_LOW1_REG);
t_slp |= ((uint64_t) READ_PERI_REG(RTC_CNTL_TIME_HIGH1_REG)) << 32;
return (t_wake - t_slp);
}

uint64_t rtc_deep_slp_time_get(void)
{
uint64_t t_slp = READ_PERI_REG(RTC_CNTL_TIME_LOW1_REG);
t_slp |= ((uint64_t) READ_PERI_REG(RTC_CNTL_TIME_HIGH1_REG)) << 32;
uint64_t t_wake = rtc_time_get();
return (t_wake - t_slp);
}

void rtc_clk_wait_for_slow_cycle(void) //This function may not by useful any more
{
SET_PERI_REG_MASK(RTC_CNTL_SLOW_CLK_CONF_REG, RTC_CNTL_SLOW_CLK_NEXT_EDGE);
Expand Down
7 changes: 0 additions & 7 deletions components/esp_hw_support/port/esp32c6/rtc_pm.c

This file was deleted.

15 changes: 0 additions & 15 deletions components/esp_hw_support/port/esp32c6/rtc_time.c
Original file line number Diff line number Diff line change
Expand Up @@ -210,21 +210,6 @@ uint64_t rtc_time_get(void)
return lp_timer_hal_get_cycle_count(0);
}

uint64_t rtc_light_slp_time_get(void)
{
// TODO: IDF-5645
ESP_EARLY_LOGW(TAG, "rtc_light_slp_time_get() has not been implemented yet");
return 0;
}

uint64_t rtc_deep_slp_time_get(void)
{
uint64_t t_slp = READ_PERI_REG(LP_TIMER_MAIN_BUF1_LOW_REG);
t_slp |= ((uint64_t) READ_PERI_REG(LP_TIMER_MAIN_BUF1_HIGH_REG)) << 32;
uint64_t t_wake = rtc_time_get();
return (t_wake - t_slp);
}

void rtc_clk_wait_for_slow_cycle(void) //This function may not by useful any more
{
// TODO: IDF-5781
Expand Down
15 changes: 0 additions & 15 deletions components/esp_hw_support/port/esp32h2/rtc_time.c
Original file line number Diff line number Diff line change
Expand Up @@ -212,21 +212,6 @@ uint64_t rtc_time_get(void)
return t;
}

uint64_t rtc_light_slp_time_get(void)
{
// TODO: IDF-6267
ESP_EARLY_LOGW(TAG, "rtc_light_slp_time_get() has not been implemented yet");
return 0;
}

uint64_t rtc_deep_slp_time_get(void)
{
uint64_t t_slp = READ_PERI_REG(LP_TIMER_MAIN_BUF1_LOW_REG);
t_slp |= ((uint64_t) READ_PERI_REG(LP_TIMER_MAIN_BUF1_HIGH_REG)) << 32;
uint64_t t_wake = rtc_time_get();
return (t_wake - t_slp);
}

void rtc_clk_wait_for_slow_cycle(void) //This function may not by useful any more
{
// TODO: IDF-6254
Expand Down
1 change: 0 additions & 1 deletion components/esp_hw_support/port/esp32h4/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
set(srcs "rtc_clk_init.c"
"rtc_clk.c"
"rtc_init.c"
"rtc_pm.c"
"rtc_sleep.c"
"rtc_time.c"
"chip_info.c"
Expand Down
Loading

0 comments on commit a529771

Please sign in to comment.