mbed(SerialHalfDuplex入り)

Fork of mbed by mbed official

Committer:
yusuke_kyo
Date:
Wed Apr 08 08:04:18 2015 +0000
Revision:
98:01a414ca7d6d
Parent:
92:4fc01daae5a5
remove SerialHalfDuplex.h

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bogdanm 86:04dd9b1680ae 1 /**
bogdanm 86:04dd9b1680ae 2 ******************************************************************************
bogdanm 86:04dd9b1680ae 3 * @file stm32f3xx.h
bogdanm 86:04dd9b1680ae 4 * @author MCD Application Team
bogdanm 92:4fc01daae5a5 5 * @version V2.1.0
bogdanm 92:4fc01daae5a5 6 * @date 12-Sept-2014
bogdanm 86:04dd9b1680ae 7 * @brief CMSIS STM32F3xx 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 STM32F3xx 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 stm32f3xx
bogdanm 86:04dd9b1680ae 53 * @{
bogdanm 86:04dd9b1680ae 54 */
bogdanm 86:04dd9b1680ae 55
bogdanm 86:04dd9b1680ae 56 #ifndef __STM32F3xx_H
bogdanm 86:04dd9b1680ae 57 #define __STM32F3xx_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
bogdanm 92:4fc01daae5a5 71 #if !defined (STM32F301x8) && !defined (STM32F302x8) && !defined (STM32F318xx) && \
bogdanm 92:4fc01daae5a5 72 !defined (STM32F302xC) && !defined (STM32F303xC) && !defined (STM32F358xx) && \
bogdanm 92:4fc01daae5a5 73 !defined (STM32F303x8) && !defined (STM32F334x8) && !defined (STM32F328xx) && \
bogdanm 92:4fc01daae5a5 74 !defined (STM32F302xE) && !defined (STM32F303xE) && !defined (STM32F398xx) && \
bogdanm 92:4fc01daae5a5 75 !defined (STM32F373xC) && !defined (STM32F378xx)
bogdanm 92:4fc01daae5a5 76
bogdanm 86:04dd9b1680ae 77 /* #define STM32F301x8 */ /*!< STM32F301K6, STM32F301K8, STM32F301C6, STM32F301C8,
bogdanm 86:04dd9b1680ae 78 STM32F301R6 and STM32F301R8 Devices */
bogdanm 86:04dd9b1680ae 79 /* #define STM32F302x8 */ /*!< STM32F302K6, STM32F302K8, STM32F302C6, STM32F302C8,
bogdanm 86:04dd9b1680ae 80 STM32F302R6 and STM32F302R8 Devices */
bogdanm 86:04dd9b1680ae 81 /* #define STM32F302xC */ /*!< STM32F302CB, STM32F302CC, STM32F302RB, STM32F302RC, STM32F302VB and STM32F302VC Devices */
bogdanm 92:4fc01daae5a5 82 /* #define STM32F302xE */ /*!< STM32F302CE, STM32F302RE, and STM32F302VE Devices */
bogdanm 86:04dd9b1680ae 83 /* #define STM32F303x8 */ /*!< STM32F303K6, STM32F303K8, STM32F303C6, STM32F303C8,
bogdanm 86:04dd9b1680ae 84 STM32F303R6 and STM32F303R8 Devices */
bogdanm 86:04dd9b1680ae 85 /* #define STM32F303xC */ /*!< STM32F303CB, STM32F303CC, STM32F303RB, STM32F303RC, STM32F303VB and STM32F303VC Devices */
bogdanm 92:4fc01daae5a5 86 /* #define STM32F303xE */ /*!< STM32F303RE, STM32F303VE and STM32F303ZE Devices */
bogdanm 86:04dd9b1680ae 87 /* #define STM32F373xC */ /*!< STM32F373C8, STM32F373CB, STM32F373CC, STM32F373R8, STM32F373RB, STM32F373RC,
bogdanm 86:04dd9b1680ae 88 STM32F373V8, STM32F373VB and STM32F373VC Devices */
bogdanm 86:04dd9b1680ae 89 #define STM32F334x8 /*!< STM32F334C4, STM32F334C6, STM32F334C8, STM32F334R4, STM32F334R6 and STM32F334R8 Devices */
bogdanm 86:04dd9b1680ae 90 /* #define STM32F318xx */ /*!< STM32F318K8, STM32F318C8: STM32F301x8 with regulator off: STM32F318xx Devices */
bogdanm 86:04dd9b1680ae 91 /* #define STM32F328xx */ /*!< STM32F328C8, STM32F328R8: STM32F334x8 with regulator off: STM32F328xx Devices */
bogdanm 86:04dd9b1680ae 92 /* #define STM32F358xx */ /*!< STM32F358CC, STM32F358RC, STM32F358VC: STM32F303xC with regulator off: STM32F358xx Devices */
bogdanm 86:04dd9b1680ae 93 /* #define STM32F378xx */ /*!< STM32F378CC, STM32F378RC, STM32F378VC: STM32F373xC with regulator off: STM32F378xx Devices */
bogdanm 92:4fc01daae5a5 94 /* #define STM32F398xx */ /*!< STM32F398CE, STM32F398RE, STM32F398VE: STM32F303xE with regulator off: STM32F398xx Devices */
bogdanm 86:04dd9b1680ae 95 #endif
bogdanm 86:04dd9b1680ae 96
bogdanm 86:04dd9b1680ae 97 /* Tip: To avoid modifying this file each time you need to switch between these
bogdanm 86:04dd9b1680ae 98 devices, you can define the device in your toolchain compiler preprocessor.
bogdanm 86:04dd9b1680ae 99 */
bogdanm 86:04dd9b1680ae 100 #if !defined (USE_HAL_DRIVER)
bogdanm 86:04dd9b1680ae 101 /**
bogdanm 86:04dd9b1680ae 102 * @brief Comment the line below if you will not use the peripherals drivers.
bogdanm 86:04dd9b1680ae 103 In this case, these drivers will not be included and the application code will
bogdanm 86:04dd9b1680ae 104 be based on direct access to peripherals registers
bogdanm 86:04dd9b1680ae 105 */
bogdanm 86:04dd9b1680ae 106 #define USE_HAL_DRIVER
bogdanm 86:04dd9b1680ae 107 #endif /* USE_HAL_DRIVER */
bogdanm 86:04dd9b1680ae 108
bogdanm 86:04dd9b1680ae 109 /**
bogdanm 92:4fc01daae5a5 110 * @brief CMSIS Device version number V2.1.0
bogdanm 86:04dd9b1680ae 111 */
bogdanm 86:04dd9b1680ae 112 #define __STM32F3xx_CMSIS_DEVICE_VERSION_MAIN (0x02) /*!< [31:24] main version */
bogdanm 92:4fc01daae5a5 113 #define __STM32F3xx_CMSIS_DEVICE_VERSION_SUB1 (0x01) /*!< [23:16] sub1 version */
bogdanm 92:4fc01daae5a5 114 #define __STM32F3xx_CMSIS_DEVICE_VERSION_SUB2 (0x00) /*!< [15:8] sub2 version */
bogdanm 86:04dd9b1680ae 115 #define __STM32F3xx_CMSIS_DEVICE_VERSION_RC (0x00) /*!< [7:0] release candidate */
bogdanm 86:04dd9b1680ae 116 #define __STM32F3xx_CMSIS_DEVICE_VERSION ((__CMSIS_DEVICE_VERSION_MAIN << 24)\
bogdanm 86:04dd9b1680ae 117 |(__CMSIS_DEVICE_HAL_VERSION_SUB1 << 16)\
bogdanm 86:04dd9b1680ae 118 |(__CMSIS_DEVICE_HAL_VERSION_SUB2 << 8 )\
bogdanm 86:04dd9b1680ae 119 |(__CMSIS_DEVICE_HAL_VERSION_RC))
bogdanm 86:04dd9b1680ae 120
bogdanm 86:04dd9b1680ae 121 /**
bogdanm 86:04dd9b1680ae 122 * @}
bogdanm 86:04dd9b1680ae 123 */
bogdanm 86:04dd9b1680ae 124
bogdanm 86:04dd9b1680ae 125 /** @addtogroup Device_Included
bogdanm 86:04dd9b1680ae 126 * @{
bogdanm 86:04dd9b1680ae 127 */
bogdanm 86:04dd9b1680ae 128
bogdanm 86:04dd9b1680ae 129 #if defined(STM32F301x8)
bogdanm 86:04dd9b1680ae 130 #include "stm32f301x8.h"
bogdanm 86:04dd9b1680ae 131 #elif defined(STM32F302x8)
bogdanm 86:04dd9b1680ae 132 #include "stm32f302x8.h"
bogdanm 86:04dd9b1680ae 133 #elif defined(STM32F302xC)
bogdanm 86:04dd9b1680ae 134 #include "stm32f302xc.h"
bogdanm 92:4fc01daae5a5 135 #elif defined(STM32F302xE)
bogdanm 92:4fc01daae5a5 136 #include "stm32f302xe.h"
bogdanm 86:04dd9b1680ae 137 #elif defined(STM32F303x8)
bogdanm 86:04dd9b1680ae 138 #include "stm32f303x8.h"
bogdanm 86:04dd9b1680ae 139 #elif defined(STM32F303xC)
bogdanm 86:04dd9b1680ae 140 #include "stm32f303xc.h"
bogdanm 92:4fc01daae5a5 141 #elif defined(STM32F303xE)
bogdanm 92:4fc01daae5a5 142 #include "stm32f303xe.h"
bogdanm 86:04dd9b1680ae 143 #elif defined(STM32F373xC)
bogdanm 86:04dd9b1680ae 144 #include "stm32f373xc.h"
bogdanm 86:04dd9b1680ae 145 #elif defined(STM32F334x8)
bogdanm 86:04dd9b1680ae 146 #include "stm32f334x8.h"
bogdanm 86:04dd9b1680ae 147 #elif defined(STM32F318xx)
bogdanm 86:04dd9b1680ae 148 #include "stm32f318xx.h"
bogdanm 86:04dd9b1680ae 149 #elif defined(STM32F328xx)
bogdanm 86:04dd9b1680ae 150 #include "stm32f328xx.h"
bogdanm 86:04dd9b1680ae 151 #elif defined(STM32F358xx)
bogdanm 86:04dd9b1680ae 152 #include "stm32f358xx.h"
bogdanm 86:04dd9b1680ae 153 #elif defined(STM32F378xx)
bogdanm 86:04dd9b1680ae 154 #include "stm32f378xx.h"
bogdanm 92:4fc01daae5a5 155 #elif defined(STM32F398xx)
bogdanm 92:4fc01daae5a5 156 #include "stm32f398xx.h"
bogdanm 86:04dd9b1680ae 157 #else
bogdanm 86:04dd9b1680ae 158 #error "Please select first the target STM32F3xx device used in your application (in stm32f3xx.h file)"
bogdanm 86:04dd9b1680ae 159 #endif
bogdanm 86:04dd9b1680ae 160
bogdanm 86:04dd9b1680ae 161 /**
bogdanm 86:04dd9b1680ae 162 * @}
bogdanm 86:04dd9b1680ae 163 */
bogdanm 86:04dd9b1680ae 164
bogdanm 86:04dd9b1680ae 165 /** @addtogroup Exported_types
bogdanm 86:04dd9b1680ae 166 * @{
bogdanm 86:04dd9b1680ae 167 */
bogdanm 86:04dd9b1680ae 168 typedef enum
bogdanm 86:04dd9b1680ae 169 {
bogdanm 86:04dd9b1680ae 170 RESET = 0,
bogdanm 86:04dd9b1680ae 171 SET = !RESET
bogdanm 86:04dd9b1680ae 172 } FlagStatus, ITStatus;
bogdanm 86:04dd9b1680ae 173
bogdanm 86:04dd9b1680ae 174 typedef enum
bogdanm 86:04dd9b1680ae 175 {
bogdanm 86:04dd9b1680ae 176 DISABLE = 0,
bogdanm 86:04dd9b1680ae 177 ENABLE = !DISABLE
bogdanm 86:04dd9b1680ae 178 } FunctionalState;
bogdanm 86:04dd9b1680ae 179 #define IS_FUNCTIONAL_STATE(STATE) (((STATE) == DISABLE) || ((STATE) == ENABLE))
bogdanm 86:04dd9b1680ae 180
bogdanm 86:04dd9b1680ae 181 typedef enum
bogdanm 86:04dd9b1680ae 182 {
bogdanm 86:04dd9b1680ae 183 ERROR = 0,
bogdanm 86:04dd9b1680ae 184 SUCCESS = !ERROR
bogdanm 86:04dd9b1680ae 185 } ErrorStatus;
bogdanm 86:04dd9b1680ae 186
bogdanm 86:04dd9b1680ae 187 /**
bogdanm 86:04dd9b1680ae 188 * @}
bogdanm 86:04dd9b1680ae 189 */
bogdanm 86:04dd9b1680ae 190
bogdanm 86:04dd9b1680ae 191
bogdanm 86:04dd9b1680ae 192 /** @addtogroup Exported_macros
bogdanm 86:04dd9b1680ae 193 * @{
bogdanm 86:04dd9b1680ae 194 */
bogdanm 86:04dd9b1680ae 195 #define SET_BIT(REG, BIT) ((REG) |= (BIT))
bogdanm 86:04dd9b1680ae 196
bogdanm 86:04dd9b1680ae 197 #define CLEAR_BIT(REG, BIT) ((REG) &= ~(BIT))
bogdanm 86:04dd9b1680ae 198
bogdanm 86:04dd9b1680ae 199 #define READ_BIT(REG, BIT) ((REG) & (BIT))
bogdanm 86:04dd9b1680ae 200
bogdanm 86:04dd9b1680ae 201 #define CLEAR_REG(REG) ((REG) = (0x0))
bogdanm 86:04dd9b1680ae 202
bogdanm 86:04dd9b1680ae 203 #define WRITE_REG(REG, VAL) ((REG) = (VAL))
bogdanm 86:04dd9b1680ae 204
bogdanm 86:04dd9b1680ae 205 #define READ_REG(REG) ((REG))
bogdanm 86:04dd9b1680ae 206
bogdanm 86:04dd9b1680ae 207 #define MODIFY_REG(REG, CLEARMASK, SETMASK) WRITE_REG((REG), (((READ_REG(REG)) & (~(CLEARMASK))) | (SETMASK)))
bogdanm 86:04dd9b1680ae 208
bogdanm 86:04dd9b1680ae 209 #define POSITION_VAL(VAL) (__CLZ(__RBIT(VAL)))
bogdanm 86:04dd9b1680ae 210
bogdanm 86:04dd9b1680ae 211
bogdanm 86:04dd9b1680ae 212 #if defined (USE_HAL_DRIVER)
bogdanm 86:04dd9b1680ae 213 #include "stm32f3xx_hal.h"
bogdanm 86:04dd9b1680ae 214 #endif /* USE_HAL_DRIVER */
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
bogdanm 86:04dd9b1680ae 222 #ifdef __cplusplus
bogdanm 86:04dd9b1680ae 223 }
bogdanm 86:04dd9b1680ae 224 #endif /* __cplusplus */
bogdanm 86:04dd9b1680ae 225
bogdanm 86:04dd9b1680ae 226 #endif /* __STM32F3xx_H */
bogdanm 86:04dd9b1680ae 227 /**
bogdanm 86:04dd9b1680ae 228 * @}
bogdanm 86:04dd9b1680ae 229 */
bogdanm 86:04dd9b1680ae 230
bogdanm 86:04dd9b1680ae 231 /**
bogdanm 86:04dd9b1680ae 232 * @}
bogdanm 86:04dd9b1680ae 233 */
bogdanm 86:04dd9b1680ae 234
bogdanm 86:04dd9b1680ae 235
bogdanm 86:04dd9b1680ae 236
bogdanm 86:04dd9b1680ae 237
bogdanm 86:04dd9b1680ae 238 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/