Naze32 clone with Frysky receiver
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

core_cm7.h 133KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397
  1. /**************************************************************************//**
  2. * @file core_cm7.h
  3. * @brief CMSIS Cortex-M7 Core Peripheral Access Layer Header File
  4. * @version V4.10
  5. * @date 18. March 2015
  6. *
  7. * @note
  8. *
  9. ******************************************************************************/
  10. /* Copyright (c) 2009 - 2015 ARM LIMITED
  11. All rights reserved.
  12. Redistribution and use in source and binary forms, with or without
  13. modification, are permitted provided that the following conditions are met:
  14. - Redistributions of source code must retain the above copyright
  15. notice, this list of conditions and the following disclaimer.
  16. - Redistributions in binary form must reproduce the above copyright
  17. notice, this list of conditions and the following disclaimer in the
  18. documentation and/or other materials provided with the distribution.
  19. - Neither the name of ARM nor the names of its contributors may be used
  20. to endorse or promote products derived from this software without
  21. specific prior written permission.
  22. *
  23. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  24. AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  25. IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  26. ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
  27. LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  28. CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  29. SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  30. INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  31. CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  32. ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  33. POSSIBILITY OF SUCH DAMAGE.
  34. ---------------------------------------------------------------------------*/
  35. #if defined ( __ICCARM__ )
  36. #pragma system_include /* treat file as system include file for MISRA check */
  37. #endif
  38. #ifndef __CORE_CM7_H_GENERIC
  39. #define __CORE_CM7_H_GENERIC
  40. #ifdef __cplusplus
  41. extern "C" {
  42. #endif
  43. /** \page CMSIS_MISRA_Exceptions MISRA-C:2004 Compliance Exceptions
  44. CMSIS violates the following MISRA-C:2004 rules:
  45. \li Required Rule 8.5, object/function definition in header file.<br>
  46. Function definitions in header files are used to allow 'inlining'.
  47. \li Required Rule 18.4, declaration of union type or object of union type: '{...}'.<br>
  48. Unions are used for effective representation of core registers.
  49. \li Advisory Rule 19.7, Function-like macro defined.<br>
  50. Function-like macros are used to allow more efficient code.
  51. */
  52. /*******************************************************************************
  53. * CMSIS definitions
  54. ******************************************************************************/
  55. /** \ingroup Cortex_M7
  56. @{
  57. */
  58. /* CMSIS CM7 definitions */
  59. #define __CM7_CMSIS_VERSION_MAIN (0x04) /*!< [31:16] CMSIS HAL main version */
  60. #define __CM7_CMSIS_VERSION_SUB (0x00) /*!< [15:0] CMSIS HAL sub version */
  61. #define __CM7_CMSIS_VERSION ((__CM7_CMSIS_VERSION_MAIN << 16) | \
  62. __CM7_CMSIS_VERSION_SUB ) /*!< CMSIS HAL version number */
  63. #define __CORTEX_M (0x07) /*!< Cortex-M Core */
  64. #if defined ( __CC_ARM )
  65. #define __ASM __asm /*!< asm keyword for ARM Compiler */
  66. #define __INLINE __inline /*!< inline keyword for ARM Compiler */
  67. #define __STATIC_INLINE static __inline
  68. #elif defined ( __GNUC__ )
  69. #define __ASM __asm /*!< asm keyword for GNU Compiler */
  70. #define __INLINE inline /*!< inline keyword for GNU Compiler */
  71. #define __STATIC_INLINE static inline
  72. #elif defined ( __ICCARM__ )
  73. #define __ASM __asm /*!< asm keyword for IAR Compiler */
  74. #define __INLINE inline /*!< inline keyword for IAR Compiler. Only available in High optimization mode! */
  75. #define __STATIC_INLINE static inline
  76. #elif defined ( __TMS470__ )
  77. #define __ASM __asm /*!< asm keyword for TI CCS Compiler */
  78. #define __STATIC_INLINE static inline
  79. #elif defined ( __TASKING__ )
  80. #define __ASM __asm /*!< asm keyword for TASKING Compiler */
  81. #define __INLINE inline /*!< inline keyword for TASKING Compiler */
  82. #define __STATIC_INLINE static inline
  83. #elif defined ( __CSMC__ )
  84. #define __packed
  85. #define __ASM _asm /*!< asm keyword for COSMIC Compiler */
  86. #define __INLINE inline /*use -pc99 on compile line !< inline keyword for COSMIC Compiler */
  87. #define __STATIC_INLINE static inline
  88. #endif
  89. /** __FPU_USED indicates whether an FPU is used or not.
  90. For this, __FPU_PRESENT has to be checked prior to making use of FPU specific registers and functions.
  91. */
  92. #if defined ( __CC_ARM )
  93. #if defined __TARGET_FPU_VFP
  94. #if (__FPU_PRESENT == 1)
  95. #define __FPU_USED 1
  96. #else
  97. #warning "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
  98. #define __FPU_USED 0
  99. #endif
  100. #else
  101. #define __FPU_USED 0
  102. #endif
  103. #elif defined ( __GNUC__ )
  104. #if defined (__VFP_FP__) && !defined(__SOFTFP__)
  105. #if (__FPU_PRESENT == 1)
  106. #define __FPU_USED 1
  107. #else
  108. #warning "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
  109. #define __FPU_USED 0
  110. #endif
  111. #else
  112. #define __FPU_USED 0
  113. #endif
  114. #elif defined ( __ICCARM__ )
  115. #if defined __ARMVFP__
  116. #if (__FPU_PRESENT == 1)
  117. #define __FPU_USED 1
  118. #else
  119. #warning "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
  120. #define __FPU_USED 0
  121. #endif
  122. #else
  123. #define __FPU_USED 0
  124. #endif
  125. #elif defined ( __TMS470__ )
  126. #if defined __TI_VFP_SUPPORT__
  127. #if (__FPU_PRESENT == 1)
  128. #define __FPU_USED 1
  129. #else
  130. #warning "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
  131. #define __FPU_USED 0
  132. #endif
  133. #else
  134. #define __FPU_USED 0
  135. #endif
  136. #elif defined ( __TASKING__ )
  137. #if defined __FPU_VFP__
  138. #if (__FPU_PRESENT == 1)
  139. #define __FPU_USED 1
  140. #else
  141. #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
  142. #define __FPU_USED 0
  143. #endif
  144. #else
  145. #define __FPU_USED 0
  146. #endif
  147. #elif defined ( __CSMC__ ) /* Cosmic */
  148. #if ( __CSMC__ & 0x400) // FPU present for parser
  149. #if (__FPU_PRESENT == 1)
  150. #define __FPU_USED 1
  151. #else
  152. #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
  153. #define __FPU_USED 0
  154. #endif
  155. #else
  156. #define __FPU_USED 0
  157. #endif
  158. #endif
  159. #include <stdint.h> /* standard types definitions */
  160. #include <core_cmInstr.h> /* Core Instruction Access */
  161. #include <core_cmFunc.h> /* Core Function Access */
  162. #include <core_cmSimd.h> /* Compiler specific SIMD Intrinsics */
  163. #ifdef __cplusplus
  164. }
  165. #endif
  166. #endif /* __CORE_CM7_H_GENERIC */
  167. #ifndef __CMSIS_GENERIC
  168. #ifndef __CORE_CM7_H_DEPENDANT
  169. #define __CORE_CM7_H_DEPENDANT
  170. #ifdef __cplusplus
  171. extern "C" {
  172. #endif
  173. /* check device defines and use defaults */
  174. #if defined __CHECK_DEVICE_DEFINES
  175. #ifndef __CM7_REV
  176. #define __CM7_REV 0x0000
  177. #warning "__CM7_REV not defined in device header file; using default!"
  178. #endif
  179. #ifndef __FPU_PRESENT
  180. #define __FPU_PRESENT 0
  181. #warning "__FPU_PRESENT not defined in device header file; using default!"
  182. #endif
  183. #ifndef __MPU_PRESENT
  184. #define __MPU_PRESENT 0
  185. #warning "__MPU_PRESENT not defined in device header file; using default!"
  186. #endif
  187. #ifndef __ICACHE_PRESENT
  188. #define __ICACHE_PRESENT 0
  189. #warning "__ICACHE_PRESENT not defined in device header file; using default!"
  190. #endif
  191. #ifndef __DCACHE_PRESENT
  192. #define __DCACHE_PRESENT 0
  193. #warning "__DCACHE_PRESENT not defined in device header file; using default!"
  194. #endif
  195. #ifndef __DTCM_PRESENT
  196. #define __DTCM_PRESENT 0
  197. #warning "__DTCM_PRESENT not defined in device header file; using default!"
  198. #endif
  199. #ifndef __NVIC_PRIO_BITS
  200. #define __NVIC_PRIO_BITS 3
  201. #warning "__NVIC_PRIO_BITS not defined in device header file; using default!"
  202. #endif
  203. #ifndef __Vendor_SysTickConfig
  204. #define __Vendor_SysTickConfig 0
  205. #warning "__Vendor_SysTickConfig not defined in device header file; using default!"
  206. #endif
  207. #endif
  208. /* IO definitions (access restrictions to peripheral registers) */
  209. /**
  210. \defgroup CMSIS_glob_defs CMSIS Global Defines
  211. <strong>IO Type Qualifiers</strong> are used
  212. \li to specify the access to peripheral variables.
  213. \li for automatic generation of peripheral register debug information.
  214. */
  215. #ifdef __cplusplus
  216. #define __I volatile /*!< Defines 'read only' permissions */
  217. #else
  218. #define __I volatile const /*!< Defines 'read only' permissions */
  219. #endif
  220. #define __O volatile /*!< Defines 'write only' permissions */
  221. #define __IO volatile /*!< Defines 'read / write' permissions */
  222. /*@} end of group Cortex_M7 */
  223. /*******************************************************************************
  224. * Register Abstraction
  225. Core Register contain:
  226. - Core Register
  227. - Core NVIC Register
  228. - Core SCB Register
  229. - Core SysTick Register
  230. - Core Debug Register
  231. - Core MPU Register
  232. - Core FPU Register
  233. ******************************************************************************/
  234. /** \defgroup CMSIS_core_register Defines and Type Definitions
  235. \brief Type definitions and defines for Cortex-M processor based devices.
  236. */
  237. /** \ingroup CMSIS_core_register
  238. \defgroup CMSIS_CORE Status and Control Registers
  239. \brief Core Register type definitions.
  240. @{
  241. */
  242. /** \brief Union type to access the Application Program Status Register (APSR).
  243. */
  244. typedef union
  245. {
  246. struct
  247. {
  248. uint32_t _reserved0:16; /*!< bit: 0..15 Reserved */
  249. uint32_t GE:4; /*!< bit: 16..19 Greater than or Equal flags */
  250. uint32_t _reserved1:7; /*!< bit: 20..26 Reserved */
  251. uint32_t Q:1; /*!< bit: 27 Saturation condition flag */
  252. uint32_t V:1; /*!< bit: 28 Overflow condition code flag */
  253. uint32_t C:1; /*!< bit: 29 Carry condition code flag */
  254. uint32_t Z:1; /*!< bit: 30 Zero condition code flag */
  255. uint32_t N:1; /*!< bit: 31 Negative condition code flag */
  256. } b; /*!< Structure used for bit access */
  257. uint32_t w; /*!< Type used for word access */
  258. } APSR_Type;
  259. /* APSR Register Definitions */
  260. #define APSR_N_Pos 31 /*!< APSR: N Position */
  261. #define APSR_N_Msk (1UL << APSR_N_Pos) /*!< APSR: N Mask */
  262. #define APSR_Z_Pos 30 /*!< APSR: Z Position */
  263. #define APSR_Z_Msk (1UL << APSR_Z_Pos) /*!< APSR: Z Mask */
  264. #define APSR_C_Pos 29 /*!< APSR: C Position */
  265. #define APSR_C_Msk (1UL << APSR_C_Pos) /*!< APSR: C Mask */
  266. #define APSR_V_Pos 28 /*!< APSR: V Position */
  267. #define APSR_V_Msk (1UL << APSR_V_Pos) /*!< APSR: V Mask */
  268. #define APSR_Q_Pos 27 /*!< APSR: Q Position */
  269. #define APSR_Q_Msk (1UL << APSR_Q_Pos) /*!< APSR: Q Mask */
  270. #define APSR_GE_Pos 16 /*!< APSR: GE Position */
  271. #define APSR_GE_Msk (0xFUL << APSR_GE_Pos) /*!< APSR: GE Mask */
  272. /** \brief Union type to access the Interrupt Program Status Register (IPSR).
  273. */
  274. typedef union
  275. {
  276. struct
  277. {
  278. uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */
  279. uint32_t _reserved0:23; /*!< bit: 9..31 Reserved */
  280. } b; /*!< Structure used for bit access */
  281. uint32_t w; /*!< Type used for word access */
  282. } IPSR_Type;
  283. /* IPSR Register Definitions */
  284. #define IPSR_ISR_Pos 0 /*!< IPSR: ISR Position */
  285. #define IPSR_ISR_Msk (0x1FFUL /*<< IPSR_ISR_Pos*/) /*!< IPSR: ISR Mask */
  286. /** \brief Union type to access the Special-Purpose Program Status Registers (xPSR).
  287. */
  288. typedef union
  289. {
  290. struct
  291. {
  292. uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */
  293. uint32_t _reserved0:7; /*!< bit: 9..15 Reserved */
  294. uint32_t GE:4; /*!< bit: 16..19 Greater than or Equal flags */
  295. uint32_t _reserved1:4; /*!< bit: 20..23 Reserved */
  296. uint32_t T:1; /*!< bit: 24 Thumb bit (read 0) */
  297. uint32_t IT:2; /*!< bit: 25..26 saved IT state (read 0) */
  298. uint32_t Q:1; /*!< bit: 27 Saturation condition flag */
  299. uint32_t V:1; /*!< bit: 28 Overflow condition code flag */
  300. uint32_t C:1; /*!< bit: 29 Carry condition code flag */
  301. uint32_t Z:1; /*!< bit: 30 Zero condition code flag */
  302. uint32_t N:1; /*!< bit: 31 Negative condition code flag */
  303. } b; /*!< Structure used for bit access */
  304. uint32_t w; /*!< Type used for word access */
  305. } xPSR_Type;
  306. /* xPSR Register Definitions */
  307. #define xPSR_N_Pos 31 /*!< xPSR: N Position */
  308. #define xPSR_N_Msk (1UL << xPSR_N_Pos) /*!< xPSR: N Mask */
  309. #define xPSR_Z_Pos 30 /*!< xPSR: Z Position */
  310. #define xPSR_Z_Msk (1UL << xPSR_Z_Pos) /*!< xPSR: Z Mask */
  311. #define xPSR_C_Pos 29 /*!< xPSR: C Position */
  312. #define xPSR_C_Msk (1UL << xPSR_C_Pos) /*!< xPSR: C Mask */
  313. #define xPSR_V_Pos 28 /*!< xPSR: V Position */
  314. #define xPSR_V_Msk (1UL << xPSR_V_Pos) /*!< xPSR: V Mask */
  315. #define xPSR_Q_Pos 27 /*!< xPSR: Q Position */
  316. #define xPSR_Q_Msk (1UL << xPSR_Q_Pos) /*!< xPSR: Q Mask */
  317. #define xPSR_IT_Pos 25 /*!< xPSR: IT Position */
  318. #define xPSR_IT_Msk (3UL << xPSR_IT_Pos) /*!< xPSR: IT Mask */
  319. #define xPSR_T_Pos 24 /*!< xPSR: T Position */
  320. #define xPSR_T_Msk (1UL << xPSR_T_Pos) /*!< xPSR: T Mask */
  321. #define xPSR_GE_Pos 16 /*!< xPSR: GE Position */
  322. #define xPSR_GE_Msk (0xFUL << xPSR_GE_Pos) /*!< xPSR: GE Mask */
  323. #define xPSR_ISR_Pos 0 /*!< xPSR: ISR Position */
  324. #define xPSR_ISR_Msk (0x1FFUL /*<< xPSR_ISR_Pos*/) /*!< xPSR: ISR Mask */
  325. /** \brief Union type to access the Control Registers (CONTROL).
  326. */
  327. typedef union
  328. {
  329. struct
  330. {
  331. uint32_t nPRIV:1; /*!< bit: 0 Execution privilege in Thread mode */
  332. uint32_t SPSEL:1; /*!< bit: 1 Stack to be used */
  333. uint32_t FPCA:1; /*!< bit: 2 FP extension active flag */
  334. uint32_t _reserved0:29; /*!< bit: 3..31 Reserved */
  335. } b; /*!< Structure used for bit access */
  336. uint32_t w; /*!< Type used for word access */
  337. } CONTROL_Type;
  338. /* CONTROL Register Definitions */
  339. #define CONTROL_FPCA_Pos 2 /*!< CONTROL: FPCA Position */
  340. #define CONTROL_FPCA_Msk (1UL << CONTROL_FPCA_Pos) /*!< CONTROL: FPCA Mask */
  341. #define CONTROL_SPSEL_Pos 1 /*!< CONTROL: SPSEL Position */
  342. #define CONTROL_SPSEL_Msk (1UL << CONTROL_SPSEL_Pos) /*!< CONTROL: SPSEL Mask */
  343. #define CONTROL_nPRIV_Pos 0 /*!< CONTROL: nPRIV Position */
  344. #define CONTROL_nPRIV_Msk (1UL /*<< CONTROL_nPRIV_Pos*/) /*!< CONTROL: nPRIV Mask */
  345. /*@} end of group CMSIS_CORE */
  346. /** \ingroup CMSIS_core_register
  347. \defgroup CMSIS_NVIC Nested Vectored Interrupt Controller (NVIC)
  348. \brief Type definitions for the NVIC Registers
  349. @{
  350. */
  351. /** \brief Structure type to access the Nested Vectored Interrupt Controller (NVIC).
  352. */
  353. typedef struct
  354. {
  355. __IO uint32_t ISER[8]; /*!< Offset: 0x000 (R/W) Interrupt Set Enable Register */
  356. uint32_t RESERVED0[24];
  357. __IO uint32_t ICER[8]; /*!< Offset: 0x080 (R/W) Interrupt Clear Enable Register */
  358. uint32_t RSERVED1[24];
  359. __IO uint32_t ISPR[8]; /*!< Offset: 0x100 (R/W) Interrupt Set Pending Register */
  360. uint32_t RESERVED2[24];
  361. __IO uint32_t ICPR[8]; /*!< Offset: 0x180 (R/W) Interrupt Clear Pending Register */
  362. uint32_t RESERVED3[24];
  363. __IO uint32_t IABR[8]; /*!< Offset: 0x200 (R/W) Interrupt Active bit Register */
  364. uint32_t RESERVED4[56];
  365. __IO uint8_t IP[240]; /*!< Offset: 0x300 (R/W) Interrupt Priority Register (8Bit wide) */
  366. uint32_t RESERVED5[644];
  367. __O uint32_t STIR; /*!< Offset: 0xE00 ( /W) Software Trigger Interrupt Register */
  368. } NVIC_Type;
  369. /* Software Triggered Interrupt Register Definitions */
  370. #define NVIC_STIR_INTID_Pos 0 /*!< STIR: INTLINESNUM Position */
  371. #define NVIC_STIR_INTID_Msk (0x1FFUL /*<< NVIC_STIR_INTID_Pos*/) /*!< STIR: INTLINESNUM Mask */
  372. /*@} end of group CMSIS_NVIC */
  373. /** \ingroup CMSIS_core_register
  374. \defgroup CMSIS_SCB System Control Block (SCB)
  375. \brief Type definitions for the System Control Block Registers
  376. @{
  377. */
  378. /** \brief Structure type to access the System Control Block (SCB).
  379. */
  380. typedef struct
  381. {
  382. __I uint32_t CPUID; /*!< Offset: 0x000 (R/ ) CPUID Base Register */
  383. __IO uint32_t ICSR; /*!< Offset: 0x004 (R/W) Interrupt Control and State Register */
  384. __IO uint32_t VTOR; /*!< Offset: 0x008 (R/W) Vector Table Offset Register */
  385. __IO uint32_t AIRCR; /*!< Offset: 0x00C (R/W) Application Interrupt and Reset Control Register */
  386. __IO uint32_t SCR; /*!< Offset: 0x010 (R/W) System Control Register */
  387. __IO uint32_t CCR; /*!< Offset: 0x014 (R/W) Configuration Control Register */
  388. __IO uint8_t SHPR[12]; /*!< Offset: 0x018 (R/W) System Handlers Priority Registers (4-7, 8-11, 12-15) */
  389. __IO uint32_t SHCSR; /*!< Offset: 0x024 (R/W) System Handler Control and State Register */
  390. __IO uint32_t CFSR; /*!< Offset: 0x028 (R/W) Configurable Fault Status Register */
  391. __IO uint32_t HFSR; /*!< Offset: 0x02C (R/W) HardFault Status Register */
  392. __IO uint32_t DFSR; /*!< Offset: 0x030 (R/W) Debug Fault Status Register */
  393. __IO uint32_t MMFAR; /*!< Offset: 0x034 (R/W) MemManage Fault Address Register */
  394. __IO uint32_t BFAR; /*!< Offset: 0x038 (R/W) BusFault Address Register */
  395. __IO uint32_t AFSR; /*!< Offset: 0x03C (R/W) Auxiliary Fault Status Register */
  396. __I uint32_t ID_PFR[2]; /*!< Offset: 0x040 (R/ ) Processor Feature Register */
  397. __I uint32_t ID_DFR; /*!< Offset: 0x048 (R/ ) Debug Feature Register */
  398. __I uint32_t ID_AFR; /*!< Offset: 0x04C (R/ ) Auxiliary Feature Register */
  399. __I uint32_t ID_MFR[4]; /*!< Offset: 0x050 (R/ ) Memory Model Feature Register */
  400. __I uint32_t ID_ISAR[5]; /*!< Offset: 0x060 (R/ ) Instruction Set Attributes Register */
  401. uint32_t RESERVED0[1];
  402. __I uint32_t CLIDR; /*!< Offset: 0x078 (R/ ) Cache Level ID register */
  403. __I uint32_t CTR; /*!< Offset: 0x07C (R/ ) Cache Type register */
  404. __I uint32_t CCSIDR; /*!< Offset: 0x080 (R/ ) Cache Size ID Register */
  405. __IO uint32_t CSSELR; /*!< Offset: 0x084 (R/W) Cache Size Selection Register */
  406. __IO uint32_t CPACR; /*!< Offset: 0x088 (R/W) Coprocessor Access Control Register */
  407. uint32_t RESERVED3[93];
  408. __O uint32_t STIR; /*!< Offset: 0x200 ( /W) Software Triggered Interrupt Register */
  409. uint32_t RESERVED4[15];
  410. __I uint32_t MVFR0; /*!< Offset: 0x240 (R/ ) Media and VFP Feature Register 0 */
  411. __I uint32_t MVFR1; /*!< Offset: 0x244 (R/ ) Media and VFP Feature Register 1 */
  412. __I uint32_t MVFR2; /*!< Offset: 0x248 (R/ ) Media and VFP Feature Register 1 */
  413. uint32_t RESERVED5[1];
  414. __O uint32_t ICIALLU; /*!< Offset: 0x250 ( /W) I-Cache Invalidate All to PoU */
  415. uint32_t RESERVED6[1];
  416. __O uint32_t ICIMVAU; /*!< Offset: 0x258 ( /W) I-Cache Invalidate by MVA to PoU */
  417. __O uint32_t DCIMVAC; /*!< Offset: 0x25C ( /W) D-Cache Invalidate by MVA to PoC */
  418. __O uint32_t DCISW; /*!< Offset: 0x260 ( /W) D-Cache Invalidate by Set-way */
  419. __O uint32_t DCCMVAU; /*!< Offset: 0x264 ( /W) D-Cache Clean by MVA to PoU */
  420. __O uint32_t DCCMVAC; /*!< Offset: 0x268 ( /W) D-Cache Clean by MVA to PoC */
  421. __O uint32_t DCCSW; /*!< Offset: 0x26C ( /W) D-Cache Clean by Set-way */
  422. __O uint32_t DCCIMVAC; /*!< Offset: 0x270 ( /W) D-Cache Clean and Invalidate by MVA to PoC */
  423. __O uint32_t DCCISW; /*!< Offset: 0x274 ( /W) D-Cache Clean and Invalidate by Set-way */
  424. uint32_t RESERVED7[6];
  425. __IO uint32_t ITCMCR; /*!< Offset: 0x290 (R/W) Instruction Tightly-Coupled Memory Control Register */
  426. __IO uint32_t DTCMCR; /*!< Offset: 0x294 (R/W) Data Tightly-Coupled Memory Control Registers */
  427. __IO uint32_t AHBPCR; /*!< Offset: 0x298 (R/W) AHBP Control Register */
  428. __IO uint32_t CACR; /*!< Offset: 0x29C (R/W) L1 Cache Control Register */
  429. __IO uint32_t AHBSCR; /*!< Offset: 0x2A0 (R/W) AHB Slave Control Register */
  430. uint32_t RESERVED8[1];
  431. __IO uint32_t ABFSR; /*!< Offset: 0x2A8 (R/W) Auxiliary Bus Fault Status Register */
  432. } SCB_Type;
  433. /* SCB CPUID Register Definitions */
  434. #define SCB_CPUID_IMPLEMENTER_Pos 24 /*!< SCB CPUID: IMPLEMENTER Position */
  435. #define SCB_CPUID_IMPLEMENTER_Msk (0xFFUL << SCB_CPUID_IMPLEMENTER_Pos) /*!< SCB CPUID: IMPLEMENTER Mask */
  436. #define SCB_CPUID_VARIANT_Pos 20 /*!< SCB CPUID: VARIANT Position */
  437. #define SCB_CPUID_VARIANT_Msk (0xFUL << SCB_CPUID_VARIANT_Pos) /*!< SCB CPUID: VARIANT Mask */
  438. #define SCB_CPUID_ARCHITECTURE_Pos 16 /*!< SCB CPUID: ARCHITECTURE Position */
  439. #define SCB_CPUID_ARCHITECTURE_Msk (0xFUL << SCB_CPUID_ARCHITECTURE_Pos) /*!< SCB CPUID: ARCHITECTURE Mask */
  440. #define SCB_CPUID_PARTNO_Pos 4 /*!< SCB CPUID: PARTNO Position */
  441. #define SCB_CPUID_PARTNO_Msk (0xFFFUL << SCB_CPUID_PARTNO_Pos) /*!< SCB CPUID: PARTNO Mask */
  442. #define SCB_CPUID_REVISION_Pos 0 /*!< SCB CPUID: REVISION Position */
  443. #define SCB_CPUID_REVISION_Msk (0xFUL /*<< SCB_CPUID_REVISION_Pos*/) /*!< SCB CPUID: REVISION Mask */
  444. /* SCB Interrupt Control State Register Definitions */
  445. #define SCB_ICSR_NMIPENDSET_Pos 31 /*!< SCB ICSR: NMIPENDSET Position */
  446. #define SCB_ICSR_NMIPENDSET_Msk (1UL << SCB_ICSR_NMIPENDSET_Pos) /*!< SCB ICSR: NMIPENDSET Mask */
  447. #define SCB_ICSR_PENDSVSET_Pos 28 /*!< SCB ICSR: PENDSVSET Position */
  448. #define SCB_ICSR_PENDSVSET_Msk (1UL << SCB_ICSR_PENDSVSET_Pos) /*!< SCB ICSR: PENDSVSET Mask */
  449. #define SCB_ICSR_PENDSVCLR_Pos 27 /*!< SCB ICSR: PENDSVCLR Position */
  450. #define SCB_ICSR_PENDSVCLR_Msk (1UL << SCB_ICSR_PENDSVCLR_Pos) /*!< SCB ICSR: PENDSVCLR Mask */
  451. #define SCB_ICSR_PENDSTSET_Pos 26 /*!< SCB ICSR: PENDSTSET Position */
  452. #define SCB_ICSR_PENDSTSET_Msk (1UL << SCB_ICSR_PENDSTSET_Pos) /*!< SCB ICSR: PENDSTSET Mask */
  453. #define SCB_ICSR_PENDSTCLR_Pos 25 /*!< SCB ICSR: PENDSTCLR Position */
  454. #define SCB_ICSR_PENDSTCLR_Msk (1UL << SCB_ICSR_PENDSTCLR_Pos) /*!< SCB ICSR: PENDSTCLR Mask */
  455. #define SCB_ICSR_ISRPREEMPT_Pos 23 /*!< SCB ICSR: ISRPREEMPT Position */
  456. #define SCB_ICSR_ISRPREEMPT_Msk (1UL << SCB_ICSR_ISRPREEMPT_Pos) /*!< SCB ICSR: ISRPREEMPT Mask */
  457. #define SCB_ICSR_ISRPENDING_Pos 22 /*!< SCB ICSR: ISRPENDING Position */
  458. #define SCB_ICSR_ISRPENDING_Msk (1UL << SCB_ICSR_ISRPENDING_Pos) /*!< SCB ICSR: ISRPENDING Mask */
  459. #define SCB_ICSR_VECTPENDING_Pos 12 /*!< SCB ICSR: VECTPENDING Position */
  460. #define SCB_ICSR_VECTPENDING_Msk (0x1FFUL << SCB_ICSR_VECTPENDING_Pos) /*!< SCB ICSR: VECTPENDING Mask */
  461. #define SCB_ICSR_RETTOBASE_Pos 11 /*!< SCB ICSR: RETTOBASE Position */
  462. #define SCB_ICSR_RETTOBASE_Msk (1UL << SCB_ICSR_RETTOBASE_Pos) /*!< SCB ICSR: RETTOBASE Mask */
  463. #define SCB_ICSR_VECTACTIVE_Pos 0 /*!< SCB ICSR: VECTACTIVE Position */
  464. #define SCB_ICSR_VECTACTIVE_Msk (0x1FFUL /*<< SCB_ICSR_VECTACTIVE_Pos*/) /*!< SCB ICSR: VECTACTIVE Mask */
  465. /* SCB Vector Table Offset Register Definitions */
  466. #define SCB_VTOR_TBLOFF_Pos 7 /*!< SCB VTOR: TBLOFF Position */
  467. #define SCB_VTOR_TBLOFF_Msk (0x1FFFFFFUL << SCB_VTOR_TBLOFF_Pos) /*!< SCB VTOR: TBLOFF Mask */
  468. /* SCB Application Interrupt and Reset Control Register Definitions */
  469. #define SCB_AIRCR_VECTKEY_Pos 16 /*!< SCB AIRCR: VECTKEY Position */
  470. #define SCB_AIRCR_VECTKEY_Msk (0xFFFFUL << SCB_AIRCR_VECTKEY_Pos) /*!< SCB AIRCR: VECTKEY Mask */
  471. #define SCB_AIRCR_VECTKEYSTAT_Pos 16 /*!< SCB AIRCR: VECTKEYSTAT Position */
  472. #define SCB_AIRCR_VECTKEYSTAT_Msk (0xFFFFUL << SCB_AIRCR_VECTKEYSTAT_Pos) /*!< SCB AIRCR: VECTKEYSTAT Mask */
  473. #define SCB_AIRCR_ENDIANESS_Pos 15 /*!< SCB AIRCR: ENDIANESS Position */
  474. #define SCB_AIRCR_ENDIANESS_Msk (1UL << SCB_AIRCR_ENDIANESS_Pos) /*!< SCB AIRCR: ENDIANESS Mask */
  475. #define SCB_AIRCR_PRIGROUP_Pos 8 /*!< SCB AIRCR: PRIGROUP Position */
  476. #define SCB_AIRCR_PRIGROUP_Msk (7UL << SCB_AIRCR_PRIGROUP_Pos) /*!< SCB AIRCR: PRIGROUP Mask */
  477. #define SCB_AIRCR_SYSRESETREQ_Pos 2 /*!< SCB AIRCR: SYSRESETREQ Position */
  478. #define SCB_AIRCR_SYSRESETREQ_Msk (1UL << SCB_AIRCR_SYSRESETREQ_Pos) /*!< SCB AIRCR: SYSRESETREQ Mask */
  479. #define SCB_AIRCR_VECTCLRACTIVE_Pos 1 /*!< SCB AIRCR: VECTCLRACTIVE Position */
  480. #define SCB_AIRCR_VECTCLRACTIVE_Msk (1UL << SCB_AIRCR_VECTCLRACTIVE_Pos) /*!< SCB AIRCR: VECTCLRACTIVE Mask */
  481. #define SCB_AIRCR_VECTRESET_Pos 0 /*!< SCB AIRCR: VECTRESET Position */
  482. #define SCB_AIRCR_VECTRESET_Msk (1UL /*<< SCB_AIRCR_VECTRESET_Pos*/) /*!< SCB AIRCR: VECTRESET Mask */
  483. /* SCB System Control Register Definitions */
  484. #define SCB_SCR_SEVONPEND_Pos 4 /*!< SCB SCR: SEVONPEND Position */
  485. #define SCB_SCR_SEVONPEND_Msk (1UL << SCB_SCR_SEVONPEND_Pos) /*!< SCB SCR: SEVONPEND Mask */
  486. #define SCB_SCR_SLEEPDEEP_Pos 2 /*!< SCB SCR: SLEEPDEEP Position */
  487. #define SCB_SCR_SLEEPDEEP_Msk (1UL << SCB_SCR_SLEEPDEEP_Pos) /*!< SCB SCR: SLEEPDEEP Mask */
  488. #define SCB_SCR_SLEEPONEXIT_Pos 1 /*!< SCB SCR: SLEEPONEXIT Position */
  489. #define SCB_SCR_SLEEPONEXIT_Msk (1UL << SCB_SCR_SLEEPONEXIT_Pos) /*!< SCB SCR: SLEEPONEXIT Mask */
  490. /* SCB Configuration Control Register Definitions */
  491. #define SCB_CCR_BP_Pos 18 /*!< SCB CCR: Branch prediction enable bit Position */
  492. #define SCB_CCR_BP_Msk (1UL << SCB_CCR_BP_Pos) /*!< SCB CCR: Branch prediction enable bit Mask */
  493. #define SCB_CCR_IC_Pos 17 /*!< SCB CCR: Instruction cache enable bit Position */
  494. #define SCB_CCR_IC_Msk (1UL << SCB_CCR_IC_Pos) /*!< SCB CCR: Instruction cache enable bit Mask */
  495. #define SCB_CCR_DC_Pos 16 /*!< SCB CCR: Cache enable bit Position */
  496. #define SCB_CCR_DC_Msk (1UL << SCB_CCR_DC_Pos) /*!< SCB CCR: Cache enable bit Mask */
  497. #define SCB_CCR_STKALIGN_Pos 9 /*!< SCB CCR: STKALIGN Position */
  498. #define SCB_CCR_STKALIGN_Msk (1UL << SCB_CCR_STKALIGN_Pos) /*!< SCB CCR: STKALIGN Mask */
  499. #define SCB_CCR_BFHFNMIGN_Pos 8 /*!< SCB CCR: BFHFNMIGN Position */
  500. #define SCB_CCR_BFHFNMIGN_Msk (1UL << SCB_CCR_BFHFNMIGN_Pos) /*!< SCB CCR: BFHFNMIGN Mask */
  501. #define SCB_CCR_DIV_0_TRP_Pos 4 /*!< SCB CCR: DIV_0_TRP Position */
  502. #define SCB_CCR_DIV_0_TRP_Msk (1UL << SCB_CCR_DIV_0_TRP_Pos) /*!< SCB CCR: DIV_0_TRP Mask */
  503. #define SCB_CCR_UNALIGN_TRP_Pos 3 /*!< SCB CCR: UNALIGN_TRP Position */
  504. #define SCB_CCR_UNALIGN_TRP_Msk (1UL << SCB_CCR_UNALIGN_TRP_Pos) /*!< SCB CCR: UNALIGN_TRP Mask */
  505. #define SCB_CCR_USERSETMPEND_Pos 1 /*!< SCB CCR: USERSETMPEND Position */
  506. #define SCB_CCR_USERSETMPEND_Msk (1UL << SCB_CCR_USERSETMPEND_Pos) /*!< SCB CCR: USERSETMPEND Mask */
  507. #define SCB_CCR_NONBASETHRDENA_Pos 0 /*!< SCB CCR: NONBASETHRDENA Position */
  508. #define SCB_CCR_NONBASETHRDENA_Msk (1UL /*<< SCB_CCR_NONBASETHRDENA_Pos*/) /*!< SCB CCR: NONBASETHRDENA Mask */
  509. /* SCB System Handler Control and State Register Definitions */
  510. #define SCB_SHCSR_USGFAULTENA_Pos 18 /*!< SCB SHCSR: USGFAULTENA Position */
  511. #define SCB_SHCSR_USGFAULTENA_Msk (1UL << SCB_SHCSR_USGFAULTENA_Pos) /*!< SCB SHCSR: USGFAULTENA Mask */
  512. #define SCB_SHCSR_BUSFAULTENA_Pos 17 /*!< SCB SHCSR: BUSFAULTENA Position */
  513. #define SCB_SHCSR_BUSFAULTENA_Msk (1UL << SCB_SHCSR_BUSFAULTENA_Pos) /*!< SCB SHCSR: BUSFAULTENA Mask */
  514. #define SCB_SHCSR_MEMFAULTENA_Pos 16 /*!< SCB SHCSR: MEMFAULTENA Position */
  515. #define SCB_SHCSR_MEMFAULTENA_Msk (1UL << SCB_SHCSR_MEMFAULTENA_Pos) /*!< SCB SHCSR: MEMFAULTENA Mask */
  516. #define SCB_SHCSR_SVCALLPENDED_Pos 15 /*!< SCB SHCSR: SVCALLPENDED Position */
  517. #define SCB_SHCSR_SVCALLPENDED_Msk (1UL << SCB_SHCSR_SVCALLPENDED_Pos) /*!< SCB SHCSR: SVCALLPENDED Mask */
  518. #define SCB_SHCSR_BUSFAULTPENDED_Pos 14 /*!< SCB SHCSR: BUSFAULTPENDED Position */
  519. #define SCB_SHCSR_BUSFAULTPENDED_Msk (1UL << SCB_SHCSR_BUSFAULTPENDED_Pos) /*!< SCB SHCSR: BUSFAULTPENDED Mask */
  520. #define SCB_SHCSR_MEMFAULTPENDED_Pos 13 /*!< SCB SHCSR: MEMFAULTPENDED Position */
  521. #define SCB_SHCSR_MEMFAULTPENDED_Msk (1UL << SCB_SHCSR_MEMFAULTPENDED_Pos) /*!< SCB SHCSR: MEMFAULTPENDED Mask */
  522. #define SCB_SHCSR_USGFAULTPENDED_Pos 12 /*!< SCB SHCSR: USGFAULTPENDED Position */
  523. #define SCB_SHCSR_USGFAULTPENDED_Msk (1UL << SCB_SHCSR_USGFAULTPENDED_Pos) /*!< SCB SHCSR: USGFAULTPENDED Mask */
  524. #define SCB_SHCSR_SYSTICKACT_Pos 11 /*!< SCB SHCSR: SYSTICKACT Position */
  525. #define SCB_SHCSR_SYSTICKACT_Msk (1UL << SCB_SHCSR_SYSTICKACT_Pos) /*!< SCB SHCSR: SYSTICKACT Mask */
  526. #define SCB_SHCSR_PENDSVACT_Pos 10 /*!< SCB SHCSR: PENDSVACT Position */
  527. #define SCB_SHCSR_PENDSVACT_Msk (1UL << SCB_SHCSR_PENDSVACT_Pos) /*!< SCB SHCSR: PENDSVACT Mask */
  528. #define SCB_SHCSR_MONITORACT_Pos 8 /*!< SCB SHCSR: MONITORACT Position */
  529. #define SCB_SHCSR_MONITORACT_Msk (1UL << SCB_SHCSR_MONITORACT_Pos) /*!< SCB SHCSR: MONITORACT Mask */
  530. #define SCB_SHCSR_SVCALLACT_Pos 7 /*!< SCB SHCSR: SVCALLACT Position */
  531. #define SCB_SHCSR_SVCALLACT_Msk (1UL << SCB_SHCSR_SVCALLACT_Pos) /*!< SCB SHCSR: SVCALLACT Mask */
  532. #define SCB_SHCSR_USGFAULTACT_Pos 3 /*!< SCB SHCSR: USGFAULTACT Position */
  533. #define SCB_SHCSR_USGFAULTACT_Msk (1UL << SCB_SHCSR_USGFAULTACT_Pos) /*!< SCB SHCSR: USGFAULTACT Mask */
  534. #define SCB_SHCSR_BUSFAULTACT_Pos 1 /*!< SCB SHCSR: BUSFAULTACT Position */
  535. #define SCB_SHCSR_BUSFAULTACT_Msk (1UL << SCB_SHCSR_BUSFAULTACT_Pos) /*!< SCB SHCSR: BUSFAULTACT Mask */
  536. #define SCB_SHCSR_MEMFAULTACT_Pos 0 /*!< SCB SHCSR: MEMFAULTACT Position */
  537. #define SCB_SHCSR_MEMFAULTACT_Msk (1UL /*<< SCB_SHCSR_MEMFAULTACT_Pos*/) /*!< SCB SHCSR: MEMFAULTACT Mask */
  538. /* SCB Configurable Fault Status Registers Definitions */
  539. #define SCB_CFSR_USGFAULTSR_Pos 16 /*!< SCB CFSR: Usage Fault Status Register Position */
  540. #define SCB_CFSR_USGFAULTSR_Msk (0xFFFFUL << SCB_CFSR_USGFAULTSR_Pos) /*!< SCB CFSR: Usage Fault Status Register Mask */
  541. #define SCB_CFSR_BUSFAULTSR_Pos 8 /*!< SCB CFSR: Bus Fault Status Register Position */
  542. #define SCB_CFSR_BUSFAULTSR_Msk (0xFFUL << SCB_CFSR_BUSFAULTSR_Pos) /*!< SCB CFSR: Bus Fault Status Register Mask */
  543. #define SCB_CFSR_MEMFAULTSR_Pos 0 /*!< SCB CFSR: Memory Manage Fault Status Register Position */
  544. #define SCB_CFSR_MEMFAULTSR_Msk (0xFFUL /*<< SCB_CFSR_MEMFAULTSR_Pos*/) /*!< SCB CFSR: Memory Manage Fault Status Register Mask */
  545. /* SCB Hard Fault Status Registers Definitions */
  546. #define SCB_HFSR_DEBUGEVT_Pos 31 /*!< SCB HFSR: DEBUGEVT Position */
  547. #define SCB_HFSR_DEBUGEVT_Msk (1UL << SCB_HFSR_DEBUGEVT_Pos) /*!< SCB HFSR: DEBUGEVT Mask */
  548. #define SCB_HFSR_FORCED_Pos 30 /*!< SCB HFSR: FORCED Position */
  549. #define SCB_HFSR_FORCED_Msk (1UL << SCB_HFSR_FORCED_Pos) /*!< SCB HFSR: FORCED Mask */
  550. #define SCB_HFSR_VECTTBL_Pos 1 /*!< SCB HFSR: VECTTBL Position */
  551. #define SCB_HFSR_VECTTBL_Msk (1UL << SCB_HFSR_VECTTBL_Pos) /*!< SCB HFSR: VECTTBL Mask */
  552. /* SCB Debug Fault Status Register Definitions */
  553. #define SCB_DFSR_EXTERNAL_Pos 4 /*!< SCB DFSR: EXTERNAL Position */
  554. #define SCB_DFSR_EXTERNAL_Msk (1UL << SCB_DFSR_EXTERNAL_Pos) /*!< SCB DFSR: EXTERNAL Mask */
  555. #define SCB_DFSR_VCATCH_Pos 3 /*!< SCB DFSR: VCATCH Position */
  556. #define SCB_DFSR_VCATCH_Msk (1UL << SCB_DFSR_VCATCH_Pos) /*!< SCB DFSR: VCATCH Mask */
  557. #define SCB_DFSR_DWTTRAP_Pos 2 /*!< SCB DFSR: DWTTRAP Position */
  558. #define SCB_DFSR_DWTTRAP_Msk (1UL << SCB_DFSR_DWTTRAP_Pos) /*!< SCB DFSR: DWTTRAP Mask */
  559. #define SCB_DFSR_BKPT_Pos 1 /*!< SCB DFSR: BKPT Position */
  560. #define SCB_DFSR_BKPT_Msk (1UL << SCB_DFSR_BKPT_Pos) /*!< SCB DFSR: BKPT Mask */
  561. #define SCB_DFSR_HALTED_Pos 0 /*!< SCB DFSR: HALTED Position */
  562. #define SCB_DFSR_HALTED_Msk (1UL /*<< SCB_DFSR_HALTED_Pos*/) /*!< SCB DFSR: HALTED Mask */
  563. /* Cache Level ID register */
  564. #define SCB_CLIDR_LOUU_Pos 27 /*!< SCB CLIDR: LoUU Position */
  565. #define SCB_CLIDR_LOUU_Msk (7UL << SCB_CLIDR_LOUU_Pos) /*!< SCB CLIDR: LoUU Mask */
  566. #define SCB_CLIDR_LOC_Pos 24 /*!< SCB CLIDR: LoC Position */
  567. #define SCB_CLIDR_LOC_Msk (7UL << SCB_CLIDR_FORMAT_Pos) /*!< SCB CLIDR: LoC Mask */
  568. /* Cache Type register */
  569. #define SCB_CTR_FORMAT_Pos 29 /*!< SCB CTR: Format Position */
  570. #define SCB_CTR_FORMAT_Msk (7UL << SCB_CTR_FORMAT_Pos) /*!< SCB CTR: Format Mask */
  571. #define SCB_CTR_CWG_Pos 24 /*!< SCB CTR: CWG Position */
  572. #define SCB_CTR_CWG_Msk (0xFUL << SCB_CTR_CWG_Pos) /*!< SCB CTR: CWG Mask */
  573. #define SCB_CTR_ERG_Pos 20 /*!< SCB CTR: ERG Position */
  574. #define SCB_CTR_ERG_Msk (0xFUL << SCB_CTR_ERG_Pos) /*!< SCB CTR: ERG Mask */
  575. #define SCB_CTR_DMINLINE_Pos 16 /*!< SCB CTR: DminLine Position */
  576. #define SCB_CTR_DMINLINE_Msk (0xFUL << SCB_CTR_DMINLINE_Pos) /*!< SCB CTR: DminLine Mask */
  577. #define SCB_CTR_IMINLINE_Pos 0 /*!< SCB CTR: ImInLine Position */
  578. #define SCB_CTR_IMINLINE_Msk (0xFUL /*<< SCB_CTR_IMINLINE_Pos*/) /*!< SCB CTR: ImInLine Mask */
  579. /* Cache Size ID Register */
  580. #define SCB_CCSIDR_WT_Pos 31 /*!< SCB CCSIDR: WT Position */
  581. #define SCB_CCSIDR_WT_Msk (7UL << SCB_CCSIDR_WT_Pos) /*!< SCB CCSIDR: WT Mask */
  582. #define SCB_CCSIDR_WB_Pos 30 /*!< SCB CCSIDR: WB Position */
  583. #define SCB_CCSIDR_WB_Msk (7UL << SCB_CCSIDR_WB_Pos) /*!< SCB CCSIDR: WB Mask */
  584. #define SCB_CCSIDR_RA_Pos 29 /*!< SCB CCSIDR: RA Position */
  585. #define SCB_CCSIDR_RA_Msk (7UL << SCB_CCSIDR_RA_Pos) /*!< SCB CCSIDR: RA Mask */
  586. #define SCB_CCSIDR_WA_Pos 28 /*!< SCB CCSIDR: WA Position */
  587. #define SCB_CCSIDR_WA_Msk (7UL << SCB_CCSIDR_WA_Pos) /*!< SCB CCSIDR: WA Mask */
  588. #define SCB_CCSIDR_NUMSETS_Pos 13 /*!< SCB CCSIDR: NumSets Position */
  589. #define SCB_CCSIDR_NUMSETS_Msk (0x7FFFUL << SCB_CCSIDR_NUMSETS_Pos) /*!< SCB CCSIDR: NumSets Mask */
  590. #define SCB_CCSIDR_ASSOCIATIVITY_Pos 3 /*!< SCB CCSIDR: Associativity Position */
  591. #define SCB_CCSIDR_ASSOCIATIVITY_Msk (0x3FFUL << SCB_CCSIDR_ASSOCIATIVITY_Pos) /*!< SCB CCSIDR: Associativity Mask */
  592. #define SCB_CCSIDR_LINESIZE_Pos 0 /*!< SCB CCSIDR: LineSize Position */
  593. #define SCB_CCSIDR_LINESIZE_Msk (7UL /*<< SCB_CCSIDR_LINESIZE_Pos*/) /*!< SCB CCSIDR: LineSize Mask */
  594. /* Cache Size Selection Register */
  595. #define SCB_CSSELR_LEVEL_Pos 1 /*!< SCB CSSELR: Level Position */
  596. #define SCB_CSSELR_LEVEL_Msk (7UL << SCB_CSSELR_LEVEL_Pos) /*!< SCB CSSELR: Level Mask */
  597. #define SCB_CSSELR_IND_Pos 0 /*!< SCB CSSELR: InD Position */
  598. #define SCB_CSSELR_IND_Msk (1UL /*<< SCB_CSSELR_IND_Pos*/) /*!< SCB CSSELR: InD Mask */
  599. /* SCB Software Triggered Interrupt Register */
  600. #define SCB_STIR_INTID_Pos 0 /*!< SCB STIR: INTID Position */
  601. #define SCB_STIR_INTID_Msk (0x1FFUL /*<< SCB_STIR_INTID_Pos*/) /*!< SCB STIR: INTID Mask */
  602. /* Instruction Tightly-Coupled Memory Control Register*/
  603. #define SCB_ITCMCR_SZ_Pos 3 /*!< SCB ITCMCR: SZ Position */
  604. #define SCB_ITCMCR_SZ_Msk (0xFUL << SCB_ITCMCR_SZ_Pos) /*!< SCB ITCMCR: SZ Mask */
  605. #define SCB_ITCMCR_RETEN_Pos 2 /*!< SCB ITCMCR: RETEN Position */
  606. #define SCB_ITCMCR_RETEN_Msk (1UL << SCB_ITCMCR_RETEN_Pos) /*!< SCB ITCMCR: RETEN Mask */
  607. #define SCB_ITCMCR_RMW_Pos 1 /*!< SCB ITCMCR: RMW Position */
  608. #define SCB_ITCMCR_RMW_Msk (1UL << SCB_ITCMCR_RMW_Pos) /*!< SCB ITCMCR: RMW Mask */
  609. #define SCB_ITCMCR_EN_Pos 0 /*!< SCB ITCMCR: EN Position */
  610. #define SCB_ITCMCR_EN_Msk (1UL /*<< SCB_ITCMCR_EN_Pos*/) /*!< SCB ITCMCR: EN Mask */
  611. /* Data Tightly-Coupled Memory Control Registers */
  612. #define SCB_DTCMCR_SZ_Pos 3 /*!< SCB DTCMCR: SZ Position */
  613. #define SCB_DTCMCR_SZ_Msk (0xFUL << SCB_DTCMCR_SZ_Pos) /*!< SCB DTCMCR: SZ Mask */
  614. #define SCB_DTCMCR_RETEN_Pos 2 /*!< SCB DTCMCR: RETEN Position */
  615. #define SCB_DTCMCR_RETEN_Msk (1UL << SCB_DTCMCR_RETEN_Pos) /*!< SCB DTCMCR: RETEN Mask */
  616. #define SCB_DTCMCR_RMW_Pos 1 /*!< SCB DTCMCR: RMW Position */
  617. #define SCB_DTCMCR_RMW_Msk (1UL << SCB_DTCMCR_RMW_Pos) /*!< SCB DTCMCR: RMW Mask */
  618. #define SCB_DTCMCR_EN_Pos 0 /*!< SCB DTCMCR: EN Position */
  619. #define SCB_DTCMCR_EN_Msk (1UL /*<< SCB_DTCMCR_EN_Pos*/) /*!< SCB DTCMCR: EN Mask */
  620. /* AHBP Control Register */
  621. #define SCB_AHBPCR_SZ_Pos 1 /*!< SCB AHBPCR: SZ Position */
  622. #define SCB_AHBPCR_SZ_Msk (7UL << SCB_AHBPCR_SZ_Pos) /*!< SCB AHBPCR: SZ Mask */
  623. #define SCB_AHBPCR_EN_Pos 0 /*!< SCB AHBPCR: EN Position */
  624. #define SCB_AHBPCR_EN_Msk (1UL /*<< SCB_AHBPCR_EN_Pos*/) /*!< SCB AHBPCR: EN Mask */
  625. /* L1 Cache Control Register */
  626. #define SCB_CACR_FORCEWT_Pos 2 /*!< SCB CACR: FORCEWT Position */
  627. #define SCB_CACR_FORCEWT_Msk (1UL << SCB_CACR_FORCEWT_Pos) /*!< SCB CACR: FORCEWT Mask */
  628. #define SCB_CACR_ECCEN_Pos 1 /*!< SCB CACR: ECCEN Position */
  629. #define SCB_CACR_ECCEN_Msk (1UL << SCB_CACR_ECCEN_Pos) /*!< SCB CACR: ECCEN Mask */
  630. #define SCB_CACR_SIWT_Pos 0 /*!< SCB CACR: SIWT Position */
  631. #define SCB_CACR_SIWT_Msk (1UL /*<< SCB_CACR_SIWT_Pos*/) /*!< SCB CACR: SIWT Mask */
  632. /* AHBS control register */
  633. #define SCB_AHBSCR_INITCOUNT_Pos 11 /*!< SCB AHBSCR: INITCOUNT Position */
  634. #define SCB_AHBSCR_INITCOUNT_Msk (0x1FUL << SCB_AHBPCR_INITCOUNT_Pos) /*!< SCB AHBSCR: INITCOUNT Mask */
  635. #define SCB_AHBSCR_TPRI_Pos 2 /*!< SCB AHBSCR: TPRI Position */
  636. #define SCB_AHBSCR_TPRI_Msk (0x1FFUL << SCB_AHBPCR_TPRI_Pos) /*!< SCB AHBSCR: TPRI Mask */
  637. #define SCB_AHBSCR_CTL_Pos 0 /*!< SCB AHBSCR: CTL Position*/
  638. #define SCB_AHBSCR_CTL_Msk (3UL /*<< SCB_AHBPCR_CTL_Pos*/) /*!< SCB AHBSCR: CTL Mask */
  639. /* Auxiliary Bus Fault Status Register */
  640. #define SCB_ABFSR_AXIMTYPE_Pos 8 /*!< SCB ABFSR: AXIMTYPE Position*/
  641. #define SCB_ABFSR_AXIMTYPE_Msk (3UL << SCB_ABFSR_AXIMTYPE_Pos) /*!< SCB ABFSR: AXIMTYPE Mask */
  642. #define SCB_ABFSR_EPPB_Pos 4 /*!< SCB ABFSR: EPPB Position*/
  643. #define SCB_ABFSR_EPPB_Msk (1UL << SCB_ABFSR_EPPB_Pos) /*!< SCB ABFSR: EPPB Mask */
  644. #define SCB_ABFSR_AXIM_Pos 3 /*!< SCB ABFSR: AXIM Position*/
  645. #define SCB_ABFSR_AXIM_Msk (1UL << SCB_ABFSR_AXIM_Pos) /*!< SCB ABFSR: AXIM Mask */
  646. #define SCB_ABFSR_AHBP_Pos 2 /*!< SCB ABFSR: AHBP Position*/
  647. #define SCB_ABFSR_AHBP_Msk (1UL << SCB_ABFSR_AHBP_Pos) /*!< SCB ABFSR: AHBP Mask */
  648. #define SCB_ABFSR_DTCM_Pos 1 /*!< SCB ABFSR: DTCM Position*/
  649. #define SCB_ABFSR_DTCM_Msk (1UL << SCB_ABFSR_DTCM_Pos) /*!< SCB ABFSR: DTCM Mask */
  650. #define SCB_ABFSR_ITCM_Pos 0 /*!< SCB ABFSR: ITCM Position*/
  651. #define SCB_ABFSR_ITCM_Msk (1UL /*<< SCB_ABFSR_ITCM_Pos*/) /*!< SCB ABFSR: ITCM Mask */
  652. /*@} end of group CMSIS_SCB */
  653. /** \ingroup CMSIS_core_register
  654. \defgroup CMSIS_SCnSCB System Controls not in SCB (SCnSCB)
  655. \brief Type definitions for the System Control and ID Register not in the SCB
  656. @{
  657. */
  658. /** \brief Structure type to access the System Control and ID Register not in the SCB.
  659. */
  660. typedef struct
  661. {
  662. uint32_t RESERVED0[1];
  663. __I uint32_t ICTR; /*!< Offset: 0x004 (R/ ) Interrupt Controller Type Register */
  664. __IO uint32_t ACTLR; /*!< Offset: 0x008 (R/W) Auxiliary Control Register */
  665. } SCnSCB_Type;
  666. /* Interrupt Controller Type Register Definitions */
  667. #define SCnSCB_ICTR_INTLINESNUM_Pos 0 /*!< ICTR: INTLINESNUM Position */
  668. #define SCnSCB_ICTR_INTLINESNUM_Msk (0xFUL /*<< SCnSCB_ICTR_INTLINESNUM_Pos*/) /*!< ICTR: INTLINESNUM Mask */
  669. /* Auxiliary Control Register Definitions */
  670. #define SCnSCB_ACTLR_DISITMATBFLUSH_Pos 12 /*!< ACTLR: DISITMATBFLUSH Position */
  671. #define SCnSCB_ACTLR_DISITMATBFLUSH_Msk (1UL << SCnSCB_ACTLR_DISITMATBFLUSH_Pos) /*!< ACTLR: DISITMATBFLUSH Mask */
  672. #define SCnSCB_ACTLR_DISRAMODE_Pos 11 /*!< ACTLR: DISRAMODE Position */
  673. #define SCnSCB_ACTLR_DISRAMODE_Msk (1UL << SCnSCB_ACTLR_DISRAMODE_Pos) /*!< ACTLR: DISRAMODE Mask */
  674. #define SCnSCB_ACTLR_FPEXCODIS_Pos 10 /*!< ACTLR: FPEXCODIS Position */
  675. #define SCnSCB_ACTLR_FPEXCODIS_Msk (1UL << SCnSCB_ACTLR_FPEXCODIS_Pos) /*!< ACTLR: FPEXCODIS Mask */
  676. #define SCnSCB_ACTLR_DISFOLD_Pos 2 /*!< ACTLR: DISFOLD Position */
  677. #define SCnSCB_ACTLR_DISFOLD_Msk (1UL << SCnSCB_ACTLR_DISFOLD_Pos) /*!< ACTLR: DISFOLD Mask */
  678. #define SCnSCB_ACTLR_DISMCYCINT_Pos 0 /*!< ACTLR: DISMCYCINT Position */
  679. #define SCnSCB_ACTLR_DISMCYCINT_Msk (1UL /*<< SCnSCB_ACTLR_DISMCYCINT_Pos*/) /*!< ACTLR: DISMCYCINT Mask */
  680. /*@} end of group CMSIS_SCnotSCB */
  681. /** \ingroup CMSIS_core_register
  682. \defgroup CMSIS_SysTick System Tick Timer (SysTick)
  683. \brief Type definitions for the System Timer Registers.
  684. @{
  685. */
  686. /** \brief Structure type to access the System Timer (SysTick).
  687. */
  688. typedef struct
  689. {
  690. __IO uint32_t CTRL; /*!< Offset: 0x000 (R/W) SysTick Control and Status Register */
  691. __IO uint32_t LOAD; /*!< Offset: 0x004 (R/W) SysTick Reload Value Register */
  692. __IO uint32_t VAL; /*!< Offset: 0x008 (R/W) SysTick Current Value Register */
  693. __I uint32_t CALIB; /*!< Offset: 0x00C (R/ ) SysTick Calibration Register */
  694. } SysTick_Type;
  695. /* SysTick Control / Status Register Definitions */
  696. #define SysTick_CTRL_COUNTFLAG_Pos 16 /*!< SysTick CTRL: COUNTFLAG Position */
  697. #define SysTick_CTRL_COUNTFLAG_Msk (1UL << SysTick_CTRL_COUNTFLAG_Pos) /*!< SysTick CTRL: COUNTFLAG Mask */
  698. #define SysTick_CTRL_CLKSOURCE_Pos 2 /*!< SysTick CTRL: CLKSOURCE Position */
  699. #define SysTick_CTRL_CLKSOURCE_Msk (1UL << SysTick_CTRL_CLKSOURCE_Pos) /*!< SysTick CTRL: CLKSOURCE Mask */
  700. #define SysTick_CTRL_TICKINT_Pos 1 /*!< SysTick CTRL: TICKINT Position */
  701. #define SysTick_CTRL_TICKINT_Msk (1UL << SysTick_CTRL_TICKINT_Pos) /*!< SysTick CTRL: TICKINT Mask */
  702. #define SysTick_CTRL_ENABLE_Pos 0 /*!< SysTick CTRL: ENABLE Position */
  703. #define SysTick_CTRL_ENABLE_Msk (1UL /*<< SysTick_CTRL_ENABLE_Pos*/) /*!< SysTick CTRL: ENABLE Mask */
  704. /* SysTick Reload Register Definitions */
  705. #define SysTick_LOAD_RELOAD_Pos 0 /*!< SysTick LOAD: RELOAD Position */
  706. #define SysTick_LOAD_RELOAD_Msk (0xFFFFFFUL /*<< SysTick_LOAD_RELOAD_Pos*/) /*!< SysTick LOAD: RELOAD Mask */
  707. /* SysTick Current Register Definitions */
  708. #define SysTick_VAL_CURRENT_Pos 0 /*!< SysTick VAL: CURRENT Position */
  709. #define SysTick_VAL_CURRENT_Msk (0xFFFFFFUL /*<< SysTick_VAL_CURRENT_Pos*/) /*!< SysTick VAL: CURRENT Mask */
  710. /* SysTick Calibration Register Definitions */
  711. #define SysTick_CALIB_NOREF_Pos 31 /*!< SysTick CALIB: NOREF Position */
  712. #define SysTick_CALIB_NOREF_Msk (1UL << SysTick_CALIB_NOREF_Pos) /*!< SysTick CALIB: NOREF Mask */
  713. #define SysTick_CALIB_SKEW_Pos 30 /*!< SysTick CALIB: SKEW Position */
  714. #define SysTick_CALIB_SKEW_Msk (1UL << SysTick_CALIB_SKEW_Pos) /*!< SysTick CALIB: SKEW Mask */
  715. #define SysTick_CALIB_TENMS_Pos 0 /*!< SysTick CALIB: TENMS Position */
  716. #define SysTick_CALIB_TENMS_Msk (0xFFFFFFUL /*<< SysTick_CALIB_TENMS_Pos*/) /*!< SysTick CALIB: TENMS Mask */
  717. /*@} end of group CMSIS_SysTick */
  718. /** \ingroup CMSIS_core_register
  719. \defgroup CMSIS_ITM Instrumentation Trace Macrocell (ITM)
  720. \brief Type definitions for the Instrumentation Trace Macrocell (ITM)
  721. @{
  722. */
  723. /** \brief Structure type to access the Instrumentation Trace Macrocell Register (ITM).
  724. */
  725. typedef struct
  726. {
  727. __O union
  728. {
  729. __O uint8_t u8; /*!< Offset: 0x000 ( /W) ITM Stimulus Port 8-bit */
  730. __O uint16_t u16; /*!< Offset: 0x000 ( /W) ITM Stimulus Port 16-bit */
  731. __O uint32_t u32; /*!< Offset: 0x000 ( /W) ITM Stimulus Port 32-bit */
  732. } PORT [32]; /*!< Offset: 0x000 ( /W) ITM Stimulus Port Registers */
  733. uint32_t RESERVED0[864];
  734. __IO uint32_t TER; /*!< Offset: 0xE00 (R/W) ITM Trace Enable Register */
  735. uint32_t RESERVED1[15];
  736. __IO uint32_t TPR; /*!< Offset: 0xE40 (R/W) ITM Trace Privilege Register */
  737. uint32_t RESERVED2[15];
  738. __IO uint32_t TCR; /*!< Offset: 0xE80 (R/W) ITM Trace Control Register */
  739. uint32_t RESERVED3[29];
  740. __O uint32_t IWR; /*!< Offset: 0xEF8 ( /W) ITM Integration Write Register */
  741. __I uint32_t IRR; /*!< Offset: 0xEFC (R/ ) ITM Integration Read Register */
  742. __IO uint32_t IMCR; /*!< Offset: 0xF00 (R/W) ITM Integration Mode Control Register */
  743. uint32_t RESERVED4[43];
  744. __O uint32_t LAR; /*!< Offset: 0xFB0 ( /W) ITM Lock Access Register */
  745. __I uint32_t LSR; /*!< Offset: 0xFB4 (R/ ) ITM Lock Status Register */
  746. uint32_t RESERVED5[6];
  747. __I uint32_t PID4; /*!< Offset: 0xFD0 (R/ ) ITM Peripheral Identification Register #4 */
  748. __I uint32_t PID5; /*!< Offset: 0xFD4 (R/ ) ITM Peripheral Identification Register #5 */
  749. __I uint32_t PID6; /*!< Offset: 0xFD8 (R/ ) ITM Peripheral Identification Register #6 */
  750. __I uint32_t PID7; /*!< Offset: 0xFDC (R/ ) ITM Peripheral Identification Register #7 */
  751. __I uint32_t PID0; /*!< Offset: 0xFE0 (R/ ) ITM Peripheral Identification Register #0 */
  752. __I uint32_t PID1; /*!< Offset: 0xFE4 (R/ ) ITM Peripheral Identification Register #1 */
  753. __I uint32_t PID2; /*!< Offset: 0xFE8 (R/ ) ITM Peripheral Identification Register #2 */
  754. __I uint32_t PID3; /*!< Offset: 0xFEC (R/ ) ITM Peripheral Identification Register #3 */
  755. __I uint32_t CID0; /*!< Offset: 0xFF0 (R/ ) ITM Component Identification Register #0 */
  756. __I uint32_t CID1; /*!< Offset: 0xFF4 (R/ ) ITM Component Identification Register #1 */
  757. __I uint32_t CID2; /*!< Offset: 0xFF8 (R/ ) ITM Component Identification Register #2 */
  758. __I uint32_t CID3; /*!< Offset: 0xFFC (R/ ) ITM Component Identification Register #3 */
  759. } ITM_Type;
  760. /* ITM Trace Privilege Register Definitions */
  761. #define ITM_TPR_PRIVMASK_Pos 0 /*!< ITM TPR: PRIVMASK Position */
  762. #define ITM_TPR_PRIVMASK_Msk (0xFUL /*<< ITM_TPR_PRIVMASK_Pos*/) /*!< ITM TPR: PRIVMASK Mask */
  763. /* ITM Trace Control Register Definitions */
  764. #define ITM_TCR_BUSY_Pos 23 /*!< ITM TCR: BUSY Position */
  765. #define ITM_TCR_BUSY_Msk (1UL << ITM_TCR_BUSY_Pos) /*!< ITM TCR: BUSY Mask */
  766. #define ITM_TCR_TraceBusID_Pos 16 /*!< ITM TCR: ATBID Position */
  767. #define ITM_TCR_TraceBusID_Msk (0x7FUL << ITM_TCR_TraceBusID_Pos) /*!< ITM TCR: ATBID Mask */
  768. #define ITM_TCR_GTSFREQ_Pos 10 /*!< ITM TCR: Global timestamp frequency Position */
  769. #define ITM_TCR_GTSFREQ_Msk (3UL << ITM_TCR_GTSFREQ_Pos) /*!< ITM TCR: Global timestamp frequency Mask */
  770. #define ITM_TCR_TSPrescale_Pos 8 /*!< ITM TCR: TSPrescale Position */
  771. #define ITM_TCR_TSPrescale_Msk (3UL << ITM_TCR_TSPrescale_Pos) /*!< ITM TCR: TSPrescale Mask */
  772. #define ITM_TCR_SWOENA_Pos 4 /*!< ITM TCR: SWOENA Position */
  773. #define ITM_TCR_SWOENA_Msk (1UL << ITM_TCR_SWOENA_Pos) /*!< ITM TCR: SWOENA Mask */
  774. #define ITM_TCR_DWTENA_Pos 3 /*!< ITM TCR: DWTENA Position */
  775. #define ITM_TCR_DWTENA_Msk (1UL << ITM_TCR_DWTENA_Pos) /*!< ITM TCR: DWTENA Mask */
  776. #define ITM_TCR_SYNCENA_Pos 2 /*!< ITM TCR: SYNCENA Position */
  777. #define ITM_TCR_SYNCENA_Msk (1UL << ITM_TCR_SYNCENA_Pos) /*!< ITM TCR: SYNCENA Mask */
  778. #define ITM_TCR_TSENA_Pos 1 /*!< ITM TCR: TSENA Position */
  779. #define ITM_TCR_TSENA_Msk (1UL << ITM_TCR_TSENA_Pos) /*!< ITM TCR: TSENA Mask */
  780. #define ITM_TCR_ITMENA_Pos 0 /*!< ITM TCR: ITM Enable bit Position */
  781. #define ITM_TCR_ITMENA_Msk (1UL /*<< ITM_TCR_ITMENA_Pos*/) /*!< ITM TCR: ITM Enable bit Mask */
  782. /* ITM Integration Write Register Definitions */
  783. #define ITM_IWR_ATVALIDM_Pos 0 /*!< ITM IWR: ATVALIDM Position */
  784. #define ITM_IWR_ATVALIDM_Msk (1UL /*<< ITM_IWR_ATVALIDM_Pos*/) /*!< ITM IWR: ATVALIDM Mask */
  785. /* ITM Integration Read Register Definitions */
  786. #define ITM_IRR_ATREADYM_Pos 0 /*!< ITM IRR: ATREADYM Position */
  787. #define ITM_IRR_ATREADYM_Msk (1UL /*<< ITM_IRR_ATREADYM_Pos*/) /*!< ITM IRR: ATREADYM Mask */
  788. /* ITM Integration Mode Control Register Definitions */
  789. #define ITM_IMCR_INTEGRATION_Pos 0 /*!< ITM IMCR: INTEGRATION Position */
  790. #define ITM_IMCR_INTEGRATION_Msk (1UL /*<< ITM_IMCR_INTEGRATION_Pos*/) /*!< ITM IMCR: INTEGRATION Mask */
  791. /* ITM Lock Status Register Definitions */
  792. #define ITM_LSR_ByteAcc_Pos 2 /*!< ITM LSR: ByteAcc Position */
  793. #define ITM_LSR_ByteAcc_Msk (1UL << ITM_LSR_ByteAcc_Pos) /*!< ITM LSR: ByteAcc Mask */
  794. #define ITM_LSR_Access_Pos 1 /*!< ITM LSR: Access Position */
  795. #define ITM_LSR_Access_Msk (1UL << ITM_LSR_Access_Pos) /*!< ITM LSR: Access Mask */
  796. #define ITM_LSR_Present_Pos 0 /*!< ITM LSR: Present Position */
  797. #define ITM_LSR_Present_Msk (1UL /*<< ITM_LSR_Present_Pos*/) /*!< ITM LSR: Present Mask */
  798. /*@}*/ /* end of group CMSIS_ITM */
  799. /** \ingroup CMSIS_core_register
  800. \defgroup CMSIS_DWT Data Watchpoint and Trace (DWT)
  801. \brief Type definitions for the Data Watchpoint and Trace (DWT)
  802. @{
  803. */
  804. /** \brief Structure type to access the Data Watchpoint and Trace Register (DWT).
  805. */
  806. typedef struct
  807. {
  808. __IO uint32_t CTRL; /*!< Offset: 0x000 (R/W) Control Register */
  809. __IO uint32_t CYCCNT; /*!< Offset: 0x004 (R/W) Cycle Count Register */
  810. __IO uint32_t CPICNT; /*!< Offset: 0x008 (R/W) CPI Count Register */
  811. __IO uint32_t EXCCNT; /*!< Offset: 0x00C (R/W) Exception Overhead Count Register */
  812. __IO uint32_t SLEEPCNT; /*!< Offset: 0x010 (R/W) Sleep Count Register */
  813. __IO uint32_t LSUCNT; /*!< Offset: 0x014 (R/W) LSU Count Register */
  814. __IO uint32_t FOLDCNT; /*!< Offset: 0x018 (R/W) Folded-instruction Count Register */
  815. __I uint32_t PCSR; /*!< Offset: 0x01C (R/ ) Program Counter Sample Register */
  816. __IO uint32_t COMP0; /*!< Offset: 0x020 (R/W) Comparator Register 0 */
  817. __IO uint32_t MASK0; /*!< Offset: 0x024 (R/W) Mask Register 0 */
  818. __IO uint32_t FUNCTION0; /*!< Offset: 0x028 (R/W) Function Register 0 */
  819. uint32_t RESERVED0[1];
  820. __IO uint32_t COMP1; /*!< Offset: 0x030 (R/W) Comparator Register 1 */
  821. __IO uint32_t MASK1; /*!< Offset: 0x034 (R/W) Mask Register 1 */
  822. __IO uint32_t FUNCTION1; /*!< Offset: 0x038 (R/W) Function Register 1 */
  823. uint32_t RESERVED1[1];
  824. __IO uint32_t COMP2; /*!< Offset: 0x040 (R/W) Comparator Register 2 */
  825. __IO uint32_t MASK2; /*!< Offset: 0x044 (R/W) Mask Register 2 */
  826. __IO uint32_t FUNCTION2; /*!< Offset: 0x048 (R/W) Function Register 2 */
  827. uint32_t RESERVED2[1];
  828. __IO uint32_t COMP3; /*!< Offset: 0x050 (R/W) Comparator Register 3 */
  829. __IO uint32_t MASK3; /*!< Offset: 0x054 (R/W) Mask Register 3 */
  830. __IO uint32_t FUNCTION3; /*!< Offset: 0x058 (R/W) Function Register 3 */
  831. uint32_t RESERVED3[981];
  832. __O uint32_t LAR; /*!< Offset: 0xFB0 ( W) Lock Access Register */
  833. __I uint32_t LSR; /*!< Offset: 0xFB4 (R ) Lock Status Register */
  834. } DWT_Type;
  835. /* DWT Control Register Definitions */
  836. #define DWT_CTRL_NUMCOMP_Pos 28 /*!< DWT CTRL: NUMCOMP Position */
  837. #define DWT_CTRL_NUMCOMP_Msk (0xFUL << DWT_CTRL_NUMCOMP_Pos) /*!< DWT CTRL: NUMCOMP Mask */
  838. #define DWT_CTRL_NOTRCPKT_Pos 27 /*!< DWT CTRL: NOTRCPKT Position */
  839. #define DWT_CTRL_NOTRCPKT_Msk (0x1UL << DWT_CTRL_NOTRCPKT_Pos) /*!< DWT CTRL: NOTRCPKT Mask */
  840. #define DWT_CTRL_NOEXTTRIG_Pos 26 /*!< DWT CTRL: NOEXTTRIG Position */
  841. #define DWT_CTRL_NOEXTTRIG_Msk (0x1UL << DWT_CTRL_NOEXTTRIG_Pos) /*!< DWT CTRL: NOEXTTRIG Mask */
  842. #define DWT_CTRL_NOCYCCNT_Pos 25 /*!< DWT CTRL: NOCYCCNT Position */
  843. #define DWT_CTRL_NOCYCCNT_Msk (0x1UL << DWT_CTRL_NOCYCCNT_Pos) /*!< DWT CTRL: NOCYCCNT Mask */
  844. #define DWT_CTRL_NOPRFCNT_Pos 24 /*!< DWT CTRL: NOPRFCNT Position */
  845. #define DWT_CTRL_NOPRFCNT_Msk (0x1UL << DWT_CTRL_NOPRFCNT_Pos) /*!< DWT CTRL: NOPRFCNT Mask */
  846. #define DWT_CTRL_CYCEVTENA_Pos 22 /*!< DWT CTRL: CYCEVTENA Position */
  847. #define DWT_CTRL_CYCEVTENA_Msk (0x1UL << DWT_CTRL_CYCEVTENA_Pos) /*!< DWT CTRL: CYCEVTENA Mask */
  848. #define DWT_CTRL_FOLDEVTENA_Pos 21 /*!< DWT CTRL: FOLDEVTENA Position */
  849. #define DWT_CTRL_FOLDEVTENA_Msk (0x1UL << DWT_CTRL_FOLDEVTENA_Pos) /*!< DWT CTRL: FOLDEVTENA Mask */
  850. #define DWT_CTRL_LSUEVTENA_Pos 20 /*!< DWT CTRL: LSUEVTENA Position */
  851. #define DWT_CTRL_LSUEVTENA_Msk (0x1UL << DWT_CTRL_LSUEVTENA_Pos) /*!< DWT CTRL: LSUEVTENA Mask */
  852. #define DWT_CTRL_SLEEPEVTENA_Pos 19 /*!< DWT CTRL: SLEEPEVTENA Position */
  853. #define DWT_CTRL_SLEEPEVTENA_Msk (0x1UL << DWT_CTRL_SLEEPEVTENA_Pos) /*!< DWT CTRL: SLEEPEVTENA Mask */
  854. #define DWT_CTRL_EXCEVTENA_Pos 18 /*!< DWT CTRL: EXCEVTENA Position */
  855. #define DWT_CTRL_EXCEVTENA_Msk (0x1UL << DWT_CTRL_EXCEVTENA_Pos) /*!< DWT CTRL: EXCEVTENA Mask */
  856. #define DWT_CTRL_CPIEVTENA_Pos 17 /*!< DWT CTRL: CPIEVTENA Position */
  857. #define DWT_CTRL_CPIEVTENA_Msk (0x1UL << DWT_CTRL_CPIEVTENA_Pos) /*!< DWT CTRL: CPIEVTENA Mask */
  858. #define DWT_CTRL_EXCTRCENA_Pos 16 /*!< DWT CTRL: EXCTRCENA Position */
  859. #define DWT_CTRL_EXCTRCENA_Msk (0x1UL << DWT_CTRL_EXCTRCENA_Pos) /*!< DWT CTRL: EXCTRCENA Mask */
  860. #define DWT_CTRL_PCSAMPLENA_Pos 12 /*!< DWT CTRL: PCSAMPLENA Position */
  861. #define DWT_CTRL_PCSAMPLENA_Msk (0x1UL << DWT_CTRL_PCSAMPLENA_Pos) /*!< DWT CTRL: PCSAMPLENA Mask */
  862. #define DWT_CTRL_SYNCTAP_Pos 10 /*!< DWT CTRL: SYNCTAP Position */
  863. #define DWT_CTRL_SYNCTAP_Msk (0x3UL << DWT_CTRL_SYNCTAP_Pos) /*!< DWT CTRL: SYNCTAP Mask */
  864. #define DWT_CTRL_CYCTAP_Pos 9 /*!< DWT CTRL: CYCTAP Position */
  865. #define DWT_CTRL_CYCTAP_Msk (0x1UL << DWT_CTRL_CYCTAP_Pos) /*!< DWT CTRL: CYCTAP Mask */
  866. #define DWT_CTRL_POSTINIT_Pos 5 /*!< DWT CTRL: POSTINIT Position */
  867. #define DWT_CTRL_POSTINIT_Msk (0xFUL << DWT_CTRL_POSTINIT_Pos) /*!< DWT CTRL: POSTINIT Mask */
  868. #define DWT_CTRL_POSTPRESET_Pos 1 /*!< DWT CTRL: POSTPRESET Position */
  869. #define DWT_CTRL_POSTPRESET_Msk (0xFUL << DWT_CTRL_POSTPRESET_Pos) /*!< DWT CTRL: POSTPRESET Mask */
  870. #define DWT_CTRL_CYCCNTENA_Pos 0 /*!< DWT CTRL: CYCCNTENA Position */
  871. #define DWT_CTRL_CYCCNTENA_Msk (0x1UL /*<< DWT_CTRL_CYCCNTENA_Pos*/) /*!< DWT CTRL: CYCCNTENA Mask */
  872. /* DWT CPI Count Register Definitions */
  873. #define DWT_CPICNT_CPICNT_Pos 0 /*!< DWT CPICNT: CPICNT Position */
  874. #define DWT_CPICNT_CPICNT_Msk (0xFFUL /*<< DWT_CPICNT_CPICNT_Pos*/) /*!< DWT CPICNT: CPICNT Mask */
  875. /* DWT Exception Overhead Count Register Definitions */
  876. #define DWT_EXCCNT_EXCCNT_Pos 0 /*!< DWT EXCCNT: EXCCNT Position */
  877. #define DWT_EXCCNT_EXCCNT_Msk (0xFFUL /*<< DWT_EXCCNT_EXCCNT_Pos*/) /*!< DWT EXCCNT: EXCCNT Mask */
  878. /* DWT Sleep Count Register Definitions */
  879. #define DWT_SLEEPCNT_SLEEPCNT_Pos 0 /*!< DWT SLEEPCNT: SLEEPCNT Position */
  880. #define DWT_SLEEPCNT_SLEEPCNT_Msk (0xFFUL /*<< DWT_SLEEPCNT_SLEEPCNT_Pos*/) /*!< DWT SLEEPCNT: SLEEPCNT Mask */
  881. /* DWT LSU Count Register Definitions */
  882. #define DWT_LSUCNT_LSUCNT_Pos 0 /*!< DWT LSUCNT: LSUCNT Position */
  883. #define DWT_LSUCNT_LSUCNT_Msk (0xFFUL /*<< DWT_LSUCNT_LSUCNT_Pos*/) /*!< DWT LSUCNT: LSUCNT Mask */
  884. /* DWT Folded-instruction Count Register Definitions */
  885. #define DWT_FOLDCNT_FOLDCNT_Pos 0 /*!< DWT FOLDCNT: FOLDCNT Position */
  886. #define DWT_FOLDCNT_FOLDCNT_Msk (0xFFUL /*<< DWT_FOLDCNT_FOLDCNT_Pos*/) /*!< DWT FOLDCNT: FOLDCNT Mask */
  887. /* DWT Comparator Mask Register Definitions */
  888. #define DWT_MASK_MASK_Pos 0 /*!< DWT MASK: MASK Position */
  889. #define DWT_MASK_MASK_Msk (0x1FUL /*<< DWT_MASK_MASK_Pos*/) /*!< DWT MASK: MASK Mask */
  890. /* DWT Comparator Function Register Definitions */
  891. #define DWT_FUNCTION_MATCHED_Pos 24 /*!< DWT FUNCTION: MATCHED Position */
  892. #define DWT_FUNCTION_MATCHED_Msk (0x1UL << DWT_FUNCTION_MATCHED_Pos) /*!< DWT FUNCTION: MATCHED Mask */
  893. #define DWT_FUNCTION_DATAVADDR1_Pos 16 /*!< DWT FUNCTION: DATAVADDR1 Position */
  894. #define DWT_FUNCTION_DATAVADDR1_Msk (0xFUL << DWT_FUNCTION_DATAVADDR1_Pos) /*!< DWT FUNCTION: DATAVADDR1 Mask */
  895. #define DWT_FUNCTION_DATAVADDR0_Pos 12 /*!< DWT FUNCTION: DATAVADDR0 Position */
  896. #define DWT_FUNCTION_DATAVADDR0_Msk (0xFUL << DWT_FUNCTION_DATAVADDR0_Pos) /*!< DWT FUNCTION: DATAVADDR0 Mask */
  897. #define DWT_FUNCTION_DATAVSIZE_Pos 10 /*!< DWT FUNCTION: DATAVSIZE Position */
  898. #define DWT_FUNCTION_DATAVSIZE_Msk (0x3UL << DWT_FUNCTION_DATAVSIZE_Pos) /*!< DWT FUNCTION: DATAVSIZE Mask */
  899. #define DWT_FUNCTION_LNK1ENA_Pos 9 /*!< DWT FUNCTION: LNK1ENA Position */
  900. #define DWT_FUNCTION_LNK1ENA_Msk (0x1UL << DWT_FUNCTION_LNK1ENA_Pos) /*!< DWT FUNCTION: LNK1ENA Mask */
  901. #define DWT_FUNCTION_DATAVMATCH_Pos 8 /*!< DWT FUNCTION: DATAVMATCH Position */
  902. #define DWT_FUNCTION_DATAVMATCH_Msk (0x1UL << DWT_FUNCTION_DATAVMATCH_Pos) /*!< DWT FUNCTION: DATAVMATCH Mask */
  903. #define DWT_FUNCTION_CYCMATCH_Pos 7 /*!< DWT FUNCTION: CYCMATCH Position */
  904. #define DWT_FUNCTION_CYCMATCH_Msk (0x1UL << DWT_FUNCTION_CYCMATCH_Pos) /*!< DWT FUNCTION: CYCMATCH Mask */
  905. #define DWT_FUNCTION_EMITRANGE_Pos 5 /*!< DWT FUNCTION: EMITRANGE Position */
  906. #define DWT_FUNCTION_EMITRANGE_Msk (0x1UL << DWT_FUNCTION_EMITRANGE_Pos) /*!< DWT FUNCTION: EMITRANGE Mask */
  907. #define DWT_FUNCTION_FUNCTION_Pos 0 /*!< DWT FUNCTION: FUNCTION Position */
  908. #define DWT_FUNCTION_FUNCTION_Msk (0xFUL /*<< DWT_FUNCTION_FUNCTION_Pos*/) /*!< DWT FUNCTION: FUNCTION Mask */
  909. /*@}*/ /* end of group CMSIS_DWT */
  910. /** \ingroup CMSIS_core_register
  911. \defgroup CMSIS_TPI Trace Port Interface (TPI)
  912. \brief Type definitions for the Trace Port Interface (TPI)
  913. @{
  914. */
  915. /** \brief Structure type to access the Trace Port Interface Register (TPI).
  916. */
  917. typedef struct
  918. {
  919. __IO uint32_t SSPSR; /*!< Offset: 0x000 (R/ ) Supported Parallel Port Size Register */
  920. __IO uint32_t CSPSR; /*!< Offset: 0x004 (R/W) Current Parallel Port Size Register */
  921. uint32_t RESERVED0[2];
  922. __IO uint32_t ACPR; /*!< Offset: 0x010 (R/W) Asynchronous Clock Prescaler Register */
  923. uint32_t RESERVED1[55];
  924. __IO uint32_t SPPR; /*!< Offset: 0x0F0 (R/W) Selected Pin Protocol Register */
  925. uint32_t RESERVED2[131];
  926. __I uint32_t FFSR; /*!< Offset: 0x300 (R/ ) Formatter and Flush Status Register */
  927. __IO uint32_t FFCR; /*!< Offset: 0x304 (R/W) Formatter and Flush Control Register */
  928. __I uint32_t FSCR; /*!< Offset: 0x308 (R/ ) Formatter Synchronization Counter Register */
  929. uint32_t RESERVED3[759];
  930. __I uint32_t TRIGGER; /*!< Offset: 0xEE8 (R/ ) TRIGGER */
  931. __I uint32_t FIFO0; /*!< Offset: 0xEEC (R/ ) Integration ETM Data */
  932. __I uint32_t ITATBCTR2; /*!< Offset: 0xEF0 (R/ ) ITATBCTR2 */
  933. uint32_t RESERVED4[1];
  934. __I uint32_t ITATBCTR0; /*!< Offset: 0xEF8 (R/ ) ITATBCTR0 */
  935. __I uint32_t FIFO1; /*!< Offset: 0xEFC (R/ ) Integration ITM Data */
  936. __IO uint32_t ITCTRL; /*!< Offset: 0xF00 (R/W) Integration Mode Control */
  937. uint32_t RESERVED5[39];
  938. __IO uint32_t CLAIMSET; /*!< Offset: 0xFA0 (R/W) Claim tag set */
  939. __IO uint32_t CLAIMCLR; /*!< Offset: 0xFA4 (R/W) Claim tag clear */
  940. uint32_t RESERVED7[8];
  941. __I uint32_t DEVID; /*!< Offset: 0xFC8 (R/ ) TPIU_DEVID */
  942. __I uint32_t DEVTYPE; /*!< Offset: 0xFCC (R/ ) TPIU_DEVTYPE */
  943. } TPI_Type;
  944. /* TPI Asynchronous Clock Prescaler Register Definitions */
  945. #define TPI_ACPR_PRESCALER_Pos 0 /*!< TPI ACPR: PRESCALER Position */
  946. #define TPI_ACPR_PRESCALER_Msk (0x1FFFUL /*<< TPI_ACPR_PRESCALER_Pos*/) /*!< TPI ACPR: PRESCALER Mask */
  947. /* TPI Selected Pin Protocol Register Definitions */
  948. #define TPI_SPPR_TXMODE_Pos 0 /*!< TPI SPPR: TXMODE Position */
  949. #define TPI_SPPR_TXMODE_Msk (0x3UL /*<< TPI_SPPR_TXMODE_Pos*/) /*!< TPI SPPR: TXMODE Mask */
  950. /* TPI Formatter and Flush Status Register Definitions */
  951. #define TPI_FFSR_FtNonStop_Pos 3 /*!< TPI FFSR: FtNonStop Position */
  952. #define TPI_FFSR_FtNonStop_Msk (0x1UL << TPI_FFSR_FtNonStop_Pos) /*!< TPI FFSR: FtNonStop Mask */
  953. #define TPI_FFSR_TCPresent_Pos 2 /*!< TPI FFSR: TCPresent Position */
  954. #define TPI_FFSR_TCPresent_Msk (0x1UL << TPI_FFSR_TCPresent_Pos) /*!< TPI FFSR: TCPresent Mask */
  955. #define TPI_FFSR_FtStopped_Pos 1 /*!< TPI FFSR: FtStopped Position */
  956. #define TPI_FFSR_FtStopped_Msk (0x1UL << TPI_FFSR_FtStopped_Pos) /*!< TPI FFSR: FtStopped Mask */
  957. #define TPI_FFSR_FlInProg_Pos 0 /*!< TPI FFSR: FlInProg Position */
  958. #define TPI_FFSR_FlInProg_Msk (0x1UL /*<< TPI_FFSR_FlInProg_Pos*/) /*!< TPI FFSR: FlInProg Mask */
  959. /* TPI Formatter and Flush Control Register Definitions */
  960. #define TPI_FFCR_TrigIn_Pos 8 /*!< TPI FFCR: TrigIn Position */
  961. #define TPI_FFCR_TrigIn_Msk (0x1UL << TPI_FFCR_TrigIn_Pos) /*!< TPI FFCR: TrigIn Mask */
  962. #define TPI_FFCR_EnFCont_Pos 1 /*!< TPI FFCR: EnFCont Position */
  963. #define TPI_FFCR_EnFCont_Msk (0x1UL << TPI_FFCR_EnFCont_Pos) /*!< TPI FFCR: EnFCont Mask */
  964. /* TPI TRIGGER Register Definitions */
  965. #define TPI_TRIGGER_TRIGGER_Pos 0 /*!< TPI TRIGGER: TRIGGER Position */
  966. #define TPI_TRIGGER_TRIGGER_Msk (0x1UL /*<< TPI_TRIGGER_TRIGGER_Pos*/) /*!< TPI TRIGGER: TRIGGER Mask */
  967. /* TPI Integration ETM Data Register Definitions (FIFO0) */
  968. #define TPI_FIFO0_ITM_ATVALID_Pos 29 /*!< TPI FIFO0: ITM_ATVALID Position */
  969. #define TPI_FIFO0_ITM_ATVALID_Msk (0x3UL << TPI_FIFO0_ITM_ATVALID_Pos) /*!< TPI FIFO0: ITM_ATVALID Mask */
  970. #define TPI_FIFO0_ITM_bytecount_Pos 27 /*!< TPI FIFO0: ITM_bytecount Position */
  971. #define TPI_FIFO0_ITM_bytecount_Msk (0x3UL << TPI_FIFO0_ITM_bytecount_Pos) /*!< TPI FIFO0: ITM_bytecount Mask */
  972. #define TPI_FIFO0_ETM_ATVALID_Pos 26 /*!< TPI FIFO0: ETM_ATVALID Position */
  973. #define TPI_FIFO0_ETM_ATVALID_Msk (0x3UL << TPI_FIFO0_ETM_ATVALID_Pos) /*!< TPI FIFO0: ETM_ATVALID Mask */
  974. #define TPI_FIFO0_ETM_bytecount_Pos 24 /*!< TPI FIFO0: ETM_bytecount Position */
  975. #define TPI_FIFO0_ETM_bytecount_Msk (0x3UL << TPI_FIFO0_ETM_bytecount_Pos) /*!< TPI FIFO0: ETM_bytecount Mask */
  976. #define TPI_FIFO0_ETM2_Pos 16 /*!< TPI FIFO0: ETM2 Position */
  977. #define TPI_FIFO0_ETM2_Msk (0xFFUL << TPI_FIFO0_ETM2_Pos) /*!< TPI FIFO0: ETM2 Mask */
  978. #define TPI_FIFO0_ETM1_Pos 8 /*!< TPI FIFO0: ETM1 Position */
  979. #define TPI_FIFO0_ETM1_Msk (0xFFUL << TPI_FIFO0_ETM1_Pos) /*!< TPI FIFO0: ETM1 Mask */
  980. #define TPI_FIFO0_ETM0_Pos 0 /*!< TPI FIFO0: ETM0 Position */
  981. #define TPI_FIFO0_ETM0_Msk (0xFFUL /*<< TPI_FIFO0_ETM0_Pos*/) /*!< TPI FIFO0: ETM0 Mask */
  982. /* TPI ITATBCTR2 Register Definitions */
  983. #define TPI_ITATBCTR2_ATREADY_Pos 0 /*!< TPI ITATBCTR2: ATREADY Position */
  984. #define TPI_ITATBCTR2_ATREADY_Msk (0x1UL /*<< TPI_ITATBCTR2_ATREADY_Pos*/) /*!< TPI ITATBCTR2: ATREADY Mask */
  985. /* TPI Integration ITM Data Register Definitions (FIFO1) */
  986. #define TPI_FIFO1_ITM_ATVALID_Pos 29 /*!< TPI FIFO1: ITM_ATVALID Position */
  987. #define TPI_FIFO1_ITM_ATVALID_Msk (0x3UL << TPI_FIFO1_ITM_ATVALID_Pos) /*!< TPI FIFO1: ITM_ATVALID Mask */
  988. #define TPI_FIFO1_ITM_bytecount_Pos 27 /*!< TPI FIFO1: ITM_bytecount Position */
  989. #define TPI_FIFO1_ITM_bytecount_Msk (0x3UL << TPI_FIFO1_ITM_bytecount_Pos) /*!< TPI FIFO1: ITM_bytecount Mask */
  990. #define TPI_FIFO1_ETM_ATVALID_Pos 26 /*!< TPI FIFO1: ETM_ATVALID Position */
  991. #define TPI_FIFO1_ETM_ATVALID_Msk (0x3UL << TPI_FIFO1_ETM_ATVALID_Pos) /*!< TPI FIFO1: ETM_ATVALID Mask */
  992. #define TPI_FIFO1_ETM_bytecount_Pos 24 /*!< TPI FIFO1: ETM_bytecount Position */
  993. #define TPI_FIFO1_ETM_bytecount_Msk (0x3UL << TPI_FIFO1_ETM_bytecount_Pos) /*!< TPI FIFO1: ETM_bytecount Mask */
  994. #define TPI_FIFO1_ITM2_Pos 16 /*!< TPI FIFO1: ITM2 Position */
  995. #define TPI_FIFO1_ITM2_Msk (0xFFUL << TPI_FIFO1_ITM2_Pos) /*!< TPI FIFO1: ITM2 Mask */
  996. #define TPI_FIFO1_ITM1_Pos 8 /*!< TPI FIFO1: ITM1 Position */
  997. #define TPI_FIFO1_ITM1_Msk (0xFFUL << TPI_FIFO1_ITM1_Pos) /*!< TPI FIFO1: ITM1 Mask */
  998. #define TPI_FIFO1_ITM0_Pos 0 /*!< TPI FIFO1: ITM0 Position */
  999. #define TPI_FIFO1_ITM0_Msk (0xFFUL /*<< TPI_FIFO1_ITM0_Pos*/) /*!< TPI FIFO1: ITM0 Mask */
  1000. /* TPI ITATBCTR0 Register Definitions */
  1001. #define TPI_ITATBCTR0_ATREADY_Pos 0 /*!< TPI ITATBCTR0: ATREADY Position */
  1002. #define TPI_ITATBCTR0_ATREADY_Msk (0x1UL /*<< TPI_ITATBCTR0_ATREADY_Pos*/) /*!< TPI ITATBCTR0: ATREADY Mask */
  1003. /* TPI Integration Mode Control Register Definitions */
  1004. #define TPI_ITCTRL_Mode_Pos 0 /*!< TPI ITCTRL: Mode Position */
  1005. #define TPI_ITCTRL_Mode_Msk (0x1UL /*<< TPI_ITCTRL_Mode_Pos*/) /*!< TPI ITCTRL: Mode Mask */
  1006. /* TPI DEVID Register Definitions */
  1007. #define TPI_DEVID_NRZVALID_Pos 11 /*!< TPI DEVID: NRZVALID Position */
  1008. #define TPI_DEVID_NRZVALID_Msk (0x1UL << TPI_DEVID_NRZVALID_Pos) /*!< TPI DEVID: NRZVALID Mask */
  1009. #define TPI_DEVID_MANCVALID_Pos 10 /*!< TPI DEVID: MANCVALID Position */
  1010. #define TPI_DEVID_MANCVALID_Msk (0x1UL << TPI_DEVID_MANCVALID_Pos) /*!< TPI DEVID: MANCVALID Mask */
  1011. #define TPI_DEVID_PTINVALID_Pos 9 /*!< TPI DEVID: PTINVALID Position */
  1012. #define TPI_DEVID_PTINVALID_Msk (0x1UL << TPI_DEVID_PTINVALID_Pos) /*!< TPI DEVID: PTINVALID Mask */
  1013. #define TPI_DEVID_MinBufSz_Pos 6 /*!< TPI DEVID: MinBufSz Position */
  1014. #define TPI_DEVID_MinBufSz_Msk (0x7UL << TPI_DEVID_MinBufSz_Pos) /*!< TPI DEVID: MinBufSz Mask */
  1015. #define TPI_DEVID_AsynClkIn_Pos 5 /*!< TPI DEVID: AsynClkIn Position */
  1016. #define TPI_DEVID_AsynClkIn_Msk (0x1UL << TPI_DEVID_AsynClkIn_Pos) /*!< TPI DEVID: AsynClkIn Mask */
  1017. #define TPI_DEVID_NrTraceInput_Pos 0 /*!< TPI DEVID: NrTraceInput Position */
  1018. #define TPI_DEVID_NrTraceInput_Msk (0x1FUL /*<< TPI_DEVID_NrTraceInput_Pos*/) /*!< TPI DEVID: NrTraceInput Mask */
  1019. /* TPI DEVTYPE Register Definitions */
  1020. #define TPI_DEVTYPE_MajorType_Pos 4 /*!< TPI DEVTYPE: MajorType Position */
  1021. #define TPI_DEVTYPE_MajorType_Msk (0xFUL << TPI_DEVTYPE_MajorType_Pos) /*!< TPI DEVTYPE: MajorType Mask */
  1022. #define TPI_DEVTYPE_SubType_Pos 0 /*!< TPI DEVTYPE: SubType Position */
  1023. #define TPI_DEVTYPE_SubType_Msk (0xFUL /*<< TPI_DEVTYPE_SubType_Pos*/) /*!< TPI DEVTYPE: SubType Mask */
  1024. /*@}*/ /* end of group CMSIS_TPI */
  1025. #if (__MPU_PRESENT == 1)
  1026. /** \ingroup CMSIS_core_register
  1027. \defgroup CMSIS_MPU Memory Protection Unit (MPU)
  1028. \brief Type definitions for the Memory Protection Unit (MPU)
  1029. @{
  1030. */
  1031. /** \brief Structure type to access the Memory Protection Unit (MPU).
  1032. */
  1033. typedef struct
  1034. {
  1035. __I uint32_t TYPE; /*!< Offset: 0x000 (R/ ) MPU Type Register */
  1036. __IO uint32_t CTRL; /*!< Offset: 0x004 (R/W) MPU Control Register */
  1037. __IO uint32_t RNR; /*!< Offset: 0x008 (R/W) MPU Region RNRber Register */
  1038. __IO uint32_t RBAR; /*!< Offset: 0x00C (R/W) MPU Region Base Address Register */
  1039. __IO uint32_t RASR; /*!< Offset: 0x010 (R/W) MPU Region Attribute and Size Register */
  1040. __IO uint32_t RBAR_A1; /*!< Offset: 0x014 (R/W) MPU Alias 1 Region Base Address Register */
  1041. __IO uint32_t RASR_A1; /*!< Offset: 0x018 (R/W) MPU Alias 1 Region Attribute and Size Register */
  1042. __IO uint32_t RBAR_A2; /*!< Offset: 0x01C (R/W) MPU Alias 2 Region Base Address Register */
  1043. __IO uint32_t RASR_A2; /*!< Offset: 0x020 (R/W) MPU Alias 2 Region Attribute and Size Register */
  1044. __IO uint32_t RBAR_A3; /*!< Offset: 0x024 (R/W) MPU Alias 3 Region Base Address Register */
  1045. __IO uint32_t RASR_A3; /*!< Offset: 0x028 (R/W) MPU Alias 3 Region Attribute and Size Register */
  1046. } MPU_Type;
  1047. /* MPU Type Register */
  1048. #define MPU_TYPE_IREGION_Pos 16 /*!< MPU TYPE: IREGION Position */
  1049. #define MPU_TYPE_IREGION_Msk (0xFFUL << MPU_TYPE_IREGION_Pos) /*!< MPU TYPE: IREGION Mask */
  1050. #define MPU_TYPE_DREGION_Pos 8 /*!< MPU TYPE: DREGION Position */
  1051. #define MPU_TYPE_DREGION_Msk (0xFFUL << MPU_TYPE_DREGION_Pos) /*!< MPU TYPE: DREGION Mask */
  1052. #define MPU_TYPE_SEPARATE_Pos 0 /*!< MPU TYPE: SEPARATE Position */
  1053. #define MPU_TYPE_SEPARATE_Msk (1UL /*<< MPU_TYPE_SEPARATE_Pos*/) /*!< MPU TYPE: SEPARATE Mask */
  1054. /* MPU Control Register */
  1055. #define MPU_CTRL_PRIVDEFENA_Pos 2 /*!< MPU CTRL: PRIVDEFENA Position */
  1056. #define MPU_CTRL_PRIVDEFENA_Msk (1UL << MPU_CTRL_PRIVDEFENA_Pos) /*!< MPU CTRL: PRIVDEFENA Mask */
  1057. #define MPU_CTRL_HFNMIENA_Pos 1 /*!< MPU CTRL: HFNMIENA Position */
  1058. #define MPU_CTRL_HFNMIENA_Msk (1UL << MPU_CTRL_HFNMIENA_Pos) /*!< MPU CTRL: HFNMIENA Mask */
  1059. #define MPU_CTRL_ENABLE_Pos 0 /*!< MPU CTRL: ENABLE Position */
  1060. #define MPU_CTRL_ENABLE_Msk (1UL /*<< MPU_CTRL_ENABLE_Pos*/) /*!< MPU CTRL: ENABLE Mask */
  1061. /* MPU Region Number Register */
  1062. #define MPU_RNR_REGION_Pos 0 /*!< MPU RNR: REGION Position */
  1063. #define MPU_RNR_REGION_Msk (0xFFUL /*<< MPU_RNR_REGION_Pos*/) /*!< MPU RNR: REGION Mask */
  1064. /* MPU Region Base Address Register */
  1065. #define MPU_RBAR_ADDR_Pos 5 /*!< MPU RBAR: ADDR Position */
  1066. #define MPU_RBAR_ADDR_Msk (0x7FFFFFFUL << MPU_RBAR_ADDR_Pos) /*!< MPU RBAR: ADDR Mask */
  1067. #define MPU_RBAR_VALID_Pos 4 /*!< MPU RBAR: VALID Position */
  1068. #define MPU_RBAR_VALID_Msk (1UL << MPU_RBAR_VALID_Pos) /*!< MPU RBAR: VALID Mask */
  1069. #define MPU_RBAR_REGION_Pos 0 /*!< MPU RBAR: REGION Position */
  1070. #define MPU_RBAR_REGION_Msk (0xFUL /*<< MPU_RBAR_REGION_Pos*/) /*!< MPU RBAR: REGION Mask */
  1071. /* MPU Region Attribute and Size Register */
  1072. #define MPU_RASR_ATTRS_Pos 16 /*!< MPU RASR: MPU Region Attribute field Position */
  1073. #define MPU_RASR_ATTRS_Msk (0xFFFFUL << MPU_RASR_ATTRS_Pos) /*!< MPU RASR: MPU Region Attribute field Mask */
  1074. #define MPU_RASR_XN_Pos 28 /*!< MPU RASR: ATTRS.XN Position */
  1075. #define MPU_RASR_XN_Msk (1UL << MPU_RASR_XN_Pos) /*!< MPU RASR: ATTRS.XN Mask */
  1076. #define MPU_RASR_AP_Pos 24 /*!< MPU RASR: ATTRS.AP Position */
  1077. #define MPU_RASR_AP_Msk (0x7UL << MPU_RASR_AP_Pos) /*!< MPU RASR: ATTRS.AP Mask */
  1078. #define MPU_RASR_TEX_Pos 19 /*!< MPU RASR: ATTRS.TEX Position */
  1079. #define MPU_RASR_TEX_Msk (0x7UL << MPU_RASR_TEX_Pos) /*!< MPU RASR: ATTRS.TEX Mask */
  1080. #define MPU_RASR_S_Pos 18 /*!< MPU RASR: ATTRS.S Position */
  1081. #define MPU_RASR_S_Msk (1UL << MPU_RASR_S_Pos) /*!< MPU RASR: ATTRS.S Mask */
  1082. #define MPU_RASR_C_Pos 17 /*!< MPU RASR: ATTRS.C Position */
  1083. #define MPU_RASR_C_Msk (1UL << MPU_RASR_C_Pos) /*!< MPU RASR: ATTRS.C Mask */
  1084. #define MPU_RASR_B_Pos 16 /*!< MPU RASR: ATTRS.B Position */
  1085. #define MPU_RASR_B_Msk (1UL << MPU_RASR_B_Pos) /*!< MPU RASR: ATTRS.B Mask */
  1086. #define MPU_RASR_SRD_Pos 8 /*!< MPU RASR: Sub-Region Disable Position */
  1087. #define MPU_RASR_SRD_Msk (0xFFUL << MPU_RASR_SRD_Pos) /*!< MPU RASR: Sub-Region Disable Mask */
  1088. #define MPU_RASR_SIZE_Pos 1 /*!< MPU RASR: Region Size Field Position */
  1089. #define MPU_RASR_SIZE_Msk (0x1FUL << MPU_RASR_SIZE_Pos) /*!< MPU RASR: Region Size Field Mask */
  1090. #define MPU_RASR_ENABLE_Pos 0 /*!< MPU RASR: Region enable bit Position */
  1091. #define MPU_RASR_ENABLE_Msk (1UL /*<< MPU_RASR_ENABLE_Pos*/) /*!< MPU RASR: Region enable bit Disable Mask */
  1092. /*@} end of group CMSIS_MPU */
  1093. #endif
  1094. #if (__FPU_PRESENT == 1)
  1095. /** \ingroup CMSIS_core_register
  1096. \defgroup CMSIS_FPU Floating Point Unit (FPU)
  1097. \brief Type definitions for the Floating Point Unit (FPU)
  1098. @{
  1099. */
  1100. /** \brief Structure type to access the Floating Point Unit (FPU).
  1101. */
  1102. typedef struct
  1103. {
  1104. uint32_t RESERVED0[1];
  1105. __IO uint32_t FPCCR; /*!< Offset: 0x004 (R/W) Floating-Point Context Control Register */
  1106. __IO uint32_t FPCAR; /*!< Offset: 0x008 (R/W) Floating-Point Context Address Register */
  1107. __IO uint32_t FPDSCR; /*!< Offset: 0x00C (R/W) Floating-Point Default Status Control Register */
  1108. __I uint32_t MVFR0; /*!< Offset: 0x010 (R/ ) Media and FP Feature Register 0 */
  1109. __I uint32_t MVFR1; /*!< Offset: 0x014 (R/ ) Media and FP Feature Register 1 */
  1110. __I uint32_t MVFR2; /*!< Offset: 0x018 (R/ ) Media and FP Feature Register 2 */
  1111. } FPU_Type;
  1112. /* Floating-Point Context Control Register */
  1113. #define FPU_FPCCR_ASPEN_Pos 31 /*!< FPCCR: ASPEN bit Position */
  1114. #define FPU_FPCCR_ASPEN_Msk (1UL << FPU_FPCCR_ASPEN_Pos) /*!< FPCCR: ASPEN bit Mask */
  1115. #define FPU_FPCCR_LSPEN_Pos 30 /*!< FPCCR: LSPEN Position */
  1116. #define FPU_FPCCR_LSPEN_Msk (1UL << FPU_FPCCR_LSPEN_Pos) /*!< FPCCR: LSPEN bit Mask */
  1117. #define FPU_FPCCR_MONRDY_Pos 8 /*!< FPCCR: MONRDY Position */
  1118. #define FPU_FPCCR_MONRDY_Msk (1UL << FPU_FPCCR_MONRDY_Pos) /*!< FPCCR: MONRDY bit Mask */
  1119. #define FPU_FPCCR_BFRDY_Pos 6 /*!< FPCCR: BFRDY Position */
  1120. #define FPU_FPCCR_BFRDY_Msk (1UL << FPU_FPCCR_BFRDY_Pos) /*!< FPCCR: BFRDY bit Mask */
  1121. #define FPU_FPCCR_MMRDY_Pos 5 /*!< FPCCR: MMRDY Position */
  1122. #define FPU_FPCCR_MMRDY_Msk (1UL << FPU_FPCCR_MMRDY_Pos) /*!< FPCCR: MMRDY bit Mask */
  1123. #define FPU_FPCCR_HFRDY_Pos 4 /*!< FPCCR: HFRDY Position */
  1124. #define FPU_FPCCR_HFRDY_Msk (1UL << FPU_FPCCR_HFRDY_Pos) /*!< FPCCR: HFRDY bit Mask */
  1125. #define FPU_FPCCR_THREAD_Pos 3 /*!< FPCCR: processor mode bit Position */
  1126. #define FPU_FPCCR_THREAD_Msk (1UL << FPU_FPCCR_THREAD_Pos) /*!< FPCCR: processor mode active bit Mask */
  1127. #define FPU_FPCCR_USER_Pos 1 /*!< FPCCR: privilege level bit Position */
  1128. #define FPU_FPCCR_USER_Msk (1UL << FPU_FPCCR_USER_Pos) /*!< FPCCR: privilege level bit Mask */
  1129. #define FPU_FPCCR_LSPACT_Pos 0 /*!< FPCCR: Lazy state preservation active bit Position */
  1130. #define FPU_FPCCR_LSPACT_Msk (1UL /*<< FPU_FPCCR_LSPACT_Pos*/) /*!< FPCCR: Lazy state preservation active bit Mask */
  1131. /* Floating-Point Context Address Register */
  1132. #define FPU_FPCAR_ADDRESS_Pos 3 /*!< FPCAR: ADDRESS bit Position */
  1133. #define FPU_FPCAR_ADDRESS_Msk (0x1FFFFFFFUL << FPU_FPCAR_ADDRESS_Pos) /*!< FPCAR: ADDRESS bit Mask */
  1134. /* Floating-Point Default Status Control Register */
  1135. #define FPU_FPDSCR_AHP_Pos 26 /*!< FPDSCR: AHP bit Position */
  1136. #define FPU_FPDSCR_AHP_Msk (1UL << FPU_FPDSCR_AHP_Pos) /*!< FPDSCR: AHP bit Mask */
  1137. #define FPU_FPDSCR_DN_Pos 25 /*!< FPDSCR: DN bit Position */
  1138. #define FPU_FPDSCR_DN_Msk (1UL << FPU_FPDSCR_DN_Pos) /*!< FPDSCR: DN bit Mask */
  1139. #define FPU_FPDSCR_FZ_Pos 24 /*!< FPDSCR: FZ bit Position */
  1140. #define FPU_FPDSCR_FZ_Msk (1UL << FPU_FPDSCR_FZ_Pos) /*!< FPDSCR: FZ bit Mask */
  1141. #define FPU_FPDSCR_RMode_Pos 22 /*!< FPDSCR: RMode bit Position */
  1142. #define FPU_FPDSCR_RMode_Msk (3UL << FPU_FPDSCR_RMode_Pos) /*!< FPDSCR: RMode bit Mask */
  1143. /* Media and FP Feature Register 0 */
  1144. #define FPU_MVFR0_FP_rounding_modes_Pos 28 /*!< MVFR0: FP rounding modes bits Position */
  1145. #define FPU_MVFR0_FP_rounding_modes_Msk (0xFUL << FPU_MVFR0_FP_rounding_modes_Pos) /*!< MVFR0: FP rounding modes bits Mask */
  1146. #define FPU_MVFR0_Short_vectors_Pos 24 /*!< MVFR0: Short vectors bits Position */
  1147. #define FPU_MVFR0_Short_vectors_Msk (0xFUL << FPU_MVFR0_Short_vectors_Pos) /*!< MVFR0: Short vectors bits Mask */
  1148. #define FPU_MVFR0_Square_root_Pos 20 /*!< MVFR0: Square root bits Position */
  1149. #define FPU_MVFR0_Square_root_Msk (0xFUL << FPU_MVFR0_Square_root_Pos) /*!< MVFR0: Square root bits Mask */
  1150. #define FPU_MVFR0_Divide_Pos 16 /*!< MVFR0: Divide bits Position */
  1151. #define FPU_MVFR0_Divide_Msk (0xFUL << FPU_MVFR0_Divide_Pos) /*!< MVFR0: Divide bits Mask */
  1152. #define FPU_MVFR0_FP_excep_trapping_Pos 12 /*!< MVFR0: FP exception trapping bits Position */
  1153. #define FPU_MVFR0_FP_excep_trapping_Msk (0xFUL << FPU_MVFR0_FP_excep_trapping_Pos) /*!< MVFR0: FP exception trapping bits Mask */
  1154. #define FPU_MVFR0_Double_precision_Pos 8 /*!< MVFR0: Double-precision bits Position */
  1155. #define FPU_MVFR0_Double_precision_Msk (0xFUL << FPU_MVFR0_Double_precision_Pos) /*!< MVFR0: Double-precision bits Mask */
  1156. #define FPU_MVFR0_Single_precision_Pos 4 /*!< MVFR0: Single-precision bits Position */
  1157. #define FPU_MVFR0_Single_precision_Msk (0xFUL << FPU_MVFR0_Single_precision_Pos) /*!< MVFR0: Single-precision bits Mask */
  1158. #define FPU_MVFR0_A_SIMD_registers_Pos 0 /*!< MVFR0: A_SIMD registers bits Position */
  1159. #define FPU_MVFR0_A_SIMD_registers_Msk (0xFUL /*<< FPU_MVFR0_A_SIMD_registers_Pos*/) /*!< MVFR0: A_SIMD registers bits Mask */
  1160. /* Media and FP Feature Register 1 */
  1161. #define FPU_MVFR1_FP_fused_MAC_Pos 28 /*!< MVFR1: FP fused MAC bits Position */
  1162. #define FPU_MVFR1_FP_fused_MAC_Msk (0xFUL << FPU_MVFR1_FP_fused_MAC_Pos) /*!< MVFR1: FP fused MAC bits Mask */
  1163. #define FPU_MVFR1_FP_HPFP_Pos 24 /*!< MVFR1: FP HPFP bits Position */
  1164. #define FPU_MVFR1_FP_HPFP_Msk (0xFUL << FPU_MVFR1_FP_HPFP_Pos) /*!< MVFR1: FP HPFP bits Mask */
  1165. #define FPU_MVFR1_D_NaN_mode_Pos 4 /*!< MVFR1: D_NaN mode bits Position */
  1166. #define FPU_MVFR1_D_NaN_mode_Msk (0xFUL << FPU_MVFR1_D_NaN_mode_Pos) /*!< MVFR1: D_NaN mode bits Mask */
  1167. #define FPU_MVFR1_FtZ_mode_Pos 0 /*!< MVFR1: FtZ mode bits Position */
  1168. #define FPU_MVFR1_FtZ_mode_Msk (0xFUL /*<< FPU_MVFR1_FtZ_mode_Pos*/) /*!< MVFR1: FtZ mode bits Mask */
  1169. /* Media and FP Feature Register 2 */
  1170. /*@} end of group CMSIS_FPU */
  1171. #endif
  1172. /** \ingroup CMSIS_core_register
  1173. \defgroup CMSIS_CoreDebug Core Debug Registers (CoreDebug)
  1174. \brief Type definitions for the Core Debug Registers
  1175. @{
  1176. */
  1177. /** \brief Structure type to access the Core Debug Register (CoreDebug).
  1178. */
  1179. typedef struct
  1180. {
  1181. __IO uint32_t DHCSR; /*!< Offset: 0x000 (R/W) Debug Halting Control and Status Register */
  1182. __O uint32_t DCRSR; /*!< Offset: 0x004 ( /W) Debug Core Register Selector Register */
  1183. __IO uint32_t DCRDR; /*!< Offset: 0x008 (R/W) Debug Core Register Data Register */
  1184. __IO uint32_t DEMCR; /*!< Offset: 0x00C (R/W) Debug Exception and Monitor Control Register */
  1185. } CoreDebug_Type;
  1186. /* Debug Halting Control and Status Register */
  1187. #define CoreDebug_DHCSR_DBGKEY_Pos 16 /*!< CoreDebug DHCSR: DBGKEY Position */
  1188. #define CoreDebug_DHCSR_DBGKEY_Msk (0xFFFFUL << CoreDebug_DHCSR_DBGKEY_Pos) /*!< CoreDebug DHCSR: DBGKEY Mask */
  1189. #define CoreDebug_DHCSR_S_RESET_ST_Pos 25 /*!< CoreDebug DHCSR: S_RESET_ST Position */
  1190. #define CoreDebug_DHCSR_S_RESET_ST_Msk (1UL << CoreDebug_DHCSR_S_RESET_ST_Pos) /*!< CoreDebug DHCSR: S_RESET_ST Mask */
  1191. #define CoreDebug_DHCSR_S_RETIRE_ST_Pos 24 /*!< CoreDebug DHCSR: S_RETIRE_ST Position */
  1192. #define CoreDebug_DHCSR_S_RETIRE_ST_Msk (1UL << CoreDebug_DHCSR_S_RETIRE_ST_Pos) /*!< CoreDebug DHCSR: S_RETIRE_ST Mask */
  1193. #define CoreDebug_DHCSR_S_LOCKUP_Pos 19 /*!< CoreDebug DHCSR: S_LOCKUP Position */
  1194. #define CoreDebug_DHCSR_S_LOCKUP_Msk (1UL << CoreDebug_DHCSR_S_LOCKUP_Pos) /*!< CoreDebug DHCSR: S_LOCKUP Mask */
  1195. #define CoreDebug_DHCSR_S_SLEEP_Pos 18 /*!< CoreDebug DHCSR: S_SLEEP Position */
  1196. #define CoreDebug_DHCSR_S_SLEEP_Msk (1UL << CoreDebug_DHCSR_S_SLEEP_Pos) /*!< CoreDebug DHCSR: S_SLEEP Mask */
  1197. #define CoreDebug_DHCSR_S_HALT_Pos 17 /*!< CoreDebug DHCSR: S_HALT Position */
  1198. #define CoreDebug_DHCSR_S_HALT_Msk (1UL << CoreDebug_DHCSR_S_HALT_Pos) /*!< CoreDebug DHCSR: S_HALT Mask */
  1199. #define CoreDebug_DHCSR_S_REGRDY_Pos 16 /*!< CoreDebug DHCSR: S_REGRDY Position */
  1200. #define CoreDebug_DHCSR_S_REGRDY_Msk (1UL << CoreDebug_DHCSR_S_REGRDY_Pos) /*!< CoreDebug DHCSR: S_REGRDY Mask */
  1201. #define CoreDebug_DHCSR_C_SNAPSTALL_Pos 5 /*!< CoreDebug DHCSR: C_SNAPSTALL Position */
  1202. #define CoreDebug_DHCSR_C_SNAPSTALL_Msk (1UL << CoreDebug_DHCSR_C_SNAPSTALL_Pos) /*!< CoreDebug DHCSR: C_SNAPSTALL Mask */
  1203. #define CoreDebug_DHCSR_C_MASKINTS_Pos 3 /*!< CoreDebug DHCSR: C_MASKINTS Position */
  1204. #define CoreDebug_DHCSR_C_MASKINTS_Msk (1UL << CoreDebug_DHCSR_C_MASKINTS_Pos) /*!< CoreDebug DHCSR: C_MASKINTS Mask */
  1205. #define CoreDebug_DHCSR_C_STEP_Pos 2 /*!< CoreDebug DHCSR: C_STEP Position */
  1206. #define CoreDebug_DHCSR_C_STEP_Msk (1UL << CoreDebug_DHCSR_C_STEP_Pos) /*!< CoreDebug DHCSR: C_STEP Mask */
  1207. #define CoreDebug_DHCSR_C_HALT_Pos 1 /*!< CoreDebug DHCSR: C_HALT Position */
  1208. #define CoreDebug_DHCSR_C_HALT_Msk (1UL << CoreDebug_DHCSR_C_HALT_Pos) /*!< CoreDebug DHCSR: C_HALT Mask */
  1209. #define CoreDebug_DHCSR_C_DEBUGEN_Pos 0 /*!< CoreDebug DHCSR: C_DEBUGEN Position */
  1210. #define CoreDebug_DHCSR_C_DEBUGEN_Msk (1UL /*<< CoreDebug_DHCSR_C_DEBUGEN_Pos*/) /*!< CoreDebug DHCSR: C_DEBUGEN Mask */
  1211. /* Debug Core Register Selector Register */
  1212. #define CoreDebug_DCRSR_REGWnR_Pos 16 /*!< CoreDebug DCRSR: REGWnR Position */
  1213. #define CoreDebug_DCRSR_REGWnR_Msk (1UL << CoreDebug_DCRSR_REGWnR_Pos) /*!< CoreDebug DCRSR: REGWnR Mask */
  1214. #define CoreDebug_DCRSR_REGSEL_Pos 0 /*!< CoreDebug DCRSR: REGSEL Position */
  1215. #define CoreDebug_DCRSR_REGSEL_Msk (0x1FUL /*<< CoreDebug_DCRSR_REGSEL_Pos*/) /*!< CoreDebug DCRSR: REGSEL Mask */
  1216. /* Debug Exception and Monitor Control Register */
  1217. #define CoreDebug_DEMCR_TRCENA_Pos 24 /*!< CoreDebug DEMCR: TRCENA Position */
  1218. #define CoreDebug_DEMCR_TRCENA_Msk (1UL << CoreDebug_DEMCR_TRCENA_Pos) /*!< CoreDebug DEMCR: TRCENA Mask */
  1219. #define CoreDebug_DEMCR_MON_REQ_Pos 19 /*!< CoreDebug DEMCR: MON_REQ Position */
  1220. #define CoreDebug_DEMCR_MON_REQ_Msk (1UL << CoreDebug_DEMCR_MON_REQ_Pos) /*!< CoreDebug DEMCR: MON_REQ Mask */
  1221. #define CoreDebug_DEMCR_MON_STEP_Pos 18 /*!< CoreDebug DEMCR: MON_STEP Position */
  1222. #define CoreDebug_DEMCR_MON_STEP_Msk (1UL << CoreDebug_DEMCR_MON_STEP_Pos) /*!< CoreDebug DEMCR: MON_STEP Mask */
  1223. #define CoreDebug_DEMCR_MON_PEND_Pos 17 /*!< CoreDebug DEMCR: MON_PEND Position */
  1224. #define CoreDebug_DEMCR_MON_PEND_Msk (1UL << CoreDebug_DEMCR_MON_PEND_Pos) /*!< CoreDebug DEMCR: MON_PEND Mask */
  1225. #define CoreDebug_DEMCR_MON_EN_Pos 16 /*!< CoreDebug DEMCR: MON_EN Position */
  1226. #define CoreDebug_DEMCR_MON_EN_Msk (1UL << CoreDebug_DEMCR_MON_EN_Pos) /*!< CoreDebug DEMCR: MON_EN Mask */
  1227. #define CoreDebug_DEMCR_VC_HARDERR_Pos 10 /*!< CoreDebug DEMCR: VC_HARDERR Position */
  1228. #define CoreDebug_DEMCR_VC_HARDERR_Msk (1UL << CoreDebug_DEMCR_VC_HARDERR_Pos) /*!< CoreDebug DEMCR: VC_HARDERR Mask */
  1229. #define CoreDebug_DEMCR_VC_INTERR_Pos 9 /*!< CoreDebug DEMCR: VC_INTERR Position */
  1230. #define CoreDebug_DEMCR_VC_INTERR_Msk (1UL << CoreDebug_DEMCR_VC_INTERR_Pos) /*!< CoreDebug DEMCR: VC_INTERR Mask */
  1231. #define CoreDebug_DEMCR_VC_BUSERR_Pos 8 /*!< CoreDebug DEMCR: VC_BUSERR Position */
  1232. #define CoreDebug_DEMCR_VC_BUSERR_Msk (1UL << CoreDebug_DEMCR_VC_BUSERR_Pos) /*!< CoreDebug DEMCR: VC_BUSERR Mask */
  1233. #define CoreDebug_DEMCR_VC_STATERR_Pos 7 /*!< CoreDebug DEMCR: VC_STATERR Position */
  1234. #define CoreDebug_DEMCR_VC_STATERR_Msk (1UL << CoreDebug_DEMCR_VC_STATERR_Pos) /*!< CoreDebug DEMCR: VC_STATERR Mask */
  1235. #define CoreDebug_DEMCR_VC_CHKERR_Pos 6 /*!< CoreDebug DEMCR: VC_CHKERR Position */
  1236. #define CoreDebug_DEMCR_VC_CHKERR_Msk (1UL << CoreDebug_DEMCR_VC_CHKERR_Pos) /*!< CoreDebug DEMCR: VC_CHKERR Mask */
  1237. #define CoreDebug_DEMCR_VC_NOCPERR_Pos 5 /*!< CoreDebug DEMCR: VC_NOCPERR Position */
  1238. #define CoreDebug_DEMCR_VC_NOCPERR_Msk (1UL << CoreDebug_DEMCR_VC_NOCPERR_Pos) /*!< CoreDebug DEMCR: VC_NOCPERR Mask */
  1239. #define CoreDebug_DEMCR_VC_MMERR_Pos 4 /*!< CoreDebug DEMCR: VC_MMERR Position */
  1240. #define CoreDebug_DEMCR_VC_MMERR_Msk (1UL << CoreDebug_DEMCR_VC_MMERR_Pos) /*!< CoreDebug DEMCR: VC_MMERR Mask */
  1241. #define CoreDebug_DEMCR_VC_CORERESET_Pos 0 /*!< CoreDebug DEMCR: VC_CORERESET Position */
  1242. #define CoreDebug_DEMCR_VC_CORERESET_Msk (1UL /*<< CoreDebug_DEMCR_VC_CORERESET_Pos*/) /*!< CoreDebug DEMCR: VC_CORERESET Mask */
  1243. /*@} end of group CMSIS_CoreDebug */
  1244. /** \ingroup CMSIS_core_register
  1245. \defgroup CMSIS_core_base Core Definitions
  1246. \brief Definitions for base addresses, unions, and structures.
  1247. @{
  1248. */
  1249. /* Memory mapping of Cortex-M4 Hardware */
  1250. #define SCS_BASE (0xE000E000UL) /*!< System Control Space Base Address */
  1251. #define ITM_BASE (0xE0000000UL) /*!< ITM Base Address */
  1252. #define DWT_BASE (0xE0001000UL) /*!< DWT Base Address */
  1253. #define TPI_BASE (0xE0040000UL) /*!< TPI Base Address */
  1254. #define CoreDebug_BASE (0xE000EDF0UL) /*!< Core Debug Base Address */
  1255. #define SysTick_BASE (SCS_BASE + 0x0010UL) /*!< SysTick Base Address */
  1256. #define NVIC_BASE (SCS_BASE + 0x0100UL) /*!< NVIC Base Address */
  1257. #define SCB_BASE (SCS_BASE + 0x0D00UL) /*!< System Control Block Base Address */
  1258. #define SCnSCB ((SCnSCB_Type *) SCS_BASE ) /*!< System control Register not in SCB */
  1259. #define SCB ((SCB_Type *) SCB_BASE ) /*!< SCB configuration struct */
  1260. #define SysTick ((SysTick_Type *) SysTick_BASE ) /*!< SysTick configuration struct */
  1261. #define NVIC ((NVIC_Type *) NVIC_BASE ) /*!< NVIC configuration struct */
  1262. #define ITM ((ITM_Type *) ITM_BASE ) /*!< ITM configuration struct */
  1263. #define DWT ((DWT_Type *) DWT_BASE ) /*!< DWT configuration struct */
  1264. #define TPI ((TPI_Type *) TPI_BASE ) /*!< TPI configuration struct */
  1265. #define CoreDebug ((CoreDebug_Type *) CoreDebug_BASE) /*!< Core Debug configuration struct */
  1266. #if (__MPU_PRESENT == 1)
  1267. #define MPU_BASE (SCS_BASE + 0x0D90UL) /*!< Memory Protection Unit */
  1268. #define MPU ((MPU_Type *) MPU_BASE ) /*!< Memory Protection Unit */
  1269. #endif
  1270. #if (__FPU_PRESENT == 1)
  1271. #define FPU_BASE (SCS_BASE + 0x0F30UL) /*!< Floating Point Unit */
  1272. #define FPU ((FPU_Type *) FPU_BASE ) /*!< Floating Point Unit */
  1273. #endif
  1274. /*@} */
  1275. /*******************************************************************************
  1276. * Hardware Abstraction Layer
  1277. Core Function Interface contains:
  1278. - Core NVIC Functions
  1279. - Core SysTick Functions
  1280. - Core Debug Functions
  1281. - Core Register Access Functions
  1282. ******************************************************************************/
  1283. /** \defgroup CMSIS_Core_FunctionInterface Functions and Instructions Reference
  1284. */
  1285. /* ########################## NVIC functions #################################### */
  1286. /** \ingroup CMSIS_Core_FunctionInterface
  1287. \defgroup CMSIS_Core_NVICFunctions NVIC Functions
  1288. \brief Functions that manage interrupts and exceptions via the NVIC.
  1289. @{
  1290. */
  1291. /** \brief Set Priority Grouping
  1292. The function sets the priority grouping field using the required unlock sequence.
  1293. The parameter PriorityGroup is assigned to the field SCB->AIRCR [10:8] PRIGROUP field.
  1294. Only values from 0..7 are used.
  1295. In case of a conflict between priority grouping and available
  1296. priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set.
  1297. \param [in] PriorityGroup Priority grouping field.
  1298. */
  1299. __STATIC_INLINE void NVIC_SetPriorityGrouping(uint32_t PriorityGroup)
  1300. {
  1301. uint32_t reg_value;
  1302. uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */
  1303. reg_value = SCB->AIRCR; /* read old register configuration */
  1304. reg_value &= ~((uint32_t)(SCB_AIRCR_VECTKEY_Msk | SCB_AIRCR_PRIGROUP_Msk)); /* clear bits to change */
  1305. reg_value = (reg_value |
  1306. ((uint32_t)0x5FAUL << SCB_AIRCR_VECTKEY_Pos) |
  1307. (PriorityGroupTmp << 8) ); /* Insert write key and priorty group */
  1308. SCB->AIRCR = reg_value;
  1309. }
  1310. /** \brief Get Priority Grouping
  1311. The function reads the priority grouping field from the NVIC Interrupt Controller.
  1312. \return Priority grouping field (SCB->AIRCR [10:8] PRIGROUP field).
  1313. */
  1314. __STATIC_INLINE uint32_t NVIC_GetPriorityGrouping(void)
  1315. {
  1316. return ((uint32_t)((SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) >> SCB_AIRCR_PRIGROUP_Pos));
  1317. }
  1318. /** \brief Enable External Interrupt
  1319. The function enables a device-specific interrupt in the NVIC interrupt controller.
  1320. \param [in] IRQn External interrupt number. Value cannot be negative.
  1321. */
  1322. __STATIC_INLINE void NVIC_EnableIRQ(IRQn_Type IRQn)
  1323. {
  1324. NVIC->ISER[(((uint32_t)(int32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL));
  1325. }
  1326. /** \brief Disable External Interrupt
  1327. The function disables a device-specific interrupt in the NVIC interrupt controller.
  1328. \param [in] IRQn External interrupt number. Value cannot be negative.
  1329. */
  1330. __STATIC_INLINE void NVIC_DisableIRQ(IRQn_Type IRQn)
  1331. {
  1332. NVIC->ICER[(((uint32_t)(int32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL));
  1333. }
  1334. /** \brief Get Pending Interrupt
  1335. The function reads the pending register in the NVIC and returns the pending bit
  1336. for the specified interrupt.
  1337. \param [in] IRQn Interrupt number.
  1338. \return 0 Interrupt status is not pending.
  1339. \return 1 Interrupt status is pending.
  1340. */
  1341. __STATIC_INLINE uint32_t NVIC_GetPendingIRQ(IRQn_Type IRQn)
  1342. {
  1343. return((uint32_t)(((NVIC->ISPR[(((uint32_t)(int32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
  1344. }
  1345. /** \brief Set Pending Interrupt
  1346. The function sets the pending bit of an external interrupt.
  1347. \param [in] IRQn Interrupt number. Value cannot be negative.
  1348. */
  1349. __STATIC_INLINE void NVIC_SetPendingIRQ(IRQn_Type IRQn)
  1350. {
  1351. NVIC->ISPR[(((uint32_t)(int32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL));
  1352. }
  1353. /** \brief Clear Pending Interrupt
  1354. The function clears the pending bit of an external interrupt.
  1355. \param [in] IRQn External interrupt number. Value cannot be negative.
  1356. */
  1357. __STATIC_INLINE void NVIC_ClearPendingIRQ(IRQn_Type IRQn)
  1358. {
  1359. NVIC->ICPR[(((uint32_t)(int32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL));
  1360. }
  1361. /** \brief Get Active Interrupt
  1362. The function reads the active register in NVIC and returns the active bit.
  1363. \param [in] IRQn Interrupt number.
  1364. \return 0 Interrupt status is not active.
  1365. \return 1 Interrupt status is active.
  1366. */
  1367. __STATIC_INLINE uint32_t NVIC_GetActive(IRQn_Type IRQn)
  1368. {
  1369. return((uint32_t)(((NVIC->IABR[(((uint32_t)(int32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
  1370. }
  1371. /** \brief Set Interrupt Priority
  1372. The function sets the priority of an interrupt.
  1373. \note The priority cannot be set for every core interrupt.
  1374. \param [in] IRQn Interrupt number.
  1375. \param [in] priority Priority to set.
  1376. */
  1377. __STATIC_INLINE void NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority)
  1378. {
  1379. if((int32_t)IRQn < 0) {
  1380. SCB->SHPR[(((uint32_t)(int32_t)IRQn) & 0xFUL)-4UL] = (uint8_t)((priority << (8 - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL);
  1381. }
  1382. else {
  1383. NVIC->IP[((uint32_t)(int32_t)IRQn)] = (uint8_t)((priority << (8 - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL);
  1384. }
  1385. }
  1386. /** \brief Get Interrupt Priority
  1387. The function reads the priority of an interrupt. The interrupt
  1388. number can be positive to specify an external (device specific)
  1389. interrupt, or negative to specify an internal (core) interrupt.
  1390. \param [in] IRQn Interrupt number.
  1391. \return Interrupt Priority. Value is aligned automatically to the implemented
  1392. priority bits of the microcontroller.
  1393. */
  1394. __STATIC_INLINE uint32_t NVIC_GetPriority(IRQn_Type IRQn)
  1395. {
  1396. if((int32_t)IRQn < 0) {
  1397. return(((uint32_t)SCB->SHPR[(((uint32_t)(int32_t)IRQn) & 0xFUL)-4UL] >> (8 - __NVIC_PRIO_BITS)));
  1398. }
  1399. else {
  1400. return(((uint32_t)NVIC->IP[((uint32_t)(int32_t)IRQn)] >> (8 - __NVIC_PRIO_BITS)));
  1401. }
  1402. }
  1403. /** \brief Encode Priority
  1404. The function encodes the priority for an interrupt with the given priority group,
  1405. preemptive priority value, and subpriority value.
  1406. In case of a conflict between priority grouping and available
  1407. priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set.
  1408. \param [in] PriorityGroup Used priority group.
  1409. \param [in] PreemptPriority Preemptive priority value (starting from 0).
  1410. \param [in] SubPriority Subpriority value (starting from 0).
  1411. \return Encoded priority. Value can be used in the function \ref NVIC_SetPriority().
  1412. */
  1413. __STATIC_INLINE uint32_t NVIC_EncodePriority (uint32_t PriorityGroup, uint32_t PreemptPriority, uint32_t SubPriority)
  1414. {
  1415. uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */
  1416. uint32_t PreemptPriorityBits;
  1417. uint32_t SubPriorityBits;
  1418. PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp);
  1419. SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS));
  1420. return (
  1421. ((PreemptPriority & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL)) << SubPriorityBits) |
  1422. ((SubPriority & (uint32_t)((1UL << (SubPriorityBits )) - 1UL)))
  1423. );
  1424. }
  1425. /** \brief Decode Priority
  1426. The function decodes an interrupt priority value with a given priority group to
  1427. preemptive priority value and subpriority value.
  1428. In case of a conflict between priority grouping and available
  1429. priority bits (__NVIC_PRIO_BITS) the smallest possible priority group is set.
  1430. \param [in] Priority Priority value, which can be retrieved with the function \ref NVIC_GetPriority().
  1431. \param [in] PriorityGroup Used priority group.
  1432. \param [out] pPreemptPriority Preemptive priority value (starting from 0).
  1433. \param [out] pSubPriority Subpriority value (starting from 0).
  1434. */
  1435. __STATIC_INLINE void NVIC_DecodePriority (uint32_t Priority, uint32_t PriorityGroup, uint32_t* pPreemptPriority, uint32_t* pSubPriority)
  1436. {
  1437. uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */
  1438. uint32_t PreemptPriorityBits;
  1439. uint32_t SubPriorityBits;
  1440. PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp);
  1441. SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS));
  1442. *pPreemptPriority = (Priority >> SubPriorityBits) & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL);
  1443. *pSubPriority = (Priority ) & (uint32_t)((1UL << (SubPriorityBits )) - 1UL);
  1444. }
  1445. /** \brief System Reset
  1446. The function initiates a system reset request to reset the MCU.
  1447. */
  1448. __STATIC_INLINE void NVIC_SystemReset(void)
  1449. {
  1450. __DSB(); /* Ensure all outstanding memory accesses included
  1451. buffered write are completed before reset */
  1452. SCB->AIRCR = (uint32_t)((0x5FAUL << SCB_AIRCR_VECTKEY_Pos) |
  1453. (SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) |
  1454. SCB_AIRCR_SYSRESETREQ_Msk ); /* Keep priority group unchanged */
  1455. __DSB(); /* Ensure completion of memory access */
  1456. while(1) { __NOP(); } /* wait until reset */
  1457. }
  1458. /*@} end of CMSIS_Core_NVICFunctions */
  1459. /* ########################## FPU functions #################################### */
  1460. /** \ingroup CMSIS_Core_FunctionInterface
  1461. \defgroup CMSIS_Core_FpuFunctions FPU Functions
  1462. \brief Function that provides FPU type.
  1463. @{
  1464. */
  1465. /**
  1466. \fn uint32_t SCB_GetFPUType(void)
  1467. \brief get FPU type
  1468. \returns
  1469. - \b 0: No FPU
  1470. - \b 1: Single precision FPU
  1471. - \b 2: Double + Single precision FPU
  1472. */
  1473. __STATIC_INLINE uint32_t SCB_GetFPUType(void)
  1474. {
  1475. uint32_t mvfr0;
  1476. mvfr0 = SCB->MVFR0;
  1477. if ((mvfr0 & 0x00000FF0UL) == 0x220UL) {
  1478. return 2UL; // Double + Single precision FPU
  1479. } else if ((mvfr0 & 0x00000FF0UL) == 0x020UL) {
  1480. return 1UL; // Single precision FPU
  1481. } else {
  1482. return 0UL; // No FPU
  1483. }
  1484. }
  1485. /*@} end of CMSIS_Core_FpuFunctions */
  1486. /* ########################## Cache functions #################################### */
  1487. /** \ingroup CMSIS_Core_FunctionInterface
  1488. \defgroup CMSIS_Core_CacheFunctions Cache Functions
  1489. \brief Functions that configure Instruction and Data cache.
  1490. @{
  1491. */
  1492. /* Cache Size ID Register Macros */
  1493. #define CCSIDR_WAYS(x) (((x) & SCB_CCSIDR_ASSOCIATIVITY_Msk) >> SCB_CCSIDR_ASSOCIATIVITY_Pos)
  1494. #define CCSIDR_SETS(x) (((x) & SCB_CCSIDR_NUMSETS_Msk ) >> SCB_CCSIDR_NUMSETS_Pos )
  1495. #define CCSIDR_LSSHIFT(x) (((x) & SCB_CCSIDR_LINESIZE_Msk ) /*>> SCB_CCSIDR_LINESIZE_Pos*/ )
  1496. /** \brief Enable I-Cache
  1497. The function turns on I-Cache
  1498. */
  1499. __STATIC_INLINE void SCB_EnableICache (void)
  1500. {
  1501. #if (__ICACHE_PRESENT == 1)
  1502. __DSB();
  1503. __ISB();
  1504. SCB->ICIALLU = 0UL; // invalidate I-Cache
  1505. SCB->CCR |= (uint32_t)SCB_CCR_IC_Msk; // enable I-Cache
  1506. __DSB();
  1507. __ISB();
  1508. #endif
  1509. }
  1510. /** \brief Disable I-Cache
  1511. The function turns off I-Cache
  1512. */
  1513. __STATIC_INLINE void SCB_DisableICache (void)
  1514. {
  1515. #if (__ICACHE_PRESENT == 1)
  1516. __DSB();
  1517. __ISB();
  1518. SCB->CCR &= ~(uint32_t)SCB_CCR_IC_Msk; // disable I-Cache
  1519. SCB->ICIALLU = 0UL; // invalidate I-Cache
  1520. __DSB();
  1521. __ISB();
  1522. #endif
  1523. }
  1524. /** \brief Invalidate I-Cache
  1525. The function invalidates I-Cache
  1526. */
  1527. __STATIC_INLINE void SCB_InvalidateICache (void)
  1528. {
  1529. #if (__ICACHE_PRESENT == 1)
  1530. __DSB();
  1531. __ISB();
  1532. SCB->ICIALLU = 0UL;
  1533. __DSB();
  1534. __ISB();
  1535. #endif
  1536. }
  1537. /** \brief Enable D-Cache
  1538. The function turns on D-Cache
  1539. */
  1540. __STATIC_INLINE void SCB_EnableDCache (void)
  1541. {
  1542. #if (__DCACHE_PRESENT == 1)
  1543. uint32_t ccsidr, sshift, wshift, sw;
  1544. uint32_t sets, ways;
  1545. SCB->CSSELR = (0UL << 1) | 0UL; // Level 1 data cache
  1546. ccsidr = SCB->CCSIDR;
  1547. sets = (uint32_t)(CCSIDR_SETS(ccsidr));
  1548. sshift = (uint32_t)(CCSIDR_LSSHIFT(ccsidr) + 4UL);
  1549. ways = (uint32_t)(CCSIDR_WAYS(ccsidr));
  1550. wshift = (uint32_t)((uint32_t)__CLZ(ways) & 0x1FUL);
  1551. __DSB();
  1552. do { // invalidate D-Cache
  1553. uint32_t tmpways = ways;
  1554. do {
  1555. sw = ((tmpways << wshift) | (sets << sshift));
  1556. SCB->DCISW = sw;
  1557. } while(tmpways--);
  1558. } while(sets--);
  1559. __DSB();
  1560. SCB->CCR |= (uint32_t)SCB_CCR_DC_Msk; // enable D-Cache
  1561. __DSB();
  1562. __ISB();
  1563. #endif
  1564. }
  1565. /** \brief Disable D-Cache
  1566. The function turns off D-Cache
  1567. */
  1568. __STATIC_INLINE void SCB_DisableDCache (void)
  1569. {
  1570. #if (__DCACHE_PRESENT == 1)
  1571. uint32_t ccsidr, sshift, wshift, sw;
  1572. uint32_t sets, ways;
  1573. SCB->CSSELR = (0UL << 1) | 0UL; // Level 1 data cache
  1574. ccsidr = SCB->CCSIDR;
  1575. sets = (uint32_t)(CCSIDR_SETS(ccsidr));
  1576. sshift = (uint32_t)(CCSIDR_LSSHIFT(ccsidr) + 4UL);
  1577. ways = (uint32_t)(CCSIDR_WAYS(ccsidr));
  1578. wshift = (uint32_t)((uint32_t)__CLZ(ways) & 0x1FUL);
  1579. __DSB();
  1580. SCB->CCR &= ~(uint32_t)SCB_CCR_DC_Msk; // disable D-Cache
  1581. do { // clean & invalidate D-Cache
  1582. uint32_t tmpways = ways;
  1583. do {
  1584. sw = ((tmpways << wshift) | (sets << sshift));
  1585. SCB->DCCISW = sw;
  1586. } while(tmpways--);
  1587. } while(sets--);
  1588. __DSB();
  1589. __ISB();
  1590. #endif
  1591. }
  1592. /** \brief Invalidate D-Cache
  1593. The function invalidates D-Cache
  1594. */
  1595. __STATIC_INLINE void SCB_InvalidateDCache (void)
  1596. {
  1597. #if (__DCACHE_PRESENT == 1)
  1598. uint32_t ccsidr, sshift, wshift, sw;
  1599. uint32_t sets, ways;
  1600. SCB->CSSELR = (0UL << 1) | 0UL; // Level 1 data cache
  1601. ccsidr = SCB->CCSIDR;
  1602. sets = (uint32_t)(CCSIDR_SETS(ccsidr));
  1603. sshift = (uint32_t)(CCSIDR_LSSHIFT(ccsidr) + 4UL);
  1604. ways = (uint32_t)(CCSIDR_WAYS(ccsidr));
  1605. wshift = (uint32_t)((uint32_t)__CLZ(ways) & 0x1FUL);
  1606. __DSB();
  1607. do { // invalidate D-Cache
  1608. uint32_t tmpways = ways;
  1609. do {
  1610. sw = ((tmpways << wshift) | (sets << sshift));
  1611. SCB->DCISW = sw;
  1612. } while(tmpways--);
  1613. } while(sets--);
  1614. __DSB();
  1615. __ISB();
  1616. #endif
  1617. }
  1618. /** \brief Clean D-Cache
  1619. The function cleans D-Cache
  1620. */
  1621. __STATIC_INLINE void SCB_CleanDCache (void)
  1622. {
  1623. #if (__DCACHE_PRESENT == 1)
  1624. uint32_t ccsidr, sshift, wshift, sw;
  1625. uint32_t sets, ways;
  1626. SCB->CSSELR = (0UL << 1) | 0UL; // Level 1 data cache
  1627. ccsidr = SCB->CCSIDR;
  1628. sets = (uint32_t)(CCSIDR_SETS(ccsidr));
  1629. sshift = (uint32_t)(CCSIDR_LSSHIFT(ccsidr) + 4UL);
  1630. ways = (uint32_t)(CCSIDR_WAYS(ccsidr));
  1631. wshift = (uint32_t)((uint32_t)__CLZ(ways) & 0x1FUL);
  1632. __DSB();
  1633. do { // clean D-Cache
  1634. uint32_t tmpways = ways;
  1635. do {
  1636. sw = ((tmpways << wshift) | (sets << sshift));
  1637. SCB->DCCSW = sw;
  1638. } while(tmpways--);
  1639. } while(sets--);
  1640. __DSB();
  1641. __ISB();
  1642. #endif
  1643. }
  1644. /** \brief Clean & Invalidate D-Cache
  1645. The function cleans and Invalidates D-Cache
  1646. */
  1647. __STATIC_INLINE void SCB_CleanInvalidateDCache (void)
  1648. {
  1649. #if (__DCACHE_PRESENT == 1)
  1650. uint32_t ccsidr, sshift, wshift, sw;
  1651. uint32_t sets, ways;
  1652. SCB->CSSELR = (0UL << 1) | 0UL; // Level 1 data cache
  1653. ccsidr = SCB->CCSIDR;
  1654. sets = (uint32_t)(CCSIDR_SETS(ccsidr));
  1655. sshift = (uint32_t)(CCSIDR_LSSHIFT(ccsidr) + 4UL);
  1656. ways = (uint32_t)(CCSIDR_WAYS(ccsidr));
  1657. wshift = (uint32_t)((uint32_t)__CLZ(ways) & 0x1FUL);
  1658. __DSB();
  1659. do { // clean & invalidate D-Cache
  1660. uint32_t tmpways = ways;
  1661. do {
  1662. sw = ((tmpways << wshift) | (sets << sshift));
  1663. SCB->DCCISW = sw;
  1664. } while(tmpways--);
  1665. } while(sets--);
  1666. __DSB();
  1667. __ISB();
  1668. #endif
  1669. }
  1670. /**
  1671. \fn void SCB_InvalidateDCache_by_Addr(volatile uint32_t *addr, int32_t dsize)
  1672. \brief D-Cache Invalidate by address
  1673. \param[in] addr address (aligned to 32-byte boundary)
  1674. \param[in] dsize size of memory block (in number of bytes)
  1675. */
  1676. __STATIC_INLINE void SCB_InvalidateDCache_by_Addr (uint32_t *addr, int32_t dsize)
  1677. {
  1678. #if (__DCACHE_PRESENT == 1)
  1679. int32_t op_size = dsize;
  1680. uint32_t op_addr = (uint32_t)addr;
  1681. uint32_t linesize = 32UL; // in Cortex-M7 size of cache line is fixed to 8 words (32 bytes)
  1682. __DSB();
  1683. while (op_size > 0) {
  1684. SCB->DCIMVAC = op_addr;
  1685. op_addr += linesize;
  1686. op_size -= (int32_t)linesize;
  1687. }
  1688. __DSB();
  1689. __ISB();
  1690. #endif
  1691. }
  1692. /**
  1693. \fn void SCB_CleanDCache_by_Addr(volatile uint32_t *addr, int32_t dsize)
  1694. \brief D-Cache Clean by address
  1695. \param[in] addr address (aligned to 32-byte boundary)
  1696. \param[in] dsize size of memory block (in number of bytes)
  1697. */
  1698. __STATIC_INLINE void SCB_CleanDCache_by_Addr (uint32_t *addr, int32_t dsize)
  1699. {
  1700. #if (__DCACHE_PRESENT == 1)
  1701. int32_t op_size = dsize;
  1702. uint32_t op_addr = (uint32_t) addr;
  1703. uint32_t linesize = 32UL; // in Cortex-M7 size of cache line is fixed to 8 words (32 bytes)
  1704. __DSB();
  1705. while (op_size > 0) {
  1706. SCB->DCCMVAC = op_addr;
  1707. op_addr += linesize;
  1708. op_size -= (int32_t)linesize;
  1709. }
  1710. __DSB();
  1711. __ISB();
  1712. #endif
  1713. }
  1714. /**
  1715. \fn void SCB_CleanInvalidateDCache_by_Addr(volatile uint32_t *addr, int32_t dsize)
  1716. \brief D-Cache Clean and Invalidate by address
  1717. \param[in] addr address (aligned to 32-byte boundary)
  1718. \param[in] dsize size of memory block (in number of bytes)
  1719. */
  1720. __STATIC_INLINE void SCB_CleanInvalidateDCache_by_Addr (uint32_t *addr, int32_t dsize)
  1721. {
  1722. #if (__DCACHE_PRESENT == 1)
  1723. int32_t op_size = dsize;
  1724. uint32_t op_addr = (uint32_t) addr;
  1725. uint32_t linesize = 32UL; // in Cortex-M7 size of cache line is fixed to 8 words (32 bytes)
  1726. __DSB();
  1727. while (op_size > 0) {
  1728. SCB->DCCIMVAC = op_addr;
  1729. op_addr += linesize;
  1730. op_size -= (int32_t)linesize;
  1731. }
  1732. __DSB();
  1733. __ISB();
  1734. #endif
  1735. }
  1736. /*@} end of CMSIS_Core_CacheFunctions */
  1737. /* ################################## SysTick function ############################################ */
  1738. /** \ingroup CMSIS_Core_FunctionInterface
  1739. \defgroup CMSIS_Core_SysTickFunctions SysTick Functions
  1740. \brief Functions that configure the System.
  1741. @{
  1742. */
  1743. #if (__Vendor_SysTickConfig == 0)
  1744. /** \brief System Tick Configuration
  1745. The function initializes the System Timer and its interrupt, and starts the System Tick Timer.
  1746. Counter is in free running mode to generate periodic interrupts.
  1747. \param [in] ticks Number of ticks between two interrupts.
  1748. \return 0 Function succeeded.
  1749. \return 1 Function failed.
  1750. \note When the variable <b>__Vendor_SysTickConfig</b> is set to 1, then the
  1751. function <b>SysTick_Config</b> is not included. In this case, the file <b><i>device</i>.h</b>
  1752. must contain a vendor-specific implementation of this function.
  1753. */
  1754. __STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks)
  1755. {
  1756. if ((ticks - 1UL) > SysTick_LOAD_RELOAD_Msk) { return (1UL); } /* Reload value impossible */
  1757. SysTick->LOAD = (uint32_t)(ticks - 1UL); /* set reload register */
  1758. NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */
  1759. SysTick->VAL = 0UL; /* Load the SysTick Counter Value */
  1760. SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk |
  1761. SysTick_CTRL_TICKINT_Msk |
  1762. SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */
  1763. return (0UL); /* Function successful */
  1764. }
  1765. #endif
  1766. /*@} end of CMSIS_Core_SysTickFunctions */
  1767. /* ##################################### Debug In/Output function ########################################### */
  1768. /** \ingroup CMSIS_Core_FunctionInterface
  1769. \defgroup CMSIS_core_DebugFunctions ITM Functions
  1770. \brief Functions that access the ITM debug interface.
  1771. @{
  1772. */
  1773. extern volatile int32_t ITM_RxBuffer; /*!< External variable to receive characters. */
  1774. #define ITM_RXBUFFER_EMPTY 0x5AA55AA5 /*!< Value identifying \ref ITM_RxBuffer is ready for next character. */
  1775. /** \brief ITM Send Character
  1776. The function transmits a character via the ITM channel 0, and
  1777. \li Just returns when no debugger is connected that has booked the output.
  1778. \li Is blocking when a debugger is connected, but the previous character sent has not been transmitted.
  1779. \param [in] ch Character to transmit.
  1780. \returns Character to transmit.
  1781. */
  1782. __STATIC_INLINE uint32_t ITM_SendChar (uint32_t ch)
  1783. {
  1784. if (((ITM->TCR & ITM_TCR_ITMENA_Msk) != 0UL) && /* ITM enabled */
  1785. ((ITM->TER & 1UL ) != 0UL) ) /* ITM Port #0 enabled */
  1786. {
  1787. while (ITM->PORT[0].u32 == 0UL) { __NOP(); }
  1788. ITM->PORT[0].u8 = (uint8_t)ch;
  1789. }
  1790. return (ch);
  1791. }
  1792. /** \brief ITM Receive Character
  1793. The function inputs a character via the external variable \ref ITM_RxBuffer.
  1794. \return Received character.
  1795. \return -1 No character pending.
  1796. */
  1797. __STATIC_INLINE int32_t ITM_ReceiveChar (void) {
  1798. int32_t ch = -1; /* no character available */
  1799. if (ITM_RxBuffer != ITM_RXBUFFER_EMPTY) {
  1800. ch = ITM_RxBuffer;
  1801. ITM_RxBuffer = ITM_RXBUFFER_EMPTY; /* ready for next character */
  1802. }
  1803. return (ch);
  1804. }
  1805. /** \brief ITM Check Character
  1806. The function checks whether a character is pending for reading in the variable \ref ITM_RxBuffer.
  1807. \return 0 No character available.
  1808. \return 1 Character available.
  1809. */
  1810. __STATIC_INLINE int32_t ITM_CheckChar (void) {
  1811. if (ITM_RxBuffer == ITM_RXBUFFER_EMPTY) {
  1812. return (0); /* no character available */
  1813. } else {
  1814. return (1); /* character available */
  1815. }
  1816. }
  1817. /*@} end of CMSIS_core_DebugFunctions */
  1818. #ifdef __cplusplus
  1819. }
  1820. #endif
  1821. #endif /* __CORE_CM7_H_DEPENDANT */
  1822. #endif /* __CMSIS_GENERIC */