N64® Functions Menu

al - Audio Library Functions
gDP - DP GBI Macros
gdSP - General GBI Macros
gSP - SP GBI Macros
gt - Turbo Microcode RDP
gu - Graphics Utilities
Math - Math Functions
nuSys - NuSystem
os - N64 Operating System
sp - Sprite Library Functions
uh - Host to Target IO
64DD - N64 Disk Drive

Nintendo® Confidential

## osPiRawStartDma

Cannot be used beginning from os2.0I/patch5.

Syntax

    #include <ultra64.h>
    s32 osPiRawStartDma(s32 direction, u32 devAddr, void *vAddr, u32 nbytes);
    s32 osPiRawWriteIo(u32 devAddr, u32 data);
    s32 osPiRawReadIo(u32 devAddr, u32 *data);
    u32 osPiGetStatus(void);

Explanation
The parallel interface (PI) serves to transfer data between RDRAM and devices such as ROM, RAM, and magnetic disks. The functions shown above provide low-level PI access. These functions should be used only when it can be guaranteed that operations that access the PI will not be performed. These operations include debugging, printing, logging, and profiling. The reason for this is that the access routine that includes PI management can be used most efficiently is such cases.

Based on the specified input direction (OS_READ or OS_WRITE), The osPiRawStartDma routine sets up a DMA transfer between RDRAM virtual address specified by vAddr and the PI device address specified by devAddr. The length count specified by the nbytes argument contains the number of bytes to transfer (up to 16 megabytes) and must be a multiple of two bytes. The PI device address specified by the devAddr argument must be two-byte aligned. The RDRAM virtual PI device address specified by vAddr must be at least eight-byte aligned, but for OS_READ DMA operations, a stricter alignment is recommended. See OS_DCACHE_ROUNDUP_ADDR for a description of the problems that can result when transfers are not an integral number of cache lines. The osPiRawStartDma routine also polls the interface for idleness before programming the DMA registers.

The osPiRawWriteIo routine performs a 32-bit programmed IO write to the PI device address specified by the devAddr argument. It polls the interface for idleness before performing the operation.

osPiGetStatus simply returns the PI hardware status. The 32-bit values returned include the following bit patterns.

PI_STATUS_TO_IO_BUSY
  A previously issued program IO request has not been completed.
PI_STATUS_DMA_BUSY
  A previously issued DMA request has not been completed.
PI_STATUS_ERROR
  An IO request was issued while DMA was busy.

The osPiGetStatus routine is most often used to confirm that the last of the latest series of IO requests has been completed.
See Also
osPiStartDma

Nintendo® Confidential Warning: all information in this document is confidential and covered by a non-disclosure agreement. You are responsible for keeping this information confidential and protected. Nintendo will vigorously enforce this responsibility.
Copyright © 1998
Nintendo of America Inc. All rights reserved
Nintendo and N64 are registered trademarks of Nintendo
Last updated March 1998