INTERRUPTS_ENABLE (Compact 2013)

3/28/2014

This function enables or disables all interrupts and returns the current state.

Syntax

BOOL INTERRUPTS_ENABLE(
  BOOL fEnable
);

Parameters

  • fEnable
    [in] Flag to turn on/off interrupts.

Return Value

The previous interrupt enable/disable state.

Remarks

INTERRUPTS_ENABLE is available to OEM adaptation layer (OAL) routines so that they can perform critical operations without being interrupted. The caller should use the return value to restore the interrupt state, as shown in the following code example:

fWasEnabled = INTERRUPTS_ENABLE (FALSE);  // Disable interrupt.
DoCriticalOperations ();
INTERRUPTS_ENABLE (fWasEnabled);  // restore interrupt state

When synchronizing real-time clock (RTC) routines, critical sections should be utilized instead of interrupts.

Requirements

Header

nkintr.h

Library

Nk.lib

See Also

Reference

Kernel Functions
INTERRUPTS_OFF
INTERRUPTS_ON