List of Operating System API 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 cache 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.
OSCreateAlarm Initializes the structure for the specified alarm.
OSCancelAlarms Cancels alarm groups that have the same tag.
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 The 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 len.
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 on the log window of the debugger.
OSSetErrorHandler Implements an error handler of 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

Introduction Overview of the internal ROM fonts.
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 the 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.
OSGetPhysicalMem1Size This function is retained for compatibility with older versions. Gets the internal main memory size of Hollywood that is mounted in a development machine.
OSGetPhysicalMem2Size Gets the size of the external main memory (GDDR3) that is mounted on a development machine.
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.

Reset

Introduction This is an overview of the reset and shutdown functions.
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 (restarts) the application.
OSReturnToMenu Terminates execution of the applications and restores execution to the system menu.
OSShutdownSystem Terminates execution of the application and turns off the system power (shutdown).

RESET

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

Introduction An overview of the relocatable module system.
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 the module which includes the specified address.
OSSetStringTable Specifies the module string table location.

Stack

OSClearStack Sets the val value to the stack of the thread to call.
OSGetStackPointer Gets the current stack pointer address (r1).
OSSwitchFiber Executes a function that uses the new stack.
OSSwitchStack Switches the current stack pointer.

Stopwatch

OSInitStopwatch Initializes the specified stopwatch structure.
OSStartStopwatch Records the current time (start stopwatch).
OSStopStopwatch Records the current time (stop stopwatch). Updates the cumulative time from OSStartStopwatch.
OSCheckStopwatch Checks whether the stopwatch function is running.
OSResetStopwatch Initializes the specified stopwatch structure.
OSDumpStopwatch Writes to the debug channel some information sets (interval, total time, etc.) that the stopwatch measures.

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 cycles units ( OS_CORE_CLOCK Hz).
OSTicksToSeconds Converts value from unit of ticks to seconds.
OSTicksToMilliseconds Converts value from unit of ticks to milliseconds.
OSTicksToMicroseconds Converts value from unit of ticks to microseconds.
OSTicksToNanoseconds Converts value from unit of ticks to nanoseconds.
OSSecondsToTicks Converts value from unit of seconds to ticks.
OSMillisecondsToTicks Converts value from unit of milliseconds to ticks.
OSMicrosecondsToTicks Converts value from unit of microseconds to ticks.
OSNanosecondsToTicks Converts value from unit of nanoseconds to ticks.
OSCalendarTimeToTicks Converts value from unit of calendar time to ticks (OS_TIMER_CLOCK Hz).
OSTicksToCalendarTime

(Converts value from unit of ticks (OS_TIMER_CLOCK Hz) to calendar time.

Thread

OSCancelThread Stops the specified thread. 
OSCheckActiveThreads Executes as many checks as possible by tracing an active thread queue.
OSCreateThread Creates a new thread.
OSDetachThread Sets the detached attribute for the specified thread. 
OSDisableScheduler Pauses thread rescheduling.
OSEnableScheduler Restarts thread rescheduling.
OSExitThread Ends the current (called) thread and switches to the next runnable 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 end and reproduces information for the ended thread.
OSResumeThread Resumes the specified thread (incremental).
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 thread queue that queue specifies..
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 of the system clock have elapsed.

Thread Synchronization

Mutexes and Condition Variables

OSInitCond Initializes the condition variable. 
OSInitMutex Initializes the mutex.
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 mq
OSJamMessage Inserts a message at the start of the specified message queue.
OSReceiveMessage Extracts messages 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.


CONFIDENTIAL