libmetal
cache.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018, Pinecone Inc. and Contributors. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 /*
8  * @file nuttx/cache.h
9  * @brief NuttX cache operation primitives for libmetal.
10  */
11 
12 #ifndef __METAL_CACHE__H__
13 #error "Include metal/cache.h instead of metal/nuttx/cache.h"
14 #endif
15 
16 #ifndef __METAL_NUTTX_CACHE__H__
17 #define __METAL_NUTTX_CACHE__H__
18 
19 #include <nuttx/arch.h>
20 
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24 
25 static inline void __metal_cache_flush(void *addr, unsigned int len)
26 {
27  up_clean_dcache((uintptr_t)addr, (uintptr_t)addr + len);
28 }
29 
30 static inline void __metal_cache_invalidate(void *addr, unsigned int len)
31 {
32  up_invalidate_dcache((uintptr_t)addr, (uintptr_t)addr + len);
33 }
34 
35 #ifdef __cplusplus
36 }
37 #endif
38 
39 #endif /* __METAL_NUTTX_CACHE__H__ */
__metal_cache_flush
static void __metal_cache_flush(void *addr, unsigned int len)
Definition: cache.h:25
__metal_cache_invalidate
static void __metal_cache_invalidate(void *addr, unsigned int len)
Definition: cache.h:30