8#ifndef ZEPHYR_INCLUDE_CACHE_H_
9#define ZEPHYR_INCLUDE_CACHE_H_
24#if defined(CONFIG_EXTERNAL_CACHE)
27#elif defined(CONFIG_ARCH_CACHE)
30#elif defined(CONFIG_SOC_CACHE)
49#if defined(CONFIG_CACHE_MANAGEMENT) && defined(CONFIG_DCACHE)
62#if defined(CONFIG_CACHE_MANAGEMENT) && defined(CONFIG_DCACHE)
75#if defined(CONFIG_CACHE_MANAGEMENT) && defined(CONFIG_ICACHE)
88#if defined(CONFIG_CACHE_MANAGEMENT) && defined(CONFIG_ICACHE)
104#if defined(CONFIG_CACHE_MANAGEMENT) && defined(CONFIG_DCACHE)
121#if defined(CONFIG_CACHE_MANAGEMENT) && defined(CONFIG_ICACHE)
138#if defined(CONFIG_CACHE_MANAGEMENT) && defined(CONFIG_DCACHE)
155#if defined(CONFIG_CACHE_MANAGEMENT) && defined(CONFIG_ICACHE)
172#if defined(CONFIG_CACHE_MANAGEMENT) && defined(CONFIG_DCACHE)
189#if defined(CONFIG_CACHE_MANAGEMENT) && defined(CONFIG_ICACHE)
216static ALWAYS_INLINE int z_impl_sys_cache_data_flush_range(
void *addr,
size_t size)
218#if defined(CONFIG_CACHE_MANAGEMENT) && defined(CONFIG_DCACHE)
248#if defined(CONFIG_CACHE_MANAGEMENT) && defined(CONFIG_ICACHE)
279static ALWAYS_INLINE int z_impl_sys_cache_data_invd_range(
void *addr,
size_t size)
281#if defined(CONFIG_CACHE_MANAGEMENT) && defined(CONFIG_DCACHE)
312#if defined(CONFIG_CACHE_MANAGEMENT) && defined(CONFIG_ICACHE)
343static ALWAYS_INLINE int z_impl_sys_cache_data_flush_and_invd_range(
void *addr,
size_t size)
345#if defined(CONFIG_CACHE_MANAGEMENT) && defined(CONFIG_DCACHE)
376#if defined(CONFIG_CACHE_MANAGEMENT) && defined(CONFIG_ICACHE)
402#ifdef CONFIG_DCACHE_LINE_SIZE_DETECT
404#elif defined(CONFIG_DCACHE_LINE_SIZE)
405 return CONFIG_DCACHE_LINE_SIZE;
428#ifdef CONFIG_ICACHE_LINE_SIZE_DETECT
430#elif defined(CONFIG_ICACHE_LINE_SIZE)
431 return CONFIG_ICACHE_LINE_SIZE;
452#if defined(CONFIG_CACHE_MANAGEMENT) && defined(CONFIG_CACHE_HAS_MIRRORED_MEMORY_REGIONS)
476#if defined(CONFIG_CACHE_MANAGEMENT) && defined(CONFIG_CACHE_HAS_MIRRORED_MEMORY_REGIONS)
505#if defined(CONFIG_CACHE_MANAGEMENT) && defined(CONFIG_CACHE_HAS_MIRRORED_MEMORY_REGIONS)
508 return (__sparse_force
void __sparse_cache *)ptr;
530#if defined(CONFIG_CACHE_MANAGEMENT) && defined(CONFIG_CACHE_HAS_MIRRORED_MEMORY_REGIONS)
533 return (__sparse_force
void *)ptr;
538#ifdef CONFIG_LIBMETAL
539static ALWAYS_INLINE void sys_cache_flush(
void *addr,
size_t size)
545#if defined(CONFIG_CACHE_CAN_SAY_MEM_COHERENCE) || defined(__DOXYGEN__)
569#include <zephyr/syscalls/cache.h>
Public APIs for architectural cache controller drivers.
Main header file for external cache controller driver API.
#define cache_uncached_ptr(ptr)
Definition cache.h:351
#define cache_instr_invd_all
Definition cache.h:229
#define cache_cached_ptr(ptr)
Definition cache.h:348
#define cache_instr_disable
Definition cache.h:203
#define cache_is_ptr_uncached(ptr)
Definition cache.h:345
#define cache_instr_flush_all
Definition cache.h:216
#define cache_data_flush_and_invd_range(addr, size)
Definition cache.h:159
#define cache_instr_invd_range(addr, size)
Definition cache.h:289
#define cache_instr_flush_and_invd_all
Definition cache.h:242
#define cache_instr_enable
Definition cache.h:194
#define cache_instr_flush_range(addr, size)
Definition cache.h:265
#define cache_data_invd_range(addr, size)
Definition cache.h:134
#define cache_instr_flush_and_invd_range(addr, size)
Definition cache.h:313
#define cache_data_invd_all
Definition cache.h:74
#define cache_is_mem_coherent(ptr)
Definition cache.h:358
#define cache_is_ptr_cached(ptr)
Definition cache.h:342
#define cache_data_flush_range(addr, size)
Definition cache.h:110
#define cache_data_flush_and_invd_all
Definition cache.h:87
#define cache_data_flush_all
Definition cache.h:61
#define cache_data_enable
Definition cache.h:39
#define cache_instr_line_size_get
Definition cache.h:334
#define cache_data_disable
Definition cache.h:48
#define cache_data_line_size_get
Definition cache.h:179
static ALWAYS_INLINE bool sys_cache_is_ptr_cached(void *ptr)
Test if a pointer is in cached region.
Definition cache.h:450
static ALWAYS_INLINE void * sys_cache_uncached_ptr_get(void *ptr)
Return uncached pointer to a RAM address.
Definition cache.h:528
static ALWAYS_INLINE bool sys_cache_is_mem_coherent(void *ptr)
Detect memory coherence type.
Definition cache.h:563
static ALWAYS_INLINE int sys_cache_data_flush_all(void)
Flush the d-cache.
Definition cache.h:102
static ALWAYS_INLINE int sys_cache_instr_flush_and_invd_all(void)
Flush and Invalidate the i-cache.
Definition cache.h:187
static ALWAYS_INLINE size_t sys_cache_instr_line_size_get(void)
Get the i-cache line size.
Definition cache.h:426
static ALWAYS_INLINE void sys_cache_instr_disable(void)
Disable the i-cache.
Definition cache.h:86
int sys_cache_data_flush_and_invd_range(void *addr, size_t size)
Flush and Invalidate an address range in the d-cache.
int sys_cache_data_invd_range(void *addr, size_t size)
Invalidate an address range in the d-cache.
static ALWAYS_INLINE int sys_cache_instr_flush_range(void *addr, size_t size)
Flush an address range in the i-cache.
Definition cache.h:246
static ALWAYS_INLINE int sys_cache_instr_flush_all(void)
Flush the i-cache.
Definition cache.h:119
static ALWAYS_INLINE size_t sys_cache_data_line_size_get(void)
Get the d-cache line size.
Definition cache.h:400
int sys_cache_data_flush_range(void *addr, size_t size)
Flush an address range in the d-cache.
static ALWAYS_INLINE int sys_cache_instr_flush_and_invd_range(void *addr, size_t size)
Flush and Invalidate an address range in the i-cache.
Definition cache.h:374
static ALWAYS_INLINE void * sys_cache_cached_ptr_get(void *ptr)
Return cached pointer to a RAM address.
Definition cache.h:503
static ALWAYS_INLINE void sys_cache_data_disable(void)
Disable the d-cache.
Definition cache.h:60
static ALWAYS_INLINE int sys_cache_instr_invd_range(void *addr, size_t size)
Invalidate an address range in the i-cache.
Definition cache.h:310
static ALWAYS_INLINE void sys_cache_data_enable(void)
Enable the d-cache.
Definition cache.h:47
static ALWAYS_INLINE void sys_cache_instr_enable(void)
Enable the i-cache.
Definition cache.h:73
static ALWAYS_INLINE int sys_cache_data_invd_all(void)
Invalidate the d-cache.
Definition cache.h:136
static ALWAYS_INLINE bool sys_cache_is_ptr_uncached(void *ptr)
Test if a pointer is in un-cached region.
Definition cache.h:474
static ALWAYS_INLINE int sys_cache_data_flush_and_invd_all(void)
Flush and Invalidate the d-cache.
Definition cache.h:170
static ALWAYS_INLINE int sys_cache_instr_invd_all(void)
Invalidate the i-cache.
Definition cache.h:153
#define ENOTSUP
Unsupported value.
Definition errno.h:114