osPiRawStartDma, osPiRawWriteIo, osPiRawReadIo, osPiGetStatus

Accesses the parallel interface (PI) without PI management (Cannot be used beginning from os2.0I/patch5)


#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);


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 in such cases. (For more information on this function, see osPiStartDma). Although the Raw routines are easy to use, the procedures stop soon after the application boots and before the operating system is initialized. osPiRawStartDma sets up a DMA transfer between the RDRAM virtual address vaddr and the PI device address devAddr as the basic input designation (OS_READ or OS_WRITE). The total size, nbytes, should be set within the range of the number of transfer bytes, to a maximum of 16 MB, and should be a multiple of 2 bytes. The PI device address vAddr should be at least 8 byte aligned, but a higher minimum is recommended for OS_READ_DMA operations. For a detailed description of the types of problems that may occur when the transfer is not a multiple of the cache line, see OS_DCACHE_ROUNDUP_ADDR. The osPiRawStartDma routine also polls the interface again before programming the DMA register.

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. The osPiRawReadIo routine performs a 32-bit programmed IO read from the PI device address specified by devAddr and returns the value in data. It also polls the interface for idleness before performing the operation. Note that the device address devAddr must be two-byte aligned.

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

A previously issued program IO request has not been completed.

A previously issued DMGA request has not been completed.

An IO request was issued while DMA was busy.

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

See Also