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_sc300.h 99KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675
  1. /**************************************************************************//**
  2. * @file core_sc300.h
  3. * @brief CMSIS SC300 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_SC300_H_GENERIC
  39. #define __CORE_SC300_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 SC3000
  56. @{
  57. */
  58. /* CMSIS SC300 definitions */
  59. #define __SC300_CMSIS_VERSION_MAIN (0x04) /*!< [31:16] CMSIS HAL main version */
  60. #define __SC300_CMSIS_VERSION_SUB (0x00) /*!< [15:0] CMSIS HAL sub version */
  61. #define __SC300_CMSIS_VERSION ((__SC300_CMSIS_VERSION_MAIN << 16) | \
  62. __SC300_CMSIS_VERSION_SUB ) /*!< CMSIS HAL version number */
  63. #define __CORTEX_SC (300) /*!< Cortex secure 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. This core does not support an FPU at all
  91. */
  92. #define __FPU_USED 0
  93. #if defined ( __CC_ARM )
  94. #if defined __TARGET_FPU_VFP
  95. #warning "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
  96. #endif
  97. #elif defined ( __GNUC__ )
  98. #if defined (__VFP_FP__) && !defined(__SOFTFP__)
  99. #warning "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
  100. #endif
  101. #elif defined ( __ICCARM__ )
  102. #if defined __ARMVFP__
  103. #warning "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
  104. #endif
  105. #elif defined ( __TMS470__ )
  106. #if defined __TI__VFP_SUPPORT____
  107. #warning "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
  108. #endif
  109. #elif defined ( __TASKING__ )
  110. #if defined __FPU_VFP__
  111. #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
  112. #endif
  113. #elif defined ( __CSMC__ ) /* Cosmic */
  114. #if ( __CSMC__ & 0x400) // FPU present for parser
  115. #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
  116. #endif
  117. #endif
  118. #include <stdint.h> /* standard types definitions */
  119. #include <core_cmInstr.h> /* Core Instruction Access */
  120. #include <core_cmFunc.h> /* Core Function Access */
  121. #ifdef __cplusplus
  122. }
  123. #endif
  124. #endif /* __CORE_SC300_H_GENERIC */
  125. #ifndef __CMSIS_GENERIC
  126. #ifndef __CORE_SC300_H_DEPENDANT
  127. #define __CORE_SC300_H_DEPENDANT
  128. #ifdef __cplusplus
  129. extern "C" {
  130. #endif
  131. /* check device defines and use defaults */
  132. #if defined __CHECK_DEVICE_DEFINES
  133. #ifndef __SC300_REV
  134. #define __SC300_REV 0x0000
  135. #warning "__SC300_REV not defined in device header file; using default!"
  136. #endif
  137. #ifndef __MPU_PRESENT
  138. #define __MPU_PRESENT 0
  139. #warning "__MPU_PRESENT not defined in device header file; using default!"
  140. #endif
  141. #ifndef __NVIC_PRIO_BITS
  142. #define __NVIC_PRIO_BITS 4
  143. #warning "__NVIC_PRIO_BITS not defined in device header file; using default!"
  144. #endif
  145. #ifndef __Vendor_SysTickConfig
  146. #define __Vendor_SysTickConfig 0
  147. #warning "__Vendor_SysTickConfig not defined in device header file; using default!"
  148. #endif
  149. #endif
  150. /* IO definitions (access restrictions to peripheral registers) */
  151. /**
  152. \defgroup CMSIS_glob_defs CMSIS Global Defines
  153. <strong>IO Type Qualifiers</strong> are used
  154. \li to specify the access to peripheral variables.
  155. \li for automatic generation of peripheral register debug information.
  156. */
  157. #ifdef __cplusplus
  158. #define __I volatile /*!< Defines 'read only' permissions */
  159. #else
  160. #define __I volatile const /*!< Defines 'read only' permissions */
  161. #endif
  162. #define __O volatile /*!< Defines 'write only' permissions */
  163. #define __IO volatile /*!< Defines 'read / write' permissions */
  164. /*@} end of group SC300 */
  165. /*******************************************************************************
  166. * Register Abstraction
  167. Core Register contain:
  168. - Core Register
  169. - Core NVIC Register
  170. - Core SCB Register
  171. - Core SysTick Register
  172. - Core Debug Register
  173. - Core MPU Register
  174. ******************************************************************************/
  175. /** \defgroup CMSIS_core_register Defines and Type Definitions
  176. \brief Type definitions and defines for Cortex-M processor based devices.
  177. */
  178. /** \ingroup CMSIS_core_register
  179. \defgroup CMSIS_CORE Status and Control Registers
  180. \brief Core Register type definitions.
  181. @{
  182. */
  183. /** \brief Union type to access the Application Program Status Register (APSR).
  184. */
  185. typedef union
  186. {
  187. struct
  188. {
  189. uint32_t _reserved0:27; /*!< bit: 0..26 Reserved */
  190. uint32_t Q:1; /*!< bit: 27 Saturation condition flag */
  191. uint32_t V:1; /*!< bit: 28 Overflow condition code flag */
  192. uint32_t C:1; /*!< bit: 29 Carry condition code flag */
  193. uint32_t Z:1; /*!< bit: 30 Zero condition code flag */
  194. uint32_t N:1; /*!< bit: 31 Negative condition code flag */
  195. } b; /*!< Structure used for bit access */
  196. uint32_t w; /*!< Type used for word access */
  197. } APSR_Type;
  198. /* APSR Register Definitions */
  199. #define APSR_N_Pos 31 /*!< APSR: N Position */
  200. #define APSR_N_Msk (1UL << APSR_N_Pos) /*!< APSR: N Mask */
  201. #define APSR_Z_Pos 30 /*!< APSR: Z Position */
  202. #define APSR_Z_Msk (1UL << APSR_Z_Pos) /*!< APSR: Z Mask */
  203. #define APSR_C_Pos 29 /*!< APSR: C Position */
  204. #define APSR_C_Msk (1UL << APSR_C_Pos) /*!< APSR: C Mask */
  205. #define APSR_V_Pos 28 /*!< APSR: V Position */
  206. #define APSR_V_Msk (1UL << APSR_V_Pos) /*!< APSR: V Mask */
  207. #define APSR_Q_Pos 27 /*!< APSR: Q Position */
  208. #define APSR_Q_Msk (1UL << APSR_Q_Pos) /*!< APSR: Q Mask */
  209. /** \brief Union type to access the Interrupt Program Status Register (IPSR).
  210. */
  211. typedef union
  212. {
  213. struct
  214. {
  215. uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */
  216. uint32_t _reserved0:23; /*!< bit: 9..31 Reserved */
  217. } b; /*!< Structure used for bit access */
  218. uint32_t w; /*!< Type used for word access */
  219. } IPSR_Type;
  220. /* IPSR Register Definitions */
  221. #define IPSR_ISR_Pos 0 /*!< IPSR: ISR Position */
  222. #define IPSR_ISR_Msk (0x1FFUL /*<< IPSR_ISR_Pos*/) /*!< IPSR: ISR Mask */
  223. /** \brief Union type to access the Special-Purpose Program Status Registers (xPSR).
  224. */
  225. typedef union
  226. {
  227. struct
  228. {
  229. uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */
  230. uint32_t _reserved0:15; /*!< bit: 9..23 Reserved */
  231. uint32_t T:1; /*!< bit: 24 Thumb bit (read 0) */
  232. uint32_t IT:2; /*!< bit: 25..26 saved IT state (read 0) */
  233. uint32_t Q:1; /*!< bit: 27 Saturation condition flag */
  234. uint32_t V:1; /*!< bit: 28 Overflow condition code flag */
  235. uint32_t C:1; /*!< bit: 29 Carry condition code flag */
  236. uint32_t Z:1; /*!< bit: 30 Zero condition code flag */
  237. uint32_t N:1; /*!< bit: 31 Negative condition code flag */
  238. } b; /*!< Structure used for bit access */
  239. uint32_t w; /*!< Type used for word access */
  240. } xPSR_Type;
  241. /* xPSR Register Definitions */
  242. #define xPSR_N_Pos 31 /*!< xPSR: N Position */
  243. #define xPSR_N_Msk (1UL << xPSR_N_Pos) /*!< xPSR: N Mask */
  244. #define xPSR_Z_Pos 30 /*!< xPSR: Z Position */
  245. #define xPSR_Z_Msk (1UL << xPSR_Z_Pos) /*!< xPSR: Z Mask */
  246. #define xPSR_C_Pos 29 /*!< xPSR: C Position */
  247. #define xPSR_C_Msk (1UL << xPSR_C_Pos) /*!< xPSR: C Mask */
  248. #define xPSR_V_Pos 28 /*!< xPSR: V Position */
  249. #define xPSR_V_Msk (1UL << xPSR_V_Pos) /*!< xPSR: V Mask */
  250. #define xPSR_Q_Pos 27 /*!< xPSR: Q Position */
  251. #define xPSR_Q_Msk (1UL << xPSR_Q_Pos) /*!< xPSR: Q Mask */
  252. #define xPSR_IT_Pos 25 /*!< xPSR: IT Position */
  253. #define xPSR_IT_Msk (3UL << xPSR_IT_Pos) /*!< xPSR: IT Mask */
  254. #define xPSR_T_Pos 24 /*!< xPSR: T Position */
  255. #define xPSR_T_Msk (1UL << xPSR_T_Pos) /*!< xPSR: T Mask */
  256. #define xPSR_ISR_Pos 0 /*!< xPSR: ISR Position */
  257. #define xPSR_ISR_Msk (0x1FFUL /*<< xPSR_ISR_Pos*/) /*!< xPSR: ISR Mask */
  258. /** \brief Union type to access the Control Registers (CONTROL).
  259. */
  260. typedef union
  261. {
  262. struct
  263. {
  264. uint32_t nPRIV:1; /*!< bit: 0 Execution privilege in Thread mode */
  265. uint32_t SPSEL:1; /*!< bit: 1 Stack to be used */
  266. uint32_t _reserved1:30; /*!< bit: 2..31 Reserved */
  267. } b; /*!< Structure used for bit access */
  268. uint32_t w; /*!< Type used for word access */
  269. } CONTROL_Type;
  270. /* CONTROL Register Definitions */
  271. #define CONTROL_SPSEL_Pos 1 /*!< CONTROL: SPSEL Position */
  272. #define CONTROL_SPSEL_Msk (1UL << CONTROL_SPSEL_Pos) /*!< CONTROL: SPSEL Mask */
  273. #define CONTROL_nPRIV_Pos 0 /*!< CONTROL: nPRIV Position */
  274. #define CONTROL_nPRIV_Msk (1UL /*<< CONTROL_nPRIV_Pos*/) /*!< CONTROL: nPRIV Mask */
  275. /*@} end of group CMSIS_CORE */
  276. /** \ingroup CMSIS_core_register
  277. \defgroup CMSIS_NVIC Nested Vectored Interrupt Controller (NVIC)
  278. \brief Type definitions for the NVIC Registers
  279. @{
  280. */
  281. /** \brief Structure type to access the Nested Vectored Interrupt Controller (NVIC).
  282. */
  283. typedef struct
  284. {
  285. __IO uint32_t ISER[8]; /*!< Offset: 0x000 (R/W) Interrupt Set Enable Register */
  286. uint32_t RESERVED0[24];
  287. __IO uint32_t ICER[8]; /*!< Offset: 0x080 (R/W) Interrupt Clear Enable Register */
  288. uint32_t RSERVED1[24];
  289. __IO uint32_t ISPR[8]; /*!< Offset: 0x100 (R/W) Interrupt Set Pending Register */
  290. uint32_t RESERVED2[24];
  291. __IO uint32_t ICPR[8]; /*!< Offset: 0x180 (R/W) Interrupt Clear Pending Register */
  292. uint32_t RESERVED3[24];
  293. __IO uint32_t IABR[8]; /*!< Offset: 0x200 (R/W) Interrupt Active bit Register */
  294. uint32_t RESERVED4[56];
  295. __IO uint8_t IP[240]; /*!< Offset: 0x300 (R/W) Interrupt Priority Register (8Bit wide) */
  296. uint32_t RESERVED5[644];
  297. __O uint32_t STIR; /*!< Offset: 0xE00 ( /W) Software Trigger Interrupt Register */
  298. } NVIC_Type;
  299. /* Software Triggered Interrupt Register Definitions */
  300. #define NVIC_STIR_INTID_Pos 0 /*!< STIR: INTLINESNUM Position */
  301. #define NVIC_STIR_INTID_Msk (0x1FFUL /*<< NVIC_STIR_INTID_Pos*/) /*!< STIR: INTLINESNUM Mask */
  302. /*@} end of group CMSIS_NVIC */
  303. /** \ingroup CMSIS_core_register
  304. \defgroup CMSIS_SCB System Control Block (SCB)
  305. \brief Type definitions for the System Control Block Registers
  306. @{
  307. */
  308. /** \brief Structure type to access the System Control Block (SCB).
  309. */
  310. typedef struct
  311. {
  312. __I uint32_t CPUID; /*!< Offset: 0x000 (R/ ) CPUID Base Register */
  313. __IO uint32_t ICSR; /*!< Offset: 0x004 (R/W) Interrupt Control and State Register */
  314. __IO uint32_t VTOR; /*!< Offset: 0x008 (R/W) Vector Table Offset Register */
  315. __IO uint32_t AIRCR; /*!< Offset: 0x00C (R/W) Application Interrupt and Reset Control Register */
  316. __IO uint32_t SCR; /*!< Offset: 0x010 (R/W) System Control Register */
  317. __IO uint32_t CCR; /*!< Offset: 0x014 (R/W) Configuration Control Register */
  318. __IO uint8_t SHP[12]; /*!< Offset: 0x018 (R/W) System Handlers Priority Registers (4-7, 8-11, 12-15) */
  319. __IO uint32_t SHCSR; /*!< Offset: 0x024 (R/W) System Handler Control and State Register */
  320. __IO uint32_t CFSR; /*!< Offset: 0x028 (R/W) Configurable Fault Status Register */
  321. __IO uint32_t HFSR; /*!< Offset: 0x02C (R/W) HardFault Status Register */
  322. __IO uint32_t DFSR; /*!< Offset: 0x030 (R/W) Debug Fault Status Register */
  323. __IO uint32_t MMFAR; /*!< Offset: 0x034 (R/W) MemManage Fault Address Register */
  324. __IO uint32_t BFAR; /*!< Offset: 0x038 (R/W) BusFault Address Register */
  325. __IO uint32_t AFSR; /*!< Offset: 0x03C (R/W) Auxiliary Fault Status Register */
  326. __I uint32_t PFR[2]; /*!< Offset: 0x040 (R/ ) Processor Feature Register */
  327. __I uint32_t DFR; /*!< Offset: 0x048 (R/ ) Debug Feature Register */
  328. __I uint32_t ADR; /*!< Offset: 0x04C (R/ ) Auxiliary Feature Register */
  329. __I uint32_t MMFR[4]; /*!< Offset: 0x050 (R/ ) Memory Model Feature Register */
  330. __I uint32_t ISAR[5]; /*!< Offset: 0x060 (R/ ) Instruction Set Attributes Register */
  331. uint32_t RESERVED0[5];
  332. __IO uint32_t CPACR; /*!< Offset: 0x088 (R/W) Coprocessor Access Control Register */
  333. uint32_t RESERVED1[129];
  334. __IO uint32_t SFCR; /*!< Offset: 0x290 (R/W) Security Features Control Register */
  335. } SCB_Type;
  336. /* SCB CPUID Register Definitions */
  337. #define SCB_CPUID_IMPLEMENTER_Pos 24 /*!< SCB CPUID: IMPLEMENTER Position */
  338. #define SCB_CPUID_IMPLEMENTER_Msk (0xFFUL << SCB_CPUID_IMPLEMENTER_Pos) /*!< SCB CPUID: IMPLEMENTER Mask */
  339. #define SCB_CPUID_VARIANT_Pos 20 /*!< SCB CPUID: VARIANT Position */
  340. #define SCB_CPUID_VARIANT_Msk (0xFUL << SCB_CPUID_VARIANT_Pos) /*!< SCB CPUID: VARIANT Mask */
  341. #define SCB_CPUID_ARCHITECTURE_Pos 16 /*!< SCB CPUID: ARCHITECTURE Position */
  342. #define SCB_CPUID_ARCHITECTURE_Msk (0xFUL << SCB_CPUID_ARCHITECTURE_Pos) /*!< SCB CPUID: ARCHITECTURE Mask */
  343. #define SCB_CPUID_PARTNO_Pos 4 /*!< SCB CPUID: PARTNO Position */
  344. #define SCB_CPUID_PARTNO_Msk (0xFFFUL << SCB_CPUID_PARTNO_Pos) /*!< SCB CPUID: PARTNO Mask */
  345. #define SCB_CPUID_REVISION_Pos 0 /*!< SCB CPUID: REVISION Position */
  346. #define SCB_CPUID_REVISION_Msk (0xFUL /*<< SCB_CPUID_REVISION_Pos*/) /*!< SCB CPUID: REVISION Mask */
  347. /* SCB Interrupt Control State Register Definitions */
  348. #define SCB_ICSR_NMIPENDSET_Pos 31 /*!< SCB ICSR: NMIPENDSET Position */
  349. #define SCB_ICSR_NMIPENDSET_Msk (1UL << SCB_ICSR_NMIPENDSET_Pos) /*!< SCB ICSR: NMIPENDSET Mask */
  350. #define SCB_ICSR_PENDSVSET_Pos 28 /*!< SCB ICSR: PENDSVSET Position */
  351. #define SCB_ICSR_PENDSVSET_Msk (1UL << SCB_ICSR_PENDSVSET_Pos) /*!< SCB ICSR: PENDSVSET Mask */
  352. #define SCB_ICSR_PENDSVCLR_Pos 27 /*!< SCB ICSR: PENDSVCLR Position */
  353. #define SCB_ICSR_PENDSVCLR_Msk (1UL << SCB_ICSR_PENDSVCLR_Pos) /*!< SCB ICSR: PENDSVCLR Mask */
  354. #define SCB_ICSR_PENDSTSET_Pos 26 /*!< SCB ICSR: PENDSTSET Position */
  355. #define SCB_ICSR_PENDSTSET_Msk (1UL << SCB_ICSR_PENDSTSET_Pos) /*!< SCB ICSR: PENDSTSET Mask */
  356. #define SCB_ICSR_PENDSTCLR_Pos 25 /*!< SCB ICSR: PENDSTCLR Position */
  357. #define SCB_ICSR_PENDSTCLR_Msk (1UL << SCB_ICSR_PENDSTCLR_Pos) /*!< SCB ICSR: PENDSTCLR Mask */
  358. #define SCB_ICSR_ISRPREEMPT_Pos 23 /*!< SCB ICSR: ISRPREEMPT Position */
  359. #define SCB_ICSR_ISRPREEMPT_Msk (1UL << SCB_ICSR_ISRPREEMPT_Pos) /*!< SCB ICSR: ISRPREEMPT Mask */
  360. #define SCB_ICSR_ISRPENDING_Pos 22 /*!< SCB ICSR: ISRPENDING Position */
  361. #define SCB_ICSR_ISRPENDING_Msk (1UL << SCB_ICSR_ISRPENDING_Pos) /*!< SCB ICSR: ISRPENDING Mask */
  362. #define SCB_ICSR_VECTPENDING_Pos 12 /*!< SCB ICSR: VECTPENDING Position */
  363. #define SCB_ICSR_VECTPENDING_Msk (0x1FFUL << SCB_ICSR_VECTPENDING_Pos) /*!< SCB ICSR: VECTPENDING Mask */
  364. #define SCB_ICSR_RETTOBASE_Pos 11 /*!< SCB ICSR: RETTOBASE Position */
  365. #define SCB_ICSR_RETTOBASE_Msk (1UL << SCB_ICSR_RETTOBASE_Pos) /*!< SCB ICSR: RETTOBASE Mask */
  366. #define SCB_ICSR_VECTACTIVE_Pos 0 /*!< SCB ICSR: VECTACTIVE Position */
  367. #define SCB_ICSR_VECTACTIVE_Msk (0x1FFUL /*<< SCB_ICSR_VECTACTIVE_Pos*/) /*!< SCB ICSR: VECTACTIVE Mask */
  368. /* SCB Vector Table Offset Register Definitions */
  369. #define SCB_VTOR_TBLBASE_Pos 29 /*!< SCB VTOR: TBLBASE Position */
  370. #define SCB_VTOR_TBLBASE_Msk (1UL << SCB_VTOR_TBLBASE_Pos) /*!< SCB VTOR: TBLBASE Mask */
  371. #define SCB_VTOR_TBLOFF_Pos 7 /*!< SCB VTOR: TBLOFF Position */
  372. #define SCB_VTOR_TBLOFF_Msk (0x3FFFFFUL << SCB_VTOR_TBLOFF_Pos) /*!< SCB VTOR: TBLOFF Mask */
  373. /* SCB Application Interrupt and Reset Control Register Definitions */
  374. #define SCB_AIRCR_VECTKEY_Pos 16 /*!< SCB AIRCR: VECTKEY Position */
  375. #define SCB_AIRCR_VECTKEY_Msk (0xFFFFUL << SCB_AIRCR_VECTKEY_Pos) /*!< SCB AIRCR: VECTKEY Mask */
  376. #define SCB_AIRCR_VECTKEYSTAT_Pos 16 /*!< SCB AIRCR: VECTKEYSTAT Position */
  377. #define SCB_AIRCR_VECTKEYSTAT_Msk (0xFFFFUL << SCB_AIRCR_VECTKEYSTAT_Pos) /*!< SCB AIRCR: VECTKEYSTAT Mask */
  378. #define SCB_AIRCR_ENDIANESS_Pos 15 /*!< SCB AIRCR: ENDIANESS Position */
  379. #define SCB_AIRCR_ENDIANESS_Msk (1UL << SCB_AIRCR_ENDIANESS_Pos) /*!< SCB AIRCR: ENDIANESS Mask */
  380. #define SCB_AIRCR_PRIGROUP_Pos 8 /*!< SCB AIRCR: PRIGROUP Position */
  381. #define SCB_AIRCR_PRIGROUP_Msk (7UL << SCB_AIRCR_PRIGROUP_Pos) /*!< SCB AIRCR: PRIGROUP Mask */
  382. #define SCB_AIRCR_SYSRESETREQ_Pos 2 /*!< SCB AIRCR: SYSRESETREQ Position */
  383. #define SCB_AIRCR_SYSRESETREQ_Msk (1UL << SCB_AIRCR_SYSRESETREQ_Pos) /*!< SCB AIRCR: SYSRESETREQ Mask */
  384. #define SCB_AIRCR_VECTCLRACTIVE_Pos 1 /*!< SCB AIRCR: VECTCLRACTIVE Position */
  385. #define SCB_AIRCR_VECTCLRACTIVE_Msk (1UL << SCB_AIRCR_VECTCLRACTIVE_Pos) /*!< SCB AIRCR: VECTCLRACTIVE Mask */
  386. #define SCB_AIRCR_VECTRESET_Pos 0 /*!< SCB AIRCR: VECTRESET Position */
  387. #define SCB_AIRCR_VECTRESET_Msk (1UL /*<< SCB_AIRCR_VECTRESET_Pos*/) /*!< SCB AIRCR: VECTRESET Mask */
  388. /* SCB System Control Register Definitions */
  389. #define SCB_SCR_SEVONPEND_Pos 4 /*!< SCB SCR: SEVONPEND Position */
  390. #define SCB_SCR_SEVONPEND_Msk (1UL << SCB_SCR_SEVONPEND_Pos) /*!< SCB SCR: SEVONPEND Mask */
  391. #define SCB_SCR_SLEEPDEEP_Pos 2 /*!< SCB SCR: SLEEPDEEP Position */
  392. #define SCB_SCR_SLEEPDEEP_Msk (1UL << SCB_SCR_SLEEPDEEP_Pos) /*!< SCB SCR: SLEEPDEEP Mask */
  393. #define SCB_SCR_SLEEPONEXIT_Pos 1 /*!< SCB SCR: SLEEPONEXIT Position */
  394. #define SCB_SCR_SLEEPONEXIT_Msk (1UL << SCB_SCR_SLEEPONEXIT_Pos) /*!< SCB SCR: SLEEPONEXIT Mask */
  395. /* SCB Configuration Control Register Definitions */
  396. #define SCB_CCR_STKALIGN_Pos 9 /*!< SCB CCR: STKALIGN Position */
  397. #define SCB_CCR_STKALIGN_Msk (1UL << SCB_CCR_STKALIGN_Pos) /*!< SCB CCR: STKALIGN Mask */
  398. #define SCB_CCR_BFHFNMIGN_Pos 8 /*!< SCB CCR: BFHFNMIGN Position */
  399. #define SCB_CCR_BFHFNMIGN_Msk (1UL << SCB_CCR_BFHFNMIGN_Pos) /*!< SCB CCR: BFHFNMIGN Mask */
  400. #define SCB_CCR_DIV_0_TRP_Pos 4 /*!< SCB CCR: DIV_0_TRP Position */
  401. #define SCB_CCR_DIV_0_TRP_Msk (1UL << SCB_CCR_DIV_0_TRP_Pos) /*!< SCB CCR: DIV_0_TRP Mask */
  402. #define SCB_CCR_UNALIGN_TRP_Pos 3 /*!< SCB CCR: UNALIGN_TRP Position */
  403. #define SCB_CCR_UNALIGN_TRP_Msk (1UL << SCB_CCR_UNALIGN_TRP_Pos) /*!< SCB CCR: UNALIGN_TRP Mask */
  404. #define SCB_CCR_USERSETMPEND_Pos 1 /*!< SCB CCR: USERSETMPEND Position */
  405. #define SCB_CCR_USERSETMPEND_Msk (1UL << SCB_CCR_USERSETMPEND_Pos) /*!< SCB CCR: USERSETMPEND Mask */
  406. #define SCB_CCR_NONBASETHRDENA_Pos 0 /*!< SCB CCR: NONBASETHRDENA Position */
  407. #define SCB_CCR_NONBASETHRDENA_Msk (1UL /*<< SCB_CCR_NONBASETHRDENA_Pos*/) /*!< SCB CCR: NONBASETHRDENA Mask */
  408. /* SCB System Handler Control and State Register Definitions */
  409. #define SCB_SHCSR_USGFAULTENA_Pos 18 /*!< SCB SHCSR: USGFAULTENA Position */
  410. #define SCB_SHCSR_USGFAULTENA_Msk (1UL << SCB_SHCSR_USGFAULTENA_Pos) /*!< SCB SHCSR: USGFAULTENA Mask */
  411. #define SCB_SHCSR_BUSFAULTENA_Pos 17 /*!< SCB SHCSR: BUSFAULTENA Position */
  412. #define SCB_SHCSR_BUSFAULTENA_Msk (1UL << SCB_SHCSR_BUSFAULTENA_Pos) /*!< SCB SHCSR: BUSFAULTENA Mask */
  413. #define SCB_SHCSR_MEMFAULTENA_Pos 16 /*!< SCB SHCSR: MEMFAULTENA Position */
  414. #define SCB_SHCSR_MEMFAULTENA_Msk (1UL << SCB_SHCSR_MEMFAULTENA_Pos) /*!< SCB SHCSR: MEMFAULTENA Mask */
  415. #define SCB_SHCSR_SVCALLPENDED_Pos 15 /*!< SCB SHCSR: SVCALLPENDED Position */
  416. #define SCB_SHCSR_SVCALLPENDED_Msk (1UL << SCB_SHCSR_SVCALLPENDED_Pos) /*!< SCB SHCSR: SVCALLPENDED Mask */
  417. #define SCB_SHCSR_BUSFAULTPENDED_Pos 14 /*!< SCB SHCSR: BUSFAULTPENDED Position */
  418. #define SCB_SHCSR_BUSFAULTPENDED_Msk (1UL << SCB_SHCSR_BUSFAULTPENDED_Pos) /*!< SCB SHCSR: BUSFAULTPENDED Mask */
  419. #define SCB_SHCSR_MEMFAULTPENDED_Pos 13 /*!< SCB SHCSR: MEMFAULTPENDED Position */
  420. #define SCB_SHCSR_MEMFAULTPENDED_Msk (1UL << SCB_SHCSR_MEMFAULTPENDED_Pos) /*!< SCB SHCSR: MEMFAULTPENDED Mask */
  421. #define SCB_SHCSR_USGFAULTPENDED_Pos 12 /*!< SCB SHCSR: USGFAULTPENDED Position */
  422. #define SCB_SHCSR_USGFAULTPENDED_Msk (1UL << SCB_SHCSR_USGFAULTPENDED_Pos) /*!< SCB SHCSR: USGFAULTPENDED Mask */
  423. #define SCB_SHCSR_SYSTICKACT_Pos 11 /*!< SCB SHCSR: SYSTICKACT Position */
  424. #define SCB_SHCSR_SYSTICKACT_Msk (1UL << SCB_SHCSR_SYSTICKACT_Pos) /*!< SCB SHCSR: SYSTICKACT Mask */
  425. #define SCB_SHCSR_PENDSVACT_Pos 10 /*!< SCB SHCSR: PENDSVACT Position */
  426. #define SCB_SHCSR_PENDSVACT_Msk (1UL << SCB_SHCSR_PENDSVACT_Pos) /*!< SCB SHCSR: PENDSVACT Mask */
  427. #define SCB_SHCSR_MONITORACT_Pos 8 /*!< SCB SHCSR: MONITORACT Position */
  428. #define SCB_SHCSR_MONITORACT_Msk (1UL << SCB_SHCSR_MONITORACT_Pos) /*!< SCB SHCSR: MONITORACT Mask */
  429. #define SCB_SHCSR_SVCALLACT_Pos 7 /*!< SCB SHCSR: SVCALLACT Position */
  430. #define SCB_SHCSR_SVCALLACT_Msk (1UL << SCB_SHCSR_SVCALLACT_Pos) /*!< SCB SHCSR: SVCALLACT Mask */
  431. #define SCB_SHCSR_USGFAULTACT_Pos 3 /*!< SCB SHCSR: USGFAULTACT Position */
  432. #define SCB_SHCSR_USGFAULTACT_Msk (1UL << SCB_SHCSR_USGFAULTACT_Pos) /*!< SCB SHCSR: USGFAULTACT Mask */
  433. #define SCB_SHCSR_BUSFAULTACT_Pos 1 /*!< SCB SHCSR: BUSFAULTACT Position */
  434. #define SCB_SHCSR_BUSFAULTACT_Msk (1UL << SCB_SHCSR_BUSFAULTACT_Pos) /*!< SCB SHCSR: BUSFAULTACT Mask */
  435. #define SCB_SHCSR_MEMFAULTACT_Pos 0 /*!< SCB SHCSR: MEMFAULTACT Position */
  436. #define SCB_SHCSR_MEMFAULTACT_Msk (1UL /*<< SCB_SHCSR_MEMFAULTACT_Pos*/) /*!< SCB SHCSR: MEMFAULTACT Mask */
  437. /* SCB Configurable Fault Status Registers Definitions */
  438. #define SCB_CFSR_USGFAULTSR_Pos 16 /*!< SCB CFSR: Usage Fault Status Register Position */
  439. #define SCB_CFSR_USGFAULTSR_Msk (0xFFFFUL << SCB_CFSR_USGFAULTSR_Pos) /*!< SCB CFSR: Usage Fault Status Register Mask */
  440. #define SCB_CFSR_BUSFAULTSR_Pos 8 /*!< SCB CFSR: Bus Fault Status Register Position */
  441. #define SCB_CFSR_BUSFAULTSR_Msk (0xFFUL << SCB_CFSR_BUSFAULTSR_Pos) /*!< SCB CFSR: Bus Fault Status Register Mask */
  442. #define SCB_CFSR_MEMFAULTSR_Pos 0 /*!< SCB CFSR: Memory Manage Fault Status Register Position */
  443. #define SCB_CFSR_MEMFAULTSR_Msk (0xFFUL /*<< SCB_CFSR_MEMFAULTSR_Pos*/) /*!< SCB CFSR: Memory Manage Fault Status Register Mask */
  444. /* SCB Hard Fault Status Registers Definitions */
  445. #define SCB_HFSR_DEBUGEVT_Pos 31 /*!< SCB HFSR: DEBUGEVT Position */
  446. #define SCB_HFSR_DEBUGEVT_Msk (1UL << SCB_HFSR_DEBUGEVT_Pos) /*!< SCB HFSR: DEBUGEVT Mask */
  447. #define SCB_HFSR_FORCED_Pos 30 /*!< SCB HFSR: FORCED Position */
  448. #define SCB_HFSR_FORCED_Msk (1UL << SCB_HFSR_FORCED_Pos) /*!< SCB HFSR: FORCED Mask */
  449. #define SCB_HFSR_VECTTBL_Pos 1 /*!< SCB HFSR: VECTTBL Position */
  450. #define SCB_HFSR_VECTTBL_Msk (1UL << SCB_HFSR_VECTTBL_Pos) /*!< SCB HFSR: VECTTBL Mask */
  451. /* SCB Debug Fault Status Register Definitions */
  452. #define SCB_DFSR_EXTERNAL_Pos 4 /*!< SCB DFSR: EXTERNAL Position */
  453. #define SCB_DFSR_EXTERNAL_Msk (1UL << SCB_DFSR_EXTERNAL_Pos) /*!< SCB DFSR: EXTERNAL Mask */
  454. #define SCB_DFSR_VCATCH_Pos 3 /*!< SCB DFSR: VCATCH Position */
  455. #define SCB_DFSR_VCATCH_Msk (1UL << SCB_DFSR_VCATCH_Pos) /*!< SCB DFSR: VCATCH Mask */
  456. #define SCB_DFSR_DWTTRAP_Pos 2 /*!< SCB DFSR: DWTTRAP Position */
  457. #define SCB_DFSR_DWTTRAP_Msk (1UL << SCB_DFSR_DWTTRAP_Pos) /*!< SCB DFSR: DWTTRAP Mask */
  458. #define SCB_DFSR_BKPT_Pos 1 /*!< SCB DFSR: BKPT Position */
  459. #define SCB_DFSR_BKPT_Msk (1UL << SCB_DFSR_BKPT_Pos) /*!< SCB DFSR: BKPT Mask */
  460. #define SCB_DFSR_HALTED_Pos 0 /*!< SCB DFSR: HALTED Position */
  461. #define SCB_DFSR_HALTED_Msk (1UL /*<< SCB_DFSR_HALTED_Pos*/) /*!< SCB DFSR: HALTED Mask */
  462. /*@} end of group CMSIS_SCB */
  463. /** \ingroup CMSIS_core_register
  464. \defgroup CMSIS_SCnSCB System Controls not in SCB (SCnSCB)
  465. \brief Type definitions for the System Control and ID Register not in the SCB
  466. @{
  467. */
  468. /** \brief Structure type to access the System Control and ID Register not in the SCB.
  469. */
  470. typedef struct
  471. {
  472. uint32_t RESERVED0[1];
  473. __I uint32_t ICTR; /*!< Offset: 0x004 (R/ ) Interrupt Controller Type Register */
  474. uint32_t RESERVED1[1];
  475. } SCnSCB_Type;
  476. /* Interrupt Controller Type Register Definitions */
  477. #define SCnSCB_ICTR_INTLINESNUM_Pos 0 /*!< ICTR: INTLINESNUM Position */
  478. #define SCnSCB_ICTR_INTLINESNUM_Msk (0xFUL /*<< SCnSCB_ICTR_INTLINESNUM_Pos*/) /*!< ICTR: INTLINESNUM Mask */
  479. /*@} end of group CMSIS_SCnotSCB */
  480. /** \ingroup CMSIS_core_register
  481. \defgroup CMSIS_SysTick System Tick Timer (SysTick)
  482. \brief Type definitions for the System Timer Registers.
  483. @{
  484. */
  485. /** \brief Structure type to access the System Timer (SysTick).
  486. */
  487. typedef struct
  488. {
  489. __IO uint32_t CTRL; /*!< Offset: 0x000 (R/W) SysTick Control and Status Register */
  490. __IO uint32_t LOAD; /*!< Offset: 0x004 (R/W) SysTick Reload Value Register */
  491. __IO uint32_t VAL; /*!< Offset: 0x008 (R/W) SysTick Current Value Register */
  492. __I uint32_t CALIB; /*!< Offset: 0x00C (R/ ) SysTick Calibration Register */
  493. } SysTick_Type;
  494. /* SysTick Control / Status Register Definitions */
  495. #define SysTick_CTRL_COUNTFLAG_Pos 16 /*!< SysTick CTRL: COUNTFLAG Position */
  496. #define SysTick_CTRL_COUNTFLAG_Msk (1UL << SysTick_CTRL_COUNTFLAG_Pos) /*!< SysTick CTRL: COUNTFLAG Mask */
  497. #define SysTick_CTRL_CLKSOURCE_Pos 2 /*!< SysTick CTRL: CLKSOURCE Position */
  498. #define SysTick_CTRL_CLKSOURCE_Msk (1UL << SysTick_CTRL_CLKSOURCE_Pos) /*!< SysTick CTRL: CLKSOURCE Mask */
  499. #define SysTick_CTRL_TICKINT_Pos 1 /*!< SysTick CTRL: TICKINT Position */
  500. #define SysTick_CTRL_TICKINT_Msk (1UL << SysTick_CTRL_TICKINT_Pos) /*!< SysTick CTRL: TICKINT Mask */
  501. #define SysTick_CTRL_ENABLE_Pos 0 /*!< SysTick CTRL: ENABLE Position */
  502. #define SysTick_CTRL_ENABLE_Msk (1UL /*<< SysTick_CTRL_ENABLE_Pos*/) /*!< SysTick CTRL: ENABLE Mask */
  503. /* SysTick Reload Register Definitions */
  504. #define SysTick_LOAD_RELOAD_Pos 0 /*!< SysTick LOAD: RELOAD Position */
  505. #define SysTick_LOAD_RELOAD_Msk (0xFFFFFFUL /*<< SysTick_LOAD_RELOAD_Pos*/) /*!< SysTick LOAD: RELOAD Mask */
  506. /* SysTick Current Register Definitions */
  507. #define SysTick_VAL_CURRENT_Pos 0 /*!< SysTick VAL: CURRENT Position */
  508. #define SysTick_VAL_CURRENT_Msk (0xFFFFFFUL /*<< SysTick_VAL_CURRENT_Pos*/) /*!< SysTick VAL: CURRENT Mask */
  509. /* SysTick Calibration Register Definitions */
  510. #define SysTick_CALIB_NOREF_Pos 31 /*!< SysTick CALIB: NOREF Position */
  511. #define SysTick_CALIB_NOREF_Msk (1UL << SysTick_CALIB_NOREF_Pos) /*!< SysTick CALIB: NOREF Mask */
  512. #define SysTick_CALIB_SKEW_Pos 30 /*!< SysTick CALIB: SKEW Position */
  513. #define SysTick_CALIB_SKEW_Msk (1UL << SysTick_CALIB_SKEW_Pos) /*!< SysTick CALIB: SKEW Mask */
  514. #define SysTick_CALIB_TENMS_Pos 0 /*!< SysTick CALIB: TENMS Position */
  515. #define SysTick_CALIB_TENMS_Msk (0xFFFFFFUL /*<< SysTick_CALIB_TENMS_Pos*/) /*!< SysTick CALIB: TENMS Mask */
  516. /*@} end of group CMSIS_SysTick */
  517. /** \ingroup CMSIS_core_register
  518. \defgroup CMSIS_ITM Instrumentation Trace Macrocell (ITM)
  519. \brief Type definitions for the Instrumentation Trace Macrocell (ITM)
  520. @{
  521. */
  522. /** \brief Structure type to access the Instrumentation Trace Macrocell Register (ITM).
  523. */
  524. typedef struct
  525. {
  526. __O union
  527. {
  528. __O uint8_t u8; /*!< Offset: 0x000 ( /W) ITM Stimulus Port 8-bit */
  529. __O uint16_t u16; /*!< Offset: 0x000 ( /W) ITM Stimulus Port 16-bit */
  530. __O uint32_t u32; /*!< Offset: 0x000 ( /W) ITM Stimulus Port 32-bit */
  531. } PORT [32]; /*!< Offset: 0x000 ( /W) ITM Stimulus Port Registers */
  532. uint32_t RESERVED0[864];
  533. __IO uint32_t TER; /*!< Offset: 0xE00 (R/W) ITM Trace Enable Register */
  534. uint32_t RESERVED1[15];
  535. __IO uint32_t TPR; /*!< Offset: 0xE40 (R/W) ITM Trace Privilege Register */
  536. uint32_t RESERVED2[15];
  537. __IO uint32_t TCR; /*!< Offset: 0xE80 (R/W) ITM Trace Control Register */
  538. uint32_t RESERVED3[29];
  539. __O uint32_t IWR; /*!< Offset: 0xEF8 ( /W) ITM Integration Write Register */
  540. __I uint32_t IRR; /*!< Offset: 0xEFC (R/ ) ITM Integration Read Register */
  541. __IO uint32_t IMCR; /*!< Offset: 0xF00 (R/W) ITM Integration Mode Control Register */
  542. uint32_t RESERVED4[43];
  543. __O uint32_t LAR; /*!< Offset: 0xFB0 ( /W) ITM Lock Access Register */
  544. __I uint32_t LSR; /*!< Offset: 0xFB4 (R/ ) ITM Lock Status Register */
  545. uint32_t RESERVED5[6];
  546. __I uint32_t PID4; /*!< Offset: 0xFD0 (R/ ) ITM Peripheral Identification Register #4 */
  547. __I uint32_t PID5; /*!< Offset: 0xFD4 (R/ ) ITM Peripheral Identification Register #5 */
  548. __I uint32_t PID6; /*!< Offset: 0xFD8 (R/ ) ITM Peripheral Identification Register #6 */
  549. __I uint32_t PID7; /*!< Offset: 0xFDC (R/ ) ITM Peripheral Identification Register #7 */
  550. __I uint32_t PID0; /*!< Offset: 0xFE0 (R/ ) ITM Peripheral Identification Register #0 */
  551. __I uint32_t PID1; /*!< Offset: 0xFE4 (R/ ) ITM Peripheral Identification Register #1 */
  552. __I uint32_t PID2; /*!< Offset: 0xFE8 (R/ ) ITM Peripheral Identification Register #2 */
  553. __I uint32_t PID3; /*!< Offset: 0xFEC (R/ ) ITM Peripheral Identification Register #3 */
  554. __I uint32_t CID0; /*!< Offset: 0xFF0 (R/ ) ITM Component Identification Register #0 */
  555. __I uint32_t CID1; /*!< Offset: 0xFF4 (R/ ) ITM Component Identification Register #1 */
  556. __I uint32_t CID2; /*!< Offset: 0xFF8 (R/ ) ITM Component Identification Register #2 */
  557. __I uint32_t CID3; /*!< Offset: 0xFFC (R/ ) ITM Component Identification Register #3 */
  558. } ITM_Type;
  559. /* ITM Trace Privilege Register Definitions */
  560. #define ITM_TPR_PRIVMASK_Pos 0 /*!< ITM TPR: PRIVMASK Position */
  561. #define ITM_TPR_PRIVMASK_Msk (0xFUL /*<< ITM_TPR_PRIVMASK_Pos*/) /*!< ITM TPR: PRIVMASK Mask */
  562. /* ITM Trace Control Register Definitions */
  563. #define ITM_TCR_BUSY_Pos 23 /*!< ITM TCR: BUSY Position */
  564. #define ITM_TCR_BUSY_Msk (1UL << ITM_TCR_BUSY_Pos) /*!< ITM TCR: BUSY Mask */
  565. #define ITM_TCR_TraceBusID_Pos 16 /*!< ITM TCR: ATBID Position */
  566. #define ITM_TCR_TraceBusID_Msk (0x7FUL << ITM_TCR_TraceBusID_Pos) /*!< ITM TCR: ATBID Mask */
  567. #define ITM_TCR_GTSFREQ_Pos 10 /*!< ITM TCR: Global timestamp frequency Position */
  568. #define ITM_TCR_GTSFREQ_Msk (3UL << ITM_TCR_GTSFREQ_Pos) /*!< ITM TCR: Global timestamp frequency Mask */
  569. #define ITM_TCR_TSPrescale_Pos 8 /*!< ITM TCR: TSPrescale Position */
  570. #define ITM_TCR_TSPrescale_Msk (3UL << ITM_TCR_TSPrescale_Pos) /*!< ITM TCR: TSPrescale Mask */
  571. #define ITM_TCR_SWOENA_Pos 4 /*!< ITM TCR: SWOENA Position */
  572. #define ITM_TCR_SWOENA_Msk (1UL << ITM_TCR_SWOENA_Pos) /*!< ITM TCR: SWOENA Mask */
  573. #define ITM_TCR_DWTENA_Pos 3 /*!< ITM TCR: DWTENA Position */
  574. #define ITM_TCR_DWTENA_Msk (1UL << ITM_TCR_DWTENA_Pos) /*!< ITM TCR: DWTENA Mask */
  575. #define ITM_TCR_SYNCENA_Pos 2 /*!< ITM TCR: SYNCENA Position */
  576. #define ITM_TCR_SYNCENA_Msk (1UL << ITM_TCR_SYNCENA_Pos) /*!< ITM TCR: SYNCENA Mask */
  577. #define ITM_TCR_TSENA_Pos 1 /*!< ITM TCR: TSENA Position */
  578. #define ITM_TCR_TSENA_Msk (1UL << ITM_TCR_TSENA_Pos) /*!< ITM TCR: TSENA Mask */
  579. #define ITM_TCR_ITMENA_Pos 0 /*!< ITM TCR: ITM Enable bit Position */
  580. #define ITM_TCR_ITMENA_Msk (1UL /*<< ITM_TCR_ITMENA_Pos*/) /*!< ITM TCR: ITM Enable bit Mask */
  581. /* ITM Integration Write Register Definitions */
  582. #define ITM_IWR_ATVALIDM_Pos 0 /*!< ITM IWR: ATVALIDM Position */
  583. #define ITM_IWR_ATVALIDM_Msk (1UL /*<< ITM_IWR_ATVALIDM_Pos*/) /*!< ITM IWR: ATVALIDM Mask */
  584. /* ITM Integration Read Register Definitions */
  585. #define ITM_IRR_ATREADYM_Pos 0 /*!< ITM IRR: ATREADYM Position */
  586. #define ITM_IRR_ATREADYM_Msk (1UL /*<< ITM_IRR_ATREADYM_Pos*/) /*!< ITM IRR: ATREADYM Mask */
  587. /* ITM Integration Mode Control Register Definitions */
  588. #define ITM_IMCR_INTEGRATION_Pos 0 /*!< ITM IMCR: INTEGRATION Position */
  589. #define ITM_IMCR_INTEGRATION_Msk (1UL /*<< ITM_IMCR_INTEGRATION_Pos*/) /*!< ITM IMCR: INTEGRATION Mask */
  590. /* ITM Lock Status Register Definitions */
  591. #define ITM_LSR_ByteAcc_Pos 2 /*!< ITM LSR: ByteAcc Position */
  592. #define ITM_LSR_ByteAcc_Msk (1UL << ITM_LSR_ByteAcc_Pos) /*!< ITM LSR: ByteAcc Mask */
  593. #define ITM_LSR_Access_Pos 1 /*!< ITM LSR: Access Position */
  594. #define ITM_LSR_Access_Msk (1UL << ITM_LSR_Access_Pos) /*!< ITM LSR: Access Mask */
  595. #define ITM_LSR_Present_Pos 0 /*!< ITM LSR: Present Position */
  596. #define ITM_LSR_Present_Msk (1UL /*<< ITM_LSR_Present_Pos*/) /*!< ITM LSR: Present Mask */
  597. /*@}*/ /* end of group CMSIS_ITM */
  598. /** \ingroup CMSIS_core_register
  599. \defgroup CMSIS_DWT Data Watchpoint and Trace (DWT)
  600. \brief Type definitions for the Data Watchpoint and Trace (DWT)
  601. @{
  602. */
  603. /** \brief Structure type to access the Data Watchpoint and Trace Register (DWT).
  604. */
  605. typedef struct
  606. {
  607. __IO uint32_t CTRL; /*!< Offset: 0x000 (R/W) Control Register */
  608. __IO uint32_t CYCCNT; /*!< Offset: 0x004 (R/W) Cycle Count Register */
  609. __IO uint32_t CPICNT; /*!< Offset: 0x008 (R/W) CPI Count Register */
  610. __IO uint32_t EXCCNT; /*!< Offset: 0x00C (R/W) Exception Overhead Count Register */
  611. __IO uint32_t SLEEPCNT; /*!< Offset: 0x010 (R/W) Sleep Count Register */
  612. __IO uint32_t LSUCNT; /*!< Offset: 0x014 (R/W) LSU Count Register */
  613. __IO uint32_t FOLDCNT; /*!< Offset: 0x018 (R/W) Folded-instruction Count Register */
  614. __I uint32_t PCSR; /*!< Offset: 0x01C (R/ ) Program Counter Sample Register */
  615. __IO uint32_t COMP0; /*!< Offset: 0x020 (R/W) Comparator Register 0 */
  616. __IO uint32_t MASK0; /*!< Offset: 0x024 (R/W) Mask Register 0 */
  617. __IO uint32_t FUNCTION0; /*!< Offset: 0x028 (R/W) Function Register 0 */
  618. uint32_t RESERVED0[1];
  619. __IO uint32_t COMP1; /*!< Offset: 0x030 (R/W) Comparator Register 1 */
  620. __IO uint32_t MASK1; /*!< Offset: 0x034 (R/W) Mask Register 1 */
  621. __IO uint32_t FUNCTION1; /*!< Offset: 0x038 (R/W) Function Register 1 */
  622. uint32_t RESERVED1[1];
  623. __IO uint32_t COMP2; /*!< Offset: 0x040 (R/W) Comparator Register 2 */
  624. __IO uint32_t MASK2; /*!< Offset: 0x044 (R/W) Mask Register 2 */
  625. __IO uint32_t FUNCTION2; /*!< Offset: 0x048 (R/W) Function Register 2 */
  626. uint32_t RESERVED2[1];
  627. __IO uint32_t COMP3; /*!< Offset: 0x050 (R/W) Comparator Register 3 */
  628. __IO uint32_t MASK3; /*!< Offset: 0x054 (R/W) Mask Register 3 */
  629. __IO uint32_t FUNCTION3; /*!< Offset: 0x058 (R/W) Function Register 3 */
  630. } DWT_Type;
  631. /* DWT Control Register Definitions */
  632. #define DWT_CTRL_NUMCOMP_Pos 28 /*!< DWT CTRL: NUMCOMP Position */
  633. #define DWT_CTRL_NUMCOMP_Msk (0xFUL << DWT_CTRL_NUMCOMP_Pos) /*!< DWT CTRL: NUMCOMP Mask */
  634. #define DWT_CTRL_NOTRCPKT_Pos 27 /*!< DWT CTRL: NOTRCPKT Position */
  635. #define DWT_CTRL_NOTRCPKT_Msk (0x1UL << DWT_CTRL_NOTRCPKT_Pos) /*!< DWT CTRL: NOTRCPKT Mask */
  636. #define DWT_CTRL_NOEXTTRIG_Pos 26 /*!< DWT CTRL: NOEXTTRIG Position */
  637. #define DWT_CTRL_NOEXTTRIG_Msk (0x1UL << DWT_CTRL_NOEXTTRIG_Pos) /*!< DWT CTRL: NOEXTTRIG Mask */
  638. #define DWT_CTRL_NOCYCCNT_Pos 25 /*!< DWT CTRL: NOCYCCNT Position */
  639. #define DWT_CTRL_NOCYCCNT_Msk (0x1UL << DWT_CTRL_NOCYCCNT_Pos) /*!< DWT CTRL: NOCYCCNT Mask */
  640. #define DWT_CTRL_NOPRFCNT_Pos 24 /*!< DWT CTRL: NOPRFCNT Position */
  641. #define DWT_CTRL_NOPRFCNT_Msk (0x1UL << DWT_CTRL_NOPRFCNT_Pos) /*!< DWT CTRL: NOPRFCNT Mask */
  642. #define DWT_CTRL_CYCEVTENA_Pos 22 /*!< DWT CTRL: CYCEVTENA Position */
  643. #define DWT_CTRL_CYCEVTENA_Msk (0x1UL << DWT_CTRL_CYCEVTENA_Pos) /*!< DWT CTRL: CYCEVTENA Mask */
  644. #define DWT_CTRL_FOLDEVTENA_Pos 21 /*!< DWT CTRL: FOLDEVTENA Position */
  645. #define DWT_CTRL_FOLDEVTENA_Msk (0x1UL << DWT_CTRL_FOLDEVTENA_Pos) /*!< DWT CTRL: FOLDEVTENA Mask */
  646. #define DWT_CTRL_LSUEVTENA_Pos 20 /*!< DWT CTRL: LSUEVTENA Position */
  647. #define DWT_CTRL_LSUEVTENA_Msk (0x1UL << DWT_CTRL_LSUEVTENA_Pos) /*!< DWT CTRL: LSUEVTENA Mask */
  648. #define DWT_CTRL_SLEEPEVTENA_Pos 19 /*!< DWT CTRL: SLEEPEVTENA Position */
  649. #define DWT_CTRL_SLEEPEVTENA_Msk (0x1UL << DWT_CTRL_SLEEPEVTENA_Pos) /*!< DWT CTRL: SLEEPEVTENA Mask */
  650. #define DWT_CTRL_EXCEVTENA_Pos 18 /*!< DWT CTRL: EXCEVTENA Position */
  651. #define DWT_CTRL_EXCEVTENA_Msk (0x1UL << DWT_CTRL_EXCEVTENA_Pos) /*!< DWT CTRL: EXCEVTENA Mask */
  652. #define DWT_CTRL_CPIEVTENA_Pos 17 /*!< DWT CTRL: CPIEVTENA Position */
  653. #define DWT_CTRL_CPIEVTENA_Msk (0x1UL << DWT_CTRL_CPIEVTENA_Pos) /*!< DWT CTRL: CPIEVTENA Mask */
  654. #define DWT_CTRL_EXCTRCENA_Pos 16 /*!< DWT CTRL: EXCTRCENA Position */
  655. #define DWT_CTRL_EXCTRCENA_Msk (0x1UL << DWT_CTRL_EXCTRCENA_Pos) /*!< DWT CTRL: EXCTRCENA Mask */
  656. #define DWT_CTRL_PCSAMPLENA_Pos 12 /*!< DWT CTRL: PCSAMPLENA Position */
  657. #define DWT_CTRL_PCSAMPLENA_Msk (0x1UL << DWT_CTRL_PCSAMPLENA_Pos) /*!< DWT CTRL: PCSAMPLENA Mask */
  658. #define DWT_CTRL_SYNCTAP_Pos 10 /*!< DWT CTRL: SYNCTAP Position */
  659. #define DWT_CTRL_SYNCTAP_Msk (0x3UL << DWT_CTRL_SYNCTAP_Pos) /*!< DWT CTRL: SYNCTAP Mask */
  660. #define DWT_CTRL_CYCTAP_Pos 9 /*!< DWT CTRL: CYCTAP Position */
  661. #define DWT_CTRL_CYCTAP_Msk (0x1UL << DWT_CTRL_CYCTAP_Pos) /*!< DWT CTRL: CYCTAP Mask */
  662. #define DWT_CTRL_POSTINIT_Pos 5 /*!< DWT CTRL: POSTINIT Position */
  663. #define DWT_CTRL_POSTINIT_Msk (0xFUL << DWT_CTRL_POSTINIT_Pos) /*!< DWT CTRL: POSTINIT Mask */
  664. #define DWT_CTRL_POSTPRESET_Pos 1 /*!< DWT CTRL: POSTPRESET Position */
  665. #define DWT_CTRL_POSTPRESET_Msk (0xFUL << DWT_CTRL_POSTPRESET_Pos) /*!< DWT CTRL: POSTPRESET Mask */
  666. #define DWT_CTRL_CYCCNTENA_Pos 0 /*!< DWT CTRL: CYCCNTENA Position */
  667. #define DWT_CTRL_CYCCNTENA_Msk (0x1UL /*<< DWT_CTRL_CYCCNTENA_Pos*/) /*!< DWT CTRL: CYCCNTENA Mask */
  668. /* DWT CPI Count Register Definitions */
  669. #define DWT_CPICNT_CPICNT_Pos 0 /*!< DWT CPICNT: CPICNT Position */
  670. #define DWT_CPICNT_CPICNT_Msk (0xFFUL /*<< DWT_CPICNT_CPICNT_Pos*/) /*!< DWT CPICNT: CPICNT Mask */
  671. /* DWT Exception Overhead Count Register Definitions */
  672. #define DWT_EXCCNT_EXCCNT_Pos 0 /*!< DWT EXCCNT: EXCCNT Position */
  673. #define DWT_EXCCNT_EXCCNT_Msk (0xFFUL /*<< DWT_EXCCNT_EXCCNT_Pos*/) /*!< DWT EXCCNT: EXCCNT Mask */
  674. /* DWT Sleep Count Register Definitions */
  675. #define DWT_SLEEPCNT_SLEEPCNT_Pos 0 /*!< DWT SLEEPCNT: SLEEPCNT Position */
  676. #define DWT_SLEEPCNT_SLEEPCNT_Msk (0xFFUL /*<< DWT_SLEEPCNT_SLEEPCNT_Pos*/) /*!< DWT SLEEPCNT: SLEEPCNT Mask */
  677. /* DWT LSU Count Register Definitions */
  678. #define DWT_LSUCNT_LSUCNT_Pos 0 /*!< DWT LSUCNT: LSUCNT Position */
  679. #define DWT_LSUCNT_LSUCNT_Msk (0xFFUL /*<< DWT_LSUCNT_LSUCNT_Pos*/) /*!< DWT LSUCNT: LSUCNT Mask */
  680. /* DWT Folded-instruction Count Register Definitions */
  681. #define DWT_FOLDCNT_FOLDCNT_Pos 0 /*!< DWT FOLDCNT: FOLDCNT Position */
  682. #define DWT_FOLDCNT_FOLDCNT_Msk (0xFFUL /*<< DWT_FOLDCNT_FOLDCNT_Pos*/) /*!< DWT FOLDCNT: FOLDCNT Mask */
  683. /* DWT Comparator Mask Register Definitions */
  684. #define DWT_MASK_MASK_Pos 0 /*!< DWT MASK: MASK Position */
  685. #define DWT_MASK_MASK_Msk (0x1FUL /*<< DWT_MASK_MASK_Pos*/) /*!< DWT MASK: MASK Mask */
  686. /* DWT Comparator Function Register Definitions */
  687. #define DWT_FUNCTION_MATCHED_Pos 24 /*!< DWT FUNCTION: MATCHED Position */
  688. #define DWT_FUNCTION_MATCHED_Msk (0x1UL << DWT_FUNCTION_MATCHED_Pos) /*!< DWT FUNCTION: MATCHED Mask */
  689. #define DWT_FUNCTION_DATAVADDR1_Pos 16 /*!< DWT FUNCTION: DATAVADDR1 Position */
  690. #define DWT_FUNCTION_DATAVADDR1_Msk (0xFUL << DWT_FUNCTION_DATAVADDR1_Pos) /*!< DWT FUNCTION: DATAVADDR1 Mask */
  691. #define DWT_FUNCTION_DATAVADDR0_Pos 12 /*!< DWT FUNCTION: DATAVADDR0 Position */
  692. #define DWT_FUNCTION_DATAVADDR0_Msk (0xFUL << DWT_FUNCTION_DATAVADDR0_Pos) /*!< DWT FUNCTION: DATAVADDR0 Mask */
  693. #define DWT_FUNCTION_DATAVSIZE_Pos 10 /*!< DWT FUNCTION: DATAVSIZE Position */
  694. #define DWT_FUNCTION_DATAVSIZE_Msk (0x3UL << DWT_FUNCTION_DATAVSIZE_Pos) /*!< DWT FUNCTION: DATAVSIZE Mask */
  695. #define DWT_FUNCTION_LNK1ENA_Pos 9 /*!< DWT FUNCTION: LNK1ENA Position */
  696. #define DWT_FUNCTION_LNK1ENA_Msk (0x1UL << DWT_FUNCTION_LNK1ENA_Pos) /*!< DWT FUNCTION: LNK1ENA Mask */
  697. #define DWT_FUNCTION_DATAVMATCH_Pos 8 /*!< DWT FUNCTION: DATAVMATCH Position */
  698. #define DWT_FUNCTION_DATAVMATCH_Msk (0x1UL << DWT_FUNCTION_DATAVMATCH_Pos) /*!< DWT FUNCTION: DATAVMATCH Mask */
  699. #define DWT_FUNCTION_CYCMATCH_Pos 7 /*!< DWT FUNCTION: CYCMATCH Position */
  700. #define DWT_FUNCTION_CYCMATCH_Msk (0x1UL << DWT_FUNCTION_CYCMATCH_Pos) /*!< DWT FUNCTION: CYCMATCH Mask */
  701. #define DWT_FUNCTION_EMITRANGE_Pos 5 /*!< DWT FUNCTION: EMITRANGE Position */
  702. #define DWT_FUNCTION_EMITRANGE_Msk (0x1UL << DWT_FUNCTION_EMITRANGE_Pos) /*!< DWT FUNCTION: EMITRANGE Mask */
  703. #define DWT_FUNCTION_FUNCTION_Pos 0 /*!< DWT FUNCTION: FUNCTION Position */
  704. #define DWT_FUNCTION_FUNCTION_Msk (0xFUL /*<< DWT_FUNCTION_FUNCTION_Pos*/) /*!< DWT FUNCTION: FUNCTION Mask */
  705. /*@}*/ /* end of group CMSIS_DWT */
  706. /** \ingroup CMSIS_core_register
  707. \defgroup CMSIS_TPI Trace Port Interface (TPI)
  708. \brief Type definitions for the Trace Port Interface (TPI)
  709. @{
  710. */
  711. /** \brief Structure type to access the Trace Port Interface Register (TPI).
  712. */
  713. typedef struct
  714. {
  715. __IO uint32_t SSPSR; /*!< Offset: 0x000 (R/ ) Supported Parallel Port Size Register */
  716. __IO uint32_t CSPSR; /*!< Offset: 0x004 (R/W) Current Parallel Port Size Register */
  717. uint32_t RESERVED0[2];
  718. __IO uint32_t ACPR; /*!< Offset: 0x010 (R/W) Asynchronous Clock Prescaler Register */
  719. uint32_t RESERVED1[55];
  720. __IO uint32_t SPPR; /*!< Offset: 0x0F0 (R/W) Selected Pin Protocol Register */
  721. uint32_t RESERVED2[131];
  722. __I uint32_t FFSR; /*!< Offset: 0x300 (R/ ) Formatter and Flush Status Register */
  723. __IO uint32_t FFCR; /*!< Offset: 0x304 (R/W) Formatter and Flush Control Register */
  724. __I uint32_t FSCR; /*!< Offset: 0x308 (R/ ) Formatter Synchronization Counter Register */
  725. uint32_t RESERVED3[759];
  726. __I uint32_t TRIGGER; /*!< Offset: 0xEE8 (R/ ) TRIGGER */
  727. __I uint32_t FIFO0; /*!< Offset: 0xEEC (R/ ) Integration ETM Data */
  728. __I uint32_t ITATBCTR2; /*!< Offset: 0xEF0 (R/ ) ITATBCTR2 */
  729. uint32_t RESERVED4[1];
  730. __I uint32_t ITATBCTR0; /*!< Offset: 0xEF8 (R/ ) ITATBCTR0 */
  731. __I uint32_t FIFO1; /*!< Offset: 0xEFC (R/ ) Integration ITM Data */
  732. __IO uint32_t ITCTRL; /*!< Offset: 0xF00 (R/W) Integration Mode Control */
  733. uint32_t RESERVED5[39];
  734. __IO uint32_t CLAIMSET; /*!< Offset: 0xFA0 (R/W) Claim tag set */
  735. __IO uint32_t CLAIMCLR; /*!< Offset: 0xFA4 (R/W) Claim tag clear */
  736. uint32_t RESERVED7[8];
  737. __I uint32_t DEVID; /*!< Offset: 0xFC8 (R/ ) TPIU_DEVID */
  738. __I uint32_t DEVTYPE; /*!< Offset: 0xFCC (R/ ) TPIU_DEVTYPE */
  739. } TPI_Type;
  740. /* TPI Asynchronous Clock Prescaler Register Definitions */
  741. #define TPI_ACPR_PRESCALER_Pos 0 /*!< TPI ACPR: PRESCALER Position */
  742. #define TPI_ACPR_PRESCALER_Msk (0x1FFFUL /*<< TPI_ACPR_PRESCALER_Pos*/) /*!< TPI ACPR: PRESCALER Mask */
  743. /* TPI Selected Pin Protocol Register Definitions */
  744. #define TPI_SPPR_TXMODE_Pos 0 /*!< TPI SPPR: TXMODE Position */
  745. #define TPI_SPPR_TXMODE_Msk (0x3UL /*<< TPI_SPPR_TXMODE_Pos*/) /*!< TPI SPPR: TXMODE Mask */
  746. /* TPI Formatter and Flush Status Register Definitions */
  747. #define TPI_FFSR_FtNonStop_Pos 3 /*!< TPI FFSR: FtNonStop Position */
  748. #define TPI_FFSR_FtNonStop_Msk (0x1UL << TPI_FFSR_FtNonStop_Pos) /*!< TPI FFSR: FtNonStop Mask */
  749. #define TPI_FFSR_TCPresent_Pos 2 /*!< TPI FFSR: TCPresent Position */
  750. #define TPI_FFSR_TCPresent_Msk (0x1UL << TPI_FFSR_TCPresent_Pos) /*!< TPI FFSR: TCPresent Mask */
  751. #define TPI_FFSR_FtStopped_Pos 1 /*!< TPI FFSR: FtStopped Position */
  752. #define TPI_FFSR_FtStopped_Msk (0x1UL << TPI_FFSR_FtStopped_Pos) /*!< TPI FFSR: FtStopped Mask */
  753. #define TPI_FFSR_FlInProg_Pos 0 /*!< TPI FFSR: FlInProg Position */
  754. #define TPI_FFSR_FlInProg_Msk (0x1UL /*<< TPI_FFSR_FlInProg_Pos*/) /*!< TPI FFSR: FlInProg Mask */
  755. /* TPI Formatter and Flush Control Register Definitions */
  756. #define TPI_FFCR_TrigIn_Pos 8 /*!< TPI FFCR: TrigIn Position */
  757. #define TPI_FFCR_TrigIn_Msk (0x1UL << TPI_FFCR_TrigIn_Pos) /*!< TPI FFCR: TrigIn Mask */
  758. #define TPI_FFCR_EnFCont_Pos 1 /*!< TPI FFCR: EnFCont Position */
  759. #define TPI_FFCR_EnFCont_Msk (0x1UL << TPI_FFCR_EnFCont_Pos) /*!< TPI FFCR: EnFCont Mask */
  760. /* TPI TRIGGER Register Definitions */
  761. #define TPI_TRIGGER_TRIGGER_Pos 0 /*!< TPI TRIGGER: TRIGGER Position */
  762. #define TPI_TRIGGER_TRIGGER_Msk (0x1UL /*<< TPI_TRIGGER_TRIGGER_Pos*/) /*!< TPI TRIGGER: TRIGGER Mask */
  763. /* TPI Integration ETM Data Register Definitions (FIFO0) */
  764. #define TPI_FIFO0_ITM_ATVALID_Pos 29 /*!< TPI FIFO0: ITM_ATVALID Position */
  765. #define TPI_FIFO0_ITM_ATVALID_Msk (0x3UL << TPI_FIFO0_ITM_ATVALID_Pos) /*!< TPI FIFO0: ITM_ATVALID Mask */
  766. #define TPI_FIFO0_ITM_bytecount_Pos 27 /*!< TPI FIFO0: ITM_bytecount Position */
  767. #define TPI_FIFO0_ITM_bytecount_Msk (0x3UL << TPI_FIFO0_ITM_bytecount_Pos) /*!< TPI FIFO0: ITM_bytecount Mask */
  768. #define TPI_FIFO0_ETM_ATVALID_Pos 26 /*!< TPI FIFO0: ETM_ATVALID Position */
  769. #define TPI_FIFO0_ETM_ATVALID_Msk (0x3UL << TPI_FIFO0_ETM_ATVALID_Pos) /*!< TPI FIFO0: ETM_ATVALID Mask */
  770. #define TPI_FIFO0_ETM_bytecount_Pos 24 /*!< TPI FIFO0: ETM_bytecount Position */
  771. #define TPI_FIFO0_ETM_bytecount_Msk (0x3UL << TPI_FIFO0_ETM_bytecount_Pos) /*!< TPI FIFO0: ETM_bytecount Mask */
  772. #define TPI_FIFO0_ETM2_Pos 16 /*!< TPI FIFO0: ETM2 Position */
  773. #define TPI_FIFO0_ETM2_Msk (0xFFUL << TPI_FIFO0_ETM2_Pos) /*!< TPI FIFO0: ETM2 Mask */
  774. #define TPI_FIFO0_ETM1_Pos 8 /*!< TPI FIFO0: ETM1 Position */
  775. #define TPI_FIFO0_ETM1_Msk (0xFFUL << TPI_FIFO0_ETM1_Pos) /*!< TPI FIFO0: ETM1 Mask */
  776. #define TPI_FIFO0_ETM0_Pos 0 /*!< TPI FIFO0: ETM0 Position */
  777. #define TPI_FIFO0_ETM0_Msk (0xFFUL /*<< TPI_FIFO0_ETM0_Pos*/) /*!< TPI FIFO0: ETM0 Mask */
  778. /* TPI ITATBCTR2 Register Definitions */
  779. #define TPI_ITATBCTR2_ATREADY_Pos 0 /*!< TPI ITATBCTR2: ATREADY Position */
  780. #define TPI_ITATBCTR2_ATREADY_Msk (0x1UL /*<< TPI_ITATBCTR2_ATREADY_Pos*/) /*!< TPI ITATBCTR2: ATREADY Mask */
  781. /* TPI Integration ITM Data Register Definitions (FIFO1) */
  782. #define TPI_FIFO1_ITM_ATVALID_Pos 29 /*!< TPI FIFO1: ITM_ATVALID Position */
  783. #define TPI_FIFO1_ITM_ATVALID_Msk (0x3UL << TPI_FIFO1_ITM_ATVALID_Pos) /*!< TPI FIFO1: ITM_ATVALID Mask */
  784. #define TPI_FIFO1_ITM_bytecount_Pos 27 /*!< TPI FIFO1: ITM_bytecount Position */
  785. #define TPI_FIFO1_ITM_bytecount_Msk (0x3UL << TPI_FIFO1_ITM_bytecount_Pos) /*!< TPI FIFO1: ITM_bytecount Mask */
  786. #define TPI_FIFO1_ETM_ATVALID_Pos 26 /*!< TPI FIFO1: ETM_ATVALID Position */
  787. #define TPI_FIFO1_ETM_ATVALID_Msk (0x3UL << TPI_FIFO1_ETM_ATVALID_Pos) /*!< TPI FIFO1: ETM_ATVALID Mask */
  788. #define TPI_FIFO1_ETM_bytecount_Pos 24 /*!< TPI FIFO1: ETM_bytecount Position */
  789. #define TPI_FIFO1_ETM_bytecount_Msk (0x3UL << TPI_FIFO1_ETM_bytecount_Pos) /*!< TPI FIFO1: ETM_bytecount Mask */
  790. #define TPI_FIFO1_ITM2_Pos 16 /*!< TPI FIFO1: ITM2 Position */
  791. #define TPI_FIFO1_ITM2_Msk (0xFFUL << TPI_FIFO1_ITM2_Pos) /*!< TPI FIFO1: ITM2 Mask */
  792. #define TPI_FIFO1_ITM1_Pos 8 /*!< TPI FIFO1: ITM1 Position */
  793. #define TPI_FIFO1_ITM1_Msk (0xFFUL << TPI_FIFO1_ITM1_Pos) /*!< TPI FIFO1: ITM1 Mask */
  794. #define TPI_FIFO1_ITM0_Pos 0 /*!< TPI FIFO1: ITM0 Position */
  795. #define TPI_FIFO1_ITM0_Msk (0xFFUL /*<< TPI_FIFO1_ITM0_Pos*/) /*!< TPI FIFO1: ITM0 Mask */
  796. /* TPI ITATBCTR0 Register Definitions */
  797. #define TPI_ITATBCTR0_ATREADY_Pos 0 /*!< TPI ITATBCTR0: ATREADY Position */
  798. #define TPI_ITATBCTR0_ATREADY_Msk (0x1UL /*<< TPI_ITATBCTR0_ATREADY_Pos*/) /*!< TPI ITATBCTR0: ATREADY Mask */
  799. /* TPI Integration Mode Control Register Definitions */
  800. #define TPI_ITCTRL_Mode_Pos 0 /*!< TPI ITCTRL: Mode Position */
  801. #define TPI_ITCTRL_Mode_Msk (0x1UL /*<< TPI_ITCTRL_Mode_Pos*/) /*!< TPI ITCTRL: Mode Mask */
  802. /* TPI DEVID Register Definitions */
  803. #define TPI_DEVID_NRZVALID_Pos 11 /*!< TPI DEVID: NRZVALID Position */
  804. #define TPI_DEVID_NRZVALID_Msk (0x1UL << TPI_DEVID_NRZVALID_Pos) /*!< TPI DEVID: NRZVALID Mask */
  805. #define TPI_DEVID_MANCVALID_Pos 10 /*!< TPI DEVID: MANCVALID Position */
  806. #define TPI_DEVID_MANCVALID_Msk (0x1UL << TPI_DEVID_MANCVALID_Pos) /*!< TPI DEVID: MANCVALID Mask */
  807. #define TPI_DEVID_PTINVALID_Pos 9 /*!< TPI DEVID: PTINVALID Position */
  808. #define TPI_DEVID_PTINVALID_Msk (0x1UL << TPI_DEVID_PTINVALID_Pos) /*!< TPI DEVID: PTINVALID Mask */
  809. #define TPI_DEVID_MinBufSz_Pos 6 /*!< TPI DEVID: MinBufSz Position */
  810. #define TPI_DEVID_MinBufSz_Msk (0x7UL << TPI_DEVID_MinBufSz_Pos) /*!< TPI DEVID: MinBufSz Mask */
  811. #define TPI_DEVID_AsynClkIn_Pos 5 /*!< TPI DEVID: AsynClkIn Position */
  812. #define TPI_DEVID_AsynClkIn_Msk (0x1UL << TPI_DEVID_AsynClkIn_Pos) /*!< TPI DEVID: AsynClkIn Mask */
  813. #define TPI_DEVID_NrTraceInput_Pos 0 /*!< TPI DEVID: NrTraceInput Position */
  814. #define TPI_DEVID_NrTraceInput_Msk (0x1FUL /*<< TPI_DEVID_NrTraceInput_Pos*/) /*!< TPI DEVID: NrTraceInput Mask */
  815. /* TPI DEVTYPE Register Definitions */
  816. #define TPI_DEVTYPE_MajorType_Pos 4 /*!< TPI DEVTYPE: MajorType Position */
  817. #define TPI_DEVTYPE_MajorType_Msk (0xFUL << TPI_DEVTYPE_MajorType_Pos) /*!< TPI DEVTYPE: MajorType Mask */
  818. #define TPI_DEVTYPE_SubType_Pos 0 /*!< TPI DEVTYPE: SubType Position */
  819. #define TPI_DEVTYPE_SubType_Msk (0xFUL /*<< TPI_DEVTYPE_SubType_Pos*/) /*!< TPI DEVTYPE: SubType Mask */
  820. /*@}*/ /* end of group CMSIS_TPI */
  821. #if (__MPU_PRESENT == 1)
  822. /** \ingroup CMSIS_core_register
  823. \defgroup CMSIS_MPU Memory Protection Unit (MPU)
  824. \brief Type definitions for the Memory Protection Unit (MPU)
  825. @{
  826. */
  827. /** \brief Structure type to access the Memory Protection Unit (MPU).
  828. */
  829. typedef struct
  830. {
  831. __I uint32_t TYPE; /*!< Offset: 0x000 (R/ ) MPU Type Register */
  832. __IO uint32_t CTRL; /*!< Offset: 0x004 (R/W) MPU Control Register */
  833. __IO uint32_t RNR; /*!< Offset: 0x008 (R/W) MPU Region RNRber Register */
  834. __IO uint32_t RBAR; /*!< Offset: 0x00C (R/W) MPU Region Base Address Register */
  835. __IO uint32_t RASR; /*!< Offset: 0x010 (R/W) MPU Region Attribute and Size Register */
  836. __IO uint32_t RBAR_A1; /*!< Offset: 0x014 (R/W) MPU Alias 1 Region Base Address Register */
  837. __IO uint32_t RASR_A1; /*!< Offset: 0x018 (R/W) MPU Alias 1 Region Attribute and Size Register */
  838. __IO uint32_t RBAR_A2; /*!< Offset: 0x01C (R/W) MPU Alias 2 Region Base Address Register */
  839. __IO uint32_t RASR_A2; /*!< Offset: 0x020 (R/W) MPU Alias 2 Region Attribute and Size Register */
  840. __IO uint32_t RBAR_A3; /*!< Offset: 0x024 (R/W) MPU Alias 3 Region Base Address Register */
  841. __IO uint32_t RASR_A3; /*!< Offset: 0x028 (R/W) MPU Alias 3 Region Attribute and Size Register */
  842. } MPU_Type;
  843. /* MPU Type Register */
  844. #define MPU_TYPE_IREGION_Pos 16 /*!< MPU TYPE: IREGION Position */
  845. #define MPU_TYPE_IREGION_Msk (0xFFUL << MPU_TYPE_IREGION_Pos) /*!< MPU TYPE: IREGION Mask */
  846. #define MPU_TYPE_DREGION_Pos 8 /*!< MPU TYPE: DREGION Position */
  847. #define MPU_TYPE_DREGION_Msk (0xFFUL << MPU_TYPE_DREGION_Pos) /*!< MPU TYPE: DREGION Mask */
  848. #define MPU_TYPE_SEPARATE_Pos 0 /*!< MPU TYPE: SEPARATE Position */
  849. #define MPU_TYPE_SEPARATE_Msk (1UL /*<< MPU_TYPE_SEPARATE_Pos*/) /*!< MPU TYPE: SEPARATE Mask */
  850. /* MPU Control Register */
  851. #define MPU_CTRL_PRIVDEFENA_Pos 2 /*!< MPU CTRL: PRIVDEFENA Position */
  852. #define MPU_CTRL_PRIVDEFENA_Msk (1UL << MPU_CTRL_PRIVDEFENA_Pos) /*!< MPU CTRL: PRIVDEFENA Mask */
  853. #define MPU_CTRL_HFNMIENA_Pos 1 /*!< MPU CTRL: HFNMIENA Position */
  854. #define MPU_CTRL_HFNMIENA_Msk (1UL << MPU_CTRL_HFNMIENA_Pos) /*!< MPU CTRL: HFNMIENA Mask */
  855. #define MPU_CTRL_ENABLE_Pos 0 /*!< MPU CTRL: ENABLE Position */
  856. #define MPU_CTRL_ENABLE_Msk (1UL /*<< MPU_CTRL_ENABLE_Pos*/) /*!< MPU CTRL: ENABLE Mask */
  857. /* MPU Region Number Register */
  858. #define MPU_RNR_REGION_Pos 0 /*!< MPU RNR: REGION Position */
  859. #define MPU_RNR_REGION_Msk (0xFFUL /*<< MPU_RNR_REGION_Pos*/) /*!< MPU RNR: REGION Mask */
  860. /* MPU Region Base Address Register */
  861. #define MPU_RBAR_ADDR_Pos 5 /*!< MPU RBAR: ADDR Position */
  862. #define MPU_RBAR_ADDR_Msk (0x7FFFFFFUL << MPU_RBAR_ADDR_Pos) /*!< MPU RBAR: ADDR Mask */
  863. #define MPU_RBAR_VALID_Pos 4 /*!< MPU RBAR: VALID Position */
  864. #define MPU_RBAR_VALID_Msk (1UL << MPU_RBAR_VALID_Pos) /*!< MPU RBAR: VALID Mask */
  865. #define MPU_RBAR_REGION_Pos 0 /*!< MPU RBAR: REGION Position */
  866. #define MPU_RBAR_REGION_Msk (0xFUL /*<< MPU_RBAR_REGION_Pos*/) /*!< MPU RBAR: REGION Mask */
  867. /* MPU Region Attribute and Size Register */
  868. #define MPU_RASR_ATTRS_Pos 16 /*!< MPU RASR: MPU Region Attribute field Position */
  869. #define MPU_RASR_ATTRS_Msk (0xFFFFUL << MPU_RASR_ATTRS_Pos) /*!< MPU RASR: MPU Region Attribute field Mask */
  870. #define MPU_RASR_XN_Pos 28 /*!< MPU RASR: ATTRS.XN Position */
  871. #define MPU_RASR_XN_Msk (1UL << MPU_RASR_XN_Pos) /*!< MPU RASR: ATTRS.XN Mask */
  872. #define MPU_RASR_AP_Pos 24 /*!< MPU RASR: ATTRS.AP Position */
  873. #define MPU_RASR_AP_Msk (0x7UL << MPU_RASR_AP_Pos) /*!< MPU RASR: ATTRS.AP Mask */
  874. #define MPU_RASR_TEX_Pos 19 /*!< MPU RASR: ATTRS.TEX Position */
  875. #define MPU_RASR_TEX_Msk (0x7UL << MPU_RASR_TEX_Pos) /*!< MPU RASR: ATTRS.TEX Mask */
  876. #define MPU_RASR_S_Pos 18 /*!< MPU RASR: ATTRS.S Position */
  877. #define MPU_RASR_S_Msk (1UL << MPU_RASR_S_Pos) /*!< MPU RASR: ATTRS.S Mask */
  878. #define MPU_RASR_C_Pos 17 /*!< MPU RASR: ATTRS.C Position */
  879. #define MPU_RASR_C_Msk (1UL << MPU_RASR_C_Pos) /*!< MPU RASR: ATTRS.C Mask */
  880. #define MPU_RASR_B_Pos 16 /*!< MPU RASR: ATTRS.B Position */
  881. #define MPU_RASR_B_Msk (1UL << MPU_RASR_B_Pos) /*!< MPU RASR: ATTRS.B Mask */
  882. #define MPU_RASR_SRD_Pos 8 /*!< MPU RASR: Sub-Region Disable Position */
  883. #define MPU_RASR_SRD_Msk (0xFFUL << MPU_RASR_SRD_Pos) /*!< MPU RASR: Sub-Region Disable Mask */
  884. #define MPU_RASR_SIZE_Pos 1 /*!< MPU RASR: Region Size Field Position */
  885. #define MPU_RASR_SIZE_Msk (0x1FUL << MPU_RASR_SIZE_Pos) /*!< MPU RASR: Region Size Field Mask */
  886. #define MPU_RASR_ENABLE_Pos 0 /*!< MPU RASR: Region enable bit Position */
  887. #define MPU_RASR_ENABLE_Msk (1UL /*<< MPU_RASR_ENABLE_Pos*/) /*!< MPU RASR: Region enable bit Disable Mask */
  888. /*@} end of group CMSIS_MPU */
  889. #endif
  890. /** \ingroup CMSIS_core_register
  891. \defgroup CMSIS_CoreDebug Core Debug Registers (CoreDebug)
  892. \brief Type definitions for the Core Debug Registers
  893. @{
  894. */
  895. /** \brief Structure type to access the Core Debug Register (CoreDebug).
  896. */
  897. typedef struct
  898. {
  899. __IO uint32_t DHCSR; /*!< Offset: 0x000 (R/W) Debug Halting Control and Status Register */
  900. __O uint32_t DCRSR; /*!< Offset: 0x004 ( /W) Debug Core Register Selector Register */
  901. __IO uint32_t DCRDR; /*!< Offset: 0x008 (R/W) Debug Core Register Data Register */
  902. __IO uint32_t DEMCR; /*!< Offset: 0x00C (R/W) Debug Exception and Monitor Control Register */
  903. } CoreDebug_Type;
  904. /* Debug Halting Control and Status Register */
  905. #define CoreDebug_DHCSR_DBGKEY_Pos 16 /*!< CoreDebug DHCSR: DBGKEY Position */
  906. #define CoreDebug_DHCSR_DBGKEY_Msk (0xFFFFUL << CoreDebug_DHCSR_DBGKEY_Pos) /*!< CoreDebug DHCSR: DBGKEY Mask */
  907. #define CoreDebug_DHCSR_S_RESET_ST_Pos 25 /*!< CoreDebug DHCSR: S_RESET_ST Position */
  908. #define CoreDebug_DHCSR_S_RESET_ST_Msk (1UL << CoreDebug_DHCSR_S_RESET_ST_Pos) /*!< CoreDebug DHCSR: S_RESET_ST Mask */
  909. #define CoreDebug_DHCSR_S_RETIRE_ST_Pos 24 /*!< CoreDebug DHCSR: S_RETIRE_ST Position */
  910. #define CoreDebug_DHCSR_S_RETIRE_ST_Msk (1UL << CoreDebug_DHCSR_S_RETIRE_ST_Pos) /*!< CoreDebug DHCSR: S_RETIRE_ST Mask */
  911. #define CoreDebug_DHCSR_S_LOCKUP_Pos 19 /*!< CoreDebug DHCSR: S_LOCKUP Position */
  912. #define CoreDebug_DHCSR_S_LOCKUP_Msk (1UL << CoreDebug_DHCSR_S_LOCKUP_Pos) /*!< CoreDebug DHCSR: S_LOCKUP Mask */
  913. #define CoreDebug_DHCSR_S_SLEEP_Pos 18 /*!< CoreDebug DHCSR: S_SLEEP Position */
  914. #define CoreDebug_DHCSR_S_SLEEP_Msk (1UL << CoreDebug_DHCSR_S_SLEEP_Pos) /*!< CoreDebug DHCSR: S_SLEEP Mask */
  915. #define CoreDebug_DHCSR_S_HALT_Pos 17 /*!< CoreDebug DHCSR: S_HALT Position */
  916. #define CoreDebug_DHCSR_S_HALT_Msk (1UL << CoreDebug_DHCSR_S_HALT_Pos) /*!< CoreDebug DHCSR: S_HALT Mask */
  917. #define CoreDebug_DHCSR_S_REGRDY_Pos 16 /*!< CoreDebug DHCSR: S_REGRDY Position */
  918. #define CoreDebug_DHCSR_S_REGRDY_Msk (1UL << CoreDebug_DHCSR_S_REGRDY_Pos) /*!< CoreDebug DHCSR: S_REGRDY Mask */
  919. #define CoreDebug_DHCSR_C_SNAPSTALL_Pos 5 /*!< CoreDebug DHCSR: C_SNAPSTALL Position */
  920. #define CoreDebug_DHCSR_C_SNAPSTALL_Msk (1UL << CoreDebug_DHCSR_C_SNAPSTALL_Pos) /*!< CoreDebug DHCSR: C_SNAPSTALL Mask */
  921. #define CoreDebug_DHCSR_C_MASKINTS_Pos 3 /*!< CoreDebug DHCSR: C_MASKINTS Position */
  922. #define CoreDebug_DHCSR_C_MASKINTS_Msk (1UL << CoreDebug_DHCSR_C_MASKINTS_Pos) /*!< CoreDebug DHCSR: C_MASKINTS Mask */
  923. #define CoreDebug_DHCSR_C_STEP_Pos 2 /*!< CoreDebug DHCSR: C_STEP Position */
  924. #define CoreDebug_DHCSR_C_STEP_Msk (1UL << CoreDebug_DHCSR_C_STEP_Pos) /*!< CoreDebug DHCSR: C_STEP Mask */
  925. #define CoreDebug_DHCSR_C_HALT_Pos 1 /*!< CoreDebug DHCSR: C_HALT Position */
  926. #define CoreDebug_DHCSR_C_HALT_Msk (1UL << CoreDebug_DHCSR_C_HALT_Pos) /*!< CoreDebug DHCSR: C_HALT Mask */
  927. #define CoreDebug_DHCSR_C_DEBUGEN_Pos 0 /*!< CoreDebug DHCSR: C_DEBUGEN Position */
  928. #define CoreDebug_DHCSR_C_DEBUGEN_Msk (1UL /*<< CoreDebug_DHCSR_C_DEBUGEN_Pos*/) /*!< CoreDebug DHCSR: C_DEBUGEN Mask */
  929. /* Debug Core Register Selector Register */
  930. #define CoreDebug_DCRSR_REGWnR_Pos 16 /*!< CoreDebug DCRSR: REGWnR Position */
  931. #define CoreDebug_DCRSR_REGWnR_Msk (1UL << CoreDebug_DCRSR_REGWnR_Pos) /*!< CoreDebug DCRSR: REGWnR Mask */
  932. #define CoreDebug_DCRSR_REGSEL_Pos 0 /*!< CoreDebug DCRSR: REGSEL Position */
  933. #define CoreDebug_DCRSR_REGSEL_Msk (0x1FUL /*<< CoreDebug_DCRSR_REGSEL_Pos*/) /*!< CoreDebug DCRSR: REGSEL Mask */
  934. /* Debug Exception and Monitor Control Register */
  935. #define CoreDebug_DEMCR_TRCENA_Pos 24 /*!< CoreDebug DEMCR: TRCENA Position */
  936. #define CoreDebug_DEMCR_TRCENA_Msk (1UL << CoreDebug_DEMCR_TRCENA_Pos) /*!< CoreDebug DEMCR: TRCENA Mask */
  937. #define CoreDebug_DEMCR_MON_REQ_Pos 19 /*!< CoreDebug DEMCR: MON_REQ Position */
  938. #define CoreDebug_DEMCR_MON_REQ_Msk (1UL << CoreDebug_DEMCR_MON_REQ_Pos) /*!< CoreDebug DEMCR: MON_REQ Mask */
  939. #define CoreDebug_DEMCR_MON_STEP_Pos 18 /*!< CoreDebug DEMCR: MON_STEP Position */
  940. #define CoreDebug_DEMCR_MON_STEP_Msk (1UL << CoreDebug_DEMCR_MON_STEP_Pos) /*!< CoreDebug DEMCR: MON_STEP Mask */
  941. #define CoreDebug_DEMCR_MON_PEND_Pos 17 /*!< CoreDebug DEMCR: MON_PEND Position */
  942. #define CoreDebug_DEMCR_MON_PEND_Msk (1UL << CoreDebug_DEMCR_MON_PEND_Pos) /*!< CoreDebug DEMCR: MON_PEND Mask */
  943. #define CoreDebug_DEMCR_MON_EN_Pos 16 /*!< CoreDebug DEMCR: MON_EN Position */
  944. #define CoreDebug_DEMCR_MON_EN_Msk (1UL << CoreDebug_DEMCR_MON_EN_Pos) /*!< CoreDebug DEMCR: MON_EN Mask */
  945. #define CoreDebug_DEMCR_VC_HARDERR_Pos 10 /*!< CoreDebug DEMCR: VC_HARDERR Position */
  946. #define CoreDebug_DEMCR_VC_HARDERR_Msk (1UL << CoreDebug_DEMCR_VC_HARDERR_Pos) /*!< CoreDebug DEMCR: VC_HARDERR Mask */
  947. #define CoreDebug_DEMCR_VC_INTERR_Pos 9 /*!< CoreDebug DEMCR: VC_INTERR Position */
  948. #define CoreDebug_DEMCR_VC_INTERR_Msk (1UL << CoreDebug_DEMCR_VC_INTERR_Pos) /*!< CoreDebug DEMCR: VC_INTERR Mask */
  949. #define CoreDebug_DEMCR_VC_BUSERR_Pos 8 /*!< CoreDebug DEMCR: VC_BUSERR Position */
  950. #define CoreDebug_DEMCR_VC_BUSERR_Msk (1UL << CoreDebug_DEMCR_VC_BUSERR_Pos) /*!< CoreDebug DEMCR: VC_BUSERR Mask */
  951. #define CoreDebug_DEMCR_VC_STATERR_Pos 7 /*!< CoreDebug DEMCR: VC_STATERR Position */
  952. #define CoreDebug_DEMCR_VC_STATERR_Msk (1UL << CoreDebug_DEMCR_VC_STATERR_Pos) /*!< CoreDebug DEMCR: VC_STATERR Mask */
  953. #define CoreDebug_DEMCR_VC_CHKERR_Pos 6 /*!< CoreDebug DEMCR: VC_CHKERR Position */
  954. #define CoreDebug_DEMCR_VC_CHKERR_Msk (1UL << CoreDebug_DEMCR_VC_CHKERR_Pos) /*!< CoreDebug DEMCR: VC_CHKERR Mask */
  955. #define CoreDebug_DEMCR_VC_NOCPERR_Pos 5 /*!< CoreDebug DEMCR: VC_NOCPERR Position */
  956. #define CoreDebug_DEMCR_VC_NOCPERR_Msk (1UL << CoreDebug_DEMCR_VC_NOCPERR_Pos) /*!< CoreDebug DEMCR: VC_NOCPERR Mask */
  957. #define CoreDebug_DEMCR_VC_MMERR_Pos 4 /*!< CoreDebug DEMCR: VC_MMERR Position */
  958. #define CoreDebug_DEMCR_VC_MMERR_Msk (1UL << CoreDebug_DEMCR_VC_MMERR_Pos) /*!< CoreDebug DEMCR: VC_MMERR Mask */
  959. #define CoreDebug_DEMCR_VC_CORERESET_Pos 0 /*!< CoreDebug DEMCR: VC_CORERESET Position */
  960. #define CoreDebug_DEMCR_VC_CORERESET_Msk (1UL /*<< CoreDebug_DEMCR_VC_CORERESET_Pos*/) /*!< CoreDebug DEMCR: VC_CORERESET Mask */
  961. /*@} end of group CMSIS_CoreDebug */
  962. /** \ingroup CMSIS_core_register
  963. \defgroup CMSIS_core_base Core Definitions
  964. \brief Definitions for base addresses, unions, and structures.
  965. @{
  966. */
  967. /* Memory mapping of Cortex-M3 Hardware */
  968. #define SCS_BASE (0xE000E000UL) /*!< System Control Space Base Address */
  969. #define ITM_BASE (0xE0000000UL) /*!< ITM Base Address */
  970. #define DWT_BASE (0xE0001000UL) /*!< DWT Base Address */
  971. #define TPI_BASE (0xE0040000UL) /*!< TPI Base Address */
  972. #define CoreDebug_BASE (0xE000EDF0UL) /*!< Core Debug Base Address */
  973. #define SysTick_BASE (SCS_BASE + 0x0010UL) /*!< SysTick Base Address */
  974. #define NVIC_BASE (SCS_BASE + 0x0100UL) /*!< NVIC Base Address */
  975. #define SCB_BASE (SCS_BASE + 0x0D00UL) /*!< System Control Block Base Address */
  976. #define SCnSCB ((SCnSCB_Type *) SCS_BASE ) /*!< System control Register not in SCB */
  977. #define SCB ((SCB_Type *) SCB_BASE ) /*!< SCB configuration struct */
  978. #define SysTick ((SysTick_Type *) SysTick_BASE ) /*!< SysTick configuration struct */
  979. #define NVIC ((NVIC_Type *) NVIC_BASE ) /*!< NVIC configuration struct */
  980. #define ITM ((ITM_Type *) ITM_BASE ) /*!< ITM configuration struct */
  981. #define DWT ((DWT_Type *) DWT_BASE ) /*!< DWT configuration struct */
  982. #define TPI ((TPI_Type *) TPI_BASE ) /*!< TPI configuration struct */
  983. #define CoreDebug ((CoreDebug_Type *) CoreDebug_BASE) /*!< Core Debug configuration struct */
  984. #if (__MPU_PRESENT == 1)
  985. #define MPU_BASE (SCS_BASE + 0x0D90UL) /*!< Memory Protection Unit */
  986. #define MPU ((MPU_Type *) MPU_BASE ) /*!< Memory Protection Unit */
  987. #endif
  988. /*@} */
  989. /*******************************************************************************
  990. * Hardware Abstraction Layer
  991. Core Function Interface contains:
  992. - Core NVIC Functions
  993. - Core SysTick Functions
  994. - Core Debug Functions
  995. - Core Register Access Functions
  996. ******************************************************************************/
  997. /** \defgroup CMSIS_Core_FunctionInterface Functions and Instructions Reference
  998. */
  999. /* ########################## NVIC functions #################################### */
  1000. /** \ingroup CMSIS_Core_FunctionInterface
  1001. \defgroup CMSIS_Core_NVICFunctions NVIC Functions
  1002. \brief Functions that manage interrupts and exceptions via the NVIC.
  1003. @{
  1004. */
  1005. /** \brief Set Priority Grouping
  1006. The function sets the priority grouping field using the required unlock sequence.
  1007. The parameter PriorityGroup is assigned to the field SCB->AIRCR [10:8] PRIGROUP field.
  1008. Only values from 0..7 are used.
  1009. In case of a conflict between priority grouping and available
  1010. priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set.
  1011. \param [in] PriorityGroup Priority grouping field.
  1012. */
  1013. __STATIC_INLINE void NVIC_SetPriorityGrouping(uint32_t PriorityGroup)
  1014. {
  1015. uint32_t reg_value;
  1016. uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */
  1017. reg_value = SCB->AIRCR; /* read old register configuration */
  1018. reg_value &= ~((uint32_t)(SCB_AIRCR_VECTKEY_Msk | SCB_AIRCR_PRIGROUP_Msk)); /* clear bits to change */
  1019. reg_value = (reg_value |
  1020. ((uint32_t)0x5FAUL << SCB_AIRCR_VECTKEY_Pos) |
  1021. (PriorityGroupTmp << 8) ); /* Insert write key and priorty group */
  1022. SCB->AIRCR = reg_value;
  1023. }
  1024. /** \brief Get Priority Grouping
  1025. The function reads the priority grouping field from the NVIC Interrupt Controller.
  1026. \return Priority grouping field (SCB->AIRCR [10:8] PRIGROUP field).
  1027. */
  1028. __STATIC_INLINE uint32_t NVIC_GetPriorityGrouping(void)
  1029. {
  1030. return ((uint32_t)((SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) >> SCB_AIRCR_PRIGROUP_Pos));
  1031. }
  1032. /** \brief Enable External Interrupt
  1033. The function enables a device-specific interrupt in the NVIC interrupt controller.
  1034. \param [in] IRQn External interrupt number. Value cannot be negative.
  1035. */
  1036. __STATIC_INLINE void NVIC_EnableIRQ(IRQn_Type IRQn)
  1037. {
  1038. NVIC->ISER[(((uint32_t)(int32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL));
  1039. }
  1040. /** \brief Disable External Interrupt
  1041. The function disables a device-specific interrupt in the NVIC interrupt controller.
  1042. \param [in] IRQn External interrupt number. Value cannot be negative.
  1043. */
  1044. __STATIC_INLINE void NVIC_DisableIRQ(IRQn_Type IRQn)
  1045. {
  1046. NVIC->ICER[(((uint32_t)(int32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL));
  1047. }
  1048. /** \brief Get Pending Interrupt
  1049. The function reads the pending register in the NVIC and returns the pending bit
  1050. for the specified interrupt.
  1051. \param [in] IRQn Interrupt number.
  1052. \return 0 Interrupt status is not pending.
  1053. \return 1 Interrupt status is pending.
  1054. */
  1055. __STATIC_INLINE uint32_t NVIC_GetPendingIRQ(IRQn_Type IRQn)
  1056. {
  1057. return((uint32_t)(((NVIC->ISPR[(((uint32_t)(int32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
  1058. }
  1059. /** \brief Set Pending Interrupt
  1060. The function sets the pending bit of an external interrupt.
  1061. \param [in] IRQn Interrupt number. Value cannot be negative.
  1062. */
  1063. __STATIC_INLINE void NVIC_SetPendingIRQ(IRQn_Type IRQn)
  1064. {
  1065. NVIC->ISPR[(((uint32_t)(int32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL));
  1066. }
  1067. /** \brief Clear Pending Interrupt
  1068. The function clears the pending bit of an external interrupt.
  1069. \param [in] IRQn External interrupt number. Value cannot be negative.
  1070. */
  1071. __STATIC_INLINE void NVIC_ClearPendingIRQ(IRQn_Type IRQn)
  1072. {
  1073. NVIC->ICPR[(((uint32_t)(int32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL));
  1074. }
  1075. /** \brief Get Active Interrupt
  1076. The function reads the active register in NVIC and returns the active bit.
  1077. \param [in] IRQn Interrupt number.
  1078. \return 0 Interrupt status is not active.
  1079. \return 1 Interrupt status is active.
  1080. */
  1081. __STATIC_INLINE uint32_t NVIC_GetActive(IRQn_Type IRQn)
  1082. {
  1083. return((uint32_t)(((NVIC->IABR[(((uint32_t)(int32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
  1084. }
  1085. /** \brief Set Interrupt Priority
  1086. The function sets the priority of an interrupt.
  1087. \note The priority cannot be set for every core interrupt.
  1088. \param [in] IRQn Interrupt number.
  1089. \param [in] priority Priority to set.
  1090. */
  1091. __STATIC_INLINE void NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority)
  1092. {
  1093. if((int32_t)IRQn < 0) {
  1094. SCB->SHP[(((uint32_t)(int32_t)IRQn) & 0xFUL)-4UL] = (uint8_t)((priority << (8 - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL);
  1095. }
  1096. else {
  1097. NVIC->IP[((uint32_t)(int32_t)IRQn)] = (uint8_t)((priority << (8 - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL);
  1098. }
  1099. }
  1100. /** \brief Get Interrupt Priority
  1101. The function reads the priority of an interrupt. The interrupt
  1102. number can be positive to specify an external (device specific)
  1103. interrupt, or negative to specify an internal (core) interrupt.
  1104. \param [in] IRQn Interrupt number.
  1105. \return Interrupt Priority. Value is aligned automatically to the implemented
  1106. priority bits of the microcontroller.
  1107. */
  1108. __STATIC_INLINE uint32_t NVIC_GetPriority(IRQn_Type IRQn)
  1109. {
  1110. if((int32_t)IRQn < 0) {
  1111. return(((uint32_t)SCB->SHP[(((uint32_t)(int32_t)IRQn) & 0xFUL)-4UL] >> (8 - __NVIC_PRIO_BITS)));
  1112. }
  1113. else {
  1114. return(((uint32_t)NVIC->IP[((uint32_t)(int32_t)IRQn)] >> (8 - __NVIC_PRIO_BITS)));
  1115. }
  1116. }
  1117. /** \brief Encode Priority
  1118. The function encodes the priority for an interrupt with the given priority group,
  1119. preemptive priority value, and subpriority value.
  1120. In case of a conflict between priority grouping and available
  1121. priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set.
  1122. \param [in] PriorityGroup Used priority group.
  1123. \param [in] PreemptPriority Preemptive priority value (starting from 0).
  1124. \param [in] SubPriority Subpriority value (starting from 0).
  1125. \return Encoded priority. Value can be used in the function \ref NVIC_SetPriority().
  1126. */
  1127. __STATIC_INLINE uint32_t NVIC_EncodePriority (uint32_t PriorityGroup, uint32_t PreemptPriority, uint32_t SubPriority)
  1128. {
  1129. uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */
  1130. uint32_t PreemptPriorityBits;
  1131. uint32_t SubPriorityBits;
  1132. PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp);
  1133. SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS));
  1134. return (
  1135. ((PreemptPriority & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL)) << SubPriorityBits) |
  1136. ((SubPriority & (uint32_t)((1UL << (SubPriorityBits )) - 1UL)))
  1137. );
  1138. }
  1139. /** \brief Decode Priority
  1140. The function decodes an interrupt priority value with a given priority group to
  1141. preemptive priority value and subpriority value.
  1142. In case of a conflict between priority grouping and available
  1143. priority bits (__NVIC_PRIO_BITS) the smallest possible priority group is set.
  1144. \param [in] Priority Priority value, which can be retrieved with the function \ref NVIC_GetPriority().
  1145. \param [in] PriorityGroup Used priority group.
  1146. \param [out] pPreemptPriority Preemptive priority value (starting from 0).
  1147. \param [out] pSubPriority Subpriority value (starting from 0).
  1148. */
  1149. __STATIC_INLINE void NVIC_DecodePriority (uint32_t Priority, uint32_t PriorityGroup, uint32_t* pPreemptPriority, uint32_t* pSubPriority)
  1150. {
  1151. uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */
  1152. uint32_t PreemptPriorityBits;
  1153. uint32_t SubPriorityBits;
  1154. PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp);
  1155. SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS));
  1156. *pPreemptPriority = (Priority >> SubPriorityBits) & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL);
  1157. *pSubPriority = (Priority ) & (uint32_t)((1UL << (SubPriorityBits )) - 1UL);
  1158. }
  1159. /** \brief System Reset
  1160. The function initiates a system reset request to reset the MCU.
  1161. */
  1162. __STATIC_INLINE void NVIC_SystemReset(void)
  1163. {
  1164. __DSB(); /* Ensure all outstanding memory accesses included
  1165. buffered write are completed before reset */
  1166. SCB->AIRCR = (uint32_t)((0x5FAUL << SCB_AIRCR_VECTKEY_Pos) |
  1167. (SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) |
  1168. SCB_AIRCR_SYSRESETREQ_Msk ); /* Keep priority group unchanged */
  1169. __DSB(); /* Ensure completion of memory access */
  1170. while(1) { __NOP(); } /* wait until reset */
  1171. }
  1172. /*@} end of CMSIS_Core_NVICFunctions */
  1173. /* ################################## SysTick function ############################################ */
  1174. /** \ingroup CMSIS_Core_FunctionInterface
  1175. \defgroup CMSIS_Core_SysTickFunctions SysTick Functions
  1176. \brief Functions that configure the System.
  1177. @{
  1178. */
  1179. #if (__Vendor_SysTickConfig == 0)
  1180. /** \brief System Tick Configuration
  1181. The function initializes the System Timer and its interrupt, and starts the System Tick Timer.
  1182. Counter is in free running mode to generate periodic interrupts.
  1183. \param [in] ticks Number of ticks between two interrupts.
  1184. \return 0 Function succeeded.
  1185. \return 1 Function failed.
  1186. \note When the variable <b>__Vendor_SysTickConfig</b> is set to 1, then the
  1187. function <b>SysTick_Config</b> is not included. In this case, the file <b><i>device</i>.h</b>
  1188. must contain a vendor-specific implementation of this function.
  1189. */
  1190. __STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks)
  1191. {
  1192. if ((ticks - 1UL) > SysTick_LOAD_RELOAD_Msk) { return (1UL); } /* Reload value impossible */
  1193. SysTick->LOAD = (uint32_t)(ticks - 1UL); /* set reload register */
  1194. NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */
  1195. SysTick->VAL = 0UL; /* Load the SysTick Counter Value */
  1196. SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk |
  1197. SysTick_CTRL_TICKINT_Msk |
  1198. SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */
  1199. return (0UL); /* Function successful */
  1200. }
  1201. #endif
  1202. /*@} end of CMSIS_Core_SysTickFunctions */
  1203. /* ##################################### Debug In/Output function ########################################### */
  1204. /** \ingroup CMSIS_Core_FunctionInterface
  1205. \defgroup CMSIS_core_DebugFunctions ITM Functions
  1206. \brief Functions that access the ITM debug interface.
  1207. @{
  1208. */
  1209. extern volatile int32_t ITM_RxBuffer; /*!< External variable to receive characters. */
  1210. #define ITM_RXBUFFER_EMPTY 0x5AA55AA5 /*!< Value identifying \ref ITM_RxBuffer is ready for next character. */
  1211. /** \brief ITM Send Character
  1212. The function transmits a character via the ITM channel 0, and
  1213. \li Just returns when no debugger is connected that has booked the output.
  1214. \li Is blocking when a debugger is connected, but the previous character sent has not been transmitted.
  1215. \param [in] ch Character to transmit.
  1216. \returns Character to transmit.
  1217. */
  1218. __STATIC_INLINE uint32_t ITM_SendChar (uint32_t ch)
  1219. {
  1220. if (((ITM->TCR & ITM_TCR_ITMENA_Msk) != 0UL) && /* ITM enabled */
  1221. ((ITM->TER & 1UL ) != 0UL) ) /* ITM Port #0 enabled */
  1222. {
  1223. while (ITM->PORT[0].u32 == 0UL) { __NOP(); }
  1224. ITM->PORT[0].u8 = (uint8_t)ch;
  1225. }
  1226. return (ch);
  1227. }
  1228. /** \brief ITM Receive Character
  1229. The function inputs a character via the external variable \ref ITM_RxBuffer.
  1230. \return Received character.
  1231. \return -1 No character pending.
  1232. */
  1233. __STATIC_INLINE int32_t ITM_ReceiveChar (void) {
  1234. int32_t ch = -1; /* no character available */
  1235. if (ITM_RxBuffer != ITM_RXBUFFER_EMPTY) {
  1236. ch = ITM_RxBuffer;
  1237. ITM_RxBuffer = ITM_RXBUFFER_EMPTY; /* ready for next character */
  1238. }
  1239. return (ch);
  1240. }
  1241. /** \brief ITM Check Character
  1242. The function checks whether a character is pending for reading in the variable \ref ITM_RxBuffer.
  1243. \return 0 No character available.
  1244. \return 1 Character available.
  1245. */
  1246. __STATIC_INLINE int32_t ITM_CheckChar (void) {
  1247. if (ITM_RxBuffer == ITM_RXBUFFER_EMPTY) {
  1248. return (0); /* no character available */
  1249. } else {
  1250. return (1); /* character available */
  1251. }
  1252. }
  1253. /*@} end of CMSIS_core_DebugFunctions */
  1254. #ifdef __cplusplus
  1255. }
  1256. #endif
  1257. #endif /* __CORE_SC300_H_DEPENDANT */
  1258. #endif /* __CMSIS_GENERIC */