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