cache.c 923 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*
  2. * Copyright (c) 2006-2025 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. * 2025-05-29 Zhang Jing remove redundant code
  10. */
  11. #include <rthw.h>
  12. #include <rtdef.h>
  13. #include <board.h>
  14. #include <riscv.h>
  15. #include <cache.h>
  16. void rt_hw_cpu_icache_ops(int ops, void *addr, int size)
  17. {
  18. if (ops == RT_HW_CACHE_INVALIDATE)
  19. {
  20. rt_hw_cpu_icache_invalidate(addr, size);
  21. }
  22. return;
  23. }
  24. void rt_hw_cpu_dcache_ops(int ops, void *addr, int size)
  25. {
  26. if (ops == RT_HW_CACHE_FLUSH)
  27. {
  28. rt_hw_cpu_dcache_clean(addr, size);
  29. }
  30. else
  31. {
  32. rt_hw_cpu_dcache_invalidate(addr, size);
  33. }
  34. return;
  35. }
  36. void rt_hw_sync_cache_local(void *addr, int size)
  37. {
  38. rt_hw_cpu_dcache_clean_local(addr, size);
  39. rt_hw_cpu_icache_invalidate_local(addr, size);
  40. return;
  41. }