core_armv8mbl.h 112 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222
  1. /**************************************************************************//**
  2. * @file core_armv8mbl.h
  3. * @brief CMSIS Armv8-M Baseline Core Peripheral Access Layer Header File
  4. * @version V5.1.0
  5. * @date 27. March 2020
  6. ******************************************************************************/
  7. /*
  8. * Copyright (c) 2009-2020 Arm Limited. All rights reserved.
  9. *
  10. * SPDX-License-Identifier: Apache-2.0
  11. *
  12. * Licensed under the Apache License, Version 2.0 (the License); you may
  13. * not use this file except in compliance with the License.
  14. * You may obtain a copy of the License at
  15. *
  16. * www.apache.org/licenses/LICENSE-2.0
  17. *
  18. * Unless required by applicable law or agreed to in writing, software
  19. * distributed under the License is distributed on an AS IS BASIS, WITHOUT
  20. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  21. * See the License for the specific language governing permissions and
  22. * limitations under the License.
  23. */
  24. #if defined ( __ICCARM__ )
  25. #pragma system_include /* treat file as system include file for MISRA check */
  26. #elif defined (__clang__)
  27. #pragma clang system_header /* treat file as system include file */
  28. #elif defined ( __GNUC__ )
  29. #pragma GCC diagnostic ignored "-Wpedantic" /* disable pedantic warning due to unnamed structs/unions */
  30. #endif
  31. #ifndef __CORE_ARMV8MBL_H_GENERIC
  32. #define __CORE_ARMV8MBL_H_GENERIC
  33. #include <stdint.h>
  34. #ifdef __cplusplus
  35. extern "C" {
  36. #endif
  37. /**
  38. \page CMSIS_MISRA_Exceptions MISRA-C:2004 Compliance Exceptions
  39. CMSIS violates the following MISRA-C:2004 rules:
  40. \li Required Rule 8.5, object/function definition in header file.<br>
  41. Function definitions in header files are used to allow 'inlining'.
  42. \li Required Rule 18.4, declaration of union type or object of union type: '{...}'.<br>
  43. Unions are used for effective representation of core registers.
  44. \li Advisory Rule 19.7, Function-like macro defined.<br>
  45. Function-like macros are used to allow more efficient code.
  46. */
  47. /*******************************************************************************
  48. * CMSIS definitions
  49. ******************************************************************************/
  50. /**
  51. \ingroup Cortex_ARMv8MBL
  52. @{
  53. */
  54. #include "cmsis_version.h"
  55. /* CMSIS definitions */
  56. #define __ARMv8MBL_CMSIS_VERSION_MAIN (__CM_CMSIS_VERSION_MAIN) /*!< \deprecated [31:16] CMSIS HAL main version */
  57. #define __ARMv8MBL_CMSIS_VERSION_SUB (__CM_CMSIS_VERSION_SUB) /*!< \deprecated [15:0] CMSIS HAL sub version */
  58. #define __ARMv8MBL_CMSIS_VERSION ((__ARMv8MBL_CMSIS_VERSION_MAIN << 16U) | \
  59. __ARMv8MBL_CMSIS_VERSION_SUB ) /*!< \deprecated CMSIS HAL version number */
  60. #define __CORTEX_M (2U) /*!< Cortex-M Core */
  61. /** __FPU_USED indicates whether an FPU is used or not.
  62. This core does not support an FPU at all
  63. */
  64. #define __FPU_USED 0U
  65. #if defined ( __CC_ARM )
  66. #if defined __TARGET_FPU_VFP
  67. #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
  68. #endif
  69. #elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
  70. #if defined __ARM_FP
  71. #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
  72. #endif
  73. #elif defined ( __GNUC__ )
  74. #if defined (__VFP_FP__) && !defined(__SOFTFP__)
  75. #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
  76. #endif
  77. #elif defined ( __ICCARM__ )
  78. #if defined __ARMVFP__
  79. #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
  80. #endif
  81. #elif defined ( __TI_ARM__ )
  82. #if defined __TI_VFP_SUPPORT__
  83. #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
  84. #endif
  85. #elif defined ( __TASKING__ )
  86. #if defined __FPU_VFP__
  87. #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
  88. #endif
  89. #elif defined ( __CSMC__ )
  90. #if ( __CSMC__ & 0x400U)
  91. #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
  92. #endif
  93. #endif
  94. #include "cmsis_compiler.h" /* CMSIS compiler specific defines */
  95. #ifdef __cplusplus
  96. }
  97. #endif
  98. #endif /* __CORE_ARMV8MBL_H_GENERIC */
  99. #ifndef __CMSIS_GENERIC
  100. #ifndef __CORE_ARMV8MBL_H_DEPENDANT
  101. #define __CORE_ARMV8MBL_H_DEPENDANT
  102. #ifdef __cplusplus
  103. extern "C" {
  104. #endif
  105. /* check device defines and use defaults */
  106. #if defined __CHECK_DEVICE_DEFINES
  107. #ifndef __ARMv8MBL_REV
  108. #define __ARMv8MBL_REV 0x0000U
  109. #warning "__ARMv8MBL_REV not defined in device header file; using default!"
  110. #endif
  111. #ifndef __FPU_PRESENT
  112. #define __FPU_PRESENT 0U
  113. #warning "__FPU_PRESENT not defined in device header file; using default!"
  114. #endif
  115. #ifndef __MPU_PRESENT
  116. #define __MPU_PRESENT 0U
  117. #warning "__MPU_PRESENT not defined in device header file; using default!"
  118. #endif
  119. #ifndef __SAUREGION_PRESENT
  120. #define __SAUREGION_PRESENT 0U
  121. #warning "__SAUREGION_PRESENT not defined in device header file; using default!"
  122. #endif
  123. #ifndef __VTOR_PRESENT
  124. #define __VTOR_PRESENT 0U
  125. #warning "__VTOR_PRESENT not defined in device header file; using default!"
  126. #endif
  127. #ifndef __NVIC_PRIO_BITS
  128. #define __NVIC_PRIO_BITS 2U
  129. #warning "__NVIC_PRIO_BITS not defined in device header file; using default!"
  130. #endif
  131. #ifndef __Vendor_SysTickConfig
  132. #define __Vendor_SysTickConfig 0U
  133. #warning "__Vendor_SysTickConfig not defined in device header file; using default!"
  134. #endif
  135. #ifndef __ETM_PRESENT
  136. #define __ETM_PRESENT 0U
  137. #warning "__ETM_PRESENT not defined in device header file; using default!"
  138. #endif
  139. #ifndef __MTB_PRESENT
  140. #define __MTB_PRESENT 0U
  141. #warning "__MTB_PRESENT not defined in device header file; using default!"
  142. #endif
  143. #endif
  144. /* IO definitions (access restrictions to peripheral registers) */
  145. /**
  146. \defgroup CMSIS_glob_defs CMSIS Global Defines
  147. <strong>IO Type Qualifiers</strong> are used
  148. \li to specify the access to peripheral variables.
  149. \li for automatic generation of peripheral register debug information.
  150. */
  151. #ifdef __cplusplus
  152. #define __I volatile /*!< Defines 'read only' permissions */
  153. #else
  154. #define __I volatile const /*!< Defines 'read only' permissions */
  155. #endif
  156. #define __O volatile /*!< Defines 'write only' permissions */
  157. #define __IO volatile /*!< Defines 'read / write' permissions */
  158. /* following defines should be used for structure members */
  159. #define __IM volatile const /*! Defines 'read only' structure member permissions */
  160. #define __OM volatile /*! Defines 'write only' structure member permissions */
  161. #define __IOM volatile /*! Defines 'read / write' structure member permissions */
  162. /*@} end of group ARMv8MBL */
  163. /*******************************************************************************
  164. * Register Abstraction
  165. Core Register contain:
  166. - Core Register
  167. - Core NVIC Register
  168. - Core SCB Register
  169. - Core SysTick Register
  170. - Core Debug Register
  171. - Core MPU Register
  172. - Core SAU Register
  173. ******************************************************************************/
  174. /**
  175. \defgroup CMSIS_core_register Defines and Type Definitions
  176. \brief Type definitions and defines for Cortex-M processor based devices.
  177. */
  178. /**
  179. \ingroup CMSIS_core_register
  180. \defgroup CMSIS_CORE Status and Control Registers
  181. \brief Core Register type definitions.
  182. @{
  183. */
  184. /**
  185. \brief Union type to access the Application Program Status Register (APSR).
  186. */
  187. typedef union
  188. {
  189. struct
  190. {
  191. uint32_t _reserved0:28; /*!< bit: 0..27 Reserved */
  192. uint32_t V:1; /*!< bit: 28 Overflow condition code flag */
  193. uint32_t C:1; /*!< bit: 29 Carry condition code flag */
  194. uint32_t Z:1; /*!< bit: 30 Zero condition code flag */
  195. uint32_t N:1; /*!< bit: 31 Negative condition code flag */
  196. } b; /*!< Structure used for bit access */
  197. uint32_t w; /*!< Type used for word access */
  198. } APSR_Type;
  199. /* APSR Register Definitions */
  200. #define APSR_N_Pos 31U /*!< APSR: N Position */
  201. #define APSR_N_Msk (1UL << APSR_N_Pos) /*!< APSR: N Mask */
  202. #define APSR_Z_Pos 30U /*!< APSR: Z Position */
  203. #define APSR_Z_Msk (1UL << APSR_Z_Pos) /*!< APSR: Z Mask */
  204. #define APSR_C_Pos 29U /*!< APSR: C Position */
  205. #define APSR_C_Msk (1UL << APSR_C_Pos) /*!< APSR: C Mask */
  206. #define APSR_V_Pos 28U /*!< APSR: V Position */
  207. #define APSR_V_Msk (1UL << APSR_V_Pos) /*!< APSR: V Mask */
  208. /**
  209. \brief Union type to access the Interrupt Program Status Register (IPSR).
  210. */
  211. typedef union
  212. {
  213. struct
  214. {
  215. uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */
  216. uint32_t _reserved0:23; /*!< bit: 9..31 Reserved */
  217. } b; /*!< Structure used for bit access */
  218. uint32_t w; /*!< Type used for word access */
  219. } IPSR_Type;
  220. /* IPSR Register Definitions */
  221. #define IPSR_ISR_Pos 0U /*!< IPSR: ISR Position */
  222. #define IPSR_ISR_Msk (0x1FFUL /*<< IPSR_ISR_Pos*/) /*!< IPSR: ISR Mask */
  223. /**
  224. \brief Union type to access the Special-Purpose Program Status Registers (xPSR).
  225. */
  226. typedef union
  227. {
  228. struct
  229. {
  230. uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */
  231. uint32_t _reserved0:15; /*!< bit: 9..23 Reserved */
  232. uint32_t T:1; /*!< bit: 24 Thumb bit (read 0) */
  233. uint32_t _reserved1:3; /*!< bit: 25..27 Reserved */
  234. uint32_t V:1; /*!< bit: 28 Overflow condition code flag */
  235. uint32_t C:1; /*!< bit: 29 Carry condition code flag */
  236. uint32_t Z:1; /*!< bit: 30 Zero condition code flag */
  237. uint32_t N:1; /*!< bit: 31 Negative condition code flag */
  238. } b; /*!< Structure used for bit access */
  239. uint32_t w; /*!< Type used for word access */
  240. } xPSR_Type;
  241. /* xPSR Register Definitions */
  242. #define xPSR_N_Pos 31U /*!< xPSR: N Position */
  243. #define xPSR_N_Msk (1UL << xPSR_N_Pos) /*!< xPSR: N Mask */
  244. #define xPSR_Z_Pos 30U /*!< xPSR: Z Position */
  245. #define xPSR_Z_Msk (1UL << xPSR_Z_Pos) /*!< xPSR: Z Mask */
  246. #define xPSR_C_Pos 29U /*!< xPSR: C Position */
  247. #define xPSR_C_Msk (1UL << xPSR_C_Pos) /*!< xPSR: C Mask */
  248. #define xPSR_V_Pos 28U /*!< xPSR: V Position */
  249. #define xPSR_V_Msk (1UL << xPSR_V_Pos) /*!< xPSR: V Mask */
  250. #define xPSR_T_Pos 24U /*!< xPSR: T Position */
  251. #define xPSR_T_Msk (1UL << xPSR_T_Pos) /*!< xPSR: T Mask */
  252. #define xPSR_ISR_Pos 0U /*!< xPSR: ISR Position */
  253. #define xPSR_ISR_Msk (0x1FFUL /*<< xPSR_ISR_Pos*/) /*!< xPSR: ISR Mask */
  254. /**
  255. \brief Union type to access the Control Registers (CONTROL).
  256. */
  257. typedef union
  258. {
  259. struct
  260. {
  261. uint32_t nPRIV:1; /*!< bit: 0 Execution privilege in Thread mode */
  262. uint32_t SPSEL:1; /*!< bit: 1 Stack-pointer select */
  263. uint32_t _reserved1:30; /*!< bit: 2..31 Reserved */
  264. } b; /*!< Structure used for bit access */
  265. uint32_t w; /*!< Type used for word access */
  266. } CONTROL_Type;
  267. /* CONTROL Register Definitions */
  268. #define CONTROL_SPSEL_Pos 1U /*!< CONTROL: SPSEL Position */
  269. #define CONTROL_SPSEL_Msk (1UL << CONTROL_SPSEL_Pos) /*!< CONTROL: SPSEL Mask */
  270. #define CONTROL_nPRIV_Pos 0U /*!< CONTROL: nPRIV Position */
  271. #define CONTROL_nPRIV_Msk (1UL /*<< CONTROL_nPRIV_Pos*/) /*!< CONTROL: nPRIV Mask */
  272. /*@} end of group CMSIS_CORE */
  273. /**
  274. \ingroup CMSIS_core_register
  275. \defgroup CMSIS_NVIC Nested Vectored Interrupt Controller (NVIC)
  276. \brief Type definitions for the NVIC Registers
  277. @{
  278. */
  279. /**
  280. \brief Structure type to access the Nested Vectored Interrupt Controller (NVIC).
  281. */
  282. typedef struct
  283. {
  284. __IOM uint32_t ISER[16U]; /*!< Offset: 0x000 (R/W) Interrupt Set Enable Register */
  285. uint32_t RESERVED0[16U];
  286. __IOM uint32_t ICER[16U]; /*!< Offset: 0x080 (R/W) Interrupt Clear Enable Register */
  287. uint32_t RSERVED1[16U];
  288. __IOM uint32_t ISPR[16U]; /*!< Offset: 0x100 (R/W) Interrupt Set Pending Register */
  289. uint32_t RESERVED2[16U];
  290. __IOM uint32_t ICPR[16U]; /*!< Offset: 0x180 (R/W) Interrupt Clear Pending Register */
  291. uint32_t RESERVED3[16U];
  292. __IOM uint32_t IABR[16U]; /*!< Offset: 0x200 (R/W) Interrupt Active bit Register */
  293. uint32_t RESERVED4[16U];
  294. __IOM uint32_t ITNS[16U]; /*!< Offset: 0x280 (R/W) Interrupt Non-Secure State Register */
  295. uint32_t RESERVED5[16U];
  296. __IOM uint32_t IPR[124U]; /*!< Offset: 0x300 (R/W) Interrupt Priority Register */
  297. } NVIC_Type;
  298. /*@} end of group CMSIS_NVIC */
  299. /**
  300. \ingroup CMSIS_core_register
  301. \defgroup CMSIS_SCB System Control Block (SCB)
  302. \brief Type definitions for the System Control Block Registers
  303. @{
  304. */
  305. /**
  306. \brief Structure type to access the System Control Block (SCB).
  307. */
  308. typedef struct
  309. {
  310. __IM uint32_t CPUID; /*!< Offset: 0x000 (R/ ) CPUID Base Register */
  311. __IOM uint32_t ICSR; /*!< Offset: 0x004 (R/W) Interrupt Control and State Register */
  312. #if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U)
  313. __IOM uint32_t VTOR; /*!< Offset: 0x008 (R/W) Vector Table Offset Register */
  314. #else
  315. uint32_t RESERVED0;
  316. #endif
  317. __IOM uint32_t AIRCR; /*!< Offset: 0x00C (R/W) Application Interrupt and Reset Control Register */
  318. __IOM uint32_t SCR; /*!< Offset: 0x010 (R/W) System Control Register */
  319. __IOM uint32_t CCR; /*!< Offset: 0x014 (R/W) Configuration Control Register */
  320. uint32_t RESERVED1;
  321. __IOM uint32_t SHPR[2U]; /*!< Offset: 0x01C (R/W) System Handlers Priority Registers. [0] is RESERVED */
  322. __IOM uint32_t SHCSR; /*!< Offset: 0x024 (R/W) System Handler Control and State Register */
  323. } SCB_Type;
  324. /* SCB CPUID Register Definitions */
  325. #define SCB_CPUID_IMPLEMENTER_Pos 24U /*!< SCB CPUID: IMPLEMENTER Position */
  326. #define SCB_CPUID_IMPLEMENTER_Msk (0xFFUL << SCB_CPUID_IMPLEMENTER_Pos) /*!< SCB CPUID: IMPLEMENTER Mask */
  327. #define SCB_CPUID_VARIANT_Pos 20U /*!< SCB CPUID: VARIANT Position */
  328. #define SCB_CPUID_VARIANT_Msk (0xFUL << SCB_CPUID_VARIANT_Pos) /*!< SCB CPUID: VARIANT Mask */
  329. #define SCB_CPUID_ARCHITECTURE_Pos 16U /*!< SCB CPUID: ARCHITECTURE Position */
  330. #define SCB_CPUID_ARCHITECTURE_Msk (0xFUL << SCB_CPUID_ARCHITECTURE_Pos) /*!< SCB CPUID: ARCHITECTURE Mask */
  331. #define SCB_CPUID_PARTNO_Pos 4U /*!< SCB CPUID: PARTNO Position */
  332. #define SCB_CPUID_PARTNO_Msk (0xFFFUL << SCB_CPUID_PARTNO_Pos) /*!< SCB CPUID: PARTNO Mask */
  333. #define SCB_CPUID_REVISION_Pos 0U /*!< SCB CPUID: REVISION Position */
  334. #define SCB_CPUID_REVISION_Msk (0xFUL /*<< SCB_CPUID_REVISION_Pos*/) /*!< SCB CPUID: REVISION Mask */
  335. /* SCB Interrupt Control State Register Definitions */
  336. #define SCB_ICSR_PENDNMISET_Pos 31U /*!< SCB ICSR: PENDNMISET Position */
  337. #define SCB_ICSR_PENDNMISET_Msk (1UL << SCB_ICSR_PENDNMISET_Pos) /*!< SCB ICSR: PENDNMISET Mask */
  338. #define SCB_ICSR_NMIPENDSET_Pos SCB_ICSR_PENDNMISET_Pos /*!< SCB ICSR: NMIPENDSET Position, backward compatibility */
  339. #define SCB_ICSR_NMIPENDSET_Msk SCB_ICSR_PENDNMISET_Msk /*!< SCB ICSR: NMIPENDSET Mask, backward compatibility */
  340. #define SCB_ICSR_PENDNMICLR_Pos 30U /*!< SCB ICSR: PENDNMICLR Position */
  341. #define SCB_ICSR_PENDNMICLR_Msk (1UL << SCB_ICSR_PENDNMICLR_Pos) /*!< SCB ICSR: PENDNMICLR Mask */
  342. #define SCB_ICSR_PENDSVSET_Pos 28U /*!< SCB ICSR: PENDSVSET Position */
  343. #define SCB_ICSR_PENDSVSET_Msk (1UL << SCB_ICSR_PENDSVSET_Pos) /*!< SCB ICSR: PENDSVSET Mask */
  344. #define SCB_ICSR_PENDSVCLR_Pos 27U /*!< SCB ICSR: PENDSVCLR Position */
  345. #define SCB_ICSR_PENDSVCLR_Msk (1UL << SCB_ICSR_PENDSVCLR_Pos) /*!< SCB ICSR: PENDSVCLR Mask */
  346. #define SCB_ICSR_PENDSTSET_Pos 26U /*!< SCB ICSR: PENDSTSET Position */
  347. #define SCB_ICSR_PENDSTSET_Msk (1UL << SCB_ICSR_PENDSTSET_Pos) /*!< SCB ICSR: PENDSTSET Mask */
  348. #define SCB_ICSR_PENDSTCLR_Pos 25U /*!< SCB ICSR: PENDSTCLR Position */
  349. #define SCB_ICSR_PENDSTCLR_Msk (1UL << SCB_ICSR_PENDSTCLR_Pos) /*!< SCB ICSR: PENDSTCLR Mask */
  350. #define SCB_ICSR_STTNS_Pos 24U /*!< SCB ICSR: STTNS Position (Security Extension) */
  351. #define SCB_ICSR_STTNS_Msk (1UL << SCB_ICSR_STTNS_Pos) /*!< SCB ICSR: STTNS Mask (Security Extension) */
  352. #define SCB_ICSR_ISRPREEMPT_Pos 23U /*!< SCB ICSR: ISRPREEMPT Position */
  353. #define SCB_ICSR_ISRPREEMPT_Msk (1UL << SCB_ICSR_ISRPREEMPT_Pos) /*!< SCB ICSR: ISRPREEMPT Mask */
  354. #define SCB_ICSR_ISRPENDING_Pos 22U /*!< SCB ICSR: ISRPENDING Position */
  355. #define SCB_ICSR_ISRPENDING_Msk (1UL << SCB_ICSR_ISRPENDING_Pos) /*!< SCB ICSR: ISRPENDING Mask */
  356. #define SCB_ICSR_VECTPENDING_Pos 12U /*!< SCB ICSR: VECTPENDING Position */
  357. #define SCB_ICSR_VECTPENDING_Msk (0x1FFUL << SCB_ICSR_VECTPENDING_Pos) /*!< SCB ICSR: VECTPENDING Mask */
  358. #define SCB_ICSR_RETTOBASE_Pos 11U /*!< SCB ICSR: RETTOBASE Position */
  359. #define SCB_ICSR_RETTOBASE_Msk (1UL << SCB_ICSR_RETTOBASE_Pos) /*!< SCB ICSR: RETTOBASE Mask */
  360. #define SCB_ICSR_VECTACTIVE_Pos 0U /*!< SCB ICSR: VECTACTIVE Position */
  361. #define SCB_ICSR_VECTACTIVE_Msk (0x1FFUL /*<< SCB_ICSR_VECTACTIVE_Pos*/) /*!< SCB ICSR: VECTACTIVE Mask */
  362. #if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U)
  363. /* SCB Vector Table Offset Register Definitions */
  364. #define SCB_VTOR_TBLOFF_Pos 7U /*!< SCB VTOR: TBLOFF Position */
  365. #define SCB_VTOR_TBLOFF_Msk (0x1FFFFFFUL << SCB_VTOR_TBLOFF_Pos) /*!< SCB VTOR: TBLOFF Mask */
  366. #endif
  367. /* SCB Application Interrupt and Reset Control Register Definitions */
  368. #define SCB_AIRCR_VECTKEY_Pos 16U /*!< SCB AIRCR: VECTKEY Position */
  369. #define SCB_AIRCR_VECTKEY_Msk (0xFFFFUL << SCB_AIRCR_VECTKEY_Pos) /*!< SCB AIRCR: VECTKEY Mask */
  370. #define SCB_AIRCR_VECTKEYSTAT_Pos 16U /*!< SCB AIRCR: VECTKEYSTAT Position */
  371. #define SCB_AIRCR_VECTKEYSTAT_Msk (0xFFFFUL << SCB_AIRCR_VECTKEYSTAT_Pos) /*!< SCB AIRCR: VECTKEYSTAT Mask */
  372. #define SCB_AIRCR_ENDIANESS_Pos 15U /*!< SCB AIRCR: ENDIANESS Position */
  373. #define SCB_AIRCR_ENDIANESS_Msk (1UL << SCB_AIRCR_ENDIANESS_Pos) /*!< SCB AIRCR: ENDIANESS Mask */
  374. #define SCB_AIRCR_PRIS_Pos 14U /*!< SCB AIRCR: PRIS Position */
  375. #define SCB_AIRCR_PRIS_Msk (1UL << SCB_AIRCR_PRIS_Pos) /*!< SCB AIRCR: PRIS Mask */
  376. #define SCB_AIRCR_BFHFNMINS_Pos 13U /*!< SCB AIRCR: BFHFNMINS Position */
  377. #define SCB_AIRCR_BFHFNMINS_Msk (1UL << SCB_AIRCR_BFHFNMINS_Pos) /*!< SCB AIRCR: BFHFNMINS Mask */
  378. #define SCB_AIRCR_SYSRESETREQS_Pos 3U /*!< SCB AIRCR: SYSRESETREQS Position */
  379. #define SCB_AIRCR_SYSRESETREQS_Msk (1UL << SCB_AIRCR_SYSRESETREQS_Pos) /*!< SCB AIRCR: SYSRESETREQS Mask */
  380. #define SCB_AIRCR_SYSRESETREQ_Pos 2U /*!< SCB AIRCR: SYSRESETREQ Position */
  381. #define SCB_AIRCR_SYSRESETREQ_Msk (1UL << SCB_AIRCR_SYSRESETREQ_Pos) /*!< SCB AIRCR: SYSRESETREQ Mask */
  382. #define SCB_AIRCR_VECTCLRACTIVE_Pos 1U /*!< SCB AIRCR: VECTCLRACTIVE Position */
  383. #define SCB_AIRCR_VECTCLRACTIVE_Msk (1UL << SCB_AIRCR_VECTCLRACTIVE_Pos) /*!< SCB AIRCR: VECTCLRACTIVE Mask */
  384. /* SCB System Control Register Definitions */
  385. #define SCB_SCR_SEVONPEND_Pos 4U /*!< SCB SCR: SEVONPEND Position */
  386. #define SCB_SCR_SEVONPEND_Msk (1UL << SCB_SCR_SEVONPEND_Pos) /*!< SCB SCR: SEVONPEND Mask */
  387. #define SCB_SCR_SLEEPDEEPS_Pos 3U /*!< SCB SCR: SLEEPDEEPS Position */
  388. #define SCB_SCR_SLEEPDEEPS_Msk (1UL << SCB_SCR_SLEEPDEEPS_Pos) /*!< SCB SCR: SLEEPDEEPS Mask */
  389. #define SCB_SCR_SLEEPDEEP_Pos 2U /*!< SCB SCR: SLEEPDEEP Position */
  390. #define SCB_SCR_SLEEPDEEP_Msk (1UL << SCB_SCR_SLEEPDEEP_Pos) /*!< SCB SCR: SLEEPDEEP Mask */
  391. #define SCB_SCR_SLEEPONEXIT_Pos 1U /*!< SCB SCR: SLEEPONEXIT Position */
  392. #define SCB_SCR_SLEEPONEXIT_Msk (1UL << SCB_SCR_SLEEPONEXIT_Pos) /*!< SCB SCR: SLEEPONEXIT Mask */
  393. /* SCB Configuration Control Register Definitions */
  394. #define SCB_CCR_BP_Pos 18U /*!< SCB CCR: BP Position */
  395. #define SCB_CCR_BP_Msk (1UL << SCB_CCR_BP_Pos) /*!< SCB CCR: BP Mask */
  396. #define SCB_CCR_IC_Pos 17U /*!< SCB CCR: IC Position */
  397. #define SCB_CCR_IC_Msk (1UL << SCB_CCR_IC_Pos) /*!< SCB CCR: IC Mask */
  398. #define SCB_CCR_DC_Pos 16U /*!< SCB CCR: DC Position */
  399. #define SCB_CCR_DC_Msk (1UL << SCB_CCR_DC_Pos) /*!< SCB CCR: DC Mask */
  400. #define SCB_CCR_STKOFHFNMIGN_Pos 10U /*!< SCB CCR: STKOFHFNMIGN Position */
  401. #define SCB_CCR_STKOFHFNMIGN_Msk (1UL << SCB_CCR_STKOFHFNMIGN_Pos) /*!< SCB CCR: STKOFHFNMIGN Mask */
  402. #define SCB_CCR_BFHFNMIGN_Pos 8U /*!< SCB CCR: BFHFNMIGN Position */
  403. #define SCB_CCR_BFHFNMIGN_Msk (1UL << SCB_CCR_BFHFNMIGN_Pos) /*!< SCB CCR: BFHFNMIGN Mask */
  404. #define SCB_CCR_DIV_0_TRP_Pos 4U /*!< SCB CCR: DIV_0_TRP Position */
  405. #define SCB_CCR_DIV_0_TRP_Msk (1UL << SCB_CCR_DIV_0_TRP_Pos) /*!< SCB CCR: DIV_0_TRP Mask */
  406. #define SCB_CCR_UNALIGN_TRP_Pos 3U /*!< SCB CCR: UNALIGN_TRP Position */
  407. #define SCB_CCR_UNALIGN_TRP_Msk (1UL << SCB_CCR_UNALIGN_TRP_Pos) /*!< SCB CCR: UNALIGN_TRP Mask */
  408. #define SCB_CCR_USERSETMPEND_Pos 1U /*!< SCB CCR: USERSETMPEND Position */
  409. #define SCB_CCR_USERSETMPEND_Msk (1UL << SCB_CCR_USERSETMPEND_Pos) /*!< SCB CCR: USERSETMPEND Mask */
  410. /* SCB System Handler Control and State Register Definitions */
  411. #define SCB_SHCSR_HARDFAULTPENDED_Pos 21U /*!< SCB SHCSR: HARDFAULTPENDED Position */
  412. #define SCB_SHCSR_HARDFAULTPENDED_Msk (1UL << SCB_SHCSR_HARDFAULTPENDED_Pos) /*!< SCB SHCSR: HARDFAULTPENDED Mask */
  413. #define SCB_SHCSR_SVCALLPENDED_Pos 15U /*!< SCB SHCSR: SVCALLPENDED Position */
  414. #define SCB_SHCSR_SVCALLPENDED_Msk (1UL << SCB_SHCSR_SVCALLPENDED_Pos) /*!< SCB SHCSR: SVCALLPENDED Mask */
  415. #define SCB_SHCSR_SYSTICKACT_Pos 11U /*!< SCB SHCSR: SYSTICKACT Position */
  416. #define SCB_SHCSR_SYSTICKACT_Msk (1UL << SCB_SHCSR_SYSTICKACT_Pos) /*!< SCB SHCSR: SYSTICKACT Mask */
  417. #define SCB_SHCSR_PENDSVACT_Pos 10U /*!< SCB SHCSR: PENDSVACT Position */
  418. #define SCB_SHCSR_PENDSVACT_Msk (1UL << SCB_SHCSR_PENDSVACT_Pos) /*!< SCB SHCSR: PENDSVACT Mask */
  419. #define SCB_SHCSR_SVCALLACT_Pos 7U /*!< SCB SHCSR: SVCALLACT Position */
  420. #define SCB_SHCSR_SVCALLACT_Msk (1UL << SCB_SHCSR_SVCALLACT_Pos) /*!< SCB SHCSR: SVCALLACT Mask */
  421. #define SCB_SHCSR_NMIACT_Pos 5U /*!< SCB SHCSR: NMIACT Position */
  422. #define SCB_SHCSR_NMIACT_Msk (1UL << SCB_SHCSR_NMIACT_Pos) /*!< SCB SHCSR: NMIACT Mask */
  423. #define SCB_SHCSR_HARDFAULTACT_Pos 2U /*!< SCB SHCSR: HARDFAULTACT Position */
  424. #define SCB_SHCSR_HARDFAULTACT_Msk (1UL << SCB_SHCSR_HARDFAULTACT_Pos) /*!< SCB SHCSR: HARDFAULTACT Mask */
  425. /*@} end of group CMSIS_SCB */
  426. /**
  427. \ingroup CMSIS_core_register
  428. \defgroup CMSIS_SysTick System Tick Timer (SysTick)
  429. \brief Type definitions for the System Timer Registers.
  430. @{
  431. */
  432. /**
  433. \brief Structure type to access the System Timer (SysTick).
  434. */
  435. typedef struct
  436. {
  437. __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) SysTick Control and Status Register */
  438. __IOM uint32_t LOAD; /*!< Offset: 0x004 (R/W) SysTick Reload Value Register */
  439. __IOM uint32_t VAL; /*!< Offset: 0x008 (R/W) SysTick Current Value Register */
  440. __IM uint32_t CALIB; /*!< Offset: 0x00C (R/ ) SysTick Calibration Register */
  441. } SysTick_Type;
  442. /* SysTick Control / Status Register Definitions */
  443. #define SysTick_CTRL_COUNTFLAG_Pos 16U /*!< SysTick CTRL: COUNTFLAG Position */
  444. #define SysTick_CTRL_COUNTFLAG_Msk (1UL << SysTick_CTRL_COUNTFLAG_Pos) /*!< SysTick CTRL: COUNTFLAG Mask */
  445. #define SysTick_CTRL_CLKSOURCE_Pos 2U /*!< SysTick CTRL: CLKSOURCE Position */
  446. #define SysTick_CTRL_CLKSOURCE_Msk (1UL << SysTick_CTRL_CLKSOURCE_Pos) /*!< SysTick CTRL: CLKSOURCE Mask */
  447. #define SysTick_CTRL_TICKINT_Pos 1U /*!< SysTick CTRL: TICKINT Position */
  448. #define SysTick_CTRL_TICKINT_Msk (1UL << SysTick_CTRL_TICKINT_Pos) /*!< SysTick CTRL: TICKINT Mask */
  449. #define SysTick_CTRL_ENABLE_Pos 0U /*!< SysTick CTRL: ENABLE Position */
  450. #define SysTick_CTRL_ENABLE_Msk (1UL /*<< SysTick_CTRL_ENABLE_Pos*/) /*!< SysTick CTRL: ENABLE Mask */
  451. /* SysTick Reload Register Definitions */
  452. #define SysTick_LOAD_RELOAD_Pos 0U /*!< SysTick LOAD: RELOAD Position */
  453. #define SysTick_LOAD_RELOAD_Msk (0xFFFFFFUL /*<< SysTick_LOAD_RELOAD_Pos*/) /*!< SysTick LOAD: RELOAD Mask */
  454. /* SysTick Current Register Definitions */
  455. #define SysTick_VAL_CURRENT_Pos 0U /*!< SysTick VAL: CURRENT Position */
  456. #define SysTick_VAL_CURRENT_Msk (0xFFFFFFUL /*<< SysTick_VAL_CURRENT_Pos*/) /*!< SysTick VAL: CURRENT Mask */
  457. /* SysTick Calibration Register Definitions */
  458. #define SysTick_CALIB_NOREF_Pos 31U /*!< SysTick CALIB: NOREF Position */
  459. #define SysTick_CALIB_NOREF_Msk (1UL << SysTick_CALIB_NOREF_Pos) /*!< SysTick CALIB: NOREF Mask */
  460. #define SysTick_CALIB_SKEW_Pos 30U /*!< SysTick CALIB: SKEW Position */
  461. #define SysTick_CALIB_SKEW_Msk (1UL << SysTick_CALIB_SKEW_Pos) /*!< SysTick CALIB: SKEW Mask */
  462. #define SysTick_CALIB_TENMS_Pos 0U /*!< SysTick CALIB: TENMS Position */
  463. #define SysTick_CALIB_TENMS_Msk (0xFFFFFFUL /*<< SysTick_CALIB_TENMS_Pos*/) /*!< SysTick CALIB: TENMS Mask */
  464. /*@} end of group CMSIS_SysTick */
  465. /**
  466. \ingroup CMSIS_core_register
  467. \defgroup CMSIS_DWT Data Watchpoint and Trace (DWT)
  468. \brief Type definitions for the Data Watchpoint and Trace (DWT)
  469. @{
  470. */
  471. /**
  472. \brief Structure type to access the Data Watchpoint and Trace Register (DWT).
  473. */
  474. typedef struct
  475. {
  476. __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) Control Register */
  477. uint32_t RESERVED0[6U];
  478. __IM uint32_t PCSR; /*!< Offset: 0x01C (R/ ) Program Counter Sample Register */
  479. __IOM uint32_t COMP0; /*!< Offset: 0x020 (R/W) Comparator Register 0 */
  480. uint32_t RESERVED1[1U];
  481. __IOM uint32_t FUNCTION0; /*!< Offset: 0x028 (R/W) Function Register 0 */
  482. uint32_t RESERVED2[1U];
  483. __IOM uint32_t COMP1; /*!< Offset: 0x030 (R/W) Comparator Register 1 */
  484. uint32_t RESERVED3[1U];
  485. __IOM uint32_t FUNCTION1; /*!< Offset: 0x038 (R/W) Function Register 1 */
  486. uint32_t RESERVED4[1U];
  487. __IOM uint32_t COMP2; /*!< Offset: 0x040 (R/W) Comparator Register 2 */
  488. uint32_t RESERVED5[1U];
  489. __IOM uint32_t FUNCTION2; /*!< Offset: 0x048 (R/W) Function Register 2 */
  490. uint32_t RESERVED6[1U];
  491. __IOM uint32_t COMP3; /*!< Offset: 0x050 (R/W) Comparator Register 3 */
  492. uint32_t RESERVED7[1U];
  493. __IOM uint32_t FUNCTION3; /*!< Offset: 0x058 (R/W) Function Register 3 */
  494. uint32_t RESERVED8[1U];
  495. __IOM uint32_t COMP4; /*!< Offset: 0x060 (R/W) Comparator Register 4 */
  496. uint32_t RESERVED9[1U];
  497. __IOM uint32_t FUNCTION4; /*!< Offset: 0x068 (R/W) Function Register 4 */
  498. uint32_t RESERVED10[1U];
  499. __IOM uint32_t COMP5; /*!< Offset: 0x070 (R/W) Comparator Register 5 */
  500. uint32_t RESERVED11[1U];
  501. __IOM uint32_t FUNCTION5; /*!< Offset: 0x078 (R/W) Function Register 5 */
  502. uint32_t RESERVED12[1U];
  503. __IOM uint32_t COMP6; /*!< Offset: 0x080 (R/W) Comparator Register 6 */
  504. uint32_t RESERVED13[1U];
  505. __IOM uint32_t FUNCTION6; /*!< Offset: 0x088 (R/W) Function Register 6 */
  506. uint32_t RESERVED14[1U];
  507. __IOM uint32_t COMP7; /*!< Offset: 0x090 (R/W) Comparator Register 7 */
  508. uint32_t RESERVED15[1U];
  509. __IOM uint32_t FUNCTION7; /*!< Offset: 0x098 (R/W) Function Register 7 */
  510. uint32_t RESERVED16[1U];
  511. __IOM uint32_t COMP8; /*!< Offset: 0x0A0 (R/W) Comparator Register 8 */
  512. uint32_t RESERVED17[1U];
  513. __IOM uint32_t FUNCTION8; /*!< Offset: 0x0A8 (R/W) Function Register 8 */
  514. uint32_t RESERVED18[1U];
  515. __IOM uint32_t COMP9; /*!< Offset: 0x0B0 (R/W) Comparator Register 9 */
  516. uint32_t RESERVED19[1U];
  517. __IOM uint32_t FUNCTION9; /*!< Offset: 0x0B8 (R/W) Function Register 9 */
  518. uint32_t RESERVED20[1U];
  519. __IOM uint32_t COMP10; /*!< Offset: 0x0C0 (R/W) Comparator Register 10 */
  520. uint32_t RESERVED21[1U];
  521. __IOM uint32_t FUNCTION10; /*!< Offset: 0x0C8 (R/W) Function Register 10 */
  522. uint32_t RESERVED22[1U];
  523. __IOM uint32_t COMP11; /*!< Offset: 0x0D0 (R/W) Comparator Register 11 */
  524. uint32_t RESERVED23[1U];
  525. __IOM uint32_t FUNCTION11; /*!< Offset: 0x0D8 (R/W) Function Register 11 */
  526. uint32_t RESERVED24[1U];
  527. __IOM uint32_t COMP12; /*!< Offset: 0x0E0 (R/W) Comparator Register 12 */
  528. uint32_t RESERVED25[1U];
  529. __IOM uint32_t FUNCTION12; /*!< Offset: 0x0E8 (R/W) Function Register 12 */
  530. uint32_t RESERVED26[1U];
  531. __IOM uint32_t COMP13; /*!< Offset: 0x0F0 (R/W) Comparator Register 13 */
  532. uint32_t RESERVED27[1U];
  533. __IOM uint32_t FUNCTION13; /*!< Offset: 0x0F8 (R/W) Function Register 13 */
  534. uint32_t RESERVED28[1U];
  535. __IOM uint32_t COMP14; /*!< Offset: 0x100 (R/W) Comparator Register 14 */
  536. uint32_t RESERVED29[1U];
  537. __IOM uint32_t FUNCTION14; /*!< Offset: 0x108 (R/W) Function Register 14 */
  538. uint32_t RESERVED30[1U];
  539. __IOM uint32_t COMP15; /*!< Offset: 0x110 (R/W) Comparator Register 15 */
  540. uint32_t RESERVED31[1U];
  541. __IOM uint32_t FUNCTION15; /*!< Offset: 0x118 (R/W) Function Register 15 */
  542. } DWT_Type;
  543. /* DWT Control Register Definitions */
  544. #define DWT_CTRL_NUMCOMP_Pos 28U /*!< DWT CTRL: NUMCOMP Position */
  545. #define DWT_CTRL_NUMCOMP_Msk (0xFUL << DWT_CTRL_NUMCOMP_Pos) /*!< DWT CTRL: NUMCOMP Mask */
  546. #define DWT_CTRL_NOTRCPKT_Pos 27U /*!< DWT CTRL: NOTRCPKT Position */
  547. #define DWT_CTRL_NOTRCPKT_Msk (0x1UL << DWT_CTRL_NOTRCPKT_Pos) /*!< DWT CTRL: NOTRCPKT Mask */
  548. #define DWT_CTRL_NOEXTTRIG_Pos 26U /*!< DWT CTRL: NOEXTTRIG Position */
  549. #define DWT_CTRL_NOEXTTRIG_Msk (0x1UL << DWT_CTRL_NOEXTTRIG_Pos) /*!< DWT CTRL: NOEXTTRIG Mask */
  550. #define DWT_CTRL_NOCYCCNT_Pos 25U /*!< DWT CTRL: NOCYCCNT Position */
  551. #define DWT_CTRL_NOCYCCNT_Msk (0x1UL << DWT_CTRL_NOCYCCNT_Pos) /*!< DWT CTRL: NOCYCCNT Mask */
  552. #define DWT_CTRL_NOPRFCNT_Pos 24U /*!< DWT CTRL: NOPRFCNT Position */
  553. #define DWT_CTRL_NOPRFCNT_Msk (0x1UL << DWT_CTRL_NOPRFCNT_Pos) /*!< DWT CTRL: NOPRFCNT Mask */
  554. /* DWT Comparator Function Register Definitions */
  555. #define DWT_FUNCTION_ID_Pos 27U /*!< DWT FUNCTION: ID Position */
  556. #define DWT_FUNCTION_ID_Msk (0x1FUL << DWT_FUNCTION_ID_Pos) /*!< DWT FUNCTION: ID Mask */
  557. #define DWT_FUNCTION_MATCHED_Pos 24U /*!< DWT FUNCTION: MATCHED Position */
  558. #define DWT_FUNCTION_MATCHED_Msk (0x1UL << DWT_FUNCTION_MATCHED_Pos) /*!< DWT FUNCTION: MATCHED Mask */
  559. #define DWT_FUNCTION_DATAVSIZE_Pos 10U /*!< DWT FUNCTION: DATAVSIZE Position */
  560. #define DWT_FUNCTION_DATAVSIZE_Msk (0x3UL << DWT_FUNCTION_DATAVSIZE_Pos) /*!< DWT FUNCTION: DATAVSIZE Mask */
  561. #define DWT_FUNCTION_ACTION_Pos 4U /*!< DWT FUNCTION: ACTION Position */
  562. #define DWT_FUNCTION_ACTION_Msk (0x3UL << DWT_FUNCTION_ACTION_Pos) /*!< DWT FUNCTION: ACTION Mask */
  563. #define DWT_FUNCTION_MATCH_Pos 0U /*!< DWT FUNCTION: MATCH Position */
  564. #define DWT_FUNCTION_MATCH_Msk (0xFUL /*<< DWT_FUNCTION_MATCH_Pos*/) /*!< DWT FUNCTION: MATCH Mask */
  565. /*@}*/ /* end of group CMSIS_DWT */
  566. /**
  567. \ingroup CMSIS_core_register
  568. \defgroup CMSIS_TPI Trace Port Interface (TPI)
  569. \brief Type definitions for the Trace Port Interface (TPI)
  570. @{
  571. */
  572. /**
  573. \brief Structure type to access the Trace Port Interface Register (TPI).
  574. */
  575. typedef struct
  576. {
  577. __IM uint32_t SSPSR; /*!< Offset: 0x000 (R/ ) Supported Parallel Port Sizes Register */
  578. __IOM uint32_t CSPSR; /*!< Offset: 0x004 (R/W) Current Parallel Port Sizes Register */
  579. uint32_t RESERVED0[2U];
  580. __IOM uint32_t ACPR; /*!< Offset: 0x010 (R/W) Asynchronous Clock Prescaler Register */
  581. uint32_t RESERVED1[55U];
  582. __IOM uint32_t SPPR; /*!< Offset: 0x0F0 (R/W) Selected Pin Protocol Register */
  583. uint32_t RESERVED2[131U];
  584. __IM uint32_t FFSR; /*!< Offset: 0x300 (R/ ) Formatter and Flush Status Register */
  585. __IOM uint32_t FFCR; /*!< Offset: 0x304 (R/W) Formatter and Flush Control Register */
  586. __IOM uint32_t PSCR; /*!< Offset: 0x308 (R/W) Periodic Synchronization Control Register */
  587. uint32_t RESERVED3[809U];
  588. __OM uint32_t LAR; /*!< Offset: 0xFB0 ( /W) Software Lock Access Register */
  589. __IM uint32_t LSR; /*!< Offset: 0xFB4 (R/ ) Software Lock Status Register */
  590. uint32_t RESERVED4[4U];
  591. __IM uint32_t TYPE; /*!< Offset: 0xFC8 (R/ ) Device Identifier Register */
  592. __IM uint32_t DEVTYPE; /*!< Offset: 0xFCC (R/ ) Device Type Register */
  593. } TPI_Type;
  594. /* TPI Asynchronous Clock Prescaler Register Definitions */
  595. #define TPI_ACPR_SWOSCALER_Pos 0U /*!< TPI ACPR: SWOSCALER Position */
  596. #define TPI_ACPR_SWOSCALER_Msk (0xFFFFUL /*<< TPI_ACPR_SWOSCALER_Pos*/) /*!< TPI ACPR: SWOSCALER Mask */
  597. /* TPI Selected Pin Protocol Register Definitions */
  598. #define TPI_SPPR_TXMODE_Pos 0U /*!< TPI SPPR: TXMODE Position */
  599. #define TPI_SPPR_TXMODE_Msk (0x3UL /*<< TPI_SPPR_TXMODE_Pos*/) /*!< TPI SPPR: TXMODE Mask */
  600. /* TPI Formatter and Flush Status Register Definitions */
  601. #define TPI_FFSR_FtNonStop_Pos 3U /*!< TPI FFSR: FtNonStop Position */
  602. #define TPI_FFSR_FtNonStop_Msk (0x1UL << TPI_FFSR_FtNonStop_Pos) /*!< TPI FFSR: FtNonStop Mask */
  603. #define TPI_FFSR_TCPresent_Pos 2U /*!< TPI FFSR: TCPresent Position */
  604. #define TPI_FFSR_TCPresent_Msk (0x1UL << TPI_FFSR_TCPresent_Pos) /*!< TPI FFSR: TCPresent Mask */
  605. #define TPI_FFSR_FtStopped_Pos 1U /*!< TPI FFSR: FtStopped Position */
  606. #define TPI_FFSR_FtStopped_Msk (0x1UL << TPI_FFSR_FtStopped_Pos) /*!< TPI FFSR: FtStopped Mask */
  607. #define TPI_FFSR_FlInProg_Pos 0U /*!< TPI FFSR: FlInProg Position */
  608. #define TPI_FFSR_FlInProg_Msk (0x1UL /*<< TPI_FFSR_FlInProg_Pos*/) /*!< TPI FFSR: FlInProg Mask */
  609. /* TPI Formatter and Flush Control Register Definitions */
  610. #define TPI_FFCR_TrigIn_Pos 8U /*!< TPI FFCR: TrigIn Position */
  611. #define TPI_FFCR_TrigIn_Msk (0x1UL << TPI_FFCR_TrigIn_Pos) /*!< TPI FFCR: TrigIn Mask */
  612. #define TPI_FFCR_FOnMan_Pos 6U /*!< TPI FFCR: FOnMan Position */
  613. #define TPI_FFCR_FOnMan_Msk (0x1UL << TPI_FFCR_FOnMan_Pos) /*!< TPI FFCR: FOnMan Mask */
  614. #define TPI_FFCR_EnFCont_Pos 1U /*!< TPI FFCR: EnFCont Position */
  615. #define TPI_FFCR_EnFCont_Msk (0x1UL << TPI_FFCR_EnFCont_Pos) /*!< TPI FFCR: EnFCont Mask */
  616. /* TPI Periodic Synchronization Control Register Definitions */
  617. #define TPI_PSCR_PSCount_Pos 0U /*!< TPI PSCR: PSCount Position */
  618. #define TPI_PSCR_PSCount_Msk (0x1FUL /*<< TPI_PSCR_PSCount_Pos*/) /*!< TPI PSCR: TPSCount Mask */
  619. /* TPI Software Lock Status Register Definitions */
  620. #define TPI_LSR_nTT_Pos 1U /*!< TPI LSR: Not thirty-two bit. Position */
  621. #define TPI_LSR_nTT_Msk (0x1UL << TPI_LSR_nTT_Pos) /*!< TPI LSR: Not thirty-two bit. Mask */
  622. #define TPI_LSR_SLK_Pos 1U /*!< TPI LSR: Software Lock status Position */
  623. #define TPI_LSR_SLK_Msk (0x1UL << TPI_LSR_SLK_Pos) /*!< TPI LSR: Software Lock status Mask */
  624. #define TPI_LSR_SLI_Pos 0U /*!< TPI LSR: Software Lock implemented Position */
  625. #define TPI_LSR_SLI_Msk (0x1UL /*<< TPI_LSR_SLI_Pos*/) /*!< TPI LSR: Software Lock implemented Mask */
  626. /* TPI DEVID Register Definitions */
  627. #define TPI_DEVID_NRZVALID_Pos 11U /*!< TPI DEVID: NRZVALID Position */
  628. #define TPI_DEVID_NRZVALID_Msk (0x1UL << TPI_DEVID_NRZVALID_Pos) /*!< TPI DEVID: NRZVALID Mask */
  629. #define TPI_DEVID_MANCVALID_Pos 10U /*!< TPI DEVID: MANCVALID Position */
  630. #define TPI_DEVID_MANCVALID_Msk (0x1UL << TPI_DEVID_MANCVALID_Pos) /*!< TPI DEVID: MANCVALID Mask */
  631. #define TPI_DEVID_PTINVALID_Pos 9U /*!< TPI DEVID: PTINVALID Position */
  632. #define TPI_DEVID_PTINVALID_Msk (0x1UL << TPI_DEVID_PTINVALID_Pos) /*!< TPI DEVID: PTINVALID Mask */
  633. #define TPI_DEVID_FIFOSZ_Pos 6U /*!< TPI DEVID: FIFO depth Position */
  634. #define TPI_DEVID_FIFOSZ_Msk (0x7UL << TPI_DEVID_FIFOSZ_Pos) /*!< TPI DEVID: FIFO depth Mask */
  635. /* TPI DEVTYPE Register Definitions */
  636. #define TPI_DEVTYPE_SubType_Pos 4U /*!< TPI DEVTYPE: SubType Position */
  637. #define TPI_DEVTYPE_SubType_Msk (0xFUL /*<< TPI_DEVTYPE_SubType_Pos*/) /*!< TPI DEVTYPE: SubType Mask */
  638. #define TPI_DEVTYPE_MajorType_Pos 0U /*!< TPI DEVTYPE: MajorType Position */
  639. #define TPI_DEVTYPE_MajorType_Msk (0xFUL << TPI_DEVTYPE_MajorType_Pos) /*!< TPI DEVTYPE: MajorType Mask */
  640. /*@}*/ /* end of group CMSIS_TPI */
  641. #if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U)
  642. /**
  643. \ingroup CMSIS_core_register
  644. \defgroup CMSIS_MPU Memory Protection Unit (MPU)
  645. \brief Type definitions for the Memory Protection Unit (MPU)
  646. @{
  647. */
  648. /**
  649. \brief Structure type to access the Memory Protection Unit (MPU).
  650. */
  651. typedef struct
  652. {
  653. __IM uint32_t TYPE; /*!< Offset: 0x000 (R/ ) MPU Type Register */
  654. __IOM uint32_t CTRL; /*!< Offset: 0x004 (R/W) MPU Control Register */
  655. __IOM uint32_t RNR; /*!< Offset: 0x008 (R/W) MPU Region Number Register */
  656. __IOM uint32_t RBAR; /*!< Offset: 0x00C (R/W) MPU Region Base Address Register */
  657. __IOM uint32_t RLAR; /*!< Offset: 0x010 (R/W) MPU Region Limit Address Register */
  658. uint32_t RESERVED0[7U];
  659. union {
  660. __IOM uint32_t MAIR[2];
  661. struct {
  662. __IOM uint32_t MAIR0; /*!< Offset: 0x030 (R/W) MPU Memory Attribute Indirection Register 0 */
  663. __IOM uint32_t MAIR1; /*!< Offset: 0x034 (R/W) MPU Memory Attribute Indirection Register 1 */
  664. };
  665. };
  666. } MPU_Type;
  667. #define MPU_TYPE_RALIASES 1U
  668. /* MPU Type Register Definitions */
  669. #define MPU_TYPE_IREGION_Pos 16U /*!< MPU TYPE: IREGION Position */
  670. #define MPU_TYPE_IREGION_Msk (0xFFUL << MPU_TYPE_IREGION_Pos) /*!< MPU TYPE: IREGION Mask */
  671. #define MPU_TYPE_DREGION_Pos 8U /*!< MPU TYPE: DREGION Position */
  672. #define MPU_TYPE_DREGION_Msk (0xFFUL << MPU_TYPE_DREGION_Pos) /*!< MPU TYPE: DREGION Mask */
  673. #define MPU_TYPE_SEPARATE_Pos 0U /*!< MPU TYPE: SEPARATE Position */
  674. #define MPU_TYPE_SEPARATE_Msk (1UL /*<< MPU_TYPE_SEPARATE_Pos*/) /*!< MPU TYPE: SEPARATE Mask */
  675. /* MPU Control Register Definitions */
  676. #define MPU_CTRL_PRIVDEFENA_Pos 2U /*!< MPU CTRL: PRIVDEFENA Position */
  677. #define MPU_CTRL_PRIVDEFENA_Msk (1UL << MPU_CTRL_PRIVDEFENA_Pos) /*!< MPU CTRL: PRIVDEFENA Mask */
  678. #define MPU_CTRL_HFNMIENA_Pos 1U /*!< MPU CTRL: HFNMIENA Position */
  679. #define MPU_CTRL_HFNMIENA_Msk (1UL << MPU_CTRL_HFNMIENA_Pos) /*!< MPU CTRL: HFNMIENA Mask */
  680. #define MPU_CTRL_ENABLE_Pos 0U /*!< MPU CTRL: ENABLE Position */
  681. #define MPU_CTRL_ENABLE_Msk (1UL /*<< MPU_CTRL_ENABLE_Pos*/) /*!< MPU CTRL: ENABLE Mask */
  682. /* MPU Region Number Register Definitions */
  683. #define MPU_RNR_REGION_Pos 0U /*!< MPU RNR: REGION Position */
  684. #define MPU_RNR_REGION_Msk (0xFFUL /*<< MPU_RNR_REGION_Pos*/) /*!< MPU RNR: REGION Mask */
  685. /* MPU Region Base Address Register Definitions */
  686. #define MPU_RBAR_BASE_Pos 5U /*!< MPU RBAR: BASE Position */
  687. #define MPU_RBAR_BASE_Msk (0x7FFFFFFUL << MPU_RBAR_BASE_Pos) /*!< MPU RBAR: BASE Mask */
  688. #define MPU_RBAR_SH_Pos 3U /*!< MPU RBAR: SH Position */
  689. #define MPU_RBAR_SH_Msk (0x3UL << MPU_RBAR_SH_Pos) /*!< MPU RBAR: SH Mask */
  690. #define MPU_RBAR_AP_Pos 1U /*!< MPU RBAR: AP Position */
  691. #define MPU_RBAR_AP_Msk (0x3UL << MPU_RBAR_AP_Pos) /*!< MPU RBAR: AP Mask */
  692. #define MPU_RBAR_XN_Pos 0U /*!< MPU RBAR: XN Position */
  693. #define MPU_RBAR_XN_Msk (01UL /*<< MPU_RBAR_XN_Pos*/) /*!< MPU RBAR: XN Mask */
  694. /* MPU Region Limit Address Register Definitions */
  695. #define MPU_RLAR_LIMIT_Pos 5U /*!< MPU RLAR: LIMIT Position */
  696. #define MPU_RLAR_LIMIT_Msk (0x7FFFFFFUL << MPU_RLAR_LIMIT_Pos) /*!< MPU RLAR: LIMIT Mask */
  697. #define MPU_RLAR_AttrIndx_Pos 1U /*!< MPU RLAR: AttrIndx Position */
  698. #define MPU_RLAR_AttrIndx_Msk (0x7UL << MPU_RLAR_AttrIndx_Pos) /*!< MPU RLAR: AttrIndx Mask */
  699. #define MPU_RLAR_EN_Pos 0U /*!< MPU RLAR: EN Position */
  700. #define MPU_RLAR_EN_Msk (1UL /*<< MPU_RLAR_EN_Pos*/) /*!< MPU RLAR: EN Mask */
  701. /* MPU Memory Attribute Indirection Register 0 Definitions */
  702. #define MPU_MAIR0_Attr3_Pos 24U /*!< MPU MAIR0: Attr3 Position */
  703. #define MPU_MAIR0_Attr3_Msk (0xFFUL << MPU_MAIR0_Attr3_Pos) /*!< MPU MAIR0: Attr3 Mask */
  704. #define MPU_MAIR0_Attr2_Pos 16U /*!< MPU MAIR0: Attr2 Position */
  705. #define MPU_MAIR0_Attr2_Msk (0xFFUL << MPU_MAIR0_Attr2_Pos) /*!< MPU MAIR0: Attr2 Mask */
  706. #define MPU_MAIR0_Attr1_Pos 8U /*!< MPU MAIR0: Attr1 Position */
  707. #define MPU_MAIR0_Attr1_Msk (0xFFUL << MPU_MAIR0_Attr1_Pos) /*!< MPU MAIR0: Attr1 Mask */
  708. #define MPU_MAIR0_Attr0_Pos 0U /*!< MPU MAIR0: Attr0 Position */
  709. #define MPU_MAIR0_Attr0_Msk (0xFFUL /*<< MPU_MAIR0_Attr0_Pos*/) /*!< MPU MAIR0: Attr0 Mask */
  710. /* MPU Memory Attribute Indirection Register 1 Definitions */
  711. #define MPU_MAIR1_Attr7_Pos 24U /*!< MPU MAIR1: Attr7 Position */
  712. #define MPU_MAIR1_Attr7_Msk (0xFFUL << MPU_MAIR1_Attr7_Pos) /*!< MPU MAIR1: Attr7 Mask */
  713. #define MPU_MAIR1_Attr6_Pos 16U /*!< MPU MAIR1: Attr6 Position */
  714. #define MPU_MAIR1_Attr6_Msk (0xFFUL << MPU_MAIR1_Attr6_Pos) /*!< MPU MAIR1: Attr6 Mask */
  715. #define MPU_MAIR1_Attr5_Pos 8U /*!< MPU MAIR1: Attr5 Position */
  716. #define MPU_MAIR1_Attr5_Msk (0xFFUL << MPU_MAIR1_Attr5_Pos) /*!< MPU MAIR1: Attr5 Mask */
  717. #define MPU_MAIR1_Attr4_Pos 0U /*!< MPU MAIR1: Attr4 Position */
  718. #define MPU_MAIR1_Attr4_Msk (0xFFUL /*<< MPU_MAIR1_Attr4_Pos*/) /*!< MPU MAIR1: Attr4 Mask */
  719. /*@} end of group CMSIS_MPU */
  720. #endif
  721. #if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
  722. /**
  723. \ingroup CMSIS_core_register
  724. \defgroup CMSIS_SAU Security Attribution Unit (SAU)
  725. \brief Type definitions for the Security Attribution Unit (SAU)
  726. @{
  727. */
  728. /**
  729. \brief Structure type to access the Security Attribution Unit (SAU).
  730. */
  731. typedef struct
  732. {
  733. __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) SAU Control Register */
  734. __IM uint32_t TYPE; /*!< Offset: 0x004 (R/ ) SAU Type Register */
  735. #if defined (__SAUREGION_PRESENT) && (__SAUREGION_PRESENT == 1U)
  736. __IOM uint32_t RNR; /*!< Offset: 0x008 (R/W) SAU Region Number Register */
  737. __IOM uint32_t RBAR; /*!< Offset: 0x00C (R/W) SAU Region Base Address Register */
  738. __IOM uint32_t RLAR; /*!< Offset: 0x010 (R/W) SAU Region Limit Address Register */
  739. #endif
  740. } SAU_Type;
  741. /* SAU Control Register Definitions */
  742. #define SAU_CTRL_ALLNS_Pos 1U /*!< SAU CTRL: ALLNS Position */
  743. #define SAU_CTRL_ALLNS_Msk (1UL << SAU_CTRL_ALLNS_Pos) /*!< SAU CTRL: ALLNS Mask */
  744. #define SAU_CTRL_ENABLE_Pos 0U /*!< SAU CTRL: ENABLE Position */
  745. #define SAU_CTRL_ENABLE_Msk (1UL /*<< SAU_CTRL_ENABLE_Pos*/) /*!< SAU CTRL: ENABLE Mask */
  746. /* SAU Type Register Definitions */
  747. #define SAU_TYPE_SREGION_Pos 0U /*!< SAU TYPE: SREGION Position */
  748. #define SAU_TYPE_SREGION_Msk (0xFFUL /*<< SAU_TYPE_SREGION_Pos*/) /*!< SAU TYPE: SREGION Mask */
  749. #if defined (__SAUREGION_PRESENT) && (__SAUREGION_PRESENT == 1U)
  750. /* SAU Region Number Register Definitions */
  751. #define SAU_RNR_REGION_Pos 0U /*!< SAU RNR: REGION Position */
  752. #define SAU_RNR_REGION_Msk (0xFFUL /*<< SAU_RNR_REGION_Pos*/) /*!< SAU RNR: REGION Mask */
  753. /* SAU Region Base Address Register Definitions */
  754. #define SAU_RBAR_BADDR_Pos 5U /*!< SAU RBAR: BADDR Position */
  755. #define SAU_RBAR_BADDR_Msk (0x7FFFFFFUL << SAU_RBAR_BADDR_Pos) /*!< SAU RBAR: BADDR Mask */
  756. /* SAU Region Limit Address Register Definitions */
  757. #define SAU_RLAR_LADDR_Pos 5U /*!< SAU RLAR: LADDR Position */
  758. #define SAU_RLAR_LADDR_Msk (0x7FFFFFFUL << SAU_RLAR_LADDR_Pos) /*!< SAU RLAR: LADDR Mask */
  759. #define SAU_RLAR_NSC_Pos 1U /*!< SAU RLAR: NSC Position */
  760. #define SAU_RLAR_NSC_Msk (1UL << SAU_RLAR_NSC_Pos) /*!< SAU RLAR: NSC Mask */
  761. #define SAU_RLAR_ENABLE_Pos 0U /*!< SAU RLAR: ENABLE Position */
  762. #define SAU_RLAR_ENABLE_Msk (1UL /*<< SAU_RLAR_ENABLE_Pos*/) /*!< SAU RLAR: ENABLE Mask */
  763. #endif /* defined (__SAUREGION_PRESENT) && (__SAUREGION_PRESENT == 1U) */
  764. /*@} end of group CMSIS_SAU */
  765. #endif /* defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */
  766. /* CoreDebug is deprecated. replaced by DCB (Debug Control Block) */
  767. /**
  768. \ingroup CMSIS_core_register
  769. \defgroup CMSIS_CoreDebug Core Debug Registers (CoreDebug)
  770. \brief Type definitions for the Core Debug Registers
  771. @{
  772. */
  773. /**
  774. \brief \deprecated Structure type to access the Core Debug Register (CoreDebug).
  775. */
  776. typedef struct
  777. {
  778. __IOM uint32_t DHCSR; /*!< Offset: 0x000 (R/W) Debug Halting Control and Status Register */
  779. __OM uint32_t DCRSR; /*!< Offset: 0x004 ( /W) Debug Core Register Selector Register */
  780. __IOM uint32_t DCRDR; /*!< Offset: 0x008 (R/W) Debug Core Register Data Register */
  781. __IOM uint32_t DEMCR; /*!< Offset: 0x00C (R/W) Debug Exception and Monitor Control Register */
  782. uint32_t RESERVED0[1U];
  783. __IOM uint32_t DAUTHCTRL; /*!< Offset: 0x014 (R/W) Debug Authentication Control Register */
  784. __IOM uint32_t DSCSR; /*!< Offset: 0x018 (R/W) Debug Security Control and Status Register */
  785. } CoreDebug_Type;
  786. /* Debug Halting Control and Status Register Definitions */
  787. #define CoreDebug_DHCSR_DBGKEY_Pos 16U /*!< \deprecated CoreDebug DHCSR: DBGKEY Position */
  788. #define CoreDebug_DHCSR_DBGKEY_Msk (0xFFFFUL << CoreDebug_DHCSR_DBGKEY_Pos) /*!< \deprecated CoreDebug DHCSR: DBGKEY Mask */
  789. #define CoreDebug_DHCSR_S_RESTART_ST_Pos 26U /*!< \deprecated CoreDebug DHCSR: S_RESTART_ST Position */
  790. #define CoreDebug_DHCSR_S_RESTART_ST_Msk (1UL << CoreDebug_DHCSR_S_RESTART_ST_Pos) /*!< \deprecated CoreDebug DHCSR: S_RESTART_ST Mask */
  791. #define CoreDebug_DHCSR_S_RESET_ST_Pos 25U /*!< \deprecated CoreDebug DHCSR: S_RESET_ST Position */
  792. #define CoreDebug_DHCSR_S_RESET_ST_Msk (1UL << CoreDebug_DHCSR_S_RESET_ST_Pos) /*!< \deprecated CoreDebug DHCSR: S_RESET_ST Mask */
  793. #define CoreDebug_DHCSR_S_RETIRE_ST_Pos 24U /*!< \deprecated CoreDebug DHCSR: S_RETIRE_ST Position */
  794. #define CoreDebug_DHCSR_S_RETIRE_ST_Msk (1UL << CoreDebug_DHCSR_S_RETIRE_ST_Pos) /*!< \deprecated CoreDebug DHCSR: S_RETIRE_ST Mask */
  795. #define CoreDebug_DHCSR_S_LOCKUP_Pos 19U /*!< \deprecated CoreDebug DHCSR: S_LOCKUP Position */
  796. #define CoreDebug_DHCSR_S_LOCKUP_Msk (1UL << CoreDebug_DHCSR_S_LOCKUP_Pos) /*!< \deprecated CoreDebug DHCSR: S_LOCKUP Mask */
  797. #define CoreDebug_DHCSR_S_SLEEP_Pos 18U /*!< \deprecated CoreDebug DHCSR: S_SLEEP Position */
  798. #define CoreDebug_DHCSR_S_SLEEP_Msk (1UL << CoreDebug_DHCSR_S_SLEEP_Pos) /*!< \deprecated CoreDebug DHCSR: S_SLEEP Mask */
  799. #define CoreDebug_DHCSR_S_HALT_Pos 17U /*!< \deprecated CoreDebug DHCSR: S_HALT Position */
  800. #define CoreDebug_DHCSR_S_HALT_Msk (1UL << CoreDebug_DHCSR_S_HALT_Pos) /*!< \deprecated CoreDebug DHCSR: S_HALT Mask */
  801. #define CoreDebug_DHCSR_S_REGRDY_Pos 16U /*!< \deprecated CoreDebug DHCSR: S_REGRDY Position */
  802. #define CoreDebug_DHCSR_S_REGRDY_Msk (1UL << CoreDebug_DHCSR_S_REGRDY_Pos) /*!< \deprecated CoreDebug DHCSR: S_REGRDY Mask */
  803. #define CoreDebug_DHCSR_C_MASKINTS_Pos 3U /*!< \deprecated CoreDebug DHCSR: C_MASKINTS Position */
  804. #define CoreDebug_DHCSR_C_MASKINTS_Msk (1UL << CoreDebug_DHCSR_C_MASKINTS_Pos) /*!< \deprecated CoreDebug DHCSR: C_MASKINTS Mask */
  805. #define CoreDebug_DHCSR_C_STEP_Pos 2U /*!< \deprecated CoreDebug DHCSR: C_STEP Position */
  806. #define CoreDebug_DHCSR_C_STEP_Msk (1UL << CoreDebug_DHCSR_C_STEP_Pos) /*!< \deprecated CoreDebug DHCSR: C_STEP Mask */
  807. #define CoreDebug_DHCSR_C_HALT_Pos 1U /*!< \deprecated CoreDebug DHCSR: C_HALT Position */
  808. #define CoreDebug_DHCSR_C_HALT_Msk (1UL << CoreDebug_DHCSR_C_HALT_Pos) /*!< \deprecated CoreDebug DHCSR: C_HALT Mask */
  809. #define CoreDebug_DHCSR_C_DEBUGEN_Pos 0U /*!< \deprecated CoreDebug DHCSR: C_DEBUGEN Position */
  810. #define CoreDebug_DHCSR_C_DEBUGEN_Msk (1UL /*<< CoreDebug_DHCSR_C_DEBUGEN_Pos*/) /*!< \deprecated CoreDebug DHCSR: C_DEBUGEN Mask */
  811. /* Debug Core Register Selector Register Definitions */
  812. #define CoreDebug_DCRSR_REGWnR_Pos 16U /*!< \deprecated CoreDebug DCRSR: REGWnR Position */
  813. #define CoreDebug_DCRSR_REGWnR_Msk (1UL << CoreDebug_DCRSR_REGWnR_Pos) /*!< \deprecated CoreDebug DCRSR: REGWnR Mask */
  814. #define CoreDebug_DCRSR_REGSEL_Pos 0U /*!< \deprecated CoreDebug DCRSR: REGSEL Position */
  815. #define CoreDebug_DCRSR_REGSEL_Msk (0x1FUL /*<< CoreDebug_DCRSR_REGSEL_Pos*/) /*!< \deprecated CoreDebug DCRSR: REGSEL Mask */
  816. /* Debug Exception and Monitor Control Register Definitions */
  817. #define CoreDebug_DEMCR_DWTENA_Pos 24U /*!< \deprecated CoreDebug DEMCR: DWTENA Position */
  818. #define CoreDebug_DEMCR_DWTENA_Msk (1UL << CoreDebug_DEMCR_DWTENA_Pos) /*!< \deprecated CoreDebug DEMCR: DWTENA Mask */
  819. #define CoreDebug_DEMCR_VC_HARDERR_Pos 10U /*!< \deprecated CoreDebug DEMCR: VC_HARDERR Position */
  820. #define CoreDebug_DEMCR_VC_HARDERR_Msk (1UL << CoreDebug_DEMCR_VC_HARDERR_Pos) /*!< \deprecated CoreDebug DEMCR: VC_HARDERR Mask */
  821. #define CoreDebug_DEMCR_VC_CORERESET_Pos 0U /*!< \deprecated CoreDebug DEMCR: VC_CORERESET Position */
  822. #define CoreDebug_DEMCR_VC_CORERESET_Msk (1UL /*<< CoreDebug_DEMCR_VC_CORERESET_Pos*/) /*!< \deprecated CoreDebug DEMCR: VC_CORERESET Mask */
  823. /* Debug Authentication Control Register Definitions */
  824. #define CoreDebug_DAUTHCTRL_INTSPNIDEN_Pos 3U /*!< \deprecated CoreDebug DAUTHCTRL: INTSPNIDEN, Position */
  825. #define CoreDebug_DAUTHCTRL_INTSPNIDEN_Msk (1UL << CoreDebug_DAUTHCTRL_INTSPNIDEN_Pos) /*!< \deprecated CoreDebug DAUTHCTRL: INTSPNIDEN, Mask */
  826. #define CoreDebug_DAUTHCTRL_SPNIDENSEL_Pos 2U /*!< \deprecated CoreDebug DAUTHCTRL: SPNIDENSEL Position */
  827. #define CoreDebug_DAUTHCTRL_SPNIDENSEL_Msk (1UL << CoreDebug_DAUTHCTRL_SPNIDENSEL_Pos) /*!< \deprecated CoreDebug DAUTHCTRL: SPNIDENSEL Mask */
  828. #define CoreDebug_DAUTHCTRL_INTSPIDEN_Pos 1U /*!< \deprecated CoreDebug DAUTHCTRL: INTSPIDEN Position */
  829. #define CoreDebug_DAUTHCTRL_INTSPIDEN_Msk (1UL << CoreDebug_DAUTHCTRL_INTSPIDEN_Pos) /*!< \deprecated CoreDebug DAUTHCTRL: INTSPIDEN Mask */
  830. #define CoreDebug_DAUTHCTRL_SPIDENSEL_Pos 0U /*!< \deprecated CoreDebug DAUTHCTRL: SPIDENSEL Position */
  831. #define CoreDebug_DAUTHCTRL_SPIDENSEL_Msk (1UL /*<< CoreDebug_DAUTHCTRL_SPIDENSEL_Pos*/) /*!< \deprecated CoreDebug DAUTHCTRL: SPIDENSEL Mask */
  832. /* Debug Security Control and Status Register Definitions */
  833. #define CoreDebug_DSCSR_CDS_Pos 16U /*!< \deprecated CoreDebug DSCSR: CDS Position */
  834. #define CoreDebug_DSCSR_CDS_Msk (1UL << CoreDebug_DSCSR_CDS_Pos) /*!< \deprecated CoreDebug DSCSR: CDS Mask */
  835. #define CoreDebug_DSCSR_SBRSEL_Pos 1U /*!< \deprecated CoreDebug DSCSR: SBRSEL Position */
  836. #define CoreDebug_DSCSR_SBRSEL_Msk (1UL << CoreDebug_DSCSR_SBRSEL_Pos) /*!< \deprecated CoreDebug DSCSR: SBRSEL Mask */
  837. #define CoreDebug_DSCSR_SBRSELEN_Pos 0U /*!< \deprecated CoreDebug DSCSR: SBRSELEN Position */
  838. #define CoreDebug_DSCSR_SBRSELEN_Msk (1UL /*<< CoreDebug_DSCSR_SBRSELEN_Pos*/) /*!< \deprecated CoreDebug DSCSR: SBRSELEN Mask */
  839. /*@} end of group CMSIS_CoreDebug */
  840. /**
  841. \ingroup CMSIS_core_register
  842. \defgroup CMSIS_DCB Debug Control Block
  843. \brief Type definitions for the Debug Control Block Registers
  844. @{
  845. */
  846. /**
  847. \brief Structure type to access the Debug Control Block Registers (DCB).
  848. */
  849. typedef struct
  850. {
  851. __IOM uint32_t DHCSR; /*!< Offset: 0x000 (R/W) Debug Halting Control and Status Register */
  852. __OM uint32_t DCRSR; /*!< Offset: 0x004 ( /W) Debug Core Register Selector Register */
  853. __IOM uint32_t DCRDR; /*!< Offset: 0x008 (R/W) Debug Core Register Data Register */
  854. __IOM uint32_t DEMCR; /*!< Offset: 0x00C (R/W) Debug Exception and Monitor Control Register */
  855. uint32_t RESERVED0[1U];
  856. __IOM uint32_t DAUTHCTRL; /*!< Offset: 0x014 (R/W) Debug Authentication Control Register */
  857. __IOM uint32_t DSCSR; /*!< Offset: 0x018 (R/W) Debug Security Control and Status Register */
  858. } DCB_Type;
  859. /* DHCSR, Debug Halting Control and Status Register Definitions */
  860. #define DCB_DHCSR_DBGKEY_Pos 16U /*!< DCB DHCSR: Debug key Position */
  861. #define DCB_DHCSR_DBGKEY_Msk (0xFFFFUL << DCB_DHCSR_DBGKEY_Pos) /*!< DCB DHCSR: Debug key Mask */
  862. #define DCB_DHCSR_S_RESTART_ST_Pos 26U /*!< DCB DHCSR: Restart sticky status Position */
  863. #define DCB_DHCSR_S_RESTART_ST_Msk (0x1UL << DCB_DHCSR_S_RESTART_ST_Pos) /*!< DCB DHCSR: Restart sticky status Mask */
  864. #define DCB_DHCSR_S_RESET_ST_Pos 25U /*!< DCB DHCSR: Reset sticky status Position */
  865. #define DCB_DHCSR_S_RESET_ST_Msk (0x1UL << DCB_DHCSR_S_RESET_ST_Pos) /*!< DCB DHCSR: Reset sticky status Mask */
  866. #define DCB_DHCSR_S_RETIRE_ST_Pos 24U /*!< DCB DHCSR: Retire sticky status Position */
  867. #define DCB_DHCSR_S_RETIRE_ST_Msk (0x1UL << DCB_DHCSR_S_RETIRE_ST_Pos) /*!< DCB DHCSR: Retire sticky status Mask */
  868. #define DCB_DHCSR_S_SDE_Pos 20U /*!< DCB DHCSR: Secure debug enabled Position */
  869. #define DCB_DHCSR_S_SDE_Msk (0x1UL << DCB_DHCSR_S_SDE_Pos) /*!< DCB DHCSR: Secure debug enabled Mask */
  870. #define DCB_DHCSR_S_LOCKUP_Pos 19U /*!< DCB DHCSR: Lockup status Position */
  871. #define DCB_DHCSR_S_LOCKUP_Msk (0x1UL << DCB_DHCSR_S_LOCKUP_Pos) /*!< DCB DHCSR: Lockup status Mask */
  872. #define DCB_DHCSR_S_SLEEP_Pos 18U /*!< DCB DHCSR: Sleeping status Position */
  873. #define DCB_DHCSR_S_SLEEP_Msk (0x1UL << DCB_DHCSR_S_SLEEP_Pos) /*!< DCB DHCSR: Sleeping status Mask */
  874. #define DCB_DHCSR_S_HALT_Pos 17U /*!< DCB DHCSR: Halted status Position */
  875. #define DCB_DHCSR_S_HALT_Msk (0x1UL << DCB_DHCSR_S_HALT_Pos) /*!< DCB DHCSR: Halted status Mask */
  876. #define DCB_DHCSR_S_REGRDY_Pos 16U /*!< DCB DHCSR: Register ready status Position */
  877. #define DCB_DHCSR_S_REGRDY_Msk (0x1UL << DCB_DHCSR_S_REGRDY_Pos) /*!< DCB DHCSR: Register ready status Mask */
  878. #define DCB_DHCSR_C_MASKINTS_Pos 3U /*!< DCB DHCSR: Mask interrupts control Position */
  879. #define DCB_DHCSR_C_MASKINTS_Msk (0x1UL << DCB_DHCSR_C_MASKINTS_Pos) /*!< DCB DHCSR: Mask interrupts control Mask */
  880. #define DCB_DHCSR_C_STEP_Pos 2U /*!< DCB DHCSR: Step control Position */
  881. #define DCB_DHCSR_C_STEP_Msk (0x1UL << DCB_DHCSR_C_STEP_Pos) /*!< DCB DHCSR: Step control Mask */
  882. #define DCB_DHCSR_C_HALT_Pos 1U /*!< DCB DHCSR: Halt control Position */
  883. #define DCB_DHCSR_C_HALT_Msk (0x1UL << DCB_DHCSR_C_HALT_Pos) /*!< DCB DHCSR: Halt control Mask */
  884. #define DCB_DHCSR_C_DEBUGEN_Pos 0U /*!< DCB DHCSR: Debug enable control Position */
  885. #define DCB_DHCSR_C_DEBUGEN_Msk (0x1UL /*<< DCB_DHCSR_C_DEBUGEN_Pos*/) /*!< DCB DHCSR: Debug enable control Mask */
  886. /* DCRSR, Debug Core Register Select Register Definitions */
  887. #define DCB_DCRSR_REGWnR_Pos 16U /*!< DCB DCRSR: Register write/not-read Position */
  888. #define DCB_DCRSR_REGWnR_Msk (0x1UL << DCB_DCRSR_REGWnR_Pos) /*!< DCB DCRSR: Register write/not-read Mask */
  889. #define DCB_DCRSR_REGSEL_Pos 0U /*!< DCB DCRSR: Register selector Position */
  890. #define DCB_DCRSR_REGSEL_Msk (0x7FUL /*<< DCB_DCRSR_REGSEL_Pos*/) /*!< DCB DCRSR: Register selector Mask */
  891. /* DCRDR, Debug Core Register Data Register Definitions */
  892. #define DCB_DCRDR_DBGTMP_Pos 0U /*!< DCB DCRDR: Data temporary buffer Position */
  893. #define DCB_DCRDR_DBGTMP_Msk (0xFFFFFFFFUL /*<< DCB_DCRDR_DBGTMP_Pos*/) /*!< DCB DCRDR: Data temporary buffer Mask */
  894. /* DEMCR, Debug Exception and Monitor Control Register Definitions */
  895. #define DCB_DEMCR_TRCENA_Pos 24U /*!< DCB DEMCR: Trace enable Position */
  896. #define DCB_DEMCR_TRCENA_Msk (0x1UL << DCB_DEMCR_TRCENA_Pos) /*!< DCB DEMCR: Trace enable Mask */
  897. #define DCB_DEMCR_VC_HARDERR_Pos 10U /*!< DCB DEMCR: Vector Catch HardFault errors Position */
  898. #define DCB_DEMCR_VC_HARDERR_Msk (0x1UL << DCB_DEMCR_VC_HARDERR_Pos) /*!< DCB DEMCR: Vector Catch HardFault errors Mask */
  899. #define DCB_DEMCR_VC_CORERESET_Pos 0U /*!< DCB DEMCR: Vector Catch Core reset Position */
  900. #define DCB_DEMCR_VC_CORERESET_Msk (0x1UL /*<< DCB_DEMCR_VC_CORERESET_Pos*/) /*!< DCB DEMCR: Vector Catch Core reset Mask */
  901. /* DAUTHCTRL, Debug Authentication Control Register Definitions */
  902. #define DCB_DAUTHCTRL_INTSPNIDEN_Pos 3U /*!< DCB DAUTHCTRL: Internal Secure non-invasive debug enable Position */
  903. #define DCB_DAUTHCTRL_INTSPNIDEN_Msk (0x1UL << DCB_DAUTHCTRL_INTSPNIDEN_Pos) /*!< DCB DAUTHCTRL: Internal Secure non-invasive debug enable Mask */
  904. #define DCB_DAUTHCTRL_SPNIDENSEL_Pos 2U /*!< DCB DAUTHCTRL: Secure non-invasive debug enable select Position */
  905. #define DCB_DAUTHCTRL_SPNIDENSEL_Msk (0x1UL << DCB_DAUTHCTRL_SPNIDENSEL_Pos) /*!< DCB DAUTHCTRL: Secure non-invasive debug enable select Mask */
  906. #define DCB_DAUTHCTRL_INTSPIDEN_Pos 1U /*!< DCB DAUTHCTRL: Internal Secure invasive debug enable Position */
  907. #define DCB_DAUTHCTRL_INTSPIDEN_Msk (0x1UL << DCB_DAUTHCTRL_INTSPIDEN_Pos) /*!< DCB DAUTHCTRL: Internal Secure invasive debug enable Mask */
  908. #define DCB_DAUTHCTRL_SPIDENSEL_Pos 0U /*!< DCB DAUTHCTRL: Secure invasive debug enable select Position */
  909. #define DCB_DAUTHCTRL_SPIDENSEL_Msk (0x1UL /*<< DCB_DAUTHCTRL_SPIDENSEL_Pos*/) /*!< DCB DAUTHCTRL: Secure invasive debug enable select Mask */
  910. /* DSCSR, Debug Security Control and Status Register Definitions */
  911. #define DCB_DSCSR_CDSKEY_Pos 17U /*!< DCB DSCSR: CDS write-enable key Position */
  912. #define DCB_DSCSR_CDSKEY_Msk (0x1UL << DCB_DSCSR_CDSKEY_Pos) /*!< DCB DSCSR: CDS write-enable key Mask */
  913. #define DCB_DSCSR_CDS_Pos 16U /*!< DCB DSCSR: Current domain Secure Position */
  914. #define DCB_DSCSR_CDS_Msk (0x1UL << DCB_DSCSR_CDS_Pos) /*!< DCB DSCSR: Current domain Secure Mask */
  915. #define DCB_DSCSR_SBRSEL_Pos 1U /*!< DCB DSCSR: Secure banked register select Position */
  916. #define DCB_DSCSR_SBRSEL_Msk (0x1UL << DCB_DSCSR_SBRSEL_Pos) /*!< DCB DSCSR: Secure banked register select Mask */
  917. #define DCB_DSCSR_SBRSELEN_Pos 0U /*!< DCB DSCSR: Secure banked register select enable Position */
  918. #define DCB_DSCSR_SBRSELEN_Msk (0x1UL /*<< DCB_DSCSR_SBRSELEN_Pos*/) /*!< DCB DSCSR: Secure banked register select enable Mask */
  919. /*@} end of group CMSIS_DCB */
  920. /**
  921. \ingroup CMSIS_core_register
  922. \defgroup CMSIS_DIB Debug Identification Block
  923. \brief Type definitions for the Debug Identification Block Registers
  924. @{
  925. */
  926. /**
  927. \brief Structure type to access the Debug Identification Block Registers (DIB).
  928. */
  929. typedef struct
  930. {
  931. __OM uint32_t DLAR; /*!< Offset: 0x000 ( /W) SCS Software Lock Access Register */
  932. __IM uint32_t DLSR; /*!< Offset: 0x004 (R/ ) SCS Software Lock Status Register */
  933. __IM uint32_t DAUTHSTATUS; /*!< Offset: 0x008 (R/ ) Debug Authentication Status Register */
  934. __IM uint32_t DDEVARCH; /*!< Offset: 0x00C (R/ ) SCS Device Architecture Register */
  935. __IM uint32_t DDEVTYPE; /*!< Offset: 0x010 (R/ ) SCS Device Type Register */
  936. } DIB_Type;
  937. /* DLAR, SCS Software Lock Access Register Definitions */
  938. #define DIB_DLAR_KEY_Pos 0U /*!< DIB DLAR: KEY Position */
  939. #define DIB_DLAR_KEY_Msk (0xFFFFFFFFUL /*<< DIB_DLAR_KEY_Pos */) /*!< DIB DLAR: KEY Mask */
  940. /* DLSR, SCS Software Lock Status Register Definitions */
  941. #define DIB_DLSR_nTT_Pos 2U /*!< DIB DLSR: Not thirty-two bit Position */
  942. #define DIB_DLSR_nTT_Msk (0x1UL << DIB_DLSR_nTT_Pos ) /*!< DIB DLSR: Not thirty-two bit Mask */
  943. #define DIB_DLSR_SLK_Pos 1U /*!< DIB DLSR: Software Lock status Position */
  944. #define DIB_DLSR_SLK_Msk (0x1UL << DIB_DLSR_SLK_Pos ) /*!< DIB DLSR: Software Lock status Mask */
  945. #define DIB_DLSR_SLI_Pos 0U /*!< DIB DLSR: Software Lock implemented Position */
  946. #define DIB_DLSR_SLI_Msk (0x1UL /*<< DIB_DLSR_SLI_Pos*/) /*!< DIB DLSR: Software Lock implemented Mask */
  947. /* DAUTHSTATUS, Debug Authentication Status Register Definitions */
  948. #define DIB_DAUTHSTATUS_SNID_Pos 6U /*!< DIB DAUTHSTATUS: Secure Non-invasive Debug Position */
  949. #define DIB_DAUTHSTATUS_SNID_Msk (0x3UL << DIB_DAUTHSTATUS_SNID_Pos ) /*!< DIB DAUTHSTATUS: Secure Non-invasive Debug Mask */
  950. #define DIB_DAUTHSTATUS_SID_Pos 4U /*!< DIB DAUTHSTATUS: Secure Invasive Debug Position */
  951. #define DIB_DAUTHSTATUS_SID_Msk (0x3UL << DIB_DAUTHSTATUS_SID_Pos ) /*!< DIB DAUTHSTATUS: Secure Invasive Debug Mask */
  952. #define DIB_DAUTHSTATUS_NSNID_Pos 2U /*!< DIB DAUTHSTATUS: Non-secure Non-invasive Debug Position */
  953. #define DIB_DAUTHSTATUS_NSNID_Msk (0x3UL << DIB_DAUTHSTATUS_NSNID_Pos ) /*!< DIB DAUTHSTATUS: Non-secure Non-invasive Debug Mask */
  954. #define DIB_DAUTHSTATUS_NSID_Pos 0U /*!< DIB DAUTHSTATUS: Non-secure Invasive Debug Position */
  955. #define DIB_DAUTHSTATUS_NSID_Msk (0x3UL /*<< DIB_DAUTHSTATUS_NSID_Pos*/) /*!< DIB DAUTHSTATUS: Non-secure Invasive Debug Mask */
  956. /* DDEVARCH, SCS Device Architecture Register Definitions */
  957. #define DIB_DDEVARCH_ARCHITECT_Pos 21U /*!< DIB DDEVARCH: Architect Position */
  958. #define DIB_DDEVARCH_ARCHITECT_Msk (0x7FFUL << DIB_DDEVARCH_ARCHITECT_Pos ) /*!< DIB DDEVARCH: Architect Mask */
  959. #define DIB_DDEVARCH_PRESENT_Pos 20U /*!< DIB DDEVARCH: DEVARCH Present Position */
  960. #define DIB_DDEVARCH_PRESENT_Msk (0x1FUL << DIB_DDEVARCH_PRESENT_Pos ) /*!< DIB DDEVARCH: DEVARCH Present Mask */
  961. #define DIB_DDEVARCH_REVISION_Pos 16U /*!< DIB DDEVARCH: Revision Position */
  962. #define DIB_DDEVARCH_REVISION_Msk (0xFUL << DIB_DDEVARCH_REVISION_Pos ) /*!< DIB DDEVARCH: Revision Mask */
  963. #define DIB_DDEVARCH_ARCHVER_Pos 12U /*!< DIB DDEVARCH: Architecture Version Position */
  964. #define DIB_DDEVARCH_ARCHVER_Msk (0xFUL << DIB_DDEVARCH_ARCHVER_Pos ) /*!< DIB DDEVARCH: Architecture Version Mask */
  965. #define DIB_DDEVARCH_ARCHPART_Pos 0U /*!< DIB DDEVARCH: Architecture Part Position */
  966. #define DIB_DDEVARCH_ARCHPART_Msk (0xFFFUL /*<< DIB_DDEVARCH_ARCHPART_Pos*/) /*!< DIB DDEVARCH: Architecture Part Mask */
  967. /* DDEVTYPE, SCS Device Type Register Definitions */
  968. #define DIB_DDEVTYPE_SUB_Pos 4U /*!< DIB DDEVTYPE: Sub-type Position */
  969. #define DIB_DDEVTYPE_SUB_Msk (0xFUL << DIB_DDEVTYPE_SUB_Pos ) /*!< DIB DDEVTYPE: Sub-type Mask */
  970. #define DIB_DDEVTYPE_MAJOR_Pos 0U /*!< DIB DDEVTYPE: Major type Position */
  971. #define DIB_DDEVTYPE_MAJOR_Msk (0xFUL /*<< DIB_DDEVTYPE_MAJOR_Pos*/) /*!< DIB DDEVTYPE: Major type Mask */
  972. /*@} end of group CMSIS_DIB */
  973. /**
  974. \ingroup CMSIS_core_register
  975. \defgroup CMSIS_core_bitfield Core register bit field macros
  976. \brief Macros for use with bit field definitions (xxx_Pos, xxx_Msk).
  977. @{
  978. */
  979. /**
  980. \brief Mask and shift a bit field value for use in a register bit range.
  981. \param[in] field Name of the register bit field.
  982. \param[in] value Value of the bit field. This parameter is interpreted as an uint32_t type.
  983. \return Masked and shifted value.
  984. */
  985. #define _VAL2FLD(field, value) (((uint32_t)(value) << field ## _Pos) & field ## _Msk)
  986. /**
  987. \brief Mask and shift a register value to extract a bit filed value.
  988. \param[in] field Name of the register bit field.
  989. \param[in] value Value of register. This parameter is interpreted as an uint32_t type.
  990. \return Masked and shifted bit field value.
  991. */
  992. #define _FLD2VAL(field, value) (((uint32_t)(value) & field ## _Msk) >> field ## _Pos)
  993. /*@} end of group CMSIS_core_bitfield */
  994. /**
  995. \ingroup CMSIS_core_register
  996. \defgroup CMSIS_core_base Core Definitions
  997. \brief Definitions for base addresses, unions, and structures.
  998. @{
  999. */
  1000. /* Memory mapping of Core Hardware */
  1001. #define SCS_BASE (0xE000E000UL) /*!< System Control Space Base Address */
  1002. #define DWT_BASE (0xE0001000UL) /*!< DWT Base Address */
  1003. #define TPI_BASE (0xE0040000UL) /*!< TPI Base Address */
  1004. #define CoreDebug_BASE (0xE000EDF0UL) /*!< \deprecated Core Debug Base Address */
  1005. #define DCB_BASE (0xE000EDF0UL) /*!< DCB Base Address */
  1006. #define DIB_BASE (0xE000EFB0UL) /*!< DIB Base Address */
  1007. #define SysTick_BASE (SCS_BASE + 0x0010UL) /*!< SysTick Base Address */
  1008. #define NVIC_BASE (SCS_BASE + 0x0100UL) /*!< NVIC Base Address */
  1009. #define SCB_BASE (SCS_BASE + 0x0D00UL) /*!< System Control Block Base Address */
  1010. #define SCB ((SCB_Type *) SCB_BASE ) /*!< SCB configuration struct */
  1011. #define SysTick ((SysTick_Type *) SysTick_BASE ) /*!< SysTick configuration struct */
  1012. #define NVIC ((NVIC_Type *) NVIC_BASE ) /*!< NVIC configuration struct */
  1013. #define DWT ((DWT_Type *) DWT_BASE ) /*!< DWT configuration struct */
  1014. #define TPI ((TPI_Type *) TPI_BASE ) /*!< TPI configuration struct */
  1015. #define CoreDebug ((CoreDebug_Type *) CoreDebug_BASE ) /*!< \deprecated Core Debug configuration struct */
  1016. #define DCB ((DCB_Type *) DCB_BASE ) /*!< DCB configuration struct */
  1017. #define DIB ((DIB_Type *) DIB_BASE ) /*!< DIB configuration struct */
  1018. #if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U)
  1019. #define MPU_BASE (SCS_BASE + 0x0D90UL) /*!< Memory Protection Unit */
  1020. #define MPU ((MPU_Type *) MPU_BASE ) /*!< Memory Protection Unit */
  1021. #endif
  1022. #if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
  1023. #define SAU_BASE (SCS_BASE + 0x0DD0UL) /*!< Security Attribution Unit */
  1024. #define SAU ((SAU_Type *) SAU_BASE ) /*!< Security Attribution Unit */
  1025. #endif
  1026. #if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
  1027. #define SCS_BASE_NS (0xE002E000UL) /*!< System Control Space Base Address (non-secure address space) */
  1028. #define CoreDebug_BASE_NS (0xE002EDF0UL) /*!< \deprecated Core Debug Base Address (non-secure address space) */
  1029. #define DCB_BASE_NS (0xE002EDF0UL) /*!< DCB Base Address (non-secure address space) */
  1030. #define DIB_BASE_NS (0xE002EFB0UL) /*!< DIB Base Address (non-secure address space) */
  1031. #define SysTick_BASE_NS (SCS_BASE_NS + 0x0010UL) /*!< SysTick Base Address (non-secure address space) */
  1032. #define NVIC_BASE_NS (SCS_BASE_NS + 0x0100UL) /*!< NVIC Base Address (non-secure address space) */
  1033. #define SCB_BASE_NS (SCS_BASE_NS + 0x0D00UL) /*!< System Control Block Base Address (non-secure address space) */
  1034. #define SCB_NS ((SCB_Type *) SCB_BASE_NS ) /*!< SCB configuration struct (non-secure address space) */
  1035. #define SysTick_NS ((SysTick_Type *) SysTick_BASE_NS ) /*!< SysTick configuration struct (non-secure address space) */
  1036. #define NVIC_NS ((NVIC_Type *) NVIC_BASE_NS ) /*!< NVIC configuration struct (non-secure address space) */
  1037. #define CoreDebug_NS ((CoreDebug_Type *) CoreDebug_BASE_NS) /*!< \deprecated Core Debug configuration struct (non-secure address space) */
  1038. #define DCB_NS ((DCB_Type *) DCB_BASE_NS ) /*!< DCB configuration struct (non-secure address space) */
  1039. #define DIB_NS ((DIB_Type *) DIB_BASE_NS ) /*!< DIB configuration struct (non-secure address space) */
  1040. #if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U)
  1041. #define MPU_BASE_NS (SCS_BASE_NS + 0x0D90UL) /*!< Memory Protection Unit (non-secure address space) */
  1042. #define MPU_NS ((MPU_Type *) MPU_BASE_NS ) /*!< Memory Protection Unit (non-secure address space) */
  1043. #endif
  1044. #endif /* defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */
  1045. /*@} */
  1046. /*******************************************************************************
  1047. * Hardware Abstraction Layer
  1048. Core Function Interface contains:
  1049. - Core NVIC Functions
  1050. - Core SysTick Functions
  1051. - Core Debug Functions
  1052. - Core Register Access Functions
  1053. ******************************************************************************/
  1054. /**
  1055. \defgroup CMSIS_Core_FunctionInterface Functions and Instructions Reference
  1056. */
  1057. /* ########################## NVIC functions #################################### */
  1058. /**
  1059. \ingroup CMSIS_Core_FunctionInterface
  1060. \defgroup CMSIS_Core_NVICFunctions NVIC Functions
  1061. \brief Functions that manage interrupts and exceptions via the NVIC.
  1062. @{
  1063. */
  1064. #ifdef CMSIS_NVIC_VIRTUAL
  1065. #ifndef CMSIS_NVIC_VIRTUAL_HEADER_FILE
  1066. #define CMSIS_NVIC_VIRTUAL_HEADER_FILE "cmsis_nvic_virtual.h"
  1067. #endif
  1068. #include CMSIS_NVIC_VIRTUAL_HEADER_FILE
  1069. #else
  1070. #define NVIC_SetPriorityGrouping __NVIC_SetPriorityGrouping
  1071. #define NVIC_GetPriorityGrouping __NVIC_GetPriorityGrouping
  1072. #define NVIC_EnableIRQ __NVIC_EnableIRQ
  1073. #define NVIC_GetEnableIRQ __NVIC_GetEnableIRQ
  1074. #define NVIC_DisableIRQ __NVIC_DisableIRQ
  1075. #define NVIC_GetPendingIRQ __NVIC_GetPendingIRQ
  1076. #define NVIC_SetPendingIRQ __NVIC_SetPendingIRQ
  1077. #define NVIC_ClearPendingIRQ __NVIC_ClearPendingIRQ
  1078. #define NVIC_GetActive __NVIC_GetActive
  1079. #define NVIC_SetPriority __NVIC_SetPriority
  1080. #define NVIC_GetPriority __NVIC_GetPriority
  1081. #define NVIC_SystemReset __NVIC_SystemReset
  1082. #endif /* CMSIS_NVIC_VIRTUAL */
  1083. #ifdef CMSIS_VECTAB_VIRTUAL
  1084. #ifndef CMSIS_VECTAB_VIRTUAL_HEADER_FILE
  1085. #define CMSIS_VECTAB_VIRTUAL_HEADER_FILE "cmsis_vectab_virtual.h"
  1086. #endif
  1087. #include CMSIS_VECTAB_VIRTUAL_HEADER_FILE
  1088. #else
  1089. #define NVIC_SetVector __NVIC_SetVector
  1090. #define NVIC_GetVector __NVIC_GetVector
  1091. #endif /* (CMSIS_VECTAB_VIRTUAL) */
  1092. #define NVIC_USER_IRQ_OFFSET 16
  1093. /* Special LR values for Secure/Non-Secure call handling and exception handling */
  1094. /* Function Return Payload (from ARMv8-M Architecture Reference Manual) LR value on entry from Secure BLXNS */
  1095. #define FNC_RETURN (0xFEFFFFFFUL) /* bit [0] ignored when processing a branch */
  1096. /* The following EXC_RETURN mask values are used to evaluate the LR on exception entry */
  1097. #define EXC_RETURN_PREFIX (0xFF000000UL) /* bits [31:24] set to indicate an EXC_RETURN value */
  1098. #define EXC_RETURN_S (0x00000040UL) /* bit [6] stack used to push registers: 0=Non-secure 1=Secure */
  1099. #define EXC_RETURN_DCRS (0x00000020UL) /* bit [5] stacking rules for called registers: 0=skipped 1=saved */
  1100. #define EXC_RETURN_FTYPE (0x00000010UL) /* bit [4] allocate stack for floating-point context: 0=done 1=skipped */
  1101. #define EXC_RETURN_MODE (0x00000008UL) /* bit [3] processor mode for return: 0=Handler mode 1=Thread mode */
  1102. #define EXC_RETURN_SPSEL (0x00000004UL) /* bit [2] stack pointer used to restore context: 0=MSP 1=PSP */
  1103. #define EXC_RETURN_ES (0x00000001UL) /* bit [0] security state exception was taken to: 0=Non-secure 1=Secure */
  1104. /* Integrity Signature (from ARMv8-M Architecture Reference Manual) for exception context stacking */
  1105. #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U) /* Value for processors with floating-point extension: */
  1106. #define EXC_INTEGRITY_SIGNATURE (0xFEFA125AUL) /* bit [0] SFTC must match LR bit[4] EXC_RETURN_FTYPE */
  1107. #else
  1108. #define EXC_INTEGRITY_SIGNATURE (0xFEFA125BUL) /* Value for processors without floating-point extension */
  1109. #endif
  1110. /* Interrupt Priorities are WORD accessible only under Armv6-M */
  1111. /* The following MACROS handle generation of the register offset and byte masks */
  1112. #define _BIT_SHIFT(IRQn) ( ((((uint32_t)(int32_t)(IRQn)) ) & 0x03UL) * 8UL)
  1113. #define _SHP_IDX(IRQn) ( (((((uint32_t)(int32_t)(IRQn)) & 0x0FUL)-8UL) >> 2UL) )
  1114. #define _IP_IDX(IRQn) ( (((uint32_t)(int32_t)(IRQn)) >> 2UL) )
  1115. #define __NVIC_SetPriorityGrouping(X) (void)(X)
  1116. #define __NVIC_GetPriorityGrouping() (0U)
  1117. /**
  1118. \brief Enable Interrupt
  1119. \details Enables a device specific interrupt in the NVIC interrupt controller.
  1120. \param [in] IRQn Device specific interrupt number.
  1121. \note IRQn must not be negative.
  1122. */
  1123. __STATIC_INLINE void __NVIC_EnableIRQ(IRQn_Type IRQn)
  1124. {
  1125. if ((int32_t)(IRQn) >= 0)
  1126. {
  1127. __COMPILER_BARRIER();
  1128. NVIC->ISER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
  1129. __COMPILER_BARRIER();
  1130. }
  1131. }
  1132. /**
  1133. \brief Get Interrupt Enable status
  1134. \details Returns a device specific interrupt enable status from the NVIC interrupt controller.
  1135. \param [in] IRQn Device specific interrupt number.
  1136. \return 0 Interrupt is not enabled.
  1137. \return 1 Interrupt is enabled.
  1138. \note IRQn must not be negative.
  1139. */
  1140. __STATIC_INLINE uint32_t __NVIC_GetEnableIRQ(IRQn_Type IRQn)
  1141. {
  1142. if ((int32_t)(IRQn) >= 0)
  1143. {
  1144. return((uint32_t)(((NVIC->ISER[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
  1145. }
  1146. else
  1147. {
  1148. return(0U);
  1149. }
  1150. }
  1151. /**
  1152. \brief Disable Interrupt
  1153. \details Disables a device specific interrupt in the NVIC interrupt controller.
  1154. \param [in] IRQn Device specific interrupt number.
  1155. \note IRQn must not be negative.
  1156. */
  1157. __STATIC_INLINE void __NVIC_DisableIRQ(IRQn_Type IRQn)
  1158. {
  1159. if ((int32_t)(IRQn) >= 0)
  1160. {
  1161. NVIC->ICER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
  1162. __DSB();
  1163. __ISB();
  1164. }
  1165. }
  1166. /**
  1167. \brief Get Pending Interrupt
  1168. \details Reads the NVIC pending register and returns the pending bit for the specified device specific interrupt.
  1169. \param [in] IRQn Device specific interrupt number.
  1170. \return 0 Interrupt status is not pending.
  1171. \return 1 Interrupt status is pending.
  1172. \note IRQn must not be negative.
  1173. */
  1174. __STATIC_INLINE uint32_t __NVIC_GetPendingIRQ(IRQn_Type IRQn)
  1175. {
  1176. if ((int32_t)(IRQn) >= 0)
  1177. {
  1178. return((uint32_t)(((NVIC->ISPR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
  1179. }
  1180. else
  1181. {
  1182. return(0U);
  1183. }
  1184. }
  1185. /**
  1186. \brief Set Pending Interrupt
  1187. \details Sets the pending bit of a device specific interrupt in the NVIC pending register.
  1188. \param [in] IRQn Device specific interrupt number.
  1189. \note IRQn must not be negative.
  1190. */
  1191. __STATIC_INLINE void __NVIC_SetPendingIRQ(IRQn_Type IRQn)
  1192. {
  1193. if ((int32_t)(IRQn) >= 0)
  1194. {
  1195. NVIC->ISPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
  1196. }
  1197. }
  1198. /**
  1199. \brief Clear Pending Interrupt
  1200. \details Clears the pending bit of a device specific interrupt in the NVIC pending register.
  1201. \param [in] IRQn Device specific interrupt number.
  1202. \note IRQn must not be negative.
  1203. */
  1204. __STATIC_INLINE void __NVIC_ClearPendingIRQ(IRQn_Type IRQn)
  1205. {
  1206. if ((int32_t)(IRQn) >= 0)
  1207. {
  1208. NVIC->ICPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
  1209. }
  1210. }
  1211. /**
  1212. \brief Get Active Interrupt
  1213. \details Reads the active register in the NVIC and returns the active bit for the device specific interrupt.
  1214. \param [in] IRQn Device specific interrupt number.
  1215. \return 0 Interrupt status is not active.
  1216. \return 1 Interrupt status is active.
  1217. \note IRQn must not be negative.
  1218. */
  1219. __STATIC_INLINE uint32_t __NVIC_GetActive(IRQn_Type IRQn)
  1220. {
  1221. if ((int32_t)(IRQn) >= 0)
  1222. {
  1223. return((uint32_t)(((NVIC->IABR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
  1224. }
  1225. else
  1226. {
  1227. return(0U);
  1228. }
  1229. }
  1230. #if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
  1231. /**
  1232. \brief Get Interrupt Target State
  1233. \details Reads the interrupt target field in the NVIC and returns the interrupt target bit for the device specific interrupt.
  1234. \param [in] IRQn Device specific interrupt number.
  1235. \return 0 if interrupt is assigned to Secure
  1236. \return 1 if interrupt is assigned to Non Secure
  1237. \note IRQn must not be negative.
  1238. */
  1239. __STATIC_INLINE uint32_t NVIC_GetTargetState(IRQn_Type IRQn)
  1240. {
  1241. if ((int32_t)(IRQn) >= 0)
  1242. {
  1243. return((uint32_t)(((NVIC->ITNS[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
  1244. }
  1245. else
  1246. {
  1247. return(0U);
  1248. }
  1249. }
  1250. /**
  1251. \brief Set Interrupt Target State
  1252. \details Sets the interrupt target field in the NVIC and returns the interrupt target bit for the device specific interrupt.
  1253. \param [in] IRQn Device specific interrupt number.
  1254. \return 0 if interrupt is assigned to Secure
  1255. 1 if interrupt is assigned to Non Secure
  1256. \note IRQn must not be negative.
  1257. */
  1258. __STATIC_INLINE uint32_t NVIC_SetTargetState(IRQn_Type IRQn)
  1259. {
  1260. if ((int32_t)(IRQn) >= 0)
  1261. {
  1262. NVIC->ITNS[(((uint32_t)IRQn) >> 5UL)] |= ((uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)));
  1263. return((uint32_t)(((NVIC->ITNS[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
  1264. }
  1265. else
  1266. {
  1267. return(0U);
  1268. }
  1269. }
  1270. /**
  1271. \brief Clear Interrupt Target State
  1272. \details Clears the interrupt target field in the NVIC and returns the interrupt target bit for the device specific interrupt.
  1273. \param [in] IRQn Device specific interrupt number.
  1274. \return 0 if interrupt is assigned to Secure
  1275. 1 if interrupt is assigned to Non Secure
  1276. \note IRQn must not be negative.
  1277. */
  1278. __STATIC_INLINE uint32_t NVIC_ClearTargetState(IRQn_Type IRQn)
  1279. {
  1280. if ((int32_t)(IRQn) >= 0)
  1281. {
  1282. NVIC->ITNS[(((uint32_t)IRQn) >> 5UL)] &= ~((uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)));
  1283. return((uint32_t)(((NVIC->ITNS[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
  1284. }
  1285. else
  1286. {
  1287. return(0U);
  1288. }
  1289. }
  1290. #endif /* defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */
  1291. /**
  1292. \brief Set Interrupt Priority
  1293. \details Sets the priority of a device specific interrupt or a processor exception.
  1294. The interrupt number can be positive to specify a device specific interrupt,
  1295. or negative to specify a processor exception.
  1296. \param [in] IRQn Interrupt number.
  1297. \param [in] priority Priority to set.
  1298. \note The priority cannot be set for every processor exception.
  1299. */
  1300. __STATIC_INLINE void __NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority)
  1301. {
  1302. if ((int32_t)(IRQn) >= 0)
  1303. {
  1304. NVIC->IPR[_IP_IDX(IRQn)] = ((uint32_t)(NVIC->IPR[_IP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) |
  1305. (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn)));
  1306. }
  1307. else
  1308. {
  1309. SCB->SHPR[_SHP_IDX(IRQn)] = ((uint32_t)(SCB->SHPR[_SHP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) |
  1310. (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn)));
  1311. }
  1312. }
  1313. /**
  1314. \brief Get Interrupt Priority
  1315. \details Reads the priority of a device specific interrupt or a processor exception.
  1316. The interrupt number can be positive to specify a device specific interrupt,
  1317. or negative to specify a processor exception.
  1318. \param [in] IRQn Interrupt number.
  1319. \return Interrupt Priority.
  1320. Value is aligned automatically to the implemented priority bits of the microcontroller.
  1321. */
  1322. __STATIC_INLINE uint32_t __NVIC_GetPriority(IRQn_Type IRQn)
  1323. {
  1324. if ((int32_t)(IRQn) >= 0)
  1325. {
  1326. return((uint32_t)(((NVIC->IPR[ _IP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS)));
  1327. }
  1328. else
  1329. {
  1330. return((uint32_t)(((SCB->SHPR[_SHP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS)));
  1331. }
  1332. }
  1333. /**
  1334. \brief Encode Priority
  1335. \details Encodes the priority for an interrupt with the given priority group,
  1336. preemptive priority value, and subpriority value.
  1337. In case of a conflict between priority grouping and available
  1338. priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set.
  1339. \param [in] PriorityGroup Used priority group.
  1340. \param [in] PreemptPriority Preemptive priority value (starting from 0).
  1341. \param [in] SubPriority Subpriority value (starting from 0).
  1342. \return Encoded priority. Value can be used in the function \ref NVIC_SetPriority().
  1343. */
  1344. __STATIC_INLINE uint32_t NVIC_EncodePriority (uint32_t PriorityGroup, uint32_t PreemptPriority, uint32_t SubPriority)
  1345. {
  1346. uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */
  1347. uint32_t PreemptPriorityBits;
  1348. uint32_t SubPriorityBits;
  1349. PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp);
  1350. SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS));
  1351. return (
  1352. ((PreemptPriority & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL)) << SubPriorityBits) |
  1353. ((SubPriority & (uint32_t)((1UL << (SubPriorityBits )) - 1UL)))
  1354. );
  1355. }
  1356. /**
  1357. \brief Decode Priority
  1358. \details Decodes an interrupt priority value with a given priority group to
  1359. preemptive priority value and subpriority value.
  1360. In case of a conflict between priority grouping and available
  1361. priority bits (__NVIC_PRIO_BITS) the smallest possible priority group is set.
  1362. \param [in] Priority Priority value, which can be retrieved with the function \ref NVIC_GetPriority().
  1363. \param [in] PriorityGroup Used priority group.
  1364. \param [out] pPreemptPriority Preemptive priority value (starting from 0).
  1365. \param [out] pSubPriority Subpriority value (starting from 0).
  1366. */
  1367. __STATIC_INLINE void NVIC_DecodePriority (uint32_t Priority, uint32_t PriorityGroup, uint32_t* const pPreemptPriority, uint32_t* const pSubPriority)
  1368. {
  1369. uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */
  1370. uint32_t PreemptPriorityBits;
  1371. uint32_t SubPriorityBits;
  1372. PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp);
  1373. SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS));
  1374. *pPreemptPriority = (Priority >> SubPriorityBits) & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL);
  1375. *pSubPriority = (Priority ) & (uint32_t)((1UL << (SubPriorityBits )) - 1UL);
  1376. }
  1377. /**
  1378. \brief Set Interrupt Vector
  1379. \details Sets an interrupt vector in SRAM based interrupt vector table.
  1380. The interrupt number can be positive to specify a device specific interrupt,
  1381. or negative to specify a processor exception.
  1382. VTOR must been relocated to SRAM before.
  1383. If VTOR is not present address 0 must be mapped to SRAM.
  1384. \param [in] IRQn Interrupt number
  1385. \param [in] vector Address of interrupt handler function
  1386. */
  1387. __STATIC_INLINE void __NVIC_SetVector(IRQn_Type IRQn, uint32_t vector)
  1388. {
  1389. #if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U)
  1390. uint32_t *vectors = (uint32_t *)SCB->VTOR;
  1391. #else
  1392. uint32_t *vectors = (uint32_t *)0x0U;
  1393. #endif
  1394. vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET] = vector;
  1395. __DSB();
  1396. }
  1397. /**
  1398. \brief Get Interrupt Vector
  1399. \details Reads an interrupt vector from interrupt vector table.
  1400. The interrupt number can be positive to specify a device specific interrupt,
  1401. or negative to specify a processor exception.
  1402. \param [in] IRQn Interrupt number.
  1403. \return Address of interrupt handler function
  1404. */
  1405. __STATIC_INLINE uint32_t __NVIC_GetVector(IRQn_Type IRQn)
  1406. {
  1407. #if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U)
  1408. uint32_t *vectors = (uint32_t *)SCB->VTOR;
  1409. #else
  1410. uint32_t *vectors = (uint32_t *)0x0U;
  1411. #endif
  1412. return vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET];
  1413. }
  1414. /**
  1415. \brief System Reset
  1416. \details Initiates a system reset request to reset the MCU.
  1417. */
  1418. __NO_RETURN __STATIC_INLINE void __NVIC_SystemReset(void)
  1419. {
  1420. __DSB(); /* Ensure all outstanding memory accesses included
  1421. buffered write are completed before reset */
  1422. SCB->AIRCR = ((0x5FAUL << SCB_AIRCR_VECTKEY_Pos) |
  1423. SCB_AIRCR_SYSRESETREQ_Msk);
  1424. __DSB(); /* Ensure completion of memory access */
  1425. for(;;) /* wait until reset */
  1426. {
  1427. __NOP();
  1428. }
  1429. }
  1430. #if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
  1431. /**
  1432. \brief Enable Interrupt (non-secure)
  1433. \details Enables a device specific interrupt in the non-secure NVIC interrupt controller when in secure state.
  1434. \param [in] IRQn Device specific interrupt number.
  1435. \note IRQn must not be negative.
  1436. */
  1437. __STATIC_INLINE void TZ_NVIC_EnableIRQ_NS(IRQn_Type IRQn)
  1438. {
  1439. if ((int32_t)(IRQn) >= 0)
  1440. {
  1441. NVIC_NS->ISER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
  1442. }
  1443. }
  1444. /**
  1445. \brief Get Interrupt Enable status (non-secure)
  1446. \details Returns a device specific interrupt enable status from the non-secure NVIC interrupt controller when in secure state.
  1447. \param [in] IRQn Device specific interrupt number.
  1448. \return 0 Interrupt is not enabled.
  1449. \return 1 Interrupt is enabled.
  1450. \note IRQn must not be negative.
  1451. */
  1452. __STATIC_INLINE uint32_t TZ_NVIC_GetEnableIRQ_NS(IRQn_Type IRQn)
  1453. {
  1454. if ((int32_t)(IRQn) >= 0)
  1455. {
  1456. return((uint32_t)(((NVIC_NS->ISER[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
  1457. }
  1458. else
  1459. {
  1460. return(0U);
  1461. }
  1462. }
  1463. /**
  1464. \brief Disable Interrupt (non-secure)
  1465. \details Disables a device specific interrupt in the non-secure NVIC interrupt controller when in secure state.
  1466. \param [in] IRQn Device specific interrupt number.
  1467. \note IRQn must not be negative.
  1468. */
  1469. __STATIC_INLINE void TZ_NVIC_DisableIRQ_NS(IRQn_Type IRQn)
  1470. {
  1471. if ((int32_t)(IRQn) >= 0)
  1472. {
  1473. NVIC_NS->ICER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
  1474. }
  1475. }
  1476. /**
  1477. \brief Get Pending Interrupt (non-secure)
  1478. \details Reads the NVIC pending register in the non-secure NVIC when in secure state and returns the pending bit for the specified device specific interrupt.
  1479. \param [in] IRQn Device specific interrupt number.
  1480. \return 0 Interrupt status is not pending.
  1481. \return 1 Interrupt status is pending.
  1482. \note IRQn must not be negative.
  1483. */
  1484. __STATIC_INLINE uint32_t TZ_NVIC_GetPendingIRQ_NS(IRQn_Type IRQn)
  1485. {
  1486. if ((int32_t)(IRQn) >= 0)
  1487. {
  1488. return((uint32_t)(((NVIC_NS->ISPR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
  1489. }
  1490. else
  1491. {
  1492. return(0U);
  1493. }
  1494. }
  1495. /**
  1496. \brief Set Pending Interrupt (non-secure)
  1497. \details Sets the pending bit of a device specific interrupt in the non-secure NVIC pending register when in secure state.
  1498. \param [in] IRQn Device specific interrupt number.
  1499. \note IRQn must not be negative.
  1500. */
  1501. __STATIC_INLINE void TZ_NVIC_SetPendingIRQ_NS(IRQn_Type IRQn)
  1502. {
  1503. if ((int32_t)(IRQn) >= 0)
  1504. {
  1505. NVIC_NS->ISPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
  1506. }
  1507. }
  1508. /**
  1509. \brief Clear Pending Interrupt (non-secure)
  1510. \details Clears the pending bit of a device specific interrupt in the non-secure NVIC pending register when in secure state.
  1511. \param [in] IRQn Device specific interrupt number.
  1512. \note IRQn must not be negative.
  1513. */
  1514. __STATIC_INLINE void TZ_NVIC_ClearPendingIRQ_NS(IRQn_Type IRQn)
  1515. {
  1516. if ((int32_t)(IRQn) >= 0)
  1517. {
  1518. NVIC_NS->ICPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
  1519. }
  1520. }
  1521. /**
  1522. \brief Get Active Interrupt (non-secure)
  1523. \details Reads the active register in non-secure NVIC when in secure state and returns the active bit for the device specific interrupt.
  1524. \param [in] IRQn Device specific interrupt number.
  1525. \return 0 Interrupt status is not active.
  1526. \return 1 Interrupt status is active.
  1527. \note IRQn must not be negative.
  1528. */
  1529. __STATIC_INLINE uint32_t TZ_NVIC_GetActive_NS(IRQn_Type IRQn)
  1530. {
  1531. if ((int32_t)(IRQn) >= 0)
  1532. {
  1533. return((uint32_t)(((NVIC_NS->IABR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
  1534. }
  1535. else
  1536. {
  1537. return(0U);
  1538. }
  1539. }
  1540. /**
  1541. \brief Set Interrupt Priority (non-secure)
  1542. \details Sets the priority of a non-secure device specific interrupt or a non-secure processor exception when in secure state.
  1543. The interrupt number can be positive to specify a device specific interrupt,
  1544. or negative to specify a processor exception.
  1545. \param [in] IRQn Interrupt number.
  1546. \param [in] priority Priority to set.
  1547. \note The priority cannot be set for every non-secure processor exception.
  1548. */
  1549. __STATIC_INLINE void TZ_NVIC_SetPriority_NS(IRQn_Type IRQn, uint32_t priority)
  1550. {
  1551. if ((int32_t)(IRQn) >= 0)
  1552. {
  1553. NVIC_NS->IPR[_IP_IDX(IRQn)] = ((uint32_t)(NVIC_NS->IPR[_IP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) |
  1554. (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn)));
  1555. }
  1556. else
  1557. {
  1558. SCB_NS->SHPR[_SHP_IDX(IRQn)] = ((uint32_t)(SCB_NS->SHPR[_SHP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) |
  1559. (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn)));
  1560. }
  1561. }
  1562. /**
  1563. \brief Get Interrupt Priority (non-secure)
  1564. \details Reads the priority of a non-secure device specific interrupt or a non-secure processor exception when in secure state.
  1565. The interrupt number can be positive to specify a device specific interrupt,
  1566. or negative to specify a processor exception.
  1567. \param [in] IRQn Interrupt number.
  1568. \return Interrupt Priority. Value is aligned automatically to the implemented priority bits of the microcontroller.
  1569. */
  1570. __STATIC_INLINE uint32_t TZ_NVIC_GetPriority_NS(IRQn_Type IRQn)
  1571. {
  1572. if ((int32_t)(IRQn) >= 0)
  1573. {
  1574. return((uint32_t)(((NVIC_NS->IPR[ _IP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS)));
  1575. }
  1576. else
  1577. {
  1578. return((uint32_t)(((SCB_NS->SHPR[_SHP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS)));
  1579. }
  1580. }
  1581. #endif /* defined (__ARM_FEATURE_CMSE) &&(__ARM_FEATURE_CMSE == 3U) */
  1582. /*@} end of CMSIS_Core_NVICFunctions */
  1583. /* ########################## MPU functions #################################### */
  1584. #if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U)
  1585. #include "mpu_armv8.h"
  1586. #endif
  1587. /* ########################## FPU functions #################################### */
  1588. /**
  1589. \ingroup CMSIS_Core_FunctionInterface
  1590. \defgroup CMSIS_Core_FpuFunctions FPU Functions
  1591. \brief Function that provides FPU type.
  1592. @{
  1593. */
  1594. /**
  1595. \brief get FPU type
  1596. \details returns the FPU type
  1597. \returns
  1598. - \b 0: No FPU
  1599. - \b 1: Single precision FPU
  1600. - \b 2: Double + Single precision FPU
  1601. */
  1602. __STATIC_INLINE uint32_t SCB_GetFPUType(void)
  1603. {
  1604. return 0U; /* No FPU */
  1605. }
  1606. /*@} end of CMSIS_Core_FpuFunctions */
  1607. /* ########################## SAU functions #################################### */
  1608. /**
  1609. \ingroup CMSIS_Core_FunctionInterface
  1610. \defgroup CMSIS_Core_SAUFunctions SAU Functions
  1611. \brief Functions that configure the SAU.
  1612. @{
  1613. */
  1614. #if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
  1615. /**
  1616. \brief Enable SAU
  1617. \details Enables the Security Attribution Unit (SAU).
  1618. */
  1619. __STATIC_INLINE void TZ_SAU_Enable(void)
  1620. {
  1621. SAU->CTRL |= (SAU_CTRL_ENABLE_Msk);
  1622. }
  1623. /**
  1624. \brief Disable SAU
  1625. \details Disables the Security Attribution Unit (SAU).
  1626. */
  1627. __STATIC_INLINE void TZ_SAU_Disable(void)
  1628. {
  1629. SAU->CTRL &= ~(SAU_CTRL_ENABLE_Msk);
  1630. }
  1631. #endif /* defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */
  1632. /*@} end of CMSIS_Core_SAUFunctions */
  1633. /* ################################## Debug Control function ############################################ */
  1634. /**
  1635. \ingroup CMSIS_Core_FunctionInterface
  1636. \defgroup CMSIS_Core_DCBFunctions Debug Control Functions
  1637. \brief Functions that access the Debug Control Block.
  1638. @{
  1639. */
  1640. /**
  1641. \brief Set Debug Authentication Control Register
  1642. \details writes to Debug Authentication Control register.
  1643. \param [in] value value to be writen.
  1644. */
  1645. __STATIC_INLINE void DCB_SetAuthCtrl(uint32_t value)
  1646. {
  1647. __DSB();
  1648. __ISB();
  1649. DCB->DAUTHCTRL = value;
  1650. __DSB();
  1651. __ISB();
  1652. }
  1653. /**
  1654. \brief Get Debug Authentication Control Register
  1655. \details Reads Debug Authentication Control register.
  1656. \return Debug Authentication Control Register.
  1657. */
  1658. __STATIC_INLINE uint32_t DCB_GetAuthCtrl(void)
  1659. {
  1660. return (DCB->DAUTHCTRL);
  1661. }
  1662. #if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
  1663. /**
  1664. \brief Set Debug Authentication Control Register (non-secure)
  1665. \details writes to non-secure Debug Authentication Control register when in secure state.
  1666. \param [in] value value to be writen
  1667. */
  1668. __STATIC_INLINE void TZ_DCB_SetAuthCtrl_NS(uint32_t value)
  1669. {
  1670. __DSB();
  1671. __ISB();
  1672. DCB_NS->DAUTHCTRL = value;
  1673. __DSB();
  1674. __ISB();
  1675. }
  1676. /**
  1677. \brief Get Debug Authentication Control Register (non-secure)
  1678. \details Reads non-secure Debug Authentication Control register when in secure state.
  1679. \return Debug Authentication Control Register.
  1680. */
  1681. __STATIC_INLINE uint32_t TZ_DCB_GetAuthCtrl_NS(void)
  1682. {
  1683. return (DCB_NS->DAUTHCTRL);
  1684. }
  1685. #endif /* defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */
  1686. /*@} end of CMSIS_Core_DCBFunctions */
  1687. /* ################################## Debug Identification function ############################################ */
  1688. /**
  1689. \ingroup CMSIS_Core_FunctionInterface
  1690. \defgroup CMSIS_Core_DIBFunctions Debug Identification Functions
  1691. \brief Functions that access the Debug Identification Block.
  1692. @{
  1693. */
  1694. /**
  1695. \brief Get Debug Authentication Status Register
  1696. \details Reads Debug Authentication Status register.
  1697. \return Debug Authentication Status Register.
  1698. */
  1699. __STATIC_INLINE uint32_t DIB_GetAuthStatus(void)
  1700. {
  1701. return (DIB->DAUTHSTATUS);
  1702. }
  1703. #if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
  1704. /**
  1705. \brief Get Debug Authentication Status Register (non-secure)
  1706. \details Reads non-secure Debug Authentication Status register when in secure state.
  1707. \return Debug Authentication Status Register.
  1708. */
  1709. __STATIC_INLINE uint32_t TZ_DIB_GetAuthStatus_NS(void)
  1710. {
  1711. return (DIB_NS->DAUTHSTATUS);
  1712. }
  1713. #endif /* defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */
  1714. /*@} end of CMSIS_Core_DCBFunctions */
  1715. /* ################################## SysTick function ############################################ */
  1716. /**
  1717. \ingroup CMSIS_Core_FunctionInterface
  1718. \defgroup CMSIS_Core_SysTickFunctions SysTick Functions
  1719. \brief Functions that configure the System.
  1720. @{
  1721. */
  1722. #if defined (__Vendor_SysTickConfig) && (__Vendor_SysTickConfig == 0U)
  1723. /**
  1724. \brief System Tick Configuration
  1725. \details Initializes the System Timer and its interrupt, and starts the System Tick Timer.
  1726. Counter is in free running mode to generate periodic interrupts.
  1727. \param [in] ticks Number of ticks between two interrupts.
  1728. \return 0 Function succeeded.
  1729. \return 1 Function failed.
  1730. \note When the variable <b>__Vendor_SysTickConfig</b> is set to 1, then the
  1731. function <b>SysTick_Config</b> is not included. In this case, the file <b><i>device</i>.h</b>
  1732. must contain a vendor-specific implementation of this function.
  1733. */
  1734. __STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks)
  1735. {
  1736. if ((ticks - 1UL) > SysTick_LOAD_RELOAD_Msk)
  1737. {
  1738. return (1UL); /* Reload value impossible */
  1739. }
  1740. SysTick->LOAD = (uint32_t)(ticks - 1UL); /* set reload register */
  1741. NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */
  1742. SysTick->VAL = 0UL; /* Load the SysTick Counter Value */
  1743. SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk |
  1744. SysTick_CTRL_TICKINT_Msk |
  1745. SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */
  1746. return (0UL); /* Function successful */
  1747. }
  1748. #if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
  1749. /**
  1750. \brief System Tick Configuration (non-secure)
  1751. \details Initializes the non-secure System Timer and its interrupt when in secure state, and starts the System Tick Timer.
  1752. Counter is in free running mode to generate periodic interrupts.
  1753. \param [in] ticks Number of ticks between two interrupts.
  1754. \return 0 Function succeeded.
  1755. \return 1 Function failed.
  1756. \note When the variable <b>__Vendor_SysTickConfig</b> is set to 1, then the
  1757. function <b>TZ_SysTick_Config_NS</b> is not included. In this case, the file <b><i>device</i>.h</b>
  1758. must contain a vendor-specific implementation of this function.
  1759. */
  1760. __STATIC_INLINE uint32_t TZ_SysTick_Config_NS(uint32_t ticks)
  1761. {
  1762. if ((ticks - 1UL) > SysTick_LOAD_RELOAD_Msk)
  1763. {
  1764. return (1UL); /* Reload value impossible */
  1765. }
  1766. SysTick_NS->LOAD = (uint32_t)(ticks - 1UL); /* set reload register */
  1767. TZ_NVIC_SetPriority_NS (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */
  1768. SysTick_NS->VAL = 0UL; /* Load the SysTick Counter Value */
  1769. SysTick_NS->CTRL = SysTick_CTRL_CLKSOURCE_Msk |
  1770. SysTick_CTRL_TICKINT_Msk |
  1771. SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */
  1772. return (0UL); /* Function successful */
  1773. }
  1774. #endif /* defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */
  1775. #endif
  1776. /*@} end of CMSIS_Core_SysTickFunctions */
  1777. #ifdef __cplusplus
  1778. }
  1779. #endif
  1780. #endif /* __CORE_ARMV8MBL_H_DEPENDANT */
  1781. #endif /* __CMSIS_GENERIC */