2022-12-03 12:07:44 +08:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2006-2021, RT-Thread Development Team
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*
|
|
|
|
* Change Logs:
|
|
|
|
* Date Author Notes
|
|
|
|
* 2022-11-09 RT-Thread The first version
|
|
|
|
*/
|
|
|
|
#ifndef __CACHE_H__
|
|
|
|
#define __CACHE_H__
|
|
|
|
|
2024-02-20 03:51:42 +08:00
|
|
|
#include <rtdef.h>
|
2022-12-03 12:07:44 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief These APIs may not be supported by a specified architecture
|
|
|
|
* But we have to include to all the cases to be 'general purpose'
|
|
|
|
*/
|
|
|
|
|
2024-02-20 03:51:42 +08:00
|
|
|
rt_always_inline void rt_hw_cpu_dcache_clean_local(void *addr, int size)
|
|
|
|
{
|
|
|
|
RT_UNUSED(addr);
|
|
|
|
RT_UNUSED(size);
|
|
|
|
}
|
2022-12-03 12:07:44 +08:00
|
|
|
|
2024-02-20 03:51:42 +08:00
|
|
|
rt_always_inline void rt_hw_cpu_dcache_invalidate_local(void *addr, int size)
|
|
|
|
{
|
|
|
|
RT_UNUSED(addr);
|
|
|
|
RT_UNUSED(size);
|
|
|
|
}
|
2022-12-03 12:07:44 +08:00
|
|
|
|
2024-02-20 03:51:42 +08:00
|
|
|
rt_always_inline void rt_hw_cpu_dcache_clean_and_invalidate_local(void *addr, int size)
|
|
|
|
{
|
|
|
|
RT_UNUSED(addr);
|
|
|
|
RT_UNUSED(size);
|
|
|
|
}
|
|
|
|
|
|
|
|
rt_always_inline void rt_hw_cpu_dcache_clean_all_local(void)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
rt_always_inline void rt_hw_cpu_dcache_invalidate_all_local(void)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
rt_always_inline void rt_hw_cpu_dcache_clean_and_invalidate_all_local(void)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
rt_always_inline void rt_hw_cpu_icache_invalidate_local(void *addr, int size)
|
|
|
|
{
|
|
|
|
RT_UNUSED(addr);
|
|
|
|
RT_UNUSED(size);
|
|
|
|
}
|
|
|
|
|
|
|
|
rt_always_inline void rt_hw_cpu_icache_invalidate_all_local(void)
|
|
|
|
{
|
|
|
|
}
|
2022-12-03 12:07:44 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Multi-core
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define rt_hw_cpu_dcache_clean rt_hw_cpu_dcache_clean_local
|
|
|
|
#define rt_hw_cpu_dcache_invalidate rt_hw_cpu_dcache_invalidate_local
|
2023-03-17 15:11:38 +08:00
|
|
|
#define rt_hw_cpu_dcache_clean_and_invalidate rt_hw_cpu_dcache_clean_and_invalidate_local
|
2022-12-03 12:07:44 +08:00
|
|
|
|
|
|
|
#define rt_hw_cpu_dcache_clean_all rt_hw_cpu_dcache_clean_all_local
|
|
|
|
#define rt_hw_cpu_dcache_invalidate_all rt_hw_cpu_dcache_invalidate_all_local
|
2023-03-17 15:11:38 +08:00
|
|
|
#define rt_hw_cpu_dcache_clean_and_invalidate_all rt_hw_cpu_dcache_clean_and_invalidate_all_local
|
2022-12-03 12:07:44 +08:00
|
|
|
|
|
|
|
#define rt_hw_cpu_icache_invalidate rt_hw_cpu_icache_invalidate_local
|
|
|
|
#define rt_hw_cpu_icache_invalidate_all rt_hw_cpu_icache_invalidate_all_local
|
|
|
|
|
2023-02-20 13:48:00 +08:00
|
|
|
#define rt_hw_icache_invalidate_all rt_hw_cpu_icache_invalidate_all
|
|
|
|
|
2022-12-03 12:07:44 +08:00
|
|
|
/** instruction barrier */
|
2023-03-30 08:25:15 +08:00
|
|
|
static inline void rt_hw_cpu_sync(void) {}
|
2022-12-03 12:07:44 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief local cpu icahce & dcache synchronization
|
|
|
|
*
|
|
|
|
* @param addr
|
|
|
|
* @param size
|
|
|
|
*/
|
|
|
|
void rt_hw_sync_cache_local(void *addr, int size);
|
|
|
|
|
|
|
|
#endif /* __CACHE_H__ */
|