# OS_WaitInterrupt

## C Specification

      #include <nitro/os.h>

      void OS_WaitInterrupt(
              BOOL        clear ,
              OSIrqMask   irqFlags );

## Description

Waits for the generation of a specified IRQ interrupt source

In `irqFlags`, you can specify multiple interrupt sources by logically adding the mask values. Generation of any of the interrupts included here will cause a return from the function.

A check flag can be set after an IRQ interrupt is generated it indicate that interrupt. To set this flag, the user must explicitly call `OS_SetIrqCheckFlag` from the interrupt handler.

If you set `clear` to `TRUE`, before waiting, this resets interrupt flags that are specified by `irqFlags` from amongst the interrupt check flags. If there is no reset, and a relevant check flag has been preset, return from the function will be immediate.

The difference between `OS_WaitInterrupt()` and `OS_WaitIrq()` is as follows:

- While `OS_WaitInterrupt()` is waiting for an interrupt source, it uses `OS_Halt()` to stop.
- While `OS_WaitIrq()` is waiting for an interrupt source, it moves processing to another thread. It recommences operation after an interrupt is generated.

If no threads are used, both functions behave the same.

## Arguments

`clear` | Indicates whether or not check flags should be cleared.
`irqFlags` | The mask value of the interrupt generation for which the function is waiting. You can specify more that one using a logical sum.

## Return Values

None

## See Also

`OS_SetIrqCheckFlag`, `OS_WaitIrq`

## Revision History

05/24/204 Initial version