#include <nitro/mi.h>
BOOL MI_ReadCache(MICache *cache, void *buffer, u32 offset, u32 length);
cache | Pointer to the MICache structure to access.The cache must have been initialized using MI_InitCache() . |
buffer | The destination memory to store the loaded data.
Specifying NULL indicates cache preloading for the specified area. For more details, see the Description section below. |
offset | The start address of the device to which data should be read. |
length | Data size to load. |
Returns TRUE if the cache is hit and the read succeeds; otherwise, returns FALSE.
Reads data from the cache page list of the MICache
structure.
If the data in the specified range has already been loaded with MI_LoadCache()
, it will copy data from the cache page list and return TRUE.
If part or all of the specified range does not exist in the cache page list, it will destroy the least-used page within the cache page list, set it to the "waiting to load" state, and return FALSE.
Pages that enter the "waiting to load" state will actually be loaded during the subsequent call to MI_LoadCache()
.
If NULL is specified for buffer (the destination memory for the transfer), nothing will happen if there is a hit in the cache, but the same processing will apply for putting pages in areas that didn't have hits into the "waiting to load" state. Therefore, this function can be used to instruct to prepare for prefetch the specified range.
This function is thread-safe. This function can be used even while MI_LoadCache()
or other such functions are being called in other threads.
This feature is a utility that enables efficient read access to devices. For more information, see the reference for the MICache
structure.
MI_InitCache, MI_LoadCache, MI_IsCacheLoading
MICache
2007/05/16 Initial version.
CONFIDENTIAL