Skip to content

Commit c85d50d

Browse files
committed
Remove invalid code
1 parent 0a2e150 commit c85d50d

File tree

2 files changed

+12
-25
lines changed

2 files changed

+12
-25
lines changed

bsp/xuantie/virt64/c906/libcpu/cache.c

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,6 @@
1414
#include <riscv.h>
1515
#include <cache.h>
1616

17-
rt_inline rt_uint32_t rt_cpu_icache_line_size()
18-
{
19-
return 0;
20-
}
21-
22-
rt_inline rt_uint32_t rt_cpu_dcache_line_size()
23-
{
24-
return 0;
25-
}
26-
2717
void rt_hw_cpu_icache_ops(int ops, void *addr, int size)
2818
{
2919
if (ops == RT_HW_CACHE_INVALIDATE)
@@ -44,16 +34,9 @@ void rt_hw_cpu_dcache_ops(int ops, void *addr, int size)
4434
}
4535
}
4636

47-
rt_base_t rt_hw_cpu_icache_status_local()
48-
{
49-
return 0;
50-
}
51-
52-
rt_base_t rt_hw_cpu_dcache_status()
53-
{
54-
return 0;
55-
}
56-
5737
void rt_hw_sync_cache_local(void *addr, int size)
5838
{
39+
rt_hw_cpu_dcache_clean_local(addr, size);
40+
rt_hw_cpu_icache_invalidate_local(addr, size);
41+
return;
5942
}

bsp/xuantie/virt64/c906/libcpu/cache.h

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2006-2021, RT-Thread Development Team
2+
* Copyright (c) 2006-2025 RT-Thread Development Team
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*
@@ -47,14 +47,15 @@ rt_always_inline void rt_hw_cpu_dcache_clean_and_invalidate_all_local(void)
4747
{
4848
}
4949

50+
/*use fence.i to invalidate all icache*/
5051
rt_always_inline void rt_hw_cpu_icache_invalidate_local(void *addr, int size)
5152
{
52-
RT_UNUSED(addr);
53-
RT_UNUSED(size);
53+
__asm__ __volatile__("fence.i" ::: "memory");
5454
}
55-
55+
/*use fence.i to invalidate all icache*/
5656
rt_always_inline void rt_hw_cpu_icache_invalidate_all_local(void)
5757
{
58+
__asm__ __volatile__("fence.i" ::: "memory");
5859
}
5960

6061
/**
@@ -75,7 +76,10 @@ rt_always_inline void rt_hw_cpu_icache_invalidate_all_local(void)
7576
#define rt_hw_icache_invalidate_all rt_hw_cpu_icache_invalidate_all
7677

7778
/** instruction barrier */
78-
static inline void rt_hw_cpu_sync(void) {}
79+
static inline void rt_hw_cpu_sync(void)
80+
{
81+
__asm__ __volatile__("fence.i" ::: "memory");
82+
}
7983

8084
/**
8185
* @brief local cpu icahce & dcache synchronization

0 commit comments

Comments
 (0)