41static const char*
const s_tag =
"ra8_cache";
49typedef enum : uintptr_t {
67typedef enum : uint32_t {
94 return (
volatile uint32_t*)addr;
101 const uint32_t dmin =
132 const uintptr_t mask = (uintptr_t)line - 1U;
133 const uintptr_t start = addr & ~mask;
134 const uintptr_t last = (addr + (uintptr_t)size - 1U) & ~mask;
136 return (uint32_t)((last - start) / (uintptr_t)line) + 1U;
169 uintptr_t start = 0U;
172 for (uint32_t i = 0U; i < lines; ++i) {
226 if ((ccsidr == 0U) || (ccsidr == UINT32_MAX)) {
237 }
while (ways-- != 0U);
238 }
while (sets-- != 0U);
static const char * s_tag
Logging / check tag.
Annotation-attribute framework macros for ra8-firmware.
#define RA8_INTERNAL
Marker that a function is intended to be static (file-local).
static void internal_ra8_cache_setway_all(ra8_cache_reg_addr_t op_reg)
Apply a set/way maintenance op to every line of the L1 D-cache.
static volatile uint32_t * internal_ra8_cache_reg(ra8_cache_reg_addr_t addr)
Typed pointer to a 32-bit SCB cache register.
void ra8_cache_dcache_disable(void)
Disable the Cortex-M85 L1 data cache, cleaning dirty lines (CCR.DC).
void ra8_cache_icache_disable(void)
Disable the Cortex-M85 L1 instruction cache and invalidate it (CCR.IC).
ra8_cache_reg_addr_t
Arm v8-M SCB cache-maintenance register addresses (PPB 0xE000Exxx).
@ k_ra8_cache_iciallu
I-cache invalidate all to PoU.
@ k_ra8_cache_ctr
Cache Type Register (CTR).
@ k_ra8_cache_ccsidr
Cache Size ID Register (CCSIDR).
@ k_ra8_cache_dcisw
D-cache invalidate by set/way.
@ k_ra8_cache_dccisw
D-cache clean+invalidate by set/way.
@ k_ra8_cache_dccmvac
D-cache clean by MVA (PoC).
@ k_ra8_cache_dcimvac
D-cache invalidate by MVA (PoC).
@ k_ra8_cache_ccr
Configuration and Control (CCR).
@ k_ra8_cache_csselr
Cache Size Selection (CSSELR).
@ k_ra8_cache_dccimvac
D-cache clean+invalidate by MVA.
ra8_err_t ra8_cache_dcache_invalidate_by_addr(const void *addr, uint32_t size)
Invalidate (drop) the D-cache lines covering a byte range.
void ra8_cache_icache_invalidate_all(void)
Invalidate the entire Cortex-M85 L1 instruction cache (ICIALLU).
uint32_t ra8_cache_dcache_line_bytes(void)
Smallest Cortex-M85 D-cache line size, in bytes.
void ra8_cache_icache_enable(void)
Invalidate then enable the Cortex-M85 L1 instruction cache (CCR.IC).
void ra8_cache_enable(void)
Enable both Cortex-M85 L1 caches (I-cache then D-cache).
ra8_err_t ra8_cache_dcache_clean_by_addr(const void *addr, uint32_t size)
Clean (write back) the D-cache lines covering a byte range.
ra8_cache_field_t
Bit positions, masks, and sizes for the CTR / CCSIDR / DCISW fields.
@ k_ra8_cache_ccsidr_sets_msk
CCSIDR.NumSets field mask (15 bit).
@ k_ra8_cache_dcisw_set_shift
DCISW.SET position (32-byte line).
@ k_ra8_cache_word_bytes
Bytes per 32-bit cache word.
@ k_ra8_cache_ctr_dmin_mask
CTR.DminLine field mask (4 bits).
@ k_ra8_cache_ccsidr_assoc_sh
CCSIDR.Associativity bit position.
@ k_ra8_cache_ccsidr_sets_sh
CCSIDR.NumSets bit position.
@ k_ra8_cache_ccr_dc_bit
CCR.DC – L1 data-cache enable.
@ k_ra8_cache_dcisw_way_shift
DCISW.WAY position (assoc <= 4).
@ k_ra8_cache_ctr_dmin_shift
CTR.DminLine bit position.
@ k_ra8_cache_ccsidr_assoc_mk
CCSIDR.Associativity mask (10 bit).
@ k_ra8_cache_ccr_ic_bit
CCR.IC – L1 instruction-cache en.
static uint32_t internal_ra8_cache_span_lines(uintptr_t addr, uint32_t size, uint32_t line, uintptr_t *out_start)
Number of cache lines spanning size bytes from addr.
void ra8_cache_dcache_invalidate_all(void)
Invalidate the entire D-cache by set/way.
ra8_err_t ra8_cache_dcache_clean_invalidate_by_addr(const void *addr, uint32_t size)
Clean and invalidate the D-cache lines covering a byte range.
void ra8_cache_dcache_enable(void)
Invalidate then enable the Cortex-M85 L1 data cache (CCR.DC).
static ra8_err_t internal_ra8_cache_maintain_range(const void *addr, uint32_t size, ra8_cache_reg_addr_t reg)
Apply a by-MVA maintenance op to every line of a range.
Cortex-M85 L1 cache maintenance, enable/disable, and I-cache invalidate.
Validation and Error-Checking Macros for ra8-firmware.
#define RA8_CHECK_NULL_PTR(ptr, tag, message)
Reject nullptr pointer, returning k_ra8_err_null_ptr.
Error Code Definitions for ra8-firmware.
@ k_ra8_ok
Success – operation completed with all postconditions satisfied.
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
Shared CPU-intrinsic seam for the HAL drivers (host/target split).
static void ra8_hw_dsb(void)
Data Synchronisation Barrier (full system).
static void ra8_hw_isb(void)
Instruction Synchronisation Barrier (full system).