From b86d550ec5e615436590faf90803dc69ec655320 Mon Sep 17 00:00:00 2001 From: Lou Tianhao Date: Mon, 20 Nov 2023 16:35:27 +0800 Subject: [PATCH] change(pm/ext): remove ext0_wakeup_clear and ext1_wakeup_clear --- components/esp_hw_support/sleep_modes.c | 21 ++----------------- components/hal/esp32/include/hal/rtc_io_ll.h | 10 --------- .../hal/esp32s2/include/hal/rtc_io_ll.h | 11 ---------- .../hal/esp32s3/include/hal/rtc_io_ll.h | 11 ---------- components/hal/include/hal/rtc_io_hal.h | 5 ----- 5 files changed, 2 insertions(+), 56 deletions(-) diff --git a/components/esp_hw_support/sleep_modes.c b/components/esp_hw_support/sleep_modes.c index 29421ffbec..5ab78ab228 100644 --- a/components/esp_hw_support/sleep_modes.c +++ b/components/esp_hw_support/sleep_modes.c @@ -256,11 +256,9 @@ void esp_sleep_periph_use_8m(bool use_or_not) static uint32_t get_power_down_flags(void); #if SOC_PM_SUPPORT_EXT0_WAKEUP static void ext0_wakeup_prepare(void); -static void IRAM_ATTR ext0_wakeup_clear(void); #endif #if SOC_PM_SUPPORT_EXT1_WAKEUP static void ext1_wakeup_prepare(void); -static void IRAM_ATTR ext1_wakeup_clear(void); #endif static esp_err_t timer_wakeup_prepare(int64_t sleep_duration); #if CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 @@ -635,16 +633,14 @@ static esp_err_t IRAM_ATTR esp_sleep_start(uint32_t pd_flags, esp_sleep_mode_t m // Configure pins for external wakeup if (s_config.wakeup_triggers & RTC_EXT0_TRIG_EN) { ext0_wakeup_prepare(); - } else { - ext0_wakeup_clear(); } + // for !(s_config.wakeup_triggers & RTC_EXT0_TRIG_EN), ext0 wakeup will be turned off in hardware in the real call to sleep #endif #if SOC_PM_SUPPORT_EXT1_WAKEUP if (s_config.wakeup_triggers & RTC_EXT1_TRIG_EN) { ext1_wakeup_prepare(); - } else { - ext1_wakeup_clear(); } + // for !(s_config.wakeup_triggers & RTC_EXT1_TRIG_EN), ext1 wakeup will be turned off in hardware in the real call to sleep #endif #if SOC_GPIO_SUPPORT_DEEPSLEEP_WAKEUP @@ -1478,11 +1474,6 @@ static void ext0_wakeup_prepare(void) rtcio_hal_input_enable(rtc_gpio_num); } -static void ext0_wakeup_clear(void) -{ - rtcio_hal_ext0_clear_wakeup_pins(); -} - #endif // SOC_PM_SUPPORT_EXT0_WAKEUP #if SOC_PM_SUPPORT_EXT1_WAKEUP @@ -1641,14 +1632,6 @@ static void ext1_wakeup_prepare(void) rtc_hal_ext1_set_wakeup_pins(s_config.ext1_rtc_gpio_mask, s_config.ext1_trigger_mode); } -static void ext1_wakeup_clear(void) -{ - // Clear state from previous wakeup - rtc_hal_ext1_clear_wakeup_status(); - // Clear all ext1 wakup-source setting - rtc_hal_ext1_clear_wakeup_pins(); -} - uint64_t esp_sleep_get_ext1_wakeup_status(void) { if (esp_sleep_get_wakeup_cause() != ESP_SLEEP_WAKEUP_EXT1) { diff --git a/components/hal/esp32/include/hal/rtc_io_ll.h b/components/hal/esp32/include/hal/rtc_io_ll.h index 86b340fb77..d10deaa96b 100644 --- a/components/hal/esp32/include/hal/rtc_io_ll.h +++ b/components/hal/esp32/include/hal/rtc_io_ll.h @@ -373,16 +373,6 @@ static inline void rtcio_ll_ext0_set_wakeup_pin(int rtcio_num, int level) level , RTC_CNTL_EXT_WAKEUP0_LV_S); } -/** - * Clear ext0 wakeup trigger. - */ -static inline void rtcio_ll_ext0_clear_wakeup_pins(void) -{ - REG_SET_FIELD(RTC_IO_EXT_WAKEUP0_REG, RTC_IO_EXT_WAKEUP0_SEL, 0); - // Clear level which will trigger wakeup - SET_PERI_REG_BITS(RTC_CNTL_EXT_WAKEUP_CONF_REG, 0x1, - 0 , RTC_CNTL_EXT_WAKEUP0_LV_S); -} #ifdef __cplusplus } #endif diff --git a/components/hal/esp32s2/include/hal/rtc_io_ll.h b/components/hal/esp32s2/include/hal/rtc_io_ll.h index d7033fb636..ad05ea95dd 100644 --- a/components/hal/esp32s2/include/hal/rtc_io_ll.h +++ b/components/hal/esp32s2/include/hal/rtc_io_ll.h @@ -376,17 +376,6 @@ static inline void rtcio_ll_ext0_set_wakeup_pin(int rtcio_num, int level) level , RTC_CNTL_EXT_WAKEUP0_LV_S); } -/** - * Clear ext0 wakeup trigger. - */ -static inline void rtcio_ll_ext0_clear_wakeup_pins(void) -{ - REG_SET_FIELD(RTC_IO_EXT_WAKEUP0_REG, RTC_IO_EXT_WAKEUP0_SEL, 0); - // Clear level which will trigger wakeup - SET_PERI_REG_BITS(RTC_CNTL_EXT_WAKEUP_CONF_REG, 0x1, - 0 , RTC_CNTL_EXT_WAKEUP0_LV_S); -} - #ifdef __cplusplus } #endif diff --git a/components/hal/esp32s3/include/hal/rtc_io_ll.h b/components/hal/esp32s3/include/hal/rtc_io_ll.h index 64088b0cd2..323e126c11 100644 --- a/components/hal/esp32s3/include/hal/rtc_io_ll.h +++ b/components/hal/esp32s3/include/hal/rtc_io_ll.h @@ -391,17 +391,6 @@ static inline void rtcio_ll_ext0_set_wakeup_pin(int rtcio_num, int level) level , RTC_CNTL_EXT_WAKEUP0_LV_S); } -/** - * Clear ext0 wakeup trigger. - */ -static inline void rtcio_ll_ext0_clear_wakeup_pins(void) -{ - REG_SET_FIELD(RTC_IO_EXT_WAKEUP0_REG, RTC_IO_EXT_WAKEUP0_SEL, 0); - // Clear level which will trigger wakeup - SET_PERI_REG_BITS(RTC_CNTL_EXT_WAKEUP_CONF_REG, 0x1, - 0 , RTC_CNTL_EXT_WAKEUP0_LV_S); -} - #ifdef __cplusplus } #endif diff --git a/components/hal/include/hal/rtc_io_hal.h b/components/hal/include/hal/rtc_io_hal.h index 35732be4fd..67b2201bca 100644 --- a/components/hal/include/hal/rtc_io_hal.h +++ b/components/hal/include/hal/rtc_io_hal.h @@ -266,11 +266,6 @@ void rtcio_hal_set_direction_in_sleep(int rtcio_num, rtc_gpio_mode_t mode); */ #define rtcio_hal_ext0_set_wakeup_pin(rtcio_num, level) rtcio_ll_ext0_set_wakeup_pin(rtcio_num, level) -/** - * Clear ext0 wakeup trigger. - */ -#define rtcio_hal_ext0_clear_wakeup_pins() rtcio_ll_ext0_clear_wakeup_pins() - #endif #if SOC_RTCIO_HOLD_SUPPORTED && SOC_RTCIO_INPUT_OUTPUT_SUPPORTED