am_reg_sysctrl.h 34 KB

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