Skip to main content

IAR Embedded Workbench for RX 5.20

__get_interrupt_state

In this section:
Syntax
__istate_t __get_interrupt_state(void);
Description

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.

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.