v7m.h 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /*
  2. * Common defines for v7m cpus
  3. */
  4. #define V7M_SCS_ICTR IOMEM(0xe000e004)
  5. #define V7M_SCS_ICTR_INTLINESNUM_MASK 0x0000000f
  6. #define BASEADDR_V7M_SCB IOMEM(0xe000ed00)
  7. #define V7M_SCB_CPUID 0x00
  8. #define V7M_SCB_ICSR 0x04
  9. #define V7M_SCB_ICSR_PENDSVSET (1 << 28)
  10. #define V7M_SCB_ICSR_PENDSVCLR (1 << 27)
  11. #define V7M_SCB_ICSR_RETTOBASE (1 << 11)
  12. #define V7M_SCB_VTOR 0x08
  13. #define V7M_SCB_AIRCR 0x0c
  14. #define V7M_SCB_AIRCR_VECTKEY (0x05fa << 16)
  15. #define V7M_SCB_AIRCR_SYSRESETREQ (1 << 2)
  16. #define V7M_SCB_SCR 0x10
  17. #define V7M_SCB_SCR_SLEEPDEEP (1 << 2)
  18. #define V7M_SCB_CCR 0x14
  19. #define V7M_SCB_CCR_STKALIGN (1 << 9)
  20. #define V7M_SCB_CCR_DC (1 << 16)
  21. #define V7M_SCB_CCR_IC (1 << 17)
  22. #define V7M_SCB_CCR_BP (1 << 18)
  23. #define V7M_SCB_SHPR2 0x1c
  24. #define V7M_SCB_SHPR3 0x20
  25. #define V7M_SCB_SHCSR 0x24
  26. #define V7M_SCB_SHCSR_USGFAULTENA (1 << 18)
  27. #define V7M_SCB_SHCSR_BUSFAULTENA (1 << 17)
  28. #define V7M_SCB_SHCSR_MEMFAULTENA (1 << 16)
  29. #define V7M_xPSR_FRAMEPTRALIGN 0x00000200
  30. #define V7M_xPSR_EXCEPTIONNO 0x000001ff
  31. /*
  32. * When branching to an address that has bits [31:28] == 0xf an exception return
  33. * occurs. Bits [27:5] are reserved (SBOP). If the processor implements the FP
  34. * extension Bit [4] defines if the exception frame has space allocated for FP
  35. * state information, SBOP otherwise. Bit [3] defines the mode that is returned
  36. * to (0 -> handler mode; 1 -> thread mode). Bit [2] defines which sp is used
  37. * (0 -> msp; 1 -> psp). Bits [1:0] are fixed to 0b01.
  38. */
  39. #define EXC_RET_STACK_MASK 0x00000004
  40. #define EXC_RET_THREADMODE_PROCESSSTACK 0xfffffffd
  41. /* Cache related definitions */
  42. #define V7M_SCB_CLIDR 0x78 /* Cache Level ID register */
  43. #define V7M_SCB_CTR 0x7c /* Cache Type register */
  44. #define V7M_SCB_CCSIDR 0x80 /* Cache size ID register */
  45. #define V7M_SCB_CSSELR 0x84 /* Cache size selection register */
  46. /* Cache opeartions */
  47. #define V7M_SCB_ICIALLU 0x250 /* I-cache invalidate all to PoU */
  48. #define V7M_SCB_ICIMVAU 0x258 /* I-cache invalidate by MVA to PoU */
  49. #define V7M_SCB_DCIMVAC 0x25c /* D-cache invalidate by MVA to PoC */
  50. #define V7M_SCB_DCISW 0x260 /* D-cache invalidate by set-way */
  51. #define V7M_SCB_DCCMVAU 0x264 /* D-cache clean by MVA to PoU */
  52. #define V7M_SCB_DCCMVAC 0x268 /* D-cache clean by MVA to PoC */
  53. #define V7M_SCB_DCCSW 0x26c /* D-cache clean by set-way */
  54. #define V7M_SCB_DCCIMVAC 0x270 /* D-cache clean and invalidate by MVA to PoC */
  55. #define V7M_SCB_DCCISW 0x274 /* D-cache clean and invalidate by set-way */
  56. #define V7M_SCB_BPIALL 0x278 /* D-cache clean and invalidate by set-way */
  57. #ifndef __ASSEMBLY__
  58. enum reboot_mode;
  59. void armv7m_restart(enum reboot_mode mode, const char *cmd);
  60. #endif /* __ASSEMBLY__ */