1 /**
2   ******************************************************************************
3   * @file    stm32f7xx_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) 2017 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 __STM32F7xx_HAL_H
22 #define __STM32F7xx_HAL_H
23 
24 #ifdef __cplusplus
25  extern "C" {
26 #endif
27 
28 /* Includes ------------------------------------------------------------------*/
29 #include "stm32f7xx_hal_conf.h"
30 
31 /** @addtogroup STM32F7xx_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 /** @defgroup SYSCFG_BootMode Boot Mode
61   * @{
62   */
63 #define SYSCFG_MEM_BOOT_ADD0          ((uint32_t)0x00000000U)
64 #define SYSCFG_MEM_BOOT_ADD1          SYSCFG_MEMRMP_MEM_BOOT
65 /**
66   * @}
67   */
68 
69 /**
70   * @}
71   */
72 
73 /* Exported macro ------------------------------------------------------------*/
74 /** @defgroup HAL_Exported_Macros HAL Exported Macros
75   * @{
76   */
77 
78 /** @brief  Freeze/Unfreeze Peripherals in Debug mode
79   */
80 #define __HAL_DBGMCU_FREEZE_TIM2()           (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_TIM2_STOP))
81 #define __HAL_DBGMCU_FREEZE_TIM3()           (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_TIM3_STOP))
82 #define __HAL_DBGMCU_FREEZE_TIM4()           (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_TIM4_STOP))
83 #define __HAL_DBGMCU_FREEZE_TIM5()           (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_TIM5_STOP))
84 #define __HAL_DBGMCU_FREEZE_TIM6()           (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_TIM6_STOP))
85 #define __HAL_DBGMCU_FREEZE_TIM7()           (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_TIM7_STOP))
86 #define __HAL_DBGMCU_FREEZE_TIM12()          (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_TIM12_STOP))
87 #define __HAL_DBGMCU_FREEZE_TIM13()          (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_TIM13_STOP))
88 #define __HAL_DBGMCU_FREEZE_TIM14()          (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_TIM14_STOP))
89 #define __HAL_DBGMCU_FREEZE_LPTIM1()         (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_LPTIM1_STOP))
90 #define __HAL_DBGMCU_FREEZE_RTC()            (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_RTC_STOP))
91 #define __HAL_DBGMCU_FREEZE_WWDG()           (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_WWDG_STOP))
92 #define __HAL_DBGMCU_FREEZE_IWDG()           (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_IWDG_STOP))
93 #define __HAL_DBGMCU_FREEZE_I2C1_TIMEOUT()   (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_I2C1_SMBUS_TIMEOUT))
94 #define __HAL_DBGMCU_FREEZE_I2C2_TIMEOUT()   (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_I2C2_SMBUS_TIMEOUT))
95 #define __HAL_DBGMCU_FREEZE_I2C3_TIMEOUT()   (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_I2C3_SMBUS_TIMEOUT))
96 #define __HAL_DBGMCU_FREEZE_I2C4_TIMEOUT()   (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_I2C4_SMBUS_TIMEOUT))
97 #define __HAL_DBGMCU_FREEZE_CAN1()           (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_CAN1_STOP))
98 #define __HAL_DBGMCU_FREEZE_CAN2()           (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_CAN2_STOP))
99 #define __HAL_DBGMCU_FREEZE_TIM1()           (DBGMCU->APB2FZ |= (DBGMCU_APB2_FZ_DBG_TIM1_STOP))
100 #define __HAL_DBGMCU_FREEZE_TIM8()           (DBGMCU->APB2FZ |= (DBGMCU_APB2_FZ_DBG_TIM8_STOP))
101 #define __HAL_DBGMCU_FREEZE_TIM9()           (DBGMCU->APB2FZ |= (DBGMCU_APB2_FZ_DBG_TIM9_STOP))
102 #define __HAL_DBGMCU_FREEZE_TIM10()          (DBGMCU->APB2FZ |= (DBGMCU_APB2_FZ_DBG_TIM10_STOP))
103 #define __HAL_DBGMCU_FREEZE_TIM11()          (DBGMCU->APB2FZ |= (DBGMCU_APB2_FZ_DBG_TIM11_STOP))
104 
105 #define __HAL_DBGMCU_UNFREEZE_TIM2()           (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_TIM2_STOP))
106 #define __HAL_DBGMCU_UNFREEZE_TIM3()           (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_TIM3_STOP))
107 #define __HAL_DBGMCU_UNFREEZE_TIM4()           (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_TIM4_STOP))
108 #define __HAL_DBGMCU_UNFREEZE_TIM5()           (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_TIM5_STOP))
109 #define __HAL_DBGMCU_UNFREEZE_TIM6()           (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_TIM6_STOP))
110 #define __HAL_DBGMCU_UNFREEZE_TIM7()           (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_TIM7_STOP))
111 #define __HAL_DBGMCU_UNFREEZE_TIM12()          (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_TIM12_STOP))
112 #define __HAL_DBGMCU_UNFREEZE_TIM13()          (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_TIM13_STOP))
113 #define __HAL_DBGMCU_UNFREEZE_TIM14()          (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_TIM14_STOP))
114 #define __HAL_DBGMCU_UNFREEZE_LPTIM1()         (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_LPTIM1_STOP))
115 #define __HAL_DBGMCU_UNFREEZE_RTC()            (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_RTC_STOP))
116 #define __HAL_DBGMCU_UNFREEZE_WWDG()           (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_WWDG_STOP))
117 #define __HAL_DBGMCU_UNFREEZE_IWDG()           (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_IWDG_STOP))
118 #define __HAL_DBGMCU_UNFREEZE_I2C1_TIMEOUT()   (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_I2C1_SMBUS_TIMEOUT))
119 #define __HAL_DBGMCU_UNFREEZE_I2C2_TIMEOUT()   (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_I2C2_SMBUS_TIMEOUT))
120 #define __HAL_DBGMCU_UNFREEZE_I2C3_TIMEOUT()   (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_I2C3_SMBUS_TIMEOUT))
121 #define __HAL_DBGMCU_UNFREEZE_I2C4_TIMEOUT()   (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_I2C4_SMBUS_TIMEOUT))
122 #define __HAL_DBGMCU_UNFREEZE_CAN1()           (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_CAN1_STOP))
123 #define __HAL_DBGMCU_UNFREEZE_CAN2()           (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_CAN2_STOP))
124 #define __HAL_DBGMCU_UNFREEZE_TIM1()           (DBGMCU->APB2FZ &= ~(DBGMCU_APB2_FZ_DBG_TIM1_STOP))
125 #define __HAL_DBGMCU_UNFREEZE_TIM8()           (DBGMCU->APB2FZ &= ~(DBGMCU_APB2_FZ_DBG_TIM8_STOP))
126 #define __HAL_DBGMCU_UNFREEZE_TIM9()           (DBGMCU->APB2FZ &= ~(DBGMCU_APB2_FZ_DBG_TIM9_STOP))
127 #define __HAL_DBGMCU_UNFREEZE_TIM10()          (DBGMCU->APB2FZ &= ~(DBGMCU_APB2_FZ_DBG_TIM10_STOP))
128 #define __HAL_DBGMCU_UNFREEZE_TIM11()          (DBGMCU->APB2FZ &= ~(DBGMCU_APB2_FZ_DBG_TIM11_STOP))
129 
130 
131 /** @brief  FMC (NOR/RAM) mapped at 0x60000000 and SDRAM mapped at 0xC0000000
132   */
133 #define __HAL_SYSCFG_REMAPMEMORY_FMC()          (SYSCFG->MEMRMP &= ~(SYSCFG_MEMRMP_SWP_FMC))
134 
135 
136 /** @brief  FMC/SDRAM  mapped at 0x60000000 (NOR/RAM) mapped at 0xC0000000
137   */
138 #define __HAL_SYSCFG_REMAPMEMORY_FMC_SDRAM() do {SYSCFG->MEMRMP &= ~(SYSCFG_MEMRMP_SWP_FMC);\
139                                           SYSCFG->MEMRMP |= (SYSCFG_MEMRMP_SWP_FMC_0);\
140                                          }while(0);
141 /**
142   * @brief  Return the memory boot mapping as configured by user.
143   * @retval The boot mode as configured by user. The returned value can be one
144   *         of the following values:
145   *           @arg @ref SYSCFG_MEM_BOOT_ADD0
146   *           @arg @ref SYSCFG_MEM_BOOT_ADD1
147   */
148 #define __HAL_SYSCFG_GET_BOOT_MODE()           READ_BIT(SYSCFG->MEMRMP, SYSCFG_MEMRMP_MEM_BOOT)
149 
150 #if defined (STM32F765xx) || defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx)
151 /** @brief  SYSCFG Break Cortex-M7 Lockup lock.
152   *         Enable and lock the connection of Cortex-M7 LOCKUP (Hardfault) output to TIM1/8 Break input.
153   * @note   The selected configuration is locked and can be unlocked only by system reset.
154   */
155 #define __HAL_SYSCFG_BREAK_LOCKUP_LOCK()     SET_BIT(SYSCFG->CBR, SYSCFG_CBR_CLL)
156 
157 /** @brief  SYSCFG Break PVD lock.
158   *         Enable and lock the PVD connection to Timer1/8 Break input, as well as the PVDE and PLS[2:0] in the PWR_CR1 register.
159   * @note   The selected configuration is locked and can be unlocked only by system reset.
160   */
161 #define __HAL_SYSCFG_BREAK_PVD_LOCK()        SET_BIT(SYSCFG->CBR, SYSCFG_CBR_PVDL)
162 #endif /* STM32F765xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx */
163 
164 /**
165   * @}
166   */
167 
168 /** @defgroup HAL_Private_Macros HAL Private Macros
169   * @{
170   */
171 #define IS_TICKFREQ(FREQ) (((FREQ) == HAL_TICK_FREQ_10HZ)  || \
172                            ((FREQ) == HAL_TICK_FREQ_100HZ) || \
173                            ((FREQ) == HAL_TICK_FREQ_1KHZ))
174 /**
175   * @}
176   */
177 /* Exported functions --------------------------------------------------------*/
178 /** @addtogroup HAL_Exported_Functions
179   * @{
180   */
181 /** @addtogroup HAL_Exported_Functions_Group1
182   * @{
183   */
184 /* Initialization and Configuration functions  ******************************/
185 HAL_StatusTypeDef HAL_Init(void);
186 HAL_StatusTypeDef HAL_DeInit(void);
187 void HAL_MspInit(void);
188 void HAL_MspDeInit(void);
189 HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority);
190 /**
191   * @}
192   */
193 
194  /* Exported variables ---------------------------------------------------------*/
195 /** @addtogroup HAL_Exported_Variables
196   * @{
197   */
198 extern __IO uint32_t uwTick;
199 extern uint32_t uwTickPrio;
200 extern HAL_TickFreqTypeDef uwTickFreq;
201 /**
202   * @}
203   */
204 
205 /** @addtogroup HAL_Exported_Functions_Group2
206   * @{
207   */
208 /* Peripheral Control functions  ************************************************/
209 void HAL_IncTick(void);
210 void HAL_Delay(uint32_t Delay);
211 uint32_t HAL_GetTick(void);
212 uint32_t HAL_GetTickPrio(void);
213 HAL_StatusTypeDef HAL_SetTickFreq(HAL_TickFreqTypeDef Freq);
214 HAL_TickFreqTypeDef HAL_GetTickFreq(void);
215 void HAL_SuspendTick(void);
216 void HAL_ResumeTick(void);
217 uint32_t HAL_GetHalVersion(void);
218 uint32_t HAL_GetREVID(void);
219 uint32_t HAL_GetDEVID(void);
220 uint32_t HAL_GetUIDw0(void);
221 uint32_t HAL_GetUIDw1(void);
222 uint32_t HAL_GetUIDw2(void);
223 void HAL_DBGMCU_EnableDBGSleepMode(void);
224 void HAL_DBGMCU_DisableDBGSleepMode(void);
225 void HAL_DBGMCU_EnableDBGStopMode(void);
226 void HAL_DBGMCU_DisableDBGStopMode(void);
227 void HAL_DBGMCU_EnableDBGStandbyMode(void);
228 void HAL_DBGMCU_DisableDBGStandbyMode(void);
229 void HAL_EnableCompensationCell(void);
230 void HAL_DisableCompensationCell(void);
231 void HAL_EnableFMCMemorySwapping(void);
232 void HAL_DisableFMCMemorySwapping(void);
233 #if defined (STM32F765xx) || defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx)
234 void HAL_EnableMemorySwappingBank(void);
235 void HAL_DisableMemorySwappingBank(void);
236 #endif /* STM32F765xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx */
237 /**
238   * @}
239   */
240 
241 /**
242   * @}
243   */
244 /* Private types -------------------------------------------------------------*/
245 /* Private variables ---------------------------------------------------------*/
246 /** @defgroup HAL_Private_Variables HAL Private Variables
247   * @{
248   */
249 /**
250   * @}
251   */
252 /* Private constants ---------------------------------------------------------*/
253 /** @defgroup HAL_Private_Constants HAL Private Constants
254   * @{
255   */
256 /**
257   * @}
258   */
259 /* Private macros ------------------------------------------------------------*/
260 /* Private functions ---------------------------------------------------------*/
261 /**
262   * @}
263   */
264 
265 /**
266   * @}
267   */
268 
269 #ifdef __cplusplus
270 }
271 #endif
272 
273 #endif /* __STM32F7xx_HAL_H */
274 
275