Skip to content

Commit 6e1d598

Browse files
esp-wzhespressif-bot
authored andcommitted
fix(esp_hw_support): reset smp core state if the sleep request is rejected by hardware
1 parent eb45491 commit 6e1d598

File tree

1 file changed

+7
-3
lines changed
  • components/esp_hw_support/lowpower/cpu_retention/port/esp32p4

1 file changed

+7
-3
lines changed

components/esp_hw_support/lowpower/cpu_retention/port/esp32p4/sleep_cpu.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -528,8 +528,9 @@ static TCM_IRAM_ATTR void smp_core_do_retention(void)
528528

529529
// Wait another core start to do retention
530530
bool smp_skip_retention = false;
531+
smp_retention_state_t another_core_state;
531532
while (1) {
532-
smp_retention_state_t another_core_state = atomic_load(&s_smp_retention_state[!core_id]);
533+
another_core_state = atomic_load(&s_smp_retention_state[!core_id]);
533534
if (another_core_state == SMP_SKIP_RETENTION) {
534535
// If another core skips the retention, the current core should also have to skip it.
535536
smp_skip_retention = true;
@@ -548,9 +549,12 @@ static TCM_IRAM_ATTR void smp_core_do_retention(void)
548549
if ((frame_critical->pmufunc & 0x3) == 0x1) {
549550
atomic_store(&s_smp_retention_state[core_id], SMP_BACKUP_DONE);
550551
// wait another core trigger sleep and wakeup
551-
esp_cpu_wait_for_intr();
552552
while (1) {
553-
;
553+
// If another core's sleep request is rejected by the hardware, jumps out of blocking.
554+
another_core_state = atomic_load(&s_smp_retention_state[!core_id]);
555+
if (another_core_state == SMP_SKIP_RETENTION) {
556+
break;
557+
}
554558
}
555559
} else {
556560
// Start core1

0 commit comments

Comments
 (0)