List of Operations System API Functions

# List of Operating System (OS) API Functions

### Initialization

OS_InitReset | Initialize the system
OS_ResetSystem | Describes initialization processes to be executed before static constructor calls.

### Reset

Summary | Introduction to resetting the system.
OS_InitReset | Initialize the system.
OS_ResetSystem | Re-executes the program.
OS_GetResetParameter | Obtains the reset parameter value.

### System State

(Overview) | Describes the system state functions
OS_EnableInterrupts | Enable CPSR IRQ interrupts
OS_DisableInterrupts | Disable CPSR IRQ interrupts
OS_RestoreInterrupts | Put CPSR IRQ interrupts into designated state
OS_EnableInterrupts_IrqAndFiq | Enables IRQ, FIQ interrupts in CPSR
OS_DisableInterrupts_IrqAndFiq | Prohibits IRQ, FIQ interrupts in CPSR
OS_RestoreInterrupts_IrqAndFiq | Sets IRQ, FIQ interrupts in CPSR to a specified status.
OS_GetCpsrIrq | Obtain current CPSR IRQ and FIQ interrupts
OS_GetProcMode | Obtain current processor mode
OS_Halt | Sets the processor to HALT condition
OS_Terminate | Sets the processor to HALT status and loops.
OS_SpinWait | Sets the processor to idle

### TCM

(Overview) | Describes DTCM, ITCM
OS_EnableITCM | Enables instruction TCM.
OS_DisableITCM | Disables instruction TCM.
OS_EnableDTCM | Enables data TCM.
OS_DisableDTCM | Disables data TCM.
OS_SetITCMParam | Sets instruction TCM parameters.
OS_GetITCMParam | Obtains instruction TCM parameters.
OS_SetDTCMParam | Sets data TCM parameters.
OS_GetDTCMParam | Obtains the data TCM parameters.
OS_SetDTCMAddress | Sets the data TCM address.
OS_GetDTCMAddress | Obtains the data TCM address.

### Protection Unit

(Overview) | Describes protection unit settings
OS_EnableProtectionUnit | Enables the protection unit.
OS_DisableProtectionUnit | Disables the protection unit.
OS_SetProtectionRegion | Sets the protection region.
OS_SetProtectionRegionParam | Sets the protection region with parameter specification.
OS_GetProtectionRegionAddress | Obtains the base address of the protection region setting.
OS_GetProtectionRegionSize | Obtains the region size of the protection region setting.
OS_GetProtectionRegionParam | Obtains the setting parameters of the protection region.

### Exceptions

(Overview) | Describes the exception display system
OS_InitException | Initializes the exception display system.
OS_SetUserExceptionHandler | Sets the user handler to be used when an exception is generated.
OS_SetExceptionVectorLower | Sets the exception vector position as a normalized address
OS_SetExceptionVectorUpper | Sets the exception vector position as a high vector.

### Interrupts

(Overview) | Describes IRQ interrupts
OS_EnableIrq | Enables all IRQ interrupts.
OS_DisableIrq | Disables all IRQ interrupts.
OS_RestoreIrq | Puts all interrupts into designated state.
OS_SetIrqMask | Sets IRQ interrupt parameters.
OS_GetIrqMask | Obtains currently established IRQ interrupt parameters.
OS_EnableIrqMask | Enables IRQ of designated interrupt parameters.
OS_DisableIrqMask | Disables IRQ of designated interrupt parameters.
OS_ResetRequestIrqMask | Releases the interrupt request's designated interrupt parameters.
OS_GetRequestIrqMask | Obtains current interrupt request state.
OS_InitIrqTable | Initializes IRQ handler table.
OS_SetIrqFunction | Sets handler corresponding to designated IRQ.
OS_GetIrqFunction | Obtains handler corresponding to designated IRQ.
OS_SetIrqCheckFlag | Sets the interrupt check flag.
OS_ClearIrqCheckFlag | Clears the interrupt check flag.
OS_GetIrqCheckFlag | Obtains the interrupt check flag.
OS_WaitIrq | Waits for the specified IRQ.
OS_WaitAnyIrq | Waits for all IRQ.
OS_WaitInterrupt | Waits for the specified IRQ (a thread switch is not done).
OS_GetVBlankCount | Obtains the value of the V blank counter.

### Timer

(Overview) | Describes timers
OS_StartTimer | Set timer and start. The counter value is 16-bit.
OS_StartTimer32 | Using two timers, start the 32-bit long timer
OS_StartTimer48 | Using three timers, start the 48-bit long timer
OS_StartTimer64 | Using four timers, start the 64-bit long timer
OS_StopTimer | Stops the timer. The count value is 16 bits.
OS_StopTimer32 | Stops the two timers. Used when the 32-bit timer is being used.
OS_StopTimer48 | Stops the three timers. Used when the 48-bit timer is being used.
OS_StopTimer64 | Stops the four timers. Used when the 64-bit timer is being used.

### Alarms

(Overview) | Describes the alarm system
OS_InitAlarm | Allocates a timer for an alarm system and initializes.
OS_EndAlarm | Frees a timer that was allocated to an alarm system.
OS_IsAlarmAvailable | Checks whether an alarm system is initialized and available.
OS_CreateAlarm | Initializes an alarm structure.
OS_SetAlarm | Sets an alarm.
OS_SetPeriodicAlarm | Sets a periodic alarm.
OS_SetAlarmTag | Sets a tag to an alarm.
OS_CancelAlarm | Cancels an alarm.
OS_CancelAlarms | Cancels alarms that have a specified tag.
OS_CancelAllAlarms | Cancels all alarms.

### V-Count Alarms

Summary | Introduction to V-Count alarm operation.
OS_InitVAlarm | Initializes a V-count alarm system.
OS_EndVAlarm | Ends a V-count alarm system.
OS_IsVAlarmAvailable | Checks whether a V-count alarm system is initialized and available.
OS_CreateVAlarm | Initializes a V-count alarm structure.
OS_SetVAlarm | Sets a V-count alarm.
OS_SetOneTimeVAlarm | Sets a V-Count alarm. (Function added to maintain backwards-compatibility.)
OS_SetPeriodicVAlarm | Sets a periodic V-count alarm.
OS_SetVAlarmTag | Sets a tag to a V-count alarm.
OS_CancelVAlarm | Cancels a V-count alarm.
OS_CancelVAlarms | Cancels V-count alarms that have a specified tag.
OS_CancelAllVAlarms | Cancels all V-count alarms.

### Time

(Overview) | Describes the tick system
OS_InitTick | Allocates a timer for ticks.
OS_IsTickAvailable | Checks whether a tick is initialized and available.
OS_GetTick | Acquires a tick value.
OS_GetTickLo | Acquires the lower order 16-bit value of a tick value.
OS_SetTick | Sets a tick value.
OS_MicroSecondsToTicks | Converts from microseconds to a tick value.
OS_MilliSecondsToTicks | Converts from milliseconds to a tick value.
OS_SecondsToTicks | Converts from seconds to a tick value.
OS_TicksToMicroSeconds | Converts from a tick value to microseconds.
OS_TicksToMilliSeconds | Converts from a tick value to milliseconds.
OS_TicksToSeconds | Converts from a tick value to seconds.

### Thread

(Overview) | Describes the thread system
OS_InitThread | Initialize thread system
OS_IsThreadAvailable | initialized and is available.
OS_CreateThread | Create thread
OS_InitThreadQueue | Create thread queue
OS_ExitThread | Exit thread
OS_JoinThread | Bounds threads and waits for completion.
OS_IsThreadTerminated | Obtains whether the thread has completed.
OS_SelectThread | Select the next thread to be operated
OS_SetSwitchThreadCallback | Sets the callback during thread switch.
OS_RescheduleThread | Conduct thread scheduling
OS_SleepThread | Put thread into sleep state
OS_Sleep | Set threads to sleep status for a prescribed time.
OS_WakeupThread | Put thread into an operable state
OS_WakeupThreadDirect | Put thread into an operable state
OS_SetThreadPriority | Sets thread priority.
OS_GetThreadPriority | Obtains thread priority.
OS_GetCurrentThread | Obtains the current thread.
OS_GetNumberOfThread | Obtains the number of threads being created.
OS_DumpThreadList | Display all threads (for debug).

### Exclusion Control

(Overview) | Describes Mutex
OS_InitMutex | Initialize Mutex structure used for exclusive control
OS_LockMutex | Lock thread using Mutex
OS_UnlockMutex | Unlock the thread locked with Mutex
OS_TryLockMutex | Attempt to lock the thread locked with Mutex
(Overview-with spinLock) | Describes exclusive control using spinLock
OS_LockCard | Spin locks the card for exclusive control
OS_LockCartridge | Spin locks the Game Pak for exclusive control
OS_UnlockCard | Release a spin lock for the card
OS_UnlockCartridge | Release a spin lock for the Game Pak
OS_TryLockCard | Attempts to spin lock the card for exclusive control
OS_TryLockCartridge | Attempts to spin lock the Game Pak for exclusive control
OS_GetLockID | Obtains the lock ID for spin lock
OS_ReleaseLockID | Releases the lock ID used for spin lock

### Context

(Overview) | Describes context
OS_InitContext | Initialize context
OS_SaveContext | Save current context
OS_LoadContext | Load current context
OS_DumpContext | Display contents of context structure (for debug)

### Message

(Overview) | Describes the message system
OS_InitMessageQueue | Initialize message queue structure
OS_SendMessage | Insert message at end of message queue
OS_JamMessage | Inserts a message in the front of the message queue
OS_ReceiveMessage | Extract message from message queue
OS_ReadMessage | Copies the message that is at the front of the message queue.

### Cache

DC_Enable | Permits all data cache to be used.
DC_Disable | Prohibits all data cache from being used.
DC_Restore | Selects whether to permit or prohibit use of all data cache.
DC_InvalidateAll | Disables all data cache.
DC_StoreAll (DC_CleanAll) | Cleans all data cache.
DC_FlushAll (DC_CleanAndInvalidateAll) | Cleans and then disables all data cache.
DC_InvalidateRange | Disables specified range of data cache.
DC_StoreRange (DC_CleanRange) | Cleans specified range of data cache.
DC_FlushRange (DC_CleanAndInvalidateRange) | Cleans and then disables specified range of data cache.
DC_TouchRange | Loads specified range of data cache into cache.
DC_LockdownRange | Locks down specified range of data cache.
DC_WaitWriteBufferEmpty | Waits for the write buffer to empty.
IC_Enable | Permits all instruction cache to be used.
IC_Disable | Prohibits all instruction cache from being used.
IC_Restore | Selects whether to permit or prohibit use of all instruction cache.
IC_InvalidateAll | Disables all instruction cache.
IC_InvalidateRange | Disables specified range of instruction cache
IC_PrefetchRange | Pre-fetches specified range of instruction cache
IC_LockdownRange | Locks down specified range of instruction cache

### Arena

Summary | Introduction to Arenas.
OS_InitArena | Initializes the arena.
OS_SetArenaHi | Sets the upper boundary of the arena.
OS_Set*ArenaHi | Sets the upper boundary of the arena (arena specification).
OS_SetArenaLo | Sets the lower boundary of the arena.
OS_Set*ArenaLo | Sets the lower boundary of the arena (arena specification).
OS_GetArenaHi | Gets the upper boundary of the arena.
OS_Get*ArenaHi | Gets the upper boundary of the arena (arena specification).
OS_GetArenaLo | Gets the lower boundary of the arena.
OS_Get*ArenaLo | Gets the lower boundary of the arena (arena specification).
OS_AllocFromArenaHi | Allocates a region of specified size from the upper arena.
OS_AllocFrom*ArenaHi | Allocates a region of specified size from the upper arena (arena specification).
OS_AllocFromArenaLo | Allocates a region of specified size from the lower arena.
OS_AllocFrom*ArenaLo | Allocates a region of specified size from the lower arena (arena specification).

### Memory Allocation

Summary | Introduction to the Memory Allocation System.
OS_InitAlloc | Initializes the memory allocation system.
OS_ClearAlloc | Destroys the memory allocation system information.
OS_CreateHeap | Creates a heap.
OS_DestroyHeap | Destroys a heap.
OS_ClearHeap | Initializes a heap
OS_AddToHeap | Adds the specified memory block to the heap.
OS_SetCurrentHeap | Sets the current heap.
OS_AllocFromHeap | Allocate memory from the heap region.
OS_AllocFrom* | Allocate memory from the heap region (arena specification).
OS_Alloc | Allocate memory from the heap region (main memory arena)
OS_AllocFixed | Allocate the specified region.
OS_FreeToHeap | Free memory to the heap region.
OS_FreeTo* | Free memory to the heap region (arena specification).
OS_Free | Free memory to the heap region (main memory arena).
OS_FreeAllToHeap | Frees all allocated memory to the heap region.
OS_FreeAllTo* | Frees all allocated memory to the heap region. (arena specification)
OS_FreeAll | Frees all allocated memory to the heap region. (main memory arena)
OS_CheckHeap | Checks heap.
OS_DumpHeap | Displays heap contents (for debug).
OS_ReferentSize | Gets the size in memory of the memory block (excluding the header).
OS_VisitAllocated | Applies the specified function to all memory blocks.
OS_GetTotalAllocSize | Gets the total size of memory blocks allocated to heaps.
OS_GetTotalFreeSize | Gets total size of free blocks in heaps.
OS_GetMaxFreeSize | Gets the size of the largest free block in the heaps.

### System Information

OS_GetOwnerInfo | Obtains the owner information.
OSOwnerInfo | Structure that indicates the owner information.
OS_GetOwnerRtcOffset | Obtains the RTC modification offset information.
OS_GetMacAddress | Obtains the MAC address that is unique to each Nintendo DS system.
OS_GetFavoriteColorTable | Gets pointer to "favorite color" owner information.
OS_GetFavoriteColor | Gets color value of "favorite color" owner information.
OS_FAVORITE_COLOR_* | Definition value of "favorite color" owner information.

### Debug (Operation Environment)

OS_IsRunOnEmulator | Checks if the program is running on ensata.
OS_GetConsoleType | Checks the operation environment of the program.

### Debug (Character String Display)

OS_PutString | Displays the character string.
OS_Printf | Displays the character string with formatting.
OS_TPrintf | Displays the character string with formatting. This is a simplified version of `OS_Printf`.
OS_VPrintf | Displays the character string with formatting. Uses the list of arguments.
OS_TVPrintf | Displays the character string with formatting. This is a simplified version of `OS_VPrintf`.
OS_SPrintf | Outputs the formatted character string to the memory with variable arguments.
OS_VSPrintf | Outputs the formatted character string to the memory with the argument list.
OS_SNPrintf | Outputs the formatted character string to the memory with variable arguments (the size is specified).
OS_VSNPrintf | Outputs the formatted character string to the memory with the argument list (the size is specified).
OS_Warning | Displays a warning.
OS_TWarning | Displays a warning. This is a simplified version of `OS_TWarning`.

### Debug (Assert)

SDK_ASSERT* | Checks the requirements, displays a warning, and stops the program.
SDK_WARNING | Checks the requirements and displays a warning
OS_Panic | Stops the program.
OS_TPanic | Stops the execution of the program. This is a simplified version of `OS_Panic`.

### Debug (Function Call Trace)

OS_InitCallTrace | Sets the buffer of the function call trace.
OS_DumpCallTrace | Displays the contents of the function call trace buffer.
OS_DumpThreadCallTrace | Displays the contents of the function call trace buffer for the specified thread.
OS_CalcCallTraceLines | Calculates the number of lines for the function call trace from the buffer size.
OS_CalcCallTraceBufferSize | Calculates the buffer size for the function call trace from the number of lines.
OS_ClearCallTraceBuffer | Clears the contents of the function call trace buffer.
OS_EnableCallTrace | Enables the features of the function call trace.
OS_DisableCallTrace | Disables the features of the function call trace.
OS_RestoreCallTrace | Sets the function call trace features to enabled or disabled.

### Debug (Function Cost Measurement)

OS_InitFunctionCost | Sets the function cost measurement buffer.
OS_CalcFunctionCostLines | Calculates the amount of information for the function cost measurement from the buffer size.
OS_CalcFunctionCostBufferSize | Calculates the buffer size for the function cost measurement from the number of lines.
OS_ClearFunctionCostBuffer | Clears the contents of the function cost measurement buffer.
OS_EnableFunctionCost | Enables the features of the function cost measurement.
OS_DisableFunctionCost | Disables the features of the function cost measurement.
OS_RestoreFunctionCost | Sets the features of the function cost measurement to enabled or disabled.
OS_InitStatistics | Initializes the function cost calculation buffer.
OS_CalcStatistics | Calculates the contents of the measurement buffer to the function cost calculation buffer.
OS_CalcThreadStatitics | Calculates the contents of the measurement buffer to the function cost calculation buffer with a thread specification.
OS_DumpStatistics | Outputs the contents of the function cost calculation buffer.

### Debug (Stack Check)

OS_SetThreadStackWarningOffset | Sets the warning level for the thread stack overflow check.
OS_CheckStack | Checks the thread stack overflow.
OS_GetStackStatus | Obtains the stack overflow status of the thread.