stm32h7xx.h 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301
  1. /**
  2. ******************************************************************************
  3. * @file stm32h7xx.h
  4. * @author MCD Application Team
  5. * @brief CMSIS STM32H7xx 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 STM32H7xx 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) 2017 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 stm32h7xx
  32. * @{
  33. */
  34. #ifndef STM32H7xx_H
  35. #define STM32H7xx_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 (STM32H7)
  46. #define STM32H7
  47. #endif /* STM32H7 */
  48. /* Uncomment the line below according to the target STM32H7 device used in your
  49. application
  50. */
  51. #if !defined (STM32H743xx) && !defined (STM32H753xx) && !defined (STM32H750xx) && !defined (STM32H742xx) && \
  52. !defined (STM32H745xx) && !defined (STM32H745xG) && !defined (STM32H755xx) && !defined (STM32H747xx) && !defined (STM32H747xG)&& !defined (STM32H757xx) && \
  53. !defined (STM32H7A3xx) && !defined (STM32H7A3xxQ) && !defined (STM32H7B3xx) && !defined (STM32H7B3xxQ) && !defined (STM32H7B0xx) && !defined (STM32H7B0xxQ) && \
  54. !defined (STM32H735xx) && !defined (STM32H733xx) && !defined (STM32H730xx) && !defined (STM32H730xxQ) && !defined (STM32H725xx) && !defined (STM32H723xx)
  55. /* #define STM32H742xx */ /*!< STM32H742VI, STM32H742ZI, STM32H742AI, STM32H742II, STM32H742BI, STM32H742XI Devices */
  56. /* #define STM32H743xx */ /*!< STM32H743VI, STM32H743ZI, STM32H743AI, STM32H743II, STM32H743BI, STM32H743XI Devices */
  57. /* #define STM32H753xx */ /*!< STM32H753VI, STM32H753ZI, STM32H753AI, STM32H753II, STM32H753BI, STM32H753XI Devices */
  58. /* #define STM32H750xx */ /*!< STM32H750V, STM32H750I, STM32H750X Devices */
  59. /* #define STM32H747xx */ /*!< STM32H747ZI, STM32H747AI, STM32H747II, STM32H747BI, STM32H747XI Devices */
  60. /* #define STM32H747xG */ /*!< STM32H747AG, STM32H747IG, STM32H747BG, STM32H747XG */
  61. /* #define STM32H757xx */ /*!< STM32H757ZI, STM32H757AI, STM32H757II, STM32H757BI, STM32H757XI Devices */
  62. /* #define STM32H745xx */ /*!< STM32H745ZI, STM32H745II, STM32H745BI, STM32H745XI Devices */
  63. /* #define STM32H745xG */ /*!< STM32H745ZG, STM32H745IG, STM32H745BG, STM32H745XG Devices */
  64. /* #define STM32H755xx */ /*!< STM32H755ZI, STM32H755II, STM32H755BI, STM32H755XI Devices */
  65. /* #define STM32H7B0xx */ /*!< STM32H7B0ABIxQ, STM32H7B0IBTx, STM32H7B0RBTx, STM32H7B0VBTx, STM32H7B0ZBTx, STM32H7B0IBKxQ */
  66. /* #define STM32H7A3xx */ /*!< STM32H7A3IIK6, STM32H7A3IIT6, STM32H7A3NIH6, STM32H7A3RIT6, STM32H7A3VIH6, STM32H7A3VIT6, STM32H7A3ZIT6 */
  67. /* #define STM32H7A3xxQ */ /*!< STM32H7A3QIY6Q, STM32H7A3IIK6Q, STM32H7A3IIT6Q, STM32H7A3LIH6Q, STM32H7A3VIH6Q, STM32H7A3VIT6Q, STM32H7A3AII6Q, STM32H7A3ZIT6Q */
  68. /* #define STM32H7B3xx */ /*!< STM32H7B3IIK6, STM32H7B3IIT6, STM32H7B3NIH6, STM32H7B3RIT6, STM32H7B3VIH6, STM32H7B3VIT6, STM32H7B3ZIT6 */
  69. /* #define STM32H7B3xxQ */ /*!< STM32H7B3QIY6Q, STM32H7B3IIK6Q, STM32H7B3IIT6Q, STM32H7B3LIH6Q, STM32H7B3VIH6Q, STM32H7B3VIT6Q, STM32H7B3AII6Q, STM32H7B3ZIT6Q */
  70. /* #define STM32H735xx */ /*!< STM32H735AGI6, STM32H735IGK6, STM32H735RGV6, STM32H735VGT6, STM32H735VGY6, STM32H735ZGT6 Devices */
  71. /* #define STM32H733xx */ /*!< STM32H733VGH6, STM32H733VGT6, STM32H733ZGI6, STM32H733ZGT6, Devices */
  72. /* #define STM32H730xx */ /*!< STM32H730VBH6, STM32H730VBT6, STM32H730ZBT6, STM32H730ZBI6 Devices */
  73. /* #define STM32H730xxQ */ /*!< STM32H730IBT6Q, STM32H730ABI6Q, STM32H730IBK6Q Devices */
  74. /* #define STM32H725xx */ /*!< STM32H725AGI6, STM32H725IGK6, STM32H725IGT6, STM32H725RGV6, STM32H725VGT6, STM32H725VGY6, STM32H725ZGT6, STM32H725REV6, SM32H725VET6, STM32H725ZET6, STM32H725AEI6, STM32H725IET6, STM32H725IEK6 Devices */
  75. /* #define STM32H723xx */ /*!< STM32H723VGH6, STM32H723VGT6, STM32H723ZGI6, STM32H723ZGT6, STM32H723VET6, STM32H723VEH6, STM32H723ZET6, STM32H723ZEI6 Devices */
  76. #endif
  77. /* Tip: To avoid modifying this file each time you need to switch between these
  78. devices, you can define the device in your toolchain compiler preprocessor.
  79. */
  80. #if defined(DUAL_CORE) && !defined(CORE_CM4) && !defined(CORE_CM7)
  81. #error "Dual core device, please select CORE_CM4 or CORE_CM7"
  82. #endif
  83. #if !defined (USE_HAL_DRIVER)
  84. /**
  85. * @brief Comment the line below if you will not use the peripherals drivers.
  86. In this case, these drivers will not be included and the application code will
  87. be based on direct access to peripherals registers
  88. */
  89. /*#define USE_HAL_DRIVER */
  90. #endif /* USE_HAL_DRIVER */
  91. /**
  92. * @brief CMSIS Device version number V1.10.1
  93. */
  94. #define __STM32H7xx_CMSIS_DEVICE_VERSION_MAIN (0x01) /*!< [31:24] main version */
  95. #define __STM32H7xx_CMSIS_DEVICE_VERSION_SUB1 (0x0A) /*!< [23:16] sub1 version */
  96. #define __STM32H7xx_CMSIS_DEVICE_VERSION_SUB2 (0x01) /*!< [15:8] sub2 version */
  97. #define __STM32H7xx_CMSIS_DEVICE_VERSION_RC (0x00) /*!< [7:0] release candidate */
  98. #define __STM32H7xx_CMSIS_DEVICE_VERSION ((__STM32H7xx_CMSIS_DEVICE_VERSION_MAIN << 24)\
  99. |(__STM32H7xx_CMSIS_DEVICE_VERSION_SUB1 << 16)\
  100. |(__STM32H7xx_CMSIS_DEVICE_VERSION_SUB2 << 8 )\
  101. |(__STM32H7xx_CMSIS_DEVICE_VERSION_RC))
  102. /**
  103. * @}
  104. */
  105. /** @addtogroup Device_Included
  106. * @{
  107. */
  108. #if defined(STM32H743xx)
  109. #include "stm32h743xx.h"
  110. #elif defined(STM32H753xx)
  111. #include "stm32h753xx.h"
  112. #elif defined(STM32H750xx)
  113. #include "stm32h750xx.h"
  114. #elif defined(STM32H742xx)
  115. #include "stm32h742xx.h"
  116. #elif defined(STM32H745xx)
  117. #include "stm32h745xx.h"
  118. #elif defined(STM32H745xG)
  119. #include "stm32h745xg.h"
  120. #elif defined(STM32H755xx)
  121. #include "stm32h755xx.h"
  122. #elif defined(STM32H747xx)
  123. #include "stm32h747xx.h"
  124. #elif defined(STM32H747xG)
  125. #include "stm32h747xg.h"
  126. #elif defined(STM32H757xx)
  127. #include "stm32h757xx.h"
  128. #elif defined(STM32H7B0xx)
  129. #include "stm32h7b0xx.h"
  130. #elif defined(STM32H7B0xxQ)
  131. #include "stm32h7b0xxq.h"
  132. #elif defined(STM32H7A3xx)
  133. #include "stm32h7a3xx.h"
  134. #elif defined(STM32H7B3xx)
  135. #include "stm32h7b3xx.h"
  136. #elif defined(STM32H7A3xxQ)
  137. #include "stm32h7a3xxq.h"
  138. #elif defined(STM32H7B3xxQ)
  139. #include "stm32h7b3xxq.h"
  140. #elif defined(STM32H735xx)
  141. #include "stm32h735xx.h"
  142. #elif defined(STM32H733xx)
  143. #include "stm32h733xx.h"
  144. #elif defined(STM32H730xx)
  145. #include "stm32h730xx.h"
  146. #elif defined(STM32H730xxQ)
  147. #include "stm32h730xxq.h"
  148. #elif defined(STM32H725xx)
  149. #include "stm32h725xx.h"
  150. #elif defined(STM32H723xx)
  151. #include "stm32h723xx.h"
  152. #else
  153. #error "Please select first the target STM32H7xx device used in your application (in stm32h7xx.h file)"
  154. #endif
  155. /**
  156. * @}
  157. */
  158. /** @addtogroup Exported_types
  159. * @{
  160. */
  161. typedef enum
  162. {
  163. RESET = 0,
  164. SET = !RESET
  165. } FlagStatus, ITStatus;
  166. typedef enum
  167. {
  168. DISABLE = 0,
  169. ENABLE = !DISABLE
  170. } FunctionalState;
  171. #define IS_FUNCTIONAL_STATE(STATE) (((STATE) == DISABLE) || ((STATE) == ENABLE))
  172. typedef enum
  173. {
  174. SUCCESS = 0,
  175. ERROR = !SUCCESS
  176. } ErrorStatus;
  177. /**
  178. * @}
  179. */
  180. /** @addtogroup Exported_macros
  181. * @{
  182. */
  183. #define SET_BIT(REG, BIT) ((REG) |= (BIT))
  184. #define CLEAR_BIT(REG, BIT) ((REG) &= ~(BIT))
  185. #define READ_BIT(REG, BIT) ((REG) & (BIT))
  186. #define CLEAR_REG(REG) ((REG) = (0x0))
  187. #define WRITE_REG(REG, VAL) ((REG) = (VAL))
  188. #define READ_REG(REG) ((REG))
  189. #define MODIFY_REG(REG, CLEARMASK, SETMASK) WRITE_REG((REG), (((READ_REG(REG)) & (~(CLEARMASK))) | (SETMASK)))
  190. #define POSITION_VAL(VAL) (__CLZ(__RBIT(VAL)))
  191. /* Use of CMSIS compiler intrinsics for register exclusive access */
  192. /* Atomic 32-bit register access macro to set one or several bits */
  193. #define ATOMIC_SET_BIT(REG, BIT) \
  194. do { \
  195. uint32_t val; \
  196. do { \
  197. val = __LDREXW((__IO uint32_t *)&(REG)) | (BIT); \
  198. } while ((__STREXW(val,(__IO uint32_t *)&(REG))) != 0U); \
  199. } while(0)
  200. /* Atomic 32-bit register access macro to clear one or several bits */
  201. #define ATOMIC_CLEAR_BIT(REG, BIT) \
  202. do { \
  203. uint32_t val; \
  204. do { \
  205. val = __LDREXW((__IO uint32_t *)&(REG)) & ~(BIT); \
  206. } while ((__STREXW(val,(__IO uint32_t *)&(REG))) != 0U); \
  207. } while(0)
  208. /* Atomic 32-bit register access macro to clear and set one or several bits */
  209. #define ATOMIC_MODIFY_REG(REG, CLEARMSK, SETMASK) \
  210. do { \
  211. uint32_t val; \
  212. do { \
  213. val = (__LDREXW((__IO uint32_t *)&(REG)) & ~(CLEARMSK)) | (SETMASK); \
  214. } while ((__STREXW(val,(__IO uint32_t *)&(REG))) != 0U); \
  215. } while(0)
  216. /* Atomic 16-bit register access macro to set one or several bits */
  217. #define ATOMIC_SETH_BIT(REG, BIT) \
  218. do { \
  219. uint16_t val; \
  220. do { \
  221. val = __LDREXH((__IO uint16_t *)&(REG)) | (BIT); \
  222. } while ((__STREXH(val,(__IO uint16_t *)&(REG))) != 0U); \
  223. } while(0)
  224. /* Atomic 16-bit register access macro to clear one or several bits */
  225. #define ATOMIC_CLEARH_BIT(REG, BIT) \
  226. do { \
  227. uint16_t val; \
  228. do { \
  229. val = __LDREXH((__IO uint16_t *)&(REG)) & ~(BIT); \
  230. } while ((__STREXH(val,(__IO uint16_t *)&(REG))) != 0U); \
  231. } while(0)
  232. /* Atomic 16-bit register access macro to clear and set one or several bits */
  233. #define ATOMIC_MODIFYH_REG(REG, CLEARMSK, SETMASK) \
  234. do { \
  235. uint16_t val; \
  236. do { \
  237. val = (__LDREXH((__IO uint16_t *)&(REG)) & ~(CLEARMSK)) | (SETMASK); \
  238. } while ((__STREXH(val,(__IO uint16_t *)&(REG))) != 0U); \
  239. } while(0)
  240. /**
  241. * @}
  242. */
  243. #if defined (USE_HAL_DRIVER)
  244. #include "stm32h7xx_hal.h"
  245. #endif /* USE_HAL_DRIVER */
  246. #ifdef __cplusplus
  247. }
  248. #endif /* __cplusplus */
  249. #endif /* STM32H7xx_H */
  250. /**
  251. * @}
  252. */
  253. /**
  254. * @}
  255. */