2022-01-07 13:49:06 +08:00
|
|
|
/*
|
2022-12-20 17:49:37 +08:00
|
|
|
* Copyright (c) 2006-2018, RT-Thread Development Team
|
2022-01-07 13:49:06 +08:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*
|
|
|
|
* Change Logs:
|
|
|
|
* Date Author Notes
|
2024-06-28 00:23:09 +08:00
|
|
|
* 2019-03-29 quanzhao the first version
|
2022-01-07 13:49:06 +08:00
|
|
|
*/
|
|
|
|
#include <rthw.h>
|
|
|
|
#include <rtdef.h>
|
|
|
|
|
2022-12-20 17:49:37 +08:00
|
|
|
void __asm_invalidate_icache_all(void);
|
2022-01-07 13:49:06 +08:00
|
|
|
void __asm_flush_dcache_all(void);
|
2023-02-20 13:48:00 +08:00
|
|
|
void __asm_flush_dcache_range(rt_size_t start, rt_size_t end);
|
|
|
|
void __asm_invalidate_dcache_range(rt_size_t start, rt_size_t end);
|
|
|
|
void __asm_invalidate_icache_range(rt_size_t start, rt_size_t end);
|
2022-12-20 17:49:37 +08:00
|
|
|
void __asm_invalidate_dcache_all(void);
|
|
|
|
void __asm_invalidate_icache_all(void);
|
2022-01-07 13:49:06 +08:00
|
|
|
|
2022-12-20 17:49:37 +08:00
|
|
|
rt_inline rt_uint32_t rt_cpu_icache_line_size(void)
|
2022-01-07 13:49:06 +08:00
|
|
|
{
|
2022-12-20 17:49:37 +08:00
|
|
|
return 0;
|
2022-01-07 13:49:06 +08:00
|
|
|
}
|
|
|
|
|
2022-12-20 17:49:37 +08:00
|
|
|
rt_inline rt_uint32_t rt_cpu_dcache_line_size(void)
|
2022-01-07 13:49:06 +08:00
|
|
|
{
|
2022-12-20 17:49:37 +08:00
|
|
|
return 0;
|
2022-01-07 13:49:06 +08:00
|
|
|
}
|
|
|
|
|
2023-02-20 13:48:00 +08:00
|
|
|
void rt_hw_cpu_icache_invalidate(void *addr, rt_size_t size)
|
2022-01-07 13:49:06 +08:00
|
|
|
{
|
2023-02-20 13:48:00 +08:00
|
|
|
__asm_invalidate_icache_range((rt_size_t)addr, (rt_size_t)addr + size);
|
2022-01-07 13:49:06 +08:00
|
|
|
}
|
|
|
|
|
2023-02-20 13:48:00 +08:00
|
|
|
void rt_hw_cpu_dcache_invalidate(void *addr, rt_size_t size)
|
2022-01-07 13:49:06 +08:00
|
|
|
{
|
2023-02-20 13:48:00 +08:00
|
|
|
__asm_invalidate_dcache_range((rt_size_t)addr, (rt_size_t)addr + size);
|
2022-01-07 13:49:06 +08:00
|
|
|
}
|
|
|
|
|
2023-02-20 13:48:00 +08:00
|
|
|
void rt_hw_cpu_dcache_clean(void *addr, rt_size_t size)
|
2022-01-07 13:49:06 +08:00
|
|
|
{
|
2023-02-20 13:48:00 +08:00
|
|
|
__asm_flush_dcache_range((rt_size_t)addr, (rt_size_t)addr + size);
|
2022-01-07 13:49:06 +08:00
|
|
|
}
|
|
|
|
|
2023-02-20 13:48:00 +08:00
|
|
|
void rt_hw_cpu_dcache_clean_and_invalidate(void *addr, rt_size_t size)
|
2022-01-07 13:49:06 +08:00
|
|
|
{
|
2023-02-20 13:48:00 +08:00
|
|
|
__asm_flush_dcache_range((rt_size_t)addr, (rt_size_t)addr + size);
|
2022-01-07 13:49:06 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void rt_hw_cpu_icache_ops(int ops, void *addr, int size)
|
|
|
|
{
|
|
|
|
if (ops == RT_HW_CACHE_INVALIDATE)
|
|
|
|
{
|
2022-12-20 17:49:37 +08:00
|
|
|
rt_hw_cpu_icache_invalidate(addr, size);
|
2022-01-07 13:49:06 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void rt_hw_cpu_dcache_ops(int ops, void *addr, int size)
|
|
|
|
{
|
|
|
|
if (ops == RT_HW_CACHE_FLUSH)
|
|
|
|
{
|
2022-12-20 17:49:37 +08:00
|
|
|
rt_hw_cpu_dcache_clean(addr, size);
|
2022-01-07 13:49:06 +08:00
|
|
|
}
|
|
|
|
else if (ops == RT_HW_CACHE_INVALIDATE)
|
|
|
|
{
|
2022-12-20 17:49:37 +08:00
|
|
|
rt_hw_cpu_dcache_invalidate(addr, size);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
rt_base_t rt_hw_cpu_icache_status(void)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
rt_base_t rt_hw_cpu_dcache_status(void)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|