OS_DCACHE_ROUNDUP_SIZE OS_DCACHE_ROUNDUP_SIZE (Macro)

OS_DCACHE_ROUNDUP_ADDR, OS_DCACHE_ROUNDUP_SIZE

Rounds up the address value to the size value/physical address, to match the data cache line size

Syntax

#include <ultra64.h>     /* ultra64.h */
void *OS_DCACHE_ROUNDUP_ADDR(void *vaddr);
u32 OS_DCACHE_ROUNDUP_SIZE(u32 nbytes);

Description

OS_DCACHE_ROUNDUP_ADDR is a cpp macro that rounds up an address to an alignment matching that of the R4300 data-cache line size (16 bytes). Similarly, the OS_DCACHE_ROUNDUP_SIZE macro rounds up an integer value to the data-cache line size.

You can apply these macros on an address range given to an agent external to the CPU (such as the PI, SP, or DP) that modifies physical memory directly. If the affected memory region is not cache-aligned, there exists the possibility that a CPU program variable also shares the data-cache line. During normal operation of the CPU cache, the data cache line can be written back and overwrite the data written by the external agent.

See Also

osPiRawStartDma, osPiStartDma, osSpTaskLoad, and osDpSetNextBuffer

Revision history

1999/04/30 Changed format