cpuport.h 960 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*
  2. * Copyright (c) 2006-2024, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2018-10-03 Bernard The first version
  9. */
  10. #ifndef CPUPORT_H__
  11. #define CPUPORT_H__
  12. #include <rtconfig.h>
  13. #include <opcode.h>
  14. #ifndef __ASSEMBLY__
  15. #ifdef RT_USING_SMP
  16. typedef union {
  17. unsigned long slock;
  18. struct __arch_tickets {
  19. unsigned short owner;
  20. unsigned short next;
  21. } tickets;
  22. } rt_hw_spinlock_t;
  23. #endif
  24. #include <rtcompiler.h>
  25. rt_inline void rt_hw_dsb(void)
  26. {
  27. __asm__ volatile("fence":::"memory");
  28. }
  29. rt_inline void rt_hw_dmb(void)
  30. {
  31. __asm__ volatile("fence":::"memory");
  32. }
  33. rt_inline void rt_hw_isb(void)
  34. {
  35. __asm__ volatile(OPC_FENCE_I:::"memory");
  36. }
  37. #ifdef ARCH_MM_MMU
  38. void rt_hw_percpu_hartid_init(rt_ubase_t *percpu_ptr, rt_ubase_t hartid);
  39. #endif
  40. #endif
  41. #endif
  42. #ifdef RISCV_U_MODE
  43. #define RISCV_USER_ENTRY 0xFFFFFFE000000000ULL
  44. #endif