Skip to content

Commit

Permalink
pm: prevent interrupt nesting during esp_pm_impl_isr_hook
Browse files Browse the repository at this point in the history
Follows the approach proposed in #3110,
but masks the interrupts during the entire ISR hook, not only during
leave_idle. Interrupt nesting during update_ccompare may also cause
issues.

Closes #3057
  • Loading branch information
igrr authored and espressif-bot committed Apr 17, 2019
1 parent 92989b5 commit d31ee80
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions components/esp32/pm_esp32.c
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,10 @@ void IRAM_ATTR esp_pm_impl_isr_hook()
{
int core_id = xPortGetCoreID();
ESP_PM_TRACE_ENTER(ISR_HOOK, core_id);
/* Prevent higher level interrupts (than the one this function was called from)
* from happening in this section, since they will also call into esp_pm_impl_isr_hook.
*/
uint32_t state = portENTER_CRITICAL_NESTED();
#if portNUM_PROCESSORS == 2
if (s_need_update_ccompare[core_id]) {
update_ccompare();
Expand All @@ -467,6 +471,7 @@ void IRAM_ATTR esp_pm_impl_isr_hook()
#else
leave_idle();
#endif // portNUM_PROCESSORS == 2
portEXIT_CRITICAL_NESTED(state);
ESP_PM_TRACE_EXIT(ISR_HOOK, core_id);
}

Expand Down

0 comments on commit d31ee80

Please sign in to comment.