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