stm32h7xx.h 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. /**
  2. ******************************************************************************
  3. * @file stm32h7xx.h
  4. * @author MCD Application Team
  5. * @version V1.1.0
  6. * @date 31-August-2017
  7. * @brief CMSIS STM32H7xx Device Peripheral Access Layer Header File.
  8. *
  9. * The file is the unique include file that the application programmer
  10. * is using in the C source code, usually in main.c. This file contains:
  11. * - Configuration section that allows to select:
  12. * - The STM32H7xx device used in the target application
  13. * - To use or not the peripheral’s drivers in application code(i.e.
  14. * code will be based on direct access to peripheral’s registers
  15. * rather than drivers API), this option is controlled by
  16. * "#define USE_HAL_DRIVER"
  17. *
  18. ******************************************************************************
  19. * @attention
  20. *
  21. * <h2><center>&copy; COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
  22. *
  23. * Redistribution and use in source and binary forms, with or without modification,
  24. * are permitted provided that the following conditions are met:
  25. * 1. Redistributions of source code must retain the above copyright notice,
  26. * this list of conditions and the following disclaimer.
  27. * 2. Redistributions in binary form must reproduce the above copyright notice,
  28. * this list of conditions and the following disclaimer in the documentation
  29. * and/or other materials provided with the distribution.
  30. * 3. Neither the name of STMicroelectronics nor the names of its contributors
  31. * may be used to endorse or promote products derived from this software
  32. * without specific prior written permission.
  33. *
  34. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  35. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  36. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  37. * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
  38. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  39. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  40. * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  41. * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  42. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  43. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  44. *
  45. ******************************************************************************
  46. */
  47. /** @addtogroup CMSIS
  48. * @{
  49. */
  50. /** @addtogroup stm32h7xx
  51. * @{
  52. */
  53. #ifndef __STM32H7xx_H
  54. #define __STM32H7xx_H
  55. #ifdef __cplusplus
  56. extern "C" {
  57. #endif /* __cplusplus */
  58. /** @addtogroup Library_configuration_section
  59. * @{
  60. */
  61. /**
  62. * @brief STM32 Family
  63. */
  64. #if !defined (STM32H7)
  65. #define STM32H7
  66. #endif /* STM32H7 */
  67. /* Uncomment the line below according to the target STM32H7 device used in your
  68. application
  69. */
  70. #if !defined (STM32H743xx) && !defined (STM32H753xx)
  71. /* #define STM32H743xx */ /*!< STM32H743VI, STM32H743ZI, STM32H743II, STM32H743BI, STM32H743XI Devices */
  72. /* #define STM32H753xx */ /*!< STM32H753VI, STM32H753ZI, STM32H753II, STM32H753BI, STM32H753XI Devices */
  73. #endif
  74. /* Tip: To avoid modifying this file each time you need to switch between these
  75. devices, you can define the device in your toolchain compiler preprocessor.
  76. */
  77. #if !defined (USE_HAL_DRIVER)
  78. /**
  79. * @brief Comment the line below if you will not use the peripherals drivers.
  80. In this case, these drivers will not be included and the application code will
  81. be based on direct access to peripherals registers
  82. */
  83. /*#define USE_HAL_DRIVER */
  84. #endif /* USE_HAL_DRIVER */
  85. /**
  86. * @brief CMSIS Device version number V1.1.0
  87. */
  88. #define __STM32H7xx_CMSIS_DEVICE_VERSION_MAIN (0x01) /*!< [31:24] main version */
  89. #define __STM32H7xx_CMSIS_DEVICE_VERSION_SUB1 (0x01) /*!< [23:16] sub1 version */
  90. #define __STM32H7xx_CMSIS_DEVICE_VERSION_SUB2 (0x00) /*!< [15:8] sub2 version */
  91. #define __STM32H7xx_CMSIS_DEVICE_VERSION_RC (0x00) /*!< [7:0] release candidate */
  92. #define __STM32H7xx_CMSIS_DEVICE_VERSION ((__CMSIS_DEVICE_VERSION_MAIN << 24)\
  93. |(__CMSIS_DEVICE_HAL_VERSION_SUB1 << 16)\
  94. |(__CMSIS_DEVICE_HAL_VERSION_SUB2 << 8 )\
  95. |(__CMSIS_DEVICE_HAL_VERSION_RC))
  96. /**
  97. * @}
  98. */
  99. /** @addtogroup Device_Included
  100. * @{
  101. */
  102. #if defined(STM32H743xx)
  103. #include "stm32h743xx.h"
  104. #elif defined(STM32H753xx)
  105. #include "stm32h753xx.h"
  106. #else
  107. #error "Please select first the target STM32H7xx device used in your application (in stm32h7xx.h file)"
  108. #endif
  109. /**
  110. * @}
  111. */
  112. /** @addtogroup Exported_types
  113. * @{
  114. */
  115. typedef enum
  116. {
  117. RESET = 0,
  118. SET = !RESET
  119. } FlagStatus, ITStatus;
  120. typedef enum
  121. {
  122. DISABLE = 0,
  123. ENABLE = !DISABLE
  124. } FunctionalState;
  125. #define IS_FUNCTIONAL_STATE(STATE) (((STATE) == DISABLE) || ((STATE) == ENABLE))
  126. typedef enum
  127. {
  128. ERROR = 0,
  129. SUCCESS = !ERROR
  130. } ErrorStatus;
  131. /**
  132. * @}
  133. */
  134. /** @addtogroup Exported_macros
  135. * @{
  136. */
  137. #define SET_BIT(REG, BIT) ((REG) |= (BIT))
  138. #define CLEAR_BIT(REG, BIT) ((REG) &= ~(BIT))
  139. #define READ_BIT(REG, BIT) ((REG) & (BIT))
  140. #define CLEAR_REG(REG) ((REG) = (0x0))
  141. #define WRITE_REG(REG, VAL) ((REG) = (VAL))
  142. #define READ_REG(REG) ((REG))
  143. #define MODIFY_REG(REG, CLEARMASK, SETMASK) WRITE_REG((REG), (((READ_REG(REG)) & (~(CLEARMASK))) | (SETMASK)))
  144. #define POSITION_VAL(VAL) (__CLZ(__RBIT(VAL)))
  145. /**
  146. * @}
  147. */
  148. #if defined (USE_HAL_DRIVER)
  149. #include "stm32h7xx_hal.h"
  150. #endif /* USE_HAL_DRIVER */
  151. #ifdef __cplusplus
  152. }
  153. #endif /* __cplusplus */
  154. #endif /* __STM32H7xx_H */
  155. /**
  156. * @}
  157. */
  158. /**
  159. * @}
  160. */
  161. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/