File indexing completed on 2025-05-11 08:23:02
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025 #if defined ( __ICCARM__ )
0026 #pragma system_include
0027 #elif defined (__clang__)
0028 #pragma clang system_header
0029 #endif
0030
0031 #ifndef __CORE_CM4_H_GENERIC
0032 #define __CORE_CM4_H_GENERIC
0033
0034 #include <stdint.h>
0035
0036 #ifdef __cplusplus
0037 extern "C" {
0038 #endif
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060
0061
0062
0063 #include "cmsis_version.h"
0064
0065
0066 #define __CM4_CMSIS_VERSION_MAIN (__CM_CMSIS_VERSION_MAIN)
0067 #define __CM4_CMSIS_VERSION_SUB (__CM_CMSIS_VERSION_SUB)
0068 #define __CM4_CMSIS_VERSION ((__CM4_CMSIS_VERSION_MAIN << 16U) | \
0069 __CM4_CMSIS_VERSION_SUB )
0070
0071 #define __CORTEX_M (4U)
0072
0073
0074
0075
0076 #if defined ( __CC_ARM )
0077 #if defined __TARGET_FPU_VFP
0078 #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)
0079 #define __FPU_USED 1U
0080 #else
0081 #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
0082 #define __FPU_USED 0U
0083 #endif
0084 #else
0085 #define __FPU_USED 0U
0086 #endif
0087
0088 #elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
0089 #if defined __ARM_FP
0090 #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)
0091 #define __FPU_USED 1U
0092 #else
0093 #warning "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
0094 #define __FPU_USED 0U
0095 #endif
0096 #else
0097 #define __FPU_USED 0U
0098 #endif
0099
0100 #elif defined (__ti__)
0101 #if defined (__ARM_FP)
0102 #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)
0103 #define __FPU_USED 1U
0104 #else
0105 #warning "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
0106 #define __FPU_USED 0U
0107 #endif
0108 #else
0109 #define __FPU_USED 0U
0110 #endif
0111
0112 #elif defined ( __GNUC__ )
0113 #if defined (__VFP_FP__) && !defined(__SOFTFP__)
0114 #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)
0115 #define __FPU_USED 1U
0116 #else
0117 #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
0118 #define __FPU_USED 0U
0119 #endif
0120 #else
0121 #define __FPU_USED 0U
0122 #endif
0123
0124 #elif defined ( __ICCARM__ )
0125 #if defined __ARMVFP__
0126 #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)
0127 #define __FPU_USED 1U
0128 #else
0129 #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
0130 #define __FPU_USED 0U
0131 #endif
0132 #else
0133 #define __FPU_USED 0U
0134 #endif
0135
0136 #elif defined ( __TI_ARM__ )
0137 #if defined __TI_VFP_SUPPORT__
0138 #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)
0139 #define __FPU_USED 1U
0140 #else
0141 #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
0142 #define __FPU_USED 0U
0143 #endif
0144 #else
0145 #define __FPU_USED 0U
0146 #endif
0147
0148 #elif defined ( __TASKING__ )
0149 #if defined __FPU_VFP__
0150 #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)
0151 #define __FPU_USED 1U
0152 #else
0153 #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
0154 #define __FPU_USED 0U
0155 #endif
0156 #else
0157 #define __FPU_USED 0U
0158 #endif
0159
0160 #elif defined ( __CSMC__ )
0161 #if ( __CSMC__ & 0x400U)
0162 #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)
0163 #define __FPU_USED 1U
0164 #else
0165 #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
0166 #define __FPU_USED 0U
0167 #endif
0168 #else
0169 #define __FPU_USED 0U
0170 #endif
0171
0172 #endif
0173
0174 #include "cmsis_compiler.h" /* CMSIS compiler specific defines */
0175
0176
0177 #ifdef __cplusplus
0178 }
0179 #endif
0180
0181 #endif
0182
0183 #ifndef __CMSIS_GENERIC
0184
0185 #ifndef __CORE_CM4_H_DEPENDANT
0186 #define __CORE_CM4_H_DEPENDANT
0187
0188 #ifdef __cplusplus
0189 extern "C" {
0190 #endif
0191
0192
0193 #if defined __CHECK_DEVICE_DEFINES
0194 #ifndef __CM4_REV
0195 #define __CM4_REV 0x0000U
0196 #warning "__CM4_REV not defined in device header file; using default!"
0197 #endif
0198
0199 #ifndef __FPU_PRESENT
0200 #define __FPU_PRESENT 0U
0201 #warning "__FPU_PRESENT not defined in device header file; using default!"
0202 #endif
0203
0204 #ifndef __MPU_PRESENT
0205 #define __MPU_PRESENT 0U
0206 #warning "__MPU_PRESENT not defined in device header file; using default!"
0207 #endif
0208
0209 #ifndef __VTOR_PRESENT
0210 #define __VTOR_PRESENT 1U
0211 #warning "__VTOR_PRESENT not defined in device header file; using default!"
0212 #endif
0213
0214 #ifndef __NVIC_PRIO_BITS
0215 #define __NVIC_PRIO_BITS 3U
0216 #warning "__NVIC_PRIO_BITS not defined in device header file; using default!"
0217 #endif
0218
0219 #ifndef __Vendor_SysTickConfig
0220 #define __Vendor_SysTickConfig 0U
0221 #warning "__Vendor_SysTickConfig not defined in device header file; using default!"
0222 #endif
0223 #endif
0224
0225
0226
0227
0228
0229
0230
0231
0232
0233 #ifdef __cplusplus
0234 #define __I volatile
0235 #else
0236 #define __I volatile const
0237 #endif
0238 #define __O volatile
0239 #define __IO volatile
0240
0241
0242 #define __IM volatile const
0243 #define __OM volatile
0244 #define __IOM volatile
0245
0246
0247
0248
0249
0250
0251
0252
0253
0254
0255
0256
0257
0258
0259
0260
0261
0262
0263
0264
0265
0266
0267
0268
0269
0270
0271
0272
0273
0274
0275
0276 typedef union
0277 {
0278 struct
0279 {
0280 uint32_t _reserved0:16;
0281 uint32_t GE:4;
0282 uint32_t _reserved1:7;
0283 uint32_t Q:1;
0284 uint32_t V:1;
0285 uint32_t C:1;
0286 uint32_t Z:1;
0287 uint32_t N:1;
0288 } b;
0289 uint32_t w;
0290 } APSR_Type;
0291
0292
0293 #define APSR_N_Pos 31U
0294 #define APSR_N_Msk (1UL << APSR_N_Pos)
0295
0296 #define APSR_Z_Pos 30U
0297 #define APSR_Z_Msk (1UL << APSR_Z_Pos)
0298
0299 #define APSR_C_Pos 29U
0300 #define APSR_C_Msk (1UL << APSR_C_Pos)
0301
0302 #define APSR_V_Pos 28U
0303 #define APSR_V_Msk (1UL << APSR_V_Pos)
0304
0305 #define APSR_Q_Pos 27U
0306 #define APSR_Q_Msk (1UL << APSR_Q_Pos)
0307
0308 #define APSR_GE_Pos 16U
0309 #define APSR_GE_Msk (0xFUL << APSR_GE_Pos)
0310
0311
0312
0313
0314
0315 typedef union
0316 {
0317 struct
0318 {
0319 uint32_t ISR:9;
0320 uint32_t _reserved0:23;
0321 } b;
0322 uint32_t w;
0323 } IPSR_Type;
0324
0325
0326 #define IPSR_ISR_Pos 0U
0327 #define IPSR_ISR_Msk (0x1FFUL )
0328
0329
0330
0331
0332
0333 typedef union
0334 {
0335 struct
0336 {
0337 uint32_t ISR:9;
0338 uint32_t _reserved0:1;
0339 uint32_t ICI_IT_1:6;
0340 uint32_t GE:4;
0341 uint32_t _reserved1:4;
0342 uint32_t T:1;
0343 uint32_t ICI_IT_2:2;
0344 uint32_t Q:1;
0345 uint32_t V:1;
0346 uint32_t C:1;
0347 uint32_t Z:1;
0348 uint32_t N:1;
0349 } b;
0350 uint32_t w;
0351 } xPSR_Type;
0352
0353
0354 #define xPSR_N_Pos 31U
0355 #define xPSR_N_Msk (1UL << xPSR_N_Pos)
0356
0357 #define xPSR_Z_Pos 30U
0358 #define xPSR_Z_Msk (1UL << xPSR_Z_Pos)
0359
0360 #define xPSR_C_Pos 29U
0361 #define xPSR_C_Msk (1UL << xPSR_C_Pos)
0362
0363 #define xPSR_V_Pos 28U
0364 #define xPSR_V_Msk (1UL << xPSR_V_Pos)
0365
0366 #define xPSR_Q_Pos 27U
0367 #define xPSR_Q_Msk (1UL << xPSR_Q_Pos)
0368
0369 #define xPSR_ICI_IT_2_Pos 25U
0370 #define xPSR_ICI_IT_2_Msk (3UL << xPSR_ICI_IT_2_Pos)
0371
0372 #define xPSR_T_Pos 24U
0373 #define xPSR_T_Msk (1UL << xPSR_T_Pos)
0374
0375 #define xPSR_GE_Pos 16U
0376 #define xPSR_GE_Msk (0xFUL << xPSR_GE_Pos)
0377
0378 #define xPSR_ICI_IT_1_Pos 10U
0379 #define xPSR_ICI_IT_1_Msk (0x3FUL << xPSR_ICI_IT_1_Pos)
0380
0381 #define xPSR_ISR_Pos 0U
0382 #define xPSR_ISR_Msk (0x1FFUL )
0383
0384
0385
0386
0387
0388 typedef union
0389 {
0390 struct
0391 {
0392 uint32_t nPRIV:1;
0393 uint32_t SPSEL:1;
0394 uint32_t FPCA:1;
0395 uint32_t _reserved0:29;
0396 } b;
0397 uint32_t w;
0398 } CONTROL_Type;
0399
0400
0401 #define CONTROL_FPCA_Pos 2U
0402 #define CONTROL_FPCA_Msk (1UL << CONTROL_FPCA_Pos)
0403
0404 #define CONTROL_SPSEL_Pos 1U
0405 #define CONTROL_SPSEL_Msk (1UL << CONTROL_SPSEL_Pos)
0406
0407 #define CONTROL_nPRIV_Pos 0U
0408 #define CONTROL_nPRIV_Msk (1UL )
0409
0410
0411
0412
0413
0414
0415
0416
0417
0418
0419
0420
0421
0422
0423 typedef struct
0424 {
0425 __IOM uint32_t ISER[8U];
0426 uint32_t RESERVED0[24U];
0427 __IOM uint32_t ICER[8U];
0428 uint32_t RESERVED1[24U];
0429 __IOM uint32_t ISPR[8U];
0430 uint32_t RESERVED2[24U];
0431 __IOM uint32_t ICPR[8U];
0432 uint32_t RESERVED3[24U];
0433 __IOM uint32_t IABR[8U];
0434 uint32_t RESERVED4[56U];
0435 __IOM uint8_t IP[240U];
0436 uint32_t RESERVED5[644U];
0437 __OM uint32_t STIR;
0438 } NVIC_Type;
0439
0440
0441 #define NVIC_STIR_INTID_Pos 0U
0442 #define NVIC_STIR_INTID_Msk (0x1FFUL )
0443
0444
0445
0446
0447
0448
0449
0450
0451
0452
0453
0454
0455
0456
0457 typedef struct
0458 {
0459 __IM uint32_t CPUID;
0460 __IOM uint32_t ICSR;
0461 __IOM uint32_t VTOR;
0462 __IOM uint32_t AIRCR;
0463 __IOM uint32_t SCR;
0464 __IOM uint32_t CCR;
0465 __IOM uint8_t SHP[12U];
0466 __IOM uint32_t SHCSR;
0467 __IOM uint32_t CFSR;
0468 __IOM uint32_t HFSR;
0469 __IOM uint32_t DFSR;
0470 __IOM uint32_t MMFAR;
0471 __IOM uint32_t BFAR;
0472 __IOM uint32_t AFSR;
0473 __IM uint32_t PFR[2U];
0474 __IM uint32_t DFR;
0475 __IM uint32_t ADR;
0476 __IM uint32_t MMFR[4U];
0477 __IM uint32_t ISAR[5U];
0478 uint32_t RESERVED0[5U];
0479 __IOM uint32_t CPACR;
0480 } SCB_Type;
0481
0482
0483 #define SCB_CPUID_IMPLEMENTER_Pos 24U
0484 #define SCB_CPUID_IMPLEMENTER_Msk (0xFFUL << SCB_CPUID_IMPLEMENTER_Pos)
0485
0486 #define SCB_CPUID_VARIANT_Pos 20U
0487 #define SCB_CPUID_VARIANT_Msk (0xFUL << SCB_CPUID_VARIANT_Pos)
0488
0489 #define SCB_CPUID_ARCHITECTURE_Pos 16U
0490 #define SCB_CPUID_ARCHITECTURE_Msk (0xFUL << SCB_CPUID_ARCHITECTURE_Pos)
0491
0492 #define SCB_CPUID_PARTNO_Pos 4U
0493 #define SCB_CPUID_PARTNO_Msk (0xFFFUL << SCB_CPUID_PARTNO_Pos)
0494
0495 #define SCB_CPUID_REVISION_Pos 0U
0496 #define SCB_CPUID_REVISION_Msk (0xFUL )
0497
0498
0499 #define SCB_ICSR_NMIPENDSET_Pos 31U
0500 #define SCB_ICSR_NMIPENDSET_Msk (1UL << SCB_ICSR_NMIPENDSET_Pos)
0501
0502 #define SCB_ICSR_PENDSVSET_Pos 28U
0503 #define SCB_ICSR_PENDSVSET_Msk (1UL << SCB_ICSR_PENDSVSET_Pos)
0504
0505 #define SCB_ICSR_PENDSVCLR_Pos 27U
0506 #define SCB_ICSR_PENDSVCLR_Msk (1UL << SCB_ICSR_PENDSVCLR_Pos)
0507
0508 #define SCB_ICSR_PENDSTSET_Pos 26U
0509 #define SCB_ICSR_PENDSTSET_Msk (1UL << SCB_ICSR_PENDSTSET_Pos)
0510
0511 #define SCB_ICSR_PENDSTCLR_Pos 25U
0512 #define SCB_ICSR_PENDSTCLR_Msk (1UL << SCB_ICSR_PENDSTCLR_Pos)
0513
0514 #define SCB_ICSR_ISRPREEMPT_Pos 23U
0515 #define SCB_ICSR_ISRPREEMPT_Msk (1UL << SCB_ICSR_ISRPREEMPT_Pos)
0516
0517 #define SCB_ICSR_ISRPENDING_Pos 22U
0518 #define SCB_ICSR_ISRPENDING_Msk (1UL << SCB_ICSR_ISRPENDING_Pos)
0519
0520 #define SCB_ICSR_VECTPENDING_Pos 12U
0521 #define SCB_ICSR_VECTPENDING_Msk (0x1FFUL << SCB_ICSR_VECTPENDING_Pos)
0522
0523 #define SCB_ICSR_RETTOBASE_Pos 11U
0524 #define SCB_ICSR_RETTOBASE_Msk (1UL << SCB_ICSR_RETTOBASE_Pos)
0525
0526 #define SCB_ICSR_VECTACTIVE_Pos 0U
0527 #define SCB_ICSR_VECTACTIVE_Msk (0x1FFUL )
0528
0529
0530 #define SCB_VTOR_TBLOFF_Pos 7U
0531 #define SCB_VTOR_TBLOFF_Msk (0x1FFFFFFUL << SCB_VTOR_TBLOFF_Pos)
0532
0533
0534 #define SCB_AIRCR_VECTKEY_Pos 16U
0535 #define SCB_AIRCR_VECTKEY_Msk (0xFFFFUL << SCB_AIRCR_VECTKEY_Pos)
0536
0537 #define SCB_AIRCR_VECTKEYSTAT_Pos 16U
0538 #define SCB_AIRCR_VECTKEYSTAT_Msk (0xFFFFUL << SCB_AIRCR_VECTKEYSTAT_Pos)
0539
0540 #define SCB_AIRCR_ENDIANESS_Pos 15U
0541 #define SCB_AIRCR_ENDIANESS_Msk (1UL << SCB_AIRCR_ENDIANESS_Pos)
0542
0543 #define SCB_AIRCR_PRIGROUP_Pos 8U
0544 #define SCB_AIRCR_PRIGROUP_Msk (7UL << SCB_AIRCR_PRIGROUP_Pos)
0545
0546 #define SCB_AIRCR_SYSRESETREQ_Pos 2U
0547 #define SCB_AIRCR_SYSRESETREQ_Msk (1UL << SCB_AIRCR_SYSRESETREQ_Pos)
0548
0549 #define SCB_AIRCR_VECTCLRACTIVE_Pos 1U
0550 #define SCB_AIRCR_VECTCLRACTIVE_Msk (1UL << SCB_AIRCR_VECTCLRACTIVE_Pos)
0551
0552 #define SCB_AIRCR_VECTRESET_Pos 0U
0553 #define SCB_AIRCR_VECTRESET_Msk (1UL )
0554
0555
0556 #define SCB_SCR_SEVONPEND_Pos 4U
0557 #define SCB_SCR_SEVONPEND_Msk (1UL << SCB_SCR_SEVONPEND_Pos)
0558
0559 #define SCB_SCR_SLEEPDEEP_Pos 2U
0560 #define SCB_SCR_SLEEPDEEP_Msk (1UL << SCB_SCR_SLEEPDEEP_Pos)
0561
0562 #define SCB_SCR_SLEEPONEXIT_Pos 1U
0563 #define SCB_SCR_SLEEPONEXIT_Msk (1UL << SCB_SCR_SLEEPONEXIT_Pos)
0564
0565
0566 #define SCB_CCR_STKALIGN_Pos 9U
0567 #define SCB_CCR_STKALIGN_Msk (1UL << SCB_CCR_STKALIGN_Pos)
0568
0569 #define SCB_CCR_BFHFNMIGN_Pos 8U
0570 #define SCB_CCR_BFHFNMIGN_Msk (1UL << SCB_CCR_BFHFNMIGN_Pos)
0571
0572 #define SCB_CCR_DIV_0_TRP_Pos 4U
0573 #define SCB_CCR_DIV_0_TRP_Msk (1UL << SCB_CCR_DIV_0_TRP_Pos)
0574
0575 #define SCB_CCR_UNALIGN_TRP_Pos 3U
0576 #define SCB_CCR_UNALIGN_TRP_Msk (1UL << SCB_CCR_UNALIGN_TRP_Pos)
0577
0578 #define SCB_CCR_USERSETMPEND_Pos 1U
0579 #define SCB_CCR_USERSETMPEND_Msk (1UL << SCB_CCR_USERSETMPEND_Pos)
0580
0581 #define SCB_CCR_NONBASETHRDENA_Pos 0U
0582 #define SCB_CCR_NONBASETHRDENA_Msk (1UL )
0583
0584
0585 #define SCB_SHCSR_USGFAULTENA_Pos 18U
0586 #define SCB_SHCSR_USGFAULTENA_Msk (1UL << SCB_SHCSR_USGFAULTENA_Pos)
0587
0588 #define SCB_SHCSR_BUSFAULTENA_Pos 17U
0589 #define SCB_SHCSR_BUSFAULTENA_Msk (1UL << SCB_SHCSR_BUSFAULTENA_Pos)
0590
0591 #define SCB_SHCSR_MEMFAULTENA_Pos 16U
0592 #define SCB_SHCSR_MEMFAULTENA_Msk (1UL << SCB_SHCSR_MEMFAULTENA_Pos)
0593
0594 #define SCB_SHCSR_SVCALLPENDED_Pos 15U
0595 #define SCB_SHCSR_SVCALLPENDED_Msk (1UL << SCB_SHCSR_SVCALLPENDED_Pos)
0596
0597 #define SCB_SHCSR_BUSFAULTPENDED_Pos 14U
0598 #define SCB_SHCSR_BUSFAULTPENDED_Msk (1UL << SCB_SHCSR_BUSFAULTPENDED_Pos)
0599
0600 #define SCB_SHCSR_MEMFAULTPENDED_Pos 13U
0601 #define SCB_SHCSR_MEMFAULTPENDED_Msk (1UL << SCB_SHCSR_MEMFAULTPENDED_Pos)
0602
0603 #define SCB_SHCSR_USGFAULTPENDED_Pos 12U
0604 #define SCB_SHCSR_USGFAULTPENDED_Msk (1UL << SCB_SHCSR_USGFAULTPENDED_Pos)
0605
0606 #define SCB_SHCSR_SYSTICKACT_Pos 11U
0607 #define SCB_SHCSR_SYSTICKACT_Msk (1UL << SCB_SHCSR_SYSTICKACT_Pos)
0608
0609 #define SCB_SHCSR_PENDSVACT_Pos 10U
0610 #define SCB_SHCSR_PENDSVACT_Msk (1UL << SCB_SHCSR_PENDSVACT_Pos)
0611
0612 #define SCB_SHCSR_MONITORACT_Pos 8U
0613 #define SCB_SHCSR_MONITORACT_Msk (1UL << SCB_SHCSR_MONITORACT_Pos)
0614
0615 #define SCB_SHCSR_SVCALLACT_Pos 7U
0616 #define SCB_SHCSR_SVCALLACT_Msk (1UL << SCB_SHCSR_SVCALLACT_Pos)
0617
0618 #define SCB_SHCSR_USGFAULTACT_Pos 3U
0619 #define SCB_SHCSR_USGFAULTACT_Msk (1UL << SCB_SHCSR_USGFAULTACT_Pos)
0620
0621 #define SCB_SHCSR_BUSFAULTACT_Pos 1U
0622 #define SCB_SHCSR_BUSFAULTACT_Msk (1UL << SCB_SHCSR_BUSFAULTACT_Pos)
0623
0624 #define SCB_SHCSR_MEMFAULTACT_Pos 0U
0625 #define SCB_SHCSR_MEMFAULTACT_Msk (1UL )
0626
0627
0628 #define SCB_CFSR_USGFAULTSR_Pos 16U
0629 #define SCB_CFSR_USGFAULTSR_Msk (0xFFFFUL << SCB_CFSR_USGFAULTSR_Pos)
0630
0631 #define SCB_CFSR_BUSFAULTSR_Pos 8U
0632 #define SCB_CFSR_BUSFAULTSR_Msk (0xFFUL << SCB_CFSR_BUSFAULTSR_Pos)
0633
0634 #define SCB_CFSR_MEMFAULTSR_Pos 0U
0635 #define SCB_CFSR_MEMFAULTSR_Msk (0xFFUL )
0636
0637
0638 #define SCB_CFSR_MMARVALID_Pos (SCB_CFSR_MEMFAULTSR_Pos + 7U)
0639 #define SCB_CFSR_MMARVALID_Msk (1UL << SCB_CFSR_MMARVALID_Pos)
0640
0641 #define SCB_CFSR_MLSPERR_Pos (SCB_CFSR_MEMFAULTSR_Pos + 5U)
0642 #define SCB_CFSR_MLSPERR_Msk (1UL << SCB_CFSR_MLSPERR_Pos)
0643
0644 #define SCB_CFSR_MSTKERR_Pos (SCB_CFSR_MEMFAULTSR_Pos + 4U)
0645 #define SCB_CFSR_MSTKERR_Msk (1UL << SCB_CFSR_MSTKERR_Pos)
0646
0647 #define SCB_CFSR_MUNSTKERR_Pos (SCB_CFSR_MEMFAULTSR_Pos + 3U)
0648 #define SCB_CFSR_MUNSTKERR_Msk (1UL << SCB_CFSR_MUNSTKERR_Pos)
0649
0650 #define SCB_CFSR_DACCVIOL_Pos (SCB_CFSR_MEMFAULTSR_Pos + 1U)
0651 #define SCB_CFSR_DACCVIOL_Msk (1UL << SCB_CFSR_DACCVIOL_Pos)
0652
0653 #define SCB_CFSR_IACCVIOL_Pos (SCB_CFSR_MEMFAULTSR_Pos + 0U)
0654 #define SCB_CFSR_IACCVIOL_Msk (1UL )
0655
0656
0657 #define SCB_CFSR_BFARVALID_Pos (SCB_CFSR_BUSFAULTSR_Pos + 7U)
0658 #define SCB_CFSR_BFARVALID_Msk (1UL << SCB_CFSR_BFARVALID_Pos)
0659
0660 #define SCB_CFSR_LSPERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 5U)
0661 #define SCB_CFSR_LSPERR_Msk (1UL << SCB_CFSR_LSPERR_Pos)
0662
0663 #define SCB_CFSR_STKERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 4U)
0664 #define SCB_CFSR_STKERR_Msk (1UL << SCB_CFSR_STKERR_Pos)
0665
0666 #define SCB_CFSR_UNSTKERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 3U)
0667 #define SCB_CFSR_UNSTKERR_Msk (1UL << SCB_CFSR_UNSTKERR_Pos)
0668
0669 #define SCB_CFSR_IMPRECISERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 2U)
0670 #define SCB_CFSR_IMPRECISERR_Msk (1UL << SCB_CFSR_IMPRECISERR_Pos)
0671
0672 #define SCB_CFSR_PRECISERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 1U)
0673 #define SCB_CFSR_PRECISERR_Msk (1UL << SCB_CFSR_PRECISERR_Pos)
0674
0675 #define SCB_CFSR_IBUSERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 0U)
0676 #define SCB_CFSR_IBUSERR_Msk (1UL << SCB_CFSR_IBUSERR_Pos)
0677
0678
0679 #define SCB_CFSR_DIVBYZERO_Pos (SCB_CFSR_USGFAULTSR_Pos + 9U)
0680 #define SCB_CFSR_DIVBYZERO_Msk (1UL << SCB_CFSR_DIVBYZERO_Pos)
0681
0682 #define SCB_CFSR_UNALIGNED_Pos (SCB_CFSR_USGFAULTSR_Pos + 8U)
0683 #define SCB_CFSR_UNALIGNED_Msk (1UL << SCB_CFSR_UNALIGNED_Pos)
0684
0685 #define SCB_CFSR_NOCP_Pos (SCB_CFSR_USGFAULTSR_Pos + 3U)
0686 #define SCB_CFSR_NOCP_Msk (1UL << SCB_CFSR_NOCP_Pos)
0687
0688 #define SCB_CFSR_INVPC_Pos (SCB_CFSR_USGFAULTSR_Pos + 2U)
0689 #define SCB_CFSR_INVPC_Msk (1UL << SCB_CFSR_INVPC_Pos)
0690
0691 #define SCB_CFSR_INVSTATE_Pos (SCB_CFSR_USGFAULTSR_Pos + 1U)
0692 #define SCB_CFSR_INVSTATE_Msk (1UL << SCB_CFSR_INVSTATE_Pos)
0693
0694 #define SCB_CFSR_UNDEFINSTR_Pos (SCB_CFSR_USGFAULTSR_Pos + 0U)
0695 #define SCB_CFSR_UNDEFINSTR_Msk (1UL << SCB_CFSR_UNDEFINSTR_Pos)
0696
0697
0698 #define SCB_HFSR_DEBUGEVT_Pos 31U
0699 #define SCB_HFSR_DEBUGEVT_Msk (1UL << SCB_HFSR_DEBUGEVT_Pos)
0700
0701 #define SCB_HFSR_FORCED_Pos 30U
0702 #define SCB_HFSR_FORCED_Msk (1UL << SCB_HFSR_FORCED_Pos)
0703
0704 #define SCB_HFSR_VECTTBL_Pos 1U
0705 #define SCB_HFSR_VECTTBL_Msk (1UL << SCB_HFSR_VECTTBL_Pos)
0706
0707
0708 #define SCB_DFSR_EXTERNAL_Pos 4U
0709 #define SCB_DFSR_EXTERNAL_Msk (1UL << SCB_DFSR_EXTERNAL_Pos)
0710
0711 #define SCB_DFSR_VCATCH_Pos 3U
0712 #define SCB_DFSR_VCATCH_Msk (1UL << SCB_DFSR_VCATCH_Pos)
0713
0714 #define SCB_DFSR_DWTTRAP_Pos 2U
0715 #define SCB_DFSR_DWTTRAP_Msk (1UL << SCB_DFSR_DWTTRAP_Pos)
0716
0717 #define SCB_DFSR_BKPT_Pos 1U
0718 #define SCB_DFSR_BKPT_Msk (1UL << SCB_DFSR_BKPT_Pos)
0719
0720 #define SCB_DFSR_HALTED_Pos 0U
0721 #define SCB_DFSR_HALTED_Msk (1UL )
0722
0723
0724
0725
0726
0727
0728
0729
0730
0731
0732
0733
0734
0735
0736 typedef struct
0737 {
0738 uint32_t RESERVED0[1U];
0739 __IM uint32_t ICTR;
0740 __IOM uint32_t ACTLR;
0741 } SCnSCB_Type;
0742
0743
0744 #define SCnSCB_ICTR_INTLINESNUM_Pos 0U
0745 #define SCnSCB_ICTR_INTLINESNUM_Msk (0xFUL )
0746
0747
0748 #define SCnSCB_ACTLR_DISOOFP_Pos 9U
0749 #define SCnSCB_ACTLR_DISOOFP_Msk (1UL << SCnSCB_ACTLR_DISOOFP_Pos)
0750
0751 #define SCnSCB_ACTLR_DISFPCA_Pos 8U
0752 #define SCnSCB_ACTLR_DISFPCA_Msk (1UL << SCnSCB_ACTLR_DISFPCA_Pos)
0753
0754 #define SCnSCB_ACTLR_DISFOLD_Pos 2U
0755 #define SCnSCB_ACTLR_DISFOLD_Msk (1UL << SCnSCB_ACTLR_DISFOLD_Pos)
0756
0757 #define SCnSCB_ACTLR_DISDEFWBUF_Pos 1U
0758 #define SCnSCB_ACTLR_DISDEFWBUF_Msk (1UL << SCnSCB_ACTLR_DISDEFWBUF_Pos)
0759
0760 #define SCnSCB_ACTLR_DISMCYCINT_Pos 0U
0761 #define SCnSCB_ACTLR_DISMCYCINT_Msk (1UL )
0762
0763
0764
0765
0766
0767
0768
0769
0770
0771
0772
0773
0774
0775
0776 typedef struct
0777 {
0778 __IOM uint32_t CTRL;
0779 __IOM uint32_t LOAD;
0780 __IOM uint32_t VAL;
0781 __IM uint32_t CALIB;
0782 } SysTick_Type;
0783
0784
0785 #define SysTick_CTRL_COUNTFLAG_Pos 16U
0786 #define SysTick_CTRL_COUNTFLAG_Msk (1UL << SysTick_CTRL_COUNTFLAG_Pos)
0787
0788 #define SysTick_CTRL_CLKSOURCE_Pos 2U
0789 #define SysTick_CTRL_CLKSOURCE_Msk (1UL << SysTick_CTRL_CLKSOURCE_Pos)
0790
0791 #define SysTick_CTRL_TICKINT_Pos 1U
0792 #define SysTick_CTRL_TICKINT_Msk (1UL << SysTick_CTRL_TICKINT_Pos)
0793
0794 #define SysTick_CTRL_ENABLE_Pos 0U
0795 #define SysTick_CTRL_ENABLE_Msk (1UL )
0796
0797
0798 #define SysTick_LOAD_RELOAD_Pos 0U
0799 #define SysTick_LOAD_RELOAD_Msk (0xFFFFFFUL )
0800
0801
0802 #define SysTick_VAL_CURRENT_Pos 0U
0803 #define SysTick_VAL_CURRENT_Msk (0xFFFFFFUL )
0804
0805
0806 #define SysTick_CALIB_NOREF_Pos 31U
0807 #define SysTick_CALIB_NOREF_Msk (1UL << SysTick_CALIB_NOREF_Pos)
0808
0809 #define SysTick_CALIB_SKEW_Pos 30U
0810 #define SysTick_CALIB_SKEW_Msk (1UL << SysTick_CALIB_SKEW_Pos)
0811
0812 #define SysTick_CALIB_TENMS_Pos 0U
0813 #define SysTick_CALIB_TENMS_Msk (0xFFFFFFUL )
0814
0815
0816
0817
0818
0819
0820
0821
0822
0823
0824
0825
0826
0827
0828 typedef struct
0829 {
0830 __OM union
0831 {
0832 __OM uint8_t u8;
0833 __OM uint16_t u16;
0834 __OM uint32_t u32;
0835 } PORT [32U];
0836 uint32_t RESERVED0[864U];
0837 __IOM uint32_t TER;
0838 uint32_t RESERVED1[15U];
0839 __IOM uint32_t TPR;
0840 uint32_t RESERVED2[15U];
0841 __IOM uint32_t TCR;
0842 uint32_t RESERVED3[32U];
0843 uint32_t RESERVED4[43U];
0844 __OM uint32_t LAR;
0845 __IM uint32_t LSR;
0846 uint32_t RESERVED5[6U];
0847 __IM uint32_t PID4;
0848 __IM uint32_t PID5;
0849 __IM uint32_t PID6;
0850 __IM uint32_t PID7;
0851 __IM uint32_t PID0;
0852 __IM uint32_t PID1;
0853 __IM uint32_t PID2;
0854 __IM uint32_t PID3;
0855 __IM uint32_t CID0;
0856 __IM uint32_t CID1;
0857 __IM uint32_t CID2;
0858 __IM uint32_t CID3;
0859 } ITM_Type;
0860
0861
0862 #define ITM_TPR_PRIVMASK_Pos 0U
0863 #define ITM_TPR_PRIVMASK_Msk (0xFFFFFFFFUL )
0864
0865
0866 #define ITM_TCR_BUSY_Pos 23U
0867 #define ITM_TCR_BUSY_Msk (1UL << ITM_TCR_BUSY_Pos)
0868
0869 #define ITM_TCR_TRACEBUSID_Pos 16U
0870 #define ITM_TCR_TRACEBUSID_Msk (0x7FUL << ITM_TCR_TRACEBUSID_Pos)
0871
0872 #define ITM_TCR_GTSFREQ_Pos 10U
0873 #define ITM_TCR_GTSFREQ_Msk (3UL << ITM_TCR_GTSFREQ_Pos)
0874
0875 #define ITM_TCR_TSPRESCALE_Pos 8U
0876 #define ITM_TCR_TSPRESCALE_Msk (3UL << ITM_TCR_TSPRESCALE_Pos)
0877
0878 #define ITM_TCR_SWOENA_Pos 4U
0879 #define ITM_TCR_SWOENA_Msk (1UL << ITM_TCR_SWOENA_Pos)
0880
0881 #define ITM_TCR_DWTENA_Pos 3U
0882 #define ITM_TCR_DWTENA_Msk (1UL << ITM_TCR_DWTENA_Pos)
0883
0884 #define ITM_TCR_SYNCENA_Pos 2U
0885 #define ITM_TCR_SYNCENA_Msk (1UL << ITM_TCR_SYNCENA_Pos)
0886
0887 #define ITM_TCR_TSENA_Pos 1U
0888 #define ITM_TCR_TSENA_Msk (1UL << ITM_TCR_TSENA_Pos)
0889
0890 #define ITM_TCR_ITMENA_Pos 0U
0891 #define ITM_TCR_ITMENA_Msk (1UL )
0892
0893
0894 #define ITM_LSR_BYTEACC_Pos 2U
0895 #define ITM_LSR_BYTEACC_Msk (1UL << ITM_LSR_BYTEACC_Pos)
0896
0897 #define ITM_LSR_ACCESS_Pos 1U
0898 #define ITM_LSR_ACCESS_Msk (1UL << ITM_LSR_ACCESS_Pos)
0899
0900 #define ITM_LSR_PRESENT_Pos 0U
0901 #define ITM_LSR_PRESENT_Msk (1UL )
0902
0903
0904
0905
0906
0907
0908
0909
0910
0911
0912
0913
0914
0915
0916 typedef struct
0917 {
0918 __IOM uint32_t CTRL;
0919 __IOM uint32_t CYCCNT;
0920 __IOM uint32_t CPICNT;
0921 __IOM uint32_t EXCCNT;
0922 __IOM uint32_t SLEEPCNT;
0923 __IOM uint32_t LSUCNT;
0924 __IOM uint32_t FOLDCNT;
0925 __IM uint32_t PCSR;
0926 __IOM uint32_t COMP0;
0927 __IOM uint32_t MASK0;
0928 __IOM uint32_t FUNCTION0;
0929 uint32_t RESERVED0[1U];
0930 __IOM uint32_t COMP1;
0931 __IOM uint32_t MASK1;
0932 __IOM uint32_t FUNCTION1;
0933 uint32_t RESERVED1[1U];
0934 __IOM uint32_t COMP2;
0935 __IOM uint32_t MASK2;
0936 __IOM uint32_t FUNCTION2;
0937 uint32_t RESERVED2[1U];
0938 __IOM uint32_t COMP3;
0939 __IOM uint32_t MASK3;
0940 __IOM uint32_t FUNCTION3;
0941 } DWT_Type;
0942
0943
0944 #define DWT_CTRL_NUMCOMP_Pos 28U
0945 #define DWT_CTRL_NUMCOMP_Msk (0xFUL << DWT_CTRL_NUMCOMP_Pos)
0946
0947 #define DWT_CTRL_NOTRCPKT_Pos 27U
0948 #define DWT_CTRL_NOTRCPKT_Msk (0x1UL << DWT_CTRL_NOTRCPKT_Pos)
0949
0950 #define DWT_CTRL_NOEXTTRIG_Pos 26U
0951 #define DWT_CTRL_NOEXTTRIG_Msk (0x1UL << DWT_CTRL_NOEXTTRIG_Pos)
0952
0953 #define DWT_CTRL_NOCYCCNT_Pos 25U
0954 #define DWT_CTRL_NOCYCCNT_Msk (0x1UL << DWT_CTRL_NOCYCCNT_Pos)
0955
0956 #define DWT_CTRL_NOPRFCNT_Pos 24U
0957 #define DWT_CTRL_NOPRFCNT_Msk (0x1UL << DWT_CTRL_NOPRFCNT_Pos)
0958
0959 #define DWT_CTRL_CYCEVTENA_Pos 22U
0960 #define DWT_CTRL_CYCEVTENA_Msk (0x1UL << DWT_CTRL_CYCEVTENA_Pos)
0961
0962 #define DWT_CTRL_FOLDEVTENA_Pos 21U
0963 #define DWT_CTRL_FOLDEVTENA_Msk (0x1UL << DWT_CTRL_FOLDEVTENA_Pos)
0964
0965 #define DWT_CTRL_LSUEVTENA_Pos 20U
0966 #define DWT_CTRL_LSUEVTENA_Msk (0x1UL << DWT_CTRL_LSUEVTENA_Pos)
0967
0968 #define DWT_CTRL_SLEEPEVTENA_Pos 19U
0969 #define DWT_CTRL_SLEEPEVTENA_Msk (0x1UL << DWT_CTRL_SLEEPEVTENA_Pos)
0970
0971 #define DWT_CTRL_EXCEVTENA_Pos 18U
0972 #define DWT_CTRL_EXCEVTENA_Msk (0x1UL << DWT_CTRL_EXCEVTENA_Pos)
0973
0974 #define DWT_CTRL_CPIEVTENA_Pos 17U
0975 #define DWT_CTRL_CPIEVTENA_Msk (0x1UL << DWT_CTRL_CPIEVTENA_Pos)
0976
0977 #define DWT_CTRL_EXCTRCENA_Pos 16U
0978 #define DWT_CTRL_EXCTRCENA_Msk (0x1UL << DWT_CTRL_EXCTRCENA_Pos)
0979
0980 #define DWT_CTRL_PCSAMPLENA_Pos 12U
0981 #define DWT_CTRL_PCSAMPLENA_Msk (0x1UL << DWT_CTRL_PCSAMPLENA_Pos)
0982
0983 #define DWT_CTRL_SYNCTAP_Pos 10U
0984 #define DWT_CTRL_SYNCTAP_Msk (0x3UL << DWT_CTRL_SYNCTAP_Pos)
0985
0986 #define DWT_CTRL_CYCTAP_Pos 9U
0987 #define DWT_CTRL_CYCTAP_Msk (0x1UL << DWT_CTRL_CYCTAP_Pos)
0988
0989 #define DWT_CTRL_POSTINIT_Pos 5U
0990 #define DWT_CTRL_POSTINIT_Msk (0xFUL << DWT_CTRL_POSTINIT_Pos)
0991
0992 #define DWT_CTRL_POSTPRESET_Pos 1U
0993 #define DWT_CTRL_POSTPRESET_Msk (0xFUL << DWT_CTRL_POSTPRESET_Pos)
0994
0995 #define DWT_CTRL_CYCCNTENA_Pos 0U
0996 #define DWT_CTRL_CYCCNTENA_Msk (0x1UL )
0997
0998
0999 #define DWT_CPICNT_CPICNT_Pos 0U
1000 #define DWT_CPICNT_CPICNT_Msk (0xFFUL )
1001
1002
1003 #define DWT_EXCCNT_EXCCNT_Pos 0U
1004 #define DWT_EXCCNT_EXCCNT_Msk (0xFFUL )
1005
1006
1007 #define DWT_SLEEPCNT_SLEEPCNT_Pos 0U
1008 #define DWT_SLEEPCNT_SLEEPCNT_Msk (0xFFUL )
1009
1010
1011 #define DWT_LSUCNT_LSUCNT_Pos 0U
1012 #define DWT_LSUCNT_LSUCNT_Msk (0xFFUL )
1013
1014
1015 #define DWT_FOLDCNT_FOLDCNT_Pos 0U
1016 #define DWT_FOLDCNT_FOLDCNT_Msk (0xFFUL )
1017
1018
1019 #define DWT_MASK_MASK_Pos 0U
1020 #define DWT_MASK_MASK_Msk (0x1FUL )
1021
1022
1023 #define DWT_FUNCTION_MATCHED_Pos 24U
1024 #define DWT_FUNCTION_MATCHED_Msk (0x1UL << DWT_FUNCTION_MATCHED_Pos)
1025
1026 #define DWT_FUNCTION_DATAVADDR1_Pos 16U
1027 #define DWT_FUNCTION_DATAVADDR1_Msk (0xFUL << DWT_FUNCTION_DATAVADDR1_Pos)
1028
1029 #define DWT_FUNCTION_DATAVADDR0_Pos 12U
1030 #define DWT_FUNCTION_DATAVADDR0_Msk (0xFUL << DWT_FUNCTION_DATAVADDR0_Pos)
1031
1032 #define DWT_FUNCTION_DATAVSIZE_Pos 10U
1033 #define DWT_FUNCTION_DATAVSIZE_Msk (0x3UL << DWT_FUNCTION_DATAVSIZE_Pos)
1034
1035 #define DWT_FUNCTION_LNK1ENA_Pos 9U
1036 #define DWT_FUNCTION_LNK1ENA_Msk (0x1UL << DWT_FUNCTION_LNK1ENA_Pos)
1037
1038 #define DWT_FUNCTION_DATAVMATCH_Pos 8U
1039 #define DWT_FUNCTION_DATAVMATCH_Msk (0x1UL << DWT_FUNCTION_DATAVMATCH_Pos)
1040
1041 #define DWT_FUNCTION_CYCMATCH_Pos 7U
1042 #define DWT_FUNCTION_CYCMATCH_Msk (0x1UL << DWT_FUNCTION_CYCMATCH_Pos)
1043
1044 #define DWT_FUNCTION_EMITRANGE_Pos 5U
1045 #define DWT_FUNCTION_EMITRANGE_Msk (0x1UL << DWT_FUNCTION_EMITRANGE_Pos)
1046
1047 #define DWT_FUNCTION_FUNCTION_Pos 0U
1048 #define DWT_FUNCTION_FUNCTION_Msk (0xFUL )
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063 typedef struct
1064 {
1065 __IM uint32_t SSPSR;
1066 __IOM uint32_t CSPSR;
1067 uint32_t RESERVED0[2U];
1068 __IOM uint32_t ACPR;
1069 uint32_t RESERVED1[55U];
1070 __IOM uint32_t SPPR;
1071 uint32_t RESERVED2[131U];
1072 __IM uint32_t FFSR;
1073 __IOM uint32_t FFCR;
1074 __IM uint32_t FSCR;
1075 uint32_t RESERVED3[759U];
1076 __IM uint32_t TRIGGER;
1077 __IM uint32_t FIFO0;
1078 __IM uint32_t ITATBCTR2;
1079 uint32_t RESERVED4[1U];
1080 __IM uint32_t ITATBCTR0;
1081 __IM uint32_t FIFO1;
1082 __IOM uint32_t ITCTRL;
1083 uint32_t RESERVED5[39U];
1084 __IOM uint32_t CLAIMSET;
1085 __IOM uint32_t CLAIMCLR;
1086 uint32_t RESERVED7[8U];
1087 __IM uint32_t DEVID;
1088 __IM uint32_t DEVTYPE;
1089 } TPI_Type;
1090
1091
1092 #define TPI_ACPR_PRESCALER_Pos 0U
1093 #define TPI_ACPR_PRESCALER_Msk (0x1FFFUL )
1094
1095
1096 #define TPI_SPPR_TXMODE_Pos 0U
1097 #define TPI_SPPR_TXMODE_Msk (0x3UL )
1098
1099
1100 #define TPI_FFSR_FtNonStop_Pos 3U
1101 #define TPI_FFSR_FtNonStop_Msk (0x1UL << TPI_FFSR_FtNonStop_Pos)
1102
1103 #define TPI_FFSR_TCPresent_Pos 2U
1104 #define TPI_FFSR_TCPresent_Msk (0x1UL << TPI_FFSR_TCPresent_Pos)
1105
1106 #define TPI_FFSR_FtStopped_Pos 1U
1107 #define TPI_FFSR_FtStopped_Msk (0x1UL << TPI_FFSR_FtStopped_Pos)
1108
1109 #define TPI_FFSR_FlInProg_Pos 0U
1110 #define TPI_FFSR_FlInProg_Msk (0x1UL )
1111
1112
1113 #define TPI_FFCR_TrigIn_Pos 8U
1114 #define TPI_FFCR_TrigIn_Msk (0x1UL << TPI_FFCR_TrigIn_Pos)
1115
1116 #define TPI_FFCR_EnFCont_Pos 1U
1117 #define TPI_FFCR_EnFCont_Msk (0x1UL << TPI_FFCR_EnFCont_Pos)
1118
1119
1120 #define TPI_TRIGGER_TRIGGER_Pos 0U
1121 #define TPI_TRIGGER_TRIGGER_Msk (0x1UL )
1122
1123
1124 #define TPI_FIFO0_ITM_ATVALID_Pos 29U
1125 #define TPI_FIFO0_ITM_ATVALID_Msk (0x1UL << TPI_FIFO0_ITM_ATVALID_Pos)
1126
1127 #define TPI_FIFO0_ITM_bytecount_Pos 27U
1128 #define TPI_FIFO0_ITM_bytecount_Msk (0x3UL << TPI_FIFO0_ITM_bytecount_Pos)
1129
1130 #define TPI_FIFO0_ETM_ATVALID_Pos 26U
1131 #define TPI_FIFO0_ETM_ATVALID_Msk (0x1UL << TPI_FIFO0_ETM_ATVALID_Pos)
1132
1133 #define TPI_FIFO0_ETM_bytecount_Pos 24U
1134 #define TPI_FIFO0_ETM_bytecount_Msk (0x3UL << TPI_FIFO0_ETM_bytecount_Pos)
1135
1136 #define TPI_FIFO0_ETM2_Pos 16U
1137 #define TPI_FIFO0_ETM2_Msk (0xFFUL << TPI_FIFO0_ETM2_Pos)
1138
1139 #define TPI_FIFO0_ETM1_Pos 8U
1140 #define TPI_FIFO0_ETM1_Msk (0xFFUL << TPI_FIFO0_ETM1_Pos)
1141
1142 #define TPI_FIFO0_ETM0_Pos 0U
1143 #define TPI_FIFO0_ETM0_Msk (0xFFUL )
1144
1145
1146 #define TPI_ITATBCTR2_ATREADY2_Pos 0U
1147 #define TPI_ITATBCTR2_ATREADY2_Msk (0x1UL )
1148
1149 #define TPI_ITATBCTR2_ATREADY1_Pos 0U
1150 #define TPI_ITATBCTR2_ATREADY1_Msk (0x1UL )
1151
1152
1153 #define TPI_FIFO1_ITM_ATVALID_Pos 29U
1154 #define TPI_FIFO1_ITM_ATVALID_Msk (0x1UL << TPI_FIFO1_ITM_ATVALID_Pos)
1155
1156 #define TPI_FIFO1_ITM_bytecount_Pos 27U
1157 #define TPI_FIFO1_ITM_bytecount_Msk (0x3UL << TPI_FIFO1_ITM_bytecount_Pos)
1158
1159 #define TPI_FIFO1_ETM_ATVALID_Pos 26U
1160 #define TPI_FIFO1_ETM_ATVALID_Msk (0x1UL << TPI_FIFO1_ETM_ATVALID_Pos)
1161
1162 #define TPI_FIFO1_ETM_bytecount_Pos 24U
1163 #define TPI_FIFO1_ETM_bytecount_Msk (0x3UL << TPI_FIFO1_ETM_bytecount_Pos)
1164
1165 #define TPI_FIFO1_ITM2_Pos 16U
1166 #define TPI_FIFO1_ITM2_Msk (0xFFUL << TPI_FIFO1_ITM2_Pos)
1167
1168 #define TPI_FIFO1_ITM1_Pos 8U
1169 #define TPI_FIFO1_ITM1_Msk (0xFFUL << TPI_FIFO1_ITM1_Pos)
1170
1171 #define TPI_FIFO1_ITM0_Pos 0U
1172 #define TPI_FIFO1_ITM0_Msk (0xFFUL )
1173
1174
1175 #define TPI_ITATBCTR0_ATREADY2_Pos 0U
1176 #define TPI_ITATBCTR0_ATREADY2_Msk (0x1UL )
1177
1178 #define TPI_ITATBCTR0_ATREADY1_Pos 0U
1179 #define TPI_ITATBCTR0_ATREADY1_Msk (0x1UL )
1180
1181
1182 #define TPI_ITCTRL_Mode_Pos 0U
1183 #define TPI_ITCTRL_Mode_Msk (0x3UL )
1184
1185
1186 #define TPI_DEVID_NRZVALID_Pos 11U
1187 #define TPI_DEVID_NRZVALID_Msk (0x1UL << TPI_DEVID_NRZVALID_Pos)
1188
1189 #define TPI_DEVID_MANCVALID_Pos 10U
1190 #define TPI_DEVID_MANCVALID_Msk (0x1UL << TPI_DEVID_MANCVALID_Pos)
1191
1192 #define TPI_DEVID_PTINVALID_Pos 9U
1193 #define TPI_DEVID_PTINVALID_Msk (0x1UL << TPI_DEVID_PTINVALID_Pos)
1194
1195 #define TPI_DEVID_MinBufSz_Pos 6U
1196 #define TPI_DEVID_MinBufSz_Msk (0x7UL << TPI_DEVID_MinBufSz_Pos)
1197
1198 #define TPI_DEVID_AsynClkIn_Pos 5U
1199 #define TPI_DEVID_AsynClkIn_Msk (0x1UL << TPI_DEVID_AsynClkIn_Pos)
1200
1201 #define TPI_DEVID_NrTraceInput_Pos 0U
1202 #define TPI_DEVID_NrTraceInput_Msk (0x1FUL )
1203
1204
1205 #define TPI_DEVTYPE_SubType_Pos 4U
1206 #define TPI_DEVTYPE_SubType_Msk (0xFUL )
1207
1208 #define TPI_DEVTYPE_MajorType_Pos 0U
1209 #define TPI_DEVTYPE_MajorType_Msk (0xFUL << TPI_DEVTYPE_MajorType_Pos)
1210
1211
1212
1213
1214 #if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U)
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225 typedef struct
1226 {
1227 __IM uint32_t TYPE;
1228 __IOM uint32_t CTRL;
1229 __IOM uint32_t RNR;
1230 __IOM uint32_t RBAR;
1231 __IOM uint32_t RASR;
1232 __IOM uint32_t RBAR_A1;
1233 __IOM uint32_t RASR_A1;
1234 __IOM uint32_t RBAR_A2;
1235 __IOM uint32_t RASR_A2;
1236 __IOM uint32_t RBAR_A3;
1237 __IOM uint32_t RASR_A3;
1238 } MPU_Type;
1239
1240 #define MPU_TYPE_RALIASES 4U
1241
1242
1243 #define MPU_TYPE_IREGION_Pos 16U
1244 #define MPU_TYPE_IREGION_Msk (0xFFUL << MPU_TYPE_IREGION_Pos)
1245
1246 #define MPU_TYPE_DREGION_Pos 8U
1247 #define MPU_TYPE_DREGION_Msk (0xFFUL << MPU_TYPE_DREGION_Pos)
1248
1249 #define MPU_TYPE_SEPARATE_Pos 0U
1250 #define MPU_TYPE_SEPARATE_Msk (1UL )
1251
1252
1253 #define MPU_CTRL_PRIVDEFENA_Pos 2U
1254 #define MPU_CTRL_PRIVDEFENA_Msk (1UL << MPU_CTRL_PRIVDEFENA_Pos)
1255
1256 #define MPU_CTRL_HFNMIENA_Pos 1U
1257 #define MPU_CTRL_HFNMIENA_Msk (1UL << MPU_CTRL_HFNMIENA_Pos)
1258
1259 #define MPU_CTRL_ENABLE_Pos 0U
1260 #define MPU_CTRL_ENABLE_Msk (1UL )
1261
1262
1263 #define MPU_RNR_REGION_Pos 0U
1264 #define MPU_RNR_REGION_Msk (0xFFUL )
1265
1266
1267 #define MPU_RBAR_ADDR_Pos 5U
1268 #define MPU_RBAR_ADDR_Msk (0x7FFFFFFUL << MPU_RBAR_ADDR_Pos)
1269
1270 #define MPU_RBAR_VALID_Pos 4U
1271 #define MPU_RBAR_VALID_Msk (1UL << MPU_RBAR_VALID_Pos)
1272
1273 #define MPU_RBAR_REGION_Pos 0U
1274 #define MPU_RBAR_REGION_Msk (0xFUL )
1275
1276
1277 #define MPU_RASR_ATTRS_Pos 16U
1278 #define MPU_RASR_ATTRS_Msk (0xFFFFUL << MPU_RASR_ATTRS_Pos)
1279
1280 #define MPU_RASR_XN_Pos 28U
1281 #define MPU_RASR_XN_Msk (1UL << MPU_RASR_XN_Pos)
1282
1283 #define MPU_RASR_AP_Pos 24U
1284 #define MPU_RASR_AP_Msk (0x7UL << MPU_RASR_AP_Pos)
1285
1286 #define MPU_RASR_TEX_Pos 19U
1287 #define MPU_RASR_TEX_Msk (0x7UL << MPU_RASR_TEX_Pos)
1288
1289 #define MPU_RASR_S_Pos 18U
1290 #define MPU_RASR_S_Msk (1UL << MPU_RASR_S_Pos)
1291
1292 #define MPU_RASR_C_Pos 17U
1293 #define MPU_RASR_C_Msk (1UL << MPU_RASR_C_Pos)
1294
1295 #define MPU_RASR_B_Pos 16U
1296 #define MPU_RASR_B_Msk (1UL << MPU_RASR_B_Pos)
1297
1298 #define MPU_RASR_SRD_Pos 8U
1299 #define MPU_RASR_SRD_Msk (0xFFUL << MPU_RASR_SRD_Pos)
1300
1301 #define MPU_RASR_SIZE_Pos 1U
1302 #define MPU_RASR_SIZE_Msk (0x1FUL << MPU_RASR_SIZE_Pos)
1303
1304 #define MPU_RASR_ENABLE_Pos 0U
1305 #define MPU_RASR_ENABLE_Msk (1UL )
1306
1307
1308 #endif
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321 typedef struct
1322 {
1323 uint32_t RESERVED0[1U];
1324 __IOM uint32_t FPCCR;
1325 __IOM uint32_t FPCAR;
1326 __IOM uint32_t FPDSCR;
1327 __IM uint32_t MVFR0;
1328 __IM uint32_t MVFR1;
1329 __IM uint32_t MVFR2;
1330 } FPU_Type;
1331
1332
1333 #define FPU_FPCCR_ASPEN_Pos 31U
1334 #define FPU_FPCCR_ASPEN_Msk (1UL << FPU_FPCCR_ASPEN_Pos)
1335
1336 #define FPU_FPCCR_LSPEN_Pos 30U
1337 #define FPU_FPCCR_LSPEN_Msk (1UL << FPU_FPCCR_LSPEN_Pos)
1338
1339 #define FPU_FPCCR_MONRDY_Pos 8U
1340 #define FPU_FPCCR_MONRDY_Msk (1UL << FPU_FPCCR_MONRDY_Pos)
1341
1342 #define FPU_FPCCR_BFRDY_Pos 6U
1343 #define FPU_FPCCR_BFRDY_Msk (1UL << FPU_FPCCR_BFRDY_Pos)
1344
1345 #define FPU_FPCCR_MMRDY_Pos 5U
1346 #define FPU_FPCCR_MMRDY_Msk (1UL << FPU_FPCCR_MMRDY_Pos)
1347
1348 #define FPU_FPCCR_HFRDY_Pos 4U
1349 #define FPU_FPCCR_HFRDY_Msk (1UL << FPU_FPCCR_HFRDY_Pos)
1350
1351 #define FPU_FPCCR_THREAD_Pos 3U
1352 #define FPU_FPCCR_THREAD_Msk (1UL << FPU_FPCCR_THREAD_Pos)
1353
1354 #define FPU_FPCCR_USER_Pos 1U
1355 #define FPU_FPCCR_USER_Msk (1UL << FPU_FPCCR_USER_Pos)
1356
1357 #define FPU_FPCCR_LSPACT_Pos 0U
1358 #define FPU_FPCCR_LSPACT_Msk (1UL )
1359
1360
1361 #define FPU_FPCAR_ADDRESS_Pos 3U
1362 #define FPU_FPCAR_ADDRESS_Msk (0x1FFFFFFFUL << FPU_FPCAR_ADDRESS_Pos)
1363
1364
1365 #define FPU_FPDSCR_AHP_Pos 26U
1366 #define FPU_FPDSCR_AHP_Msk (1UL << FPU_FPDSCR_AHP_Pos)
1367
1368 #define FPU_FPDSCR_DN_Pos 25U
1369 #define FPU_FPDSCR_DN_Msk (1UL << FPU_FPDSCR_DN_Pos)
1370
1371 #define FPU_FPDSCR_FZ_Pos 24U
1372 #define FPU_FPDSCR_FZ_Msk (1UL << FPU_FPDSCR_FZ_Pos)
1373
1374 #define FPU_FPDSCR_RMode_Pos 22U
1375 #define FPU_FPDSCR_RMode_Msk (3UL << FPU_FPDSCR_RMode_Pos)
1376
1377
1378 #define FPU_MVFR0_FP_rounding_modes_Pos 28U
1379 #define FPU_MVFR0_FP_rounding_modes_Msk (0xFUL << FPU_MVFR0_FP_rounding_modes_Pos)
1380
1381 #define FPU_MVFR0_Short_vectors_Pos 24U
1382 #define FPU_MVFR0_Short_vectors_Msk (0xFUL << FPU_MVFR0_Short_vectors_Pos)
1383
1384 #define FPU_MVFR0_Square_root_Pos 20U
1385 #define FPU_MVFR0_Square_root_Msk (0xFUL << FPU_MVFR0_Square_root_Pos)
1386
1387 #define FPU_MVFR0_Divide_Pos 16U
1388 #define FPU_MVFR0_Divide_Msk (0xFUL << FPU_MVFR0_Divide_Pos)
1389
1390 #define FPU_MVFR0_FP_excep_trapping_Pos 12U
1391 #define FPU_MVFR0_FP_excep_trapping_Msk (0xFUL << FPU_MVFR0_FP_excep_trapping_Pos)
1392
1393 #define FPU_MVFR0_Double_precision_Pos 8U
1394 #define FPU_MVFR0_Double_precision_Msk (0xFUL << FPU_MVFR0_Double_precision_Pos)
1395
1396 #define FPU_MVFR0_Single_precision_Pos 4U
1397 #define FPU_MVFR0_Single_precision_Msk (0xFUL << FPU_MVFR0_Single_precision_Pos)
1398
1399 #define FPU_MVFR0_A_SIMD_registers_Pos 0U
1400 #define FPU_MVFR0_A_SIMD_registers_Msk (0xFUL )
1401
1402
1403 #define FPU_MVFR1_FP_fused_MAC_Pos 28U
1404 #define FPU_MVFR1_FP_fused_MAC_Msk (0xFUL << FPU_MVFR1_FP_fused_MAC_Pos)
1405
1406 #define FPU_MVFR1_FP_HPFP_Pos 24U
1407 #define FPU_MVFR1_FP_HPFP_Msk (0xFUL << FPU_MVFR1_FP_HPFP_Pos)
1408
1409 #define FPU_MVFR1_D_NaN_mode_Pos 4U
1410 #define FPU_MVFR1_D_NaN_mode_Msk (0xFUL << FPU_MVFR1_D_NaN_mode_Pos)
1411
1412 #define FPU_MVFR1_FtZ_mode_Pos 0U
1413 #define FPU_MVFR1_FtZ_mode_Msk (0xFUL )
1414
1415
1416
1417 #define FPU_MVFR2_VFP_Misc_Pos 4U
1418 #define FPU_MVFR2_VFP_Misc_Msk (0xFUL << FPU_MVFR2_VFP_Misc_Pos)
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433 typedef struct
1434 {
1435 __IOM uint32_t DHCSR;
1436 __OM uint32_t DCRSR;
1437 __IOM uint32_t DCRDR;
1438 __IOM uint32_t DEMCR;
1439 } CoreDebug_Type;
1440
1441
1442 #define CoreDebug_DHCSR_DBGKEY_Pos 16U
1443 #define CoreDebug_DHCSR_DBGKEY_Msk (0xFFFFUL << CoreDebug_DHCSR_DBGKEY_Pos)
1444
1445 #define CoreDebug_DHCSR_S_RESET_ST_Pos 25U
1446 #define CoreDebug_DHCSR_S_RESET_ST_Msk (1UL << CoreDebug_DHCSR_S_RESET_ST_Pos)
1447
1448 #define CoreDebug_DHCSR_S_RETIRE_ST_Pos 24U
1449 #define CoreDebug_DHCSR_S_RETIRE_ST_Msk (1UL << CoreDebug_DHCSR_S_RETIRE_ST_Pos)
1450
1451 #define CoreDebug_DHCSR_S_LOCKUP_Pos 19U
1452 #define CoreDebug_DHCSR_S_LOCKUP_Msk (1UL << CoreDebug_DHCSR_S_LOCKUP_Pos)
1453
1454 #define CoreDebug_DHCSR_S_SLEEP_Pos 18U
1455 #define CoreDebug_DHCSR_S_SLEEP_Msk (1UL << CoreDebug_DHCSR_S_SLEEP_Pos)
1456
1457 #define CoreDebug_DHCSR_S_HALT_Pos 17U
1458 #define CoreDebug_DHCSR_S_HALT_Msk (1UL << CoreDebug_DHCSR_S_HALT_Pos)
1459
1460 #define CoreDebug_DHCSR_S_REGRDY_Pos 16U
1461 #define CoreDebug_DHCSR_S_REGRDY_Msk (1UL << CoreDebug_DHCSR_S_REGRDY_Pos)
1462
1463 #define CoreDebug_DHCSR_C_SNAPSTALL_Pos 5U
1464 #define CoreDebug_DHCSR_C_SNAPSTALL_Msk (1UL << CoreDebug_DHCSR_C_SNAPSTALL_Pos)
1465
1466 #define CoreDebug_DHCSR_C_MASKINTS_Pos 3U
1467 #define CoreDebug_DHCSR_C_MASKINTS_Msk (1UL << CoreDebug_DHCSR_C_MASKINTS_Pos)
1468
1469 #define CoreDebug_DHCSR_C_STEP_Pos 2U
1470 #define CoreDebug_DHCSR_C_STEP_Msk (1UL << CoreDebug_DHCSR_C_STEP_Pos)
1471
1472 #define CoreDebug_DHCSR_C_HALT_Pos 1U
1473 #define CoreDebug_DHCSR_C_HALT_Msk (1UL << CoreDebug_DHCSR_C_HALT_Pos)
1474
1475 #define CoreDebug_DHCSR_C_DEBUGEN_Pos 0U
1476 #define CoreDebug_DHCSR_C_DEBUGEN_Msk (1UL )
1477
1478
1479 #define CoreDebug_DCRSR_REGWnR_Pos 16U
1480 #define CoreDebug_DCRSR_REGWnR_Msk (1UL << CoreDebug_DCRSR_REGWnR_Pos)
1481
1482 #define CoreDebug_DCRSR_REGSEL_Pos 0U
1483 #define CoreDebug_DCRSR_REGSEL_Msk (0x1FUL )
1484
1485
1486 #define CoreDebug_DEMCR_TRCENA_Pos 24U
1487 #define CoreDebug_DEMCR_TRCENA_Msk (1UL << CoreDebug_DEMCR_TRCENA_Pos)
1488
1489 #define CoreDebug_DEMCR_MON_REQ_Pos 19U
1490 #define CoreDebug_DEMCR_MON_REQ_Msk (1UL << CoreDebug_DEMCR_MON_REQ_Pos)
1491
1492 #define CoreDebug_DEMCR_MON_STEP_Pos 18U
1493 #define CoreDebug_DEMCR_MON_STEP_Msk (1UL << CoreDebug_DEMCR_MON_STEP_Pos)
1494
1495 #define CoreDebug_DEMCR_MON_PEND_Pos 17U
1496 #define CoreDebug_DEMCR_MON_PEND_Msk (1UL << CoreDebug_DEMCR_MON_PEND_Pos)
1497
1498 #define CoreDebug_DEMCR_MON_EN_Pos 16U
1499 #define CoreDebug_DEMCR_MON_EN_Msk (1UL << CoreDebug_DEMCR_MON_EN_Pos)
1500
1501 #define CoreDebug_DEMCR_VC_HARDERR_Pos 10U
1502 #define CoreDebug_DEMCR_VC_HARDERR_Msk (1UL << CoreDebug_DEMCR_VC_HARDERR_Pos)
1503
1504 #define CoreDebug_DEMCR_VC_INTERR_Pos 9U
1505 #define CoreDebug_DEMCR_VC_INTERR_Msk (1UL << CoreDebug_DEMCR_VC_INTERR_Pos)
1506
1507 #define CoreDebug_DEMCR_VC_BUSERR_Pos 8U
1508 #define CoreDebug_DEMCR_VC_BUSERR_Msk (1UL << CoreDebug_DEMCR_VC_BUSERR_Pos)
1509
1510 #define CoreDebug_DEMCR_VC_STATERR_Pos 7U
1511 #define CoreDebug_DEMCR_VC_STATERR_Msk (1UL << CoreDebug_DEMCR_VC_STATERR_Pos)
1512
1513 #define CoreDebug_DEMCR_VC_CHKERR_Pos 6U
1514 #define CoreDebug_DEMCR_VC_CHKERR_Msk (1UL << CoreDebug_DEMCR_VC_CHKERR_Pos)
1515
1516 #define CoreDebug_DEMCR_VC_NOCPERR_Pos 5U
1517 #define CoreDebug_DEMCR_VC_NOCPERR_Msk (1UL << CoreDebug_DEMCR_VC_NOCPERR_Pos)
1518
1519 #define CoreDebug_DEMCR_VC_MMERR_Pos 4U
1520 #define CoreDebug_DEMCR_VC_MMERR_Msk (1UL << CoreDebug_DEMCR_VC_MMERR_Pos)
1521
1522 #define CoreDebug_DEMCR_VC_CORERESET_Pos 0U
1523 #define CoreDebug_DEMCR_VC_CORERESET_Msk (1UL )
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541 #define _VAL2FLD(field, value) (((uint32_t)(value) << field ## _Pos) & field ## _Msk)
1542
1543
1544
1545
1546
1547
1548
1549 #define _FLD2VAL(field, value) (((uint32_t)(value) & field ## _Msk) >> field ## _Pos)
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562 #define SCS_BASE (0xE000E000UL)
1563 #define ITM_BASE (0xE0000000UL)
1564 #define DWT_BASE (0xE0001000UL)
1565 #define TPI_BASE (0xE0040000UL)
1566 #define CoreDebug_BASE (0xE000EDF0UL)
1567 #define SysTick_BASE (SCS_BASE + 0x0010UL)
1568 #define NVIC_BASE (SCS_BASE + 0x0100UL)
1569 #define SCB_BASE (SCS_BASE + 0x0D00UL)
1570
1571 #define SCnSCB ((SCnSCB_Type *) SCS_BASE )
1572 #define SCB ((SCB_Type *) SCB_BASE )
1573 #define SysTick ((SysTick_Type *) SysTick_BASE )
1574 #define NVIC ((NVIC_Type *) NVIC_BASE )
1575 #define ITM ((ITM_Type *) ITM_BASE )
1576 #define DWT ((DWT_Type *) DWT_BASE )
1577 #define TPI ((TPI_Type *) TPI_BASE )
1578 #define CoreDebug ((CoreDebug_Type *) CoreDebug_BASE)
1579
1580 #if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U)
1581 #define MPU_BASE (SCS_BASE + 0x0D90UL)
1582 #define MPU ((MPU_Type *) MPU_BASE )
1583 #endif
1584
1585 #define FPU_BASE (SCS_BASE + 0x0F30UL)
1586 #define FPU ((FPU_Type *) FPU_BASE )
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601 #define ITM_TCR_TraceBusID_Pos (ITM_TCR_TRACEBUSID_Pos)
1602 #define ITM_TCR_TraceBusID_Msk (ITM_TCR_TRACEBUSID_Msk)
1603
1604 #define ITM_TCR_TSPrescale_Pos (ITM_TCR_TSPRESCALE_Pos)
1605 #define ITM_TCR_TSPrescale_Msk (ITM_TCR_TSPRESCALE_Msk)
1606
1607
1608 #define ITM_LSR_ByteAcc_Pos (ITM_LSR_BYTEACC_Pos)
1609 #define ITM_LSR_ByteAcc_Msk (ITM_LSR_BYTEACC_Msk)
1610
1611 #define ITM_LSR_Access_Pos (ITM_LSR_ACCESS_Pos)
1612 #define ITM_LSR_Access_Msk (ITM_LSR_ACCESS_Msk)
1613
1614 #define ITM_LSR_Present_Pos (ITM_LSR_PRESENT_Pos)
1615 #define ITM_LSR_Present_Msk (ITM_LSR_PRESENT_Msk)
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643 #ifdef CMSIS_NVIC_VIRTUAL
1644 #ifndef CMSIS_NVIC_VIRTUAL_HEADER_FILE
1645 #define CMSIS_NVIC_VIRTUAL_HEADER_FILE "cmsis_nvic_virtual.h"
1646 #endif
1647 #include CMSIS_NVIC_VIRTUAL_HEADER_FILE
1648 #else
1649 #define NVIC_SetPriorityGrouping __NVIC_SetPriorityGrouping
1650 #define NVIC_GetPriorityGrouping __NVIC_GetPriorityGrouping
1651 #define NVIC_EnableIRQ __NVIC_EnableIRQ
1652 #define NVIC_GetEnableIRQ __NVIC_GetEnableIRQ
1653 #define NVIC_DisableIRQ __NVIC_DisableIRQ
1654 #define NVIC_GetPendingIRQ __NVIC_GetPendingIRQ
1655 #define NVIC_SetPendingIRQ __NVIC_SetPendingIRQ
1656 #define NVIC_ClearPendingIRQ __NVIC_ClearPendingIRQ
1657 #define NVIC_GetActive __NVIC_GetActive
1658 #define NVIC_SetPriority __NVIC_SetPriority
1659 #define NVIC_GetPriority __NVIC_GetPriority
1660 #define NVIC_SystemReset __NVIC_SystemReset
1661 #endif
1662
1663 #ifdef CMSIS_VECTAB_VIRTUAL
1664 #ifndef CMSIS_VECTAB_VIRTUAL_HEADER_FILE
1665 #define CMSIS_VECTAB_VIRTUAL_HEADER_FILE "cmsis_vectab_virtual.h"
1666 #endif
1667 #include CMSIS_VECTAB_VIRTUAL_HEADER_FILE
1668 #else
1669 #define NVIC_SetVector __NVIC_SetVector
1670 #define NVIC_GetVector __NVIC_GetVector
1671 #endif
1672
1673 #define NVIC_USER_IRQ_OFFSET 16
1674
1675
1676
1677 #define EXC_RETURN_HANDLER (0xFFFFFFF1UL)
1678 #define EXC_RETURN_THREAD_MSP (0xFFFFFFF9UL)
1679 #define EXC_RETURN_THREAD_PSP (0xFFFFFFFDUL)
1680 #define EXC_RETURN_HANDLER_FPU (0xFFFFFFE1UL)
1681 #define EXC_RETURN_THREAD_MSP_FPU (0xFFFFFFE9UL)
1682 #define EXC_RETURN_THREAD_PSP_FPU (0xFFFFFFEDUL)
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694 __STATIC_INLINE void __NVIC_SetPriorityGrouping(uint32_t PriorityGroup)
1695 {
1696 uint32_t reg_value;
1697 uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL);
1698
1699 reg_value = SCB->AIRCR;
1700 reg_value &= ~((uint32_t)(SCB_AIRCR_VECTKEY_Msk | SCB_AIRCR_PRIGROUP_Msk));
1701 reg_value = (reg_value |
1702 ((uint32_t)0x5FAUL << SCB_AIRCR_VECTKEY_Pos) |
1703 (PriorityGroupTmp << SCB_AIRCR_PRIGROUP_Pos) );
1704 SCB->AIRCR = reg_value;
1705 }
1706
1707
1708
1709
1710
1711
1712
1713 __STATIC_INLINE uint32_t __NVIC_GetPriorityGrouping(void)
1714 {
1715 return ((uint32_t)((SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) >> SCB_AIRCR_PRIGROUP_Pos));
1716 }
1717
1718
1719
1720
1721
1722
1723
1724
1725 __STATIC_INLINE void __NVIC_EnableIRQ(IRQn_Type IRQn)
1726 {
1727 if ((int32_t)(IRQn) >= 0)
1728 {
1729 __COMPILER_BARRIER();
1730 NVIC->ISER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
1731 __COMPILER_BARRIER();
1732 }
1733 }
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744 __STATIC_INLINE uint32_t __NVIC_GetEnableIRQ(IRQn_Type IRQn)
1745 {
1746 if ((int32_t)(IRQn) >= 0)
1747 {
1748 return((uint32_t)(((NVIC->ISER[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
1749 }
1750 else
1751 {
1752 return(0U);
1753 }
1754 }
1755
1756
1757
1758
1759
1760
1761
1762
1763 __STATIC_INLINE void __NVIC_DisableIRQ(IRQn_Type IRQn)
1764 {
1765 if ((int32_t)(IRQn) >= 0)
1766 {
1767 NVIC->ICER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
1768 __DSB();
1769 __ISB();
1770 }
1771 }
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782 __STATIC_INLINE uint32_t __NVIC_GetPendingIRQ(IRQn_Type IRQn)
1783 {
1784 if ((int32_t)(IRQn) >= 0)
1785 {
1786 return((uint32_t)(((NVIC->ISPR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
1787 }
1788 else
1789 {
1790 return(0U);
1791 }
1792 }
1793
1794
1795
1796
1797
1798
1799
1800
1801 __STATIC_INLINE void __NVIC_SetPendingIRQ(IRQn_Type IRQn)
1802 {
1803 if ((int32_t)(IRQn) >= 0)
1804 {
1805 NVIC->ISPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
1806 }
1807 }
1808
1809
1810
1811
1812
1813
1814
1815
1816 __STATIC_INLINE void __NVIC_ClearPendingIRQ(IRQn_Type IRQn)
1817 {
1818 if ((int32_t)(IRQn) >= 0)
1819 {
1820 NVIC->ICPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
1821 }
1822 }
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833 __STATIC_INLINE uint32_t __NVIC_GetActive(IRQn_Type IRQn)
1834 {
1835 if ((int32_t)(IRQn) >= 0)
1836 {
1837 return((uint32_t)(((NVIC->IABR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
1838 }
1839 else
1840 {
1841 return(0U);
1842 }
1843 }
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855 __STATIC_INLINE void __NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority)
1856 {
1857 if ((int32_t)(IRQn) >= 0)
1858 {
1859 NVIC->IP[((uint32_t)IRQn)] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL);
1860 }
1861 else
1862 {
1863 SCB->SHP[(((uint32_t)IRQn) & 0xFUL)-4UL] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL);
1864 }
1865 }
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877 __STATIC_INLINE uint32_t __NVIC_GetPriority(IRQn_Type IRQn)
1878 {
1879
1880 if ((int32_t)(IRQn) >= 0)
1881 {
1882 return(((uint32_t)NVIC->IP[((uint32_t)IRQn)] >> (8U - __NVIC_PRIO_BITS)));
1883 }
1884 else
1885 {
1886 return(((uint32_t)SCB->SHP[(((uint32_t)IRQn) & 0xFUL)-4UL] >> (8U - __NVIC_PRIO_BITS)));
1887 }
1888 }
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902 __STATIC_INLINE uint32_t NVIC_EncodePriority (uint32_t PriorityGroup, uint32_t PreemptPriority, uint32_t SubPriority)
1903 {
1904 uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL);
1905 uint32_t PreemptPriorityBits;
1906 uint32_t SubPriorityBits;
1907
1908 PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp);
1909 SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS));
1910
1911 return (
1912 ((PreemptPriority & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL)) << SubPriorityBits) |
1913 ((SubPriority & (uint32_t)((1UL << (SubPriorityBits )) - 1UL)))
1914 );
1915 }
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929 __STATIC_INLINE void NVIC_DecodePriority (uint32_t Priority, uint32_t PriorityGroup, uint32_t* const pPreemptPriority, uint32_t* const pSubPriority)
1930 {
1931 uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL);
1932 uint32_t PreemptPriorityBits;
1933 uint32_t SubPriorityBits;
1934
1935 PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp);
1936 SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS));
1937
1938 *pPreemptPriority = (Priority >> SubPriorityBits) & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL);
1939 *pSubPriority = (Priority ) & (uint32_t)((1UL << (SubPriorityBits )) - 1UL);
1940 }
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952 __STATIC_INLINE void __NVIC_SetVector(IRQn_Type IRQn, uint32_t vector)
1953 {
1954 uint32_t *vectors = (uint32_t *)SCB->VTOR;
1955 vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET] = vector;
1956
1957 }
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968 __STATIC_INLINE uint32_t __NVIC_GetVector(IRQn_Type IRQn)
1969 {
1970 uint32_t *vectors = (uint32_t *)SCB->VTOR;
1971 return vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET];
1972 }
1973
1974
1975
1976
1977
1978
1979 __NO_RETURN __STATIC_INLINE void __NVIC_SystemReset(void)
1980 {
1981 __DSB();
1982
1983 SCB->AIRCR = (uint32_t)((0x5FAUL << SCB_AIRCR_VECTKEY_Pos) |
1984 (SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) |
1985 SCB_AIRCR_SYSRESETREQ_Msk );
1986 __DSB();
1987
1988 for(;;)
1989 {
1990 __NOP();
1991 }
1992 }
1993
1994
1995
1996
1997
1998
1999 #if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U)
2000
2001 #include "mpu_armv7.h"
2002
2003 #endif
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022 __STATIC_INLINE uint32_t SCB_GetFPUType(void)
2023 {
2024 uint32_t mvfr0;
2025
2026 mvfr0 = FPU->MVFR0;
2027 if ((mvfr0 & (FPU_MVFR0_Single_precision_Msk | FPU_MVFR0_Double_precision_Msk)) == 0x020U)
2028 {
2029 return 1U;
2030 }
2031 else
2032 {
2033 return 0U;
2034 }
2035 }
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050 #if defined (__Vendor_SysTickConfig) && (__Vendor_SysTickConfig == 0U)
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063 __STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks)
2064 {
2065 if ((ticks - 1UL) > SysTick_LOAD_RELOAD_Msk)
2066 {
2067 return (1UL);
2068 }
2069
2070 SysTick->LOAD = (uint32_t)(ticks - 1UL);
2071 NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL);
2072 SysTick->VAL = 0UL;
2073 SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk |
2074 SysTick_CTRL_TICKINT_Msk |
2075 SysTick_CTRL_ENABLE_Msk;
2076 return (0UL);
2077 }
2078
2079 #endif
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093 extern volatile int32_t ITM_RxBuffer;
2094 #define ITM_RXBUFFER_EMPTY ((int32_t)0x5AA55AA5U)
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105 __STATIC_INLINE uint32_t ITM_SendChar (uint32_t ch)
2106 {
2107 if (((ITM->TCR & ITM_TCR_ITMENA_Msk) != 0UL) &&
2108 ((ITM->TER & 1UL ) != 0UL) )
2109 {
2110 while (ITM->PORT[0U].u32 == 0UL)
2111 {
2112 __NOP();
2113 }
2114 ITM->PORT[0U].u8 = (uint8_t)ch;
2115 }
2116 return (ch);
2117 }
2118
2119
2120
2121
2122
2123
2124
2125
2126 __STATIC_INLINE int32_t ITM_ReceiveChar (void)
2127 {
2128 int32_t ch = -1;
2129
2130 if (ITM_RxBuffer != ITM_RXBUFFER_EMPTY)
2131 {
2132 ch = ITM_RxBuffer;
2133 ITM_RxBuffer = ITM_RXBUFFER_EMPTY;
2134 }
2135
2136 return (ch);
2137 }
2138
2139
2140
2141
2142
2143
2144
2145
2146 __STATIC_INLINE int32_t ITM_CheckChar (void)
2147 {
2148
2149 if (ITM_RxBuffer == ITM_RXBUFFER_EMPTY)
2150 {
2151 return (0);
2152 }
2153 else
2154 {
2155 return (1);
2156 }
2157 }
2158
2159
2160
2161
2162
2163
2164 #ifdef __cplusplus
2165 }
2166 #endif
2167
2168 #endif
2169
2170 #endif