1
0

cpuport.h 878 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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. #ifdef RT_USING_SMP
  15. typedef union {
  16. unsigned long slock;
  17. struct __arch_tickets {
  18. unsigned short owner;
  19. unsigned short next;
  20. } tickets;
  21. } rt_hw_spinlock_t;
  22. #endif
  23. #ifndef __ASSEMBLY__
  24. #include <rtdef.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. int rt_hw_cpu_id(void);
  38. #endif
  39. #endif
  40. #ifdef RISCV_U_MODE
  41. #define RISCV_USER_ENTRY 0xFFFFFFE000000000ULL
  42. #endif