arch: arm: cortex_m: cpu_idle: Add missing irq masking/unmasking

This was missed during conversion from ASM to C.

Signed-off-by: Wilfried Chauveau <wilfried.chauveau@arm.com>
This commit is contained in:
Wilfried Chauveau 2024-04-17 10:22:13 +01:00 committed by Alberto Escolar
parent fb6ab560a5
commit b621802614
1 changed files with 14 additions and 9 deletions

View File

@ -76,7 +76,7 @@ void arch_cpu_idle(void)
__disable_irq();
/*
* Set wake-up interrupt priority to the lowest and synchronise to
* Set wake-up interrupt priority to the lowest and synchronize to
* ensure that this is visible to the WFI instruction.
*/
__set_BASEPRI(0);
@ -91,10 +91,6 @@ void arch_cpu_idle(void)
*/
#endif
/*
* Wait for all memory transactions to complete before entering low
* power state.
*/
SLEEP_IF_ALLOWED(__WFI);
__enable_irq();
@ -122,11 +118,20 @@ void arch_cpu_atomic_idle(unsigned int key)
* and never touched again.
*/
/*
* Wait for all memory transactions to complete before entering low
* power state.
*/
#if defined(CONFIG_ARMV6_M_ARMV8_M_BASELINE)
/* No BASEPRI, call wfe directly. (SEVONPEND is set in z_arm_cpu_idle_init()) */
#elif defined(CONFIG_ARMV7_M_ARMV8_M_MAINLINE)
/* unlock BASEPRI so wfe gets interrupted by incoming interrupts */
__set_BASEPRI(0);
__ISB();
#else
#error Unsupported architecture
#endif
SLEEP_IF_ALLOWED(__WFE);
arch_irq_unlock(key);
#if defined(CONFIG_ARMV7_M_ARMV8_M_MAINLINE)
__enable_irq();
#endif
}