cpuport.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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. * 2018-10-03 Bernard The first version
  9. * 2020/11/20 BalanceTWK Add FPU support
  10. */
  11. #ifndef CPUPORT_H__
  12. #define CPUPORT_H__
  13. #include <rtconfig.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. #endif
  25. /* bytes of register width */
  26. #ifdef ARCH_CPU_64BIT
  27. #define STORE sd
  28. #define LOAD ld
  29. #define REGBYTES 8
  30. #else
  31. #define STORE sw
  32. #define LOAD lw
  33. #define REGBYTES 4
  34. #endif
  35. #ifdef ARCH_RISCV_FPU
  36. #ifdef ARCH_RISCV_FPU_D
  37. #define FSTORE fsd
  38. #define FLOAD fld
  39. #define FREGBYTES 8
  40. #define rv_floatreg_t rt_int64_t
  41. #endif
  42. #ifdef ARCH_RISCV_FPU_S
  43. #define FSTORE fsw
  44. #define FLOAD flw
  45. #define FREGBYTES 4
  46. #define rv_floatreg_t rt_int32_t
  47. #endif
  48. #endif
  49. #endif