cpuport.h 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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. * 2021-09-10 GuEe-GUI first version
  9. */
  10. #ifndef __CPUPORT_H__
  11. #define __CPUPORT_H__
  12. #include <rtdef.h>
  13. #define __WFI() __asm__ volatile ("wfi":::"memory")
  14. #define __WFE() __asm__ volatile ("wfe":::"memory")
  15. #define __SEV() __asm__ volatile ("sev")
  16. #define __ISB() __asm__ volatile ("isb 0xf":::"memory")
  17. #define __DSB() __asm__ volatile ("dsb 0xf":::"memory")
  18. #define __DMB() __asm__ volatile ("dmb 0xf":::"memory")
  19. #ifdef RT_USING_SMP
  20. typedef union {
  21. unsigned long slock;
  22. struct __arch_tickets {
  23. unsigned short owner;
  24. unsigned short next;
  25. } tickets;
  26. } rt_hw_spinlock_t;
  27. #endif
  28. rt_inline void rt_hw_isb(void)
  29. {
  30. __asm__ volatile ("isb":::"memory");
  31. }
  32. rt_inline void rt_hw_dmb(void)
  33. {
  34. __asm__ volatile ("dmb sy":::"memory");
  35. }
  36. rt_inline void rt_hw_dsb(void)
  37. {
  38. __asm__ volatile ("dsb sy":::"memory");
  39. }
  40. #endif /* __CPUPORT_H__ */