rjw | 1f88458 | 2022-01-06 17:20:42 +0800 | [diff] [blame^] | 1 | /** |
| 2 | ****************************************************************************** |
| 3 | * @file stm32f7xx.h |
| 4 | * @author MCD Application Team |
| 5 | * @version V1.0.1 |
| 6 | * @date 25-June-2015 |
| 7 | * @brief CMSIS STM32F7xx 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 STM32F7xx 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>© COPYRIGHT(c) 2015 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 | |
| 48 | /** @addtogroup CMSIS |
| 49 | * @{ |
| 50 | */ |
| 51 | |
| 52 | /** @addtogroup stm32f7xx |
| 53 | * @{ |
| 54 | */ |
| 55 | |
| 56 | #ifndef __STM32F7xx_H |
| 57 | #define __STM32F7xx_H |
| 58 | |
| 59 | #ifdef __cplusplus |
| 60 | extern "C" { |
| 61 | #endif /* __cplusplus */ |
| 62 | |
| 63 | /** @addtogroup Library_configuration_section |
| 64 | * @{ |
| 65 | */ |
| 66 | |
| 67 | /** |
| 68 | * @brief STM32 Family |
| 69 | */ |
| 70 | #if !defined (STM32F7) |
| 71 | #define STM32F7 |
| 72 | #endif /* STM32F7 */ |
| 73 | |
| 74 | /* Uncomment the line below according to the target STM32 device used in your |
| 75 | application |
| 76 | */ |
| 77 | #if !defined (STM32F756xx) && !defined (STM32F746xx) && !defined (STM32F745xx) |
| 78 | /* #define STM32F756xx */ /*!< STM32F756VG, STM32F756ZG, STM32F756ZG, STM32F756IG, STM32F756BG, |
| 79 | STM32F756NG Devices */ |
| 80 | /* #define STM32F746xx */ /*!< STM32F746VE, STM32F746VG, STM32F746ZE, STM32F746ZG, STM32F746IE, STM32F746IG, |
| 81 | STM32F746BE, STM32F746BG, STM32F746NE, STM32F746NG Devices */ |
| 82 | /* #define STM32F745xx */ /*!< STM32F745VE, STM32F745VG, STM32F745ZG, STM32F745ZE, STM32F745IE, STM32F745IG Devices */ |
| 83 | #endif |
| 84 | |
| 85 | /* Tip: To avoid modifying this file each time you need to switch between these |
| 86 | devices, you can define the device in your toolchain compiler preprocessor. |
| 87 | */ |
| 88 | |
| 89 | #if !defined (USE_HAL_DRIVER) |
| 90 | /** |
| 91 | * @brief Comment the line below if you will not use the peripherals drivers. |
| 92 | In this case, these drivers will not be included and the application code will |
| 93 | be based on direct access to peripherals registers |
| 94 | */ |
| 95 | #define USE_HAL_DRIVER |
| 96 | #endif /* USE_HAL_DRIVER */ |
| 97 | |
| 98 | /** |
| 99 | * @brief CMSIS Device version number V1.0.1 |
| 100 | */ |
| 101 | #define __STM32F7xx_CMSIS_DEVICE_VERSION_MAIN (0x01) /*!< [31:24] main version */ |
| 102 | #define __STM32F7xx_CMSIS_DEVICE_VERSION_SUB1 (0x00) /*!< [23:16] sub1 version */ |
| 103 | #define __STM32F7xx_CMSIS_DEVICE_VERSION_SUB2 (0x01) /*!< [15:8] sub2 version */ |
| 104 | #define __STM32F7xx_CMSIS_DEVICE_VERSION_RC (0x00) /*!< [7:0] release candidate */ |
| 105 | #define __STM32F7xx_CMSIS_DEVICE_VERSION ((__STM32F7xx_CMSIS_DEVICE_VERSION_MAIN << 24)\ |
| 106 | |(__STM32F7xx_CMSIS_DEVICE_VERSION_SUB1 << 16)\ |
| 107 | |(__STM32F7xx_CMSIS_DEVICE_VERSION_SUB2 << 8 )\ |
| 108 | |(__STM32F7xx_CMSIS_DEVICE_VERSION)) |
| 109 | /** |
| 110 | * @} |
| 111 | */ |
| 112 | |
| 113 | /** @addtogroup Device_Included |
| 114 | * @{ |
| 115 | */ |
| 116 | #if defined(STM32F756xx) |
| 117 | #include "stm32f756xx.h" |
| 118 | #elif defined(STM32F746xx) |
| 119 | #include "stm32f746xx.h" |
| 120 | #elif defined(STM32F745xx) |
| 121 | #include "stm32f745xx.h" |
| 122 | #else |
| 123 | #error "Please select first the target STM32F7xx device used in your application (in stm32f7xx.h file)" |
| 124 | #endif |
| 125 | |
| 126 | /** |
| 127 | * @} |
| 128 | */ |
| 129 | |
| 130 | /** @addtogroup Exported_types |
| 131 | * @{ |
| 132 | */ |
| 133 | typedef enum { |
| 134 | RESET = 0, |
| 135 | SET = !RESET |
| 136 | } FlagStatus, ITStatus; |
| 137 | |
| 138 | typedef enum { |
| 139 | DISABLE = 0, |
| 140 | ENABLE = !DISABLE |
| 141 | } FunctionalState; |
| 142 | #define IS_FUNCTIONAL_STATE(STATE) (((STATE) == DISABLE) || ((STATE) == ENABLE)) |
| 143 | |
| 144 | typedef enum { |
| 145 | ERROR = 0, |
| 146 | SUCCESS = !ERROR |
| 147 | } ErrorStatus; |
| 148 | |
| 149 | /** |
| 150 | * @} |
| 151 | */ |
| 152 | |
| 153 | /** @addtogroup Exported_macro |
| 154 | * @{ |
| 155 | */ |
| 156 | #define SET_BIT(REG, BIT) ((REG) |= (BIT)) |
| 157 | |
| 158 | #define CLEAR_BIT(REG, BIT) ((REG) &= ~(BIT)) |
| 159 | |
| 160 | #define READ_BIT(REG, BIT) ((REG) & (BIT)) |
| 161 | |
| 162 | #define CLEAR_REG(REG) ((REG) = (0x0)) |
| 163 | |
| 164 | #define WRITE_REG(REG, VAL) ((REG) = (VAL)) |
| 165 | |
| 166 | #define READ_REG(REG) ((REG)) |
| 167 | |
| 168 | #define MODIFY_REG(REG, CLEARMASK, SETMASK) WRITE_REG((REG), (((READ_REG(REG)) & (~(CLEARMASK))) | (SETMASK))) |
| 169 | |
| 170 | #define POSITION_VAL(VAL) (__CLZ(__RBIT(VAL))) |
| 171 | |
| 172 | /** |
| 173 | * @} |
| 174 | */ |
| 175 | |
| 176 | #ifdef USE_HAL_DRIVER |
| 177 | #include "stm32f7xx_hal_conf.h" |
| 178 | #endif /* USE_HAL_DRIVER */ |
| 179 | |
| 180 | #ifdef __cplusplus |
| 181 | } |
| 182 | #endif /* __cplusplus */ |
| 183 | |
| 184 | #endif /* __STM32F7xx_H */ |
| 185 | |
| 186 | /** |
| 187 | * @} |
| 188 | */ |
| 189 | |
| 190 | /** |
| 191 | * @} |
| 192 | */ |
| 193 | |
| 194 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |