fix(esp_hw_support): reset smp core state if the sleep request is rejected by hardware

This commit is contained in:
wuzhenghui 2024-05-16 17:54:07 +08:00
parent 7a9fb14f90
commit cced83e790
No known key found for this signature in database
GPG Key ID: 3EFEDECDEBA39BB9

View File

@ -528,8 +528,9 @@ static TCM_IRAM_ATTR void smp_core_do_retention(void)
// Wait another core start to do retention
bool smp_skip_retention = false;
smp_retention_state_t another_core_state;
while (1) {
smp_retention_state_t another_core_state = atomic_load(&s_smp_retention_state[!core_id]);
another_core_state = atomic_load(&s_smp_retention_state[!core_id]);
if (another_core_state == SMP_SKIP_RETENTION) {
// If another core skips the retention, the current core should also have to skip it.
smp_skip_retention = true;
@ -548,9 +549,12 @@ static TCM_IRAM_ATTR void smp_core_do_retention(void)
if ((frame_critical->pmufunc & 0x3) == 0x1) {
atomic_store(&s_smp_retention_state[core_id], SMP_BACKUP_DONE);
// wait another core trigger sleep and wakeup
esp_cpu_wait_for_intr();
while (1) {
;
// If another core's sleep request is rejected by the hardware, jumps out of blocking.
another_core_state = atomic_load(&s_smp_retention_state[!core_id]);
if (another_core_state == SMP_SKIP_RETENTION) {
break;
}
}
} else {
// Start core1