1.2.8.2 SYS_INT_Disable Function
C
bool SYS_INT_Disable( void )
Summary
Disable Global Interrupt
Description
This function disables global interrupt and returns the state of the global interrupt prior to disabling it. When global interrupt is disabled, only NMI and HardFault exceptions are allowed. This may be used to disable global interrupt during critical section and restore the global interrupt state after the critical section.
Precondition
None.
Parameters
None.
Returns
This function disables the global interrupt and return the state of global interrupt prior to disabling it. The state information will be used to restore the global interrupt to the original state after the critical section.
- true - Global Interrupt is enabled
- false - Global Interrupt is disabled
Example
bool interruptState;
// Save global interrupt state and disable interrupt
interruptState = SYS_INT_Disable();
// Critical Section
// Restore interrupt state
SYS_INT_Restore(interruptState)
Remarks
Returned status can be passed to SYS_INT_Restore to restore the previous global interrupt status (whether it was enabled or disabled).