1 /**
2   ******************************************************************************
3   * @file    stm32f1xx_hal.h
4   * @author  MCD Application Team
5   * @brief   This file contains all the functions prototypes for the HAL
6   *          module driver.
7   ******************************************************************************
8   * @attention
9   *
10   * <h2><center>&copy; Copyright (c) 2017 STMicroelectronics.
11   * All rights reserved.</center></h2>
12   *
13   * This software component is licensed by ST under BSD 3-Clause license,
14   * the "License"; You may not use this file except in compliance with the
15   * License. You may obtain a copy of the License at:
16   *                        opensource.org/licenses/BSD-3-Clause
17   *
18   ******************************************************************************
19   */
20 
21 /* Define to prevent recursive inclusion -------------------------------------*/
22 #ifndef __STM32F1xx_HAL_H
23 #define __STM32F1xx_HAL_H
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
29 /* Includes ------------------------------------------------------------------*/
30 #include "stm32f1xx_hal_conf.h"
31 
32 /** @addtogroup STM32F1xx_HAL_Driver
33   * @{
34   */
35 
36 /** @addtogroup HAL
37   * @{
38   */
39 
40 /* Exported constants --------------------------------------------------------*/
41 
42 /** @defgroup HAL_Exported_Constants HAL Exported Constants
43   * @{
44   */
45 
46 /** @defgroup HAL_TICK_FREQ Tick Frequency
47   * @{
48   */
49 typedef enum
50 {
51   HAL_TICK_FREQ_10HZ         = 100U,
52   HAL_TICK_FREQ_100HZ        = 10U,
53   HAL_TICK_FREQ_1KHZ         = 1U,
54   HAL_TICK_FREQ_DEFAULT      = HAL_TICK_FREQ_1KHZ
55 } HAL_TickFreqTypeDef;
56 /**
57   * @}
58   */
59 /* Exported types ------------------------------------------------------------*/
60 extern __IO uint32_t uwTick;
61 extern uint32_t uwTickPrio;
62 extern HAL_TickFreqTypeDef uwTickFreq;
63 
64 /**
65   * @}
66   */
67 /* Exported macro ------------------------------------------------------------*/
68 /** @defgroup HAL_Exported_Macros HAL Exported Macros
69   * @{
70   */
71 
72 /** @defgroup DBGMCU_Freeze_Unfreeze Freeze Unfreeze Peripherals in Debug mode
73   * @brief   Freeze/Unfreeze Peripherals in Debug mode
74   * Note: On devices STM32F10xx8 and STM32F10xxB,
75   *                  STM32F101xC/D/E and STM32F103xC/D/E,
76   *                  STM32F101xF/G and STM32F103xF/G
77   *                  STM32F10xx4 and STM32F10xx6
78   *       Debug registers DBGMCU_IDCODE and DBGMCU_CR are accessible only in
79   *       debug mode (not accessible by the user software in normal mode).
80   *       Refer to errata sheet of these devices for more details.
81   * @{
82   */
83 
84 /* Peripherals on APB1 */
85 /**
86   * @brief  TIM2 Peripherals Debug mode
87   */
88 #define __HAL_DBGMCU_FREEZE_TIM2()            SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM2_STOP)
89 #define __HAL_DBGMCU_UNFREEZE_TIM2()          CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM2_STOP)
90 
91 /**
92   * @brief  TIM3 Peripherals Debug mode
93   */
94 #define __HAL_DBGMCU_FREEZE_TIM3()            SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM3_STOP)
95 #define __HAL_DBGMCU_UNFREEZE_TIM3()          CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM3_STOP)
96 
97 #if defined (DBGMCU_CR_DBG_TIM4_STOP)
98 /**
99   * @brief  TIM4 Peripherals Debug mode
100   */
101 #define __HAL_DBGMCU_FREEZE_TIM4()            SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM4_STOP)
102 #define __HAL_DBGMCU_UNFREEZE_TIM4()          CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM4_STOP)
103 #endif
104 
105 #if defined (DBGMCU_CR_DBG_TIM5_STOP)
106 /**
107   * @brief  TIM5 Peripherals Debug mode
108   */
109 #define __HAL_DBGMCU_FREEZE_TIM5()            SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM5_STOP)
110 #define __HAL_DBGMCU_UNFREEZE_TIM5()          CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM5_STOP)
111 #endif
112 
113 #if defined (DBGMCU_CR_DBG_TIM6_STOP)
114 /**
115   * @brief  TIM6 Peripherals Debug mode
116   */
117 #define __HAL_DBGMCU_FREEZE_TIM6()            SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM6_STOP)
118 #define __HAL_DBGMCU_UNFREEZE_TIM6()          CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM6_STOP)
119 #endif
120 
121 #if defined (DBGMCU_CR_DBG_TIM7_STOP)
122 /**
123   * @brief  TIM7 Peripherals Debug mode
124   */
125 #define __HAL_DBGMCU_FREEZE_TIM7()            SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM7_STOP)
126 #define __HAL_DBGMCU_UNFREEZE_TIM7()          CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM7_STOP)
127 #endif
128 
129 #if defined (DBGMCU_CR_DBG_TIM12_STOP)
130 /**
131   * @brief  TIM12 Peripherals Debug mode
132   */
133 #define __HAL_DBGMCU_FREEZE_TIM12()            SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM12_STOP)
134 #define __HAL_DBGMCU_UNFREEZE_TIM12()          CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM12_STOP)
135 #endif
136 
137 #if defined (DBGMCU_CR_DBG_TIM13_STOP)
138 /**
139   * @brief  TIM13 Peripherals Debug mode
140   */
141 #define __HAL_DBGMCU_FREEZE_TIM13()            SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM13_STOP)
142 #define __HAL_DBGMCU_UNFREEZE_TIM13()          CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM13_STOP)
143 #endif
144 
145 #if defined (DBGMCU_CR_DBG_TIM14_STOP)
146 /**
147   * @brief  TIM14 Peripherals Debug mode
148   */
149 #define __HAL_DBGMCU_FREEZE_TIM14()            SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM14_STOP)
150 #define __HAL_DBGMCU_UNFREEZE_TIM14()          CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM14_STOP)
151 #endif
152 
153 /**
154   * @brief  WWDG Peripherals Debug mode
155   */
156 #define __HAL_DBGMCU_FREEZE_WWDG()            SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_WWDG_STOP)
157 #define __HAL_DBGMCU_UNFREEZE_WWDG()          CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_WWDG_STOP)
158 
159 /**
160   * @brief  IWDG Peripherals Debug mode
161   */
162 #define __HAL_DBGMCU_FREEZE_IWDG()            SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_IWDG_STOP)
163 #define __HAL_DBGMCU_UNFREEZE_IWDG()          CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_IWDG_STOP)
164 
165 /**
166   * @brief  I2C1 Peripherals Debug mode
167   */
168 #define __HAL_DBGMCU_FREEZE_I2C1_TIMEOUT()    SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_I2C1_SMBUS_TIMEOUT)
169 #define __HAL_DBGMCU_UNFREEZE_I2C1_TIMEOUT()  CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_I2C1_SMBUS_TIMEOUT)
170 
171 #if defined (DBGMCU_CR_DBG_I2C2_SMBUS_TIMEOUT)
172 /**
173   * @brief  I2C2 Peripherals Debug mode
174   */
175 #define __HAL_DBGMCU_FREEZE_I2C2_TIMEOUT()    SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_I2C2_SMBUS_TIMEOUT)
176 #define __HAL_DBGMCU_UNFREEZE_I2C2_TIMEOUT()  CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_I2C2_SMBUS_TIMEOUT)
177 #endif
178 
179 #if defined (DBGMCU_CR_DBG_CAN1_STOP)
180 /**
181   * @brief  CAN1 Peripherals Debug mode
182   */
183 #define __HAL_DBGMCU_FREEZE_CAN1()            SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_CAN1_STOP)
184 #define __HAL_DBGMCU_UNFREEZE_CAN1()          CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_CAN1_STOP)
185 #endif
186 
187 #if defined (DBGMCU_CR_DBG_CAN2_STOP)
188 /**
189   * @brief  CAN2 Peripherals Debug mode
190   */
191 #define __HAL_DBGMCU_FREEZE_CAN2()            SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_CAN2_STOP)
192 #define __HAL_DBGMCU_UNFREEZE_CAN2()          CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_CAN2_STOP)
193 #endif
194 
195 /* Peripherals on APB2 */
196 #if defined (DBGMCU_CR_DBG_TIM1_STOP)
197 /**
198   * @brief  TIM1 Peripherals Debug mode
199   */
200 #define __HAL_DBGMCU_FREEZE_TIM1()            SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM1_STOP)
201 #define __HAL_DBGMCU_UNFREEZE_TIM1()          CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM1_STOP)
202 #endif
203 
204 #if defined (DBGMCU_CR_DBG_TIM8_STOP)
205 /**
206   * @brief  TIM8 Peripherals Debug mode
207   */
208 #define __HAL_DBGMCU_FREEZE_TIM8()            SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM8_STOP)
209 #define __HAL_DBGMCU_UNFREEZE_TIM8()          CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM8_STOP)
210 #endif
211 
212 #if defined (DBGMCU_CR_DBG_TIM9_STOP)
213 /**
214   * @brief  TIM9 Peripherals Debug mode
215   */
216 #define __HAL_DBGMCU_FREEZE_TIM9()            SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM9_STOP)
217 #define __HAL_DBGMCU_UNFREEZE_TIM9()          CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM9_STOP)
218 #endif
219 
220 #if defined (DBGMCU_CR_DBG_TIM10_STOP)
221 /**
222   * @brief  TIM10 Peripherals Debug mode
223   */
224 #define __HAL_DBGMCU_FREEZE_TIM10()            SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM10_STOP)
225 #define __HAL_DBGMCU_UNFREEZE_TIM10()          CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM10_STOP)
226 #endif
227 
228 #if defined (DBGMCU_CR_DBG_TIM11_STOP)
229 /**
230   * @brief  TIM11 Peripherals Debug mode
231   */
232 #define __HAL_DBGMCU_FREEZE_TIM11()            SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM11_STOP)
233 #define __HAL_DBGMCU_UNFREEZE_TIM11()          CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM11_STOP)
234 #endif
235 
236 
237 #if defined (DBGMCU_CR_DBG_TIM15_STOP)
238 /**
239   * @brief  TIM15 Peripherals Debug mode
240   */
241 #define __HAL_DBGMCU_FREEZE_TIM15()            SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM15_STOP)
242 #define __HAL_DBGMCU_UNFREEZE_TIM15()          CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM15_STOP)
243 #endif
244 
245 #if defined (DBGMCU_CR_DBG_TIM16_STOP)
246 /**
247   * @brief  TIM16 Peripherals Debug mode
248   */
249 #define __HAL_DBGMCU_FREEZE_TIM16()            SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM16_STOP)
250 #define __HAL_DBGMCU_UNFREEZE_TIM16()          CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM16_STOP)
251 #endif
252 
253 #if defined (DBGMCU_CR_DBG_TIM17_STOP)
254 /**
255   * @brief  TIM17 Peripherals Debug mode
256   */
257 #define __HAL_DBGMCU_FREEZE_TIM17()            SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM17_STOP)
258 #define __HAL_DBGMCU_UNFREEZE_TIM17()          CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM17_STOP)
259 #endif
260 
261 /**
262   * @}
263   */
264 
265 /** @defgroup HAL_Private_Macros HAL Private Macros
266   * @{
267   */
268 #define IS_TICKFREQ(FREQ) (((FREQ) == HAL_TICK_FREQ_10HZ)  || \
269                            ((FREQ) == HAL_TICK_FREQ_100HZ) || \
270                            ((FREQ) == HAL_TICK_FREQ_1KHZ))
271 /**
272   * @}
273   */
274 
275 /* Exported functions --------------------------------------------------------*/
276 /** @addtogroup HAL_Exported_Functions
277   * @{
278   */
279 /** @addtogroup HAL_Exported_Functions_Group1
280   * @{
281   */
282 /* Initialization and de-initialization functions  ******************************/
283 HAL_StatusTypeDef HAL_Init(void);
284 HAL_StatusTypeDef HAL_DeInit(void);
285 void HAL_MspInit(void);
286 void HAL_MspDeInit(void);
287 HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority);
288 /**
289   * @}
290   */
291 
292 /** @addtogroup HAL_Exported_Functions_Group2
293   * @{
294   */
295 /* Peripheral Control functions  ************************************************/
296 void HAL_IncTick(void);
297 void HAL_Delay(uint32_t Delay);
298 uint32_t HAL_GetTick(void);
299 uint32_t HAL_GetTickPrio(void);
300 HAL_StatusTypeDef HAL_SetTickFreq(HAL_TickFreqTypeDef Freq);
301 HAL_TickFreqTypeDef HAL_GetTickFreq(void);
302 void HAL_SuspendTick(void);
303 void HAL_ResumeTick(void);
304 uint32_t HAL_GetHalVersion(void);
305 uint32_t HAL_GetREVID(void);
306 uint32_t HAL_GetDEVID(void);
307 uint32_t HAL_GetUIDw0(void);
308 uint32_t HAL_GetUIDw1(void);
309 uint32_t HAL_GetUIDw2(void);
310 void HAL_DBGMCU_EnableDBGSleepMode(void);
311 void HAL_DBGMCU_DisableDBGSleepMode(void);
312 void HAL_DBGMCU_EnableDBGStopMode(void);
313 void HAL_DBGMCU_DisableDBGStopMode(void);
314 void HAL_DBGMCU_EnableDBGStandbyMode(void);
315 void HAL_DBGMCU_DisableDBGStandbyMode(void);
316 /**
317   * @}
318   */
319 
320 /**
321   * @}
322   */
323 
324 /**
325   * @}
326   */
327 /* Private types -------------------------------------------------------------*/
328 /* Private variables ---------------------------------------------------------*/
329 /** @defgroup HAL_Private_Variables HAL Private Variables
330   * @{
331   */
332 /**
333   * @}
334   */
335 /* Private constants ---------------------------------------------------------*/
336 /** @defgroup HAL_Private_Constants HAL Private Constants
337   * @{
338   */
339 /**
340   * @}
341   */
342 /* Private macros ------------------------------------------------------------*/
343 /* Private functions ---------------------------------------------------------*/
344 /**
345   * @}
346   */
347 
348 /**
349   * @}
350   */
351 
352 #ifdef __cplusplus
353 }
354 #endif
355 
356 #endif /* __STM32F1xx_HAL_H */
357 
358 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
359