cpuport.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. /*
  2. * Copyright (c) 2006-2020, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. */
  9. #ifndef CPUPORT_H__
  10. #define CPUPORT_H__
  11. #include <rtcompiler.h>
  12. /* the exception stack without VFP registers */
  13. struct rt_hw_exp_stack
  14. {
  15. unsigned long r0;
  16. unsigned long r1;
  17. unsigned long r2;
  18. unsigned long r3;
  19. unsigned long r4;
  20. unsigned long r5;
  21. unsigned long r6;
  22. unsigned long r7;
  23. unsigned long r8;
  24. unsigned long r9;
  25. unsigned long r10;
  26. unsigned long fp;
  27. unsigned long ip;
  28. unsigned long sp;
  29. unsigned long lr;
  30. unsigned long pc;
  31. unsigned long cpsr;
  32. };
  33. struct rt_hw_stack
  34. {
  35. unsigned long cpsr;
  36. unsigned long r0;
  37. unsigned long r1;
  38. unsigned long r2;
  39. unsigned long r3;
  40. unsigned long r4;
  41. unsigned long r5;
  42. unsigned long r6;
  43. unsigned long r7;
  44. unsigned long r8;
  45. unsigned long r9;
  46. unsigned long r10;
  47. unsigned long fp;
  48. unsigned long ip;
  49. unsigned long lr;
  50. unsigned long pc;
  51. };
  52. #define USERMODE 0x10
  53. #define FIQMODE 0x11
  54. #define IRQMODE 0x12
  55. #define SVCMODE 0x13
  56. #define MONITORMODE 0x16
  57. #define ABORTMODE 0x17
  58. #define HYPMODE 0x1b
  59. #define UNDEFMODE 0x1b
  60. #define MODEMASK 0x1f
  61. #define NOINT 0xc0
  62. #define T_Bit (1<<5)
  63. #define F_Bit (1<<6)
  64. #define I_Bit (1<<7)
  65. #define A_Bit (1<<8)
  66. #define E_Bit (1<<9)
  67. #define J_Bit (1<<24)
  68. #ifdef RT_USING_SMP
  69. typedef union {
  70. unsigned long slock;
  71. struct __arch_tickets {
  72. unsigned short owner;
  73. unsigned short next;
  74. } tickets;
  75. } rt_hw_spinlock_t;
  76. #endif
  77. rt_inline void rt_hw_isb(void)
  78. {
  79. __asm volatile ("isb":::"memory");
  80. }
  81. rt_inline void rt_hw_dmb(void)
  82. {
  83. __asm volatile ("dmb":::"memory");
  84. }
  85. rt_inline void rt_hw_dsb(void)
  86. {
  87. __asm volatile ("dsb":::"memory");
  88. }
  89. void _thread_start(void);
  90. #endif /*CPUPORT_H__*/