forked from espressif/esp-idf
esp_hw_support: perform sleep initialization using ESP_SYSTEM_INIT_FN
This commit is contained in:
@@ -45,6 +45,7 @@
|
||||
#include "esp_private/brownout.h"
|
||||
#include "esp_private/sleep_retention.h"
|
||||
#include "esp_private/esp_clk.h"
|
||||
#include "esp_private/startup_internal.h"
|
||||
|
||||
#ifdef CONFIG_IDF_TARGET_ESP32
|
||||
#include "esp32/rom/cache.h"
|
||||
@@ -1395,3 +1396,15 @@ void rtc_sleep_enable_ultra_low(bool enable)
|
||||
{
|
||||
s_ultra_low_enabled = enable;
|
||||
}
|
||||
|
||||
#if CONFIG_ESP_SLEEP_GPIO_RESET_WORKAROUND && !CONFIG_PM_SLP_DISABLE_GPIO
|
||||
ESP_SYSTEM_INIT_FN(esp_sleep_startup_init, BIT(0), 105)
|
||||
{
|
||||
// Configure to isolate (disable the Input/Output/Pullup/Pulldown
|
||||
// function of the pin) all GPIO pins in sleep state
|
||||
esp_sleep_config_gpio_isolate();
|
||||
// Enable automatic switching of GPIO configuration
|
||||
esp_sleep_enable_gpio_switch(true);
|
||||
return ESP_OK;
|
||||
}
|
||||
#endif
|
||||
|
@@ -30,7 +30,6 @@
|
||||
#include "esp_efuse.h"
|
||||
#include "esp_flash_encrypt.h"
|
||||
#include "esp_secure_boot.h"
|
||||
#include "esp_sleep.h"
|
||||
#include "esp_xt_wdt.h"
|
||||
|
||||
#if __has_include("esp_ota_ops.h")
|
||||
@@ -447,13 +446,6 @@ static void start_cpu0_default(void)
|
||||
|
||||
ESP_SYSTEM_INIT_FN(init_components0, BIT(0), 200)
|
||||
{
|
||||
#if CONFIG_ESP_SLEEP_GPIO_RESET_WORKAROUND && !CONFIG_PM_SLP_DISABLE_GPIO
|
||||
// Configure to isolate (disable the Input/Output/Pullup/Pulldown
|
||||
// function of the pin) all GPIO pins in sleep state
|
||||
esp_sleep_config_gpio_isolate();
|
||||
// Enable automatic switching of GPIO configuration
|
||||
esp_sleep_enable_gpio_switch(true);
|
||||
#endif
|
||||
|
||||
#if CONFIG_APPTRACE_ENABLE
|
||||
esp_err_t err = esp_apptrace_init();
|
||||
|
@@ -16,6 +16,9 @@
|
||||
# esp_timer has to be initialized early, since it is used by several other components
|
||||
100: esp_timer_startup_init in components/esp_timer/src/esp_timer.c on BIT(0)
|
||||
|
||||
# esp_sleep doesn't have init dependencies
|
||||
105: esp_sleep_startup_init in components/esp_hw_support/sleep_modes.c on BIT(0)
|
||||
|
||||
# the rest of the components which are initialized from startup.c
|
||||
# [refactor-todo]: move init calls into respective components
|
||||
200: init_components0 in components/esp_system/startup.c on BIT(0)
|
||||
|
Reference in New Issue
Block a user