stm32f7xx.h 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  1. /**
  2. ******************************************************************************
  3. * @file stm32f7xx.h
  4. * @author MCD Application Team
  5. * @brief CMSIS STM32F7xx Device Peripheral Access Layer Header File.
  6. *
  7. * The file is the unique include file that the application programmer
  8. * is using in the C source code, usually in main.c. This file contains:
  9. * - Configuration section that allows to select:
  10. * - The STM32F7xx device used in the target application
  11. * - To use or not the peripheral's drivers in application code(i.e.
  12. * code will be based on direct access to peripheral's registers
  13. * rather than drivers API), this option is controlled by
  14. * "#define USE_HAL_DRIVER"
  15. *
  16. ******************************************************************************
  17. * @attention
  18. *
  19. * Copyright (c) 2016 STMicroelectronics.
  20. * All rights reserved.
  21. *
  22. * This software is licensed under terms that can be found in the LICENSE file
  23. * in the root directory of this software component.
  24. * If no LICENSE file comes with this software, it is provided AS-IS.
  25. *
  26. ******************************************************************************
  27. */
  28. /** @addtogroup CMSIS
  29. * @{
  30. */
  31. /** @addtogroup stm32f7xx
  32. * @{
  33. */
  34. #ifndef __STM32F7xx_H
  35. #define __STM32F7xx_H
  36. #ifdef __cplusplus
  37. extern "C" {
  38. #endif /* __cplusplus */
  39. /** @addtogroup Library_configuration_section
  40. * @{
  41. */
  42. /**
  43. * @brief STM32 Family
  44. */
  45. #if !defined (STM32F7)
  46. #define STM32F7
  47. #endif /* STM32F7 */
  48. /* Uncomment the line below according to the target STM32 device used in your
  49. application
  50. */
  51. #if !defined (STM32F756xx) && !defined (STM32F746xx) && !defined (STM32F745xx) && !defined (STM32F765xx) && \
  52. !defined (STM32F767xx) && !defined (STM32F769xx) && !defined (STM32F777xx) && !defined (STM32F779xx) && \
  53. !defined (STM32F722xx) && !defined (STM32F723xx) && !defined (STM32F732xx) && !defined (STM32F733xx) && \
  54. !defined (STM32F730xx) && !defined (STM32F750xx)
  55. /* #define STM32F756xx */ /*!< STM32F756VG, STM32F756ZG, STM32F756ZG, STM32F756IG, STM32F756BG,
  56. STM32F756NG Devices */
  57. /* #define STM32F746xx */ /*!< STM32F746VE, STM32F746VG, STM32F746ZE, STM32F746ZG, STM32F746IE, STM32F746IG,
  58. STM32F746BE, STM32F746BG, STM32F746NE, STM32F746NG Devices */
  59. /* #define STM32F745xx */ /*!< STM32F745VE, STM32F745VG, STM32F745ZG, STM32F745ZE, STM32F745IE, STM32F745IG Devices */
  60. /* #define STM32F765xx */ /*!< STM32F765BI, STM32F765BG, STM32F765NI, STM32F765NG, STM32F765II, STM32F765IG,
  61. STM32F765ZI, STM32F765ZG, STM32F765VI, STM32F765VG Devices */
  62. /* #define STM32F767xx */ /*!< STM32F767BG, STM32F767BI, STM32F767IG, STM32F767II, STM32F767NG, STM32F767NI,
  63. STM32F767VG, STM32F767VI, STM32F767ZG, STM32F767ZI Devices */
  64. /* #define STM32F769xx */ /*!< STM32F769AG, STM32F769AI, STM32F769BG, STM32F769BI, STM32F769IG, STM32F769II,
  65. STM32F769NG, STM32F769NI, STM32F768AI Devices */
  66. /* #define STM32F777xx */ /*!< STM32F777VI, STM32F777ZI, STM32F777II, STM32F777BI, STM32F777NI Devices */
  67. /* #define STM32F779xx */ /*!< STM32F779II, STM32F779BI, STM32F779NI, STM32F779AI, STM32F778AI Devices */
  68. /* #define STM32F722xx */ /*!< STM32F722IE, STM32F722ZE, STM32F722VE, STM32F722RE, STM32F722IC, STM32F722ZC,
  69. STM32F722VC, STM32F722RC Devices */
  70. /* #define STM32F723xx */ /*!< STM32F723IE, STM32F723ZE, STM32F723VE, STM32F723IC, STM32F723ZC, STM32F723VC Devices */
  71. /* #define STM32F732xx */ /*!< STM32F732IE, STM32F732ZE, STM32F732VE, STM32F732RE Devices */
  72. /* #define STM32F733xx */ /*!< STM32F733IE, STM32F733ZE, STM32F733VE Devices */
  73. /* #define STM32F730xx */ /*!< STM32F730R, STM32F730V, STM32F730Z, STM32F730I Devices */
  74. /* #define STM32F750xx */ /*!< STM32F750V, STM32F750Z, STM32F750N Devices */
  75. #endif
  76. /* Tip: To avoid modifying this file each time you need to switch between these
  77. devices, you can define the device in your toolchain compiler preprocessor.
  78. */
  79. #if !defined (USE_HAL_DRIVER)
  80. /**
  81. * @brief Comment the line below if you will not use the peripherals drivers.
  82. In this case, these drivers will not be included and the application code will
  83. be based on direct access to peripherals registers
  84. */
  85. /*#define USE_HAL_DRIVER */
  86. #endif /* USE_HAL_DRIVER */
  87. /**
  88. * @brief CMSIS Device version number V1.2.8
  89. */
  90. #define __STM32F7_CMSIS_VERSION_MAIN (0x01) /*!< [31:24] main version */
  91. #define __STM32F7_CMSIS_VERSION_SUB1 (0x02) /*!< [23:16] sub1 version */
  92. #define __STM32F7_CMSIS_VERSION_SUB2 (0x08) /*!< [15:8] sub2 version */
  93. #define __STM32F7_CMSIS_VERSION_RC (0x00) /*!< [7:0] release candidate */
  94. #define __STM32F7_CMSIS_VERSION ((__STM32F7_CMSIS_VERSION_MAIN << 24)\
  95. |(__STM32F7_CMSIS_VERSION_SUB1 << 16)\
  96. |(__STM32F7_CMSIS_VERSION_SUB2 << 8 )\
  97. |(__STM32F7_CMSIS_VERSION_RC))
  98. /**
  99. * @}
  100. */
  101. /** @addtogroup Device_Included
  102. * @{
  103. */
  104. #if defined(STM32F722xx)
  105. #include "stm32f722xx.h"
  106. #elif defined(STM32F723xx)
  107. #include "stm32f723xx.h"
  108. #elif defined(STM32F732xx)
  109. #include "stm32f732xx.h"
  110. #elif defined(STM32F733xx)
  111. #include "stm32f733xx.h"
  112. #elif defined(STM32F756xx)
  113. #include "stm32f756xx.h"
  114. #elif defined(STM32F746xx)
  115. #include "stm32f746xx.h"
  116. #elif defined(STM32F745xx)
  117. #include "stm32f745xx.h"
  118. #elif defined(STM32F765xx)
  119. #include "stm32f765xx.h"
  120. #elif defined(STM32F767xx)
  121. #include "stm32f767xx.h"
  122. #elif defined(STM32F769xx)
  123. #include "stm32f769xx.h"
  124. #elif defined(STM32F777xx)
  125. #include "stm32f777xx.h"
  126. #elif defined(STM32F779xx)
  127. #include "stm32f779xx.h"
  128. #elif defined(STM32F730xx)
  129. #include "stm32f730xx.h"
  130. #elif defined(STM32F750xx)
  131. #include "stm32f750xx.h"
  132. #else
  133. #error "Please select first the target STM32F7xx device used in your application (in stm32f7xx.h file)"
  134. #endif
  135. /**
  136. * @}
  137. */
  138. /** @addtogroup Exported_types
  139. * @{
  140. */
  141. typedef enum
  142. {
  143. RESET = 0U,
  144. SET = !RESET
  145. } FlagStatus, ITStatus;
  146. typedef enum
  147. {
  148. DISABLE = 0U,
  149. ENABLE = !DISABLE
  150. } FunctionalState;
  151. #define IS_FUNCTIONAL_STATE(STATE) (((STATE) == DISABLE) || ((STATE) == ENABLE))
  152. typedef enum
  153. {
  154. SUCCESS = 0U,
  155. ERROR = !SUCCESS
  156. } ErrorStatus;
  157. /**
  158. * @}
  159. */
  160. /** @addtogroup Exported_macro
  161. * @{
  162. */
  163. #define SET_BIT(REG, BIT) ((REG) |= (BIT))
  164. #define CLEAR_BIT(REG, BIT) ((REG) &= ~(BIT))
  165. #define READ_BIT(REG, BIT) ((REG) & (BIT))
  166. #define CLEAR_REG(REG) ((REG) = (0x0))
  167. #define WRITE_REG(REG, VAL) ((REG) = (VAL))
  168. #define READ_REG(REG) ((REG))
  169. #define MODIFY_REG(REG, CLEARMASK, SETMASK) WRITE_REG((REG), (((READ_REG(REG)) & (~(CLEARMASK))) | (SETMASK)))
  170. #define POSITION_VAL(VAL) (__CLZ(__RBIT(VAL)))
  171. /* Use of CMSIS compiler intrinsics for register exclusive access */
  172. /* Atomic 32-bit register access macro to set one or several bits */
  173. #define ATOMIC_SET_BIT(REG, BIT) \
  174. do { \
  175. uint32_t val; \
  176. do { \
  177. val = __LDREXW((__IO uint32_t *)&(REG)) | (BIT); \
  178. } while ((__STREXW(val,(__IO uint32_t *)&(REG))) != 0U); \
  179. } while(0)
  180. /* Atomic 32-bit register access macro to clear one or several bits */
  181. #define ATOMIC_CLEAR_BIT(REG, BIT) \
  182. do { \
  183. uint32_t val; \
  184. do { \
  185. val = __LDREXW((__IO uint32_t *)&(REG)) & ~(BIT); \
  186. } while ((__STREXW(val,(__IO uint32_t *)&(REG))) != 0U); \
  187. } while(0)
  188. /* Atomic 32-bit register access macro to clear and set one or several bits */
  189. #define ATOMIC_MODIFY_REG(REG, CLEARMSK, SETMASK) \
  190. do { \
  191. uint32_t val; \
  192. do { \
  193. val = (__LDREXW((__IO uint32_t *)&(REG)) & ~(CLEARMSK)) | (SETMASK); \
  194. } while ((__STREXW(val,(__IO uint32_t *)&(REG))) != 0U); \
  195. } while(0)
  196. /* Atomic 16-bit register access macro to set one or several bits */
  197. #define ATOMIC_SETH_BIT(REG, BIT) \
  198. do { \
  199. uint16_t val; \
  200. do { \
  201. val = __LDREXH((__IO uint16_t *)&(REG)) | (BIT); \
  202. } while ((__STREXH(val,(__IO uint16_t *)&(REG))) != 0U); \
  203. } while(0)
  204. /* Atomic 16-bit register access macro to clear one or several bits */
  205. #define ATOMIC_CLEARH_BIT(REG, BIT) \
  206. do { \
  207. uint16_t val; \
  208. do { \
  209. val = __LDREXH((__IO uint16_t *)&(REG)) & ~(BIT); \
  210. } while ((__STREXH(val,(__IO uint16_t *)&(REG))) != 0U); \
  211. } while(0)
  212. /* Atomic 16-bit register access macro to clear and set one or several bits */
  213. #define ATOMIC_MODIFYH_REG(REG, CLEARMSK, SETMASK) \
  214. do { \
  215. uint16_t val; \
  216. do { \
  217. val = (__LDREXH((__IO uint16_t *)&(REG)) & ~(CLEARMSK)) | (SETMASK); \
  218. } while ((__STREXH(val,(__IO uint16_t *)&(REG))) != 0U); \
  219. } while(0)
  220. /**
  221. * @}
  222. */
  223. #ifdef USE_HAL_DRIVER
  224. #include "stm32f7xx_hal.h"
  225. #endif /* USE_HAL_DRIVER */
  226. #ifdef __cplusplus
  227. }
  228. #endif /* __cplusplus */
  229. #endif /* __STM32F7xx_H */
  230. /**
  231. * @}
  232. */
  233. /**
  234. * @}
  235. */