__get_interrupt_state
Syntax
__istate_t __get_interrupt_state(void);
Description
In 32-bit mode:
Returns the global interrupt state. The return value can be used as an argument to the __set_interrupt_state intrinsic function, which will restore the interrupt state.
This intrinsic function can only be used in privileged mode, and cannot be used when using the ‑‑aeabi compiler option.
In 64-bit mode:
Returns the 4 low bits of the DAIF system register (__istate_t is unsigned long long).
Example
#include "intrinsics.h"
void CriticalFn()
{
__istate_t s = __get_interrupt_state();
__disable_interrupt();
/* Do something here. */
__set_interrupt_state(s);
}The advantage of using this sequence of code compared to using __disable_interrupt and __enable_interrupt is that the code in this example will not enable any interrupts disabled before the call of __get_interrupt_state.
Note
To use intrinsic functions in an application, you must include the header file(s) where they are declared, see Summary of intrinsic functions.