LCLoadData

C Specification

#include <revolution/os.h>
u32 LCLoadData(void* destAddr, void* srcAddr, u32 nBytes);

Arguments

destAddr Start address for the locked cache region of the copy destination. Must be 32 byte-aligned.
srcAddr Start address for data in main memory to copy to destAddr. Must be 32 byte-aligned.
nBytes Transfer size. Must be 32 byte-aligned.

Return Values

The number of transfers added to the DMA queue.

Description

Enqueues DMA transfers to load data into the locked cache at destAddr from main memory at srcAddr. The range of valid transfer destination addresses is the 16-KB region starting from the value returned by the LCGetBase function. The number of transfers issued is returned as a return value.

The only ways to determine if the transfers are complete are to poll the length of the DMA queue with the LCQueueLength function or to wait until the queue length reaches a certain value with the LCQueueWait function. See the LCStoreData function example in the Function Reference. 

The largest size that can be transferred with a single DMA transfer is 128 cache blocks (4 KB). Thus, the number of transfers added to the DMA queue is always CEILING (rounded up) (nBytes/4 KB). The LCLoadBlocks function is a more efficient function that generates a single DMA transfer. However, it has no error checking and argument restrictions.

A maximum of 15 outstanding DMA transfers in the DMA queue is allowed. If the queue overflows, a machine check exception occurs.

The locked cache must be enabled, otherwise a machine check exception will occur during the DMA.

If DMA finds destination addresses in the normal cache, a machine check exception will occur.

See Also

Cache Functions,
LCEnable, LCStoreData, LCQueueLength, LCQueueWait, LCLoadBlocks

Revision History

03/01/2006 Initial version.