mbed library sources

Dependents:   FRDM-KL46Z_LCD_Test FRDM-KL46Z_LCD_Test FRDM-KL46Z_Plantilla FRDM-KL46Z_Plantilla ... more

Committer:
ebrus
Date:
Thu Jul 28 15:56:34 2016 +0000
Revision:
0:6bc4ac881c8e
1;

Who changed what in which revision?

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