8.8 Device Dependent System Interface
The device-dependent system interface is actually composed of two layers of function calls: a high-level abstraction layer and a low-level, raw I/O layer. In addition to providing mutual exclusion on devices that support both DMA and I/O operations, the high-level layer also uses the lower layer to initiate raw I/O operation. The reason for exposing the raw I/O layer is to allow you to construct your own custom I/O software interface. Furthermore, if the user application requires no protection for accessing devices, using the low-level layer directly is the optimal way to request I/O operation.
In the following sections, APIs are partitioned and described under each device/interface separately. Routines also are explained under each control operation / data transmitting operation separately. For high-level operation, each function name starts with os<DeviceName> for easy identification. For low-level operation, the function name starts with os<DeviceName>Raw. Please refer to the appropriate reference pages for specifics about the arguments, return values, and behavior of these functions.
8.8.1 Signal Processor (SP) Functions
- osSpTaskStart
- This function loads a task and starts it running.
- osSpTaskYield
- This function asks a task running on the SP to yield.
- osSpTaskYielded
- This function checks to see if a recently completed task has yielded.
8.8.2 Display Processor (DP) Functions
- osDpGetStatus
- This function returns the value of the DP status register. The include file rcp.h contains bit patterns that can be used to interpret the device status.
- osDpSetStatus
- This function allows you to set various features in the DP command register. Refer to the include file rcp.h for bit patterns and their usage.
- osDpSetNextBuffer
- This function sets up the proper registers to initiate a DMA transfer from RDRAM address to the DP command buffer.
8.8.3 Video Interface (VI) Functions
- osCreateViManager
- This function creates and starts the VI manager (VIM) system thread.
- osViGetStatus
- This function returns the value of the video interface status register. The include file rcp.h contains bit patterns that can be used to interpret the device status.
- osViGetCurrentLine
- This function returns the current half line.
- osViGetCurrentMode
- This function returns the current VI mode type.
- osViGetCurrentFramebuffer
- This function returns the currently displaying frame buffer.
- osViGetNextFramebuffer
- This function returns the next frame buffer to be displayed.
- osViGetCurrentField
- This function returns the current field (either 0 or 1) being accessed by VI manager.
- osViSetMode
- This function sets the VI mode to one of the possible 28 modes. The new mode takes effect at the next vertical retrace interrupt.
- osViSetEvent
- This function registers a message queue with the VI manager to receive the notification of a vertical retrace interrupt.
- osViSet[X/Y]Scale
- These two functions allow you to change the horizontal scale-up factor (x-scale) and vertical scale-up factor (y-scale), respectively.
- osViSetSpecialFeatures
- This function enables/disables various special mode bits in the control register.
- osViSwapBuffer
- This function registers the frame buffer with the VI manager to be displayed at the next vertical retrace interrupt.
8.8.4 Audio Interface (AI) Functions
- osAiGetStatus
- This function simply returns the value of the audio interface status register. The include file rcp.h contains bit patterns that can be used to interpret the device status.
- osAiGetLength
- This function simply returns the number of bytes remaining in the audio interface DMA length register.
- osAiSetFrequency
- This function configures the audio interface to support the requested frequency (in Hz). It calculates necessary values to program internal divisors and returns the closest frequency that the divisors can generate.
- osAiSetNextBuffer
- This function programs the next DMA transfer based on the input length and starting buffer address.
8.8.5 Parallel Interface (PI) Functions
- osCreatePiManager
- This function creates and starts the PI manager (PIM) system thread.
- osPiGetStatus
- This function simply returns the value of the hardware status register. The include file rcp.h contains bit patterns that can be used to interpret the peripheral status (that is, DMA busy and I/O busy).
- osPiRawStartDma
- This low-level function sets up the proper registers to initiate a DMA transfer between ROM and RDRAM.
- osPiRaw[Read/Write]Io
- These two low-level functions perform an I/O (32-bit) read/write from/to ROM address space, respectively.
- osPi[Read/Write]Io
- These two functions perform I/O (32-bit) read/write from/to ROM address space, respectively. Since they provide mutual exclusion for accessing the PI device, these routines are both blocked I/O calls.
- osPiStartDma
- This function generates an asynchronous I/O request to the PI manager to initiate a DMA transfer between RDRAM and ROM address space. Upon I/O completion, PI manager notifies the requester by returning the I/O request message to the message queue specified by the requester (request-side thread).
8.8.6 Controller Functions
- osContInit
- This function initializes all the game controllers and returns a bit pattern to indicate which game controllers are connected.
- osContReset
- This function resets all game controllers and returns their Control Sticks to neutral position.
- osContStartQuery
- This function issues a query command to all game controllers to obtain their status and type.
- osContGetQuery
- This function returns the game controllers' status and type.
- osContStartReadData
- This function issues a read data command to all game controllers to obtain their input settings.
- osContGetReadData
- This function returns the game controllers' Control Stick data and button settings.