stm32w_systick.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef __STM32W_SYSTICK_H
00019 #define __STM32W_SYSTICK_H
00020
00021 #include "stm32w108_type.h"
00022 #include "stm32w_conf.h"
00023
00024 #ifndef EXT
00025 #define EXT extern
00026 #endif
00027
00028 typedef struct
00029 {
00030 vu32 CTRL;
00031 vu32 LOAD;
00032 vu32 VAL;
00033 vuc32 CALIB;
00034 } SysTick_TypeDef;
00035
00036
00037 #define SCS_BASE ((u32)0xE000E000)
00038
00039 #define SysTick_BASE (SCS_BASE + 0x0010)
00040 #define NVIC_BASE (SCS_BASE + 0x0100)
00041 #define SCB_BASE (SCS_BASE + 0x0D00)
00042
00043 #ifdef _SysTick
00044 #define SysTick ((SysTick_TypeDef *) SysTick_BASE)
00045 #endif
00046
00047
00048
00049 #define SysTick_CTRL_ENABLE ((u32)0x00000001)
00050 #define SysTick_CTRL_TICKINT ((u32)0x00000002)
00051 #define SysTick_CTRL_CLKSOURCE ((u32)0x00000004)
00052 #define SysTick_CTRL_COUNTFLAG ((u32)0x00010000)
00053
00054
00055
00056 #define SysTick_LOAD_RELOAD ((u32)0x00FFFFFF)
00057
00058
00059
00060 #define SysTick_VAL_CURRENT ((u32)0x00FFFFFF)
00061
00062
00063
00064 #define SysTick_CALIB_TENMS ((u32)0x00FFFFFF)
00065 #define SysTick_CALIB_SKEW ((u32)0x40000000)
00066 #define SysTick_CALIB_NOREF ((u32)0x80000000)
00067
00068
00069
00070
00071
00072 #define SysTick_CLKSource_HCLK_Div8 ((u32)0xFFFFFFFB)
00073 #define SysTick_CLKSource_HCLK ((u32)0x00000004)
00074
00075 #define IS_SYSTICK_CLK_SOURCE(SOURCE) (((SOURCE) == SysTick_CLKSource_HCLK) || \
00076 ((SOURCE) == SysTick_CLKSource_HCLK_Div8))
00077
00078
00079 #define SysTick_Counter_Disable ((u32)0xFFFFFFFE)
00080 #define SysTick_Counter_Enable ((u32)0x00000001)
00081 #define SysTick_Counter_Clear ((u32)0x00000000)
00082
00083 #define IS_SYSTICK_COUNTER(COUNTER) (((COUNTER) == SysTick_Counter_Disable) || \
00084 ((COUNTER) == SysTick_Counter_Enable) || \
00085 ((COUNTER) == SysTick_Counter_Clear))
00086
00087
00088 #define SysTick_FLAG_COUNT ((u32)0x00000010)
00089 #define SysTick_FLAG_SKEW ((u32)0x0000001E)
00090 #define SysTick_FLAG_NOREF ((u32)0x0000001F)
00091
00092 #define IS_SYSTICK_FLAG(FLAG) (((FLAG) == SysTick_FLAG_COUNT) || \
00093 ((FLAG) == SysTick_FLAG_SKEW) || \
00094 ((FLAG) == SysTick_FLAG_NOREF))
00095
00096 #define IS_SYSTICK_RELOAD(RELOAD) (((RELOAD) > 0) && ((RELOAD) <= 0xFFFFFF))
00097
00098
00099
00100 void SysTick_CLKSourceConfig(u32 SysTick_CLKSource);
00101 void SysTick_SetReload(u32 Reload);
00102 void SysTick_CounterCmd(u32 SysTick_Counter);
00103 void SysTick_ITConfig(FunctionalState NewState);
00104 u32 SysTick_GetCounter(void);
00105 FlagStatus SysTick_GetFlagStatus(u8 SysTick_FLAG);
00106
00107 #endif
00108
00109