File tree Expand file tree Collapse file tree 1 file changed +5
-0
lines changed
Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Original file line number Diff line number Diff line change 109109#endif
110110
111111static portMUX_TYPE s_switch_lock = portMUX_INITIALIZER_UNLOCKED ;
112+ static portMUX_TYPE s_cpu_freq_switch_lock [CONFIG_FREERTOS_NUMBER_OF_CORES ] = {
113+ [0 ... (CONFIG_FREERTOS_NUMBER_OF_CORES - 1 )] = portMUX_INITIALIZER_UNLOCKED
114+ };
112115/* The following state variables are protected using s_switch_lock: */
113116/* Current sleep mode; When switching, contains old mode until switch is complete */
114117static pm_mode_t s_mode = PM_MODE_CPU_MAX ;
@@ -639,6 +642,7 @@ static void IRAM_ATTR do_switch(pm_mode_t new_mode)
639642 s_is_switching = true;
640643 bool config_changed = s_config_changed ;
641644 s_config_changed = false;
645+ portENTER_CRITICAL_ISR (& s_cpu_freq_switch_lock [core_id ]);
642646 portEXIT_CRITICAL_ISR (& s_switch_lock );
643647
644648 rtc_cpu_freq_config_t new_config = s_cpu_freq_by_mode [new_mode ];
@@ -678,6 +682,7 @@ static void IRAM_ATTR do_switch(pm_mode_t new_mode)
678682 }
679683
680684 portENTER_CRITICAL_ISR (& s_switch_lock );
685+ portEXIT_CRITICAL_ISR (& s_cpu_freq_switch_lock [core_id ]);
681686 s_mode = new_mode ;
682687 s_is_switching = false;
683688 portEXIT_CRITICAL_ISR (& s_switch_lock );
You can’t perform that action at this time.
0 commit comments