]> begriffs open source - cmsis/blob - CMSIS/Core/Include/core_armv8mbl.h
Merge pull request #34 from GuentherMartin/uVisor_M4
[cmsis] / CMSIS / Core / Include / core_armv8mbl.h
1 /**************************************************************************//**\r
2  * @file     core_armv8mbl.h\r
3  * @brief    CMSIS ARMv8MBL Core Peripheral Access Layer Header File\r
4  * @version  V5.00\r
5  * @date     30. March 2016\r
6  ******************************************************************************/\r
7 /*\r
8  * Copyright (c) 2009-2016 ARM Limited. All rights reserved.\r
9  *\r
10  * SPDX-License-Identifier: Apache-2.0\r
11  *\r
12  * Licensed under the Apache License, Version 2.0 (the License); you may\r
13  * not use this file except in compliance with the License.\r
14  * You may obtain a copy of the License at\r
15  *\r
16  * http://www.apache.org/licenses/LICENSE-2.0\r
17  *\r
18  * Unless required by applicable law or agreed to in writing, software\r
19  * distributed under the License is distributed on an AS IS BASIS, WITHOUT\r
20  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
21  * See the License for the specific language governing permissions and\r
22  * limitations under the License.\r
23  */\r
24 \r
25 #if   defined ( __ICCARM__ )\r
26  #pragma system_include         /* treat file as system include file for MISRA check */\r
27 #elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)\r
28   #pragma clang system_header   /* treat file as system include file */\r
29 #endif\r
30 \r
31 #ifndef __CORE_ARMV8MBL_H_GENERIC\r
32 #define __CORE_ARMV8MBL_H_GENERIC\r
33 \r
34 #include <stdint.h>\r
35 \r
36 #ifdef __cplusplus\r
37  extern "C" {\r
38 #endif\r
39 \r
40 /**\r
41   \page CMSIS_MISRA_Exceptions  MISRA-C:2004 Compliance Exceptions\r
42   CMSIS violates the following MISRA-C:2004 rules:\r
43 \r
44    \li Required Rule 8.5, object/function definition in header file.<br>\r
45      Function definitions in header files are used to allow 'inlining'.\r
46 \r
47    \li Required Rule 18.4, declaration of union type or object of union type: '{...}'.<br>\r
48      Unions are used for effective representation of core registers.\r
49 \r
50    \li Advisory Rule 19.7, Function-like macro defined.<br>\r
51      Function-like macros are used to allow more efficient code.\r
52  */\r
53 \r
54 \r
55 /*******************************************************************************\r
56  *                 CMSIS definitions\r
57  ******************************************************************************/\r
58 /**\r
59   \ingroup Cortex_ARMv8MBL\r
60   @{\r
61  */\r
62 \r
63 /*  CMSIS cmGrebe definitions */\r
64 #define __ARMv8MBL_CMSIS_VERSION_MAIN  ( 5U)                                       /*!< [31:16] CMSIS HAL main version */\r
65 #define __ARMv8MBL_CMSIS_VERSION_SUB   ( 0U)                                       /*!< [15:0]  CMSIS HAL sub version */\r
66 #define __ARMv8MBL_CMSIS_VERSION       ((__ARMv8MBL_CMSIS_VERSION_MAIN << 16U) | \\r
67                                          __ARMv8MBL_CMSIS_VERSION_SUB           )  /*!< CMSIS HAL version number */\r
68 \r
69 #define __CORTEX_M                     ( 2U)                                            /*!< Cortex-M Core */\r
70 \r
71 /* Common defines in core_*.h files\r
72   - #define __ASM               Compiler keyword for asm\r
73   - #define __INLINE            Compiler keyword for inline\r
74   - #define __STATIC_INLINE     Compiler keyword for static inline\r
75   - #define __NO_RETURN         function that never returns\r
76   - #define __USED              function or variable that is not optimized away\r
77   - #define __WEAK              weak function or variable\r
78   - #define __UNALIGNED_UINT32  pointer to unaligned uint32_t variable\r
79  */\r
80 #if   defined ( __CC_ARM )                                            /* ARM Compiler 4/5 */\r
81   #define __ASM                     __asm\r
82   #define __INLINE                  __inline\r
83   #define __STATIC_INLINE           static __inline\r
84   #define __NO_RETURN               __declspec(noreturn)\r
85   #define __USED                    __attribute__((used))\r
86   #define __WEAK                    __attribute__((weak))\r
87   #define __UNALIGNED_UINT32(x)     (*((__packed uint32_t *)(x)))\r
88 \r
89 #elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)       /* ARM Compiler 6 */\r
90   #define __ASM                     __asm\r
91   #define __INLINE                  __inline\r
92   #define __STATIC_INLINE           static __inline\r
93   #define __NO_RETURN               __attribute__((noreturn))\r
94   #define __USED                    __attribute__((used))\r
95   #define __WEAK                    __attribute__((weak))\r
96   #pragma clang diagnostic push\r
97   #pragma clang diagnostic ignored "-Wpacked"\r
98   struct __attribute__((packed)) T_UINT32 { uint32_t v; };\r
99   #pragma clang diagnostic pop\r
100   #define __UNALIGNED_UINT32(x)     (((struct T_UINT32 *)(x))->v)\r
101 \r
102 #elif defined ( __GNUC__ )                                            /* GNU Compiler */\r
103   #define __ASM                     __asm\r
104   #define __INLINE                  inline\r
105   #define __STATIC_INLINE           static inline\r
106   #define __NO_RETURN               __attribute__((noreturn))\r
107   #define __USED                    __attribute__((used))\r
108   #define __WEAK                    __attribute__((weak))\r
109   struct __attribute__((packed)) T_UINT32 { uint32_t v; };\r
110   #define __UNALIGNED_UINT32(x)     (((struct T_UINT32 *)(x))->v)\r
111 \r
112 #elif defined ( __ICCARM__ )                                          /* IAR Compiler */\r
113   #define __ASM                     __asm\r
114   #define __INLINE                  inline\r
115   #define __STATIC_INLINE           static inline\r
116   #define __NO_RETURN               __noreturn\r
117   #define __USED                    __attribute__((used))\r
118   #define __WEAK                    __attribute__((weak))\r
119   #define __UNALIGNED_UINT32(x)     (x)\r
120 \r
121 #elif defined ( __TI_ARM__ )                                          /* TI ARM Compiler */\r
122   #define __ASM                     __asm\r
123   #define __INLINE                  inline\r
124   #define __STATIC_INLINE           static inline\r
125   #define __NO_RETURN               __attribute__((noreturn))\r
126   #define __USED                    __attribute__((used))\r
127   #define __WEAK                    __attribute__((weak))\r
128   #define __UNALIGNED_UINT32(x)     (x)\r
129 \r
130 #elif defined ( __TASKING__ )                                         /* TASKING Compiler */\r
131   #define __ASM                     __asm\r
132   #define __INLINE                  inline\r
133   #define __STATIC_INLINE           static inline\r
134   #define __NO_RETURN               __attribute__((noreturn))\r
135   #define __USED                    __attribute__((used))\r
136   #define __WEAK                    __attribute__((weak))\r
137   #define __UNALIGNED_UINT32(x)     (x)\r
138 \r
139 #elif defined ( __CSMC__ )                                            /* COSMIC Compiler */\r
140   #define __packed\r
141   #define __ASM                     _asm\r
142   #define __INLINE                  inline\r
143   #define __STATIC_INLINE           static inline\r
144   #define __NO_RETURN\r
145   #define __USED\r
146   #define __WEAK\r
147   #define __UNALIGNED_UINT32(x)     (x)\r
148 \r
149 #else\r
150   #error Unknown compiler\r
151 #endif\r
152 \r
153 /** __FPU_USED indicates whether an FPU is used or not.\r
154     This core does not support an FPU at all\r
155 */\r
156 #define __FPU_USED       0U\r
157 \r
158 #if defined ( __CC_ARM )\r
159   #if defined __TARGET_FPU_VFP\r
160     #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"\r
161   #endif\r
162 \r
163 #elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)\r
164   #if defined __ARM_PCS_VFP\r
165     #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"\r
166   #endif\r
167 \r
168 #elif defined ( __GNUC__ )\r
169   #if defined (__VFP_FP__) && !defined(__SOFTFP__)\r
170     #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"\r
171   #endif\r
172 \r
173 #elif defined ( __ICCARM__ )\r
174   #if defined __ARMVFP__\r
175     #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"\r
176   #endif\r
177 \r
178 #elif defined ( __TI_ARM__ )\r
179   #if defined __TI_VFP_SUPPORT__\r
180     #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"\r
181   #endif\r
182 \r
183 #elif defined ( __TASKING__ )\r
184   #if defined __FPU_VFP__\r
185     #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"\r
186   #endif\r
187 \r
188 #elif defined ( __CSMC__ )\r
189   #if ( __CSMC__ & 0x400U)\r
190     #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"\r
191   #endif\r
192 \r
193 #endif\r
194 \r
195 #include "core_cminstr.h"                /* Core Instruction Access */\r
196 #include "core_cmfunc.h"                 /* Core Function Access */\r
197 \r
198 #ifdef __cplusplus\r
199 }\r
200 #endif\r
201 \r
202 #endif /* __CORE_ARMV8MBL_H_GENERIC */\r
203 \r
204 #ifndef __CMSIS_GENERIC\r
205 \r
206 #ifndef __CORE_ARMV8MBL_H_DEPENDANT\r
207 #define __CORE_ARMV8MBL_H_DEPENDANT\r
208 \r
209 #ifdef __cplusplus\r
210  extern "C" {\r
211 #endif\r
212 \r
213 /* check device defines and use defaults */\r
214 #if defined __CHECK_DEVICE_DEFINES\r
215   #ifndef __ARMv8MBL_REV\r
216     #define __ARMv8MBL_REV               0x0000U\r
217     #warning "__ARMv8MBL_REV not defined in device header file; using default!"\r
218   #endif\r
219 \r
220   #ifndef __FPU_PRESENT\r
221     #define __FPU_PRESENT             0U\r
222     #warning "__FPU_PRESENT not defined in device header file; using default!"\r
223   #endif\r
224 \r
225   #ifndef __MPU_PRESENT\r
226     #define __MPU_PRESENT             0U\r
227     #warning "__MPU_PRESENT not defined in device header file; using default!"\r
228   #endif\r
229 \r
230   #ifndef __SAU_PRESENT\r
231     #define __SAU_PRESENT             0U\r
232     #warning "__SAU_PRESENT not defined in device header file; using default!"\r
233   #endif\r
234 \r
235   #ifndef __VTOR_PRESENT\r
236     #define __VTOR_PRESENT            0U\r
237     #warning "__VTOR_PRESENT not defined in device header file; using default!"\r
238   #endif\r
239 \r
240   #ifndef __NVIC_PRIO_BITS\r
241     #define __NVIC_PRIO_BITS          2U\r
242     #warning "__NVIC_PRIO_BITS not defined in device header file; using default!"\r
243   #endif\r
244 \r
245   #ifndef __Vendor_SysTickConfig\r
246     #define __Vendor_SysTickConfig    0U\r
247     #warning "__Vendor_SysTickConfig not defined in device header file; using default!"\r
248   #endif\r
249 \r
250   #ifndef __ETM_PRESENT\r
251     #define __ETM_PRESENT             0U\r
252     #warning "__ETM_PRESENT not defined in device header file; using default!"\r
253   #endif\r
254 \r
255   #ifndef __MTB_PRESENT\r
256     #define __MTB_PRESENT             0U\r
257     #warning "__MTB_PRESENT not defined in device header file; using default!"\r
258   #endif\r
259 \r
260 #endif\r
261 \r
262 /* IO definitions (access restrictions to peripheral registers) */\r
263 /**\r
264     \defgroup CMSIS_glob_defs CMSIS Global Defines\r
265 \r
266     <strong>IO Type Qualifiers</strong> are used\r
267     \li to specify the access to peripheral variables.\r
268     \li for automatic generation of peripheral register debug information.\r
269 */\r
270 #ifdef __cplusplus\r
271   #define   __I     volatile             /*!< Defines 'read only' permissions */\r
272 #else\r
273   #define   __I     volatile const       /*!< Defines 'read only' permissions */\r
274 #endif\r
275 #define     __O     volatile             /*!< Defines 'write only' permissions */\r
276 #define     __IO    volatile             /*!< Defines 'read / write' permissions */\r
277 \r
278 /* following defines should be used for structure members */\r
279 #define     __IM     volatile const      /*! Defines 'read only' structure member permissions */\r
280 #define     __OM     volatile            /*! Defines 'write only' structure member permissions */\r
281 #define     __IOM    volatile            /*! Defines 'read / write' structure member permissions */\r
282 \r
283 /*@} end of group ARMv8MBL */\r
284 \r
285 \r
286 \r
287 /*******************************************************************************\r
288  *                 Register Abstraction\r
289   Core Register contain:\r
290   - Core Register\r
291   - Core NVIC Register\r
292   - Core SCB Register\r
293   - Core SysTick Register\r
294   - Core Debug Register\r
295   - Core MPU Register\r
296   - Core SAU Register\r
297  ******************************************************************************/\r
298 /**\r
299   \defgroup CMSIS_core_register Defines and Type Definitions\r
300   \brief Type definitions and defines for Cortex-M processor based devices.\r
301 */\r
302 \r
303 /**\r
304   \ingroup    CMSIS_core_register\r
305   \defgroup   CMSIS_CORE  Status and Control Registers\r
306   \brief      Core Register type definitions.\r
307   @{\r
308  */\r
309 \r
310 /**\r
311   \brief  Union type to access the Application Program Status Register (APSR).\r
312  */\r
313 typedef union\r
314 {\r
315   struct\r
316   {\r
317     uint32_t _reserved0:28;              /*!< bit:  0..27  Reserved */\r
318     uint32_t V:1;                        /*!< bit:     28  Overflow condition code flag */\r
319     uint32_t C:1;                        /*!< bit:     29  Carry condition code flag */\r
320     uint32_t Z:1;                        /*!< bit:     30  Zero condition code flag */\r
321     uint32_t N:1;                        /*!< bit:     31  Negative condition code flag */\r
322   } b;                                   /*!< Structure used for bit  access */\r
323   uint32_t w;                            /*!< Type      used for word access */\r
324 } APSR_Type;\r
325 \r
326 /* APSR Register Definitions */\r
327 #define APSR_N_Pos                         31U                                            /*!< APSR: N Position */\r
328 #define APSR_N_Msk                         (1UL << APSR_N_Pos)                            /*!< APSR: N Mask */\r
329 \r
330 #define APSR_Z_Pos                         30U                                            /*!< APSR: Z Position */\r
331 #define APSR_Z_Msk                         (1UL << APSR_Z_Pos)                            /*!< APSR: Z Mask */\r
332 \r
333 #define APSR_C_Pos                         29U                                            /*!< APSR: C Position */\r
334 #define APSR_C_Msk                         (1UL << APSR_C_Pos)                            /*!< APSR: C Mask */\r
335 \r
336 #define APSR_V_Pos                         28U                                            /*!< APSR: V Position */\r
337 #define APSR_V_Msk                         (1UL << APSR_V_Pos)                            /*!< APSR: V Mask */\r
338 \r
339 \r
340 /**\r
341   \brief  Union type to access the Interrupt Program Status Register (IPSR).\r
342  */\r
343 typedef union\r
344 {\r
345   struct\r
346   {\r
347     uint32_t ISR:9;                      /*!< bit:  0.. 8  Exception number */\r
348     uint32_t _reserved0:23;              /*!< bit:  9..31  Reserved */\r
349   } b;                                   /*!< Structure used for bit  access */\r
350   uint32_t w;                            /*!< Type      used for word access */\r
351 } IPSR_Type;\r
352 \r
353 /* IPSR Register Definitions */\r
354 #define IPSR_ISR_Pos                        0U                                            /*!< IPSR: ISR Position */\r
355 #define IPSR_ISR_Msk                       (0x1FFUL /*<< IPSR_ISR_Pos*/)                  /*!< IPSR: ISR Mask */\r
356 \r
357 \r
358 /**\r
359   \brief  Union type to access the Special-Purpose Program Status Registers (xPSR).\r
360  */\r
361 typedef union\r
362 {\r
363   struct\r
364   {\r
365     uint32_t ISR:9;                      /*!< bit:  0.. 8  Exception number */\r
366     uint32_t _reserved0:15;              /*!< bit:  9..23  Reserved */\r
367     uint32_t T:1;                        /*!< bit:     24  Thumb bit        (read 0) */\r
368     uint32_t _reserved1:3;               /*!< bit: 25..27  Reserved */\r
369     uint32_t V:1;                        /*!< bit:     28  Overflow condition code flag */\r
370     uint32_t C:1;                        /*!< bit:     29  Carry condition code flag */\r
371     uint32_t Z:1;                        /*!< bit:     30  Zero condition code flag */\r
372     uint32_t N:1;                        /*!< bit:     31  Negative condition code flag */\r
373   } b;                                   /*!< Structure used for bit  access */\r
374   uint32_t w;                            /*!< Type      used for word access */\r
375 } xPSR_Type;\r
376 \r
377 /* xPSR Register Definitions */\r
378 #define xPSR_N_Pos                         31U                                            /*!< xPSR: N Position */\r
379 #define xPSR_N_Msk                         (1UL << xPSR_N_Pos)                            /*!< xPSR: N Mask */\r
380 \r
381 #define xPSR_Z_Pos                         30U                                            /*!< xPSR: Z Position */\r
382 #define xPSR_Z_Msk                         (1UL << xPSR_Z_Pos)                            /*!< xPSR: Z Mask */\r
383 \r
384 #define xPSR_C_Pos                         29U                                            /*!< xPSR: C Position */\r
385 #define xPSR_C_Msk                         (1UL << xPSR_C_Pos)                            /*!< xPSR: C Mask */\r
386 \r
387 #define xPSR_V_Pos                         28U                                            /*!< xPSR: V Position */\r
388 #define xPSR_V_Msk                         (1UL << xPSR_V_Pos)                            /*!< xPSR: V Mask */\r
389 \r
390 #define xPSR_T_Pos                         24U                                            /*!< xPSR: T Position */\r
391 #define xPSR_T_Msk                         (1UL << xPSR_T_Pos)                            /*!< xPSR: T Mask */\r
392 \r
393 #define xPSR_ISR_Pos                        0U                                            /*!< xPSR: ISR Position */\r
394 #define xPSR_ISR_Msk                       (0x1FFUL /*<< xPSR_ISR_Pos*/)                  /*!< xPSR: ISR Mask */\r
395 \r
396 \r
397 /**\r
398   \brief  Union type to access the Control Registers (CONTROL).\r
399  */\r
400 typedef union\r
401 {\r
402   struct\r
403   {\r
404     uint32_t nPRIV:1;                    /*!< bit:      0  Execution privilege in Thread mode */\r
405     uint32_t SPSEL:1;                    /*!< bit:      1  Stack to be used */\r
406     uint32_t _reserved1:30;              /*!< bit:  2..31  Reserved */\r
407   } b;                                   /*!< Structure used for bit  access */\r
408   uint32_t w;                            /*!< Type      used for word access */\r
409 } CONTROL_Type;\r
410 \r
411 /* CONTROL Register Definitions */\r
412 #define CONTROL_SPSEL_Pos                   1U                                            /*!< CONTROL: SPSEL Position */\r
413 #define CONTROL_SPSEL_Msk                  (1UL << CONTROL_SPSEL_Pos)                     /*!< CONTROL: SPSEL Mask */\r
414 \r
415 #define CONTROL_nPRIV_Pos                   0U                                            /*!< CONTROL: nPRIV Position */\r
416 #define CONTROL_nPRIV_Msk                  (1UL /*<< CONTROL_nPRIV_Pos*/)                 /*!< CONTROL: nPRIV Mask */\r
417 \r
418 /*@} end of group CMSIS_CORE */\r
419 \r
420 \r
421 /**\r
422   \ingroup    CMSIS_core_register\r
423   \defgroup   CMSIS_NVIC  Nested Vectored Interrupt Controller (NVIC)\r
424   \brief      Type definitions for the NVIC Registers\r
425   @{\r
426  */\r
427 \r
428 /**\r
429   \brief  Structure type to access the Nested Vectored Interrupt Controller (NVIC).\r
430  */\r
431 typedef struct\r
432 {\r
433   __IOM uint32_t ISER[8U];               /*!< Offset: 0x000 (R/W)  Interrupt Set Enable Register */\r
434         uint32_t RESERVED0[24U];\r
435   __IOM uint32_t ICER[8U];               /*!< Offset: 0x080 (R/W)  Interrupt Clear Enable Register */\r
436         uint32_t RSERVED1[24U];\r
437   __IOM uint32_t ISPR[8U];               /*!< Offset: 0x100 (R/W)  Interrupt Set Pending Register */\r
438         uint32_t RESERVED2[24U];\r
439   __IOM uint32_t ICPR[8U];               /*!< Offset: 0x180 (R/W)  Interrupt Clear Pending Register */\r
440         uint32_t RESERVED3[24U];\r
441   __IOM uint32_t IABR[8U];               /*!< Offset: 0x200 (R/W)  Interrupt Active bit Register  (TODO: Confirm position and count, barely mentioned in v8-M specs) */\r
442         uint32_t RESERVED4[24U];\r
443   __IOM uint32_t ITNS[8U];               /*!< Offset: 0x280 (R/W)  Interrupt Non-Secure State Register */\r
444         uint32_t RESERVED5[24U];\r
445   __IOM uint32_t IP[60U];                /*!< Offset: 0x300 (R/W)  Interrupt Priority Register */\r
446 }  NVIC_Type;\r
447 \r
448 /*@} end of group CMSIS_NVIC */\r
449 \r
450 \r
451 /**\r
452   \ingroup  CMSIS_core_register\r
453   \defgroup CMSIS_SCB     System Control Block (SCB)\r
454   \brief    Type definitions for the System Control Block Registers\r
455   @{\r
456  */\r
457 \r
458 /**\r
459   \brief  Structure type to access the System Control Block (SCB).\r
460  */\r
461 typedef struct\r
462 {\r
463   __IM  uint32_t CPUID;                  /*!< Offset: 0x000 (R/ )  CPUID Base Register */\r
464   __IOM uint32_t ICSR;                   /*!< Offset: 0x004 (R/W)  Interrupt Control and State Register */\r
465 #if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U)\r
466   __IOM uint32_t VTOR;                   /*!< Offset: 0x008 (R/W)  Vector Table Offset Register */\r
467 #else\r
468         uint32_t RESERVED0;\r
469 #endif\r
470   __IOM uint32_t AIRCR;                  /*!< Offset: 0x00C (R/W)  Application Interrupt and Reset Control Register */\r
471   __IOM uint32_t SCR;                    /*!< Offset: 0x010 (R/W)  System Control Register */\r
472   __IOM uint32_t CCR;                    /*!< Offset: 0x014 (R/W)  Configuration Control Register */\r
473         uint32_t RESERVED1;\r
474   __IOM uint32_t SHP[2U];                /*!< Offset: 0x01C (R/W)  System Handlers Priority Registers. [0] is RESERVED */\r
475   __IOM uint32_t SHCSR;                  /*!< Offset: 0x024 (R/W)  System Handler Control and State Register */\r
476 } SCB_Type;\r
477 \r
478 /* SCB CPUID Register Definitions */\r
479 #define SCB_CPUID_IMPLEMENTER_Pos          24U                                            /*!< SCB CPUID: IMPLEMENTER Position */\r
480 #define SCB_CPUID_IMPLEMENTER_Msk          (0xFFUL << SCB_CPUID_IMPLEMENTER_Pos)          /*!< SCB CPUID: IMPLEMENTER Mask */\r
481 \r
482 #define SCB_CPUID_VARIANT_Pos              20U                                            /*!< SCB CPUID: VARIANT Position */\r
483 #define SCB_CPUID_VARIANT_Msk              (0xFUL << SCB_CPUID_VARIANT_Pos)               /*!< SCB CPUID: VARIANT Mask */\r
484 \r
485 #define SCB_CPUID_ARCHITECTURE_Pos         16U                                            /*!< SCB CPUID: ARCHITECTURE Position */\r
486 #define SCB_CPUID_ARCHITECTURE_Msk         (0xFUL << SCB_CPUID_ARCHITECTURE_Pos)          /*!< SCB CPUID: ARCHITECTURE Mask */\r
487 \r
488 #define SCB_CPUID_PARTNO_Pos                4U                                            /*!< SCB CPUID: PARTNO Position */\r
489 #define SCB_CPUID_PARTNO_Msk               (0xFFFUL << SCB_CPUID_PARTNO_Pos)              /*!< SCB CPUID: PARTNO Mask */\r
490 \r
491 #define SCB_CPUID_REVISION_Pos              0U                                            /*!< SCB CPUID: REVISION Position */\r
492 #define SCB_CPUID_REVISION_Msk             (0xFUL /*<< SCB_CPUID_REVISION_Pos*/)          /*!< SCB CPUID: REVISION Mask */\r
493 \r
494 /* SCB Interrupt Control State Register Definitions */\r
495 #define SCB_ICSR_PENDNMISET_Pos            31U                                            /*!< SCB ICSR: PENDNMISET Position */\r
496 #define SCB_ICSR_PENDNMISET_Msk            (1UL << SCB_ICSR_PENDNMISET_Pos)               /*!< SCB ICSR: PENDNMISET Mask */\r
497 \r
498 #define SCB_ICSR_PENDNMICLR_Pos            30U                                            /*!< SCB ICSR: PENDNMICLR Position (Security Extension) */\r
499 #define SCB_ICSR_PENDNMICLR_Msk            (1UL << SCB_ICSR_PENDNMICLR_Pos)               /*!< SCB ICSR: PENDNMICLR Mask (Security Extension) */\r
500 \r
501 #define SCB_ICSR_PENDSVSET_Pos             28U                                            /*!< SCB ICSR: PENDSVSET Position */\r
502 #define SCB_ICSR_PENDSVSET_Msk             (1UL << SCB_ICSR_PENDSVSET_Pos)                /*!< SCB ICSR: PENDSVSET Mask */\r
503 \r
504 #define SCB_ICSR_PENDSVCLR_Pos             27U                                            /*!< SCB ICSR: PENDSVCLR Position */\r
505 #define SCB_ICSR_PENDSVCLR_Msk             (1UL << SCB_ICSR_PENDSVCLR_Pos)                /*!< SCB ICSR: PENDSVCLR Mask */\r
506 \r
507 #define SCB_ICSR_PENDSTSET_Pos             26U                                            /*!< SCB ICSR: PENDSTSET Position */\r
508 #define SCB_ICSR_PENDSTSET_Msk             (1UL << SCB_ICSR_PENDSTSET_Pos)                /*!< SCB ICSR: PENDSTSET Mask */\r
509 \r
510 #define SCB_ICSR_PENDSTCLR_Pos             25U                                            /*!< SCB ICSR: PENDSTCLR Position */\r
511 #define SCB_ICSR_PENDSTCLR_Msk             (1UL << SCB_ICSR_PENDSTCLR_Pos)                /*!< SCB ICSR: PENDSTCLR Mask */\r
512 \r
513 #define SCB_ICSR_STTNS_Pos                 24U                                            /*!< SCB ICSR: STTNS Position (Security Extension) */\r
514 #define SCB_ICSR_STTNS_Msk                 (1UL << SCB_ICSR_STTNS_Pos)                    /*!< SCB ICSR: STTNS Mask (Security Extension) */\r
515 \r
516 #define SCB_ICSR_ISRPREEMPT_Pos            23U                                            /*!< SCB ICSR: ISRPREEMPT Position */\r
517 #define SCB_ICSR_ISRPREEMPT_Msk            (1UL << SCB_ICSR_ISRPREEMPT_Pos)               /*!< SCB ICSR: ISRPREEMPT Mask */\r
518 \r
519 #define SCB_ICSR_ISRPENDING_Pos            22U                                            /*!< SCB ICSR: ISRPENDING Position */\r
520 #define SCB_ICSR_ISRPENDING_Msk            (1UL << SCB_ICSR_ISRPENDING_Pos)               /*!< SCB ICSR: ISRPENDING Mask */\r
521 \r
522 #define SCB_ICSR_VECTPENDING_Pos           12U                                            /*!< SCB ICSR: VECTPENDING Position */\r
523 #define SCB_ICSR_VECTPENDING_Msk           (0x1FFUL << SCB_ICSR_VECTPENDING_Pos)          /*!< SCB ICSR: VECTPENDING Mask */\r
524 \r
525 #define SCB_ICSR_VECTACTIVE_Pos             0U                                            /*!< SCB ICSR: VECTACTIVE Position */\r
526 #define SCB_ICSR_VECTACTIVE_Msk            (0x1FFUL /*<< SCB_ICSR_VECTACTIVE_Pos*/)       /*!< SCB ICSR: VECTACTIVE Mask */\r
527 \r
528 #if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U)\r
529 /* SCB Vector Table Offset Register Definitions */\r
530 #define SCB_VTOR_TBLOFF_Pos                 7U                                            /*!< SCB VTOR: TBLOFF Position */\r
531 #define SCB_VTOR_TBLOFF_Msk                (0x1FFFFFFUL << SCB_VTOR_TBLOFF_Pos)           /*!< SCB VTOR: TBLOFF Mask */\r
532 #endif\r
533 \r
534 /* SCB Application Interrupt and Reset Control Register Definitions */\r
535 #define SCB_AIRCR_VECTKEY_Pos              16U                                            /*!< SCB AIRCR: VECTKEY Position */\r
536 #define SCB_AIRCR_VECTKEY_Msk              (0xFFFFUL << SCB_AIRCR_VECTKEY_Pos)            /*!< SCB AIRCR: VECTKEY Mask */\r
537 \r
538 #define SCB_AIRCR_VECTKEYSTAT_Pos          16U                                            /*!< SCB AIRCR: VECTKEYSTAT Position */\r
539 #define SCB_AIRCR_VECTKEYSTAT_Msk          (0xFFFFUL << SCB_AIRCR_VECTKEYSTAT_Pos)        /*!< SCB AIRCR: VECTKEYSTAT Mask */\r
540 \r
541 #define SCB_AIRCR_ENDIANESS_Pos            15U                                            /*!< SCB AIRCR: ENDIANESS Position */\r
542 #define SCB_AIRCR_ENDIANESS_Msk            (1UL << SCB_AIRCR_ENDIANESS_Pos)               /*!< SCB AIRCR: ENDIANESS Mask */\r
543 \r
544 #define SCB_AIRCR_PRIS_Pos                 14U                                            /*!< SCB AIRCR: PRIS Position */\r
545 #define SCB_AIRCR_PRIS_Msk                 (1UL << SCB_AIRCR_PRIS_Pos)                    /*!< SCB AIRCR: PRIS Mask */\r
546 \r
547 #define SCB_AIRCR_BFHFNMINS_Pos            13U                                            /*!< SCB AIRCR: BFHFNMINS Position */\r
548 #define SCB_AIRCR_BFHFNMINS_Msk            (1UL << SCB_AIRCR_BFHFNMINS_Pos)               /*!< SCB AIRCR: BFHFNMINS Mask */\r
549 \r
550 #define SCB_AIRCR_SYSRESETREQS_Pos          3U                                            /*!< SCB AIRCR: SYSRESETREQS Position */\r
551 #define SCB_AIRCR_SYSRESETREQS_Msk         (1UL << SCB_AIRCR_SYSRESETREQS_Pos)            /*!< SCB AIRCR: SYSRESETREQS Mask */\r
552 \r
553 #define SCB_AIRCR_SYSRESETREQ_Pos           2U                                            /*!< SCB AIRCR: SYSRESETREQ Position */\r
554 #define SCB_AIRCR_SYSRESETREQ_Msk          (1UL << SCB_AIRCR_SYSRESETREQ_Pos)             /*!< SCB AIRCR: SYSRESETREQ Mask */\r
555 \r
556 #define SCB_AIRCR_VECTCLRACTIVE_Pos         1U                                            /*!< SCB AIRCR: VECTCLRACTIVE Position */\r
557 #define SCB_AIRCR_VECTCLRACTIVE_Msk        (1UL << SCB_AIRCR_VECTCLRACTIVE_Pos)           /*!< SCB AIRCR: VECTCLRACTIVE Mask */\r
558 \r
559 /* SCB System Control Register Definitions */\r
560 #define SCB_SCR_SEVONPEND_Pos               4U                                            /*!< SCB SCR: SEVONPEND Position */\r
561 #define SCB_SCR_SEVONPEND_Msk              (1UL << SCB_SCR_SEVONPEND_Pos)                 /*!< SCB SCR: SEVONPEND Mask */\r
562 \r
563 #define SCB_SCR_SLEEPDEEPS_Pos              3U                                            /*!< SCB SCR: SLEEPDEEPS Position */\r
564 #define SCB_SCR_SLEEPDEEPS_Msk             (1UL << SCB_SCR_SLEEPDEEPS_Pos)                /*!< SCB SCR: SLEEPDEEPS Mask */\r
565 \r
566 #define SCB_SCR_SLEEPDEEP_Pos               2U                                            /*!< SCB SCR: SLEEPDEEP Position */\r
567 #define SCB_SCR_SLEEPDEEP_Msk              (1UL << SCB_SCR_SLEEPDEEP_Pos)                 /*!< SCB SCR: SLEEPDEEP Mask */\r
568 \r
569 #define SCB_SCR_SLEEPONEXIT_Pos             1U                                            /*!< SCB SCR: SLEEPONEXIT Position */\r
570 #define SCB_SCR_SLEEPONEXIT_Msk            (1UL << SCB_SCR_SLEEPONEXIT_Pos)               /*!< SCB SCR: SLEEPONEXIT Mask */\r
571 \r
572 /* SCB Configuration Control Register Definitions */\r
573 #define SCB_CCR_STKOFHFNMIGN_Pos           10U                                            /*!< SCB CCR: STKOFHFNMIGN Position */\r
574 #define SCB_CCR_STKOFHFNMIGN_Msk           (1UL << SCB_CCR_STKOFHFNMIGN_Pos)              /*!< SCB CCR: STKOFHFNMIGN Mask */\r
575 \r
576 #define SCB_CCR_STKALIGN_Pos                9U                                            /*!< SCB CCR: STKALIGN Position */\r
577 #define SCB_CCR_STKALIGN_Msk               (1UL << SCB_CCR_STKALIGN_Pos)                  /*!< SCB CCR: STKALIGN Mask */\r
578 \r
579 #define SCB_CCR_UNALIGN_TRP_Pos             3U                                            /*!< SCB CCR: UNALIGN_TRP Position */\r
580 #define SCB_CCR_UNALIGN_TRP_Msk            (1UL << SCB_CCR_UNALIGN_TRP_Pos)               /*!< SCB CCR: UNALIGN_TRP Mask */\r
581 \r
582 #define SCB_CCR_NONBASETHRDENA_Pos          0U                                            /*!< SCB CCR: NONBASETHRDENA Position */\r
583 #define SCB_CCR_NONBASETHRDENA_Msk         (1UL << SCB_CCR_NONBASETHRDENA_Pos)            /*!< SCB CCR: NONBASETHRDENA Mask */\r
584 \r
585 /* SCB System Handler Control and State Register Definitions */\r
586 #define SCB_SHCSR_HARDFAULTPENDED_Pos      21U                                            /*!< SCB SHCSR: HARDFAULTPENDED Position */\r
587 #define SCB_SHCSR_HARDFAULTPENDED_Msk      (1UL << SCB_SHCSR_HARDFAULTPENDED_Pos)         /*!< SCB SHCSR: HARDFAULTPENDED Mask */\r
588 \r
589 #define SCB_SHCSR_SVCALLPENDED_Pos         15U                                            /*!< SCB SHCSR: SVCALLPENDED Position */\r
590 #define SCB_SHCSR_SVCALLPENDED_Msk         (1UL << SCB_SHCSR_SVCALLPENDED_Pos)            /*!< SCB SHCSR: SVCALLPENDED Mask */\r
591 \r
592 #define SCB_SHCSR_SYSTICKACT_Pos           11U                                            /*!< SCB SHCSR: SYSTICKACT Position */\r
593 #define SCB_SHCSR_SYSTICKACT_Msk           (1UL << SCB_SHCSR_SYSTICKACT_Pos)              /*!< SCB SHCSR: SYSTICKACT Mask */\r
594 \r
595 #define SCB_SHCSR_PENDSVACT_Pos            10U                                            /*!< SCB SHCSR: PENDSVACT Position */\r
596 #define SCB_SHCSR_PENDSVACT_Msk            (1UL << SCB_SHCSR_PENDSVACT_Pos)               /*!< SCB SHCSR: PENDSVACT Mask */\r
597 \r
598 #define SCB_SHCSR_SVCALLACT_Pos             7U                                            /*!< SCB SHCSR: SVCALLACT Position */\r
599 #define SCB_SHCSR_SVCALLACT_Msk            (1UL << SCB_SHCSR_SVCALLACT_Pos)               /*!< SCB SHCSR: SVCALLACT Mask */\r
600 \r
601 #define SCB_SHCSR_NMIACT_Pos                5U                                            /*!< SCB SHCSR: NMIACT Position */\r
602 #define SCB_SHCSR_NMIACT_Msk               (1UL << SCB_SHCSR_NMIACT_Pos)                  /*!< SCB SHCSR: NMIACT Mask */\r
603 \r
604 #define SCB_SHCSR_HARDFAULTACT_Pos          2U                                            /*!< SCB SHCSR: HARDFAULTACT Position */\r
605 #define SCB_SHCSR_HARDFAULTACT_Msk         (1UL << SCB_SHCSR_HARDFAULTACT_Pos)            /*!< SCB SHCSR: HARDFAULTACT Mask */\r
606 \r
607 /*@} end of group CMSIS_SCB */\r
608 \r
609 \r
610 /**\r
611   \ingroup  CMSIS_core_register\r
612   \defgroup CMSIS_SysTick     System Tick Timer (SysTick)\r
613   \brief    Type definitions for the System Timer Registers.\r
614   @{\r
615  */\r
616 \r
617 /**\r
618   \brief  Structure type to access the System Timer (SysTick).\r
619  */\r
620 typedef struct\r
621 {\r
622   __IOM uint32_t CTRL;                   /*!< Offset: 0x000 (R/W)  SysTick Control and Status Register */\r
623   __IOM uint32_t LOAD;                   /*!< Offset: 0x004 (R/W)  SysTick Reload Value Register */\r
624   __IOM uint32_t VAL;                    /*!< Offset: 0x008 (R/W)  SysTick Current Value Register */\r
625   __IM  uint32_t CALIB;                  /*!< Offset: 0x00C (R/ )  SysTick Calibration Register */\r
626 } SysTick_Type;\r
627 \r
628 /* SysTick Control / Status Register Definitions */\r
629 #define SysTick_CTRL_COUNTFLAG_Pos         16U                                            /*!< SysTick CTRL: COUNTFLAG Position */\r
630 #define SysTick_CTRL_COUNTFLAG_Msk         (1UL << SysTick_CTRL_COUNTFLAG_Pos)            /*!< SysTick CTRL: COUNTFLAG Mask */\r
631 \r
632 #define SysTick_CTRL_CLKSOURCE_Pos          2U                                            /*!< SysTick CTRL: CLKSOURCE Position */\r
633 #define SysTick_CTRL_CLKSOURCE_Msk         (1UL << SysTick_CTRL_CLKSOURCE_Pos)            /*!< SysTick CTRL: CLKSOURCE Mask */\r
634 \r
635 #define SysTick_CTRL_TICKINT_Pos            1U                                            /*!< SysTick CTRL: TICKINT Position */\r
636 #define SysTick_CTRL_TICKINT_Msk           (1UL << SysTick_CTRL_TICKINT_Pos)              /*!< SysTick CTRL: TICKINT Mask */\r
637 \r
638 #define SysTick_CTRL_ENABLE_Pos             0U                                            /*!< SysTick CTRL: ENABLE Position */\r
639 #define SysTick_CTRL_ENABLE_Msk            (1UL /*<< SysTick_CTRL_ENABLE_Pos*/)           /*!< SysTick CTRL: ENABLE Mask */\r
640 \r
641 /* SysTick Reload Register Definitions */\r
642 #define SysTick_LOAD_RELOAD_Pos             0U                                            /*!< SysTick LOAD: RELOAD Position */\r
643 #define SysTick_LOAD_RELOAD_Msk            (0xFFFFFFUL /*<< SysTick_LOAD_RELOAD_Pos*/)    /*!< SysTick LOAD: RELOAD Mask */\r
644 \r
645 /* SysTick Current Register Definitions */\r
646 #define SysTick_VAL_CURRENT_Pos             0U                                            /*!< SysTick VAL: CURRENT Position */\r
647 #define SysTick_VAL_CURRENT_Msk            (0xFFFFFFUL /*<< SysTick_VAL_CURRENT_Pos*/)    /*!< SysTick VAL: CURRENT Mask */\r
648 \r
649 /* SysTick Calibration Register Definitions */\r
650 #define SysTick_CALIB_NOREF_Pos            31U                                            /*!< SysTick CALIB: NOREF Position */\r
651 #define SysTick_CALIB_NOREF_Msk            (1UL << SysTick_CALIB_NOREF_Pos)               /*!< SysTick CALIB: NOREF Mask */\r
652 \r
653 #define SysTick_CALIB_SKEW_Pos             30U                                            /*!< SysTick CALIB: SKEW Position */\r
654 #define SysTick_CALIB_SKEW_Msk             (1UL << SysTick_CALIB_SKEW_Pos)                /*!< SysTick CALIB: SKEW Mask */\r
655 \r
656 #define SysTick_CALIB_TENMS_Pos             0U                                            /*!< SysTick CALIB: TENMS Position */\r
657 #define SysTick_CALIB_TENMS_Msk            (0xFFFFFFUL /*<< SysTick_CALIB_TENMS_Pos*/)    /*!< SysTick CALIB: TENMS Mask */\r
658 \r
659 /*@} end of group CMSIS_SysTick */\r
660 \r
661 \r
662 /**\r
663   \ingroup  CMSIS_core_register\r
664   \defgroup CMSIS_DWT     Data Watchpoint and Trace (DWT)\r
665   \brief    Type definitions for the Data Watchpoint and Trace (DWT)\r
666   @{\r
667  */\r
668 \r
669 /**\r
670   \brief  Structure type to access the Data Watchpoint and Trace Register (DWT).\r
671  */\r
672 typedef struct\r
673 {\r
674   __IOM uint32_t CTRL;                   /*!< Offset: 0x000 (R/W)  Control Register */\r
675         uint32_t RESERVED0[6U];\r
676   __IM  uint32_t PCSR;                   /*!< Offset: 0x01C (R/ )  Program Counter Sample Register */\r
677   __IOM uint32_t COMP0;                  /*!< Offset: 0x020 (R/W)  Comparator Register 0 */\r
678   __IOM uint32_t MASK0;                  /*!< Offset: 0x024 (R/W)  Mask Register 0 */\r
679   __IOM uint32_t FUNCTION0;              /*!< Offset: 0x028 (R/W)  Function Register 0 */\r
680         uint32_t RESERVED1[1U];\r
681   __IOM uint32_t COMP1;                  /*!< Offset: 0x030 (R/W)  Comparator Register 1 */\r
682         uint32_t RESERVED2[1U];\r
683   __IOM uint32_t FUNCTION1;              /*!< Offset: 0x038 (R/W)  Function Register 1 */\r
684         uint32_t RESERVED3[1U];\r
685   __IOM uint32_t COMP2;                  /*!< Offset: 0x040 (R/W)  Comparator Register 2 */\r
686         uint32_t RESERVED4[1U];\r
687   __IOM uint32_t FUNCTION2;              /*!< Offset: 0x048 (R/W)  Function Register 2 */\r
688         uint32_t RESERVED5[1U];\r
689   __IOM uint32_t COMP3;                  /*!< Offset: 0x050 (R/W)  Comparator Register 3 */\r
690         uint32_t RESERVED6[1U];\r
691   __IOM uint32_t FUNCTION3;              /*!< Offset: 0x058 (R/W)  Function Register 3 */\r
692 } DWT_Type;\r
693 \r
694 /* DWT Control Register Definitions */\r
695 #define DWT_CTRL_NUMCOMP_Pos               28U                                         /*!< DWT CTRL: NUMCOMP Position */\r
696 #define DWT_CTRL_NUMCOMP_Msk               (0xFUL << DWT_CTRL_NUMCOMP_Pos)             /*!< DWT CTRL: NUMCOMP Mask */\r
697 \r
698 #define DWT_CTRL_NOTRCPKT_Pos              27U                                         /*!< DWT CTRL: NOTRCPKT Position */\r
699 #define DWT_CTRL_NOTRCPKT_Msk              (0x1UL << DWT_CTRL_NOTRCPKT_Pos)            /*!< DWT CTRL: NOTRCPKT Mask */\r
700 \r
701 #define DWT_CTRL_NOEXTTRIG_Pos             26U                                         /*!< DWT CTRL: NOEXTTRIG Position */\r
702 #define DWT_CTRL_NOEXTTRIG_Msk             (0x1UL << DWT_CTRL_NOEXTTRIG_Pos)           /*!< DWT CTRL: NOEXTTRIG Mask */\r
703 \r
704 #define DWT_CTRL_NOCYCCNT_Pos              25U                                         /*!< DWT CTRL: NOCYCCNT Position */\r
705 #define DWT_CTRL_NOCYCCNT_Msk              (0x1UL << DWT_CTRL_NOCYCCNT_Pos)            /*!< DWT CTRL: NOCYCCNT Mask */\r
706 \r
707 #define DWT_CTRL_NOPRFCNT_Pos              24U                                         /*!< DWT CTRL: NOPRFCNT Position */\r
708 #define DWT_CTRL_NOPRFCNT_Msk              (0x1UL << DWT_CTRL_NOPRFCNT_Pos)            /*!< DWT CTRL: NOPRFCNT Mask */\r
709 \r
710 /* DWT Comparator Function Register Definitions */\r
711 #define DWT_FUNCTION_ID_Pos                27U                                         /*!< DWT FUNCTION: ID Position */\r
712 #define DWT_FUNCTION_ID_Msk                (0x1FUL << DWT_FUNCTION_ID_Pos)             /*!< DWT FUNCTION: ID Mask */\r
713 \r
714 #define DWT_FUNCTION_MATCHED_Pos           24U                                         /*!< DWT FUNCTION: MATCHED Position */\r
715 #define DWT_FUNCTION_MATCHED_Msk           (0x1UL << DWT_FUNCTION_MATCHED_Pos)         /*!< DWT FUNCTION: MATCHED Mask */\r
716 \r
717 #define DWT_FUNCTION_DATAVSIZE_Pos         10U                                         /*!< DWT FUNCTION: DATAVSIZE Position */\r
718 #define DWT_FUNCTION_DATAVSIZE_Msk         (0x3UL << DWT_FUNCTION_DATAVSIZE_Pos)       /*!< DWT FUNCTION: DATAVSIZE Mask */\r
719 \r
720 #define DWT_FUNCTION_ACTION_Pos             4U                                         /*!< DWT FUNCTION: ACTION Position */\r
721 #define DWT_FUNCTION_ACTION_Msk            (0x3UL << DWT_FUNCTION_ACTION_Pos)          /*!< DWT FUNCTION: ACTION Mask */\r
722 \r
723 #define DWT_FUNCTION_MATCH_Pos              0U                                         /*!< DWT FUNCTION: MATCH Position */\r
724 #define DWT_FUNCTION_MATCH_Msk             (0xFUL /*<< DWT_FUNCTION_MATCH_Pos*/)       /*!< DWT FUNCTION: MATCH Mask */\r
725 \r
726 /*@}*/ /* end of group CMSIS_DWT */\r
727 \r
728 \r
729 /**\r
730   \ingroup  CMSIS_core_register\r
731   \defgroup CMSIS_TPI     Trace Port Interface (TPI)\r
732   \brief    Type definitions for the Trace Port Interface (TPI)\r
733   @{\r
734  */\r
735 \r
736 /**\r
737   \brief  Structure type to access the Trace Port Interface Register (TPI).\r
738  */\r
739 typedef struct\r
740 {\r
741   __IOM uint32_t SSPSR;                  /*!< Offset: 0x000 (R/ )  Supported Parallel Port Size Register */\r
742   __IOM uint32_t CSPSR;                  /*!< Offset: 0x004 (R/W)  Current Parallel Port Size Register */\r
743         uint32_t RESERVED0[2U];\r
744   __IOM uint32_t ACPR;                   /*!< Offset: 0x010 (R/W)  Asynchronous Clock Prescaler Register */\r
745         uint32_t RESERVED1[55U];\r
746   __IOM uint32_t SPPR;                   /*!< Offset: 0x0F0 (R/W)  Selected Pin Protocol Register */\r
747         uint32_t RESERVED2[131U];\r
748   __IM  uint32_t FFSR;                   /*!< Offset: 0x300 (R/ )  Formatter and Flush Status Register */\r
749   __IOM uint32_t FFCR;                   /*!< Offset: 0x304 (R/W)  Formatter and Flush Control Register */\r
750   __IM  uint32_t FSCR;                   /*!< Offset: 0x308 (R/ )  Formatter Synchronization Counter Register */\r
751         uint32_t RESERVED3[759U];\r
752   __IM  uint32_t TRIGGER;                /*!< Offset: 0xEE8 (R/ )  TRIGGER */\r
753   __IM  uint32_t FIFO0;                  /*!< Offset: 0xEEC (R/ )  Integration ETM Data */\r
754   __IM  uint32_t ITATBCTR2;              /*!< Offset: 0xEF0 (R/ )  ITATBCTR2 */\r
755         uint32_t RESERVED4[1U];\r
756   __IM  uint32_t ITATBCTR0;              /*!< Offset: 0xEF8 (R/ )  ITATBCTR0 */\r
757   __IM  uint32_t FIFO1;                  /*!< Offset: 0xEFC (R/ )  Integration ITM Data */\r
758   __IOM uint32_t ITCTRL;                 /*!< Offset: 0xF00 (R/W)  Integration Mode Control */\r
759         uint32_t RESERVED5[39U];\r
760   __IOM uint32_t CLAIMSET;               /*!< Offset: 0xFA0 (R/W)  Claim tag set */\r
761   __IOM uint32_t CLAIMCLR;               /*!< Offset: 0xFA4 (R/W)  Claim tag clear */\r
762         uint32_t RESERVED7[8U];\r
763   __IM  uint32_t DEVID;                  /*!< Offset: 0xFC8 (R/ )  TPIU_DEVID */\r
764   __IM  uint32_t DEVTYPE;                /*!< Offset: 0xFCC (R/ )  TPIU_DEVTYPE */\r
765 } TPI_Type;\r
766 \r
767 /* TPI Asynchronous Clock Prescaler Register Definitions */\r
768 #define TPI_ACPR_PRESCALER_Pos              0U                                         /*!< TPI ACPR: PRESCALER Position */\r
769 #define TPI_ACPR_PRESCALER_Msk             (0x1FFFUL /*<< TPI_ACPR_PRESCALER_Pos*/)    /*!< TPI ACPR: PRESCALER Mask */\r
770 \r
771 /* TPI Selected Pin Protocol Register Definitions */\r
772 #define TPI_SPPR_TXMODE_Pos                 0U                                         /*!< TPI SPPR: TXMODE Position */\r
773 #define TPI_SPPR_TXMODE_Msk                (0x3UL /*<< TPI_SPPR_TXMODE_Pos*/)          /*!< TPI SPPR: TXMODE Mask */\r
774 \r
775 /* TPI Formatter and Flush Status Register Definitions */\r
776 #define TPI_FFSR_FtNonStop_Pos              3U                                         /*!< TPI FFSR: FtNonStop Position */\r
777 #define TPI_FFSR_FtNonStop_Msk             (0x1UL << TPI_FFSR_FtNonStop_Pos)           /*!< TPI FFSR: FtNonStop Mask */\r
778 \r
779 #define TPI_FFSR_TCPresent_Pos              2U                                         /*!< TPI FFSR: TCPresent Position */\r
780 #define TPI_FFSR_TCPresent_Msk             (0x1UL << TPI_FFSR_TCPresent_Pos)           /*!< TPI FFSR: TCPresent Mask */\r
781 \r
782 #define TPI_FFSR_FtStopped_Pos              1U                                         /*!< TPI FFSR: FtStopped Position */\r
783 #define TPI_FFSR_FtStopped_Msk             (0x1UL << TPI_FFSR_FtStopped_Pos)           /*!< TPI FFSR: FtStopped Mask */\r
784 \r
785 #define TPI_FFSR_FlInProg_Pos               0U                                         /*!< TPI FFSR: FlInProg Position */\r
786 #define TPI_FFSR_FlInProg_Msk              (0x1UL /*<< TPI_FFSR_FlInProg_Pos*/)        /*!< TPI FFSR: FlInProg Mask */\r
787 \r
788 /* TPI Formatter and Flush Control Register Definitions */\r
789 #define TPI_FFCR_TrigIn_Pos                 8U                                         /*!< TPI FFCR: TrigIn Position */\r
790 #define TPI_FFCR_TrigIn_Msk                (0x1UL << TPI_FFCR_TrigIn_Pos)              /*!< TPI FFCR: TrigIn Mask */\r
791 \r
792 #define TPI_FFCR_EnFCont_Pos                1U                                         /*!< TPI FFCR: EnFCont Position */\r
793 #define TPI_FFCR_EnFCont_Msk               (0x1UL << TPI_FFCR_EnFCont_Pos)             /*!< TPI FFCR: EnFCont Mask */\r
794 \r
795 /* TPI TRIGGER Register Definitions */\r
796 #define TPI_TRIGGER_TRIGGER_Pos             0U                                         /*!< TPI TRIGGER: TRIGGER Position */\r
797 #define TPI_TRIGGER_TRIGGER_Msk            (0x1UL /*<< TPI_TRIGGER_TRIGGER_Pos*/)      /*!< TPI TRIGGER: TRIGGER Mask */\r
798 \r
799 /* TPI Integration ETM Data Register Definitions (FIFO0) */\r
800 #define TPI_FIFO0_ITM_ATVALID_Pos          29U                                         /*!< TPI FIFO0: ITM_ATVALID Position */\r
801 #define TPI_FIFO0_ITM_ATVALID_Msk          (0x3UL << TPI_FIFO0_ITM_ATVALID_Pos)        /*!< TPI FIFO0: ITM_ATVALID Mask */\r
802 \r
803 #define TPI_FIFO0_ITM_bytecount_Pos        27U                                         /*!< TPI FIFO0: ITM_bytecount Position */\r
804 #define TPI_FIFO0_ITM_bytecount_Msk        (0x3UL << TPI_FIFO0_ITM_bytecount_Pos)      /*!< TPI FIFO0: ITM_bytecount Mask */\r
805 \r
806 #define TPI_FIFO0_ETM_ATVALID_Pos          26U                                         /*!< TPI FIFO0: ETM_ATVALID Position */\r
807 #define TPI_FIFO0_ETM_ATVALID_Msk          (0x3UL << TPI_FIFO0_ETM_ATVALID_Pos)        /*!< TPI FIFO0: ETM_ATVALID Mask */\r
808 \r
809 #define TPI_FIFO0_ETM_bytecount_Pos        24U                                         /*!< TPI FIFO0: ETM_bytecount Position */\r
810 #define TPI_FIFO0_ETM_bytecount_Msk        (0x3UL << TPI_FIFO0_ETM_bytecount_Pos)      /*!< TPI FIFO0: ETM_bytecount Mask */\r
811 \r
812 #define TPI_FIFO0_ETM2_Pos                 16U                                         /*!< TPI FIFO0: ETM2 Position */\r
813 #define TPI_FIFO0_ETM2_Msk                 (0xFFUL << TPI_FIFO0_ETM2_Pos)              /*!< TPI FIFO0: ETM2 Mask */\r
814 \r
815 #define TPI_FIFO0_ETM1_Pos                  8U                                         /*!< TPI FIFO0: ETM1 Position */\r
816 #define TPI_FIFO0_ETM1_Msk                 (0xFFUL << TPI_FIFO0_ETM1_Pos)              /*!< TPI FIFO0: ETM1 Mask */\r
817 \r
818 #define TPI_FIFO0_ETM0_Pos                  0U                                         /*!< TPI FIFO0: ETM0 Position */\r
819 #define TPI_FIFO0_ETM0_Msk                 (0xFFUL /*<< TPI_FIFO0_ETM0_Pos*/)          /*!< TPI FIFO0: ETM0 Mask */\r
820 \r
821 /* TPI ITATBCTR2 Register Definitions */\r
822 #define TPI_ITATBCTR2_ATREADY_Pos           0U                                         /*!< TPI ITATBCTR2: ATREADY Position */\r
823 #define TPI_ITATBCTR2_ATREADY_Msk          (0x1UL /*<< TPI_ITATBCTR2_ATREADY_Pos*/)    /*!< TPI ITATBCTR2: ATREADY Mask */\r
824 \r
825 /* TPI Integration ITM Data Register Definitions (FIFO1) */\r
826 #define TPI_FIFO1_ITM_ATVALID_Pos          29U                                         /*!< TPI FIFO1: ITM_ATVALID Position */\r
827 #define TPI_FIFO1_ITM_ATVALID_Msk          (0x3UL << TPI_FIFO1_ITM_ATVALID_Pos)        /*!< TPI FIFO1: ITM_ATVALID Mask */\r
828 \r
829 #define TPI_FIFO1_ITM_bytecount_Pos        27U                                         /*!< TPI FIFO1: ITM_bytecount Position */\r
830 #define TPI_FIFO1_ITM_bytecount_Msk        (0x3UL << TPI_FIFO1_ITM_bytecount_Pos)      /*!< TPI FIFO1: ITM_bytecount Mask */\r
831 \r
832 #define TPI_FIFO1_ETM_ATVALID_Pos          26U                                         /*!< TPI FIFO1: ETM_ATVALID Position */\r
833 #define TPI_FIFO1_ETM_ATVALID_Msk          (0x3UL << TPI_FIFO1_ETM_ATVALID_Pos)        /*!< TPI FIFO1: ETM_ATVALID Mask */\r
834 \r
835 #define TPI_FIFO1_ETM_bytecount_Pos        24U                                         /*!< TPI FIFO1: ETM_bytecount Position */\r
836 #define TPI_FIFO1_ETM_bytecount_Msk        (0x3UL << TPI_FIFO1_ETM_bytecount_Pos)      /*!< TPI FIFO1: ETM_bytecount Mask */\r
837 \r
838 #define TPI_FIFO1_ITM2_Pos                 16U                                         /*!< TPI FIFO1: ITM2 Position */\r
839 #define TPI_FIFO1_ITM2_Msk                 (0xFFUL << TPI_FIFO1_ITM2_Pos)              /*!< TPI FIFO1: ITM2 Mask */\r
840 \r
841 #define TPI_FIFO1_ITM1_Pos                  8U                                         /*!< TPI FIFO1: ITM1 Position */\r
842 #define TPI_FIFO1_ITM1_Msk                 (0xFFUL << TPI_FIFO1_ITM1_Pos)              /*!< TPI FIFO1: ITM1 Mask */\r
843 \r
844 #define TPI_FIFO1_ITM0_Pos                  0U                                         /*!< TPI FIFO1: ITM0 Position */\r
845 #define TPI_FIFO1_ITM0_Msk                 (0xFFUL /*<< TPI_FIFO1_ITM0_Pos*/)          /*!< TPI FIFO1: ITM0 Mask */\r
846 \r
847 /* TPI ITATBCTR0 Register Definitions */\r
848 #define TPI_ITATBCTR0_ATREADY_Pos           0U                                         /*!< TPI ITATBCTR0: ATREADY Position */\r
849 #define TPI_ITATBCTR0_ATREADY_Msk          (0x1UL /*<< TPI_ITATBCTR0_ATREADY_Pos*/)    /*!< TPI ITATBCTR0: ATREADY Mask */\r
850 \r
851 /* TPI Integration Mode Control Register Definitions */\r
852 #define TPI_ITCTRL_Mode_Pos                 0U                                         /*!< TPI ITCTRL: Mode Position */\r
853 #define TPI_ITCTRL_Mode_Msk                (0x1UL /*<< TPI_ITCTRL_Mode_Pos*/)          /*!< TPI ITCTRL: Mode Mask */\r
854 \r
855 /* TPI DEVID Register Definitions */\r
856 #define TPI_DEVID_NRZVALID_Pos             11U                                         /*!< TPI DEVID: NRZVALID Position */\r
857 #define TPI_DEVID_NRZVALID_Msk             (0x1UL << TPI_DEVID_NRZVALID_Pos)           /*!< TPI DEVID: NRZVALID Mask */\r
858 \r
859 #define TPI_DEVID_MANCVALID_Pos            10U                                         /*!< TPI DEVID: MANCVALID Position */\r
860 #define TPI_DEVID_MANCVALID_Msk            (0x1UL << TPI_DEVID_MANCVALID_Pos)          /*!< TPI DEVID: MANCVALID Mask */\r
861 \r
862 #define TPI_DEVID_PTINVALID_Pos             9U                                         /*!< TPI DEVID: PTINVALID Position */\r
863 #define TPI_DEVID_PTINVALID_Msk            (0x1UL << TPI_DEVID_PTINVALID_Pos)          /*!< TPI DEVID: PTINVALID Mask */\r
864 \r
865 #define TPI_DEVID_MinBufSz_Pos              6U                                         /*!< TPI DEVID: MinBufSz Position */\r
866 #define TPI_DEVID_MinBufSz_Msk             (0x7UL << TPI_DEVID_MinBufSz_Pos)           /*!< TPI DEVID: MinBufSz Mask */\r
867 \r
868 #define TPI_DEVID_AsynClkIn_Pos             5U                                         /*!< TPI DEVID: AsynClkIn Position */\r
869 #define TPI_DEVID_AsynClkIn_Msk            (0x1UL << TPI_DEVID_AsynClkIn_Pos)          /*!< TPI DEVID: AsynClkIn Mask */\r
870 \r
871 #define TPI_DEVID_NrTraceInput_Pos          0U                                         /*!< TPI DEVID: NrTraceInput Position */\r
872 #define TPI_DEVID_NrTraceInput_Msk         (0x1FUL /*<< TPI_DEVID_NrTraceInput_Pos*/)  /*!< TPI DEVID: NrTraceInput Mask */\r
873 \r
874 /* TPI DEVTYPE Register Definitions */\r
875 #define TPI_DEVTYPE_MajorType_Pos           4U                                         /*!< TPI DEVTYPE: MajorType Position */\r
876 #define TPI_DEVTYPE_MajorType_Msk          (0xFUL << TPI_DEVTYPE_MajorType_Pos)        /*!< TPI DEVTYPE: MajorType Mask */\r
877 \r
878 #define TPI_DEVTYPE_SubType_Pos             0U                                         /*!< TPI DEVTYPE: SubType Position */\r
879 #define TPI_DEVTYPE_SubType_Msk            (0xFUL /*<< TPI_DEVTYPE_SubType_Pos*/)      /*!< TPI DEVTYPE: SubType Mask */\r
880 \r
881 /*@}*/ /* end of group CMSIS_TPI */\r
882 \r
883 \r
884 #if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U)\r
885 /**\r
886   \ingroup  CMSIS_core_register\r
887   \defgroup CMSIS_MPU     Memory Protection Unit (MPU)\r
888   \brief    Type definitions for the Memory Protection Unit (MPU)\r
889   @{\r
890  */\r
891 \r
892 /**\r
893   \brief  Structure type to access the Memory Protection Unit (MPU).\r
894  */\r
895 typedef struct\r
896 {\r
897   __IM  uint32_t TYPE;                   /*!< Offset: 0x000 (R/ )  MPU Type Register */\r
898   __IOM uint32_t CTRL;                   /*!< Offset: 0x004 (R/W)  MPU Control Register */\r
899   __IOM uint32_t RNR;                    /*!< Offset: 0x008 (R/W)  MPU Region Number Register */\r
900   __IOM uint32_t RBAR;                   /*!< Offset: 0x00C (R/W)  MPU Region Base Address Register */\r
901   __IOM uint32_t RLAR;                   /*!< Offset: 0x010 (R/W)  MPU Region Limit Address Register */\r
902         uint32_t RESERVED0[7U];\r
903   __IOM uint32_t MAIR0;                  /*!< Offset: 0x030 (R/W)  MPU Memory Attribute Indirection Register 0 */\r
904   __IOM uint32_t MAIR1;                  /*!< Offset: 0x034 (R/W)  MPU Memory Attribute Indirection Register 1 */\r
905 } MPU_Type;\r
906 \r
907 /* MPU Type Register Definitions */\r
908 #define MPU_TYPE_IREGION_Pos               16U                                            /*!< MPU TYPE: IREGION Position */\r
909 #define MPU_TYPE_IREGION_Msk               (0xFFUL << MPU_TYPE_IREGION_Pos)               /*!< MPU TYPE: IREGION Mask */\r
910 \r
911 #define MPU_TYPE_DREGION_Pos                8U                                            /*!< MPU TYPE: DREGION Position */\r
912 #define MPU_TYPE_DREGION_Msk               (0xFFUL << MPU_TYPE_DREGION_Pos)               /*!< MPU TYPE: DREGION Mask */\r
913 \r
914 #define MPU_TYPE_SEPARATE_Pos               0U                                            /*!< MPU TYPE: SEPARATE Position */\r
915 #define MPU_TYPE_SEPARATE_Msk              (1UL /*<< MPU_TYPE_SEPARATE_Pos*/)             /*!< MPU TYPE: SEPARATE Mask */\r
916 \r
917 /* MPU Control Register Definitions */\r
918 #define MPU_CTRL_PRIVDEFENA_Pos             2U                                            /*!< MPU CTRL: PRIVDEFENA Position */\r
919 #define MPU_CTRL_PRIVDEFENA_Msk            (1UL << MPU_CTRL_PRIVDEFENA_Pos)               /*!< MPU CTRL: PRIVDEFENA Mask */\r
920 \r
921 #define MPU_CTRL_HFNMIENA_Pos               1U                                            /*!< MPU CTRL: HFNMIENA Position */\r
922 #define MPU_CTRL_HFNMIENA_Msk              (1UL << MPU_CTRL_HFNMIENA_Pos)                 /*!< MPU CTRL: HFNMIENA Mask */\r
923 \r
924 #define MPU_CTRL_ENABLE_Pos                 0U                                            /*!< MPU CTRL: ENABLE Position */\r
925 #define MPU_CTRL_ENABLE_Msk                (1UL /*<< MPU_CTRL_ENABLE_Pos*/)               /*!< MPU CTRL: ENABLE Mask */\r
926 \r
927 /* MPU Region Number Register Definitions */\r
928 #define MPU_RNR_REGION_Pos                  0U                                            /*!< MPU RNR: REGION Position */\r
929 #define MPU_RNR_REGION_Msk                 (0xFFUL /*<< MPU_RNR_REGION_Pos*/)             /*!< MPU RNR: REGION Mask */\r
930 \r
931 /* MPU Region Base Address Register Definitions */\r
932 #define MPU_RBAR_BASE_Pos                   5U                                            /*!< MPU RBAR: BASE Position */\r
933 #define MPU_RBAR_BASE_Msk                  (0x7FFFFFFUL << MPU_RBAR_BASE_Pos)             /*!< MPU RBAR: BASE Mask */\r
934 \r
935 #define MPU_RBAR_SH_Pos                     3U                                            /*!< MPU RBAR: SH Position */\r
936 #define MPU_RBAR_SH_Msk                    (0x3UL << MPU_RBAR_SH_Pos)                     /*!< MPU RBAR: SH Mask */\r
937 \r
938 #define MPU_RBAR_AP_Pos                     1U                                            /*!< MPU RBAR: AP Position */\r
939 #define MPU_RBAR_AP_Msk                    (0x3UL << MPU_RBAR_AP_Pos)                     /*!< MPU RBAR: AP Mask */\r
940 \r
941 #define MPU_RBAR_XN_Pos                     0U                                            /*!< MPU RBAR: XN Position */\r
942 #define MPU_RBAR_XN_Msk                    (01UL /*<< MPU_RBAR_XN_Pos*/)                  /*!< MPU RBAR: XN Mask */\r
943 \r
944 /* MPU Region Limit Address Register Definitions */\r
945 #define MPU_RLAR_LIMIT_Pos                  5U                                            /*!< MPU RLAR: LIMIT Position */\r
946 #define MPU_RLAR_LIMIT_Msk                 (0x7FFFFFFUL << MPU_RLAR_LIMIT_Pos)            /*!< MPU RLAR: LIMIT Mask */\r
947 \r
948 #define MPU_RLAR_AttrIndx_Pos               1U                                            /*!< MPU RLAR: AttrIndx Position */\r
949 #define MPU_RLAR_AttrIndx_Msk              (0x7UL << MPU_RLAR_AttrIndx_Pos)               /*!< MPU RLAR: AttrIndx Mask */\r
950 \r
951 #define MPU_RLAR_EN_Pos                     0U                                            /*!< MPU RLAR: EN Position */\r
952 #define MPU_RLAR_EN_Msk                    (1UL /*<< MPU_RLAR_EN_Pos*/)                   /*!< MPU RLAR: EN Mask */\r
953 \r
954 /* MPU Memory Attribute Indirection Register 0 Definitions */\r
955 #define MPU_MAIR0_Attr3_Pos                24U                                            /*!< MPU MAIR0: Attr3 Position */\r
956 #define MPU_MAIR0_Attr3_Msk                (0xFFUL /*<< MPU_MAIR0_Attr3_Pos*/)            /*!< MPU MAIR0: Attr3 Mask */\r
957 \r
958 #define MPU_MAIR0_Attr2_Pos                16U                                            /*!< MPU MAIR0: Attr2 Position */\r
959 #define MPU_MAIR0_Attr2_Msk                (0xFFUL /*<< MPU_MAIR0_Attr2_Pos*/)            /*!< MPU MAIR0: Attr2 Mask */\r
960 \r
961 #define MPU_MAIR0_Attr1_Pos                 8U                                            /*!< MPU MAIR0: Attr1 Position */\r
962 #define MPU_MAIR0_Attr1_Msk                (0xFFUL /*<< MPU_MAIR0_Attr1_Pos*/)            /*!< MPU MAIR0: Attr1 Mask */\r
963 \r
964 #define MPU_MAIR0_Attr0_Pos                 0U                                            /*!< MPU MAIR0: Attr0 Position */\r
965 #define MPU_MAIR0_Attr0_Msk                (0xFFUL /*<< MPU_MAIR0_Attr0_Pos*/)            /*!< MPU MAIR0: Attr0 Mask */\r
966 \r
967 /* MPU Memory Attribute Indirection Register 1 Definitions */\r
968 #define MPU_MAIR1_Attr3_Pos                24U                                            /*!< MPU MAIR1: Attr7 Position */\r
969 #define MPU_MAIR1_Attr3_Msk                (0xFFUL /*<< MPU_MAIR1_Attr7_Pos*/)            /*!< MPU MAIR1: Attr7 Mask */\r
970 \r
971 #define MPU_MAIR1_Attr2_Pos                16U                                            /*!< MPU MAIR1: Attr6 Position */\r
972 #define MPU_MAIR1_Attr2_Msk                (0xFFUL /*<< MPU_MAIR1_Attr6_Pos*/)            /*!< MPU MAIR1: Attr6 Mask */\r
973 \r
974 #define MPU_MAIR1_Attr1_Pos                 8U                                            /*!< MPU MAIR1: Attr5 Position */\r
975 #define MPU_MAIR1_Attr1_Msk                (0xFFUL /*<< MPU_MAIR1_Attr5_Pos*/)            /*!< MPU MAIR1: Attr5 Mask */\r
976 \r
977 #define MPU_MAIR1_Attr0_Pos                 0U                                            /*!< MPU MAIR1: Attr4 Position */\r
978 #define MPU_MAIR1_Attr0_Msk                (0xFFUL /*<< MPU_MAIR1_Attr4_Pos*/)            /*!< MPU MAIR1: Attr4 Mask */\r
979 \r
980 /*@} end of group CMSIS_MPU */\r
981 #endif\r
982 \r
983 \r
984 #if defined (__SAU_PRESENT) && (__SAU_PRESENT == 1U)\r
985 /**\r
986   \ingroup  CMSIS_core_register\r
987   \defgroup CMSIS_SAU     Security Attribution Unit (SAU)\r
988   \brief    Type definitions for the Security Attribution Unit (SAU)\r
989   @{\r
990  */\r
991 \r
992 /**\r
993   \brief  Structure type to access the Security Attribution Unit (SAU).\r
994  */\r
995 typedef struct\r
996 {\r
997   __IOM uint32_t CTRL;                   /*!< Offset: 0x000 (R/W)  SAU Control Register */\r
998   __IM  uint32_t TYPE;                   /*!< Offset: 0x004 (R/ )  SAU Type Register */\r
999   __IOM uint32_t RNR;                    /*!< Offset: 0x008 (R/W)  SAU Region Number Register */\r
1000   __IOM uint32_t RBAR;                   /*!< Offset: 0x00C (R/W)  SAU Region Base Address Register */\r
1001   __IOM uint32_t RLAR;                   /*!< Offset: 0x010 (R/W)  SAU Region Limit Address Register */\r
1002 } SAU_Type;\r
1003 \r
1004 /* SAU Control Register Definitions */\r
1005 #define SAU_CTRL_ALLNS_Pos                  1U                                            /*!< SAU CTRL: ALLNS Position */\r
1006 #define SAU_CTRL_ALLNS_Msk                 (1UL << SAU_CTRL_ALLNS_Pos)                    /*!< SAU CTRL: ALLNS Mask */\r
1007 \r
1008 #define SAU_CTRL_ENABLE_Pos                 0U                                            /*!< SAU CTRL: ENABLE Position */\r
1009 #define SAU_CTRL_ENABLE_Msk                (1UL /*<< SAU_CTRL_ENABLE_Pos*/)               /*!< SAU CTRL: ENABLE Mask */\r
1010 \r
1011 /* SAU Type Register Definitions */\r
1012 #define SAU_TYPE_SREGION_Pos                0U                                            /*!< SAU TYPE: SREGION Position */\r
1013 #define SAU_TYPE_SREGION_Msk               (0xFFUL /*<< SAU_TYPE_SREGION_Pos*/)           /*!< SAU TYPE: SREGION Mask */\r
1014 \r
1015 /* SAU Region Number Register Definitions */\r
1016 #define SAU_RNR_REGION_Pos                  0U                                            /*!< SAU RNR: REGION Position */\r
1017 #define SAU_RNR_REGION_Msk                 (0xFFUL /*<< SAU_RNR_REGION_Pos*/)             /*!< SAU RNR: REGION Mask */\r
1018 \r
1019 /* SAU Region Base Address Register Definitions */\r
1020 #define SAU_RBAR_BADDR_Pos                  5U                                            /*!< SAU RBAR: BADDR Position */\r
1021 #define SAU_RBAR_BADDR_Msk                 (0x7FFFFFFUL << SAU_RBAR_BADDR_Pos)            /*!< SAU RBAR: BADDR Mask */\r
1022 \r
1023 /* SAU Region Limit Address Register Definitions */\r
1024 #define SAU_RLAR_LADDR_Pos                  5U                                            /*!< SAU RLAR: LADDR Position */\r
1025 #define SAU_RLAR_LADDR_Msk                 (0x7FFFFFFUL << SAU_RLAR_LADDR_Pos)            /*!< SAU RLAR: LADDR Mask */\r
1026 \r
1027 #define SAU_RLAR_NSC_Pos                    1U                                            /*!< SAU RLAR: NSC Position */\r
1028 #define SAU_RLAR_NSC_Msk                   (1UL << SAU_RLAR_NSC_Pos)                      /*!< SAU RLAR: NSC Mask */\r
1029 \r
1030 #define SAU_RLAR_ENABLE_Pos                 0U                                            /*!< SAU RLAR: ENABLE Position */\r
1031 #define SAU_RLAR_ENABLE_Msk                (1UL /*<< SAU_RLAR_ENABLE_Pos*/)               /*!< SAU RLAR: ENABLE Mask */\r
1032 \r
1033 /*@} end of group CMSIS_SAU */\r
1034 #endif\r
1035 \r
1036 \r
1037 /**\r
1038   \ingroup  CMSIS_core_register\r
1039   \defgroup CMSIS_CoreDebug       Core Debug Registers (CoreDebug)\r
1040   \brief    Type definitions for the Core Debug Registers\r
1041   @{\r
1042  */\r
1043 \r
1044 /**\r
1045   \brief  Structure type to access the Core Debug Register (CoreDebug).\r
1046  */\r
1047 typedef struct\r
1048 {\r
1049   __IOM uint32_t DHCSR;                  /*!< Offset: 0x000 (R/W)  Debug Halting Control and Status Register */\r
1050   __OM  uint32_t DCRSR;                  /*!< Offset: 0x004 ( /W)  Debug Core Register Selector Register */\r
1051   __IOM uint32_t DCRDR;                  /*!< Offset: 0x008 (R/W)  Debug Core Register Data Register */\r
1052   __IOM uint32_t DEMCR;                  /*!< Offset: 0x00C (R/W)  Debug Exception and Monitor Control Register */\r
1053 } CoreDebug_Type;\r
1054 \r
1055 /* Debug Halting Control and Status Register Definitions */\r
1056 #define CoreDebug_DHCSR_DBGKEY_Pos         16U                                            /*!< CoreDebug DHCSR: DBGKEY Position */\r
1057 #define CoreDebug_DHCSR_DBGKEY_Msk         (0xFFFFUL << CoreDebug_DHCSR_DBGKEY_Pos)       /*!< CoreDebug DHCSR: DBGKEY Mask */\r
1058 \r
1059 #define CoreDebug_DHCSR_S_RESTART_ST_Pos   26U                                            /*!< CoreDebug DHCSR: S_RESTART_ST Position */\r
1060 #define CoreDebug_DHCSR_S_RESTART_ST_Msk   (1UL << CoreDebug_DHCSR_S_RESTART_ST_Pos)      /*!< CoreDebug DHCSR: S_RESTART_ST Mask */\r
1061 \r
1062 #define CoreDebug_DHCSR_S_RESET_ST_Pos     25U                                            /*!< CoreDebug DHCSR: S_RESET_ST Position */\r
1063 #define CoreDebug_DHCSR_S_RESET_ST_Msk     (1UL << CoreDebug_DHCSR_S_RESET_ST_Pos)        /*!< CoreDebug DHCSR: S_RESET_ST Mask */\r
1064 \r
1065 #define CoreDebug_DHCSR_S_RETIRE_ST_Pos    24U                                            /*!< CoreDebug DHCSR: S_RETIRE_ST Position */\r
1066 #define CoreDebug_DHCSR_S_RETIRE_ST_Msk    (1UL << CoreDebug_DHCSR_S_RETIRE_ST_Pos)       /*!< CoreDebug DHCSR: S_RETIRE_ST Mask */\r
1067 \r
1068 #define CoreDebug_DHCSR_S_LOCKUP_Pos       19U                                            /*!< CoreDebug DHCSR: S_LOCKUP Position */\r
1069 #define CoreDebug_DHCSR_S_LOCKUP_Msk       (1UL << CoreDebug_DHCSR_S_LOCKUP_Pos)          /*!< CoreDebug DHCSR: S_LOCKUP Mask */\r
1070 \r
1071 #define CoreDebug_DHCSR_S_SLEEP_Pos        18U                                            /*!< CoreDebug DHCSR: S_SLEEP Position */\r
1072 #define CoreDebug_DHCSR_S_SLEEP_Msk        (1UL << CoreDebug_DHCSR_S_SLEEP_Pos)           /*!< CoreDebug DHCSR: S_SLEEP Mask */\r
1073 \r
1074 #define CoreDebug_DHCSR_S_HALT_Pos         17U                                            /*!< CoreDebug DHCSR: S_HALT Position */\r
1075 #define CoreDebug_DHCSR_S_HALT_Msk         (1UL << CoreDebug_DHCSR_S_HALT_Pos)            /*!< CoreDebug DHCSR: S_HALT Mask */\r
1076 \r
1077 #define CoreDebug_DHCSR_S_REGRDY_Pos       16U                                            /*!< CoreDebug DHCSR: S_REGRDY Position */\r
1078 #define CoreDebug_DHCSR_S_REGRDY_Msk       (1UL << CoreDebug_DHCSR_S_REGRDY_Pos)          /*!< CoreDebug DHCSR: S_REGRDY Mask */\r
1079 \r
1080 #define CoreDebug_DHCSR_C_MASKINTS_Pos      3U                                            /*!< CoreDebug DHCSR: C_MASKINTS Position */\r
1081 #define CoreDebug_DHCSR_C_MASKINTS_Msk     (1UL << CoreDebug_DHCSR_C_MASKINTS_Pos)        /*!< CoreDebug DHCSR: C_MASKINTS Mask */\r
1082 \r
1083 #define CoreDebug_DHCSR_C_STEP_Pos          2U                                            /*!< CoreDebug DHCSR: C_STEP Position */\r
1084 #define CoreDebug_DHCSR_C_STEP_Msk         (1UL << CoreDebug_DHCSR_C_STEP_Pos)            /*!< CoreDebug DHCSR: C_STEP Mask */\r
1085 \r
1086 #define CoreDebug_DHCSR_C_HALT_Pos          1U                                            /*!< CoreDebug DHCSR: C_HALT Position */\r
1087 #define CoreDebug_DHCSR_C_HALT_Msk         (1UL << CoreDebug_DHCSR_C_HALT_Pos)            /*!< CoreDebug DHCSR: C_HALT Mask */\r
1088 \r
1089 #define CoreDebug_DHCSR_C_DEBUGEN_Pos       0U                                            /*!< CoreDebug DHCSR: C_DEBUGEN Position */\r
1090 #define CoreDebug_DHCSR_C_DEBUGEN_Msk      (1UL /*<< CoreDebug_DHCSR_C_DEBUGEN_Pos*/)     /*!< CoreDebug DHCSR: C_DEBUGEN Mask */\r
1091 \r
1092 /* Debug Core Register Selector Register Definitions */\r
1093 #define CoreDebug_DCRSR_REGWnR_Pos         16U                                            /*!< CoreDebug DCRSR: REGWnR Position */\r
1094 #define CoreDebug_DCRSR_REGWnR_Msk         (1UL << CoreDebug_DCRSR_REGWnR_Pos)            /*!< CoreDebug DCRSR: REGWnR Mask */\r
1095 \r
1096 #define CoreDebug_DCRSR_REGSEL_Pos          0U                                            /*!< CoreDebug DCRSR: REGSEL Position */\r
1097 #define CoreDebug_DCRSR_REGSEL_Msk         (0x1FUL /*<< CoreDebug_DCRSR_REGSEL_Pos*/)     /*!< CoreDebug DCRSR: REGSEL Mask */\r
1098 \r
1099 /* Debug Exception and Monitor Control Register */\r
1100 #define CoreDebug_DEMCR_DWTENA_Pos         24U                                            /*!< CoreDebug DEMCR: DWTENA Position */\r
1101 #define CoreDebug_DEMCR_DWTENA_Msk         (1UL << CoreDebug_DEMCR_DWTENA_Pos)            /*!< CoreDebug DEMCR: DWTENA Mask */\r
1102 \r
1103 #define CoreDebug_DEMCR_VC_HARDERR_Pos     10U                                            /*!< CoreDebug DEMCR: VC_HARDERR Position */\r
1104 #define CoreDebug_DEMCR_VC_HARDERR_Msk     (1UL << CoreDebug_DEMCR_VC_HARDERR_Pos)        /*!< CoreDebug DEMCR: VC_HARDERR Mask */\r
1105 \r
1106 #define CoreDebug_DEMCR_VC_CORERESET_Pos    0U                                            /*!< CoreDebug DEMCR: VC_CORERESET Position */\r
1107 #define CoreDebug_DEMCR_VC_CORERESET_Msk   (1UL /*<< CoreDebug_DEMCR_VC_CORERESET_Pos*/)  /*!< CoreDebug DEMCR: VC_CORERESET Mask */\r
1108 \r
1109 /*@} end of group CMSIS_CoreDebug */\r
1110 \r
1111 \r
1112 /**\r
1113   \ingroup    CMSIS_core_register\r
1114   \defgroup   CMSIS_core_bitfield     Core register bit field macros\r
1115   \brief      Macros for use with bit field definitions (xxx_Pos, xxx_Msk).\r
1116   @{\r
1117  */\r
1118 \r
1119 /**\r
1120   \brief   Mask and shift a bit field value for use in a register bit range.\r
1121   \param[in] field  Name of the register bit field.\r
1122   \param[in] value  Value of the bit field. This parameter is interpreted as an uint32_t type.\r
1123   \return           Masked and shifted value.\r
1124 */\r
1125 #define _VAL2FLD(field, value)    (((uint32_t)(value) << field ## _Pos) & field ## _Msk)\r
1126 \r
1127 /**\r
1128   \brief     Mask and shift a register value to extract a bit filed value.\r
1129   \param[in] field  Name of the register bit field.\r
1130   \param[in] value  Value of register. This parameter is interpreted as an uint32_t type.\r
1131   \return           Masked and shifted bit field value.\r
1132 */\r
1133 #define _FLD2VAL(field, value)    (((uint32_t)(value) & field ## _Msk) >> field ## _Pos)\r
1134 \r
1135 /*@} end of group CMSIS_core_bitfield */\r
1136 \r
1137 \r
1138 /**\r
1139   \ingroup    CMSIS_core_register\r
1140   \defgroup   CMSIS_core_base     Core Definitions\r
1141   \brief      Definitions for base addresses, unions, and structures.\r
1142   @{\r
1143  */\r
1144 \r
1145 /* Memory mapping of ARMv8MBL Hardware */\r
1146   #define SCS_BASE            (0xE000E000UL)                             /*!< System Control Space Base Address */\r
1147   #define DWT_BASE            (0xE0001000UL)                             /*!< DWT Base Address */\r
1148   #define TPI_BASE            (0xE0040000UL)                             /*!< TPI Base Address */\r
1149   #define CoreDebug_BASE      (0xE000EDF0UL)                             /*!< Core Debug Base Address */\r
1150   #define SysTick_BASE        (SCS_BASE +  0x0010UL)                     /*!< SysTick Base Address */\r
1151   #define NVIC_BASE           (SCS_BASE +  0x0100UL)                     /*!< NVIC Base Address */\r
1152   #define SCB_BASE            (SCS_BASE +  0x0D00UL)                     /*!< System Control Block Base Address */\r
1153 \r
1154 \r
1155   #define SCB                 ((SCB_Type       *)     SCB_BASE         ) /*!< SCB configuration struct */\r
1156   #define SysTick             ((SysTick_Type   *)     SysTick_BASE     ) /*!< SysTick configuration struct */\r
1157   #define NVIC                ((NVIC_Type      *)     NVIC_BASE        ) /*!< NVIC configuration struct */\r
1158   #define DWT                 ((DWT_Type       *)     DWT_BASE         ) /*!< DWT configuration struct */\r
1159   #define TPI                 ((TPI_Type       *)     TPI_BASE         ) /*!< TPI configuration struct */\r
1160   #define CoreDebug           ((CoreDebug_Type *)     CoreDebug_BASE   ) /*!< Core Debug configuration struct */\r
1161 \r
1162   #if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U)\r
1163     #define MPU_BASE          (SCS_BASE +  0x0D90UL)                     /*!< Memory Protection Unit */\r
1164     #define MPU               ((MPU_Type       *)     MPU_BASE         ) /*!< Memory Protection Unit */\r
1165   #endif\r
1166 \r
1167   #if defined (__SAU_PRESENT) && (__SAU_PRESENT == 1U)\r
1168     #define SAU_BASE          (SCS_BASE +  0x0DD0UL)                     /*!< Security Attribution Unit */\r
1169     #define SAU               ((SAU_Type       *)     SAU_BASE         ) /*!< Security Attribution Unit */\r
1170   #endif\r
1171 \r
1172 #if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)\r
1173   #define SCS_BASE_NS         (0xE002E000UL)                             /*!< System Control Space Base Address (non-secuer address space) */\r
1174   #define CoreDebug_BASE_NS   (0xE002EDF0UL)                             /*!< Core Debug Base Address           (non-secuer address space) */\r
1175   #define SysTick_BASE_NS     (SCS_BASE_NS +  0x0010UL)                  /*!< SysTick Base Address              (non-secuer address space) */\r
1176   #define NVIC_BASE_NS        (SCS_BASE_NS +  0x0100UL)                  /*!< NVIC Base Address                 (non-secuer address space) */\r
1177   #define SCB_BASE_NS         (SCS_BASE_NS +  0x0D00UL)                  /*!< System Control Block Base Address (non-secuer address space) */\r
1178 \r
1179   #define SCB_NS              ((SCB_Type       *)     SCB_BASE_NS      ) /*!< SCB configuration struct          (non-secuer address space) */\r
1180   #define SysTick_NS          ((SysTick_Type   *)     SysTick_BASE_NS  ) /*!< SysTick configuration struct      (non-secuer address space) */\r
1181   #define NVIC_NS             ((NVIC_Type      *)     NVIC_BASE_NS     ) /*!< NVIC configuration struct         (non-secuer address space) */\r
1182   #define CoreDebug_NS        ((CoreDebug_Type *)     CoreDebug_BASE_NS) /*!< Core Debug configuration struct   (non-secuer address space) */\r
1183 \r
1184   #if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U)\r
1185     #define MPU_BASE_NS       (SCS_BASE_NS +  0x0D90UL)                  /*!< Memory Protection Unit            (non-secuer address space) */\r
1186     #define MPU_NS            ((MPU_Type       *)     MPU_BASE_NS      ) /*!< Memory Protection Unit            (non-secuer address space) */\r
1187   #endif\r
1188 \r
1189   #if defined (__SAU_PRESENT) && (__SAU_PRESENT == 1U)\r
1190     #define SAU_BASE_NS       (SCS_BASE_NS +  0x0DD0UL)                  /*!< Security Attribution Unit         (non-secuer address space) */\r
1191     #define SAU_NS            ((SAU_Type       *)     SAU_BASE_NS      ) /*!< Security Attribution Unit         (non-secuer address space) */\r
1192   #endif\r
1193 \r
1194 #endif /* defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */\r
1195 /*@} */\r
1196 \r
1197 \r
1198 \r
1199 /*******************************************************************************\r
1200  *                Hardware Abstraction Layer\r
1201   Core Function Interface contains:\r
1202   - Core NVIC Functions\r
1203   - Core SysTick Functions\r
1204   - Core Register Access Functions\r
1205  ******************************************************************************/\r
1206 /**\r
1207   \defgroup CMSIS_Core_FunctionInterface Functions and Instructions Reference\r
1208 */\r
1209 \r
1210 \r
1211 \r
1212 /* ##########################   NVIC functions  #################################### */\r
1213 /**\r
1214   \ingroup  CMSIS_Core_FunctionInterface\r
1215   \defgroup CMSIS_Core_NVICFunctions NVIC Functions\r
1216   \brief    Functions that manage interrupts and exceptions via the NVIC.\r
1217   @{\r
1218  */\r
1219 \r
1220 /* Interrupt Priorities are WORD accessible only under ARMv6M                   */\r
1221 /* The following MACROS handle generation of the register offset and byte masks */\r
1222 #define _BIT_SHIFT(IRQn)         (  ((((uint32_t)(int32_t)(IRQn))         )      &  0x03UL) * 8UL)\r
1223 #define _SHP_IDX(IRQn)           ( (((((uint32_t)(int32_t)(IRQn)) & 0x0FUL)-8UL) >>    2UL)      )\r
1224 #define _IP_IDX(IRQn)            (   (((uint32_t)(int32_t)(IRQn))                >>    2UL)      )\r
1225 \r
1226 \r
1227 /**\r
1228   \brief   Enable External Interrupt\r
1229   \details Enables a device-specific interrupt in the NVIC interrupt controller.\r
1230   \param [in]      IRQn  External interrupt number. Value cannot be negative.\r
1231  */\r
1232 __STATIC_INLINE void NVIC_EnableIRQ(IRQn_Type IRQn)\r
1233 {\r
1234   NVIC->ISER[(((uint32_t)(int32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL));\r
1235 }\r
1236 \r
1237 \r
1238 /**\r
1239   \brief   Disable External Interrupt\r
1240   \details Disables a device-specific interrupt in the NVIC interrupt controller.\r
1241   \param [in]      IRQn  External interrupt number. Value cannot be negative.\r
1242  */\r
1243 __STATIC_INLINE void NVIC_DisableIRQ(IRQn_Type IRQn)\r
1244 {\r
1245   NVIC->ICER[(((uint32_t)(int32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL));\r
1246 }\r
1247 \r
1248 \r
1249 /**\r
1250   \brief   Get Pending Interrupt\r
1251   \details Reads the pending register in the NVIC and returns the pending bit for the specified interrupt.\r
1252   \param [in]      IRQn  Interrupt number.\r
1253   \return             0  Interrupt status is not pending.\r
1254   \return             1  Interrupt status is pending.\r
1255  */\r
1256 __STATIC_INLINE uint32_t NVIC_GetPendingIRQ(IRQn_Type IRQn)\r
1257 {\r
1258   return((uint32_t)(((NVIC->ISPR[(((uint32_t)(int32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));\r
1259 }\r
1260 \r
1261 \r
1262 /**\r
1263   \brief   Set Pending Interrupt\r
1264   \details Sets the pending bit of an external interrupt.\r
1265   \param [in]      IRQn  Interrupt number. Value cannot be negative.\r
1266  */\r
1267 __STATIC_INLINE void NVIC_SetPendingIRQ(IRQn_Type IRQn)\r
1268 {\r
1269   NVIC->ISPR[(((uint32_t)(int32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL));\r
1270 }\r
1271 \r
1272 \r
1273 /**\r
1274   \brief   Clear Pending Interrupt\r
1275   \details Clears the pending bit of an external interrupt.\r
1276   \param [in]      IRQn  External interrupt number. Value cannot be negative.\r
1277  */\r
1278 __STATIC_INLINE void NVIC_ClearPendingIRQ(IRQn_Type IRQn)\r
1279 {\r
1280   NVIC->ICPR[(((uint32_t)(int32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL));\r
1281 }\r
1282 \r
1283 \r
1284 /**\r
1285   \brief   Get Active Interrupt\r
1286   \details Reads the active register in NVIC and returns the active bit.\r
1287   \param [in]      IRQn  Interrupt number.\r
1288   \return             0  Interrupt status is not active.\r
1289   \return             1  Interrupt status is active.\r
1290  */\r
1291 __STATIC_INLINE uint32_t NVIC_GetActive(IRQn_Type IRQn)\r
1292 {\r
1293   return ((uint32_t)(((NVIC->IABR[(((uint32_t)(int32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));\r
1294 }\r
1295 \r
1296 \r
1297 /**\r
1298   \brief   Get Interrupt Target State\r
1299   \details Reads the interrupt target field from the NVIC Interrupt Controller.\r
1300   \param [in]      IRQn  External interrupt number. Value cannot be negative.\r
1301   \return             0  if interrupt is assigned to Secure\r
1302   \return             1  if interrupt is assigned to Non Secure\r
1303  */\r
1304 __STATIC_INLINE uint32_t NVIC_GetTargetState(IRQn_Type IRQn)\r
1305 {\r
1306   return ((uint32_t)(((NVIC->ITNS[(((uint32_t)(int32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));\r
1307 }\r
1308 \r
1309 \r
1310 /**\r
1311   \brief   Set Interrupt Target State\r
1312   \details Sets the interrupt target field in the NVIC.\r
1313   \param [in]      IRQn  External interrupt number. Value cannot be negative.\r
1314   \return             0  if interrupt is assigned to Secure\r
1315                       1  if interrupt is assigned to Non Secure\r
1316  */\r
1317 __STATIC_INLINE uint32_t NVIC_SetTargetState(IRQn_Type IRQn)\r
1318 {\r
1319   NVIC->ITNS[(((uint32_t)(int32_t)IRQn) >> 5UL)] |=  ((uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL)));\r
1320   return ((uint32_t)(((NVIC->ITNS[(((uint32_t)(int32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));\r
1321 }\r
1322 \r
1323 \r
1324 /**\r
1325   \brief   Clear Interrupt Target State\r
1326   \details Clears the interrupt target field in the NVIC.\r
1327   \param [in]      IRQn  External interrupt number. Value cannot be negative.\r
1328   \return             0  if interrupt is assigned to Secure\r
1329                       1  if interrupt is assigned to Non Secure\r
1330  */\r
1331 __STATIC_INLINE uint32_t NVIC_ClearTargetState(IRQn_Type IRQn)\r
1332 {\r
1333   NVIC->ITNS[(((uint32_t)(int32_t)IRQn) >> 5UL)] &= ~((uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL)));\r
1334   return ((uint32_t)(((NVIC->ITNS[(((uint32_t)(int32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));\r
1335 }\r
1336 \r
1337 \r
1338 /**\r
1339   \brief   Set Interrupt Priority\r
1340   \details Sets the priority of an interrupt.\r
1341   \note    The priority cannot be set for every core interrupt.\r
1342   \param [in]      IRQn  Interrupt number.\r
1343   \param [in]  priority  Priority to set.\r
1344  */\r
1345 __STATIC_INLINE void NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority)\r
1346 {\r
1347   if ((int32_t)(IRQn) < 0)\r
1348   {\r
1349     SCB->SHP[_SHP_IDX(IRQn)] = ((uint32_t)(SCB->SHP[_SHP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) |\r
1350        (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn)));\r
1351   }\r
1352   else\r
1353   {\r
1354     NVIC->IP[_IP_IDX(IRQn)]  = ((uint32_t)(NVIC->IP[_IP_IDX(IRQn)]  & ~(0xFFUL << _BIT_SHIFT(IRQn))) |\r
1355        (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn)));\r
1356   }\r
1357 }\r
1358 \r
1359 \r
1360 /**\r
1361   \brief   Get Interrupt Priority\r
1362   \details Reads the priority of an interrupt.\r
1363            The interrupt number can be positive to specify an external (device specific) interrupt,\r
1364            or negative to specify an internal (core) interrupt.\r
1365   \param [in]   IRQn  Interrupt number.\r
1366   \return             Interrupt Priority.\r
1367                       Value is aligned automatically to the implemented priority bits of the microcontroller.\r
1368  */\r
1369 __STATIC_INLINE uint32_t NVIC_GetPriority(IRQn_Type IRQn)\r
1370 {\r
1371 \r
1372   if ((int32_t)(IRQn) < 0)\r
1373   {\r
1374     return((uint32_t)(((SCB->SHP[_SHP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS)));\r
1375   }\r
1376   else\r
1377   {\r
1378     return((uint32_t)(((NVIC->IP[ _IP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS)));\r
1379   }\r
1380 }\r
1381 \r
1382 \r
1383 /**\r
1384   \brief   System Reset\r
1385   \details Initiates a system reset request to reset the MCU.\r
1386  */\r
1387 __STATIC_INLINE void NVIC_SystemReset(void)\r
1388 {\r
1389   __DSB();                                                          /* Ensure all outstanding memory accesses included\r
1390                                                                        buffered write are completed before reset */\r
1391   SCB->AIRCR  = ((0x5FAUL << SCB_AIRCR_VECTKEY_Pos) |\r
1392                  SCB_AIRCR_SYSRESETREQ_Msk);\r
1393   __DSB();                                                          /* Ensure completion of memory access */\r
1394 \r
1395   for(;;)                                                           /* wait until reset */\r
1396   {\r
1397     __NOP();\r
1398   }\r
1399 }\r
1400 \r
1401 #if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)\r
1402 /**\r
1403   \brief   Enable External Interrupt (non-secure)\r
1404   \details Enables a device-specific interrupt in the non-secure NVIC when in secure state.\r
1405   \param [in]      IRQn  External interrupt number. Value cannot be negative.\r
1406  */\r
1407 __STATIC_INLINE void TZ_NVIC_EnableIRQ_NS(IRQn_Type IRQn)\r
1408 {\r
1409   NVIC_NS->ISER[(((uint32_t)(int32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL));\r
1410 }\r
1411 \r
1412 \r
1413 /**\r
1414   \brief   Disable External Interrupt (non-secure)\r
1415   \details Disables a device-specific interrupt in the non-secure NVIC when in secure state.\r
1416   \param [in]      IRQn  External interrupt number. Value cannot be negative.\r
1417  */\r
1418 __STATIC_INLINE void TZ_NVIC_DisableIRQ_NS(IRQn_Type IRQn)\r
1419 {\r
1420   NVIC_NS->ICER[(((uint32_t)(int32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL));\r
1421 }\r
1422 \r
1423 \r
1424 /**\r
1425   \brief   Get Pending Interrupt (non-secure)\r
1426   \details Reads the pending register in the non-secure NVIC when in secure state and returns the pending bit for the specified interrupt.\r
1427   \param [in]      IRQn  Interrupt number.\r
1428   \return             0  Interrupt status is not pending.\r
1429   \return             1  Interrupt status is pending.\r
1430  */\r
1431 __STATIC_INLINE uint32_t TZ_NVIC_GetPendingIRQ_NS(IRQn_Type IRQn)\r
1432 {\r
1433   return((uint32_t)(((NVIC_NS->ISPR[(((uint32_t)(int32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));\r
1434 }\r
1435 \r
1436 \r
1437 /**\r
1438   \brief   Set Pending Interrupt (non-secure)\r
1439   \details Sets the pending bit of an non-secure external interrupt when in secure state.\r
1440   \param [in]      IRQn  Interrupt number. Value cannot be negative.\r
1441  */\r
1442 __STATIC_INLINE void TZ_NVIC_SetPendingIRQ_NS(IRQn_Type IRQn)\r
1443 {\r
1444   NVIC_NS->ISPR[(((uint32_t)(int32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL));\r
1445 }\r
1446 \r
1447 \r
1448 /**\r
1449   \brief   Clear Pending Interrupt (non-secure)\r
1450   \details Clears the pending bit of an non-secure external interrupt when in secure state.\r
1451   \param [in]      IRQn  External interrupt number. Value cannot be negative.\r
1452  */\r
1453 __STATIC_INLINE void TZ_NVIC_ClearPendingIRQ_NS(IRQn_Type IRQn)\r
1454 {\r
1455   NVIC_NS->ICPR[(((uint32_t)(int32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL));\r
1456 }\r
1457 \r
1458 \r
1459 /**\r
1460   \brief   Get Active Interrupt (non-secure)\r
1461   \details Reads the active register in non-secure NVIC when in secure state and returns the active bit.\r
1462   \param [in]      IRQn  Interrupt number.\r
1463   \return             0  Interrupt status is not active.\r
1464   \return             1  Interrupt status is active.\r
1465  */\r
1466 __STATIC_INLINE uint32_t TZ_NVIC_GetActive_NS(IRQn_Type IRQn)\r
1467 {\r
1468   return ((uint32_t)(((NVIC_NS->IABR[(((uint32_t)(int32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));\r
1469 }\r
1470 \r
1471 \r
1472 /**\r
1473   \brief   Get Interrupt Target State (non-secure)\r
1474   \details Reads the interrupt target field from the non-secure NVIC when in secure state.\r
1475   \param [in]      IRQn  External interrupt number. Value cannot be negative.\r
1476   \return             0  if interrupt is assigned to Secure\r
1477   \return             1  if interrupt is assigned to Non Secure\r
1478  */\r
1479 __STATIC_INLINE uint32_t TZ_NVIC_GetTargetState_NS(IRQn_Type IRQn)\r
1480 {\r
1481   return ((uint32_t)(((NVIC_NS->ITNS[(((uint32_t)(int32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));\r
1482 }\r
1483 \r
1484 \r
1485 /**\r
1486   \brief   Set Interrupt Target State (non-secure)\r
1487   \details Sets the interrupt target field in the non-secure NVIC when in secure state.\r
1488   \param [in]      IRQn  External interrupt number. Value cannot be negative.\r
1489   \return             0  if interrupt is assigned to Secure\r
1490   \return             1  if interrupt is assigned to Non Secure\r
1491  */\r
1492 __STATIC_INLINE uint32_t TZ_NVIC_SetTargetState_NS(IRQn_Type IRQn)\r
1493 {\r
1494   NVIC_NS->ITNS[(((uint32_t)(int32_t)IRQn) >> 5UL)] |=  ((uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL)));\r
1495   return ((uint32_t)(((NVIC_NS->ITNS[(((uint32_t)(int32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));\r
1496 }\r
1497 \r
1498 \r
1499 /**\r
1500   \brief   Clear Interrupt Target State (non-secure)\r
1501   \details Clears the interrupt target field in the non-secure NVIC when in secure state.\r
1502   \param [in]      IRQn  External interrupt number. Value cannot be negative.\r
1503   \return             0  if interrupt is assigned to Secure\r
1504   \return             1  if interrupt is assigned to Non Secure\r
1505  */\r
1506 __STATIC_INLINE uint32_t TZ_NVIC_ClearTargetState_NS(IRQn_Type IRQn)\r
1507 {\r
1508   NVIC_NS->ITNS[(((uint32_t)(int32_t)IRQn) >> 5UL)] &= ~((uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL)));\r
1509   return ((uint32_t)(((NVIC_NS->ITNS[(((uint32_t)(int32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));\r
1510 }\r
1511 \r
1512 \r
1513 /**\r
1514   \brief   Set Interrupt Priority (non-secure)\r
1515   \details Sets the priority of an non-secure interrupt when in secure state.\r
1516   \note    The priority cannot be set for every core interrupt.\r
1517   \param [in]      IRQn  Interrupt number.\r
1518   \param [in]  priority  Priority to set.\r
1519  */\r
1520 __STATIC_INLINE void TZ_NVIC_SetPriority_NS(IRQn_Type IRQn, uint32_t priority)\r
1521 {\r
1522   if ((int32_t)(IRQn) < 0)\r
1523   {\r
1524     SCB_NS->SHP[_SHP_IDX(IRQn)] = ((uint32_t)(SCB_NS->SHP[_SHP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) |\r
1525        (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn)));\r
1526   }\r
1527   else\r
1528   {\r
1529     NVIC_NS->IP[_IP_IDX(IRQn)]  = ((uint32_t)(NVIC_NS->IP[_IP_IDX(IRQn)]  & ~(0xFFUL << _BIT_SHIFT(IRQn))) |\r
1530        (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn)));\r
1531   }\r
1532 }\r
1533 \r
1534 \r
1535 /**\r
1536   \brief   Get Interrupt Priority (non-secure)\r
1537   \details Reads the priority of an non-secure interrupt when in secure state.\r
1538            The interrupt number can be positive to specify an external (device specific) interrupt,\r
1539            or negative to specify an internal (core) interrupt.\r
1540   \param [in]   IRQn  Interrupt number.\r
1541   \return             Interrupt Priority. Value is aligned automatically to the implemented priority bits of the microcontroller.\r
1542  */\r
1543 __STATIC_INLINE uint32_t TZ_NVIC_GetPriority_NS(IRQn_Type IRQn)\r
1544 {\r
1545 \r
1546   if ((int32_t)(IRQn) < 0)\r
1547   {\r
1548     return((uint32_t)(((SCB_NS->SHP[_SHP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS)));\r
1549   }\r
1550   else\r
1551   {\r
1552     return((uint32_t)(((NVIC_NS->IP[ _IP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS)));\r
1553   }\r
1554 }\r
1555 #endif /*  defined (__ARM_FEATURE_CMSE) &&(__ARM_FEATURE_CMSE == 3U) */\r
1556 \r
1557 /*@} end of CMSIS_Core_NVICFunctions */\r
1558 \r
1559 \r
1560 /* ##########################  FPU functions  #################################### */\r
1561 /**\r
1562   \ingroup  CMSIS_Core_FunctionInterface\r
1563   \defgroup CMSIS_Core_FpuFunctions FPU Functions\r
1564   \brief    Function that provides FPU type.\r
1565   @{\r
1566  */\r
1567 \r
1568 /**\r
1569   \brief   get FPU type\r
1570   \details returns the FPU type\r
1571   \returns\r
1572    - \b  0: No FPU\r
1573    - \b  1: Single precision FPU\r
1574    - \b  2: Double + Single precision FPU\r
1575  */\r
1576 __STATIC_INLINE uint32_t SCB_GetFPUType(void)\r
1577 {\r
1578     return 0U;           /* No FPU */\r
1579 }\r
1580 \r
1581 \r
1582 /*@} end of CMSIS_Core_FpuFunctions */\r
1583 \r
1584 \r
1585 \r
1586 /* ##########################   SAU functions  #################################### */\r
1587 /**\r
1588   \ingroup  CMSIS_Core_FunctionInterface\r
1589   \defgroup CMSIS_Core_SAUFunctions SAU Functions\r
1590   \brief    Functions that configure the SAU.\r
1591   @{\r
1592  */\r
1593 \r
1594 #if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)\r
1595 \r
1596 /**\r
1597   \brief   Enable SAU\r
1598   \details Enables the Security Attribution Unit (SAU).\r
1599  */\r
1600 __STATIC_INLINE void TZ_SAU_Enable(void)\r
1601 {\r
1602 #if defined (__SAU_PRESENT) && (__SAU_PRESENT == 1U)\r
1603     SAU->CTRL |=  (SAU_CTRL_ENABLE_Msk);\r
1604 #endif\r
1605 }\r
1606 \r
1607 \r
1608 \r
1609 /**\r
1610   \brief   Disable SAU\r
1611   \details Disables the Security Attribution Unit (SAU).\r
1612  */\r
1613 __STATIC_INLINE void TZ_SAU_Disable(void)\r
1614 {\r
1615 #if defined (__SAU_PRESENT) && (__SAU_PRESENT == 1U)\r
1616     SAU->CTRL &= ~(SAU_CTRL_ENABLE_Msk);\r
1617 #endif\r
1618 }\r
1619 \r
1620 #endif /* defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */\r
1621 \r
1622 /*@} end of CMSIS_Core_SAUFunctions */\r
1623 \r
1624 \r
1625 \r
1626 \r
1627 /* ##################################    SysTick function  ############################################ */\r
1628 /**\r
1629   \ingroup  CMSIS_Core_FunctionInterface\r
1630   \defgroup CMSIS_Core_SysTickFunctions SysTick Functions\r
1631   \brief    Functions that configure the System.\r
1632   @{\r
1633  */\r
1634 \r
1635 #if defined (__Vendor_SysTickConfig) && (__Vendor_SysTickConfig == 0U)\r
1636 \r
1637 /**\r
1638   \brief   System Tick Configuration\r
1639   \details Initializes the System Timer and its interrupt, and starts the System Tick Timer.\r
1640            Counter is in free running mode to generate periodic interrupts.\r
1641   \param [in]  ticks  Number of ticks between two interrupts.\r
1642   \return          0  Function succeeded.\r
1643   \return          1  Function failed.\r
1644   \note    When the variable <b>__Vendor_SysTickConfig</b> is set to 1, then the\r
1645            function <b>SysTick_Config</b> is not included. In this case, the file <b><i>device</i>.h</b>\r
1646            must contain a vendor-specific implementation of this function.\r
1647  */\r
1648 __STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks)\r
1649 {\r
1650   if ((ticks - 1UL) > SysTick_LOAD_RELOAD_Msk)\r
1651   {\r
1652     return (1UL);                                                   /* Reload value impossible */\r
1653   }\r
1654 \r
1655   SysTick->LOAD  = (uint32_t)(ticks - 1UL);                         /* set reload register */\r
1656   NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */\r
1657   SysTick->VAL   = 0UL;                                             /* Load the SysTick Counter Value */\r
1658   SysTick->CTRL  = SysTick_CTRL_CLKSOURCE_Msk |\r
1659                    SysTick_CTRL_TICKINT_Msk   |\r
1660                    SysTick_CTRL_ENABLE_Msk;                         /* Enable SysTick IRQ and SysTick Timer */\r
1661   return (0UL);                                                     /* Function successful */\r
1662 }\r
1663 \r
1664 #if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)\r
1665 /**\r
1666   \brief   System Tick Configuration (non-secure)\r
1667   \details Initializes the non-secure System Timer and its interrupt when in secure state, and starts the System Tick Timer.\r
1668            Counter is in free running mode to generate periodic interrupts.\r
1669   \param [in]  ticks  Number of ticks between two interrupts.\r
1670   \return          0  Function succeeded.\r
1671   \return          1  Function failed.\r
1672   \note    When the variable <b>__Vendor_SysTickConfig</b> is set to 1, then the\r
1673            function <b>TZ_SysTick_Config_NS</b> is not included. In this case, the file <b><i>device</i>.h</b>\r
1674            must contain a vendor-specific implementation of this function.\r
1675 \r
1676  */\r
1677 __STATIC_INLINE uint32_t TZ_SysTick_Config_NS(uint32_t ticks)\r
1678 {\r
1679   if ((ticks - 1UL) > SysTick_LOAD_RELOAD_Msk)\r
1680   {\r
1681     return (1UL);                                                         /* Reload value impossible */\r
1682   }\r
1683 \r
1684   SysTick_NS->LOAD  = (uint32_t)(ticks - 1UL);                            /* set reload register */\r
1685   TZ_NVIC_SetPriority_NS (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */\r
1686   SysTick_NS->VAL   = 0UL;                                                /* Load the SysTick Counter Value */\r
1687   SysTick_NS->CTRL  = SysTick_CTRL_CLKSOURCE_Msk |\r
1688                       SysTick_CTRL_TICKINT_Msk   |\r
1689                       SysTick_CTRL_ENABLE_Msk;                            /* Enable SysTick IRQ and SysTick Timer */\r
1690   return (0UL);                                                           /* Function successful */\r
1691 }\r
1692 #endif /* defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */\r
1693 \r
1694 #endif\r
1695 \r
1696 /*@} end of CMSIS_Core_SysTickFunctions */\r
1697 \r
1698 \r
1699 \r
1700 \r
1701 #ifdef __cplusplus\r
1702 }\r
1703 #endif\r
1704 \r
1705 #endif /* __CORE_ARMV8MBL_H_DEPENDANT */\r
1706 \r
1707 #endif /* __CMSIS_GENERIC */\r