Skip to content

Commit 12318bd

Browse files
crafcat7xiaoxiang781216
authored andcommitted
xtensa_cache:add up_get_cachesize api
Summary: Added up_get_dcache_size and up_get_icache_size common APIs Signed-off-by: chenrun1 <[email protected]>
1 parent 3c1d52a commit 12318bd

File tree

1 file changed

+40
-2
lines changed

1 file changed

+40
-2
lines changed

arch/xtensa/src/common/xtensa_cache.c

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,26 @@
4040
* Public Functions
4141
****************************************************************************/
4242

43+
/****************************************************************************
44+
* Name: up_get_icache_size
45+
*
46+
* Description:
47+
* Get icache size
48+
*
49+
* Input Parameters:
50+
* None
51+
*
52+
* Returned Value:
53+
* Cache size
54+
*
55+
****************************************************************************/
56+
57+
#ifdef CONFIG_XTENSA_ICACHE
58+
size_t up_get_icache_size(void)
59+
{
60+
return XCHAL_ICACHE_SIZE;
61+
}
62+
4363
/****************************************************************************
4464
* Name: up_get_icache_linesize
4565
*
@@ -54,7 +74,6 @@
5474
*
5575
****************************************************************************/
5676

57-
#ifdef CONFIG_XTENSA_ICACHE
5877
size_t up_get_icache_linesize(void)
5978
{
6079
return XCHAL_ICACHE_LINESIZE;
@@ -266,6 +285,26 @@ void up_unlock_icache_all(void)
266285
}
267286
#endif
268287

288+
/****************************************************************************
289+
* Name: up_get_dcache_size
290+
*
291+
* Description:
292+
* Get dcache size
293+
*
294+
* Input Parameters:
295+
* None
296+
*
297+
* Returned Value:
298+
* Cache size
299+
*
300+
****************************************************************************/
301+
302+
#ifdef CONFIG_XTENSA_DCACHE
303+
size_t up_get_dcache_size(void)
304+
{
305+
return XCHAL_DCACHE_SIZE;
306+
}
307+
269308
/****************************************************************************
270309
* Name: up_get_dcache_linesize
271310
*
@@ -280,7 +319,6 @@ void up_unlock_icache_all(void)
280319
*
281320
****************************************************************************/
282321

283-
#ifdef CONFIG_XTENSA_DCACHE
284322
size_t up_get_dcache_linesize(void)
285323
{
286324
return XCHAL_DCACHE_LINESIZE;

0 commit comments

Comments
 (0)