2022-12-20 17:49:37 +08:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2006-2022, RT-Thread Development Team
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*
|
|
|
|
* Change Logs:
|
|
|
|
* Date Author Notes
|
|
|
|
* 2022-12-18 RT-Thread the first version
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __CACHE_H__
|
|
|
|
#define __CACHE_H__
|
|
|
|
|
2023-03-17 15:11:38 +08:00
|
|
|
#include <rtdef.h>
|
|
|
|
|
2023-02-20 13:48:00 +08:00
|
|
|
void __asm_invalidate_icache_all(void);
|
|
|
|
|
2022-12-20 17:49:37 +08:00
|
|
|
void rt_hw_dcache_flush_all(void);
|
|
|
|
void rt_hw_dcache_invalidate_all(void);
|
|
|
|
void rt_hw_dcache_flush_range(unsigned long start_addr, unsigned long size);
|
2023-02-20 13:48:00 +08:00
|
|
|
void rt_hw_cpu_dcache_clean(void *addr, unsigned long size);
|
|
|
|
void rt_hw_cpu_dcache_invalidate(void *start_addr, unsigned long size);
|
|
|
|
|
|
|
|
static inline void rt_hw_icache_invalidate_all(void)
|
|
|
|
{
|
2023-04-26 17:17:42 +08:00
|
|
|
/* wait for previous modification to complete */
|
2023-04-22 23:59:11 +08:00
|
|
|
__asm__ volatile ("dsb ishst");
|
2023-04-26 17:17:42 +08:00
|
|
|
|
|
|
|
__asm__ volatile ("ic ialluis");
|
|
|
|
/* wait for ic to retire */
|
|
|
|
__asm__ volatile ("dsb nsh");
|
|
|
|
/* flush instruction pipeline */
|
2023-04-22 23:59:11 +08:00
|
|
|
__asm__ volatile ("isb");
|
2023-02-20 13:48:00 +08:00
|
|
|
}
|
2022-12-20 17:49:37 +08:00
|
|
|
|
2023-03-17 15:11:38 +08:00
|
|
|
void rt_hw_cpu_icache_invalidate(void *addr, rt_size_t size);
|
|
|
|
void rt_hw_cpu_dcache_clean_and_invalidate(void *addr, rt_size_t size);
|
2022-12-20 17:49:37 +08:00
|
|
|
|
|
|
|
#endif /* __CACHE_H__ */
|