LeoReadWrite LeoReadWrite (function)

Reads and writes to the N64 Disk Drive


#include <PR/leo.h> /* leo.h */ s32 LeoReadWrite(LEOCmd *cmdBlock, s32 direction, u32 startLBA, void *vaddr, u32 nLBAs, OSMesgQueue *mq);


Note: None of the N64 Disk Drive-related instructions involve ROM DMA (including DMA to ROM in the drive). In fact, the instructions are designed on the assumption that ROM DMA will not be carried out. To learn more about this, please see "Chapter 12: Programming Cautions" in the N64 Disk Drive Programming Manual.

LeoReadWrite reads and writes between RDRAM and the N64 Disk Drive. This function is used to set up various parameters of the command block specified by the cmdBlock argument in accordance with the following arguments specified on the call side:

nLBAs specifies the size of the logical block to be transferred.

Use 16-byte alignment to store the RDRAM virtual address specified by the vaddr argument. This can be easily done by using OS_DCACHE_ROUNDUP_ADDR.

The cmdBlock._nbytes element stores the current extent to which the read or write has been performed. So even if an error is returned, the data that has been correctly read up to that point can be used.

Nothing needs to be set for the command block cmdBlock argument. When processing of this function ends, an error code is returned to the message queue mq. An error could arise, so the programmer needs to check this error code.

For more information about the errors that may be returned, their causes, and ways to deal with them, please see "Chapter 10: Error-Handling" in the N64 Disk Drive Programming Manual.

The return value is -1 if Leo Manager has not been created, and 0 if it has. Usually no check is necessary.


LEOCmd cmdBlock; u32 error; ..... LeoReadWrite(&cmdBlock, OS_READ, 5, (void*)0x80200000, 100, &diskQ); osRecvMesg(&diskQ, (OSMesg *)&error, OS_MESG_BLOCK);

See Also


Revision History

04/30/1999 Changed Format