Merge pull request #14534 from bergzand/pr/cortexm/irq_during_idle
cortexm_common: disable IRQ during thread_sched_idle
This commit is contained in:
commit
ea8e867611
@ -462,6 +462,7 @@ void sched_arch_idle(void)
|
|||||||
* According to [this](http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dai0321a/BIHJICIE.html),
|
* According to [this](http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dai0321a/BIHJICIE.html),
|
||||||
* dynamically changing the priority is not supported on CortexM0(+).
|
* dynamically changing the priority is not supported on CortexM0(+).
|
||||||
*/
|
*/
|
||||||
|
unsigned state = irq_disable();
|
||||||
NVIC_SetPriority(PendSV_IRQn, CPU_CORTEXM_PENDSV_IRQ_PRIO + 1);
|
NVIC_SetPriority(PendSV_IRQn, CPU_CORTEXM_PENDSV_IRQ_PRIO + 1);
|
||||||
__DSB();
|
__DSB();
|
||||||
__ISB();
|
__ISB();
|
||||||
@ -471,5 +472,6 @@ void sched_arch_idle(void)
|
|||||||
#else
|
#else
|
||||||
__WFI();
|
__WFI();
|
||||||
#endif
|
#endif
|
||||||
|
irq_restore(state);
|
||||||
NVIC_SetPriority(PendSV_IRQn, CPU_CORTEXM_PENDSV_IRQ_PRIO);
|
NVIC_SetPriority(PendSV_IRQn, CPU_CORTEXM_PENDSV_IRQ_PRIO);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user