am_reg_sysctrl.h 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653
  1. //*****************************************************************************
  2. //
  3. // am_reg_sysctrl.h
  4. //! @file
  5. //!
  6. //! @brief Register macros for the SYSCTRL module
  7. //
  8. //*****************************************************************************
  9. //*****************************************************************************
  10. //
  11. // Copyright (c) 2017, Ambiq Micro
  12. // All rights reserved.
  13. //
  14. // Redistribution and use in source and binary forms, with or without
  15. // modification, are permitted provided that the following conditions are met:
  16. //
  17. // 1. Redistributions of source code must retain the above copyright notice,
  18. // this list of conditions and the following disclaimer.
  19. //
  20. // 2. Redistributions in binary form must reproduce the above copyright
  21. // notice, this list of conditions and the following disclaimer in the
  22. // documentation and/or other materials provided with the distribution.
  23. //
  24. // 3. Neither the name of the copyright holder nor the names of its
  25. // contributors may be used to endorse or promote products derived from this
  26. // software without specific prior written permission.
  27. //
  28. // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  29. // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  30. // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  31. // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
  32. // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  33. // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  34. // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  35. // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  36. // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  37. // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  38. // POSSIBILITY OF SUCH DAMAGE.
  39. //
  40. // This is part of revision 1.2.9 of the AmbiqSuite Development Package.
  41. //
  42. //*****************************************************************************
  43. #ifndef AM_REG_SYSCTRL_H
  44. #define AM_REG_SYSCTRL_H
  45. //*****************************************************************************
  46. //
  47. // Instance finder. (1 instance(s) available)
  48. //
  49. //*****************************************************************************
  50. #define AM_REG_SYSCTRL_NUM_MODULES 1
  51. #define AM_REG_SYSCTRLn(n) \
  52. (REG_SYSCTRL_BASEADDR + 0x00000000 * n)
  53. //*****************************************************************************
  54. //
  55. // Register offsets.
  56. //
  57. //*****************************************************************************
  58. #define AM_REG_SYSCTRL_ICSR_O 0xE000ED04
  59. #define AM_REG_SYSCTRL_VTOR_O 0xE000ED08
  60. #define AM_REG_SYSCTRL_AIRCR_O 0xE000ED0C
  61. #define AM_REG_SYSCTRL_SCR_O 0xE000ED10
  62. #define AM_REG_SYSCTRL_CCR_O 0xE000ED14
  63. #define AM_REG_SYSCTRL_SHPR1_O 0xE000ED18
  64. #define AM_REG_SYSCTRL_SHPR2_O 0xE000ED1C
  65. #define AM_REG_SYSCTRL_SHPR3_O 0xE000ED20
  66. #define AM_REG_SYSCTRL_SHCSR_O 0xE000ED24
  67. #define AM_REG_SYSCTRL_CFSR_O 0xE000ED28
  68. #define AM_REG_SYSCTRL_HFSR_O 0xE000ED2C
  69. #define AM_REG_SYSCTRL_MMFAR_O 0xE000ED34
  70. #define AM_REG_SYSCTRL_BFAR_O 0xE000ED38
  71. #define AM_REG_SYSCTRL_CPACR_O 0xE000ED88
  72. #define AM_REG_SYSCTRL_DEMCR_O 0xE000EDFC
  73. #define AM_REG_SYSCTRL_STIR_O 0xE000EF00
  74. #define AM_REG_SYSCTRL_FPCCR_O 0xE000EF34
  75. #define AM_REG_SYSCTRL_FPCAR_O 0xE000EF38
  76. #define AM_REG_SYSCTRL_FPDSCR_O 0xE000EF3C
  77. //*****************************************************************************
  78. //
  79. // SYSCTRL_ICSR - Interrupt Control and State Register
  80. //
  81. //*****************************************************************************
  82. // Pend an NMI exception.
  83. #define AM_REG_SYSCTRL_ICSR_NMIPENDSET_S 31
  84. #define AM_REG_SYSCTRL_ICSR_NMIPENDSET_M 0x80000000
  85. #define AM_REG_SYSCTRL_ICSR_NMIPENDSET(n) (((uint32_t)(n) << 31) & 0x80000000)
  86. // Set the PendSV interrupt as pending.
  87. #define AM_REG_SYSCTRL_ICSR_PENDSVSET_S 28
  88. #define AM_REG_SYSCTRL_ICSR_PENDSVSET_M 0x10000000
  89. #define AM_REG_SYSCTRL_ICSR_PENDSVSET(n) (((uint32_t)(n) << 28) & 0x10000000)
  90. // Remove the pending status of the PendSV exception.
  91. #define AM_REG_SYSCTRL_ICSR_PENDSVCLR_S 27
  92. #define AM_REG_SYSCTRL_ICSR_PENDSVCLR_M 0x08000000
  93. #define AM_REG_SYSCTRL_ICSR_PENDSVCLR(n) (((uint32_t)(n) << 27) & 0x08000000)
  94. // Set the SysTick exception as pending.
  95. #define AM_REG_SYSCTRL_ICSR_PENDSTSET_S 26
  96. #define AM_REG_SYSCTRL_ICSR_PENDSTSET_M 0x04000000
  97. #define AM_REG_SYSCTRL_ICSR_PENDSTSET(n) (((uint32_t)(n) << 26) & 0x04000000)
  98. // Remove the pending status of the SysTick exception.
  99. #define AM_REG_SYSCTRL_ICSR_PENDSTCLR_S 25
  100. #define AM_REG_SYSCTRL_ICSR_PENDSTCLR_M 0x02000000
  101. #define AM_REG_SYSCTRL_ICSR_PENDSTCLR(n) (((uint32_t)(n) << 25) & 0x02000000)
  102. // Indicates whether a pending exception will be serviced on exit from debug
  103. // halt state.
  104. #define AM_REG_SYSCTRL_ICSR_ISRPREEMPT_S 23
  105. #define AM_REG_SYSCTRL_ICSR_ISRPREEMPT_M 0x00800000
  106. #define AM_REG_SYSCTRL_ICSR_ISRPREEMPT(n) (((uint32_t)(n) << 23) & 0x00800000)
  107. // Indicates whether an external interrupt, generated by the NVIC, is pending.
  108. #define AM_REG_SYSCTRL_ICSR_ISRPENDING_S 22
  109. #define AM_REG_SYSCTRL_ICSR_ISRPENDING_M 0x00400000
  110. #define AM_REG_SYSCTRL_ICSR_ISRPENDING(n) (((uint32_t)(n) << 22) & 0x00400000)
  111. // The exception number of the highest priority pending exception.
  112. #define AM_REG_SYSCTRL_ICSR_VECTPENDING_S 12
  113. #define AM_REG_SYSCTRL_ICSR_VECTPENDING_M 0x001FF000
  114. #define AM_REG_SYSCTRL_ICSR_VECTPENDING(n) (((uint32_t)(n) << 12) & 0x001FF000)
  115. // Indicates whether there is an active exception other than the exception shown
  116. // by IPSR.
  117. #define AM_REG_SYSCTRL_ICSR_RETTOBASE_S 11
  118. #define AM_REG_SYSCTRL_ICSR_RETTOBASE_M 0x00000800
  119. #define AM_REG_SYSCTRL_ICSR_RETTOBASE(n) (((uint32_t)(n) << 11) & 0x00000800)
  120. // The exception number of the current executing exception.
  121. #define AM_REG_SYSCTRL_ICSR_VECTACTIVE_S 0
  122. #define AM_REG_SYSCTRL_ICSR_VECTACTIVE_M 0x000001FF
  123. #define AM_REG_SYSCTRL_ICSR_VECTACTIVE(n) (((uint32_t)(n) << 0) & 0x000001FF)
  124. //*****************************************************************************
  125. //
  126. // SYSCTRL_VTOR - Vector Table Offset Register.
  127. //
  128. //*****************************************************************************
  129. // Vector table base address.
  130. #define AM_REG_SYSCTRL_VTOR_VALUE_S 0
  131. #define AM_REG_SYSCTRL_VTOR_VALUE_M 0xFFFFFFFF
  132. #define AM_REG_SYSCTRL_VTOR_VALUE(n) (((uint32_t)(n) << 0) & 0xFFFFFFFF)
  133. //*****************************************************************************
  134. //
  135. // SYSCTRL_AIRCR - Application Interrupt and Reset Control Register.
  136. //
  137. //*****************************************************************************
  138. // Register writes must write 0x5FA to this field, otherwise the write is
  139. // ignored.
  140. #define AM_REG_SYSCTRL_AIRCR_VECTKEY_S 16
  141. #define AM_REG_SYSCTRL_AIRCR_VECTKEY_M 0xFFFF0000
  142. #define AM_REG_SYSCTRL_AIRCR_VECTKEY(n) (((uint32_t)(n) << 16) & 0xFFFF0000)
  143. // Indicates endianness of memory architecture. (Little = 0, Big = 1)
  144. #define AM_REG_SYSCTRL_AIRCR_ENDIANNESS_S 15
  145. #define AM_REG_SYSCTRL_AIRCR_ENDIANNESS_M 0x00008000
  146. #define AM_REG_SYSCTRL_AIRCR_ENDIANNESS(n) (((uint32_t)(n) << 15) & 0x00008000)
  147. // Priority grouping, indicates the binary point position.
  148. #define AM_REG_SYSCTRL_AIRCR_PRIGROUP_S 8
  149. #define AM_REG_SYSCTRL_AIRCR_PRIGROUP_M 0x00000700
  150. #define AM_REG_SYSCTRL_AIRCR_PRIGROUP(n) (((uint32_t)(n) << 8) & 0x00000700)
  151. // Writing a 1 to this bit reqests a local reset.
  152. #define AM_REG_SYSCTRL_AIRCR_SYSRESETREQ_S 2
  153. #define AM_REG_SYSCTRL_AIRCR_SYSRESETREQ_M 0x00000004
  154. #define AM_REG_SYSCTRL_AIRCR_SYSRESETREQ(n) (((uint32_t)(n) << 2) & 0x00000004)
  155. // Writing a 1 to this bit clears all active state information for fixed and
  156. // configurable exceptions.
  157. #define AM_REG_SYSCTRL_AIRCR_VECTCLRACTIVE_S 1
  158. #define AM_REG_SYSCTRL_AIRCR_VECTCLRACTIVE_M 0x00000002
  159. #define AM_REG_SYSCTRL_AIRCR_VECTCLRACTIVE(n) (((uint32_t)(n) << 1) & 0x00000002)
  160. // Writing a 1 to this bit causes a local system reset.
  161. #define AM_REG_SYSCTRL_AIRCR_VECTRESET_S 0
  162. #define AM_REG_SYSCTRL_AIRCR_VECTRESET_M 0x00000001
  163. #define AM_REG_SYSCTRL_AIRCR_VECTRESET(n) (((uint32_t)(n) << 0) & 0x00000001)
  164. //*****************************************************************************
  165. //
  166. // SYSCTRL_SCR - System Control Register.
  167. //
  168. //*****************************************************************************
  169. // Determines whether a pending interrupt is a wakeup event.
  170. #define AM_REG_SYSCTRL_SCR_SEVONPEND_S 4
  171. #define AM_REG_SYSCTRL_SCR_SEVONPEND_M 0x00000010
  172. #define AM_REG_SYSCTRL_SCR_SEVONPEND(n) (((uint32_t)(n) << 4) & 0x00000010)
  173. // Determines whether the sleep mode should be regular or deep sleep
  174. #define AM_REG_SYSCTRL_SCR_SLEEPDEEP_S 2
  175. #define AM_REG_SYSCTRL_SCR_SLEEPDEEP_M 0x00000004
  176. #define AM_REG_SYSCTRL_SCR_SLEEPDEEP(n) (((uint32_t)(n) << 2) & 0x00000004)
  177. // Determines whether the processor shoudl automatically sleep when an ISR
  178. // returns to the base-level.
  179. #define AM_REG_SYSCTRL_SCR_SLEEPONEXIT_S 1
  180. #define AM_REG_SYSCTRL_SCR_SLEEPONEXIT_M 0x00000002
  181. #define AM_REG_SYSCTRL_SCR_SLEEPONEXIT(n) (((uint32_t)(n) << 1) & 0x00000002)
  182. //*****************************************************************************
  183. //
  184. // SYSCTRL_CCR - Configuration and Control Register.
  185. //
  186. //*****************************************************************************
  187. // Set to force 8-byte alignment for the stack pointer.
  188. #define AM_REG_SYSCTRL_CCR_STKALIGN_S 9
  189. #define AM_REG_SYSCTRL_CCR_STKALIGN_M 0x00000200
  190. #define AM_REG_SYSCTRL_CCR_STKALIGN(n) (((uint32_t)(n) << 9) & 0x00000200)
  191. // Set to ignore precise data access faults during hard fault handlers.
  192. #define AM_REG_SYSCTRL_CCR_BFHFNMIGN_S 8
  193. #define AM_REG_SYSCTRL_CCR_BFHFNMIGN_M 0x00000100
  194. #define AM_REG_SYSCTRL_CCR_BFHFNMIGN(n) (((uint32_t)(n) << 8) & 0x00000100)
  195. // Set to enable trapping on divide-by-zero.
  196. #define AM_REG_SYSCTRL_CCR_DIV0TRP_S 4
  197. #define AM_REG_SYSCTRL_CCR_DIV0TRP_M 0x00000010
  198. #define AM_REG_SYSCTRL_CCR_DIV0TRP(n) (((uint32_t)(n) << 4) & 0x00000010)
  199. // Set to enable trapping of unaligned word or halfword accesses.
  200. #define AM_REG_SYSCTRL_CCR_UNALIGNTRP_S 3
  201. #define AM_REG_SYSCTRL_CCR_UNALIGNTRP_M 0x00000008
  202. #define AM_REG_SYSCTRL_CCR_UNALIGNTRP(n) (((uint32_t)(n) << 3) & 0x00000008)
  203. // Set to allow unpriveleged software to access the STIR
  204. #define AM_REG_SYSCTRL_CCR_USERSETMPEND_S 1
  205. #define AM_REG_SYSCTRL_CCR_USERSETMPEND_M 0x00000002
  206. #define AM_REG_SYSCTRL_CCR_USERSETMPEND(n) (((uint32_t)(n) << 1) & 0x00000002)
  207. // Set to enable the processor to enter Thread mode at an execution priority
  208. // other than base level.
  209. #define AM_REG_SYSCTRL_CCR_NONBASETHRDENA_S 0
  210. #define AM_REG_SYSCTRL_CCR_NONBASETHRDENA_M 0x00000001
  211. #define AM_REG_SYSCTRL_CCR_NONBASETHRDENA(n) (((uint32_t)(n) << 0) & 0x00000001)
  212. //*****************************************************************************
  213. //
  214. // SYSCTRL_SHPR1 - System Handler Priority Register 1.
  215. //
  216. //*****************************************************************************
  217. // Reserved for priority of system handler 7.
  218. #define AM_REG_SYSCTRL_SHPR1_PRI_7_S 24
  219. #define AM_REG_SYSCTRL_SHPR1_PRI_7_M 0xFF000000
  220. #define AM_REG_SYSCTRL_SHPR1_PRI_7(n) (((uint32_t)(n) << 24) & 0xFF000000)
  221. // Priority of system handler 6, UsageFault.
  222. #define AM_REG_SYSCTRL_SHPR1_PRI_6_S 16
  223. #define AM_REG_SYSCTRL_SHPR1_PRI_6_M 0x00FF0000
  224. #define AM_REG_SYSCTRL_SHPR1_PRI_6(n) (((uint32_t)(n) << 16) & 0x00FF0000)
  225. // Priority of system handler 5, BusFault.
  226. #define AM_REG_SYSCTRL_SHPR1_PRI_5_S 8
  227. #define AM_REG_SYSCTRL_SHPR1_PRI_5_M 0x0000FF00
  228. #define AM_REG_SYSCTRL_SHPR1_PRI_5(n) (((uint32_t)(n) << 8) & 0x0000FF00)
  229. // Priority of system handler 4, MemManage.
  230. #define AM_REG_SYSCTRL_SHPR1_PRI_4_S 0
  231. #define AM_REG_SYSCTRL_SHPR1_PRI_4_M 0x000000FF
  232. #define AM_REG_SYSCTRL_SHPR1_PRI_4(n) (((uint32_t)(n) << 0) & 0x000000FF)
  233. //*****************************************************************************
  234. //
  235. // SYSCTRL_SHPR2 - System Handler Priority Register 2.
  236. //
  237. //*****************************************************************************
  238. // Priority of system handler 11, SVCall.
  239. #define AM_REG_SYSCTRL_SHPR2_PRI_11_S 24
  240. #define AM_REG_SYSCTRL_SHPR2_PRI_11_M 0xFF000000
  241. #define AM_REG_SYSCTRL_SHPR2_PRI_11(n) (((uint32_t)(n) << 24) & 0xFF000000)
  242. // Reserved for priority of system handler 10.
  243. #define AM_REG_SYSCTRL_SHPR2_PRI_10_S 16
  244. #define AM_REG_SYSCTRL_SHPR2_PRI_10_M 0x00FF0000
  245. #define AM_REG_SYSCTRL_SHPR2_PRI_10(n) (((uint32_t)(n) << 16) & 0x00FF0000)
  246. // Reserved for priority of system handler 9.
  247. #define AM_REG_SYSCTRL_SHPR2_PRI_9_S 8
  248. #define AM_REG_SYSCTRL_SHPR2_PRI_9_M 0x0000FF00
  249. #define AM_REG_SYSCTRL_SHPR2_PRI_9(n) (((uint32_t)(n) << 8) & 0x0000FF00)
  250. // Reserved for priority of system handler 8.
  251. #define AM_REG_SYSCTRL_SHPR2_PRI_8_S 0
  252. #define AM_REG_SYSCTRL_SHPR2_PRI_8_M 0x000000FF
  253. #define AM_REG_SYSCTRL_SHPR2_PRI_8(n) (((uint32_t)(n) << 0) & 0x000000FF)
  254. //*****************************************************************************
  255. //
  256. // SYSCTRL_SHPR3 - System Handler Priority Register 3.
  257. //
  258. //*****************************************************************************
  259. // Priority of system handler 15, SysTick.
  260. #define AM_REG_SYSCTRL_SHPR3_PRI_15_S 24
  261. #define AM_REG_SYSCTRL_SHPR3_PRI_15_M 0xFF000000
  262. #define AM_REG_SYSCTRL_SHPR3_PRI_15(n) (((uint32_t)(n) << 24) & 0xFF000000)
  263. // Priority of system handler 14, PendSV.
  264. #define AM_REG_SYSCTRL_SHPR3_PRI_14_S 16
  265. #define AM_REG_SYSCTRL_SHPR3_PRI_14_M 0x00FF0000
  266. #define AM_REG_SYSCTRL_SHPR3_PRI_14(n) (((uint32_t)(n) << 16) & 0x00FF0000)
  267. // Reserved for priority of system handler 13.
  268. #define AM_REG_SYSCTRL_SHPR3_PRI_13_S 8
  269. #define AM_REG_SYSCTRL_SHPR3_PRI_13_M 0x0000FF00
  270. #define AM_REG_SYSCTRL_SHPR3_PRI_13(n) (((uint32_t)(n) << 8) & 0x0000FF00)
  271. // Priority of system handler 12, DebugMonitor.
  272. #define AM_REG_SYSCTRL_SHPR3_PRI_12_S 0
  273. #define AM_REG_SYSCTRL_SHPR3_PRI_12_M 0x000000FF
  274. #define AM_REG_SYSCTRL_SHPR3_PRI_12(n) (((uint32_t)(n) << 0) & 0x000000FF)
  275. //*****************************************************************************
  276. //
  277. // SYSCTRL_SHCSR - System Handler Control and State Register.
  278. //
  279. //*****************************************************************************
  280. // Set to enable UsageFault.
  281. #define AM_REG_SYSCTRL_SHCSR_USAGEFAULTENA_S 18
  282. #define AM_REG_SYSCTRL_SHCSR_USAGEFAULTENA_M 0x00040000
  283. #define AM_REG_SYSCTRL_SHCSR_USAGEFAULTENA(n) (((uint32_t)(n) << 18) & 0x00040000)
  284. // Set to enable BusFault.
  285. #define AM_REG_SYSCTRL_SHCSR_BUSFAULTENA_S 17
  286. #define AM_REG_SYSCTRL_SHCSR_BUSFAULTENA_M 0x00020000
  287. #define AM_REG_SYSCTRL_SHCSR_BUSFAULTENA(n) (((uint32_t)(n) << 17) & 0x00020000)
  288. // Set to enable MemManageFault.
  289. #define AM_REG_SYSCTRL_SHCSR_MEMFAULTENA_S 16
  290. #define AM_REG_SYSCTRL_SHCSR_MEMFAULTENA_M 0x00010000
  291. #define AM_REG_SYSCTRL_SHCSR_MEMFAULTENA(n) (((uint32_t)(n) << 16) & 0x00010000)
  292. // Set to pend the SVCall exception.
  293. #define AM_REG_SYSCTRL_SHCSR_SVCALLPENDED_S 15
  294. #define AM_REG_SYSCTRL_SHCSR_SVCALLPENDED_M 0x00008000
  295. #define AM_REG_SYSCTRL_SHCSR_SVCALLPENDED(n) (((uint32_t)(n) << 15) & 0x00008000)
  296. // Set to pend the BusFault exception.
  297. #define AM_REG_SYSCTRL_SHCSR_BUSFAULTPENDED_S 14
  298. #define AM_REG_SYSCTRL_SHCSR_BUSFAULTPENDED_M 0x00004000
  299. #define AM_REG_SYSCTRL_SHCSR_BUSFAULTPENDED(n) (((uint32_t)(n) << 14) & 0x00004000)
  300. // Set to pend the MemManageFault exception.
  301. #define AM_REG_SYSCTRL_SHCSR_MEMFAULTPENDED_S 13
  302. #define AM_REG_SYSCTRL_SHCSR_MEMFAULTPENDED_M 0x00002000
  303. #define AM_REG_SYSCTRL_SHCSR_MEMFAULTPENDED(n) (((uint32_t)(n) << 13) & 0x00002000)
  304. // Set to pend the UsageFault exception.
  305. #define AM_REG_SYSCTRL_SHCSR_USGFAULTPENDED_S 12
  306. #define AM_REG_SYSCTRL_SHCSR_USGFAULTPENDED_M 0x00001000
  307. #define AM_REG_SYSCTRL_SHCSR_USGFAULTPENDED(n) (((uint32_t)(n) << 12) & 0x00001000)
  308. // Set when SysTick is active.
  309. #define AM_REG_SYSCTRL_SHCSR_SYSTICKACT_S 11
  310. #define AM_REG_SYSCTRL_SHCSR_SYSTICKACT_M 0x00000800
  311. #define AM_REG_SYSCTRL_SHCSR_SYSTICKACT(n) (((uint32_t)(n) << 11) & 0x00000800)
  312. // Set when PendSV is active.
  313. #define AM_REG_SYSCTRL_SHCSR_PENDSVACT_S 10
  314. #define AM_REG_SYSCTRL_SHCSR_PENDSVACT_M 0x00000400
  315. #define AM_REG_SYSCTRL_SHCSR_PENDSVACT(n) (((uint32_t)(n) << 10) & 0x00000400)
  316. // Set when Monitor is active.
  317. #define AM_REG_SYSCTRL_SHCSR_MONITORACT_S 8
  318. #define AM_REG_SYSCTRL_SHCSR_MONITORACT_M 0x00000100
  319. #define AM_REG_SYSCTRL_SHCSR_MONITORACT(n) (((uint32_t)(n) << 8) & 0x00000100)
  320. // Set when SVCall is active.
  321. #define AM_REG_SYSCTRL_SHCSR_SVCALLACT_S 7
  322. #define AM_REG_SYSCTRL_SHCSR_SVCALLACT_M 0x00000080
  323. #define AM_REG_SYSCTRL_SHCSR_SVCALLACT(n) (((uint32_t)(n) << 7) & 0x00000080)
  324. // Set when UsageFault is active.
  325. #define AM_REG_SYSCTRL_SHCSR_USGFAULTACT_S 3
  326. #define AM_REG_SYSCTRL_SHCSR_USGFAULTACT_M 0x00000008
  327. #define AM_REG_SYSCTRL_SHCSR_USGFAULTACT(n) (((uint32_t)(n) << 3) & 0x00000008)
  328. // Set when BusFault is active.
  329. #define AM_REG_SYSCTRL_SHCSR_BUSFAULTACT_S 1
  330. #define AM_REG_SYSCTRL_SHCSR_BUSFAULTACT_M 0x00000002
  331. #define AM_REG_SYSCTRL_SHCSR_BUSFAULTACT(n) (((uint32_t)(n) << 1) & 0x00000002)
  332. // Set when MemManageFault is active.
  333. #define AM_REG_SYSCTRL_SHCSR_MEMFAULTACT_S 0
  334. #define AM_REG_SYSCTRL_SHCSR_MEMFAULTACT_M 0x00000001
  335. #define AM_REG_SYSCTRL_SHCSR_MEMFAULTACT(n) (((uint32_t)(n) << 0) & 0x00000001)
  336. //*****************************************************************************
  337. //
  338. // SYSCTRL_CFSR - Configurable Fault Status Register.
  339. //
  340. //*****************************************************************************
  341. // Divide by zero error has occurred.
  342. #define AM_REG_SYSCTRL_CFSR_DIVBYZERO_S 25
  343. #define AM_REG_SYSCTRL_CFSR_DIVBYZERO_M 0x02000000
  344. #define AM_REG_SYSCTRL_CFSR_DIVBYZERO(n) (((uint32_t)(n) << 25) & 0x02000000)
  345. // Unaligned access error has occurred.
  346. #define AM_REG_SYSCTRL_CFSR_UNALIGNED_S 24
  347. #define AM_REG_SYSCTRL_CFSR_UNALIGNED_M 0x01000000
  348. #define AM_REG_SYSCTRL_CFSR_UNALIGNED(n) (((uint32_t)(n) << 24) & 0x01000000)
  349. // A coprocessor access error has occurred.
  350. #define AM_REG_SYSCTRL_CFSR_NOCP_S 19
  351. #define AM_REG_SYSCTRL_CFSR_NOCP_M 0x00080000
  352. #define AM_REG_SYSCTRL_CFSR_NOCP(n) (((uint32_t)(n) << 19) & 0x00080000)
  353. // An integrity check error has occurred on EXC_RETURN.
  354. #define AM_REG_SYSCTRL_CFSR_INVPC_S 18
  355. #define AM_REG_SYSCTRL_CFSR_INVPC_M 0x00040000
  356. #define AM_REG_SYSCTRL_CFSR_INVPC(n) (((uint32_t)(n) << 18) & 0x00040000)
  357. // Instruction executed with invalid EPSR.T or EPSR.IT field.
  358. #define AM_REG_SYSCTRL_CFSR_INVSTATE_S 17
  359. #define AM_REG_SYSCTRL_CFSR_INVSTATE_M 0x00020000
  360. #define AM_REG_SYSCTRL_CFSR_INVSTATE(n) (((uint32_t)(n) << 17) & 0x00020000)
  361. // Processor attempted to execute an undefined instruction.
  362. #define AM_REG_SYSCTRL_CFSR_UNDEFINSTR_S 16
  363. #define AM_REG_SYSCTRL_CFSR_UNDEFINSTR_M 0x00010000
  364. #define AM_REG_SYSCTRL_CFSR_UNDEFINSTR(n) (((uint32_t)(n) << 16) & 0x00010000)
  365. // BFAR has valid contents.
  366. #define AM_REG_SYSCTRL_CFSR_BFARVALID_S 15
  367. #define AM_REG_SYSCTRL_CFSR_BFARVALID_M 0x00008000
  368. #define AM_REG_SYSCTRL_CFSR_BFARVALID(n) (((uint32_t)(n) << 15) & 0x00008000)
  369. // A bus fault occurred during FP lazy state preservation.
  370. #define AM_REG_SYSCTRL_CFSR_LSPERR_S 13
  371. #define AM_REG_SYSCTRL_CFSR_LSPERR_M 0x00002000
  372. #define AM_REG_SYSCTRL_CFSR_LSPERR(n) (((uint32_t)(n) << 13) & 0x00002000)
  373. // A derived bus fault has occurred on exception entry.
  374. #define AM_REG_SYSCTRL_CFSR_STKERR_S 12
  375. #define AM_REG_SYSCTRL_CFSR_STKERR_M 0x00001000
  376. #define AM_REG_SYSCTRL_CFSR_STKERR(n) (((uint32_t)(n) << 12) & 0x00001000)
  377. // A derived bus fault has occurred on exception return.
  378. #define AM_REG_SYSCTRL_CFSR_UNSTKERR_S 11
  379. #define AM_REG_SYSCTRL_CFSR_UNSTKERR_M 0x00000800
  380. #define AM_REG_SYSCTRL_CFSR_UNSTKERR(n) (((uint32_t)(n) << 11) & 0x00000800)
  381. // Imprecise data access error has occurred.
  382. #define AM_REG_SYSCTRL_CFSR_IMPRECISERR_S 10
  383. #define AM_REG_SYSCTRL_CFSR_IMPRECISERR_M 0x00000400
  384. #define AM_REG_SYSCTRL_CFSR_IMPRECISERR(n) (((uint32_t)(n) << 10) & 0x00000400)
  385. // A precise data access has occurrred. The faulting address is in BFAR.
  386. #define AM_REG_SYSCTRL_CFSR_PRECISERR_S 9
  387. #define AM_REG_SYSCTRL_CFSR_PRECISERR_M 0x00000200
  388. #define AM_REG_SYSCTRL_CFSR_PRECISERR(n) (((uint32_t)(n) << 9) & 0x00000200)
  389. // A bus fault on an instruction prefetch has occurred.
  390. #define AM_REG_SYSCTRL_CFSR_IBUSERR_S 8
  391. #define AM_REG_SYSCTRL_CFSR_IBUSERR_M 0x00000100
  392. #define AM_REG_SYSCTRL_CFSR_IBUSERR(n) (((uint32_t)(n) << 8) & 0x00000100)
  393. // MMAR has valid contents.
  394. #define AM_REG_SYSCTRL_CFSR_MMARVALID_S 7
  395. #define AM_REG_SYSCTRL_CFSR_MMARVALID_M 0x00000080
  396. #define AM_REG_SYSCTRL_CFSR_MMARVALID(n) (((uint32_t)(n) << 7) & 0x00000080)
  397. // MemManage fault occurred during FP lazy state preservation.
  398. #define AM_REG_SYSCTRL_CFSR_MLSPERR_S 5
  399. #define AM_REG_SYSCTRL_CFSR_MLSPERR_M 0x00000020
  400. #define AM_REG_SYSCTRL_CFSR_MLSPERR(n) (((uint32_t)(n) << 5) & 0x00000020)
  401. // Derived MemManage fault occurred on exception entry.
  402. #define AM_REG_SYSCTRL_CFSR_MSTKERR_S 4
  403. #define AM_REG_SYSCTRL_CFSR_MSTKERR_M 0x00000010
  404. #define AM_REG_SYSCTRL_CFSR_MSTKERR(n) (((uint32_t)(n) << 4) & 0x00000010)
  405. // Derived MemManage fault occurred on exception return.
  406. #define AM_REG_SYSCTRL_CFSR_MUNSTKER_S 3
  407. #define AM_REG_SYSCTRL_CFSR_MUNSTKER_M 0x00000008
  408. #define AM_REG_SYSCTRL_CFSR_MUNSTKER(n) (((uint32_t)(n) << 3) & 0x00000008)
  409. // Data access violation. Address is in MMAR.
  410. #define AM_REG_SYSCTRL_CFSR_DACCVIOL_S 1
  411. #define AM_REG_SYSCTRL_CFSR_DACCVIOL_M 0x00000002
  412. #define AM_REG_SYSCTRL_CFSR_DACCVIOL(n) (((uint32_t)(n) << 1) & 0x00000002)
  413. // MPU or Execute Never default memory map access violation.
  414. #define AM_REG_SYSCTRL_CFSR_IACCVIOL_S 0
  415. #define AM_REG_SYSCTRL_CFSR_IACCVIOL_M 0x00000001
  416. #define AM_REG_SYSCTRL_CFSR_IACCVIOL(n) (((uint32_t)(n) << 0) & 0x00000001)
  417. //*****************************************************************************
  418. //
  419. // SYSCTRL_HFSR - Hard Fault Status Register.
  420. //
  421. //*****************************************************************************
  422. // Debug event has occurred.
  423. #define AM_REG_SYSCTRL_HFSR_DEBUGEVT_S 31
  424. #define AM_REG_SYSCTRL_HFSR_DEBUGEVT_M 0x80000000
  425. #define AM_REG_SYSCTRL_HFSR_DEBUGEVT(n) (((uint32_t)(n) << 31) & 0x80000000)
  426. // Processor has elevated a configurable-priority fault to a HardFault.
  427. #define AM_REG_SYSCTRL_HFSR_FORCED_S 30
  428. #define AM_REG_SYSCTRL_HFSR_FORCED_M 0x40000000
  429. #define AM_REG_SYSCTRL_HFSR_FORCED(n) (((uint32_t)(n) << 30) & 0x40000000)
  430. // Vector table read fault has occurred.
  431. #define AM_REG_SYSCTRL_HFSR_VECTTBL_S 1
  432. #define AM_REG_SYSCTRL_HFSR_VECTTBL_M 0x00000002
  433. #define AM_REG_SYSCTRL_HFSR_VECTTBL(n) (((uint32_t)(n) << 1) & 0x00000002)
  434. //*****************************************************************************
  435. //
  436. // SYSCTRL_MMFAR - MemManage Fault Address Register.
  437. //
  438. //*****************************************************************************
  439. // Address of the memory location that caused an MMU fault.
  440. #define AM_REG_SYSCTRL_MMFAR_ADDRESS_S 0
  441. #define AM_REG_SYSCTRL_MMFAR_ADDRESS_M 0xFFFFFFFF
  442. #define AM_REG_SYSCTRL_MMFAR_ADDRESS(n) (((uint32_t)(n) << 0) & 0xFFFFFFFF)
  443. //*****************************************************************************
  444. //
  445. // SYSCTRL_BFAR - Bus Fault Address Register.
  446. //
  447. //*****************************************************************************
  448. // Address of the memory location that caused an Bus fault.
  449. #define AM_REG_SYSCTRL_BFAR_ADDRESS_S 0
  450. #define AM_REG_SYSCTRL_BFAR_ADDRESS_M 0xFFFFFFFF
  451. #define AM_REG_SYSCTRL_BFAR_ADDRESS(n) (((uint32_t)(n) << 0) & 0xFFFFFFFF)
  452. //*****************************************************************************
  453. //
  454. // SYSCTRL_CPACR - Coprocessor Access Control Register.
  455. //
  456. //*****************************************************************************
  457. // Access priveleges for the Floating point unit. Must always match CP10.
  458. #define AM_REG_SYSCTRL_CPACR_CP11_S 22
  459. #define AM_REG_SYSCTRL_CPACR_CP11_M 0x00C00000
  460. #define AM_REG_SYSCTRL_CPACR_CP11(n) (((uint32_t)(n) << 22) & 0x00C00000)
  461. // Access priveleges for the Floating point unit. Must always match CP11.
  462. #define AM_REG_SYSCTRL_CPACR_CP10_S 20
  463. #define AM_REG_SYSCTRL_CPACR_CP10_M 0x00300000
  464. #define AM_REG_SYSCTRL_CPACR_CP10(n) (((uint32_t)(n) << 20) & 0x00300000)
  465. //*****************************************************************************
  466. //
  467. // SYSCTRL_DEMCR - Debug Exception and Monitor Control Register
  468. //
  469. //*****************************************************************************
  470. // Global enable for all DWT and ITM features.
  471. #define AM_REG_SYSCTRL_DEMCR_TRCENA_S 24
  472. #define AM_REG_SYSCTRL_DEMCR_TRCENA_M 0x01000000
  473. #define AM_REG_SYSCTRL_DEMCR_TRCENA(n) (((uint32_t)(n) << 24) & 0x01000000)
  474. //*****************************************************************************
  475. //
  476. // SYSCTRL_STIR - Software Triggered Interrupt Register
  477. //
  478. //*****************************************************************************
  479. // Vector number of the interrupt that should be triggered.
  480. #define AM_REG_SYSCTRL_STIR_INTID_S 0
  481. #define AM_REG_SYSCTRL_STIR_INTID_M 0xFFFFFFFF
  482. #define AM_REG_SYSCTRL_STIR_INTID(n) (((uint32_t)(n) << 0) & 0xFFFFFFFF)
  483. //*****************************************************************************
  484. //
  485. // SYSCTRL_FPCCR - Floating-Point Context Control Register.
  486. //
  487. //*****************************************************************************
  488. // Set to enable automatic saving of FP registers on exception entry.
  489. #define AM_REG_SYSCTRL_FPCCR_ASPEN_S 31
  490. #define AM_REG_SYSCTRL_FPCCR_ASPEN_M 0x80000000
  491. #define AM_REG_SYSCTRL_FPCCR_ASPEN(n) (((uint32_t)(n) << 31) & 0x80000000)
  492. // Set to enable lazy context saving of FP registers on exception entry.
  493. #define AM_REG_SYSCTRL_FPCCR_LSPEN_S 30
  494. #define AM_REG_SYSCTRL_FPCCR_LSPEN_M 0x40000000
  495. #define AM_REG_SYSCTRL_FPCCR_LSPEN(n) (((uint32_t)(n) << 30) & 0x40000000)
  496. // Able to set DebugMonitor exception to pending on last FP stack allocation.
  497. #define AM_REG_SYSCTRL_FPCCR_MONRDY_S 8
  498. #define AM_REG_SYSCTRL_FPCCR_MONRDY_M 0x00000100
  499. #define AM_REG_SYSCTRL_FPCCR_MONRDY(n) (((uint32_t)(n) << 8) & 0x00000100)
  500. // Able to set BusFault exception to pending on last FP stack allocation.
  501. #define AM_REG_SYSCTRL_FPCCR_BFRDY_S 6
  502. #define AM_REG_SYSCTRL_FPCCR_BFRDY_M 0x00000040
  503. #define AM_REG_SYSCTRL_FPCCR_BFRDY(n) (((uint32_t)(n) << 6) & 0x00000040)
  504. // Able to set MemManage exception to pending on last FP stack allocation.
  505. #define AM_REG_SYSCTRL_FPCCR_MMRDY_S 5
  506. #define AM_REG_SYSCTRL_FPCCR_MMRDY_M 0x00000020
  507. #define AM_REG_SYSCTRL_FPCCR_MMRDY(n) (((uint32_t)(n) << 5) & 0x00000020)
  508. // Able to set HardFault exception to pending on last FP stack allocation.
  509. #define AM_REG_SYSCTRL_FPCCR_HFRDY_S 4
  510. #define AM_REG_SYSCTRL_FPCCR_HFRDY_M 0x00000010
  511. #define AM_REG_SYSCTRL_FPCCR_HFRDY(n) (((uint32_t)(n) << 4) & 0x00000010)
  512. // Running from Thread mode on last FP stack allocation.
  513. #define AM_REG_SYSCTRL_FPCCR_THREAD_S 3
  514. #define AM_REG_SYSCTRL_FPCCR_THREAD_M 0x00000008
  515. #define AM_REG_SYSCTRL_FPCCR_THREAD(n) (((uint32_t)(n) << 3) & 0x00000008)
  516. // Running from unprivileged mode on last FP stack allocation.
  517. #define AM_REG_SYSCTRL_FPCCR_USER_S 1
  518. #define AM_REG_SYSCTRL_FPCCR_USER_M 0x00000002
  519. #define AM_REG_SYSCTRL_FPCCR_USER(n) (((uint32_t)(n) << 1) & 0x00000002)
  520. // Lazy state preservation is active.
  521. #define AM_REG_SYSCTRL_FPCCR_LSPACT_S 0
  522. #define AM_REG_SYSCTRL_FPCCR_LSPACT_M 0x00000001
  523. #define AM_REG_SYSCTRL_FPCCR_LSPACT(n) (((uint32_t)(n) << 0) & 0x00000001)
  524. //*****************************************************************************
  525. //
  526. // SYSCTRL_FPCAR - Floating-Point Context Address Register.
  527. //
  528. //*****************************************************************************
  529. // Address of the unpopulated floating-point register space allocated on the
  530. // exception stack frame.
  531. #define AM_REG_SYSCTRL_FPCAR_ADDRESS_S 0
  532. #define AM_REG_SYSCTRL_FPCAR_ADDRESS_M 0xFFFFFFFF
  533. #define AM_REG_SYSCTRL_FPCAR_ADDRESS(n) (((uint32_t)(n) << 0) & 0xFFFFFFFF)
  534. //*****************************************************************************
  535. //
  536. // SYSCTRL_FPDSCR - Floating-Point Default Status Control Register.
  537. //
  538. //*****************************************************************************
  539. // Default value for FPSCR.AHP.
  540. #define AM_REG_SYSCTRL_FPDSCR_AHP_S 26
  541. #define AM_REG_SYSCTRL_FPDSCR_AHP_M 0x04000000
  542. #define AM_REG_SYSCTRL_FPDSCR_AHP(n) (((uint32_t)(n) << 26) & 0x04000000)
  543. // Default value for FPSCR.DN.
  544. #define AM_REG_SYSCTRL_FPDSCR_DN_S 25
  545. #define AM_REG_SYSCTRL_FPDSCR_DN_M 0x02000000
  546. #define AM_REG_SYSCTRL_FPDSCR_DN(n) (((uint32_t)(n) << 25) & 0x02000000)
  547. // Default value for FPSCR.FZ.
  548. #define AM_REG_SYSCTRL_FPDSCR_FZ_S 24
  549. #define AM_REG_SYSCTRL_FPDSCR_FZ_M 0x01000000
  550. #define AM_REG_SYSCTRL_FPDSCR_FZ(n) (((uint32_t)(n) << 24) & 0x01000000)
  551. // Default value for FPSCR.RMode.
  552. #define AM_REG_SYSCTRL_FPDSCR_RMODE_S 22
  553. #define AM_REG_SYSCTRL_FPDSCR_RMODE_M 0x00C00000
  554. #define AM_REG_SYSCTRL_FPDSCR_RMODE(n) (((uint32_t)(n) << 22) & 0x00C00000)
  555. #endif // AM_REG_SYSCTRL_H