The official mbed C/C SDK provides the software platform and libraries to build your applications.

Fork of mbed by mbed official

Committer:
Mikchel
Date:
Sun May 03 16:04:42 2015 +0000
Revision:
99:7f6c6de930c0
Parent:
92:4fc01daae5a5
12

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bogdanm 86:04dd9b1680ae 1 /**
bogdanm 86:04dd9b1680ae 2 ******************************************************************************
bogdanm 86:04dd9b1680ae 3 * @file stm32f4xx.h
bogdanm 86:04dd9b1680ae 4 * @author MCD Application Team
bogdanm 86:04dd9b1680ae 5 * @version V2.1.0
bogdanm 86:04dd9b1680ae 6 * @date 19-June-2014
bogdanm 86:04dd9b1680ae 7 * @brief CMSIS STM32F4xx Device Peripheral Access Layer Header File.
bogdanm 86:04dd9b1680ae 8 *
bogdanm 86:04dd9b1680ae 9 * The file is the unique include file that the application programmer
bogdanm 86:04dd9b1680ae 10 * is using in the C source code, usually in main.c. This file contains:
bogdanm 86:04dd9b1680ae 11 * - Configuration section that allows to select:
bogdanm 86:04dd9b1680ae 12 * - The STM32F4xx device used in the target application
bogdanm 86:04dd9b1680ae 13 * - To use or not the peripheral’s drivers in application code(i.e.
bogdanm 86:04dd9b1680ae 14 * code will be based on direct access to peripheral’s registers
bogdanm 86:04dd9b1680ae 15 * rather than drivers API), this option is controlled by
bogdanm 86:04dd9b1680ae 16 * "#define USE_HAL_DRIVER"
bogdanm 86:04dd9b1680ae 17 *
bogdanm 86:04dd9b1680ae 18 ******************************************************************************
bogdanm 86:04dd9b1680ae 19 * @attention
bogdanm 86:04dd9b1680ae 20 *
bogdanm 86:04dd9b1680ae 21 * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
bogdanm 86:04dd9b1680ae 22 *
bogdanm 86:04dd9b1680ae 23 * Redistribution and use in source and binary forms, with or without modification,
bogdanm 86:04dd9b1680ae 24 * are permitted provided that the following conditions are met:
bogdanm 86:04dd9b1680ae 25 * 1. Redistributions of source code must retain the above copyright notice,
bogdanm 86:04dd9b1680ae 26 * this list of conditions and the following disclaimer.
bogdanm 86:04dd9b1680ae 27 * 2. Redistributions in binary form must reproduce the above copyright notice,
bogdanm 86:04dd9b1680ae 28 * this list of conditions and the following disclaimer in the documentation
bogdanm 86:04dd9b1680ae 29 * and/or other materials provided with the distribution.
bogdanm 86:04dd9b1680ae 30 * 3. Neither the name of STMicroelectronics nor the names of its contributors
bogdanm 86:04dd9b1680ae 31 * may be used to endorse or promote products derived from this software
bogdanm 86:04dd9b1680ae 32 * without specific prior written permission.
bogdanm 86:04dd9b1680ae 33 *
bogdanm 86:04dd9b1680ae 34 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
bogdanm 86:04dd9b1680ae 35 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
bogdanm 86:04dd9b1680ae 36 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
bogdanm 86:04dd9b1680ae 37 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
bogdanm 86:04dd9b1680ae 38 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
bogdanm 86:04dd9b1680ae 39 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
bogdanm 86:04dd9b1680ae 40 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
bogdanm 86:04dd9b1680ae 41 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
bogdanm 86:04dd9b1680ae 42 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
bogdanm 86:04dd9b1680ae 43 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
bogdanm 86:04dd9b1680ae 44 *
bogdanm 86:04dd9b1680ae 45 ******************************************************************************
bogdanm 86:04dd9b1680ae 46 */
bogdanm 86:04dd9b1680ae 47
bogdanm 86:04dd9b1680ae 48 /** @addtogroup CMSIS
bogdanm 86:04dd9b1680ae 49 * @{
bogdanm 86:04dd9b1680ae 50 */
bogdanm 86:04dd9b1680ae 51
bogdanm 86:04dd9b1680ae 52 /** @addtogroup stm32f4xx
bogdanm 86:04dd9b1680ae 53 * @{
bogdanm 86:04dd9b1680ae 54 */
bogdanm 86:04dd9b1680ae 55
bogdanm 86:04dd9b1680ae 56 #ifndef __STM32F4xx_H
bogdanm 86:04dd9b1680ae 57 #define __STM32F4xx_H
bogdanm 86:04dd9b1680ae 58
bogdanm 86:04dd9b1680ae 59 #ifdef __cplusplus
bogdanm 86:04dd9b1680ae 60 extern "C" {
bogdanm 86:04dd9b1680ae 61 #endif /* __cplusplus */
bogdanm 86:04dd9b1680ae 62
bogdanm 86:04dd9b1680ae 63 /** @addtogroup Library_configuration_section
bogdanm 86:04dd9b1680ae 64 * @{
bogdanm 86:04dd9b1680ae 65 */
bogdanm 86:04dd9b1680ae 66
bogdanm 86:04dd9b1680ae 67 /* Uncomment the line below according to the target STM32 device used in your
bogdanm 86:04dd9b1680ae 68 application
bogdanm 86:04dd9b1680ae 69 */
bogdanm 86:04dd9b1680ae 70 #if !defined (STM32F405xx) && !defined (STM32F415xx) && !defined (STM32F407xx) && !defined (STM32F417xx) && \
bogdanm 86:04dd9b1680ae 71 !defined (STM32F427xx) && !defined (STM32F437xx) && !defined (STM32F429xx) && !defined (STM32F439xx) && \
bogdanm 86:04dd9b1680ae 72 !defined (STM32F401xC) && !defined (STM32F401xE) && !defined (STM32F411xE)
bogdanm 86:04dd9b1680ae 73 /* #define STM32F405xx */ /*!< STM32F405RG, STM32F405VG and STM32F405ZG Devices */
bogdanm 86:04dd9b1680ae 74 /* #define STM32F415xx */ /*!< STM32F415RG, STM32F415VG and STM32F415ZG Devices */
bogdanm 86:04dd9b1680ae 75 /* #define STM32F407xx */ /*!< STM32F407VG, STM32F407VE, STM32F407ZG, STM32F407ZE, STM32F407IG and STM32F407IE Devices */
bogdanm 86:04dd9b1680ae 76 /* #define STM32F417xx */ /*!< STM32F417VG, STM32F417VE, STM32F417ZG, STM32F417ZE, STM32F417IG and STM32F417IE Devices */
bogdanm 86:04dd9b1680ae 77 /* #define STM32F427xx */ /*!< STM32F427VG, STM32F427VI, STM32F427ZG, STM32F427ZI, STM32F427IG and STM32F427II Devices */
bogdanm 86:04dd9b1680ae 78 /* #define STM32F437xx */ /*!< STM32F437VG, STM32F437VI, STM32F437ZG, STM32F437ZI, STM32F437IG and STM32F437II Devices */
bogdanm 86:04dd9b1680ae 79 /* #define STM32F429xx */ /*!< STM32F429VG, STM32F429VI, STM32F429ZG, STM32F429ZI, STM32F429BG, STM32F429BI, STM32F429NG,
bogdanm 86:04dd9b1680ae 80 STM32F439NI, STM32F429IG and STM32F429II Devices */
bogdanm 86:04dd9b1680ae 81 /* #define STM32F439xx */ /*!< STM32F439VG, STM32F439VI, STM32F439ZG, STM32F439ZI, STM32F439BG, STM32F439BI, STM32F439NG,
bogdanm 86:04dd9b1680ae 82 STM32F439NI, STM32F439IG and STM32F439II Devices */
bogdanm 86:04dd9b1680ae 83 /* #define STM32F401xC */ /*!< STM32F401CB, STM32F401CC, STM32F401RB, STM32F401RC, STM32F401VB and STM32F401VC Devices */
bogdanm 86:04dd9b1680ae 84 /* #define STM32F401xE */ /*!< STM32F401CD, STM32F401RD, STM32F401VD, STM32F401CE, STM32F401RE and STM32F401VE Devices */
bogdanm 86:04dd9b1680ae 85 #define STM32F411xE /*!< STM32F411CD, STM32F411RD, STM32F411VD, STM32F411CE, STM32F411RE and STM32F411VE Devices */
bogdanm 86:04dd9b1680ae 86 #endif
bogdanm 86:04dd9b1680ae 87
bogdanm 86:04dd9b1680ae 88 /* Tip: To avoid modifying this file each time you need to switch between these
bogdanm 86:04dd9b1680ae 89 devices, you can define the device in your toolchain compiler preprocessor.
bogdanm 86:04dd9b1680ae 90 */
bogdanm 86:04dd9b1680ae 91 #if !defined (USE_HAL_DRIVER)
bogdanm 86:04dd9b1680ae 92 /**
bogdanm 86:04dd9b1680ae 93 * @brief Comment the line below if you will not use the peripherals drivers.
bogdanm 86:04dd9b1680ae 94 In this case, these drivers will not be included and the application code will
bogdanm 86:04dd9b1680ae 95 be based on direct access to peripherals registers
bogdanm 86:04dd9b1680ae 96 */
bogdanm 86:04dd9b1680ae 97 #define USE_HAL_DRIVER
bogdanm 86:04dd9b1680ae 98 #endif /* USE_HAL_DRIVER */
bogdanm 86:04dd9b1680ae 99
bogdanm 86:04dd9b1680ae 100 /**
bogdanm 86:04dd9b1680ae 101 * @brief CMSIS Device version number V2.1.0
bogdanm 86:04dd9b1680ae 102 */
bogdanm 86:04dd9b1680ae 103 #define __STM32F4xx_CMSIS_DEVICE_VERSION_MAIN (0x02) /*!< [31:24] main version */
bogdanm 86:04dd9b1680ae 104 #define __STM32F4xx_CMSIS_DEVICE_VERSION_SUB1 (0x01) /*!< [23:16] sub1 version */
bogdanm 86:04dd9b1680ae 105 #define __STM32F4xx_CMSIS_DEVICE_VERSION_SUB2 (0x00) /*!< [15:8] sub2 version */
bogdanm 86:04dd9b1680ae 106 #define __STM32F4xx_CMSIS_DEVICE_VERSION_RC (0x00) /*!< [7:0] release candidate */
bogdanm 86:04dd9b1680ae 107 #define __STM32F4xx_CMSIS_DEVICE_VERSION ((__STM32F4xx_CMSIS_DEVICE_VERSION_MAIN << 24)\
bogdanm 86:04dd9b1680ae 108 |(__STM32F4xx_CMSIS_DEVICE_VERSION_SUB1 << 16)\
bogdanm 86:04dd9b1680ae 109 |(__STM32F4xx_CMSIS_DEVICE_VERSION_SUB2 << 8 )\
bogdanm 86:04dd9b1680ae 110 |(__STM32F4xx_CMSIS_DEVICE_VERSION))
bogdanm 86:04dd9b1680ae 111
bogdanm 86:04dd9b1680ae 112 /**
bogdanm 86:04dd9b1680ae 113 * @}
bogdanm 86:04dd9b1680ae 114 */
bogdanm 86:04dd9b1680ae 115
bogdanm 86:04dd9b1680ae 116 /** @addtogroup Device_Included
bogdanm 86:04dd9b1680ae 117 * @{
bogdanm 86:04dd9b1680ae 118 */
bogdanm 86:04dd9b1680ae 119
bogdanm 86:04dd9b1680ae 120 #if defined(STM32F405xx)
bogdanm 86:04dd9b1680ae 121 #include "stm32f405xx.h"
bogdanm 86:04dd9b1680ae 122 #elif defined(STM32F415xx)
bogdanm 86:04dd9b1680ae 123 #include "stm32f415xx.h"
bogdanm 86:04dd9b1680ae 124 #elif defined(STM32F407xx)
bogdanm 86:04dd9b1680ae 125 #include "stm32f407xx.h"
bogdanm 86:04dd9b1680ae 126 #elif defined(STM32F417xx)
bogdanm 86:04dd9b1680ae 127 #include "stm32f417xx.h"
bogdanm 86:04dd9b1680ae 128 #elif defined(STM32F427xx)
bogdanm 86:04dd9b1680ae 129 #include "stm32f427xx.h"
bogdanm 86:04dd9b1680ae 130 #elif defined(STM32F437xx)
bogdanm 86:04dd9b1680ae 131 #include "stm32f437xx.h"
bogdanm 86:04dd9b1680ae 132 #elif defined(STM32F429xx)
bogdanm 86:04dd9b1680ae 133 #include "stm32f429xx.h"
bogdanm 86:04dd9b1680ae 134 #elif defined(STM32F439xx)
bogdanm 86:04dd9b1680ae 135 #include "stm32f439xx.h"
bogdanm 86:04dd9b1680ae 136 #elif defined(STM32F401xC)
bogdanm 86:04dd9b1680ae 137 #include "stm32f401xc.h"
bogdanm 86:04dd9b1680ae 138 #elif defined(STM32F401xE)
bogdanm 86:04dd9b1680ae 139 #include "stm32f401xe.h"
bogdanm 86:04dd9b1680ae 140 #elif defined(STM32F411xE)
bogdanm 86:04dd9b1680ae 141 #include "stm32f411xe.h"
bogdanm 86:04dd9b1680ae 142 #else
bogdanm 86:04dd9b1680ae 143 #error "Please select first the target STM32F4xx device used in your application (in stm32f4xx.h file)"
bogdanm 86:04dd9b1680ae 144 #endif
bogdanm 86:04dd9b1680ae 145
bogdanm 86:04dd9b1680ae 146 /**
bogdanm 86:04dd9b1680ae 147 * @}
bogdanm 86:04dd9b1680ae 148 */
bogdanm 86:04dd9b1680ae 149
bogdanm 86:04dd9b1680ae 150 /** @addtogroup Exported_types
bogdanm 86:04dd9b1680ae 151 * @{
bogdanm 86:04dd9b1680ae 152 */
bogdanm 86:04dd9b1680ae 153 typedef enum
bogdanm 86:04dd9b1680ae 154 {
bogdanm 86:04dd9b1680ae 155 RESET = 0,
bogdanm 86:04dd9b1680ae 156 SET = !RESET
bogdanm 86:04dd9b1680ae 157 } FlagStatus, ITStatus;
bogdanm 86:04dd9b1680ae 158
bogdanm 86:04dd9b1680ae 159 typedef enum
bogdanm 86:04dd9b1680ae 160 {
bogdanm 86:04dd9b1680ae 161 DISABLE = 0,
bogdanm 86:04dd9b1680ae 162 ENABLE = !DISABLE
bogdanm 86:04dd9b1680ae 163 } FunctionalState;
bogdanm 86:04dd9b1680ae 164 #define IS_FUNCTIONAL_STATE(STATE) (((STATE) == DISABLE) || ((STATE) == ENABLE))
bogdanm 86:04dd9b1680ae 165
bogdanm 86:04dd9b1680ae 166 typedef enum
bogdanm 86:04dd9b1680ae 167 {
bogdanm 86:04dd9b1680ae 168 ERROR = 0,
bogdanm 86:04dd9b1680ae 169 SUCCESS = !ERROR
bogdanm 86:04dd9b1680ae 170 } ErrorStatus;
bogdanm 86:04dd9b1680ae 171
bogdanm 86:04dd9b1680ae 172 /**
bogdanm 86:04dd9b1680ae 173 * @}
bogdanm 86:04dd9b1680ae 174 */
bogdanm 86:04dd9b1680ae 175
bogdanm 86:04dd9b1680ae 176
bogdanm 86:04dd9b1680ae 177 /** @addtogroup Exported_macro
bogdanm 86:04dd9b1680ae 178 * @{
bogdanm 86:04dd9b1680ae 179 */
bogdanm 86:04dd9b1680ae 180 #define SET_BIT(REG, BIT) ((REG) |= (BIT))
bogdanm 86:04dd9b1680ae 181
bogdanm 86:04dd9b1680ae 182 #define CLEAR_BIT(REG, BIT) ((REG) &= ~(BIT))
bogdanm 86:04dd9b1680ae 183
bogdanm 86:04dd9b1680ae 184 #define READ_BIT(REG, BIT) ((REG) & (BIT))
bogdanm 86:04dd9b1680ae 185
bogdanm 86:04dd9b1680ae 186 #define CLEAR_REG(REG) ((REG) = (0x0))
bogdanm 86:04dd9b1680ae 187
bogdanm 86:04dd9b1680ae 188 #define WRITE_REG(REG, VAL) ((REG) = (VAL))
bogdanm 86:04dd9b1680ae 189
bogdanm 86:04dd9b1680ae 190 #define READ_REG(REG) ((REG))
bogdanm 86:04dd9b1680ae 191
bogdanm 86:04dd9b1680ae 192 #define MODIFY_REG(REG, CLEARMASK, SETMASK) WRITE_REG((REG), (((READ_REG(REG)) & (~(CLEARMASK))) | (SETMASK)))
bogdanm 86:04dd9b1680ae 193
bogdanm 86:04dd9b1680ae 194 #define POSITION_VAL(VAL) (__CLZ(__RBIT(VAL)))
bogdanm 86:04dd9b1680ae 195
bogdanm 86:04dd9b1680ae 196
bogdanm 86:04dd9b1680ae 197 /**
bogdanm 86:04dd9b1680ae 198 * @}
bogdanm 86:04dd9b1680ae 199 */
bogdanm 86:04dd9b1680ae 200
bogdanm 86:04dd9b1680ae 201 #if defined (USE_HAL_DRIVER)
bogdanm 86:04dd9b1680ae 202 #include "stm32f4xx_hal.h"
bogdanm 86:04dd9b1680ae 203 #endif /* USE_HAL_DRIVER */
bogdanm 86:04dd9b1680ae 204
bogdanm 86:04dd9b1680ae 205 #ifdef __cplusplus
bogdanm 86:04dd9b1680ae 206 }
bogdanm 86:04dd9b1680ae 207 #endif /* __cplusplus */
bogdanm 86:04dd9b1680ae 208
bogdanm 86:04dd9b1680ae 209 #endif /* __STM32F4xx_H */
bogdanm 86:04dd9b1680ae 210 /**
bogdanm 86:04dd9b1680ae 211 * @}
bogdanm 86:04dd9b1680ae 212 */
bogdanm 86:04dd9b1680ae 213
bogdanm 86:04dd9b1680ae 214 /**
bogdanm 86:04dd9b1680ae 215 * @}
bogdanm 86:04dd9b1680ae 216 */
bogdanm 86:04dd9b1680ae 217
bogdanm 86:04dd9b1680ae 218
bogdanm 86:04dd9b1680ae 219
bogdanm 86:04dd9b1680ae 220
bogdanm 86:04dd9b1680ae 221 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/