Synopsis
unsigned __disable_interrupt(void);
Description

__disable_interrupt disables global interrupts by clearing the IGE bit in the interrupt control register IC and returns the value of the interrupt control register before the IGE bit is cleared. You can restore the state of the IGE bit from the value returned from __disable_interrupt by using the __restore_interrupt intrinsic function.

__disable_interrupt is an intrinsic function, produces inline code, and you can use it on any MAXQ30 device.

void critical_function(void)
{
// \em{Disable interrupts and save interrupt enable state}
unsigned char state = __disable_interrupt();

// \em{Critical processing here}

// \em{Restore interrupt enable state from saved value}
__restore_interrupt(state);
}