mirror of
https://github.com/espressif/esp-idf
synced 2025-03-10 01:29:21 -04:00
system: fix pm lock issue in dual core mode
This commit is contained in:
parent
32ee0bdb29
commit
d3b5f97573
@ -115,8 +115,6 @@ static portMUX_TYPE s_switch_lock = portMUX_INITIALIZER_UNLOCKED;
|
||||
static pm_mode_t s_mode = PM_MODE_CPU_MAX;
|
||||
/* True when switch is in progress */
|
||||
static volatile bool s_is_switching;
|
||||
/* When switch is in progress, this is the mode we are switching into */
|
||||
static pm_mode_t s_new_mode = PM_MODE_CPU_MAX;
|
||||
/* Number of times each mode was locked */
|
||||
static size_t s_mode_lock_counts[PM_MODE_COUNT];
|
||||
/* Bit mask of locked modes. BIT(i) is set iff s_mode_lock_counts[i] > 0. */
|
||||
@ -405,7 +403,7 @@ void IRAM_ATTR esp_pm_impl_switch_mode(pm_mode_t mode,
|
||||
#endif // WITH_PROFILING
|
||||
}
|
||||
portEXIT_CRITICAL_SAFE(&s_switch_lock);
|
||||
if (need_switch && new_mode != s_mode) {
|
||||
if (need_switch) {
|
||||
do_switch(new_mode);
|
||||
}
|
||||
}
|
||||
@ -480,10 +478,6 @@ static void IRAM_ATTR do_switch(pm_mode_t new_mode)
|
||||
if (!s_is_switching) {
|
||||
break;
|
||||
}
|
||||
if (s_new_mode <= new_mode) {
|
||||
portEXIT_CRITICAL_ISR(&s_switch_lock);
|
||||
return;
|
||||
}
|
||||
#ifdef CONFIG_FREERTOS_SYSTICK_USES_CCOUNT
|
||||
if (s_need_update_ccompare[core_id]) {
|
||||
s_need_update_ccompare[core_id] = false;
|
||||
@ -491,7 +485,10 @@ static void IRAM_ATTR do_switch(pm_mode_t new_mode)
|
||||
#endif
|
||||
portEXIT_CRITICAL_ISR(&s_switch_lock);
|
||||
} while (true);
|
||||
s_new_mode = new_mode;
|
||||
if (new_mode == s_mode) {
|
||||
portEXIT_CRITICAL_ISR(&s_switch_lock);
|
||||
return;
|
||||
}
|
||||
s_is_switching = true;
|
||||
bool config_changed = s_config_changed;
|
||||
s_config_changed = false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user