mirror of
https://github.com/espressif/esp-idf.git
synced 2025-10-24 19:12:38 +00:00
esp_pm: fix an issue and add an interface (backport to v4.3)
This commit is contained in:
@@ -323,6 +323,31 @@ esp_err_t esp_pm_configure(const void* vconfig)
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t esp_pm_get_configuration(void* vconfig)
|
||||
{
|
||||
if (vconfig == NULL) {
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
|
||||
#if CONFIG_IDF_TARGET_ESP32
|
||||
esp_pm_config_esp32_t* config = (esp_pm_config_esp32_t*) vconfig;
|
||||
#elif CONFIG_IDF_TARGET_ESP32S2
|
||||
esp_pm_config_esp32s2_t* config = (esp_pm_config_esp32s2_t*) vconfig;
|
||||
#elif CONFIG_IDF_TARGET_ESP32S3
|
||||
esp_pm_config_esp32s3_t* config = (esp_pm_config_esp32s3_t*) vconfig;
|
||||
#elif CONFIG_IDF_TARGET_ESP32C3
|
||||
esp_pm_config_esp32c3_t* config = (esp_pm_config_esp32c3_t*) vconfig;
|
||||
#endif
|
||||
|
||||
portENTER_CRITICAL(&s_switch_lock);
|
||||
config->light_sleep_enable = s_light_sleep_en;
|
||||
config->max_freq_mhz = s_cpu_freq_by_mode[PM_MODE_CPU_MAX].freq_mhz;
|
||||
config->min_freq_mhz = s_cpu_freq_by_mode[PM_MODE_APB_MIN].freq_mhz;
|
||||
portEXIT_CRITICAL(&s_switch_lock);
|
||||
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
static pm_mode_t IRAM_ATTR get_lowest_allowed_mode(void)
|
||||
{
|
||||
/* TODO: optimize using ffs/clz */
|
||||
|
||||
Reference in New Issue
Block a user