mbed(SerialHalfDuplex入り)

Fork of mbed by mbed official

Committer:
yusuke_kyo
Date:
Wed Apr 08 08:04:18 2015 +0000
Revision:
98:01a414ca7d6d
Parent:
96:487b796308b0
remove SerialHalfDuplex.h

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_hal_def.h
Kojto 96:487b796308b0 4 * @author MCD Application Team
Kojto 96:487b796308b0 5 * @version V1.0.0
Kojto 96:487b796308b0 6 * @date 15-December-2014
Kojto 96:487b796308b0 7 * @brief This file contains HAL common defines, enumeration, macros and
Kojto 96:487b796308b0 8 * structures definitions.
Kojto 96:487b796308b0 9 ******************************************************************************
Kojto 96:487b796308b0 10 * @attention
Kojto 96:487b796308b0 11 *
Kojto 96:487b796308b0 12 * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
Kojto 96:487b796308b0 13 *
Kojto 96:487b796308b0 14 * Redistribution and use in source and binary forms, with or without modification,
Kojto 96:487b796308b0 15 * are permitted provided that the following conditions are met:
Kojto 96:487b796308b0 16 * 1. Redistributions of source code must retain the above copyright notice,
Kojto 96:487b796308b0 17 * this list of conditions and the following disclaimer.
Kojto 96:487b796308b0 18 * 2. Redistributions in binary form must reproduce the above copyright notice,
Kojto 96:487b796308b0 19 * this list of conditions and the following disclaimer in the documentation
Kojto 96:487b796308b0 20 * and/or other materials provided with the distribution.
Kojto 96:487b796308b0 21 * 3. Neither the name of STMicroelectronics nor the names of its contributors
Kojto 96:487b796308b0 22 * may be used to endorse or promote products derived from this software
Kojto 96:487b796308b0 23 * without specific prior written permission.
Kojto 96:487b796308b0 24 *
Kojto 96:487b796308b0 25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
Kojto 96:487b796308b0 26 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Kojto 96:487b796308b0 27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
Kojto 96:487b796308b0 28 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
Kojto 96:487b796308b0 29 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
Kojto 96:487b796308b0 30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
Kojto 96:487b796308b0 31 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
Kojto 96:487b796308b0 32 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
Kojto 96:487b796308b0 33 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
Kojto 96:487b796308b0 34 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Kojto 96:487b796308b0 35 *
Kojto 96:487b796308b0 36 ******************************************************************************
Kojto 96:487b796308b0 37 */
Kojto 96:487b796308b0 38
Kojto 96:487b796308b0 39 /* Define to prevent recursive inclusion -------------------------------------*/
Kojto 96:487b796308b0 40 #ifndef __STM32F1xx_HAL_DEF
Kojto 96:487b796308b0 41 #define __STM32F1xx_HAL_DEF
Kojto 96:487b796308b0 42
Kojto 96:487b796308b0 43 #ifdef __cplusplus
Kojto 96:487b796308b0 44 extern "C" {
Kojto 96:487b796308b0 45 #endif
Kojto 96:487b796308b0 46
Kojto 96:487b796308b0 47 /* Includes ------------------------------------------------------------------*/
Kojto 96:487b796308b0 48 #include "stm32f1xx.h"
Kojto 96:487b796308b0 49 #include "stm32_hal_legacy.h"
Kojto 96:487b796308b0 50
Kojto 96:487b796308b0 51 /* Exported types ------------------------------------------------------------*/
Kojto 96:487b796308b0 52
Kojto 96:487b796308b0 53 /**
Kojto 96:487b796308b0 54 * @brief HAL Status structures definition
Kojto 96:487b796308b0 55 */
Kojto 96:487b796308b0 56 typedef enum
Kojto 96:487b796308b0 57 {
Kojto 96:487b796308b0 58 HAL_OK = 0x00,
Kojto 96:487b796308b0 59 HAL_ERROR = 0x01,
Kojto 96:487b796308b0 60 HAL_BUSY = 0x02,
Kojto 96:487b796308b0 61 HAL_TIMEOUT = 0x03
Kojto 96:487b796308b0 62 } HAL_StatusTypeDef;
Kojto 96:487b796308b0 63
Kojto 96:487b796308b0 64 /**
Kojto 96:487b796308b0 65 * @brief HAL Lock structures definition
Kojto 96:487b796308b0 66 */
Kojto 96:487b796308b0 67 typedef enum
Kojto 96:487b796308b0 68 {
Kojto 96:487b796308b0 69 HAL_UNLOCKED = 0x00,
Kojto 96:487b796308b0 70 HAL_LOCKED = 0x01
Kojto 96:487b796308b0 71 } HAL_LockTypeDef;
Kojto 96:487b796308b0 72
Kojto 96:487b796308b0 73 /* Exported macro ------------------------------------------------------------*/
Kojto 96:487b796308b0 74 #ifndef NULL
Kojto 96:487b796308b0 75 #define NULL 0
Kojto 96:487b796308b0 76 #endif
Kojto 96:487b796308b0 77
Kojto 96:487b796308b0 78 #define HAL_MAX_DELAY 0xFFFFFFFF
Kojto 96:487b796308b0 79
Kojto 96:487b796308b0 80 #define HAL_IS_BIT_SET(REG, BIT) (((REG) & (BIT)) != RESET)
Kojto 96:487b796308b0 81 #define HAL_IS_BIT_CLR(REG, BIT) (((REG) & (BIT)) == RESET)
Kojto 96:487b796308b0 82
Kojto 96:487b796308b0 83 #define __HAL_LINKDMA(__HANDLE__, __PPP_DMA_FIELD_, __DMA_HANDLE_) \
Kojto 96:487b796308b0 84 do{ \
Kojto 96:487b796308b0 85 (__HANDLE__)->__PPP_DMA_FIELD_ = &(__DMA_HANDLE_); \
Kojto 96:487b796308b0 86 (__DMA_HANDLE_).Parent = (__HANDLE__); \
Kojto 96:487b796308b0 87 } while(0)
Kojto 96:487b796308b0 88
Kojto 96:487b796308b0 89 #define UNUSED(x) ((void)(x))
Kojto 96:487b796308b0 90
Kojto 96:487b796308b0 91 /** @brief Reset the Handle's State field.
Kojto 96:487b796308b0 92 * @param __HANDLE__: specifies the Peripheral Handle.
Kojto 96:487b796308b0 93 * @note This macro can be used for the following purpose:
Kojto 96:487b796308b0 94 * - When the Handle is declared as local variable; before passing it as parameter
Kojto 96:487b796308b0 95 * to HAL_PPP_Init() for the first time, it is mandatory to use this macro
Kojto 96:487b796308b0 96 * to set to 0 the Handle's "State" field.
Kojto 96:487b796308b0 97 * Otherwise, "State" field may have any random value and the first time the function
Kojto 96:487b796308b0 98 * HAL_PPP_Init() is called, the low level hardware initialization will be missed
Kojto 96:487b796308b0 99 * (i.e. HAL_PPP_MspInit() will not be executed).
Kojto 96:487b796308b0 100 * - When there is a need to reconfigure the low level hardware: instead of calling
Kojto 96:487b796308b0 101 * HAL_PPP_DeInit() then HAL_PPP_Init(), user can make a call to this macro then HAL_PPP_Init().
Kojto 96:487b796308b0 102 * In this later function, when the Handle's "State" field is set to 0, it will execute the function
Kojto 96:487b796308b0 103 * HAL_PPP_MspInit() which will reconfigure the low level hardware.
Kojto 96:487b796308b0 104 * @retval None
Kojto 96:487b796308b0 105 */
Kojto 96:487b796308b0 106 #define __HAL_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = 0)
Kojto 96:487b796308b0 107
Kojto 96:487b796308b0 108 #if (USE_RTOS == 1)
Kojto 96:487b796308b0 109 #error " USE_RTOS should be 0 in the current HAL release "
Kojto 96:487b796308b0 110 #else
Kojto 96:487b796308b0 111 #define __HAL_LOCK(__HANDLE__) \
Kojto 96:487b796308b0 112 do{ \
Kojto 96:487b796308b0 113 if((__HANDLE__)->Lock == HAL_LOCKED) \
Kojto 96:487b796308b0 114 { \
Kojto 96:487b796308b0 115 return HAL_BUSY; \
Kojto 96:487b796308b0 116 } \
Kojto 96:487b796308b0 117 else \
Kojto 96:487b796308b0 118 { \
Kojto 96:487b796308b0 119 (__HANDLE__)->Lock = HAL_LOCKED; \
Kojto 96:487b796308b0 120 } \
Kojto 96:487b796308b0 121 }while (0)
Kojto 96:487b796308b0 122
Kojto 96:487b796308b0 123 #define __HAL_UNLOCK(__HANDLE__) \
Kojto 96:487b796308b0 124 do{ \
Kojto 96:487b796308b0 125 (__HANDLE__)->Lock = HAL_UNLOCKED; \
Kojto 96:487b796308b0 126 }while (0)
Kojto 96:487b796308b0 127 #endif /* USE_RTOS */
Kojto 96:487b796308b0 128
Kojto 96:487b796308b0 129 #if defined ( __GNUC__ )
Kojto 96:487b796308b0 130 #ifndef __weak
Kojto 96:487b796308b0 131 #define __weak __attribute__((weak))
Kojto 96:487b796308b0 132 #endif /* __weak */
Kojto 96:487b796308b0 133 #ifndef __packed
Kojto 96:487b796308b0 134 #define __packed __attribute__((__packed__))
Kojto 96:487b796308b0 135 #endif /* __packed */
Kojto 96:487b796308b0 136 #endif /* __GNUC__ */
Kojto 96:487b796308b0 137
Kojto 96:487b796308b0 138
Kojto 96:487b796308b0 139 /* Macro to get variable aligned on 4-bytes, for __ICCARM__ the directive "#pragma data_alignment=4" must be used instead */
Kojto 96:487b796308b0 140 #if defined (__GNUC__) /* GNU Compiler */
Kojto 96:487b796308b0 141 #ifndef __ALIGN_END
Kojto 96:487b796308b0 142 #define __ALIGN_END __attribute__ ((aligned (4)))
Kojto 96:487b796308b0 143 #endif /* __ALIGN_END */
Kojto 96:487b796308b0 144 #ifndef __ALIGN_BEGIN
Kojto 96:487b796308b0 145 #define __ALIGN_BEGIN
Kojto 96:487b796308b0 146 #endif /* __ALIGN_BEGIN */
Kojto 96:487b796308b0 147 #else
Kojto 96:487b796308b0 148 #ifndef __ALIGN_END
Kojto 96:487b796308b0 149 #define __ALIGN_END
Kojto 96:487b796308b0 150 #endif /* __ALIGN_END */
Kojto 96:487b796308b0 151 #ifndef __ALIGN_BEGIN
Kojto 96:487b796308b0 152 #if defined (__CC_ARM) /* ARM Compiler */
Kojto 96:487b796308b0 153 #define __ALIGN_BEGIN __align(4)
Kojto 96:487b796308b0 154 #elif defined (__ICCARM__) /* IAR Compiler */
Kojto 96:487b796308b0 155 #define __ALIGN_BEGIN
Kojto 96:487b796308b0 156 #endif /* __CC_ARM */
Kojto 96:487b796308b0 157 #endif /* __ALIGN_BEGIN */
Kojto 96:487b796308b0 158 #endif /* __GNUC__ */
Kojto 96:487b796308b0 159
Kojto 96:487b796308b0 160 /**
Kojto 96:487b796308b0 161 * @brief __RAM_FUNC definition
Kojto 96:487b796308b0 162 */
Kojto 96:487b796308b0 163 #if defined ( __CC_ARM )
Kojto 96:487b796308b0 164 /* ARM Compiler
Kojto 96:487b796308b0 165 ------------
Kojto 96:487b796308b0 166 RAM functions are defined using the toolchain options.
Kojto 96:487b796308b0 167 Functions that are executed in RAM should reside in a separate source module.
Kojto 96:487b796308b0 168 Using the 'Options for File' dialog you can simply change the 'Code / Const'
Kojto 96:487b796308b0 169 area of a module to a memory space in physical RAM.
Kojto 96:487b796308b0 170 Available memory areas are declared in the 'Target' tab of the 'Options for Target'
Kojto 96:487b796308b0 171 dialog.
Kojto 96:487b796308b0 172 */
Kojto 96:487b796308b0 173 #define __RAM_FUNC HAL_StatusTypeDef
Kojto 96:487b796308b0 174
Kojto 96:487b796308b0 175 #elif defined ( __ICCARM__ )
Kojto 96:487b796308b0 176 /* ICCARM Compiler
Kojto 96:487b796308b0 177 ---------------
Kojto 96:487b796308b0 178 RAM functions are defined using a specific toolchain keyword "__ramfunc".
Kojto 96:487b796308b0 179 */
Kojto 96:487b796308b0 180 #define __RAM_FUNC __ramfunc HAL_StatusTypeDef
Kojto 96:487b796308b0 181
Kojto 96:487b796308b0 182 #elif defined ( __GNUC__ )
Kojto 96:487b796308b0 183 /* GNU Compiler
Kojto 96:487b796308b0 184 ------------
Kojto 96:487b796308b0 185 RAM functions are defined using a specific toolchain attribute
Kojto 96:487b796308b0 186 "__attribute__((section(".RamFunc")))".
Kojto 96:487b796308b0 187 */
Kojto 96:487b796308b0 188 #define __RAM_FUNC HAL_StatusTypeDef __attribute__((section(".RamFunc")))
Kojto 96:487b796308b0 189
Kojto 96:487b796308b0 190 #endif
Kojto 96:487b796308b0 191
Kojto 96:487b796308b0 192 /**
Kojto 96:487b796308b0 193 * @brief __NOINLINE definition
Kojto 96:487b796308b0 194 */
Kojto 96:487b796308b0 195 #if defined ( __CC_ARM ) || defined ( __GNUC__ )
Kojto 96:487b796308b0 196 /* ARM & GNUCompiler
Kojto 96:487b796308b0 197 ----------------
Kojto 96:487b796308b0 198 */
Kojto 96:487b796308b0 199 #define __NOINLINE __attribute__ ( (noinline) )
Kojto 96:487b796308b0 200
Kojto 96:487b796308b0 201 #elif defined ( __ICCARM__ )
Kojto 96:487b796308b0 202 /* ICCARM Compiler
Kojto 96:487b796308b0 203 ---------------
Kojto 96:487b796308b0 204 */
Kojto 96:487b796308b0 205 #define __NOINLINE _Pragma("optimize = no_inline")
Kojto 96:487b796308b0 206
Kojto 96:487b796308b0 207 #endif
Kojto 96:487b796308b0 208
Kojto 96:487b796308b0 209
Kojto 96:487b796308b0 210 #ifdef __cplusplus
Kojto 96:487b796308b0 211 }
Kojto 96:487b796308b0 212 #endif
Kojto 96:487b796308b0 213
Kojto 96:487b796308b0 214 #endif /* ___STM32F1xx_HAL_DEF */
Kojto 96:487b796308b0 215
Kojto 96:487b796308b0 216 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/