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

Fork of mbed by mbed official

Committer:
bogdanm
Date:
Mon Apr 28 17:39:05 2014 +0100
Revision:
83:8a40adfe8776
Parent:
81:7d30d6019079
Child:
85:024bf7f99721
Release 83 of the mbed library

Main changes:

- updated tests
- K64F TCP/IP support
- lots of fixes in various targets

Who changed what in which revision?

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