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 29 /** @addtogroup CMSIS 30 * @{ 31 */ 32 33 /** @addtogroup stm32f7xx 34 * @{ 35 */ 36 37 #ifndef __STM32F7xx_H 38 #define __STM32F7xx_H 39 40 #ifdef __cplusplus 41 extern "C" { 42 #endif /* __cplusplus */ 43 44 /** @addtogroup Library_configuration_section 45 * @{ 46 */ 47 48 /** 49 * @brief STM32 Family 50 */ 51 #if !defined (STM32F7) 52 #define STM32F7 53 #endif /* STM32F7 */ 54 55 /* Uncomment the line below according to the target STM32 device used in your 56 application 57 */ 58 #if !defined (STM32F756xx) && !defined (STM32F746xx) && !defined (STM32F745xx) && !defined (STM32F765xx) && \ 59 !defined (STM32F767xx) && !defined (STM32F769xx) && !defined (STM32F777xx) && !defined (STM32F779xx) && \ 60 !defined (STM32F722xx) && !defined (STM32F723xx) && !defined (STM32F732xx) && !defined (STM32F733xx) && \ 61 !defined (STM32F730xx) && !defined (STM32F750xx) 62 63 /* #define STM32F756xx */ /*!< STM32F756VG, STM32F756ZG, STM32F756ZG, STM32F756IG, STM32F756BG, 64 STM32F756NG Devices */ 65 /* #define STM32F746xx */ /*!< STM32F746VE, STM32F746VG, STM32F746ZE, STM32F746ZG, STM32F746IE, STM32F746IG, 66 STM32F746BE, STM32F746BG, STM32F746NE, STM32F746NG Devices */ 67 /* #define STM32F745xx */ /*!< STM32F745VE, STM32F745VG, STM32F745ZG, STM32F745ZE, STM32F745IE, STM32F745IG Devices */ 68 /* #define STM32F765xx */ /*!< STM32F765BI, STM32F765BG, STM32F765NI, STM32F765NG, STM32F765II, STM32F765IG, 69 STM32F765ZI, STM32F765ZG, STM32F765VI, STM32F765VG Devices */ 70 /* #define STM32F767xx */ /*!< STM32F767BG, STM32F767BI, STM32F767IG, STM32F767II, STM32F767NG, STM32F767NI, 71 STM32F767VG, STM32F767VI, STM32F767ZG, STM32F767ZI Devices */ 72 /* #define STM32F769xx */ /*!< STM32F769AG, STM32F769AI, STM32F769BG, STM32F769BI, STM32F769IG, STM32F769II, 73 STM32F769NG, STM32F769NI, STM32F768AI Devices */ 74 /* #define STM32F777xx */ /*!< STM32F777VI, STM32F777ZI, STM32F777II, STM32F777BI, STM32F777NI Devices */ 75 /* #define STM32F779xx */ /*!< STM32F779II, STM32F779BI, STM32F779NI, STM32F779AI, STM32F778AI Devices */ 76 /* #define STM32F722xx */ /*!< STM32F722IE, STM32F722ZE, STM32F722VE, STM32F722RE, STM32F722IC, STM32F722ZC, 77 STM32F722VC, STM32F722RC Devices */ 78 /* #define STM32F723xx */ /*!< STM32F723IE, STM32F723ZE, STM32F723VE, STM32F723IC, STM32F723ZC, STM32F723VC Devices */ 79 /* #define STM32F732xx */ /*!< STM32F732IE, STM32F732ZE, STM32F732VE, STM32F732RE Devices */ 80 /* #define STM32F733xx */ /*!< STM32F733IE, STM32F733ZE, STM32F733VE Devices */ 81 /* #define STM32F730xx */ /*!< STM32F730R, STM32F730V, STM32F730Z, STM32F730I Devices */ 82 /* #define STM32F750xx */ /*!< STM32F750V, STM32F750Z, STM32F750N 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.2.8 100 */ 101 #define __STM32F7_CMSIS_VERSION_MAIN (0x01) /*!< [31:24] main version */ 102 #define __STM32F7_CMSIS_VERSION_SUB1 (0x02) /*!< [23:16] sub1 version */ 103 #define __STM32F7_CMSIS_VERSION_SUB2 (0x08) /*!< [15:8] sub2 version */ 104 #define __STM32F7_CMSIS_VERSION_RC (0x00) /*!< [7:0] release candidate */ 105 #define __STM32F7_CMSIS_VERSION ((__STM32F7_CMSIS_VERSION_MAIN << 24)\ 106 |(__STM32F7_CMSIS_VERSION_SUB1 << 16)\ 107 |(__STM32F7_CMSIS_VERSION_SUB2 << 8 )\ 108 |(__STM32F7_CMSIS_VERSION_RC)) 109 /** 110 * @} 111 */ 112 113 /** @addtogroup Device_Included 114 * @{ 115 */ 116 #if defined(STM32F722xx) 117 #include "stm32f722xx.h" 118 #elif defined(STM32F723xx) 119 #include "stm32f723xx.h" 120 #elif defined(STM32F732xx) 121 #include "stm32f732xx.h" 122 #elif defined(STM32F733xx) 123 #include "stm32f733xx.h" 124 #elif defined(STM32F756xx) 125 #include "stm32f756xx.h" 126 #elif defined(STM32F746xx) 127 #include "stm32f746xx.h" 128 #elif defined(STM32F745xx) 129 #include "stm32f745xx.h" 130 #elif defined(STM32F765xx) 131 #include "stm32f765xx.h" 132 #elif defined(STM32F767xx) 133 #include "stm32f767xx.h" 134 #elif defined(STM32F769xx) 135 #include "stm32f769xx.h" 136 #elif defined(STM32F777xx) 137 #include "stm32f777xx.h" 138 #elif defined(STM32F779xx) 139 #include "stm32f779xx.h" 140 #elif defined(STM32F730xx) 141 #include "stm32f730xx.h" 142 #elif defined(STM32F750xx) 143 #include "stm32f750xx.h" 144 #else 145 #error "Please select first the target STM32F7xx device used in your application (in stm32f7xx.h file)" 146 #endif 147 148 /** 149 * @} 150 */ 151 152 /** @addtogroup Exported_types 153 * @{ 154 */ 155 typedef enum 156 { 157 RESET = 0U, 158 SET = !RESET 159 } FlagStatus, ITStatus; 160 161 typedef enum 162 { 163 DISABLE = 0U, 164 ENABLE = !DISABLE 165 } FunctionalState; 166 #define IS_FUNCTIONAL_STATE(STATE) (((STATE) == DISABLE) || ((STATE) == ENABLE)) 167 168 typedef enum 169 { 170 SUCCESS = 0U, 171 ERROR = !SUCCESS 172 } ErrorStatus; 173 174 /** 175 * @} 176 */ 177 178 /** @addtogroup Exported_macro 179 * @{ 180 */ 181 #define SET_BIT(REG, BIT) ((REG) |= (BIT)) 182 183 #define CLEAR_BIT(REG, BIT) ((REG) &= ~(BIT)) 184 185 #define READ_BIT(REG, BIT) ((REG) & (BIT)) 186 187 #define CLEAR_REG(REG) ((REG) = (0x0)) 188 189 #define WRITE_REG(REG, VAL) ((REG) = (VAL)) 190 191 #define READ_REG(REG) ((REG)) 192 193 #define MODIFY_REG(REG, CLEARMASK, SETMASK) WRITE_REG((REG), (((READ_REG(REG)) & (~(CLEARMASK))) | (SETMASK))) 194 195 #define POSITION_VAL(VAL) (__CLZ(__RBIT(VAL))) 196 197 /* Use of CMSIS compiler intrinsics for register exclusive access */ 198 /* Atomic 32-bit register access macro to set one or several bits */ 199 #define ATOMIC_SET_BIT(REG, BIT) \ 200 do { \ 201 uint32_t val; \ 202 do { \ 203 val = __LDREXW((__IO uint32_t *)&(REG)) | (BIT); \ 204 } while ((__STREXW(val,(__IO uint32_t *)&(REG))) != 0U); \ 205 } while(0) 206 207 /* Atomic 32-bit register access macro to clear one or several bits */ 208 #define ATOMIC_CLEAR_BIT(REG, BIT) \ 209 do { \ 210 uint32_t val; \ 211 do { \ 212 val = __LDREXW((__IO uint32_t *)&(REG)) & ~(BIT); \ 213 } while ((__STREXW(val,(__IO uint32_t *)&(REG))) != 0U); \ 214 } while(0) 215 216 /* Atomic 32-bit register access macro to clear and set one or several bits */ 217 #define ATOMIC_MODIFY_REG(REG, CLEARMSK, SETMASK) \ 218 do { \ 219 uint32_t val; \ 220 do { \ 221 val = (__LDREXW((__IO uint32_t *)&(REG)) & ~(CLEARMSK)) | (SETMASK); \ 222 } while ((__STREXW(val,(__IO uint32_t *)&(REG))) != 0U); \ 223 } while(0) 224 225 /* Atomic 16-bit register access macro to set one or several bits */ 226 #define ATOMIC_SETH_BIT(REG, BIT) \ 227 do { \ 228 uint16_t val; \ 229 do { \ 230 val = __LDREXH((__IO uint16_t *)&(REG)) | (BIT); \ 231 } while ((__STREXH(val,(__IO uint16_t *)&(REG))) != 0U); \ 232 } while(0) 233 234 /* Atomic 16-bit register access macro to clear one or several bits */ 235 #define ATOMIC_CLEARH_BIT(REG, BIT) \ 236 do { \ 237 uint16_t val; \ 238 do { \ 239 val = __LDREXH((__IO uint16_t *)&(REG)) & ~(BIT); \ 240 } while ((__STREXH(val,(__IO uint16_t *)&(REG))) != 0U); \ 241 } while(0) 242 243 /* Atomic 16-bit register access macro to clear and set one or several bits */ 244 #define ATOMIC_MODIFYH_REG(REG, CLEARMSK, SETMASK) \ 245 do { \ 246 uint16_t val; \ 247 do { \ 248 val = (__LDREXH((__IO uint16_t *)&(REG)) & ~(CLEARMSK)) | (SETMASK); \ 249 } while ((__STREXH(val,(__IO uint16_t *)&(REG))) != 0U); \ 250 } while(0) 251 252 /** 253 * @} 254 */ 255 256 #ifdef USE_HAL_DRIVER 257 #include "stm32f7xx_hal.h" 258 #endif /* USE_HAL_DRIVER */ 259 260 #ifdef __cplusplus 261 } 262 #endif /* __cplusplus */ 263 264 #endif /* __STM32F7xx_H */ 265 266 /** 267 * @} 268 */ 269 270 /** 271 * @} 272 */ 273 274