cpuport.h 884 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. int rt_hw_cpu_id(void);
  38. #endif
  39. #endif
  40. #ifdef RISCV_U_MODE
  41. #define RISCV_USER_ENTRY 0xFFFFFFE000000000ULL
  42. #endif