cpuport.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*
  2. * Copyright (c) 2006-2023, 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. * 2023/01/04 WangShun Adapt to CH32
  11. */
  12. #ifndef CPUPORT_H__
  13. #define CPUPORT_H__
  14. #include <rtconfig.h>
  15. #if !defined(__ASSEMBLY__)
  16. #if defined(SOC_RISCV_FAMILY_CH32)
  17. #include "interrupt.h"
  18. #endif
  19. #endif
  20. #ifndef __ASSEMBLY__
  21. #ifdef RT_USING_SMP
  22. typedef union {
  23. unsigned long slock;
  24. struct __arch_tickets {
  25. unsigned short owner;
  26. unsigned short next;
  27. } tickets;
  28. } rt_hw_spinlock_t;
  29. #endif
  30. #endif
  31. /* bytes of register width */
  32. #ifdef ARCH_CPU_64BIT
  33. #define STORE sd
  34. #define LOAD ld
  35. #define REGBYTES 8
  36. #else
  37. #define STORE sw
  38. #define LOAD lw
  39. #define REGBYTES 4
  40. #endif
  41. #ifdef ARCH_RISCV_FPU
  42. #ifdef ARCH_RISCV_FPU_D
  43. #define FSTORE fsd
  44. #define FLOAD fld
  45. #define FREGBYTES 8
  46. #define rv_floatreg_t rt_int64_t
  47. #endif
  48. #ifdef ARCH_RISCV_FPU_S
  49. #define FSTORE fsw
  50. #define FLOAD flw
  51. #define FREGBYTES 4
  52. #define rv_floatreg_t rt_int32_t
  53. #endif
  54. #endif
  55. #endif