5.22 __restore_interrupt Intrinsic Function
The IAR __restore_interrupt
intrinsic function restores the interrupt flag to a
state obtained using the __save_interrupt
intrinsic function.
Suggested Replacement
There is no equivalent MPLAB XC8 built-in function, but the SREG registers can be updated with plain C code.
Use code that performs a bitwise OR of the SREG register and a saved value obtained from that same register before the interrupt flags were potentially changed.
Caveats
None
Examples
Consider migrating IAR code such
as:
unsigned char saved;
void foo(void) {
saved = __save_interrupt();
__disable_interrupt();
/* Critical section goes here */
__restore_interrupt(saved);
}
to
MPLAB XC8 code similar
to:volatile unsigned char saved;
void foo(void) {
saved = (SREG & 0x80);
di();
/* Critical section goes here */
SREG |= saved;
}