# OS_SetIrqCheckFlag

## Syntax

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

## Arguments

intr | Expresses as a logical sum the IRQ interrupt cause(s) for which you want to set the check flag. (Usually only handles one cause.)

## Return Values

None.

## Description

Sets the check flag for IRQ interrupts.

Normally, this flag is called by the handler for each interrupt. When individual interrupt processes finish, the check flag is set to indicate that this function has been called by the interrupt. For example, the function that is called by a V-Blank interrupt will be:

> ``OS_SetIrqCheckFlag( OS_IE_V_BLANK );``

and a check flag is set. The table below describes these flags.

The flag set here is used to check whether or not an interrupt occurred with `OS_WaitIntr`, `OS_WaitInterrupt`, or `SVC_WaitVBlankIntr`. Therefore, if there are interrupts that do not wait with those functions, the flags will not be used from anywhere even if they are set, so they do not necessarily have to be set. But if you carry out separate processes for each situation, you may forget to write them when they are necessary. Therefore, it is recommended that you always set the flags for interrupts if doing so creates no problems.

If `OS_WaitIntr`, `OS_WaitInterrupt`, and/or `SVC_WaitVBlankIntr` are carried out for the same interrupt with multiple threads, be aware that a restore can only be performed with one of these threads for one interrupt.

###
Types of Interrupts

See below for information on the types of interrupts.

Types of Interrupts

###
User flags

Besides flags for hardware interrupts, there are dummy check flags like those shown below, which can be used freely in the application. In order to obtain synchronization with callback functions, these can replace the processing for polling carried out by volatile variables with a combination of `OS_WaitIrq()`, `OS_ClearIrqCheckFlag()`, and `OS_SetIrqCheckFlag()`.

Value | Type
--- | ---
OS_IE_USER_FLAG0 | Check Flag 0 that can be used freely in the application
OS_IE_USER_FLAG1 | Check Flag 1 that can be used freely in the application

## See Also

`OS_ClearIrqCheckFlag`, `OS_GetIrqCheckFlag`

## Internal Operation

In the ARM9, the predetermined location `DTCM_END - 8` in DTCM is designated as the check flag region. This function operates on this region. In the ARM7, the predetermined location of the ARM7 WRAM (highest address - 8) is designated as the check flag region. The function operates on this region.

## Revision History

2005/03/08 Standardized the use of the term 'interrupt' in Japanese.
2004/12/08 Added cautions about OS_IE_KEY.
2004/11/24 Deleted OS_IE_SIO.
2004/11/02 Deleted `SVC_WaitIntr()` from See Also.
2004/09/01 Changed 'subprocessor' to 'ARM7' and 'between subprocessors' to 'between ARM9 and ARM7'.
2004/04/22 Added cautions about using multiple threads.
2003/01/09 Initial version.

CONFIDENTIAL