Lines Matching full:cache
7 #include <zephyr/drivers/cache.h>
46 static inline bool is_cache_busy(NRF_CACHE_Type *cache) in is_cache_busy() argument
49 return nrf_cache_busy_check(cache); in is_cache_busy()
55 static inline void wait_for_cache(NRF_CACHE_Type *cache) in wait_for_cache() argument
57 while (is_cache_busy(cache)) { in wait_for_cache()
62 static inline int _cache_all(NRF_CACHE_Type *cache, enum k_nrf_cache_op op) in _cache_all() argument
65 * We really do not want to invalidate the whole cache. in _cache_all()
74 * Invalidating the whole cache is dangerous. For good measure in _cache_all()
75 * disable the cache. in _cache_all()
77 nrf_cache_disable(cache); in _cache_all()
79 wait_for_cache(cache); in _cache_all()
85 nrf_cache_task_trigger(cache, NRF_CACHE_TASK_CLEANCACHE); in _cache_all()
90 nrf_cache_task_trigger(cache, NRF_CACHE_TASK_INVALIDATECACHE); in _cache_all()
95 nrf_cache_task_trigger(cache, NRF_CACHE_TASK_FLUSHCACHE); in _cache_all()
103 wait_for_cache(cache); in _cache_all()
105 nrf_cache_enable(cache); in _cache_all()
112 static inline void _cache_line(NRF_CACHE_Type *cache, enum k_nrf_cache_op op, uintptr_t line_addr) in _cache_line() argument
114 wait_for_cache(cache); in _cache_line()
116 nrf_cache_lineaddr_set(cache, line_addr); in _cache_line()
122 nrf_cache_task_trigger(cache, NRF_CACHE_TASK_CLEANLINE); in _cache_line()
127 nrf_cache_task_trigger(cache, NRF_CACHE_TASK_INVALIDATELINE); in _cache_line()
132 nrf_cache_task_trigger(cache, NRF_CACHE_TASK_FLUSHLINE); in _cache_line()
140 wait_for_cache(cache); in _cache_line()
143 static inline int _cache_range(NRF_CACHE_Type *cache, enum k_nrf_cache_op op, void *addr, in _cache_range() argument
157 _cache_line(cache, op, line_addr); in _cache_range()
168 static inline int _cache_checks(NRF_CACHE_Type *cache, enum k_nrf_cache_op op, void *addr, in _cache_checks() argument
171 /* Check if the cache is enabled */ in _cache_checks()
172 if (!(cache->ENABLE & CACHE_ENABLE_ENABLE_Enabled)) { in _cache_checks()
177 return _cache_all(cache, op); in _cache_checks()
185 return _cache_range(cache, op, addr, size); in _cache_checks()