1 /**
2   ******************************************************************************
3   * @file    stm32f2xx_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   * Copyright (c) 2016 STMicroelectronics.
11   * All rights reserved.
12   *
13   * This software is licensed under terms that can be found in the LICENSE file
14   * in the root directory of this software component.
15   * If no LICENSE file comes with this software, it is provided AS-IS.
16   *
17   ******************************************************************************
18   */
19 
20 /* Define to prevent recursive inclusion -------------------------------------*/
21 #ifndef __STM32F2xx_HAL_H
22 #define __STM32F2xx_HAL_H
23 
24 #ifdef __cplusplus
25  extern "C" {
26 #endif
27 
28 /* Includes ------------------------------------------------------------------*/
29 #include "stm32f2xx_hal_conf.h"
30 
31 /** @addtogroup STM32F2xx_HAL_Driver
32   * @{
33   */
34 
35 /** @addtogroup HAL
36   * @{
37   */
38 
39 /* Exported types ------------------------------------------------------------*/
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   */
60 
61 /**
62   * @}
63   */
64 /* Exported macro ------------------------------------------------------------*/
65 /** @defgroup HAL_Exported_Macros HAL Exported Macros
66   * @{
67   */
68 
69 /** @brief  Freeze/Unfreeze Peripherals in Debug mode
70   */
71 #define __HAL_DBGMCU_FREEZE_TIM2()           (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_TIM2_STOP))
72 #define __HAL_DBGMCU_FREEZE_TIM3()           (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_TIM3_STOP))
73 #define __HAL_DBGMCU_FREEZE_TIM4()           (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_TIM4_STOP))
74 #define __HAL_DBGMCU_FREEZE_TIM5()           (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_TIM5_STOP))
75 #define __HAL_DBGMCU_FREEZE_TIM6()           (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_TIM6_STOP))
76 #define __HAL_DBGMCU_FREEZE_TIM7()           (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_TIM7_STOP))
77 #define __HAL_DBGMCU_FREEZE_TIM12()          (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_TIM12_STOP))
78 #define __HAL_DBGMCU_FREEZE_TIM13()          (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_TIM13_STOP))
79 #define __HAL_DBGMCU_FREEZE_TIM14()          (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_TIM14_STOP))
80 #define __HAL_DBGMCU_FREEZE_RTC()            (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_RTC_STOP))
81 #define __HAL_DBGMCU_FREEZE_WWDG()           (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_WWDG_STOP))
82 #define __HAL_DBGMCU_FREEZE_IWDG()           (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_IWDG_STOP))
83 #define __HAL_DBGMCU_FREEZE_I2C1_TIMEOUT()   (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_I2C1_SMBUS_TIMEOUT))
84 #define __HAL_DBGMCU_FREEZE_I2C2_TIMEOUT()   (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_I2C2_SMBUS_TIMEOUT))
85 #define __HAL_DBGMCU_FREEZE_I2C3_TIMEOUT()   (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_I2C3_SMBUS_TIMEOUT))
86 #define __HAL_DBGMCU_FREEZE_CAN1()           (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_CAN1_STOP))
87 #define __HAL_DBGMCU_FREEZE_CAN2()           (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_CAN2_STOP))
88 #define __HAL_DBGMCU_FREEZE_TIM1()           (DBGMCU->APB2FZ |= (DBGMCU_APB2_FZ_DBG_TIM1_STOP))
89 #define __HAL_DBGMCU_FREEZE_TIM8()           (DBGMCU->APB2FZ |= (DBGMCU_APB2_FZ_DBG_TIM8_STOP))
90 #define __HAL_DBGMCU_FREEZE_TIM9()           (DBGMCU->APB2FZ |= (DBGMCU_APB2_FZ_DBG_TIM9_STOP))
91 #define __HAL_DBGMCU_FREEZE_TIM10()          (DBGMCU->APB2FZ |= (DBGMCU_APB2_FZ_DBG_TIM10_STOP))
92 #define __HAL_DBGMCU_FREEZE_TIM11()          (DBGMCU->APB2FZ |= (DBGMCU_APB2_FZ_DBG_TIM11_STOP))
93 
94 #define __HAL_DBGMCU_UNFREEZE_TIM2()           (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_TIM2_STOP))
95 #define __HAL_DBGMCU_UNFREEZE_TIM3()           (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_TIM3_STOP))
96 #define __HAL_DBGMCU_UNFREEZE_TIM4()           (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_TIM4_STOP))
97 #define __HAL_DBGMCU_UNFREEZE_TIM5()           (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_TIM5_STOP))
98 #define __HAL_DBGMCU_UNFREEZE_TIM6()           (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_TIM6_STOP))
99 #define __HAL_DBGMCU_UNFREEZE_TIM7()           (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_TIM7_STOP))
100 #define __HAL_DBGMCU_UNFREEZE_TIM12()          (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_TIM12_STOP))
101 #define __HAL_DBGMCU_UNFREEZE_TIM13()          (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_TIM13_STOP))
102 #define __HAL_DBGMCU_UNFREEZE_TIM14()          (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_TIM14_STOP))
103 #define __HAL_DBGMCU_UNFREEZE_RTC()            (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_RTC_STOP))
104 #define __HAL_DBGMCU_UNFREEZE_WWDG()           (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_WWDG_STOP))
105 #define __HAL_DBGMCU_UNFREEZE_IWDG()           (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_IWDG_STOP))
106 #define __HAL_DBGMCU_UNFREEZE_I2C1_TIMEOUT()   (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_I2C1_SMBUS_TIMEOUT))
107 #define __HAL_DBGMCU_UNFREEZE_I2C2_TIMEOUT()   (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_I2C2_SMBUS_TIMEOUT))
108 #define __HAL_DBGMCU_UNFREEZE_I2C3_TIMEOUT()   (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_I2C3_SMBUS_TIMEOUT))
109 #define __HAL_DBGMCU_UNFREEZE_CAN1()           (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_CAN1_STOP))
110 #define __HAL_DBGMCU_UNFREEZE_CAN2()           (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_CAN2_STOP))
111 #define __HAL_DBGMCU_UNFREEZE_TIM1()           (DBGMCU->APB2FZ &= ~(DBGMCU_APB2_FZ_DBG_TIM1_STOP))
112 #define __HAL_DBGMCU_UNFREEZE_TIM8()           (DBGMCU->APB2FZ &= ~(DBGMCU_APB2_FZ_DBG_TIM8_STOP))
113 #define __HAL_DBGMCU_UNFREEZE_TIM9()           (DBGMCU->APB2FZ &= ~(DBGMCU_APB2_FZ_DBG_TIM9_STOP))
114 #define __HAL_DBGMCU_UNFREEZE_TIM10()          (DBGMCU->APB2FZ &= ~(DBGMCU_APB2_FZ_DBG_TIM10_STOP))
115 #define __HAL_DBGMCU_UNFREEZE_TIM11()          (DBGMCU->APB2FZ &= ~(DBGMCU_APB2_FZ_DBG_TIM11_STOP))
116 
117 /** @brief  Main Flash memory mapped at 0x00000000
118   */
119 #define __HAL_SYSCFG_REMAPMEMORY_FLASH()             (SYSCFG->MEMRMP &= ~(SYSCFG_MEMRMP_MEM_MODE))
120 
121 /** @brief  System Flash memory mapped at 0x00000000
122   */
123 #define __HAL_SYSCFG_REMAPMEMORY_SYSTEMFLASH()       do {SYSCFG->MEMRMP &= ~(SYSCFG_MEMRMP_MEM_MODE);\
124                                                          SYSCFG->MEMRMP |= SYSCFG_MEMRMP_MEM_MODE_0;\
125                                                         }while(0);
126 
127 /** @brief  Embedded SRAM mapped at 0x00000000
128   */
129 #define __HAL_SYSCFG_REMAPMEMORY_SRAM()       do {SYSCFG->MEMRMP &= ~(SYSCFG_MEMRMP_MEM_MODE);\
130                                                   SYSCFG->MEMRMP |= (SYSCFG_MEMRMP_MEM_MODE_0 | SYSCFG_MEMRMP_MEM_MODE_1);\
131                                                  }while(0);
132 
133 /** @brief  FSMC Bank1 (NOR/PSRAM 1 and 2) mapped at 0x00000000
134   */
135 #define __HAL_SYSCFG_REMAPMEMORY_FSMC()       do {SYSCFG->MEMRMP &= ~(SYSCFG_MEMRMP_MEM_MODE);\
136                                                   SYSCFG->MEMRMP |= (SYSCFG_MEMRMP_MEM_MODE_1);\
137                                                  }while(0);
138 
139 
140 /**
141   * @}
142   */
143 
144 /** @defgroup HAL_Private_Macros HAL Private Macros
145   * @{
146   */
147 #define IS_TICKFREQ(FREQ) (((FREQ) == HAL_TICK_FREQ_10HZ)  || \
148                            ((FREQ) == HAL_TICK_FREQ_100HZ) || \
149                            ((FREQ) == HAL_TICK_FREQ_1KHZ))
150 /**
151   * @}
152   */
153 
154 /* Exported functions --------------------------------------------------------*/
155 /** @addtogroup HAL_Exported_Functions
156   * @{
157   */
158 /** @addtogroup HAL_Exported_Functions_Group1
159   * @{
160   */
161 /* Initialization and de-initialization functions  ******************************/
162 HAL_StatusTypeDef HAL_Init(void);
163 HAL_StatusTypeDef HAL_DeInit(void);
164 void HAL_MspInit(void);
165 void HAL_MspDeInit(void);
166 HAL_StatusTypeDef HAL_InitTick (uint32_t TickPriority);
167 /**
168   * @}
169   */
170 
171  /* Exported variables ---------------------------------------------------------*/
172 /** @addtogroup HAL_Exported_Variables
173   * @{
174   */
175 extern __IO uint32_t uwTick;
176 extern uint32_t uwTickPrio;
177 extern HAL_TickFreqTypeDef uwTickFreq;
178 /**
179   * @}
180   */
181 
182 /** @addtogroup HAL_Exported_Functions_Group2
183   * @{
184   */
185 /* Peripheral Control functions  ************************************************/
186 void HAL_IncTick(void);
187 void HAL_Delay(__IO uint32_t Delay);
188 uint32_t HAL_GetTick(void);
189 uint32_t HAL_GetTickPrio(void);
190 HAL_StatusTypeDef HAL_SetTickFreq(HAL_TickFreqTypeDef Freq);
191 HAL_TickFreqTypeDef HAL_GetTickFreq(void);
192 void HAL_SuspendTick(void);
193 void HAL_ResumeTick(void);
194 uint32_t HAL_GetHalVersion(void);
195 uint32_t HAL_GetREVID(void);
196 uint32_t HAL_GetDEVID(void);
197 void HAL_DBGMCU_EnableDBGSleepMode(void);
198 void HAL_DBGMCU_DisableDBGSleepMode(void);
199 void HAL_DBGMCU_EnableDBGStopMode(void);
200 void HAL_DBGMCU_DisableDBGStopMode(void);
201 void HAL_DBGMCU_EnableDBGStandbyMode(void);
202 void HAL_DBGMCU_DisableDBGStandbyMode(void);
203 void HAL_EnableCompensationCell(void);
204 void HAL_DisableCompensationCell(void);
205 uint32_t HAL_GetUIDw0(void);
206 uint32_t HAL_GetUIDw1(void);
207 uint32_t HAL_GetUIDw2(void);
208 /**
209   * @}
210   */
211 
212 /**
213   * @}
214   */
215 /* Private types -------------------------------------------------------------*/
216 /* Private variables ---------------------------------------------------------*/
217 /** @defgroup HAL_Private_Variables HAL Private Variables
218   * @{
219   */
220 /**
221   * @}
222   */
223 /* Private constants ---------------------------------------------------------*/
224 /** @defgroup HAL_Private_Constants HAL Private Constants
225   * @{
226   */
227 /**
228   * @}
229   */
230 /* Private macros ------------------------------------------------------------*/
231 /* Private functions ---------------------------------------------------------*/
232 /**
233   * @}
234   */
235 
236 /**
237   * @}
238   */
239 
240 #ifdef __cplusplus
241 }
242 #endif
243 
244 #endif /* __STM32F2xx_HAL_H */
245 
246