mbed library sources. Supersedes mbed-src.

Dependents:   Nucleo_Hello_Encoder BLE_iBeaconScan AM1805_DEMO DISCO-F429ZI_ExportTemplate1 ... more

Committer:
AnnaBridge
Date:
Wed Feb 20 22:31:08 2019 +0000
Revision:
189:f392fc9709a3
Parent:
182:a56a73fd2a6f
mbed library release version 165

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 19:112740acecfa 1 /**
mbed_official 19:112740acecfa 2 ******************************************************************************
mbed_official 19:112740acecfa 3 * @file stm32f4xx.h
mbed_official 19:112740acecfa 4 * @author MCD Application Team
mbed_official 19:112740acecfa 5 * @brief CMSIS STM32F4xx Device Peripheral Access Layer Header File.
mbed_official 19:112740acecfa 6 *
mbed_official 19:112740acecfa 7 * The file is the unique include file that the application programmer
mbed_official 19:112740acecfa 8 * is using in the C source code, usually in main.c. This file contains:
mbed_official 19:112740acecfa 9 * - Configuration section that allows to select:
mbed_official 19:112740acecfa 10 * - The STM32F4xx device used in the target application
<> 144:ef7eb2e8f9f7 11 * - To use or not the peripheral's drivers in application code(i.e.
<> 144:ef7eb2e8f9f7 12 * code will be based on direct access to peripheral's registers
mbed_official 19:112740acecfa 13 * rather than drivers API), this option is controlled by
mbed_official 19:112740acecfa 14 * "#define USE_HAL_DRIVER"
mbed_official 19:112740acecfa 15 *
mbed_official 19:112740acecfa 16 ******************************************************************************
mbed_official 19:112740acecfa 17 * @attention
mbed_official 19:112740acecfa 18 *
AnnaBridge 167:e84263d55307 19 * <h2><center>&copy; COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
mbed_official 19:112740acecfa 20 *
mbed_official 19:112740acecfa 21 * Redistribution and use in source and binary forms, with or without modification,
mbed_official 19:112740acecfa 22 * are permitted provided that the following conditions are met:
mbed_official 19:112740acecfa 23 * 1. Redistributions of source code must retain the above copyright notice,
mbed_official 19:112740acecfa 24 * this list of conditions and the following disclaimer.
mbed_official 19:112740acecfa 25 * 2. Redistributions in binary form must reproduce the above copyright notice,
mbed_official 19:112740acecfa 26 * this list of conditions and the following disclaimer in the documentation
mbed_official 19:112740acecfa 27 * and/or other materials provided with the distribution.
mbed_official 19:112740acecfa 28 * 3. Neither the name of STMicroelectronics nor the names of its contributors
mbed_official 19:112740acecfa 29 * may be used to endorse or promote products derived from this software
mbed_official 19:112740acecfa 30 * without specific prior written permission.
mbed_official 19:112740acecfa 31 *
mbed_official 19:112740acecfa 32 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
mbed_official 19:112740acecfa 33 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
mbed_official 19:112740acecfa 34 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
mbed_official 19:112740acecfa 35 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
mbed_official 19:112740acecfa 36 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
mbed_official 19:112740acecfa 37 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
mbed_official 19:112740acecfa 38 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
mbed_official 19:112740acecfa 39 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
mbed_official 19:112740acecfa 40 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
mbed_official 19:112740acecfa 41 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
mbed_official 19:112740acecfa 42 *
mbed_official 19:112740acecfa 43 ******************************************************************************
mbed_official 19:112740acecfa 44 */
mbed_official 19:112740acecfa 45
mbed_official 19:112740acecfa 46 /** @addtogroup CMSIS
mbed_official 19:112740acecfa 47 * @{
mbed_official 19:112740acecfa 48 */
mbed_official 19:112740acecfa 49
mbed_official 19:112740acecfa 50 /** @addtogroup stm32f4xx
mbed_official 19:112740acecfa 51 * @{
mbed_official 19:112740acecfa 52 */
mbed_official 19:112740acecfa 53
mbed_official 19:112740acecfa 54 #ifndef __STM32F4xx_H
mbed_official 19:112740acecfa 55 #define __STM32F4xx_H
mbed_official 19:112740acecfa 56
mbed_official 19:112740acecfa 57 #ifdef __cplusplus
mbed_official 19:112740acecfa 58 extern "C" {
mbed_official 19:112740acecfa 59 #endif /* __cplusplus */
mbed_official 19:112740acecfa 60
mbed_official 19:112740acecfa 61 /** @addtogroup Library_configuration_section
mbed_official 19:112740acecfa 62 * @{
mbed_official 19:112740acecfa 63 */
mbed_official 19:112740acecfa 64
mbed_official 19:112740acecfa 65 /**
mbed_official 19:112740acecfa 66 * @brief STM32 Family
mbed_official 19:112740acecfa 67 */
mbed_official 19:112740acecfa 68 #if !defined (STM32F4)
mbed_official 19:112740acecfa 69 #define STM32F4
mbed_official 19:112740acecfa 70 #endif /* STM32F4 */
mbed_official 19:112740acecfa 71
mbed_official 19:112740acecfa 72 /* Uncomment the line below according to the target STM32 device used in your
mbed_official 19:112740acecfa 73 application
mbed_official 19:112740acecfa 74 */
mbed_official 19:112740acecfa 75 #if !defined (STM32F405xx) && !defined (STM32F415xx) && !defined (STM32F407xx) && !defined (STM32F417xx) && \
mbed_official 19:112740acecfa 76 !defined (STM32F427xx) && !defined (STM32F437xx) && !defined (STM32F429xx) && !defined (STM32F439xx) && \
mbed_official 19:112740acecfa 77 !defined (STM32F401xC) && !defined (STM32F401xE) && !defined (STM32F410Tx) && !defined (STM32F410Cx) && \
<> 144:ef7eb2e8f9f7 78 !defined (STM32F410Rx) && !defined (STM32F411xE) && !defined (STM32F446xx) && !defined (STM32F469xx) && \
<> 144:ef7eb2e8f9f7 79 !defined (STM32F479xx) && !defined (STM32F412Cx) && !defined (STM32F412Rx) && !defined (STM32F412Vx) && \
AnnaBridge 167:e84263d55307 80 !defined (STM32F412Zx) && !defined (STM32F413xx) && !defined (STM32F423xx)
mbed_official 19:112740acecfa 81 /* #define STM32F405xx */ /*!< STM32F405RG, STM32F405VG and STM32F405ZG Devices */
mbed_official 19:112740acecfa 82 /* #define STM32F415xx */ /*!< STM32F415RG, STM32F415VG and STM32F415ZG Devices */
mbed_official 19:112740acecfa 83 /* #define STM32F407xx */ /*!< STM32F407VG, STM32F407VE, STM32F407ZG, STM32F407ZE, STM32F407IG and STM32F407IE Devices */
mbed_official 19:112740acecfa 84 /* #define STM32F417xx */ /*!< STM32F417VG, STM32F417VE, STM32F417ZG, STM32F417ZE, STM32F417IG and STM32F417IE Devices */
mbed_official 19:112740acecfa 85 /* #define STM32F427xx */ /*!< STM32F427VG, STM32F427VI, STM32F427ZG, STM32F427ZI, STM32F427IG and STM32F427II Devices */
mbed_official 19:112740acecfa 86 /* #define STM32F437xx */ /*!< STM32F437VG, STM32F437VI, STM32F437ZG, STM32F437ZI, STM32F437IG and STM32F437II Devices */
mbed_official 19:112740acecfa 87 /* #define STM32F429xx */ /*!< STM32F429VG, STM32F429VI, STM32F429ZG, STM32F429ZI, STM32F429BG, STM32F429BI, STM32F429NG,
mbed_official 19:112740acecfa 88 STM32F439NI, STM32F429IG and STM32F429II Devices */
mbed_official 19:112740acecfa 89 /* #define STM32F439xx */ /*!< STM32F439VG, STM32F439VI, STM32F439ZG, STM32F439ZI, STM32F439BG, STM32F439BI, STM32F439NG,
mbed_official 19:112740acecfa 90 STM32F439NI, STM32F439IG and STM32F439II Devices */
mbed_official 19:112740acecfa 91 /* #define STM32F401xC */ /*!< STM32F401CB, STM32F401CC, STM32F401RB, STM32F401RC, STM32F401VB and STM32F401VC Devices */
mbed_official 19:112740acecfa 92 /* #define STM32F401xE */ /*!< STM32F401CD, STM32F401RD, STM32F401VD, STM32F401CE, STM32F401RE and STM32F401VE Devices */
mbed_official 19:112740acecfa 93 /* #define STM32F410Tx */ /*!< STM32F410T8 and STM32F410TB Devices */
mbed_official 19:112740acecfa 94 /* #define STM32F410Cx */ /*!< STM32F410C8 and STM32F410CB Devices */
mbed_official 19:112740acecfa 95 /* #define STM32F410Rx */ /*!< STM32F410R8 and STM32F410RB Devices */
<> 144:ef7eb2e8f9f7 96 /* #define STM32F411xE */ /*!< STM32F411CC, STM32F411RC, STM32F411VC, STM32F411CE, STM32F411RE and STM32F411VE Devices */
mbed_official 19:112740acecfa 97 /* #define STM32F446xx */ /*!< STM32F446MC, STM32F446ME, STM32F446RC, STM32F446RE, STM32F446VC, STM32F446VE, STM32F446ZC,
mbed_official 19:112740acecfa 98 and STM32F446ZE Devices */
<> 144:ef7eb2e8f9f7 99 #define STM32F469xx /*!< STM32F469AI, STM32F469II, STM32F469BI, STM32F469NI, STM32F469AG, STM32F469IG, STM32F469BG,
mbed_official 19:112740acecfa 100 STM32F469NG, STM32F469AE, STM32F469IE, STM32F469BE and STM32F469NE Devices */
mbed_official 19:112740acecfa 101 /* #define STM32F479xx */ /*!< STM32F479AI, STM32F479II, STM32F479BI, STM32F479NI, STM32F479AG, STM32F479IG, STM32F479BG
mbed_official 19:112740acecfa 102 and STM32F479NG Devices */
<> 144:ef7eb2e8f9f7 103 /* #define STM32F412Cx */ /*!< STM32F412CEU and STM32F412CGU Devices */
<> 144:ef7eb2e8f9f7 104 /* #define STM32F412Zx */ /*!< STM32F412ZET, STM32F412ZGT, STM32F412ZEJ and STM32F412ZGJ Devices */
<> 144:ef7eb2e8f9f7 105 /* #define STM32F412Vx */ /*!< STM32F412VET, STM32F412VGT, STM32F412VEH and STM32F412VGH Devices */
<> 144:ef7eb2e8f9f7 106 /* #define STM32F412Rx */ /*!< STM32F412RET, STM32F412RGT, STM32F412REY and STM32F412RGY Devices */
AnnaBridge 167:e84263d55307 107 /* #define STM32F413xx */ /*!< STM32F413CH, STM32F413MH, STM32F413RH, STM32F413VH, STM32F413ZH, STM32F413CG, STM32F413MG,
AnnaBridge 167:e84263d55307 108 STM32F413RG, STM32F413VG and STM32F413ZG Devices */
AnnaBridge 167:e84263d55307 109 /* #define STM32F423xx */ /*!< STM32F423CH, STM32F423RH, STM32F423VH and STM32F423ZH Devices */
mbed_official 19:112740acecfa 110 #endif
mbed_official 19:112740acecfa 111
mbed_official 19:112740acecfa 112 /* Tip: To avoid modifying this file each time you need to switch between these
mbed_official 19:112740acecfa 113 devices, you can define the device in your toolchain compiler preprocessor.
mbed_official 19:112740acecfa 114 */
mbed_official 19:112740acecfa 115 #if !defined (USE_HAL_DRIVER)
mbed_official 19:112740acecfa 116 /**
mbed_official 19:112740acecfa 117 * @brief Comment the line below if you will not use the peripherals drivers.
mbed_official 19:112740acecfa 118 In this case, these drivers will not be included and the application code will
mbed_official 19:112740acecfa 119 be based on direct access to peripherals registers
mbed_official 19:112740acecfa 120 */
mbed_official 19:112740acecfa 121 #define USE_HAL_DRIVER
mbed_official 19:112740acecfa 122 #endif /* USE_HAL_DRIVER */
mbed_official 19:112740acecfa 123
mbed_official 19:112740acecfa 124 /**
AnnaBridge 182:a56a73fd2a6f 125 * @brief CMSIS version number V2.6.2
mbed_official 19:112740acecfa 126 */
<> 144:ef7eb2e8f9f7 127 #define __STM32F4xx_CMSIS_VERSION_MAIN (0x02U) /*!< [31:24] main version */
AnnaBridge 167:e84263d55307 128 #define __STM32F4xx_CMSIS_VERSION_SUB1 (0x06U) /*!< [23:16] sub1 version */
AnnaBridge 182:a56a73fd2a6f 129 #define __STM32F4xx_CMSIS_VERSION_SUB2 (0x02U) /*!< [15:8] sub2 version */
<> 144:ef7eb2e8f9f7 130 #define __STM32F4xx_CMSIS_VERSION_RC (0x00U) /*!< [7:0] release candidate */
<> 144:ef7eb2e8f9f7 131 #define __STM32F4xx_CMSIS_VERSION ((__STM32F4xx_CMSIS_VERSION_MAIN << 24)\
<> 144:ef7eb2e8f9f7 132 |(__STM32F4xx_CMSIS_VERSION_SUB1 << 16)\
<> 144:ef7eb2e8f9f7 133 |(__STM32F4xx_CMSIS_VERSION_SUB2 << 8 )\
<> 144:ef7eb2e8f9f7 134 |(__STM32F4xx_CMSIS_VERSION))
mbed_official 19:112740acecfa 135
mbed_official 19:112740acecfa 136 /**
mbed_official 19:112740acecfa 137 * @}
mbed_official 19:112740acecfa 138 */
mbed_official 19:112740acecfa 139
mbed_official 19:112740acecfa 140 /** @addtogroup Device_Included
mbed_official 19:112740acecfa 141 * @{
mbed_official 19:112740acecfa 142 */
mbed_official 19:112740acecfa 143
mbed_official 19:112740acecfa 144 #if defined(STM32F405xx)
mbed_official 19:112740acecfa 145 #include "stm32f405xx.h"
mbed_official 19:112740acecfa 146 #elif defined(STM32F415xx)
mbed_official 19:112740acecfa 147 #include "stm32f415xx.h"
mbed_official 19:112740acecfa 148 #elif defined(STM32F407xx)
mbed_official 19:112740acecfa 149 #include "stm32f407xx.h"
mbed_official 19:112740acecfa 150 #elif defined(STM32F417xx)
mbed_official 19:112740acecfa 151 #include "stm32f417xx.h"
mbed_official 19:112740acecfa 152 #elif defined(STM32F427xx)
mbed_official 19:112740acecfa 153 #include "stm32f427xx.h"
mbed_official 19:112740acecfa 154 #elif defined(STM32F437xx)
mbed_official 19:112740acecfa 155 #include "stm32f437xx.h"
mbed_official 19:112740acecfa 156 #elif defined(STM32F429xx)
mbed_official 19:112740acecfa 157 #include "stm32f429xx.h"
mbed_official 19:112740acecfa 158 #elif defined(STM32F439xx)
mbed_official 19:112740acecfa 159 #include "stm32f439xx.h"
mbed_official 19:112740acecfa 160 #elif defined(STM32F401xC)
mbed_official 19:112740acecfa 161 #include "stm32f401xc.h"
mbed_official 19:112740acecfa 162 #elif defined(STM32F401xE)
mbed_official 19:112740acecfa 163 #include "stm32f401xe.h"
mbed_official 19:112740acecfa 164 #elif defined(STM32F410Tx)
mbed_official 19:112740acecfa 165 #include "stm32f410tx.h"
mbed_official 19:112740acecfa 166 #elif defined(STM32F410Cx)
mbed_official 19:112740acecfa 167 #include "stm32f410cx.h"
mbed_official 19:112740acecfa 168 #elif defined(STM32F410Rx)
<> 144:ef7eb2e8f9f7 169 #include "stm32f410rx.h"
mbed_official 19:112740acecfa 170 #elif defined(STM32F411xE)
mbed_official 19:112740acecfa 171 #include "stm32f411xe.h"
mbed_official 19:112740acecfa 172 #elif defined(STM32F446xx)
mbed_official 19:112740acecfa 173 #include "stm32f446xx.h"
mbed_official 19:112740acecfa 174 #elif defined(STM32F469xx)
mbed_official 19:112740acecfa 175 #include "stm32f469xx.h"
mbed_official 19:112740acecfa 176 #elif defined(STM32F479xx)
mbed_official 19:112740acecfa 177 #include "stm32f479xx.h"
<> 144:ef7eb2e8f9f7 178 #elif defined(STM32F412Cx)
<> 144:ef7eb2e8f9f7 179 #include "stm32f412cx.h"
<> 144:ef7eb2e8f9f7 180 #elif defined(STM32F412Zx)
<> 144:ef7eb2e8f9f7 181 #include "stm32f412zx.h"
<> 144:ef7eb2e8f9f7 182 #elif defined(STM32F412Rx)
<> 144:ef7eb2e8f9f7 183 #include "stm32f412rx.h"
<> 144:ef7eb2e8f9f7 184 #elif defined(STM32F412Vx)
<> 144:ef7eb2e8f9f7 185 #include "stm32f412vx.h"
AnnaBridge 167:e84263d55307 186 #elif defined(STM32F413xx)
AnnaBridge 167:e84263d55307 187 #include "stm32f413xx.h"
AnnaBridge 167:e84263d55307 188 #elif defined(STM32F423xx)
AnnaBridge 167:e84263d55307 189 #include "stm32f423xx.h"
mbed_official 19:112740acecfa 190 #else
mbed_official 19:112740acecfa 191 #error "Please select first the target STM32F4xx device used in your application (in stm32f4xx.h file)"
mbed_official 19:112740acecfa 192 #endif
mbed_official 19:112740acecfa 193
mbed_official 19:112740acecfa 194 /**
mbed_official 19:112740acecfa 195 * @}
mbed_official 19:112740acecfa 196 */
mbed_official 19:112740acecfa 197
mbed_official 19:112740acecfa 198 /** @addtogroup Exported_types
mbed_official 19:112740acecfa 199 * @{
mbed_official 19:112740acecfa 200 */
mbed_official 19:112740acecfa 201 typedef enum
mbed_official 19:112740acecfa 202 {
<> 144:ef7eb2e8f9f7 203 RESET = 0U,
mbed_official 19:112740acecfa 204 SET = !RESET
mbed_official 19:112740acecfa 205 } FlagStatus, ITStatus;
mbed_official 19:112740acecfa 206
mbed_official 19:112740acecfa 207 typedef enum
mbed_official 19:112740acecfa 208 {
<> 144:ef7eb2e8f9f7 209 DISABLE = 0U,
mbed_official 19:112740acecfa 210 ENABLE = !DISABLE
mbed_official 19:112740acecfa 211 } FunctionalState;
mbed_official 19:112740acecfa 212 #define IS_FUNCTIONAL_STATE(STATE) (((STATE) == DISABLE) || ((STATE) == ENABLE))
mbed_official 19:112740acecfa 213
mbed_official 19:112740acecfa 214 typedef enum
mbed_official 19:112740acecfa 215 {
<> 144:ef7eb2e8f9f7 216 ERROR = 0U,
mbed_official 19:112740acecfa 217 SUCCESS = !ERROR
mbed_official 19:112740acecfa 218 } ErrorStatus;
mbed_official 19:112740acecfa 219
mbed_official 19:112740acecfa 220 /**
mbed_official 19:112740acecfa 221 * @}
mbed_official 19:112740acecfa 222 */
mbed_official 19:112740acecfa 223
mbed_official 19:112740acecfa 224
mbed_official 19:112740acecfa 225 /** @addtogroup Exported_macro
mbed_official 19:112740acecfa 226 * @{
mbed_official 19:112740acecfa 227 */
mbed_official 19:112740acecfa 228 #define SET_BIT(REG, BIT) ((REG) |= (BIT))
mbed_official 19:112740acecfa 229
mbed_official 19:112740acecfa 230 #define CLEAR_BIT(REG, BIT) ((REG) &= ~(BIT))
mbed_official 19:112740acecfa 231
mbed_official 19:112740acecfa 232 #define READ_BIT(REG, BIT) ((REG) & (BIT))
mbed_official 19:112740acecfa 233
mbed_official 19:112740acecfa 234 #define CLEAR_REG(REG) ((REG) = (0x0))
mbed_official 19:112740acecfa 235
mbed_official 19:112740acecfa 236 #define WRITE_REG(REG, VAL) ((REG) = (VAL))
mbed_official 19:112740acecfa 237
mbed_official 19:112740acecfa 238 #define READ_REG(REG) ((REG))
mbed_official 19:112740acecfa 239
mbed_official 19:112740acecfa 240 #define MODIFY_REG(REG, CLEARMASK, SETMASK) WRITE_REG((REG), (((READ_REG(REG)) & (~(CLEARMASK))) | (SETMASK)))
mbed_official 19:112740acecfa 241
mbed_official 19:112740acecfa 242 #define POSITION_VAL(VAL) (__CLZ(__RBIT(VAL)))
mbed_official 19:112740acecfa 243
mbed_official 19:112740acecfa 244
mbed_official 19:112740acecfa 245 /**
mbed_official 19:112740acecfa 246 * @}
mbed_official 19:112740acecfa 247 */
mbed_official 19:112740acecfa 248
mbed_official 19:112740acecfa 249 #if defined (USE_HAL_DRIVER)
mbed_official 19:112740acecfa 250 #include "stm32f4xx_hal.h"
mbed_official 19:112740acecfa 251 #endif /* USE_HAL_DRIVER */
mbed_official 19:112740acecfa 252
mbed_official 19:112740acecfa 253 #ifdef __cplusplus
mbed_official 19:112740acecfa 254 }
mbed_official 19:112740acecfa 255 #endif /* __cplusplus */
mbed_official 19:112740acecfa 256
mbed_official 19:112740acecfa 257 #endif /* __STM32F4xx_H */
mbed_official 19:112740acecfa 258 /**
mbed_official 19:112740acecfa 259 * @}
mbed_official 19:112740acecfa 260 */
mbed_official 19:112740acecfa 261
mbed_official 19:112740acecfa 262 /**
mbed_official 19:112740acecfa 263 * @}
mbed_official 19:112740acecfa 264 */
mbed_official 19:112740acecfa 265
mbed_official 19:112740acecfa 266
mbed_official 19:112740acecfa 267
mbed_official 19:112740acecfa 268
mbed_official 19:112740acecfa 269 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/