mbed(SerialHalfDuplex入り)

Fork of mbed by mbed official

Committer:
bogdanm
Date:
Fri Sep 12 16:41:52 2014 +0100
Revision:
89:552587b429a1
Release 89 of the mbed library

Main changes:

- low power optimizations for Nordic targets
- code structure changes for Freescale K64F targets
- bug fixes in various backends

Who changed what in which revision?

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