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