mbed(SerialHalfDuplex入り)

Fork of mbed by mbed official

Committer:
Kojto
Date:
Tue Mar 17 14:27:45 2015 +0000
Revision:
96:487b796308b0
Release 96 of the mbed library

Changes:
- IAR support for ble boards, lpc, ethernet stack
- RTC - attach function to redirect time functions
- Nucleo F103RB - cube driver
- k20xx - fixes for teensy and k20 platforms in sleep/deepsleep and usb
- STM32L0, Nucleo/Disco L053 - refactoring

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Kojto 96:487b796308b0 1 /**
Kojto 96:487b796308b0 2 ******************************************************************************
Kojto 96:487b796308b0 3 * @file stm32f1xx.h
Kojto 96:487b796308b0 4 * @author MCD Application Team
Kojto 96:487b796308b0 5 * @version V4.0.0
Kojto 96:487b796308b0 6 * @date 16-December-2014
Kojto 96:487b796308b0 7 * @brief CMSIS STM32F1xx Device Peripheral Access Layer Header File.
Kojto 96:487b796308b0 8 *
Kojto 96:487b796308b0 9 * The file is the unique include file that the application programmer
Kojto 96:487b796308b0 10 * is using in the C source code, usually in main.c. This file contains:
Kojto 96:487b796308b0 11 * - Configuration section that allows to select:
Kojto 96:487b796308b0 12 * - The STM32F1xx device used in the target application
Kojto 96:487b796308b0 13 * - To use or not the peripheral’s drivers in application code(i.e.
Kojto 96:487b796308b0 14 * code will be based on direct access to peripheral’s registers
Kojto 96:487b796308b0 15 * rather than drivers API), this option is controlled by
Kojto 96:487b796308b0 16 * "#define USE_HAL_DRIVER"
Kojto 96:487b796308b0 17 *
Kojto 96:487b796308b0 18 ******************************************************************************
Kojto 96:487b796308b0 19 * @attention
Kojto 96:487b796308b0 20 *
Kojto 96:487b796308b0 21 * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
Kojto 96:487b796308b0 22 *
Kojto 96:487b796308b0 23 * Redistribution and use in source and binary forms, with or without modification,
Kojto 96:487b796308b0 24 * are permitted provided that the following conditions are met:
Kojto 96:487b796308b0 25 * 1. Redistributions of source code must retain the above copyright notice,
Kojto 96:487b796308b0 26 * this list of conditions and the following disclaimer.
Kojto 96:487b796308b0 27 * 2. Redistributions in binary form must reproduce the above copyright notice,
Kojto 96:487b796308b0 28 * this list of conditions and the following disclaimer in the documentation
Kojto 96:487b796308b0 29 * and/or other materials provided with the distribution.
Kojto 96:487b796308b0 30 * 3. Neither the name of STMicroelectronics nor the names of its contributors
Kojto 96:487b796308b0 31 * may be used to endorse or promote products derived from this software
Kojto 96:487b796308b0 32 * without specific prior written permission.
Kojto 96:487b796308b0 33 *
Kojto 96:487b796308b0 34 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
Kojto 96:487b796308b0 35 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Kojto 96:487b796308b0 36 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
Kojto 96:487b796308b0 37 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
Kojto 96:487b796308b0 38 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
Kojto 96:487b796308b0 39 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
Kojto 96:487b796308b0 40 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
Kojto 96:487b796308b0 41 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
Kojto 96:487b796308b0 42 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
Kojto 96:487b796308b0 43 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Kojto 96:487b796308b0 44 *
Kojto 96:487b796308b0 45 ******************************************************************************
Kojto 96:487b796308b0 46 */
Kojto 96:487b796308b0 47
Kojto 96:487b796308b0 48 /** @addtogroup CMSIS
Kojto 96:487b796308b0 49 * @{
Kojto 96:487b796308b0 50 */
Kojto 96:487b796308b0 51
Kojto 96:487b796308b0 52 /** @addtogroup stm32f1xx
Kojto 96:487b796308b0 53 * @{
Kojto 96:487b796308b0 54 */
Kojto 96:487b796308b0 55
Kojto 96:487b796308b0 56 #ifndef __STM32F1XX_H
Kojto 96:487b796308b0 57 #define __STM32F1XX_H
Kojto 96:487b796308b0 58
Kojto 96:487b796308b0 59 #ifdef __cplusplus
Kojto 96:487b796308b0 60 extern "C" {
Kojto 96:487b796308b0 61 #endif /* __cplusplus */
Kojto 96:487b796308b0 62
Kojto 96:487b796308b0 63 /** @addtogroup Library_configuration_section
Kojto 96:487b796308b0 64 * @{
Kojto 96:487b796308b0 65 */
Kojto 96:487b796308b0 66
Kojto 96:487b796308b0 67 /**
Kojto 96:487b796308b0 68 * @brief STM32 Family
Kojto 96:487b796308b0 69 */
Kojto 96:487b796308b0 70 #if !defined (STM32F1)
Kojto 96:487b796308b0 71 #define STM32F1
Kojto 96:487b796308b0 72 #endif /* STM32F1 */
Kojto 96:487b796308b0 73
Kojto 96:487b796308b0 74 /* Uncomment the line below according to the target STM32L device used in your
Kojto 96:487b796308b0 75 application
Kojto 96:487b796308b0 76 */
Kojto 96:487b796308b0 77
Kojto 96:487b796308b0 78 #if !defined (STM32F100xB) && !defined (STM32F100xE) && !defined (STM32F101x6) && \
Kojto 96:487b796308b0 79 !defined (STM32F101xB) && !defined (STM32F101xE) && !defined (STM32F101xG) && !defined (STM32F102x6) && !defined (STM32F102xB) && !defined (STM32F103x6) && \
Kojto 96:487b796308b0 80 !defined (STM32F103xB) && !defined (STM32F103xE) && !defined (STM32F103xG) && !defined (STM32F105xC) && !defined (STM32F107xC)
Kojto 96:487b796308b0 81 /* #define STM32F100xB */ /*!< STM32F100C4, STM32F100R4, STM32F100C6, STM32F100R6, STM32F100C8, STM32F100R8, STM32F100V8, STM32F100CB, STM32F100RB and STM32F100VB */
Kojto 96:487b796308b0 82 /* #define STM32F100xE */ /*!< STM32F100RC, STM32F100VC, STM32F100ZC, STM32F100RD, STM32F100VD, STM32F100ZD, STM32F100RE, STM32F100VE and STM32F100ZE */
Kojto 96:487b796308b0 83 /* #define STM32F101x6 */ /*!< STM32F101C4, STM32F101R4, STM32F101T4, STM32F101C6, STM32F101R6 and STM32F101T6 Devices */
Kojto 96:487b796308b0 84 /* #define STM32F101xB */ /*!< STM32F101C8, STM32F101R8, STM32F101T8, STM32F101V8, STM32F101CB, STM32F101RB, STM32F101TB and STM32F101VB */
Kojto 96:487b796308b0 85 /* #define STM32F101xE */ /*!< STM32F101RC, STM32F101VC, STM32F101ZC, STM32F101RD, STM32F101VD, STM32F101ZD, STM32F101RE, STM32F101VE and STM32F101ZE */
Kojto 96:487b796308b0 86 /* #define STM32F101xG */ /*!< STM32F101RF, STM32F101VF, STM32F101ZF, STM32F101RG, STM32F101VG and STM32F101ZG */
Kojto 96:487b796308b0 87 /* #define STM32F102x6 */ /*!< STM32F102C4, STM32F102R4, STM32F102C6 and STM32F102R6 */
Kojto 96:487b796308b0 88 /* #define STM32F102xB */ /*!< STM32F102C8, STM32F102R8, STM32F102CB and STM32F102RB */
Kojto 96:487b796308b0 89 /* #define STM32F103x6 */ /*!< STM32F103C4, STM32F103R4, STM32F103T4, STM32F103C6, STM32F103R6 and STM32F103T6 */
Kojto 96:487b796308b0 90 #define STM32F103xB /*!< STM32F103C8, STM32F103R8, STM32F103T8, STM32F103V8, STM32F103CB, STM32F103RB, STM32F103TB and STM32F103VB */
Kojto 96:487b796308b0 91 /* #define STM32F103xE */ /*!< STM32F103RC, STM32F103VC, STM32F103ZC, STM32F103RD, STM32F103VD, STM32F103ZD, STM32F103RE, STM32F103VE and STM32F103ZE */
Kojto 96:487b796308b0 92 /* #define STM32F103xG */ /*!< STM32F103RF, STM32F103VF, STM32F103ZF, STM32F103RG, STM32F103VG and STM32F103ZG */
Kojto 96:487b796308b0 93 /* #define STM32F105xC */ /*!< STM32F105R8, STM32F105V8, STM32F105RB, STM32F105VB, STM32F105RC and STM32F105VC */
Kojto 96:487b796308b0 94 /* #define STM32F107xC */ /*!< STM32F107RB, STM32F107VB, STM32F107RC and STM32F107VC */
Kojto 96:487b796308b0 95 #endif
Kojto 96:487b796308b0 96
Kojto 96:487b796308b0 97 /* Tip: To avoid modifying this file each time you need to switch between these
Kojto 96:487b796308b0 98 devices, you can define the device in your toolchain compiler preprocessor.
Kojto 96:487b796308b0 99 */
Kojto 96:487b796308b0 100
Kojto 96:487b796308b0 101 #if !defined (USE_HAL_DRIVER)
Kojto 96:487b796308b0 102 /**
Kojto 96:487b796308b0 103 * @brief Comment the line below if you will not use the peripherals drivers.
Kojto 96:487b796308b0 104 In this case, these drivers will not be included and the application code will
Kojto 96:487b796308b0 105 be based on direct access to peripherals registers
Kojto 96:487b796308b0 106 */
Kojto 96:487b796308b0 107 #define USE_HAL_DRIVER
Kojto 96:487b796308b0 108 #endif /* USE_HAL_DRIVER */
Kojto 96:487b796308b0 109
Kojto 96:487b796308b0 110 /**
Kojto 96:487b796308b0 111 * @brief CMSIS Device version number V4.0.0
Kojto 96:487b796308b0 112 */
Kojto 96:487b796308b0 113 #define __STM32F1xx_CMSIS_DEVICE_VERSION_MAIN (0x04) /*!< [31:24] main version */
Kojto 96:487b796308b0 114 #define __STM32F1xx_CMSIS_DEVICE_VERSION_SUB1 (0x00) /*!< [23:16] sub1 version */
Kojto 96:487b796308b0 115 #define __STM32F1xx_CMSIS_DEVICE_VERSION_SUB2 (0x00) /*!< [15:8] sub2 version */
Kojto 96:487b796308b0 116 #define __STM32F1xx_CMSIS_DEVICE_VERSION_RC (0x00) /*!< [7:0] release candidate */
Kojto 96:487b796308b0 117 #define __STM32F1xx_CMSIS_DEVICE_VERSION ((__CMSIS_DEVICE_VERSION_MAIN << 24)\
Kojto 96:487b796308b0 118 |(__CMSIS_DEVICE_HAL_VERSION_SUB1 << 16)\
Kojto 96:487b796308b0 119 |(__CMSIS_DEVICE_HAL_VERSION_SUB2 << 8 )\
Kojto 96:487b796308b0 120 |(__CMSIS_DEVICE_HAL_VERSION_RC))
Kojto 96:487b796308b0 121
Kojto 96:487b796308b0 122 /**
Kojto 96:487b796308b0 123 * @}
Kojto 96:487b796308b0 124 */
Kojto 96:487b796308b0 125
Kojto 96:487b796308b0 126 /** @addtogroup Device_Included
Kojto 96:487b796308b0 127 * @{
Kojto 96:487b796308b0 128 */
Kojto 96:487b796308b0 129
Kojto 96:487b796308b0 130 #if defined(STM32F100xB)
Kojto 96:487b796308b0 131 #include "stm32f100xb.h"
Kojto 96:487b796308b0 132 #elif defined(STM32F100xE)
Kojto 96:487b796308b0 133 #include "stm32f100xe.h"
Kojto 96:487b796308b0 134 #elif defined(STM32F101x6)
Kojto 96:487b796308b0 135 #include "stm32f101x6.h"
Kojto 96:487b796308b0 136 #elif defined(STM32F101xB)
Kojto 96:487b796308b0 137 #include "stm32f101xb.h"
Kojto 96:487b796308b0 138 #elif defined(STM32F101xE)
Kojto 96:487b796308b0 139 #include "stm32f101xe.h"
Kojto 96:487b796308b0 140 #elif defined(STM32F101xG)
Kojto 96:487b796308b0 141 #include "stm32f101xg.h"
Kojto 96:487b796308b0 142 #elif defined(STM32F102x6)
Kojto 96:487b796308b0 143 #include "stm32f102x6.h"
Kojto 96:487b796308b0 144 #elif defined(STM32F102xB)
Kojto 96:487b796308b0 145 #include "stm32f102xb.h"
Kojto 96:487b796308b0 146 #elif defined(STM32F103x6)
Kojto 96:487b796308b0 147 #include "stm32f103x6.h"
Kojto 96:487b796308b0 148 #elif defined(STM32F103xB)
Kojto 96:487b796308b0 149 #include "stm32f103xb.h"
Kojto 96:487b796308b0 150 #elif defined(STM32F103xE)
Kojto 96:487b796308b0 151 #include "stm32f103xe.h"
Kojto 96:487b796308b0 152 #elif defined(STM32F103xG)
Kojto 96:487b796308b0 153 #include "stm32f103xg.h"
Kojto 96:487b796308b0 154 #elif defined(STM32F105xC)
Kojto 96:487b796308b0 155 #include "stm32f105xc.h"
Kojto 96:487b796308b0 156 #elif defined(STM32F107xC)
Kojto 96:487b796308b0 157 #include "stm32f107xc.h"
Kojto 96:487b796308b0 158 #else
Kojto 96:487b796308b0 159 #error "Please select first the target STM32F1xx device used in your application (in stm32f1xx.h file)"
Kojto 96:487b796308b0 160 #endif
Kojto 96:487b796308b0 161
Kojto 96:487b796308b0 162 /**
Kojto 96:487b796308b0 163 * @}
Kojto 96:487b796308b0 164 */
Kojto 96:487b796308b0 165
Kojto 96:487b796308b0 166 /** @addtogroup Exported_types
Kojto 96:487b796308b0 167 * @{
Kojto 96:487b796308b0 168 */
Kojto 96:487b796308b0 169 typedef enum
Kojto 96:487b796308b0 170 {
Kojto 96:487b796308b0 171 RESET = 0,
Kojto 96:487b796308b0 172 SET = !RESET
Kojto 96:487b796308b0 173 } FlagStatus, ITStatus;
Kojto 96:487b796308b0 174
Kojto 96:487b796308b0 175 typedef enum
Kojto 96:487b796308b0 176 {
Kojto 96:487b796308b0 177 DISABLE = 0,
Kojto 96:487b796308b0 178 ENABLE = !DISABLE
Kojto 96:487b796308b0 179 } FunctionalState;
Kojto 96:487b796308b0 180 #define IS_FUNCTIONAL_STATE(STATE) (((STATE) == DISABLE) || ((STATE) == ENABLE))
Kojto 96:487b796308b0 181
Kojto 96:487b796308b0 182 typedef enum
Kojto 96:487b796308b0 183 {
Kojto 96:487b796308b0 184 ERROR = 0,
Kojto 96:487b796308b0 185 SUCCESS = !ERROR
Kojto 96:487b796308b0 186 } ErrorStatus;
Kojto 96:487b796308b0 187
Kojto 96:487b796308b0 188 /**
Kojto 96:487b796308b0 189 * @}
Kojto 96:487b796308b0 190 */
Kojto 96:487b796308b0 191
Kojto 96:487b796308b0 192
Kojto 96:487b796308b0 193 /** @addtogroup Exported_macros
Kojto 96:487b796308b0 194 * @{
Kojto 96:487b796308b0 195 */
Kojto 96:487b796308b0 196 #define SET_BIT(REG, BIT) ((REG) |= (BIT))
Kojto 96:487b796308b0 197
Kojto 96:487b796308b0 198 #define CLEAR_BIT(REG, BIT) ((REG) &= ~(BIT))
Kojto 96:487b796308b0 199
Kojto 96:487b796308b0 200 #define READ_BIT(REG, BIT) ((REG) & (BIT))
Kojto 96:487b796308b0 201
Kojto 96:487b796308b0 202 #define CLEAR_REG(REG) ((REG) = (0x0))
Kojto 96:487b796308b0 203
Kojto 96:487b796308b0 204 #define WRITE_REG(REG, VAL) ((REG) = (VAL))
Kojto 96:487b796308b0 205
Kojto 96:487b796308b0 206 #define READ_REG(REG) ((REG))
Kojto 96:487b796308b0 207
Kojto 96:487b796308b0 208 #define MODIFY_REG(REG, CLEARMASK, SETMASK) WRITE_REG((REG), (((READ_REG(REG)) & (~(CLEARMASK))) | (SETMASK)))
Kojto 96:487b796308b0 209
Kojto 96:487b796308b0 210 #define POSITION_VAL(VAL) (__CLZ(__RBIT(VAL)))
Kojto 96:487b796308b0 211
Kojto 96:487b796308b0 212
Kojto 96:487b796308b0 213 /**
Kojto 96:487b796308b0 214 * @}
Kojto 96:487b796308b0 215 */
Kojto 96:487b796308b0 216
Kojto 96:487b796308b0 217 #if defined (USE_HAL_DRIVER)
Kojto 96:487b796308b0 218 #include "stm32f1xx_hal.h"
Kojto 96:487b796308b0 219 #endif /* USE_HAL_DRIVER */
Kojto 96:487b796308b0 220
Kojto 96:487b796308b0 221
Kojto 96:487b796308b0 222 #ifdef __cplusplus
Kojto 96:487b796308b0 223 }
Kojto 96:487b796308b0 224 #endif /* __cplusplus */
Kojto 96:487b796308b0 225
Kojto 96:487b796308b0 226 #endif /* __STM32F1xx_H */
Kojto 96:487b796308b0 227 /**
Kojto 96:487b796308b0 228 * @}
Kojto 96:487b796308b0 229 */
Kojto 96:487b796308b0 230
Kojto 96:487b796308b0 231 /**
Kojto 96:487b796308b0 232 * @}
Kojto 96:487b796308b0 233 */
Kojto 96:487b796308b0 234
Kojto 96:487b796308b0 235
Kojto 96:487b796308b0 236
Kojto 96:487b796308b0 237
Kojto 96:487b796308b0 238 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/