|
SmartSnippets DA1459x SDK
|
Go to the documentation of this file.
27 #if defined ( __ICCARM__ )
28 #pragma system_include
29 #elif defined (__clang__)
30 #pragma clang system_header
33 #ifndef __CORE_CM0_H_GENERIC
34 #define __CORE_CM0_H_GENERIC
69 #define __CM0_CMSIS_VERSION_MAIN (__CM_CMSIS_VERSION_MAIN)
70 #define __CM0_CMSIS_VERSION_SUB (__CM_CMSIS_VERSION_SUB)
71 #define __CM0_CMSIS_VERSION ((__CM0_CMSIS_VERSION_MAIN << 16U) | \
72 __CM0_CMSIS_VERSION_SUB )
74 #define __CORTEX_M (0U)
81 #if defined ( __CC_ARM )
82 #if defined __TARGET_FPU_VFP
83 #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
86 #elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
88 #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
91 #elif defined ( __GNUC__ )
92 #if defined (__VFP_FP__) && !defined(__SOFTFP__)
93 #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
96 #elif defined ( __ICCARM__ )
97 #if defined __ARMVFP__
98 #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
101 #elif defined ( __TI_ARM__ )
102 #if defined __TI_VFP_SUPPORT__
103 #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
106 #elif defined ( __TASKING__ )
107 #if defined __FPU_VFP__
108 #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
111 #elif defined ( __CSMC__ )
112 #if ( __CSMC__ & 0x400U)
113 #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
127 #ifndef __CMSIS_GENERIC
129 #ifndef __CORE_CM0_H_DEPENDANT
130 #define __CORE_CM0_H_DEPENDANT
137 #if defined __CHECK_DEVICE_DEFINES
139 #define __CM0_REV 0x0000U
140 #warning "__CM0_REV not defined in device header file; using default!"
143 #ifndef __NVIC_PRIO_BITS
144 #define __NVIC_PRIO_BITS 2U
145 #warning "__NVIC_PRIO_BITS not defined in device header file; using default!"
148 #ifndef __Vendor_SysTickConfig
149 #define __Vendor_SysTickConfig 0U
150 #warning "__Vendor_SysTickConfig not defined in device header file; using default!"
166 #define __I volatile const
169 #define __IO volatile
172 #define __IM volatile const
173 #define __OM volatile
174 #define __IOM volatile
207 uint32_t _reserved0:28;
217 #define APSR_N_Pos 31U
218 #define APSR_N_Msk (1UL << APSR_N_Pos)
220 #define APSR_Z_Pos 30U
221 #define APSR_Z_Msk (1UL << APSR_Z_Pos)
223 #define APSR_C_Pos 29U
224 #define APSR_C_Msk (1UL << APSR_C_Pos)
226 #define APSR_V_Pos 28U
227 #define APSR_V_Msk (1UL << APSR_V_Pos)
238 uint32_t _reserved0:23;
244 #define IPSR_ISR_Pos 0U
245 #define IPSR_ISR_Msk (0x1FFUL )
256 uint32_t _reserved0:15;
258 uint32_t _reserved1:3;
268 #define xPSR_N_Pos 31U
269 #define xPSR_N_Msk (1UL << xPSR_N_Pos)
271 #define xPSR_Z_Pos 30U
272 #define xPSR_Z_Msk (1UL << xPSR_Z_Pos)
274 #define xPSR_C_Pos 29U
275 #define xPSR_C_Msk (1UL << xPSR_C_Pos)
277 #define xPSR_V_Pos 28U
278 #define xPSR_V_Msk (1UL << xPSR_V_Pos)
280 #define xPSR_T_Pos 24U
281 #define xPSR_T_Msk (1UL << xPSR_T_Pos)
283 #define xPSR_ISR_Pos 0U
284 #define xPSR_ISR_Msk (0x1FFUL )
294 uint32_t _reserved0:1;
296 uint32_t _reserved1:30;
302 #define CONTROL_SPSEL_Pos 1U
303 #define CONTROL_SPSEL_Msk (1UL << CONTROL_SPSEL_Pos)
320 __IOM uint32_t ISER[1U];
321 uint32_t RESERVED0[31U];
322 __IOM uint32_t ICER[1U];
323 uint32_t RESERVED1[31U];
324 __IOM uint32_t ISPR[1U];
325 uint32_t RESERVED2[31U];
326 __IOM uint32_t ICPR[1U];
327 uint32_t RESERVED3[31U];
328 uint32_t RESERVED4[64U];
329 __IOM uint32_t IP[8U];
355 __IOM uint32_t SHCSR;
359 #define SCB_CPUID_IMPLEMENTER_Pos 24U
360 #define SCB_CPUID_IMPLEMENTER_Msk (0xFFUL << SCB_CPUID_IMPLEMENTER_Pos)
362 #define SCB_CPUID_VARIANT_Pos 20U
363 #define SCB_CPUID_VARIANT_Msk (0xFUL << SCB_CPUID_VARIANT_Pos)
365 #define SCB_CPUID_ARCHITECTURE_Pos 16U
366 #define SCB_CPUID_ARCHITECTURE_Msk (0xFUL << SCB_CPUID_ARCHITECTURE_Pos)
368 #define SCB_CPUID_PARTNO_Pos 4U
369 #define SCB_CPUID_PARTNO_Msk (0xFFFUL << SCB_CPUID_PARTNO_Pos)
371 #define SCB_CPUID_REVISION_Pos 0U
372 #define SCB_CPUID_REVISION_Msk (0xFUL )
375 #define SCB_ICSR_NMIPENDSET_Pos 31U
376 #define SCB_ICSR_NMIPENDSET_Msk (1UL << SCB_ICSR_NMIPENDSET_Pos)
378 #define SCB_ICSR_PENDSVSET_Pos 28U
379 #define SCB_ICSR_PENDSVSET_Msk (1UL << SCB_ICSR_PENDSVSET_Pos)
381 #define SCB_ICSR_PENDSVCLR_Pos 27U
382 #define SCB_ICSR_PENDSVCLR_Msk (1UL << SCB_ICSR_PENDSVCLR_Pos)
384 #define SCB_ICSR_PENDSTSET_Pos 26U
385 #define SCB_ICSR_PENDSTSET_Msk (1UL << SCB_ICSR_PENDSTSET_Pos)
387 #define SCB_ICSR_PENDSTCLR_Pos 25U
388 #define SCB_ICSR_PENDSTCLR_Msk (1UL << SCB_ICSR_PENDSTCLR_Pos)
390 #define SCB_ICSR_ISRPREEMPT_Pos 23U
391 #define SCB_ICSR_ISRPREEMPT_Msk (1UL << SCB_ICSR_ISRPREEMPT_Pos)
393 #define SCB_ICSR_ISRPENDING_Pos 22U
394 #define SCB_ICSR_ISRPENDING_Msk (1UL << SCB_ICSR_ISRPENDING_Pos)
396 #define SCB_ICSR_VECTPENDING_Pos 12U
397 #define SCB_ICSR_VECTPENDING_Msk (0x1FFUL << SCB_ICSR_VECTPENDING_Pos)
399 #define SCB_ICSR_VECTACTIVE_Pos 0U
400 #define SCB_ICSR_VECTACTIVE_Msk (0x1FFUL )
403 #define SCB_AIRCR_VECTKEY_Pos 16U
404 #define SCB_AIRCR_VECTKEY_Msk (0xFFFFUL << SCB_AIRCR_VECTKEY_Pos)
406 #define SCB_AIRCR_VECTKEYSTAT_Pos 16U
407 #define SCB_AIRCR_VECTKEYSTAT_Msk (0xFFFFUL << SCB_AIRCR_VECTKEYSTAT_Pos)
409 #define SCB_AIRCR_ENDIANESS_Pos 15U
410 #define SCB_AIRCR_ENDIANESS_Msk (1UL << SCB_AIRCR_ENDIANESS_Pos)
412 #define SCB_AIRCR_SYSRESETREQ_Pos 2U
413 #define SCB_AIRCR_SYSRESETREQ_Msk (1UL << SCB_AIRCR_SYSRESETREQ_Pos)
415 #define SCB_AIRCR_VECTCLRACTIVE_Pos 1U
416 #define SCB_AIRCR_VECTCLRACTIVE_Msk (1UL << SCB_AIRCR_VECTCLRACTIVE_Pos)
419 #define SCB_SCR_SEVONPEND_Pos 4U
420 #define SCB_SCR_SEVONPEND_Msk (1UL << SCB_SCR_SEVONPEND_Pos)
422 #define SCB_SCR_SLEEPDEEP_Pos 2U
423 #define SCB_SCR_SLEEPDEEP_Msk (1UL << SCB_SCR_SLEEPDEEP_Pos)
425 #define SCB_SCR_SLEEPONEXIT_Pos 1U
426 #define SCB_SCR_SLEEPONEXIT_Msk (1UL << SCB_SCR_SLEEPONEXIT_Pos)
429 #define SCB_CCR_STKALIGN_Pos 9U
430 #define SCB_CCR_STKALIGN_Msk (1UL << SCB_CCR_STKALIGN_Pos)
432 #define SCB_CCR_UNALIGN_TRP_Pos 3U
433 #define SCB_CCR_UNALIGN_TRP_Msk (1UL << SCB_CCR_UNALIGN_TRP_Pos)
436 #define SCB_SHCSR_SVCALLPENDED_Pos 15U
437 #define SCB_SHCSR_SVCALLPENDED_Msk (1UL << SCB_SHCSR_SVCALLPENDED_Pos)
461 #define SysTick_CTRL_COUNTFLAG_Pos 16U
462 #define SysTick_CTRL_COUNTFLAG_Msk (1UL << SysTick_CTRL_COUNTFLAG_Pos)
464 #define SysTick_CTRL_CLKSOURCE_Pos 2U
465 #define SysTick_CTRL_CLKSOURCE_Msk (1UL << SysTick_CTRL_CLKSOURCE_Pos)
467 #define SysTick_CTRL_TICKINT_Pos 1U
468 #define SysTick_CTRL_TICKINT_Msk (1UL << SysTick_CTRL_TICKINT_Pos)
470 #define SysTick_CTRL_ENABLE_Pos 0U
471 #define SysTick_CTRL_ENABLE_Msk (1UL )
474 #define SysTick_LOAD_RELOAD_Pos 0U
475 #define SysTick_LOAD_RELOAD_Msk (0xFFFFFFUL )
478 #define SysTick_VAL_CURRENT_Pos 0U
479 #define SysTick_VAL_CURRENT_Msk (0xFFFFFFUL )
482 #define SysTick_CALIB_NOREF_Pos 31U
483 #define SysTick_CALIB_NOREF_Msk (1UL << SysTick_CALIB_NOREF_Pos)
485 #define SysTick_CALIB_SKEW_Pos 30U
486 #define SysTick_CALIB_SKEW_Msk (1UL << SysTick_CALIB_SKEW_Pos)
488 #define SysTick_CALIB_TENMS_Pos 0U
489 #define SysTick_CALIB_TENMS_Msk (0xFFFFFFUL )
517 #define _VAL2FLD(field, value) (((uint32_t)(value) << field ## _Pos) & field ## _Msk)
525 #define _FLD2VAL(field, value) (((uint32_t)(value) & field ## _Msk) >> field ## _Pos)
538 #define SCS_BASE (0xE000E000UL)
539 #define SysTick_BASE (SCS_BASE + 0x0010UL)
540 #define NVIC_BASE (SCS_BASE + 0x0100UL)
541 #define SCB_BASE (SCS_BASE + 0x0D00UL)
543 #define SCB ((SCB_Type *) SCB_BASE )
544 #define SysTick ((SysTick_Type *) SysTick_BASE )
545 #define NVIC ((NVIC_Type *) NVIC_BASE )
573 #ifdef CMSIS_NVIC_VIRTUAL
574 #ifndef CMSIS_NVIC_VIRTUAL_HEADER_FILE
575 #define CMSIS_NVIC_VIRTUAL_HEADER_FILE "cmsis_nvic_virtual.h"
577 #include CMSIS_NVIC_VIRTUAL_HEADER_FILE
579 #define NVIC_SetPriorityGrouping __NVIC_SetPriorityGrouping
580 #define NVIC_GetPriorityGrouping __NVIC_GetPriorityGrouping
581 #define NVIC_EnableIRQ __NVIC_EnableIRQ
582 #define NVIC_GetEnableIRQ __NVIC_GetEnableIRQ
583 #define NVIC_DisableIRQ __NVIC_DisableIRQ
584 #define NVIC_GetPendingIRQ __NVIC_GetPendingIRQ
585 #define NVIC_SetPendingIRQ __NVIC_SetPendingIRQ
586 #define NVIC_ClearPendingIRQ __NVIC_ClearPendingIRQ
588 #define NVIC_SetPriority __NVIC_SetPriority
589 #define NVIC_GetPriority __NVIC_GetPriority
590 #define NVIC_SystemReset __NVIC_SystemReset
593 #ifdef CMSIS_VECTAB_VIRTUAL
594 #ifndef CMSIS_VECTAB_VIRTUAL_HEADER_FILE
595 #define CMSIS_VECTAB_VIRTUAL_HEADER_FILE "cmsis_vectab_virtual.h"
597 #include CMSIS_VECTAB_VIRTUAL_HEADER_FILE
599 #define NVIC_SetVector __NVIC_SetVector
600 #define NVIC_GetVector __NVIC_GetVector
603 #define NVIC_USER_IRQ_OFFSET 16
607 #define EXC_RETURN_HANDLER (0xFFFFFFF1UL)
608 #define EXC_RETURN_THREAD_MSP (0xFFFFFFF9UL)
609 #define EXC_RETURN_THREAD_PSP (0xFFFFFFFDUL)
614 #define _BIT_SHIFT(IRQn) ( ((((uint32_t)(int32_t)(IRQn)) ) & 0x03UL) * 8UL)
615 #define _SHP_IDX(IRQn) ( (((((uint32_t)(int32_t)(IRQn)) & 0x0FUL)-8UL) >> 2UL) )
616 #define _IP_IDX(IRQn) ( (((uint32_t)(int32_t)(IRQn)) >> 2UL) )
618 #define __NVIC_SetPriorityGrouping(X) (void)(X)
619 #define __NVIC_GetPriorityGrouping() (0U)
629 if ((int32_t)(IRQn) >= 0)
631 __COMPILER_BARRIER();
632 NVIC->ISER[0U] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
633 __COMPILER_BARRIER();
648 if ((int32_t)(IRQn) >= 0)
650 return((uint32_t)(((
NVIC->ISER[0U] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
667 if ((int32_t)(IRQn) >= 0)
669 NVIC->ICER[0U] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
686 if ((int32_t)(IRQn) >= 0)
688 return((uint32_t)(((
NVIC->ISPR[0U] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
705 if ((int32_t)(IRQn) >= 0)
707 NVIC->ISPR[0U] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
720 if ((int32_t)(IRQn) >= 0)
722 NVIC->ICPR[0U] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
738 if ((int32_t)(IRQn) >= 0)
740 NVIC->IP[_IP_IDX(IRQn)] = ((uint32_t)(
NVIC->IP[_IP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) |
741 (((priority << (8U -
__NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn)));
745 SCB->SHP[_SHP_IDX(IRQn)] = ((uint32_t)(
SCB->SHP[_SHP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) |
746 (((priority << (8U -
__NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn)));
763 if ((int32_t)(IRQn) >= 0)
765 return((uint32_t)(((
NVIC->IP[ _IP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U -
__NVIC_PRIO_BITS)));
769 return((uint32_t)(((
SCB->SHP[_SHP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U -
__NVIC_PRIO_BITS)));
785 __STATIC_INLINE uint32_t
NVIC_EncodePriority (uint32_t PriorityGroup, uint32_t PreemptPriority, uint32_t SubPriority)
787 uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL);
788 uint32_t PreemptPriorityBits;
789 uint32_t SubPriorityBits;
792 SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(
__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(
__NVIC_PRIO_BITS));
795 ((PreemptPriority & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL)) << SubPriorityBits) |
796 ((SubPriority & (uint32_t)((1UL << (SubPriorityBits )) - 1UL)))
812 __STATIC_INLINE
void NVIC_DecodePriority (uint32_t Priority, uint32_t PriorityGroup, uint32_t*
const pPreemptPriority, uint32_t*
const pSubPriority)
814 uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL);
815 uint32_t PreemptPriorityBits;
816 uint32_t SubPriorityBits;
819 SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(
__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(
__NVIC_PRIO_BITS));
821 *pPreemptPriority = (Priority >> SubPriorityBits) & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL);
822 *pSubPriority = (Priority ) & (uint32_t)((1UL << (SubPriorityBits )) - 1UL);
838 uint32_t *vectors = (uint32_t *)(NVIC_USER_IRQ_OFFSET << 2);
839 *(vectors + (int32_t)IRQn) = vector;
854 uint32_t *vectors = (uint32_t *)(NVIC_USER_IRQ_OFFSET << 2);
855 return *(vectors + (int32_t)IRQn);
914 #if defined (__Vendor_SysTickConfig) && (__Vendor_SysTickConfig == 0U)
927 __STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks)
934 SysTick->LOAD = (uint32_t)(ticks - 1UL);
Structure type to access the System Timer (SysTick).
Definition: core_cm0.h:451
#define __IOM
Definition: core_cm0.h:174
#define SCB_AIRCR_VECTKEY_Pos
Definition: core_cm0.h:402
#define SCB_AIRCR_SYSRESETREQ_Msk
Definition: core_cm0.h:412
Union type to access the Special-Purpose Program Status Registers (xPSR).
Definition: core_cm0.h:250
#define SysTick_CTRL_ENABLE_Msk
Definition: core_cm0.h:470
__STATIC_FORCEINLINE void __ISB(void)
Instruction Synchronization Barrier.
Definition: cmsis_gcc.h:874
#define NVIC
Definition: core_cm0.h:544
__STATIC_INLINE uint32_t NVIC_EncodePriority(uint32_t PriorityGroup, uint32_t PreemptPriority, uint32_t SubPriority)
Encode Priority.
Definition: core_cm0.h:783
__STATIC_INLINE void __NVIC_SetPendingIRQ(IRQn_Type IRQn)
Set Pending Interrupt.
Definition: core_cm0.h:701
Structure type to access the System Control Block (SCB).
Definition: core_cm0.h:344
#define SysTick_LOAD_RELOAD_Msk
Definition: core_cm0.h:474
IRQn_Type
Interrupt Number Definition.
Definition: DA1459x-00.h:67
__STATIC_INLINE void __NVIC_EnableIRQ(IRQn_Type IRQn)
Enable Interrupt.
Definition: core_cm0.h:625
__STATIC_FORCEINLINE void __DSB(void)
Data Synchronization Barrier.
Definition: cmsis_gcc.h:885
__STATIC_INLINE void __NVIC_ClearPendingIRQ(IRQn_Type IRQn)
Clear Pending Interrupt.
Definition: core_cm0.h:716
__STATIC_INLINE void __NVIC_SetVector(IRQn_Type IRQn, uint32_t vector)
Set Interrupt Vector.
Definition: core_cm0.h:834
Union type to access the Interrupt Program Status Register (IPSR).
Definition: core_cm0.h:232
CMSIS Core(M) Version definitions.
__STATIC_INLINE void __NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority)
Set Interrupt Priority.
Definition: core_cm0.h:734
#define SCB
Definition: core_cm0.h:542
__STATIC_INLINE uint32_t __NVIC_GetPendingIRQ(IRQn_Type IRQn)
Get Pending Interrupt.
Definition: core_cm0.h:682
#define __NOP()
No Operation.
Definition: cmsis_gcc.h:844
Union type to access the Control Registers (CONTROL).
Definition: core_cm0.h:289
#define SysTick
Definition: core_cm0.h:543
__STATIC_INLINE uint32_t __NVIC_GetPriority(IRQn_Type IRQn)
Get Interrupt Priority.
Definition: core_cm0.h:758
#define __NVIC_PRIO_BITS
Definition: DA1459x-00.h:129
Structure type to access the Nested Vectored Interrupt Controller (NVIC).
Definition: core_cm0.h:317
__NO_RETURN __STATIC_INLINE void __NVIC_SystemReset(void)
System Reset.
Definition: core_cm0.h:861
__STATIC_INLINE void NVIC_DecodePriority(uint32_t Priority, uint32_t PriorityGroup, uint32_t *const pPreemptPriority, uint32_t *const pSubPriority)
Decode Priority.
Definition: core_cm0.h:810
#define SysTick_CTRL_TICKINT_Msk
Definition: core_cm0.h:467
#define __IM
Definition: core_cm0.h:172
Union type to access the Application Program Status Register (APSR).
Definition: core_cm0.h:202
CMSIS compiler generic header file.
__STATIC_INLINE uint32_t SCB_GetFPUType(void)
get FPU type
Definition: core_cm0.h:894
__STATIC_INLINE uint32_t __NVIC_GetEnableIRQ(IRQn_Type IRQn)
Get Interrupt Enable status.
Definition: core_cm0.h:644
__STATIC_INLINE void __NVIC_DisableIRQ(IRQn_Type IRQn)
Disable Interrupt.
Definition: core_cm0.h:663
Definition: DA1459x-00.h:81
#define SysTick_CTRL_CLKSOURCE_Msk
Definition: core_cm0.h:464
__STATIC_INLINE uint32_t __NVIC_GetVector(IRQn_Type IRQn)
Get Interrupt Vector.
Definition: core_cm0.h:850