18 #ifndef __STM32W_SYSTICK_H
19 #define __STM32W_SYSTICK_H
21 #include "stm32w108_type.h"
22 #include "stm32w_conf.h"
37 #define SCS_BASE ((u32)0xE000E000)
39 #define SysTick_BASE (SCS_BASE + 0x0010)
40 #define NVIC_BASE (SCS_BASE + 0x0100)
41 #define SCB_BASE (SCS_BASE + 0x0D00)
44 #define SysTick ((SysTick_TypeDef *) SysTick_BASE)
49 #define SysTick_CTRL_ENABLE ((u32)0x00000001)
50 #define SysTick_CTRL_TICKINT ((u32)0x00000002)
51 #define SysTick_CTRL_CLKSOURCE ((u32)0x00000004)
52 #define SysTick_CTRL_COUNTFLAG ((u32)0x00010000)
56 #define SysTick_LOAD_RELOAD ((u32)0x00FFFFFF)
60 #define SysTick_VAL_CURRENT ((u32)0x00FFFFFF)
64 #define SysTick_CALIB_TENMS ((u32)0x00FFFFFF)
65 #define SysTick_CALIB_SKEW ((u32)0x40000000)
66 #define SysTick_CALIB_NOREF ((u32)0x80000000)
72 #define SysTick_CLKSource_HCLK_Div8 ((u32)0xFFFFFFFB)
73 #define SysTick_CLKSource_HCLK ((u32)0x00000004)
75 #define IS_SYSTICK_CLK_SOURCE(SOURCE) (((SOURCE) == SysTick_CLKSource_HCLK) || \
76 ((SOURCE) == SysTick_CLKSource_HCLK_Div8))
79 #define SysTick_Counter_Disable ((u32)0xFFFFFFFE)
80 #define SysTick_Counter_Enable ((u32)0x00000001)
81 #define SysTick_Counter_Clear ((u32)0x00000000)
83 #define IS_SYSTICK_COUNTER(COUNTER) (((COUNTER) == SysTick_Counter_Disable) || \
84 ((COUNTER) == SysTick_Counter_Enable) || \
85 ((COUNTER) == SysTick_Counter_Clear))
88 #define SysTick_FLAG_COUNT ((u32)0x00000010)
89 #define SysTick_FLAG_SKEW ((u32)0x0000001E)
90 #define SysTick_FLAG_NOREF ((u32)0x0000001F)
92 #define IS_SYSTICK_FLAG(FLAG) (((FLAG) == SysTick_FLAG_COUNT) || \
93 ((FLAG) == SysTick_FLAG_SKEW) || \
94 ((FLAG) == SysTick_FLAG_NOREF))
96 #define IS_SYSTICK_RELOAD(RELOAD) (((RELOAD) > 0) && ((RELOAD) <= 0xFFFFFF))
100 void SysTick_CLKSourceConfig(u32 SysTick_CLKSource);
101 void SysTick_SetReload(u32 Reload);
102 void SysTick_CounterCmd(u32 SysTick_Counter);
103 void SysTick_ITConfig(FunctionalState NewState);
104 u32 SysTick_GetCounter(
void);
105 FlagStatus SysTick_GetFlagStatus(u8 SysTick_FLAG);