24 #ifndef __CM3_CORE_H__ 25 #define __CM3_CORE_H__ 85 #define __CM3_CMSIS_VERSION_MAIN (0x01) 86 #define __CM3_CMSIS_VERSION_SUB (0x30) 87 #define __CM3_CMSIS_VERSION ((__CM3_CMSIS_VERSION_MAIN << 16) | __CM3_CMSIS_VERSION_SUB) 89 #define __CORTEX_M (0x03) 93 #if defined (__ICCARM__) 94 #include <intrinsics.h> 98 #ifndef __NVIC_PRIO_BITS 99 #define __NVIC_PRIO_BITS 4 120 uint32_t RESERVED0[24];
122 uint32_t RSERVED1[24];
124 uint32_t RESERVED2[24];
126 uint32_t RESERVED3[24];
128 uint32_t RESERVED4[56];
130 uint32_t RESERVED5[644];
164 #define SCB_CPUID_IMPLEMENTER_Pos 24 165 #define SCB_CPUID_IMPLEMENTER_Msk (0xFFul << SCB_CPUID_IMPLEMENTER_Pos) 167 #define SCB_CPUID_VARIANT_Pos 20 168 #define SCB_CPUID_VARIANT_Msk (0xFul << SCB_CPUID_VARIANT_Pos) 170 #define SCB_CPUID_PARTNO_Pos 4 171 #define SCB_CPUID_PARTNO_Msk (0xFFFul << SCB_CPUID_PARTNO_Pos) 173 #define SCB_CPUID_REVISION_Pos 0 174 #define SCB_CPUID_REVISION_Msk (0xFul << SCB_CPUID_REVISION_Pos) 177 #define SCB_ICSR_NMIPENDSET_Pos 31 178 #define SCB_ICSR_NMIPENDSET_Msk (1ul << SCB_ICSR_NMIPENDSET_Pos) 180 #define SCB_ICSR_PENDSVSET_Pos 28 181 #define SCB_ICSR_PENDSVSET_Msk (1ul << SCB_ICSR_PENDSVSET_Pos) 183 #define SCB_ICSR_PENDSVCLR_Pos 27 184 #define SCB_ICSR_PENDSVCLR_Msk (1ul << SCB_ICSR_PENDSVCLR_Pos) 186 #define SCB_ICSR_PENDSTSET_Pos 26 187 #define SCB_ICSR_PENDSTSET_Msk (1ul << SCB_ICSR_PENDSTSET_Pos) 189 #define SCB_ICSR_PENDSTCLR_Pos 25 190 #define SCB_ICSR_PENDSTCLR_Msk (1ul << SCB_ICSR_PENDSTCLR_Pos) 192 #define SCB_ICSR_ISRPREEMPT_Pos 23 193 #define SCB_ICSR_ISRPREEMPT_Msk (1ul << SCB_ICSR_ISRPREEMPT_Pos) 195 #define SCB_ICSR_ISRPENDING_Pos 22 196 #define SCB_ICSR_ISRPENDING_Msk (1ul << SCB_ICSR_ISRPENDING_Pos) 198 #define SCB_ICSR_VECTPENDING_Pos 12 199 #define SCB_ICSR_VECTPENDING_Msk (0x1FFul << SCB_ICSR_VECTPENDING_Pos) 201 #define SCB_ICSR_RETTOBASE_Pos 11 202 #define SCB_ICSR_RETTOBASE_Msk (1ul << SCB_ICSR_RETTOBASE_Pos) 204 #define SCB_ICSR_VECTACTIVE_Pos 0 205 #define SCB_ICSR_VECTACTIVE_Msk (0x1FFul << SCB_ICSR_VECTACTIVE_Pos) 208 #define SCB_VTOR_TBLBASE_Pos 29 209 #define SCB_VTOR_TBLBASE_Msk (0x1FFul << SCB_VTOR_TBLBASE_Pos) 211 #define SCB_VTOR_TBLOFF_Pos 7 212 #define SCB_VTOR_TBLOFF_Msk (0x3FFFFFul << SCB_VTOR_TBLOFF_Pos) 215 #define SCB_AIRCR_VECTKEY_Pos 16 216 #define SCB_AIRCR_VECTKEY_Msk (0xFFFFul << SCB_AIRCR_VECTKEY_Pos) 218 #define SCB_AIRCR_VECTKEYSTAT_Pos 16 219 #define SCB_AIRCR_VECTKEYSTAT_Msk (0xFFFFul << SCB_AIRCR_VECTKEYSTAT_Pos) 221 #define SCB_AIRCR_ENDIANESS_Pos 15 222 #define SCB_AIRCR_ENDIANESS_Msk (1ul << SCB_AIRCR_ENDIANESS_Pos) 224 #define SCB_AIRCR_PRIGROUP_Pos 8 225 #define SCB_AIRCR_PRIGROUP_Msk (7ul << SCB_AIRCR_PRIGROUP_Pos) 227 #define SCB_AIRCR_SYSRESETREQ_Pos 2 228 #define SCB_AIRCR_SYSRESETREQ_Msk (1ul << SCB_AIRCR_SYSRESETREQ_Pos) 230 #define SCB_AIRCR_VECTCLRACTIVE_Pos 1 231 #define SCB_AIRCR_VECTCLRACTIVE_Msk (1ul << SCB_AIRCR_VECTCLRACTIVE_Pos) 233 #define SCB_AIRCR_VECTRESET_Pos 0 234 #define SCB_AIRCR_VECTRESET_Msk (1ul << SCB_AIRCR_VECTRESET_Pos) 237 #define SCB_SCR_SEVONPEND_Pos 4 238 #define SCB_SCR_SEVONPEND_Msk (1ul << SCB_SCR_SEVONPEND_Pos) 240 #define SCB_SCR_SLEEPDEEP_Pos 2 241 #define SCB_SCR_SLEEPDEEP_Msk (1ul << SCB_SCR_SLEEPDEEP_Pos) 243 #define SCB_SCR_SLEEPONEXIT_Pos 1 244 #define SCB_SCR_SLEEPONEXIT_Msk (1ul << SCB_SCR_SLEEPONEXIT_Pos) 247 #define SCB_CCR_STKALIGN_Pos 9 248 #define SCB_CCR_STKALIGN_Msk (1ul << SCB_CCR_STKALIGN_Pos) 250 #define SCB_CCR_BFHFNMIGN_Pos 8 251 #define SCB_CCR_BFHFNMIGN_Msk (1ul << SCB_CCR_BFHFNMIGN_Pos) 253 #define SCB_CCR_DIV_0_TRP_Pos 4 254 #define SCB_CCR_DIV_0_TRP_Msk (1ul << SCB_CCR_DIV_0_TRP_Pos) 256 #define SCB_CCR_UNALIGN_TRP_Pos 3 257 #define SCB_CCR_UNALIGN_TRP_Msk (1ul << SCB_CCR_UNALIGN_TRP_Pos) 259 #define SCB_CCR_USERSETMPEND_Pos 1 260 #define SCB_CCR_USERSETMPEND_Msk (1ul << SCB_CCR_USERSETMPEND_Pos) 262 #define SCB_CCR_NONBASETHRDENA_Pos 0 263 #define SCB_CCR_NONBASETHRDENA_Msk (1ul << SCB_CCR_NONBASETHRDENA_Pos) 266 #define SCB_SHCSR_USGFAULTENA_Pos 18 267 #define SCB_SHCSR_USGFAULTENA_Msk (1ul << SCB_SHCSR_USGFAULTENA_Pos) 269 #define SCB_SHCSR_BUSFAULTENA_Pos 17 270 #define SCB_SHCSR_BUSFAULTENA_Msk (1ul << SCB_SHCSR_BUSFAULTENA_Pos) 272 #define SCB_SHCSR_MEMFAULTENA_Pos 16 273 #define SCB_SHCSR_MEMFAULTENA_Msk (1ul << SCB_SHCSR_MEMFAULTENA_Pos) 275 #define SCB_SHCSR_SVCALLPENDED_Pos 15 276 #define SCB_SHCSR_SVCALLPENDED_Msk (1ul << SCB_SHCSR_SVCALLPENDED_Pos) 278 #define SCB_SHCSR_BUSFAULTPENDED_Pos 14 279 #define SCB_SHCSR_BUSFAULTPENDED_Msk (1ul << SCB_SHCSR_BUSFAULTPENDED_Pos) 281 #define SCB_SHCSR_MEMFAULTPENDED_Pos 13 282 #define SCB_SHCSR_MEMFAULTPENDED_Msk (1ul << SCB_SHCSR_MEMFAULTPENDED_Pos) 284 #define SCB_SHCSR_USGFAULTPENDED_Pos 12 285 #define SCB_SHCSR_USGFAULTPENDED_Msk (1ul << SCB_SHCSR_USGFAULTPENDED_Pos) 287 #define SCB_SHCSR_SYSTICKACT_Pos 11 288 #define SCB_SHCSR_SYSTICKACT_Msk (1ul << SCB_SHCSR_SYSTICKACT_Pos) 290 #define SCB_SHCSR_PENDSVACT_Pos 10 291 #define SCB_SHCSR_PENDSVACT_Msk (1ul << SCB_SHCSR_PENDSVACT_Pos) 293 #define SCB_SHCSR_MONITORACT_Pos 8 294 #define SCB_SHCSR_MONITORACT_Msk (1ul << SCB_SHCSR_MONITORACT_Pos) 296 #define SCB_SHCSR_SVCALLACT_Pos 7 297 #define SCB_SHCSR_SVCALLACT_Msk (1ul << SCB_SHCSR_SVCALLACT_Pos) 299 #define SCB_SHCSR_USGFAULTACT_Pos 3 300 #define SCB_SHCSR_USGFAULTACT_Msk (1ul << SCB_SHCSR_USGFAULTACT_Pos) 302 #define SCB_SHCSR_BUSFAULTACT_Pos 1 303 #define SCB_SHCSR_BUSFAULTACT_Msk (1ul << SCB_SHCSR_BUSFAULTACT_Pos) 305 #define SCB_SHCSR_MEMFAULTACT_Pos 0 306 #define SCB_SHCSR_MEMFAULTACT_Msk (1ul << SCB_SHCSR_MEMFAULTACT_Pos) 309 #define SCB_CFSR_USGFAULTSR_Pos 16 310 #define SCB_CFSR_USGFAULTSR_Msk (0xFFFFul << SCB_CFSR_USGFAULTSR_Pos) 312 #define SCB_CFSR_BUSFAULTSR_Pos 8 313 #define SCB_CFSR_BUSFAULTSR_Msk (0xFFul << SCB_CFSR_BUSFAULTSR_Pos) 315 #define SCB_CFSR_MEMFAULTSR_Pos 0 316 #define SCB_CFSR_MEMFAULTSR_Msk (0xFFul << SCB_CFSR_MEMFAULTSR_Pos) 319 #define SCB_HFSR_DEBUGEVT_Pos 31 320 #define SCB_HFSR_DEBUGEVT_Msk (1ul << SCB_HFSR_DEBUGEVT_Pos) 322 #define SCB_HFSR_FORCED_Pos 30 323 #define SCB_HFSR_FORCED_Msk (1ul << SCB_HFSR_FORCED_Pos) 325 #define SCB_HFSR_VECTTBL_Pos 1 326 #define SCB_HFSR_VECTTBL_Msk (1ul << SCB_HFSR_VECTTBL_Pos) 329 #define SCB_DFSR_EXTERNAL_Pos 4 330 #define SCB_DFSR_EXTERNAL_Msk (1ul << SCB_DFSR_EXTERNAL_Pos) 332 #define SCB_DFSR_VCATCH_Pos 3 333 #define SCB_DFSR_VCATCH_Msk (1ul << SCB_DFSR_VCATCH_Pos) 335 #define SCB_DFSR_DWTTRAP_Pos 2 336 #define SCB_DFSR_DWTTRAP_Msk (1ul << SCB_DFSR_DWTTRAP_Pos) 338 #define SCB_DFSR_BKPT_Pos 1 339 #define SCB_DFSR_BKPT_Msk (1ul << SCB_DFSR_BKPT_Pos) 341 #define SCB_DFSR_HALTED_Pos 0 342 #define SCB_DFSR_HALTED_Msk (1ul << SCB_DFSR_HALTED_Pos) 359 #define SysTick_CTRL_COUNTFLAG_Pos 16 360 #define SysTick_CTRL_COUNTFLAG_Msk (1ul << SysTick_CTRL_COUNTFLAG_Pos) 362 #define SysTick_CTRL_CLKSOURCE_Pos 2 363 #define SysTick_CTRL_CLKSOURCE_Msk (1ul << SysTick_CTRL_CLKSOURCE_Pos) 365 #define SysTick_CTRL_TICKINT_Pos 1 366 #define SysTick_CTRL_TICKINT_Msk (1ul << SysTick_CTRL_TICKINT_Pos) 368 #define SysTick_CTRL_ENABLE_Pos 0 369 #define SysTick_CTRL_ENABLE_Msk (1ul << SysTick_CTRL_ENABLE_Pos) 372 #define SysTick_LOAD_RELOAD_Pos 0 373 #define SysTick_LOAD_RELOAD_Msk (0xFFFFFFul << SysTick_LOAD_RELOAD_Pos) 376 #define SysTick_VAL_CURRENT_Pos 0 377 #define SysTick_VAL_CURRENT_Msk (0xFFFFFFul << SysTick_VAL_CURRENT_Pos) 380 #define SysTick_CALIB_NOREF_Pos 31 381 #define SysTick_CALIB_NOREF_Msk (1ul << SysTick_CALIB_NOREF_Pos) 383 #define SysTick_CALIB_SKEW_Pos 30 384 #define SysTick_CALIB_SKEW_Msk (1ul << SysTick_CALIB_SKEW_Pos) 386 #define SysTick_CALIB_TENMS_Pos 0 387 #define SysTick_CALIB_TENMS_Msk (0xFFFFFFul << SysTick_VAL_CURRENT_Pos) 403 uint32_t RESERVED0[864];
405 uint32_t RESERVED1[15];
407 uint32_t RESERVED2[15];
409 uint32_t RESERVED3[29];
413 uint32_t RESERVED4[43];
416 uint32_t RESERVED5[6];
432 #define ITM_TPR_PRIVMASK_Pos 0 433 #define ITM_TPR_PRIVMASK_Msk (0xFul << ITM_TPR_PRIVMASK_Pos) 436 #define ITM_TCR_BUSY_Pos 23 437 #define ITM_TCR_BUSY_Msk (1ul << ITM_TCR_BUSY_Pos) 439 #define ITM_TCR_ATBID_Pos 16 440 #define ITM_TCR_ATBID_Msk (0x7Ful << ITM_TCR_ATBID_Pos) 442 #define ITM_TCR_TSPrescale_Pos 8 443 #define ITM_TCR_TSPrescale_Msk (3ul << ITM_TCR_TSPrescale_Pos) 445 #define ITM_TCR_SWOENA_Pos 4 446 #define ITM_TCR_SWOENA_Msk (1ul << ITM_TCR_SWOENA_Pos) 448 #define ITM_TCR_DWTENA_Pos 3 449 #define ITM_TCR_DWTENA_Msk (1ul << ITM_TCR_DWTENA_Pos) 451 #define ITM_TCR_SYNCENA_Pos 2 452 #define ITM_TCR_SYNCENA_Msk (1ul << ITM_TCR_SYNCENA_Pos) 454 #define ITM_TCR_TSENA_Pos 1 455 #define ITM_TCR_TSENA_Msk (1ul << ITM_TCR_TSENA_Pos) 457 #define ITM_TCR_ITMENA_Pos 0 458 #define ITM_TCR_ITMENA_Msk (1ul << ITM_TCR_ITMENA_Pos) 461 #define ITM_IWR_ATVALIDM_Pos 0 462 #define ITM_IWR_ATVALIDM_Msk (1ul << ITM_IWR_ATVALIDM_Pos) 465 #define ITM_IRR_ATREADYM_Pos 0 466 #define ITM_IRR_ATREADYM_Msk (1ul << ITM_IRR_ATREADYM_Pos) 469 #define ITM_IMCR_INTEGRATION_Pos 0 470 #define ITM_IMCR_INTEGRATION_Msk (1ul << ITM_IMCR_INTEGRATION_Pos) 473 #define ITM_LSR_ByteAcc_Pos 2 474 #define ITM_LSR_ByteAcc_Msk (1ul << ITM_LSR_ByteAcc_Pos) 476 #define ITM_LSR_Access_Pos 1 477 #define ITM_LSR_Access_Msk (1ul << ITM_LSR_Access_Pos) 479 #define ITM_LSR_Present_Pos 0 480 #define ITM_LSR_Present_Msk (1ul << ITM_LSR_Present_Pos) 492 #if ((defined __CM3_REV) && (__CM3_REV >= 0x200)) 500 #define InterruptType_ICTR_INTLINESNUM_Pos 0 501 #define InterruptType_ICTR_INTLINESNUM_Msk (0x1Ful << InterruptType_ICTR_INTLINESNUM_Pos) 504 #define InterruptType_ACTLR_DISFOLD_Pos 2 505 #define InterruptType_ACTLR_DISFOLD_Msk (1ul << InterruptType_ACTLR_DISFOLD_Pos) 507 #define InterruptType_ACTLR_DISDEFWBUF_Pos 1 508 #define InterruptType_ACTLR_DISDEFWBUF_Msk (1ul << InterruptType_ACTLR_DISDEFWBUF_Pos) 510 #define InterruptType_ACTLR_DISMCYCINT_Pos 0 511 #define InterruptType_ACTLR_DISMCYCINT_Msk (1ul << InterruptType_ACTLR_DISMCYCINT_Pos) 515 #if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1) 536 #define MPU_TYPE_IREGION_Pos 16 537 #define MPU_TYPE_IREGION_Msk (0xFFul << MPU_TYPE_IREGION_Pos) 539 #define MPU_TYPE_DREGION_Pos 8 540 #define MPU_TYPE_DREGION_Msk (0xFFul << MPU_TYPE_DREGION_Pos) 542 #define MPU_TYPE_SEPARATE_Pos 0 543 #define MPU_TYPE_SEPARATE_Msk (1ul << MPU_TYPE_SEPARATE_Pos) 546 #define MPU_CTRL_PRIVDEFENA_Pos 2 547 #define MPU_CTRL_PRIVDEFENA_Msk (1ul << MPU_CTRL_PRIVDEFENA_Pos) 549 #define MPU_CTRL_HFNMIENA_Pos 1 550 #define MPU_CTRL_HFNMIENA_Msk (1ul << MPU_CTRL_HFNMIENA_Pos) 552 #define MPU_CTRL_ENABLE_Pos 0 553 #define MPU_CTRL_ENABLE_Msk (1ul << MPU_CTRL_ENABLE_Pos) 556 #define MPU_RNR_REGION_Pos 0 557 #define MPU_RNR_REGION_Msk (0xFFul << MPU_RNR_REGION_Pos) 560 #define MPU_RBAR_ADDR_Pos 5 561 #define MPU_RBAR_ADDR_Msk (0x7FFFFFFul << MPU_RBAR_ADDR_Pos) 563 #define MPU_RBAR_VALID_Pos 4 564 #define MPU_RBAR_VALID_Msk (1ul << MPU_RBAR_VALID_Pos) 566 #define MPU_RBAR_REGION_Pos 0 567 #define MPU_RBAR_REGION_Msk (0xFul << MPU_RBAR_REGION_Pos) 570 #define MPU_RASR_XN_Pos 28 571 #define MPU_RASR_XN_Msk (1ul << MPU_RASR_XN_Pos) 573 #define MPU_RASR_AP_Pos 24 574 #define MPU_RASR_AP_Msk (7ul << MPU_RASR_AP_Pos) 576 #define MPU_RASR_TEX_Pos 19 577 #define MPU_RASR_TEX_Msk (7ul << MPU_RASR_TEX_Pos) 579 #define MPU_RASR_S_Pos 18 580 #define MPU_RASR_S_Msk (1ul << MPU_RASR_S_Pos) 582 #define MPU_RASR_C_Pos 17 583 #define MPU_RASR_C_Msk (1ul << MPU_RASR_C_Pos) 585 #define MPU_RASR_B_Pos 16 586 #define MPU_RASR_B_Msk (1ul << MPU_RASR_B_Pos) 588 #define MPU_RASR_SRD_Pos 8 589 #define MPU_RASR_SRD_Msk (0xFFul << MPU_RASR_SRD_Pos) 591 #define MPU_RASR_SIZE_Pos 1 592 #define MPU_RASR_SIZE_Msk (0x1Ful << MPU_RASR_SIZE_Pos) 594 #define MPU_RASR_ENA_Pos 0 595 #define MPU_RASR_ENA_Msk (0x1Ful << MPU_RASR_ENA_Pos) 614 #define CoreDebug_DHCSR_DBGKEY_Pos 16 615 #define CoreDebug_DHCSR_DBGKEY_Msk (0xFFFFul << CoreDebug_DHCSR_DBGKEY_Pos) 617 #define CoreDebug_DHCSR_S_RESET_ST_Pos 25 618 #define CoreDebug_DHCSR_S_RESET_ST_Msk (1ul << CoreDebug_DHCSR_S_RESET_ST_Pos) 620 #define CoreDebug_DHCSR_S_RETIRE_ST_Pos 24 621 #define CoreDebug_DHCSR_S_RETIRE_ST_Msk (1ul << CoreDebug_DHCSR_S_RETIRE_ST_Pos) 623 #define CoreDebug_DHCSR_S_LOCKUP_Pos 19 624 #define CoreDebug_DHCSR_S_LOCKUP_Msk (1ul << CoreDebug_DHCSR_S_LOCKUP_Pos) 626 #define CoreDebug_DHCSR_S_SLEEP_Pos 18 627 #define CoreDebug_DHCSR_S_SLEEP_Msk (1ul << CoreDebug_DHCSR_S_SLEEP_Pos) 629 #define CoreDebug_DHCSR_S_HALT_Pos 17 630 #define CoreDebug_DHCSR_S_HALT_Msk (1ul << CoreDebug_DHCSR_S_HALT_Pos) 632 #define CoreDebug_DHCSR_S_REGRDY_Pos 16 633 #define CoreDebug_DHCSR_S_REGRDY_Msk (1ul << CoreDebug_DHCSR_S_REGRDY_Pos) 635 #define CoreDebug_DHCSR_C_SNAPSTALL_Pos 5 636 #define CoreDebug_DHCSR_C_SNAPSTALL_Msk (1ul << CoreDebug_DHCSR_C_SNAPSTALL_Pos) 638 #define CoreDebug_DHCSR_C_MASKINTS_Pos 3 639 #define CoreDebug_DHCSR_C_MASKINTS_Msk (1ul << CoreDebug_DHCSR_C_MASKINTS_Pos) 641 #define CoreDebug_DHCSR_C_STEP_Pos 2 642 #define CoreDebug_DHCSR_C_STEP_Msk (1ul << CoreDebug_DHCSR_C_STEP_Pos) 644 #define CoreDebug_DHCSR_C_HALT_Pos 1 645 #define CoreDebug_DHCSR_C_HALT_Msk (1ul << CoreDebug_DHCSR_C_HALT_Pos) 647 #define CoreDebug_DHCSR_C_DEBUGEN_Pos 0 648 #define CoreDebug_DHCSR_C_DEBUGEN_Msk (1ul << CoreDebug_DHCSR_C_DEBUGEN_Pos) 651 #define CoreDebug_DCRSR_REGWnR_Pos 16 652 #define CoreDebug_DCRSR_REGWnR_Msk (1ul << CoreDebug_DCRSR_REGWnR_Pos) 654 #define CoreDebug_DCRSR_REGSEL_Pos 0 655 #define CoreDebug_DCRSR_REGSEL_Msk (0x1Ful << CoreDebug_DCRSR_REGSEL_Pos) 658 #define CoreDebug_DEMCR_TRCENA_Pos 24 659 #define CoreDebug_DEMCR_TRCENA_Msk (1ul << CoreDebug_DEMCR_TRCENA_Pos) 661 #define CoreDebug_DEMCR_MON_REQ_Pos 19 662 #define CoreDebug_DEMCR_MON_REQ_Msk (1ul << CoreDebug_DEMCR_MON_REQ_Pos) 664 #define CoreDebug_DEMCR_MON_STEP_Pos 18 665 #define CoreDebug_DEMCR_MON_STEP_Msk (1ul << CoreDebug_DEMCR_MON_STEP_Pos) 667 #define CoreDebug_DEMCR_MON_PEND_Pos 17 668 #define CoreDebug_DEMCR_MON_PEND_Msk (1ul << CoreDebug_DEMCR_MON_PEND_Pos) 670 #define CoreDebug_DEMCR_MON_EN_Pos 16 671 #define CoreDebug_DEMCR_MON_EN_Msk (1ul << CoreDebug_DEMCR_MON_EN_Pos) 673 #define CoreDebug_DEMCR_VC_HARDERR_Pos 10 674 #define CoreDebug_DEMCR_VC_HARDERR_Msk (1ul << CoreDebug_DEMCR_VC_HARDERR_Pos) 676 #define CoreDebug_DEMCR_VC_INTERR_Pos 9 677 #define CoreDebug_DEMCR_VC_INTERR_Msk (1ul << CoreDebug_DEMCR_VC_INTERR_Pos) 679 #define CoreDebug_DEMCR_VC_BUSERR_Pos 8 680 #define CoreDebug_DEMCR_VC_BUSERR_Msk (1ul << CoreDebug_DEMCR_VC_BUSERR_Pos) 682 #define CoreDebug_DEMCR_VC_STATERR_Pos 7 683 #define CoreDebug_DEMCR_VC_STATERR_Msk (1ul << CoreDebug_DEMCR_VC_STATERR_Pos) 685 #define CoreDebug_DEMCR_VC_CHKERR_Pos 6 686 #define CoreDebug_DEMCR_VC_CHKERR_Msk (1ul << CoreDebug_DEMCR_VC_CHKERR_Pos) 688 #define CoreDebug_DEMCR_VC_NOCPERR_Pos 5 689 #define CoreDebug_DEMCR_VC_NOCPERR_Msk (1ul << CoreDebug_DEMCR_VC_NOCPERR_Pos) 691 #define CoreDebug_DEMCR_VC_MMERR_Pos 4 692 #define CoreDebug_DEMCR_VC_MMERR_Msk (1ul << CoreDebug_DEMCR_VC_MMERR_Pos) 694 #define CoreDebug_DEMCR_VC_CORERESET_Pos 0 695 #define CoreDebug_DEMCR_VC_CORERESET_Msk (1ul << CoreDebug_DEMCR_VC_CORERESET_Pos) 700 #define SCS_BASE (0xE000E000) 701 #define ITM_BASE (0xE0000000) 702 #define CoreDebug_BASE (0xE000EDF0) 703 #define SysTick_BASE (SCS_BASE + 0x0010) 704 #define NVIC_BASE (SCS_BASE + 0x0100) 705 #define SCB_BASE (SCS_BASE + 0x0D00) 707 #define InterruptType ((InterruptType_Type *) SCS_BASE) 708 #define SCB ((SCB_Type *) SCB_BASE) 709 #define SysTick ((SysTick_Type *) SysTick_BASE) 710 #define NVIC ((NVIC_Type *) NVIC_BASE) 711 #define ITM ((ITM_Type *) ITM_BASE) 712 #define CoreDebug ((CoreDebug_Type *) CoreDebug_BASE) 714 #if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1) 715 #define MPU_BASE (SCS_BASE + 0x0D90) 716 #define MPU ((MPU_Type*) MPU_BASE) 726 #if defined ( __CC_ARM ) 728 #define __INLINE __inline 730 #elif defined ( __ICCARM__ ) 732 #define __INLINE inline 734 #elif defined ( __GNUC__ ) 736 #define __INLINE inline 738 #elif defined ( __TASKING__ ) 740 #define __INLINE inline 747 #if defined ( __CC_ARM ) 750 #define __enable_fault_irq __enable_fiq 751 #define __disable_fault_irq __disable_fiq 757 #define __ISB() __isb(0) 758 #define __DSB() __dsb(0) 759 #define __DMB() __dmb(0) 761 #define __RBIT __rbit 762 #define __LDREXB(ptr) ((unsigned char ) __ldrex(ptr)) 763 #define __LDREXH(ptr) ((unsigned short) __ldrex(ptr)) 764 #define __LDREXW(ptr) ((unsigned int ) __ldrex(ptr)) 765 #define __STREXB(value, ptr) __strex(value, ptr) 766 #define __STREXH(value, ptr) __strex(value, ptr) 767 #define __STREXW(value, ptr) __strex(value, ptr) 783 extern uint32_t __get_PSP(
void);
793 extern void __set_PSP(uint32_t topOfProcStack);
803 extern uint32_t __get_MSP(
void);
813 extern void __set_MSP(uint32_t topOfMainStack);
823 extern uint32_t __REV16(uint16_t value);
833 extern int32_t __REVSH(int16_t value);
836 #if (__ARMCC_VERSION < 400000) 843 extern void __CLREX(
void);
852 extern uint32_t __get_BASEPRI(
void);
861 extern void __set_BASEPRI(uint32_t basePri);
870 extern uint32_t __get_PRIMASK(
void);
879 extern void __set_PRIMASK(uint32_t priMask);
888 extern uint32_t __get_FAULTMASK(
void);
897 extern void __set_FAULTMASK(uint32_t faultMask);
906 extern uint32_t __get_CONTROL(
void);
915 extern void __set_CONTROL(uint32_t control);
924 #define __CLREX __clrex 933 static __INLINE uint32_t __get_BASEPRI(
void)
935 register uint32_t __regBasePri __ASM(
"basepri");
936 return(__regBasePri);
946 static __INLINE
void __set_BASEPRI(uint32_t basePri)
948 register uint32_t __regBasePri __ASM(
"basepri");
949 __regBasePri = (basePri & 0xff);
959 static __INLINE uint32_t __get_PRIMASK(
void)
961 register uint32_t __regPriMask __ASM(
"primask");
962 return(__regPriMask);
972 static __INLINE
void __set_PRIMASK(uint32_t priMask)
974 register uint32_t __regPriMask __ASM(
"primask");
975 __regPriMask = (priMask);
985 static __INLINE uint32_t __get_FAULTMASK(
void)
987 register uint32_t __regFaultMask __ASM(
"faultmask");
988 return(__regFaultMask);
998 static __INLINE
void __set_FAULTMASK(uint32_t faultMask)
1000 register uint32_t __regFaultMask __ASM(
"faultmask");
1001 __regFaultMask = (faultMask & 1);
1011 static __INLINE uint32_t __get_CONTROL(
void)
1013 register uint32_t __regControl __ASM(
"control");
1014 return(__regControl);
1024 static __INLINE
void __set_CONTROL(uint32_t control)
1026 register uint32_t __regControl __ASM(
"control");
1027 __regControl = control;
1034 #elif (defined (__ICCARM__)) 1037 #define __enable_irq __enable_interrupt 1038 #define __disable_irq __disable_interrupt 1040 static __INLINE void __enable_fault_irq() { __ASM ("cpsie f"); } 1041 static __INLINE
void __disable_fault_irq() { __ASM (
"cpsid f"); }
1043 #define __NOP __no_operation 1044 static __INLINE void __WFI() { __ASM ("wfi"); } 1045 static __INLINE
void __WFE() { __ASM (
"wfe"); }
1046 static __INLINE
void __SEV() { __ASM (
"sev"); }
1047 static __INLINE
void __CLREX() { __ASM (
"clrex"); }
1069 extern uint32_t __get_PSP(
void);
1079 extern void __set_PSP(uint32_t topOfProcStack);
1089 extern uint32_t __get_MSP(
void);
1099 extern void __set_MSP(uint32_t topOfMainStack);
1109 extern uint32_t __REV16(uint16_t value);
1119 extern uint32_t __RBIT(uint32_t value);
1129 extern uint8_t __LDREXB(uint8_t *addr);
1139 extern uint16_t __LDREXH(uint16_t *addr);
1149 extern uint32_t __LDREXW(uint32_t *addr);
1160 extern uint32_t __STREXB(uint8_t value, uint8_t *addr);
1171 extern uint32_t __STREXH(uint16_t value, uint16_t *addr);
1182 extern uint32_t __STREXW(uint32_t value, uint32_t *addr);
1186 #elif (defined (__GNUC__)) 1189 static __INLINE
void __enable_irq() { __ASM
volatile (
"cpsie i"); }
1190 static __INLINE
void __disable_irq() { __ASM
volatile (
"cpsid i"); }
1192 static __INLINE
void __enable_fault_irq() { __ASM
volatile (
"cpsie f"); }
1193 static __INLINE
void __disable_fault_irq() { __ASM
volatile (
"cpsid f"); }
1195 static __INLINE
void __NOP() { __ASM
volatile (
"nop"); }
1196 static __INLINE
void __WFI() { __ASM
volatile (
"wfi"); }
1197 static __INLINE
void __WFE() { __ASM
volatile (
"wfe"); }
1198 static __INLINE
void __SEV() { __ASM
volatile (
"sev"); }
1199 static __INLINE
void __ISB() { __ASM
volatile (
"isb"); }
1200 static __INLINE
void __DSB() { __ASM
volatile (
"dsb"); }
1201 static __INLINE
void __DMB() { __ASM
volatile (
"dmb"); }
1202 static __INLINE
void __CLREX() { __ASM
volatile (
"clrex"); }
1212 extern uint32_t __get_PSP(
void);
1222 extern void __set_PSP(uint32_t topOfProcStack);
1232 extern uint32_t __get_MSP(
void);
1242 extern void __set_MSP(uint32_t topOfMainStack);
1251 extern uint32_t __get_BASEPRI(
void);
1260 extern void __set_BASEPRI(uint32_t basePri);
1269 extern uint32_t __get_PRIMASK(
void);
1278 extern void __set_PRIMASK(uint32_t priMask);
1287 extern uint32_t __get_FAULTMASK(
void);
1296 extern void __set_FAULTMASK(uint32_t faultMask);
1305 extern uint32_t __get_CONTROL(
void);
1314 extern void __set_CONTROL(uint32_t control);
1324 extern uint32_t __REV(uint32_t value);
1334 extern uint32_t __REV16(uint16_t value);
1344 extern int32_t __REVSH(int16_t value);
1354 extern uint32_t __RBIT(uint32_t value);
1364 extern uint8_t __LDREXB(uint8_t *addr);
1374 extern uint16_t __LDREXH(uint16_t *addr);
1384 extern uint32_t __LDREXW(uint32_t *addr);
1395 extern uint32_t __STREXB(uint8_t value, uint8_t *addr);
1406 extern uint32_t __STREXH(uint16_t value, uint16_t *addr);
1417 extern uint32_t __STREXW(uint32_t value, uint32_t *addr);
1420 #elif (defined (__TASKING__)) 1453 static __INLINE
void NVIC_SetPriorityGrouping(uint32_t PriorityGroup)
1456 uint32_t PriorityGroupTmp = (PriorityGroup & 0x07);
1458 reg_value =
SCB->AIRCR;
1460 reg_value = (reg_value |
1462 (PriorityGroupTmp << 8));
1463 SCB->AIRCR = reg_value;
1474 static __INLINE uint32_t NVIC_GetPriorityGrouping(
void)
1489 NVIC->ISER[((uint32_t)(IRQn) >> 5)] = (1 << ((uint32_t)(
IRQn) & 0x1F));
1500 static __INLINE
void NVIC_DisableIRQ(
IRQn_Type IRQn)
1502 NVIC->ICER[((uint32_t)(IRQn) >> 5)] = (1 << ((uint32_t)(
IRQn) & 0x1F));
1514 static __INLINE uint32_t NVIC_GetPendingIRQ(
IRQn_Type IRQn)
1516 return((uint32_t) ((
NVIC->ISPR[(uint32_t)(IRQn) >> 5] & (1 << ((uint32_t)(IRQn) & 0x1F)))?1:0));
1527 static __INLINE
void NVIC_SetPendingIRQ(
IRQn_Type IRQn)
1529 NVIC->ISPR[((uint32_t)(IRQn) >> 5)] = (1 << ((uint32_t)(
IRQn) & 0x1F));
1540 static __INLINE
void NVIC_ClearPendingIRQ(
IRQn_Type IRQn)
1542 NVIC->ICPR[((uint32_t)(IRQn) >> 5)] = (1 << ((uint32_t)(
IRQn) & 0x1F));
1554 static __INLINE uint32_t NVIC_GetActive(
IRQn_Type IRQn)
1556 return((uint32_t)((
NVIC->IABR[(uint32_t)(IRQn) >> 5] & (1 << ((uint32_t)(IRQn) & 0x1F)))?1:0));
1571 static __INLINE
void NVIC_SetPriority(
IRQn_Type IRQn, uint32_t priority)
1594 static __INLINE uint32_t NVIC_GetPriority(
IRQn_Type IRQn)
1619 static __INLINE uint32_t NVIC_EncodePriority (uint32_t PriorityGroup, uint32_t PreemptPriority, uint32_t SubPriority)
1621 uint32_t PriorityGroupTmp = (PriorityGroup & 0x07);
1622 uint32_t PreemptPriorityBits;
1623 uint32_t SubPriorityBits;
1629 ((PreemptPriority & ((1 << (PreemptPriorityBits)) - 1)) << SubPriorityBits) |
1630 ((SubPriority & ((1 << (SubPriorityBits )) - 1)))
1650 static __INLINE
void NVIC_DecodePriority (uint32_t Priority, uint32_t PriorityGroup, uint32_t* pPreemptPriority, uint32_t* pSubPriority)
1652 uint32_t PriorityGroupTmp = (PriorityGroup & 0x07);
1653 uint32_t PreemptPriorityBits;
1654 uint32_t SubPriorityBits;
1656 PreemptPriorityBits = ((7 - PriorityGroupTmp) > __NVIC_PRIO_BITS) ? __NVIC_PRIO_BITS : 7 - PriorityGroupTmp;
1659 *pPreemptPriority = (Priority >> SubPriorityBits) & ((1 << (PreemptPriorityBits)) - 1);
1660 *pSubPriority = (Priority ) & ((1 << (SubPriorityBits )) - 1);
1667 #if (!defined (__Vendor_SysTickConfig)) || (__Vendor_SysTickConfig == 0) 1679 static __INLINE uint32_t SysTick_Config(uint32_t ticks)
1684 NVIC_SetPriority (
SysTick_IRQn, (1<<__NVIC_PRIO_BITS) - 1);
1704 static __INLINE
void NVIC_SystemReset(
void)
1728 #define ITM_RXBUFFER_EMPTY 0x5AA55AA5 1741 static __INLINE uint32_t ITM_SendChar (uint32_t ch) 1745 (
ITM->TER & (1ul << 0) ) )
1747 while (
ITM->PORT[0].u32 == 0);
1748 ITM->PORT[0].u8 = (uint8_t) ch;
1763 static __INLINE
int ITM_ReceiveChar (
void) {
1783 static __INLINE
int ITM_CheckChar (
void) {
__IO uint32_t CTRL
Definition: core_cm3.h:523
#define __I
Definition: LPC17xx.h:39
#define SCB_AIRCR_VECTKEY_Pos
Definition: core_cm3.h:215
__O uint32_t STIR
Definition: core_cm3.h:131
__IO uint32_t RBAR_A1
Definition: core_cm3.h:527
#define ITM
Definition: core_cm3.h:711
__IO uint32_t DCRDR
Definition: core_cm3.h:609
__IO uint32_t MMFAR
Definition: core_cm3.h:153
__IO uint32_t DHCSR
Definition: core_cm3.h:607
#define CoreDebug_DEMCR_TRCENA_Msk
Definition: core_cm3.h:659
__IO uint32_t TPR
Definition: core_cm3.h:406
#define SysTick_CTRL_CLKSOURCE_Msk
Definition: core_cm3.h:363
__I uint32_t PID5
Definition: core_cm3.h:418
__IO uint32_t RASR_A2
Definition: core_cm3.h:530
__I uint32_t PID2
Definition: core_cm3.h:423
__IO uint32_t SHCSR
Definition: core_cm3.h:149
__O uint32_t DCRSR
Definition: core_cm3.h:608
__I uint32_t PID3
Definition: core_cm3.h:424
#define CoreDebug
Definition: core_cm3.h:712
__IO uint32_t LSR
Definition: core_cm3.h:415
IRQn
Definition: LPC17xx.h:53
Definition: core_cm3.h:117
__IO uint32_t CFSR
Definition: core_cm3.h:150
#define SysTick_LOAD_RELOAD_Msk
Definition: core_cm3.h:373
Definition: core_cm3.h:140
uint32_t RESERVED0
Definition: core_cm3.h:490
__IO uint32_t VAL
Definition: core_cm3.h:354
__I uint32_t PID7
Definition: core_cm3.h:420
#define SCB_AIRCR_VECTKEY_Msk
Definition: core_cm3.h:216
__IO uint32_t RASR_A3
Definition: core_cm3.h:532
__IO uint32_t VTOR
Definition: core_cm3.h:144
__IO uint32_t TER
Definition: core_cm3.h:404
__I uint32_t CALIB
Definition: core_cm3.h:355
__IO uint32_t LAR
Definition: core_cm3.h:414
volatile int ITM_RxBuffer
#define ITM_RXBUFFER_EMPTY
Definition: core_cm3.h:1728
__IO uint32_t RBAR_A2
Definition: core_cm3.h:529
__IO uint32_t IRR
Definition: core_cm3.h:411
__IO uint32_t ICSR
Definition: core_cm3.h:143
__IO uint32_t AIRCR
Definition: core_cm3.h:145
__IO uint32_t RASR
Definition: core_cm3.h:526
__IO uint32_t DFSR
Definition: core_cm3.h:152
__IO uint32_t AFSR
Definition: core_cm3.h:155
__IO uint32_t HFSR
Definition: core_cm3.h:151
__I uint32_t PID6
Definition: core_cm3.h:419
Definition: core_cm3.h:350
Definition: core_cm3.h:605
#define SysTick_CTRL_TICKINT_Msk
Definition: core_cm3.h:366
__I uint32_t PID0
Definition: core_cm3.h:421
__O uint8_t u8
Definition: core_cm3.h:399
__IO uint32_t DEMCR
Definition: core_cm3.h:610
__I uint32_t DFR
Definition: core_cm3.h:157
Definition: core_cm3.h:488
CMSIS Cortex-M3 Core Peripheral Access Layer Header File for NXP LPC17xx Device Series.
#define __IO
Definition: LPC17xx.h:42
__I uint32_t CPUID
Definition: core_cm3.h:142
__IO uint32_t CTRL
Definition: core_cm3.h:352
#define SCB_AIRCR_PRIGROUP_Msk
Definition: core_cm3.h:225
__IO uint32_t SCR
Definition: core_cm3.h:146
#define ITM_TCR_ITMENA_Msk
Definition: core_cm3.h:458
__IO uint32_t TCR
Definition: core_cm3.h:408
#define __NVIC_PRIO_BITS
Definition: LPC17xx.h:112
__IO uint32_t IMCR
Definition: core_cm3.h:412
__IO uint32_t IWR
Definition: core_cm3.h:410
#define SCB
Definition: core_cm3.h:708
__I uint32_t ICTR
Definition: core_cm3.h:491
__IO uint32_t RBAR_A3
Definition: core_cm3.h:531
#define SysTick
Definition: core_cm3.h:709
__IO uint32_t LOAD
Definition: core_cm3.h:353
__IO uint32_t RNR
Definition: core_cm3.h:524
__I uint32_t TYPE
Definition: core_cm3.h:522
__IO uint32_t CCR
Definition: core_cm3.h:147
__I uint32_t CID0
Definition: core_cm3.h:425
__I uint32_t CID3
Definition: core_cm3.h:428
__I uint32_t CID2
Definition: core_cm3.h:427
Definition: core_cm3.h:520
#define __O
Definition: LPC17xx.h:41
__IO uint32_t RBAR
Definition: core_cm3.h:525
#define SCB_AIRCR_PRIGROUP_Pos
Definition: core_cm3.h:224
__I uint32_t CID1
Definition: core_cm3.h:426
uint32_t RESERVED1
Definition: core_cm3.h:495
__O uint32_t u32
Definition: core_cm3.h:401
__O uint16_t u16
Definition: core_cm3.h:400
__I uint32_t PID1
Definition: core_cm3.h:422
__I uint32_t PID4
Definition: core_cm3.h:417
#define SCB_AIRCR_SYSRESETREQ_Msk
Definition: core_cm3.h:228
Definition: core_cm3.h:395
__I uint32_t ADR
Definition: core_cm3.h:158
__IO uint32_t RASR_A1
Definition: core_cm3.h:528
__IO uint32_t BFAR
Definition: core_cm3.h:154
#define SysTick_CTRL_ENABLE_Msk
Definition: core_cm3.h:369
#define NVIC
Definition: core_cm3.h:710