List of Operating System (OS) Functions

Address Conversion

OSPhysicalToCached Converts a physical address into a cached address.
OSPhysicalToUncached Converts a physical address into an address outside the cache.
OSCachedToPhysical Converts a cached address into a physical address.
OSUncachedToPhysical Converts an address outside the cache into a physical address.
OSCachedToUncached Converts a cached address into an address outside the cache.
OSUncachedToCached Converts an address outside the cache into a cached address.
OSRoundUp32B Retrieves the closest 32-byte upper boundary.
OSRoundDown32B Retrieves the closest 32-byte lower boundary.

Alarms

OSCancelAlarm Cancels the specified alarm.
OSCancelAlarms Cancels alarm groups that have the same tag.
OSCreateAlarm Initializes the structure for the specified alarm.
OSSetAlarm Sets an alarm.
OSSetAlarmTag Sets a tag to an alarm.
OSSetPeriodicAlarm Sets a periodic alarm.
OSSetAlarmUserData Sets user data in an alarm.
OSGetAlarmUserData Gets user data from an alarm.

Arena

OSAllocFromMEM1ArenaHi Allocates size bytes from the upper boundary of the arena in internal main memory (MEM1 area).
OSAllocFromMEM1ArenaLo Allocates size bytes from the lower boundary of the arena in internal main memory (MEM1 area).
OSAllocFromMEM2ArenaHi Allocates size bytes from the upper boundary of the arena in external main memory (MEM2 area).
OSAllocFromMEM2ArenaLo Allocates size bytes from the lower boundary of the arena in external main memory (MEM2 area).
OSGetMEM1ArenaHi Gets the upper boundary of the arena in internal main memory (MEM1 area).
OSGetMEM1ArenaLo Gets the lower boundary of the arena in internal main memory (MEM1 area).
OSGetMEM2ArenaHi Gets the upper boundary of the arena in external main memory (MEM2 area).
OSGetMEM2ArenaLo Gets the lower boundary of the arena in external main memory (MEM2 area).
OSSetMEM1ArenaHi Sets the upper boundary of the arena in internal main memory (MEM1 area).
OSSetMEM1ArenaLo Sets the lower boundary of the arena in internal main memory (MEM1 area).
OSSetMEM2ArenaHi Sets the upper boundary of the arena in external main memory (MEM2 area).
OSSetMEM2ArenaLo Sets the lower boundary of the arena in external main memory (MEM2 area).

Cache (Data Cache)

Data Cache

DCFlushRange Flushes the specified region of the data cache.
DCFlushRangeNoSync Invalidates a specified data cache range.
DCFreeze Current contents of the L1 data cache are locked and will not be invalidated.
DCInvalidateRange Invalidates the specified region of the data cache.
DCStoreRange Reflects (writes back) the data in the specified region of the data cache to real memory.
DCStoreRangeNoSync Securely updates specified memory range with modified data in the cache.
DCTouchRange Loads specified range of memory into the cache.
DCUnfreeze Cancels the effect of the DCFreeze function.
DCZeroRange Loads the range of memory into the cache and sets all cache blocks to zero.

Instruction Cache

ICFreeze Current contents of the L1 instruction cache are locked and will not be invalidated.
ICInvalidateRange Invalidates the specified region of the instruction cache.
ICUnfreeze Cancels the effect of the ICFreeze function.

Locked Cache

LCDisable Disables the locked cache and returns the cache to the normal 32-KB and 8-way set associative state.
LCEnable Enables the locked cache.
LCGetBase Returns a base pointer to the locked cache region. 
LCFlushQueue Flushes the DMA queue and issues SYNC until all DMA transfers are committed.
LCLoadBlocks Places DMA transactions in the queue.
LCLoadData Places DMA transactions in the queue.
LCQueueLength Returns the number of remaining transactions in the DMA queue. 
LCQueueWait Polls the DMA queue length until it is less than or equal to the specified length.
LCStoreBlocks Places DMA transactions in the queue.
LCStoreData Places DMA transactions in the queue.

Error

ASSERT Displays messages for debugging.
ASSERTMSG Displays messages for debugging (specified as a character string).
OSFatal Stops program execution and displays the specified text message on the TV screen.
OSHalt Displays the specified character string and stops the OS.
OSProtectRange Sets main memory access protection for the specified region.
OSReport A formatted message is displayed in the log window of the debugger.
OSSetErrorHandler Implements an error handler for the specified error type.

Execution

OSExecl Executes new dol files (argument specified as a list).
OSExecv Executes new dol files (argument specified as an array).

Fast Cast

OSf32tos16 Fast-converts single-precision floating point values to signed 16-bit integers.
OSf32tos8 Fast-converts single-precision floating point values to signed 8-bit integers.
OSf32tou16 Fast-converts single-precision floating point values to unsigned 16-bit integers.
OSf32tou8 Fast-converts single-precision floating point values to unsigned 8-bit integers.
OSInitFastCast Sets up the floating point number/integer fast-cast feature. 
OSs16tof32 Fast-converts signed 16-bit integers to 32-bit floating point values.
OSs8tof32 Fast-converts signed 8-bit integers to 32-bit floating point values.
OSu16tof32 Fast-converts unsigned 16-bit integers to 32-bit floating point values.
OSu8tof32 Fast-converts unsigned 8-bit integers to 32-bit floating point values.
OSSetGQR[n] Sets value to a quantization register GQR in the Broadway CPU.

Font

OSGetFontEncode Checks the encoding method of a character font.
OSGetFontTexel Retrieves the font texel image of the first text character from the specified string.
OSGetFontTexture Gets a pointer to the font texture image of the first text character in the specified string.
OSGetFontWidth Gets the texel width of the first text character in the specified string.
OSInitFont Loads and expands ROM font data.
OSLoadFont Loads a ROM font.

Idle Function

OSGetIdleFunction Gets the current background execution context.
OSSetIdleFunction Generates a background execution context.

Initialization

OSGetConsoleSimulatedMem1Size Gets the size of internal main memory (MEM1) that simulates a console.
OSGetConsoleSimulatedMem2Size Gets the size of external memory (MEM2) that simulates a console.
OSGetConsoleType Checks the console type.
OSGetAppGamename Gets the game name.
OSGetAppType Gets the game type.
OSGetPhysicalMem1Size This function is retained for compatibility with older versions. Gets the internal main memory size of the Hollywood that is mounted in development machines.
OSGetPhysicalMem2Size Gets the size of the external main memory (GDDR3) that is mounted in development machines.
OSInit Initializes the OS. 

Interrupts

OSDisableInterrupts Disables external interrupts.
OSEnableInterrupts Enables external interrupts.
OSRestoreInterrupts Restores the interrupt state to a previous state.

Memory Allocation (MEM Library is recommended)

OSAddToHeap Adds an arbitrary block of memory to the heap.
OSAlloc Allocates memory from the current heap.
OSAllocFixed Allocates the explicitly specified region of memory.
OSAllocFromHeap Allocates memory from the specified heap region.
OSCheckHeap Checks that the heap region is normal for debugging.
OSCreateHeap Creates a heap.
OSDestroyHeap Destroys a heap.
OSDumpHeap Dumps statistical information and elements for the heap region.
OSFree Frees memory referenced by a pointer to the current heap.
OSFreeToHeap Returns freed memory to the specified heap.
OSInitAlloc Initializes memory allocation services and the arena in which all heaps will reside. 
OSSetCurrentHeap Sets the current heap.

Resetting

OSIsRestart Checks whether boot up was from a restart.
OSGetResetCode Returns the reset code.
OSGetSaveRegion Gets the region specified by OSSetSaveRegion.
OSGetSavedRegion Gets the region specified by OSSetSaveRegion.
OSSetSaveRegion Sets a region that must not be cleared by OSInit after restart.
OSRebootSystem Restarts (hot resets) the system.
OSRestart Restarts the application.
OSReturnToMenu Terminates execution of the applications and restores execution to the system menu.
OSShutdownSystem Terminates execution of the applications and turns off the system power (shutdown).

RESET Button

OSGetResetButtonState Checks the current state of the RESET Button.
OSSetResetCallback Registers a one-time reset callback.
OSSetPowerCallback Registers a one-time power button callback.

Relocatable Module System (You can also use the RSO library)

OSLink Links the specified module.
OSLinkFixed Links the specified module and releases some memory that the relocatable module occupies.
OSUnlink Unlinks the specified module.
OSSearchModule Searches for the module which includes the specified address.
OSSetStringTable Specifies the module string table location.

Stack

OSClearStack Sets specified value on the stack of the thread being called.
OSGetStackPointer Gets the current stack pointer address (r1).
OSSwitchFiber Executes a function that uses the new stack.
OSSwitchFiberEx Executes a function that uses the new stack. The function can pass an argument.
OSSwitchStack Switches the current stack pointer.

Stopwatch

OSInitStopwatch Initializes designated stopwatch structure.
OSStartStopwatch Records the current time (starts the stopwatch).
OSStopStopwatch Records the current time (stops the stopwatch). Updates the accumulated time since OSStartStopwatch.
OSCheckStopwatch Checks whether the stopwatch function is running.
OSResetStopwatch Initializes designated stopwatch structure.
OSDumpStopwatch Writes to the debug channel some information sets (interval, total time, and so on) measured by the stopwatch.

Synchronization

PPCSync Executes a standard PowerPC sync instruction.

Time

OSDiffTick Returns the difference between two tick values.
OSGetTime Gets the value of the time base register (64-bit width) in units of OS_TIMER_CLOCK Hz.
OSGetTick Gets a tick (gets the 32 low order bits of Broadway's time base register).
OSTicksToCycles Converts time from ticks to CPU core cycle units (OS_CORE_CLOCK Hz).
OSTicksToSeconds Converts value from ticks to seconds.
OSTicksToMilliseconds Converts value from ticks to milliseconds.
OSTicksToMicroseconds Converts value from ticks to microseconds.
OSTicksToNanoseconds Converts value from ticks to nanoseconds.
OSSecondsToTicks Converts value from seconds to ticks.
OSMillisecondsToTicks Converts value from milliseconds to ticks.
OSMicrosecondsToTicks Converts value from microseconds to ticks.
OSNanosecondsToTicks Converts value from nanoseconds to ticks.
OSCalendarTimeToTicks Converts value from calendar time to ticks (OS_TIMER_CLOCK Hz).
OSTicksToCalendarTime ( Converts value from ticks (OS_TIMER_CLOCK Hz) to calendar time.

Thread

OSCancelThread Stops the specified thread. 
OSCheckActiveThreads Executes as many checks for normalcy as possible by tracing an active thread queue.
OSCreateThread Creates a new thread.
OSDetachThread Sets the detached attribute for the specified thread. 
OSDisableScheduler Stops thread rescheduling temporarily.
OSEnableScheduler Restarts thread rescheduling.
OSExitThread Ends the current (called) thread and switches to the next executable thread.
OSGetCurrentThread Gets the pointer to the current thread.
OSGetThreadPriority Returns the priority order that will become the scheduling base for the specified thread.
OSGetThreadSpecific Gets data specific to the thread that called this function.
OSInitThreadQueue Initializes the thread queue that other thread functions use.
OSIsThreadSuspended Checks whether the specified thread is suspended.
OSIsThreadTerminated Checks whether the specified thread is stopped.
OSJoinThread Waits for the specified thread to terminate and reproduces information for that thread.
OSResumeThread Resumes the specified thread.
OSSetThreadPriority Sets the priority level used as the scheduling base.
OSSetThreadSpecific Gets data specific to the thread that called this function.
OSSetSwitchThreadCallback Registers a specified callback function.
OSSleepThread Suspends the current thread and inserts it into the specified thread queue.
OSSuspendThread Suspends the specified thread.
OSWakeupThread Wakes up all the threads in the specified thread queue. 
OSYieldThread Performs thread rescheduling.
OSSleepMicroseconds Temporarily stops the current thread and sets executable status after the specified number of microseconds have elapsed.
OSSleepMilliseconds Temporarily stops the current thread and sets executable status after the specified number of milliseconds have elapsed.
OSSleepNanoseconds Temporarily stops the current thread and sets executable status after the specified number of nanoseconds have elapsed.
OSSleepSeconds Temporarily stops the current thread and sets executable status after the specified number of seconds have elapsed.
OSSleepTicks Temporarily stops the current thread and sets executable status after the specified number of ticks have elapsed.

Thread Synchronization

Mutexes and Condition Variables

OSInitCond Initializes condition variables. 
OSInitMutex Initializes mutexes.
OSLockMutex Attempts to lock the mutex that mutex specifies.
OSSignalCond Unblocks all the threads waiting on the specified condition variable. 
OSTryLockMutex The calling thread tries to lock the mutex.
OSUnlockMutex The calling thread unlocks the mutex.
OSWaitCond Blocks the calling thread on the condition variable and releases the mutex.

Message Queues

OSInitMessageQueue Initializes the message queue structure.
OSJamMessage Inserts a message at the start of the specified message queue.
OSReceiveMessage Extracts a message from the message queue.
OSSendMessage Inserts a message at the end of the specified message queue.

Semaphores

OSGetSemaphoreCount Returns the current semaphore count.
OSInitSemaphore Initializes semaphores.
OSSignalSemaphore Increments the specified semaphore count.
OSTryWaitSemaphore If the semaphore count is greater than zero, the count is decremented.
OSWaitSemaphore Decrements the specified semaphore count.

Transitions to the Wii Menu or NAND Applications

OSReturnToMenu Terminates execution of the applications and restores execution to the system menu.
OSReturnToDataManager Ends running applications and moves execution to the Data Management screen of System Menu.
OSReturnToSetting Ends running applications and moves execution to the System Settings screen of System Menu.
OSLaunchManualViewer Ends running applications and moves execution to the Manual viewer.This cannot be used by disc applications.

CONFIDENTIAL