stm32f7xx_hal.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275
  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. /* Define to prevent recursive inclusion -------------------------------------*/
  20. #ifndef __STM32F7xx_HAL_H
  21. #define __STM32F7xx_HAL_H
  22. #ifdef __cplusplus
  23. extern "C" {
  24. #endif
  25. /* Includes ------------------------------------------------------------------*/
  26. #include "stm32f7xx_hal_conf.h"
  27. /** @addtogroup STM32F7xx_HAL_Driver
  28. * @{
  29. */
  30. /** @addtogroup HAL
  31. * @{
  32. */
  33. /* Exported types ------------------------------------------------------------*/
  34. /* Exported constants --------------------------------------------------------*/
  35. /** @defgroup HAL_Exported_Constants HAL Exported Constants
  36. * @{
  37. */
  38. /** @defgroup HAL_TICK_FREQ Tick Frequency
  39. * @{
  40. */
  41. typedef enum
  42. {
  43. HAL_TICK_FREQ_10HZ = 100U,
  44. HAL_TICK_FREQ_100HZ = 10U,
  45. HAL_TICK_FREQ_1KHZ = 1U,
  46. HAL_TICK_FREQ_DEFAULT = HAL_TICK_FREQ_1KHZ
  47. } HAL_TickFreqTypeDef;
  48. /**
  49. * @}
  50. */
  51. /** @defgroup SYSCFG_BootMode Boot Mode
  52. * @{
  53. */
  54. #define SYSCFG_MEM_BOOT_ADD0 ((uint32_t)0x00000000U)
  55. #define SYSCFG_MEM_BOOT_ADD1 SYSCFG_MEMRMP_MEM_BOOT
  56. /**
  57. * @}
  58. */
  59. /**
  60. * @}
  61. */
  62. /* Exported macro ------------------------------------------------------------*/
  63. /** @defgroup HAL_Exported_Macros HAL Exported Macros
  64. * @{
  65. */
  66. /** @brief Freeze/Unfreeze Peripherals in Debug mode
  67. */
  68. #define __HAL_DBGMCU_FREEZE_TIM2() (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_TIM2_STOP))
  69. #define __HAL_DBGMCU_FREEZE_TIM3() (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_TIM3_STOP))
  70. #define __HAL_DBGMCU_FREEZE_TIM4() (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_TIM4_STOP))
  71. #define __HAL_DBGMCU_FREEZE_TIM5() (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_TIM5_STOP))
  72. #define __HAL_DBGMCU_FREEZE_TIM6() (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_TIM6_STOP))
  73. #define __HAL_DBGMCU_FREEZE_TIM7() (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_TIM7_STOP))
  74. #define __HAL_DBGMCU_FREEZE_TIM12() (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_TIM12_STOP))
  75. #define __HAL_DBGMCU_FREEZE_TIM13() (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_TIM13_STOP))
  76. #define __HAL_DBGMCU_FREEZE_TIM14() (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_TIM14_STOP))
  77. #define __HAL_DBGMCU_FREEZE_LPTIM1() (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_LPTIM1_STOP))
  78. #define __HAL_DBGMCU_FREEZE_RTC() (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_RTC_STOP))
  79. #define __HAL_DBGMCU_FREEZE_WWDG() (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_WWDG_STOP))
  80. #define __HAL_DBGMCU_FREEZE_IWDG() (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_IWDG_STOP))
  81. #define __HAL_DBGMCU_FREEZE_I2C1_TIMEOUT() (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_I2C1_SMBUS_TIMEOUT))
  82. #define __HAL_DBGMCU_FREEZE_I2C2_TIMEOUT() (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_I2C2_SMBUS_TIMEOUT))
  83. #define __HAL_DBGMCU_FREEZE_I2C3_TIMEOUT() (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_I2C3_SMBUS_TIMEOUT))
  84. #define __HAL_DBGMCU_FREEZE_I2C4_TIMEOUT() (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_I2C4_SMBUS_TIMEOUT))
  85. #define __HAL_DBGMCU_FREEZE_CAN1() (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_CAN1_STOP))
  86. #define __HAL_DBGMCU_FREEZE_CAN2() (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_CAN2_STOP))
  87. #define __HAL_DBGMCU_FREEZE_TIM1() (DBGMCU->APB2FZ |= (DBGMCU_APB2_FZ_DBG_TIM1_STOP))
  88. #define __HAL_DBGMCU_FREEZE_TIM8() (DBGMCU->APB2FZ |= (DBGMCU_APB2_FZ_DBG_TIM8_STOP))
  89. #define __HAL_DBGMCU_FREEZE_TIM9() (DBGMCU->APB2FZ |= (DBGMCU_APB2_FZ_DBG_TIM9_STOP))
  90. #define __HAL_DBGMCU_FREEZE_TIM10() (DBGMCU->APB2FZ |= (DBGMCU_APB2_FZ_DBG_TIM10_STOP))
  91. #define __HAL_DBGMCU_FREEZE_TIM11() (DBGMCU->APB2FZ |= (DBGMCU_APB2_FZ_DBG_TIM11_STOP))
  92. #define __HAL_DBGMCU_UNFREEZE_TIM2() (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_TIM2_STOP))
  93. #define __HAL_DBGMCU_UNFREEZE_TIM3() (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_TIM3_STOP))
  94. #define __HAL_DBGMCU_UNFREEZE_TIM4() (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_TIM4_STOP))
  95. #define __HAL_DBGMCU_UNFREEZE_TIM5() (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_TIM5_STOP))
  96. #define __HAL_DBGMCU_UNFREEZE_TIM6() (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_TIM6_STOP))
  97. #define __HAL_DBGMCU_UNFREEZE_TIM7() (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_TIM7_STOP))
  98. #define __HAL_DBGMCU_UNFREEZE_TIM12() (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_TIM12_STOP))
  99. #define __HAL_DBGMCU_UNFREEZE_TIM13() (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_TIM13_STOP))
  100. #define __HAL_DBGMCU_UNFREEZE_TIM14() (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_TIM14_STOP))
  101. #define __HAL_DBGMCU_UNFREEZE_LPTIM1() (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_LPTIM1_STOP))
  102. #define __HAL_DBGMCU_UNFREEZE_RTC() (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_RTC_STOP))
  103. #define __HAL_DBGMCU_UNFREEZE_WWDG() (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_WWDG_STOP))
  104. #define __HAL_DBGMCU_UNFREEZE_IWDG() (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_IWDG_STOP))
  105. #define __HAL_DBGMCU_UNFREEZE_I2C1_TIMEOUT() (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_I2C1_SMBUS_TIMEOUT))
  106. #define __HAL_DBGMCU_UNFREEZE_I2C2_TIMEOUT() (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_I2C2_SMBUS_TIMEOUT))
  107. #define __HAL_DBGMCU_UNFREEZE_I2C3_TIMEOUT() (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_I2C3_SMBUS_TIMEOUT))
  108. #define __HAL_DBGMCU_UNFREEZE_I2C4_TIMEOUT() (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_I2C4_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. /** @brief FMC (NOR/RAM) mapped at 0x60000000 and SDRAM mapped at 0xC0000000
  117. */
  118. #define __HAL_SYSCFG_REMAPMEMORY_FMC() (SYSCFG->MEMRMP &= ~(SYSCFG_MEMRMP_SWP_FMC))
  119. /** @brief FMC/SDRAM mapped at 0x60000000 (NOR/RAM) mapped at 0xC0000000
  120. */
  121. #define __HAL_SYSCFG_REMAPMEMORY_FMC_SDRAM() do {SYSCFG->MEMRMP &= ~(SYSCFG_MEMRMP_SWP_FMC);\
  122. SYSCFG->MEMRMP |= (SYSCFG_MEMRMP_SWP_FMC_0);\
  123. }while(0);
  124. /**
  125. * @brief Return the memory boot mapping as configured by user.
  126. * @retval The boot mode as configured by user. The returned value can be one
  127. * of the following values:
  128. * @arg @ref SYSCFG_MEM_BOOT_ADD0
  129. * @arg @ref SYSCFG_MEM_BOOT_ADD1
  130. */
  131. #define __HAL_SYSCFG_GET_BOOT_MODE() READ_BIT(SYSCFG->MEMRMP, SYSCFG_MEMRMP_MEM_BOOT)
  132. #if defined (STM32F765xx) || defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx)
  133. /** @brief SYSCFG Break Cortex-M7 Lockup lock.
  134. * Enable and lock the connection of Cortex-M7 LOCKUP (Hardfault) output to TIM1/8 Break input.
  135. * @note The selected configuration is locked and can be unlocked only by system reset.
  136. */
  137. #define __HAL_SYSCFG_BREAK_LOCKUP_LOCK() SET_BIT(SYSCFG->CBR, SYSCFG_CBR_CLL)
  138. /** @brief SYSCFG Break PVD lock.
  139. * 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.
  140. * @note The selected configuration is locked and can be unlocked only by system reset.
  141. */
  142. #define __HAL_SYSCFG_BREAK_PVD_LOCK() SET_BIT(SYSCFG->CBR, SYSCFG_CBR_PVDL)
  143. #endif /* STM32F765xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx */
  144. /**
  145. * @}
  146. */
  147. /** @defgroup HAL_Private_Macros HAL Private Macros
  148. * @{
  149. */
  150. #define IS_TICKFREQ(FREQ) (((FREQ) == HAL_TICK_FREQ_10HZ) || \
  151. ((FREQ) == HAL_TICK_FREQ_100HZ) || \
  152. ((FREQ) == HAL_TICK_FREQ_1KHZ))
  153. /**
  154. * @}
  155. */
  156. /* Exported functions --------------------------------------------------------*/
  157. /** @addtogroup HAL_Exported_Functions
  158. * @{
  159. */
  160. /** @addtogroup HAL_Exported_Functions_Group1
  161. * @{
  162. */
  163. /* Initialization and Configuration functions ******************************/
  164. HAL_StatusTypeDef HAL_Init(void);
  165. HAL_StatusTypeDef HAL_DeInit(void);
  166. void HAL_MspInit(void);
  167. void HAL_MspDeInit(void);
  168. HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority);
  169. /**
  170. * @}
  171. */
  172. /* Exported variables ---------------------------------------------------------*/
  173. /** @addtogroup HAL_Exported_Variables
  174. * @{
  175. */
  176. extern __IO uint32_t uwTick;
  177. extern uint32_t uwTickPrio;
  178. extern HAL_TickFreqTypeDef uwTickFreq;
  179. /**
  180. * @}
  181. */
  182. /** @addtogroup HAL_Exported_Functions_Group2
  183. * @{
  184. */
  185. /* Peripheral Control functions ************************************************/
  186. void HAL_IncTick(void);
  187. void HAL_Delay(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. uint32_t HAL_GetUIDw0(void);
  198. uint32_t HAL_GetUIDw1(void);
  199. uint32_t HAL_GetUIDw2(void);
  200. void HAL_DBGMCU_EnableDBGSleepMode(void);
  201. void HAL_DBGMCU_DisableDBGSleepMode(void);
  202. void HAL_DBGMCU_EnableDBGStopMode(void);
  203. void HAL_DBGMCU_DisableDBGStopMode(void);
  204. void HAL_DBGMCU_EnableDBGStandbyMode(void);
  205. void HAL_DBGMCU_DisableDBGStandbyMode(void);
  206. void HAL_EnableCompensationCell(void);
  207. void HAL_DisableCompensationCell(void);
  208. void HAL_EnableFMCMemorySwapping(void);
  209. void HAL_DisableFMCMemorySwapping(void);
  210. #if defined (STM32F765xx) || defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx)
  211. void HAL_EnableMemorySwappingBank(void);
  212. void HAL_DisableMemorySwappingBank(void);
  213. #endif /* STM32F765xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx */
  214. /**
  215. * @}
  216. */
  217. /**
  218. * @}
  219. */
  220. /* Private types -------------------------------------------------------------*/
  221. /* Private variables ---------------------------------------------------------*/
  222. /** @defgroup HAL_Private_Variables HAL Private Variables
  223. * @{
  224. */
  225. /**
  226. * @}
  227. */
  228. /* Private constants ---------------------------------------------------------*/
  229. /** @defgroup HAL_Private_Constants HAL Private Constants
  230. * @{
  231. */
  232. /**
  233. * @}
  234. */
  235. /* Private macros ------------------------------------------------------------*/
  236. /* Private functions ---------------------------------------------------------*/
  237. /**
  238. * @}
  239. */
  240. /**
  241. * @}
  242. */
  243. #ifdef __cplusplus
  244. }
  245. #endif
  246. #endif /* __STM32F7xx_HAL_H */