1 /*
2 * Copyright (c) 2006-2021, RT-Thread Development Team
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 *
6 * Change Logs:
7 * Date Author Notes
8 * 2021-01-29 lizhirui first version
9 */
10
11 #include <rthw.h>
12 #include <rtdef.h>
13 #include <board.h>
14 #include <riscv.h>
15 #include <cache.h>
16
rt_hw_cpu_icache_ops(int ops,void * addr,int size)17 void rt_hw_cpu_icache_ops(int ops, void *addr, int size)
18 {
19 if (ops == RT_HW_CACHE_INVALIDATE)
20 {
21 rt_hw_cpu_icache_invalidate(addr, size);
22 }
23 }
24
rt_hw_cpu_dcache_ops(int ops,void * addr,int size)25 void rt_hw_cpu_dcache_ops(int ops, void *addr, int size)
26 {
27 if (ops == RT_HW_CACHE_FLUSH)
28 {
29 rt_hw_cpu_dcache_clean(addr, size);
30 }
31 else
32 {
33 rt_hw_cpu_dcache_invalidate(addr, size);
34 }
35 }
36
rt_hw_sync_cache_local(void * addr,int size)37 void rt_hw_sync_cache_local(void *addr, int size)
38 {
39 rt_hw_cpu_dcache_clean_local(addr, size);
40 rt_hw_cpu_icache_invalidate_local(addr, size);
41 return;
42 }
43