CPU Architecture Cache API

Module: CPU Architecture API

More…

Functions

Name

void

Arch_Cache_Wb(const void * addrPtr, uint32_t sizeBytes)
Writeback (clean) data cache lines for the specified address range.

void

Arch_Cache_Inv(const void * addrPtr, uint32_t sizeBytes)
Invalidate data cache lines for the specified address range.

void

Arch_Cache_WbInv(const void * addrPtr, uint32_t sizeBytes)
Writeback (clean) and invalidate data cache lines for the specified address range.

Defines

Name

ARCH_CACHE_CACHELINE_ALIGNMENT_BYTES
Cache line size for alignment of buffers in bytes.

Detailed Description

Note: These APIs are intended for data cache management only. Instruction cache management is typically not required in most applications, if necessary use CPU specific API.

This includes APIs for various data cache maintenance operations such as invalidation and writeback(cleaning).

CPU architecture specific notes,

  • C29,

    • Not Supported, All APIs will return gracefully without doing anything.

  • R52,

    • All APIs should be used only from a privileged mode. This is due to access restrictions in User mode to read/modify various system registers.

    • The write behavior for the data cache is always write-through whatever the region attribute is write-back or write-through

  • M33,

    • Not Supported, All APIs will return gracefully without doing anything.

Functions Documentation

function Arch_Cache_Wb

void Arch_Cache_Wb(
    const void * addrPtr,
    uint32_t sizeBytes
)

Writeback (clean) data cache lines for the specified address range.

Parameters:

  • addrPtr Start address of the memory region. Recommended to be cache line aligned.

  • sizeBytes Size of the memory region in bytes. Recommended to be a multiple of the cache line size.

function Arch_Cache_Inv

void Arch_Cache_Inv(
    const void * addrPtr,
    uint32_t sizeBytes
)

Invalidate data cache lines for the specified address range.

Parameters:

  • addrPtr Start address of the memory region. Recommended to be cache line aligned.

  • sizeBytes Size of the memory region in bytes. Recommended to be a multiple of the cache line size.

function Arch_Cache_WbInv

void Arch_Cache_WbInv(
    const void * addrPtr,
    uint32_t sizeBytes
)

Writeback (clean) and invalidate data cache lines for the specified address range.

Parameters:

  • addrPtr Start address of the memory region. Recommended to be cache line aligned.

  • sizeBytes Size of the memory region in bytes. Recommended to be a multiple of the cache line size.

Macros Documentation

define ARCH_CACHE_CACHELINE_ALIGNMENT_BYTES

#define ARCH_CACHE_CACHELINE_ALIGNMENT_BYTES (64U)

Cache line size for alignment of buffers in bytes.

Note: Actual CPU cache line can be smaller than this value, this define is a utility macro to keep application portable across different CPU’s. Refer CPU specific define (ARCH__CACHE_LINE_SIZE_BYTES) for actual cache line size.