DC_FlushRange

Syntax

#include <nitro/os.h>
void DC_FlushRange( const void* startAddr, u32 nBytes );

void DC_CleanAndInvalidateRange( const void* startAddr, u32 nBytes );

Arguments

startAddr Lowest address in the region to be flushed.
nBytes Number of bytes of the region to be flushed.

Return Values

None.

Description

Flushes the data in the specified data cache region.

Specifically, this function performs a cache writeback in a dirty state (state when a write to data cache corresponding to the specified memory region is not reflected in main memory), discards data in that cache region, and places it in an invalid state.

Call this function when completing data transmission data blocks that use the main memory of other devices, such as when performing DMA transfers or creating graphics commands.

startAddr is rounded down to the closest 32-byte boundary. The sum of startAddr + nBytes is rounded up to the closest 32-byte boundary.

DC_CleanAndInvalidateRange is another name for DC_FlushRange and operates exactly the same way. DC_Clean*/DC_CleanAndInvalidate* were prepared for porting from the prototype SDK version. In most cases, use DC_Store*/DC_Flush*.


Note

The official documentation for the ARM processor sometimes describes Flush as the operation that invalidates the data cache, Clean as the operation that writes back the data cache and puts it into a clean state, and Clean and Flush as the operation that writes back and then invalidates. However, this SDK follows the conventions of the Nintendo GameCube and Nintendo64 by using Invalidate for invalidation, Store for writeback, and Flush for writeback and invalidate operations.  

Internal Operation

Operates register 7 of the system control coprocessor.

This function divides the specified region into cache-line units and repeats its operation over and over. Thus the amount of time it takes is proportional to the size of the region. If the region is large and the system is in a state where it can successfully manage the cache for the entire application, calling DC_FlushAll() will require less processing time.

See Also

IC_InvalidateAll IC_InvalidateRange
DC_InvalidateAll DC_InvalidateRange
DC_StoreAll DC_StoreRange
DC_FlushAll

Revision History

2005/11/14 Changed the type of startAddr to const void*.
2005/04/19 Added a description of the reason why processing time is proportional to the size of the memory region.
2003/12/22 Initial version.


CONFIDENTIAL