cache.h 962 B

1234567891011121314151617181920212223242526272829303132333435
  1. /*
  2. * Copyright (c) 2006-2022, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2022-12-18 RT-Thread the first version
  9. */
  10. #ifndef __CACHE_H__
  11. #define __CACHE_H__
  12. #include <rtdef.h>
  13. void __asm_invalidate_icache_all(void);
  14. void rt_hw_dcache_flush_all(void);
  15. void rt_hw_dcache_invalidate_all(void);
  16. void rt_hw_dcache_flush_range(unsigned long start_addr, unsigned long size);
  17. void rt_hw_cpu_dcache_clean(void *addr, unsigned long size);
  18. void rt_hw_cpu_dcache_invalidate(void *start_addr, unsigned long size);
  19. static inline void rt_hw_icache_invalidate_all(void)
  20. {
  21. /* wait for any modification complete */
  22. __asm__ volatile ("dsb ishst");
  23. __asm__ volatile ("ic iallu");
  24. __asm__ volatile ("isb");
  25. }
  26. void rt_hw_cpu_icache_invalidate(void *addr, rt_size_t size);
  27. void rt_hw_cpu_dcache_clean_and_invalidate(void *addr, rt_size_t size);
  28. #endif /* __CACHE_H__ */