1 /*
2 * Copyright (c) 2016, Xilinx Inc. and Contributors. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7 /*
8 * @file cache.h
9 * @brief CACHE operation primitives for libmetal.
10 */
11
12 #ifndef __METAL_CACHE__H__
13 #define __METAL_CACHE__H__
14
15 #include <metal/system/@PROJECT_SYSTEM@/cache.h>
16
17 #ifdef __cplusplus
18 extern "C" {
19 #endif
20
21 /** \defgroup cache CACHE Interfaces
22 * @{
23 */
24
25 /**
26 * @brief flush specified data cache
27 *
28 * @param[in] addr start memory logical address
29 * @param[in] len length of memory
30 * If addr is NULL, and len is 0,
31 * It will flush the whole data cache.
32 */
metal_cache_flush(void * addr,unsigned int len)33 static inline void metal_cache_flush(void *addr, unsigned int len)
34 {
35 __metal_cache_flush(addr, len);
36 }
37
38 /**
39 * @brief invalidate specified data cache
40 *
41 * @param[in] addr start memory logical address
42 * @param[in] len length of memory
43 * If addr is NULL, and len is 0,
44 * It will invalidate the whole data cache.
45 */
metal_cache_invalidate(void * addr,unsigned int len)46 static inline void metal_cache_invalidate(void *addr, unsigned int len)
47 {
48 __metal_cache_invalidate(addr, len);
49 }
50
51 /** @} */
52
53 #ifdef __cplusplus
54 }
55 #endif
56
57 #endif /* __METAL_CACHE__H__ */
58