freertos: Replace portSET_INTERRUPT_MASK_FROM_ISR() call for SMP

The behavior of portSET_INTERRUPT_MASK_FROM_ISR() has changed in SMP FreeRTOS. It's
previous behavior is now implemented in portDISABLE_INTERRUPTS() and portRESTORE_INTERRUPTS().

This commit replaces all portSET_INTERRUPT_MASK_FROM_ISR() and portCLEAR_INTERRUPT_MASK_FROM_ISR()
calls with portDISABLE_INTERRUPTS() and portRESTORE_INTERRUPTS() respectively
This commit is contained in:
Darian Leung
2022-05-30 06:11:24 +08:00
parent 769bc9b2d2
commit daa950d9ed
5 changed files with 55 additions and 1 deletions

View File

@@ -789,7 +789,11 @@ void esp_pm_impl_init(void)
void esp_pm_impl_idle_hook(void)
{
int core_id = xPortGetCoreID();
#if CONFIG_FREERTOS_SMP
uint32_t state = portDISABLE_INTERRUPTS();
#else
uint32_t state = portSET_INTERRUPT_MASK_FROM_ISR();
#endif
if (!s_core_idle[core_id]
#ifdef CONFIG_FREERTOS_USE_TICKLESS_IDLE
&& !periph_should_skip_light_sleep()
@@ -798,7 +802,11 @@ void esp_pm_impl_idle_hook(void)
esp_pm_lock_release(s_rtos_lock_handle[core_id]);
s_core_idle[core_id] = true;
}
#if CONFIG_FREERTOS_SMP
portRESTORE_INTERRUPTS(state);
#else
portCLEAR_INTERRUPT_MASK_FROM_ISR(state);
#endif
ESP_PM_TRACE_ENTER(IDLE, core_id);
}
@@ -809,7 +817,11 @@ void IRAM_ATTR esp_pm_impl_isr_hook(void)
/* 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.
*/
#if CONFIG_FREERTOS_SMP
uint32_t state = portDISABLE_INTERRUPTS();
#else
uint32_t state = portSET_INTERRUPT_MASK_FROM_ISR();
#endif
#if defined(CONFIG_FREERTOS_SYSTICK_USES_CCOUNT) && (portNUM_PROCESSORS == 2)
if (s_need_update_ccompare[core_id]) {
update_ccompare();
@@ -820,7 +832,11 @@ void IRAM_ATTR esp_pm_impl_isr_hook(void)
#else
leave_idle();
#endif // CONFIG_FREERTOS_SYSTICK_USES_CCOUNT && portNUM_PROCESSORS == 2
#if CONFIG_FREERTOS_SMP
portRESTORE_INTERRUPTS(state);
#else
portCLEAR_INTERRUPT_MASK_FROM_ISR(state);
#endif
ESP_PM_TRACE_EXIT(ISR_HOOK, core_id);
}