# OS_SetIrqMask

## C Specification

  `#include <nitro/os.h>`
  `OSIrqMask OS_SetIrqMask( OSIrqMask intr );`

## Arguments

intr | The IRQ interrupt cause to be enabled (expressed as a bitmask)

## Return Values

The setting of the IRQ interrupt cause before this function is called.

## Description

Sets the IRQ interrupt cause When the IRQ interrupt master enable is enabled with `OS_EnableIrq`, only IRQ interrupts corresponding to those enabled with this function will occur.

The `intr` argument is displayed as the logical OR of the following causes:

OS_IE_V_BLANK | V-blank interrupt
OS_IE_H_BLANK | H-blank interrupt
OS_IE_V_COUNT | V counter interrupt
OS_IE_TIMER0 | Timer0 interrupt
OS_IE_TIMER1 | Timer1 interrupt
OS_IE_TIMER2 | Timer2 interrupt
OS_IE_TIMER3 | Timer3 interrupt
OS_IE_DMA0 | DMA0 interrupt
OS_IE_DMA1 | DMA1 interrupt
OS_IE_DMA2 | DMA2 interrupt
OS_IE_DMA3 | DMA3 interrupt
OS_IE_KEY | Key interrupt *1
OS_IE_CARTRIDGE | Game Pak IREQ/DREQ interrupt
OS_IE_SUBP | ARM7 interrupt
OS_IE_SPFIFO_SEND | ARM9-ARM7 send FIFO empty interrupt
OS_IE_SPFIFO_RECV | ARM9-ARM7 receive FIFO not-empty interrupt
OS_IE_CARD_DATA | Card data transfer end interrupt
OS_IE_CARD_IREQ | Card IREQ interrupt
OS_IE_GXFIFO | Geometry command FIFO interrupt

*1 The hardware specification does not allow the use of the key interrupt. However, it can be used for waking from sleep.

> Example:
> `// Enable both V-Blank and DMA0 interrupts.
> OS_SetIrqMask( OS_IE_V_BLANK | OS_IE_DMA0 );
> // IRQ master enable
> OS_EnableIrq();`

Note: `OS_SetIrqMask` is a function that overwrites and sets IRQ interrupt causes, and not a function to add specified causes. Since some interrupt causes are set by system, do not overwrite settings needlessly. For example, because tick and alarm use a timer interrupt, IRQ interrupt cause for the applicable timer must be enabled. Use `OS_EnableIrqMask` when adding IRQ interrupts to the previous settings.

## Internal Operation

Operates on one of the IO registers, IE (Interrupt Enable).

## See Also

`OS_GetIrqMask`, `OS_EnableIrqMask`, `OS_DisableIrqMask`

## Revision History

03/08/2005 Standardized the Japanese term for "interrupt"
12/08/2004 Added warning about OS_IE_KEY
11/24/2004 Deleted OS_IE_SIO
09/01/2004 Changed "subprocessor" to "ARM7" and "between subprocessors" to "between the ARM7 and ARM9"
03/12/2004 Emphasized differences from `OS_EnableIrqMask()`
12/01/2003 Initial version