cache.c 848 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*
  2. * Copyright (c) 2006-2021, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2021-01-29 lizhirui first version
  9. */
  10. #include <rthw.h>
  11. #include <rtdef.h>
  12. #include <board.h>
  13. #include <riscv.h>
  14. #include <cache.h>
  15. void rt_hw_cpu_icache_ops(int ops, void *addr, int size)
  16. {
  17. if (ops == RT_HW_CACHE_INVALIDATE)
  18. {
  19. rt_hw_cpu_icache_invalidate(addr, size);
  20. }
  21. }
  22. void rt_hw_cpu_dcache_ops(int ops, void *addr, int size)
  23. {
  24. if (ops == RT_HW_CACHE_FLUSH)
  25. {
  26. rt_hw_cpu_dcache_clean(addr, size);
  27. }
  28. else
  29. {
  30. rt_hw_cpu_dcache_invalidate(addr, size);
  31. }
  32. }
  33. void rt_hw_sync_cache_local(void *addr, int size)
  34. {
  35. rt_hw_cpu_dcache_clean_local(addr, size);
  36. rt_hw_cpu_icache_invalidate_local(addr, size);
  37. return;
  38. }