|
| 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 | + * <h2><center>© Copyright (c) 2017 STMicroelectronics. |
| 20 | + * All rights reserved.</center></h2> |
| 21 | + * |
| 22 | + * This software component is licensed by ST under BSD 3-Clause license, |
| 23 | + * the "License"; You may not use this file except in compliance with the |
| 24 | + * License. You may obtain a copy of the License at: |
| 25 | + * opensource.org/licenses/BSD-3-Clause |
| 26 | + * |
| 27 | + ****************************************************************************** |
| 28 | + */ |
| 29 | + |
| 30 | +/** @addtogroup CMSIS |
| 31 | + * @{ |
| 32 | + */ |
| 33 | + |
| 34 | +/** @addtogroup stm32h7xx |
| 35 | + * @{ |
| 36 | + */ |
| 37 | + |
| 38 | +#ifndef STM32H7xx_H |
| 39 | +#define STM32H7xx_H |
| 40 | + |
| 41 | +#ifdef __cplusplus |
| 42 | + extern "C" { |
| 43 | +#endif /* __cplusplus */ |
| 44 | + |
| 45 | +/** @addtogroup Library_configuration_section |
| 46 | + * @{ |
| 47 | + */ |
| 48 | + |
| 49 | +/** |
| 50 | + * @brief STM32 Family |
| 51 | + */ |
| 52 | +#if !defined (STM32H7) |
| 53 | +#define STM32H7 |
| 54 | +#endif /* STM32H7 */ |
| 55 | + |
| 56 | + |
| 57 | +/* Uncomment the line below according to the target STM32H7 device used in your |
| 58 | + application |
| 59 | + */ |
| 60 | + |
| 61 | +#if !defined (STM32H743xx) && !defined (STM32H753xx) && !defined (STM32H750xx) |
| 62 | + /* #define STM32H743xx */ /*!< STM32H743VI, STM32H743ZI, STM32H743AI, STM32H743II, STM32H743BI, STM32H743XI Devices */ |
| 63 | + /* #define STM32H753xx */ /*!< STM32H753VI, STM32H753ZI, STM32H753AI, STM32H753II, STM32H753BI, STM32H753XI Devices */ |
| 64 | + /* #define STM32H750xx */ /*!< STM32H750V, STM32H750I, STM32H750X Devices */ |
| 65 | +#endif |
| 66 | + |
| 67 | +/* Tip: To avoid modifying this file each time you need to switch between these |
| 68 | + devices, you can define the device in your toolchain compiler preprocessor. |
| 69 | + */ |
| 70 | + |
| 71 | + |
| 72 | +#if !defined (USE_HAL_DRIVER) |
| 73 | +/** |
| 74 | + * @brief Comment the line below if you will not use the peripherals drivers. |
| 75 | + In this case, these drivers will not be included and the application code will |
| 76 | + be based on direct access to peripherals registers |
| 77 | + */ |
| 78 | + /*#define USE_HAL_DRIVER */ |
| 79 | +#endif /* USE_HAL_DRIVER */ |
| 80 | + |
| 81 | +/** |
| 82 | + * @brief CMSIS Device version number V1.4.0 |
| 83 | + */ |
| 84 | +#define __STM32H7xx_CMSIS_DEVICE_VERSION_MAIN (0x01) /*!< [31:24] main version */ |
| 85 | +#define __STM32H7xx_CMSIS_DEVICE_VERSION_SUB1 (0x04) /*!< [23:16] sub1 version */ |
| 86 | +#define __STM32H7xx_CMSIS_DEVICE_VERSION_SUB2 (0x00) /*!< [15:8] sub2 version */ |
| 87 | +#define __STM32H7xx_CMSIS_DEVICE_VERSION_RC (0x00) /*!< [7:0] release candidate */ |
| 88 | +#define __STM32H7xx_CMSIS_DEVICE_VERSION ((__CMSIS_DEVICE_VERSION_MAIN << 24)\ |
| 89 | + |(__CMSIS_DEVICE_HAL_VERSION_SUB1 << 16)\ |
| 90 | + |(__CMSIS_DEVICE_HAL_VERSION_SUB2 << 8 )\ |
| 91 | + |(__CMSIS_DEVICE_HAL_VERSION_RC)) |
| 92 | + |
| 93 | +/** |
| 94 | + * @} |
| 95 | + */ |
| 96 | + |
| 97 | +/** @addtogroup Device_Included |
| 98 | + * @{ |
| 99 | + */ |
| 100 | + |
| 101 | +#if defined(STM32H743xx) |
| 102 | + #include "stm32h743xx.h" |
| 103 | +#elif defined(STM32H753xx) |
| 104 | + #include "stm32h753xx.h" |
| 105 | +#elif defined(STM32H750xx) |
| 106 | + #include "stm32h750xx.h" |
| 107 | +#else |
| 108 | + #error "Please select first the target STM32H7xx device used in your application (in stm32h7xx.h file)" |
| 109 | +#endif |
| 110 | + |
| 111 | +/** |
| 112 | + * @} |
| 113 | + */ |
| 114 | + |
| 115 | +/** @addtogroup Exported_types |
| 116 | + * @{ |
| 117 | + */ |
| 118 | +typedef enum |
| 119 | +{ |
| 120 | + RESET = 0, |
| 121 | + SET = !RESET |
| 122 | +} FlagStatus, ITStatus; |
| 123 | + |
| 124 | +typedef enum |
| 125 | +{ |
| 126 | + DISABLE = 0, |
| 127 | + ENABLE = !DISABLE |
| 128 | +} FunctionalState; |
| 129 | +#define IS_FUNCTIONAL_STATE(STATE) (((STATE) == DISABLE) || ((STATE) == ENABLE)) |
| 130 | + |
| 131 | +typedef enum |
| 132 | +{ |
| 133 | + ERROR = 0, |
| 134 | + SUCCESS = !ERROR |
| 135 | +} ErrorStatus; |
| 136 | + |
| 137 | +/** |
| 138 | + * @} |
| 139 | + */ |
| 140 | + |
| 141 | + |
| 142 | +/** @addtogroup Exported_macros |
| 143 | + * @{ |
| 144 | + */ |
| 145 | +#define SET_BIT(REG, BIT) ((REG) |= (BIT)) |
| 146 | + |
| 147 | +#define CLEAR_BIT(REG, BIT) ((REG) &= ~(BIT)) |
| 148 | + |
| 149 | +#define READ_BIT(REG, BIT) ((REG) & (BIT)) |
| 150 | + |
| 151 | +#define CLEAR_REG(REG) ((REG) = (0x0)) |
| 152 | + |
| 153 | +#define WRITE_REG(REG, VAL) ((REG) = (VAL)) |
| 154 | + |
| 155 | +#define READ_REG(REG) ((REG)) |
| 156 | + |
| 157 | +#define MODIFY_REG(REG, CLEARMASK, SETMASK) WRITE_REG((REG), (((READ_REG(REG)) & (~(CLEARMASK))) | (SETMASK))) |
| 158 | + |
| 159 | +#define POSITION_VAL(VAL) (__CLZ(__RBIT(VAL))) |
| 160 | + |
| 161 | + |
| 162 | +/** |
| 163 | + * @} |
| 164 | + */ |
| 165 | + |
| 166 | +#if defined (USE_HAL_DRIVER) |
| 167 | + #include "stm32h7xx_hal.h" |
| 168 | +#endif /* USE_HAL_DRIVER */ |
| 169 | + |
| 170 | + |
| 171 | +#ifdef __cplusplus |
| 172 | +} |
| 173 | +#endif /* __cplusplus */ |
| 174 | + |
| 175 | +#endif /* STM32H7xx_H */ |
| 176 | +/** |
| 177 | + * @} |
| 178 | + */ |
| 179 | + |
| 180 | +/** |
| 181 | + * @} |
| 182 | + */ |
| 183 | + |
| 184 | + |
| 185 | + |
| 186 | + |
| 187 | +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |
0 commit comments