2008-02-15 01:20 PM
Enable/Disable Interrupts globally
2011-05-17 03:23 AM
Hi !
How can I easily enable / disable all interrupts with one instruction ? regards Manfred2011-05-17 03:23 AM
Not exactly one instruction, but you can disable all interrupts in one go by setting the PRIMASK special register. To do this, you need to use MSR instruction (in assembly):
MOVS R0, #1 MSR PRIMASK, R0 ; Set PRIMASK to 1 Depends on the development tool and library you are using, there might be some device drive function that can do this for you.2011-05-17 03:23 AM
You CAN with only one instruction.
CPSIE I write 0 in PRIMASK so interrupts are enable CPSID I write 1 in PRIMASK so interrupts are disable See ARM DDI 0405A-01, page B3-3 With IAR compiler, you have intrinsic function __disable_interrupt() and __enable_interrupt() which put inline these instructions. With GNU compiler you can easily use __asm() directive to put these instructions in your code.2011-05-17 03:23 AM
Oops, yes of course.
I completely forgot about these two instructions. Thanks for reminding me :)