Contiki 3.x
stm32w-systick.h
1 /**
2  * \addtogroup stm32w-cpu
3  *
4  * @{
5  */
6 
7 /******************** (C) COPYRIGHT 2008 STMicroelectronics ********************
8 * File Name : stm32f10x_systick.h
9 * Author : MCD Application Team
10 * Version : V2.0.3
11 * Date : 09/22/2008
12 * Description : This file contains all the functions prototypes for the
13 * SysTick firmware library.
14 ********************************************************************************
15 * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
16 * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
17 * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
18 * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
19 * CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
20 * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
21 *******************************************************************************/
22 
23 #ifndef __STM32W_SYSTICK_H
24 #define __STM32W_SYSTICK_H
25 
26 #include "stm32w108-type.h"
27 #include "stm32w-conf.h"
28 
29 #ifndef EXT
30 #define EXT extern
31 #endif /* EXT */
32 
33 typedef struct {
34  vu32 CTRL;
35  vu32 LOAD;
36  vu32 VAL;
37  vuc32 CALIB;
38 } SysTick_TypeDef;
39 
40 /* System Control Space memory map */
41 #define SCS_BASE ((u32)0xE000E000)
42 
43 #define SysTick_BASE (SCS_BASE + 0x0010)
44 #define NVIC_BASE (SCS_BASE + 0x0100)
45 #define SCB_BASE (SCS_BASE + 0x0D00)
46 
47 #ifdef _SysTick
48 #define SysTick ((SysTick_TypeDef *) SysTick_BASE)
49 #endif /*_SysTick */
50 
51 
52 /***************** Bit definition for SysTick_CTRL register *****************/
53 /* Counter enable */
54 #define SysTick_CTRL_ENABLE ((u32)0x00000001)
55 /* Counting down to 0 pends the SysTick handler */
56 #define SysTick_CTRL_TICKINT ((u32)0x00000002)
57 /* Clock source */
58 #define SysTick_CTRL_CLKSOURCE ((u32)0x00000004)
59 /* Count Flag */
60 #define SysTick_CTRL_COUNTFLAG ((u32)0x00010000)
61 
62 
63 /***************** Bit definition for SysTick_LOAD register *****************/
64 /*
65  * Value to load into the SysTick Current Value Register when the
66  * counter reaches 0
67  */
68 #define SysTick_LOAD_RELOAD ((u32)0x00FFFFFF)
69 
70 
71 /***************** Bit definition for SysTick_VAL register ******************/
72 /* Current value at the time the register is accessed */
73 #define SysTick_VAL_CURRENT ((u32)0x00FFFFFF)
74 
75 
76 /***************** Bit definition for SysTick_CALIB register ****************/
77 /* Reload value to use for 10ms timing */
78 #define SysTick_CALIB_TENMS ((u32)0x00FFFFFF)
79 /* Calibration value is not exactly 10 ms */
80 #define SysTick_CALIB_SKEW ((u32)0x40000000)
81 /* The reference clock is not provided */
82 #define SysTick_CALIB_NOREF ((u32)0x80000000)
83 
84 
85 #define SysTick_CLKSource_HCLK_Div8 ((u32)0xFFFFFFFB)
86 #define SysTick_CLKSource_HCLK ((u32)0x00000004)
87 #define IS_SYSTICK_CLK_SOURCE(SOURCE) (((SOURCE) == SysTick_CLKSource_HCLK) || \
88  ((SOURCE) == SysTick_CLKSource_HCLK_Div8))
89 
90 /* SysTick counter state */
91 #define SysTick_Counter_Disable ((u32)0xFFFFFFFE)
92 #define SysTick_Counter_Enable ((u32)0x00000001)
93 #define SysTick_Counter_Clear ((u32)0x00000000)
94 
95 #define IS_SYSTICK_COUNTER(COUNTER) (((COUNTER) == SysTick_Counter_Disable) || \
96  ((COUNTER) == SysTick_Counter_Enable) || \
97  ((COUNTER) == SysTick_Counter_Clear))
98 
99 /* SysTick Flag */
100 #define SysTick_FLAG_COUNT ((u32)0x00000010)
101 #define SysTick_FLAG_SKEW ((u32)0x0000001E)
102 #define SysTick_FLAG_NOREF ((u32)0x0000001F)
103 
104 #define IS_SYSTICK_FLAG(FLAG) (((FLAG) == SysTick_FLAG_COUNT) || \
105  ((FLAG) == SysTick_FLAG_SKEW) || \
106  ((FLAG) == SysTick_FLAG_NOREF))
107 
108 #define IS_SYSTICK_RELOAD(RELOAD) (((RELOAD) > 0) && ((RELOAD) <= 0xFFFFFF))
109 
110 void SysTick_CLKSourceConfig(u32 SysTick_CLKSource);
111 
112 void SysTick_SetReload(u32 Reload);
113 
114 void SysTick_CounterCmd(u32 SysTick_Counter);
115 
116 void SysTick_ITConfig(FunctionalState NewState);
117 
118 u32 SysTick_GetCounter(void);
119 
120 FlagStatus SysTick_GetFlagStatus(u8 SysTick_FLAG);
121 
122 #endif /* __STM32F10x_SYSTICK_H */
123 /******************* (C) COPYRIGHT 2008 STMicroelectronics *****END OF FILE****/
124 /** @} */
void SysTick_SetReload(uint32_t Reload)
Sets SysTick Reload value.
void SysTick_CLKSourceConfig(uint32_t SysTick_CLKSource)
Configures the SysTick clock source.
FlagStatus SysTick_GetFlagStatus(uint8_t SysTick_FLAG)
Checks whether the specified SysTick flag is set or not.
void SysTick_ITConfig(FunctionalState NewState)
Enables or disables the SysTick Interrupt.
void SysTick_CounterCmd(uint32_t SysTick_Counter)
Enables or disables the SysTick counter.
uint32_t SysTick_GetCounter(void)
Gets SysTick counter value.