mbed(SerialHalfDuplex入り)

Fork of mbed by mbed official

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

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Kojto 93:e188a91d3eaa 1 /**
Kojto 93:e188a91d3eaa 2 ******************************************************************************
Kojto 93:e188a91d3eaa 3 * @file stm32f3xx_hal_smartcard_ex.h
Kojto 93:e188a91d3eaa 4 * @author MCD Application Team
Kojto 93:e188a91d3eaa 5 * @version V1.1.0
Kojto 93:e188a91d3eaa 6 * @date 12-Sept-2014
Kojto 93:e188a91d3eaa 7 * @brief Header file of SMARTCARD HAL module.
Kojto 93:e188a91d3eaa 8 ******************************************************************************
Kojto 93:e188a91d3eaa 9 * @attention
Kojto 93:e188a91d3eaa 10 *
Kojto 93:e188a91d3eaa 11 * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
Kojto 93:e188a91d3eaa 12 *
Kojto 93:e188a91d3eaa 13 * Redistribution and use in source and binary forms, with or without modification,
Kojto 93:e188a91d3eaa 14 * are permitted provided that the following conditions are met:
Kojto 93:e188a91d3eaa 15 * 1. Redistributions of source code must retain the above copyright notice,
Kojto 93:e188a91d3eaa 16 * this list of conditions and the following disclaimer.
Kojto 93:e188a91d3eaa 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
Kojto 93:e188a91d3eaa 18 * this list of conditions and the following disclaimer in the documentation
Kojto 93:e188a91d3eaa 19 * and/or other materials provided with the distribution.
Kojto 93:e188a91d3eaa 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
Kojto 93:e188a91d3eaa 21 * may be used to endorse or promote products derived from this software
Kojto 93:e188a91d3eaa 22 * without specific prior written permission.
Kojto 93:e188a91d3eaa 23 *
Kojto 93:e188a91d3eaa 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
Kojto 93:e188a91d3eaa 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Kojto 93:e188a91d3eaa 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
Kojto 93:e188a91d3eaa 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
Kojto 93:e188a91d3eaa 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
Kojto 93:e188a91d3eaa 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
Kojto 93:e188a91d3eaa 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
Kojto 93:e188a91d3eaa 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
Kojto 93:e188a91d3eaa 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
Kojto 93:e188a91d3eaa 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Kojto 93:e188a91d3eaa 34 *
Kojto 93:e188a91d3eaa 35 ******************************************************************************
Kojto 93:e188a91d3eaa 36 */
Kojto 93:e188a91d3eaa 37
Kojto 93:e188a91d3eaa 38 /* Define to prevent recursive inclusion -------------------------------------*/
Kojto 93:e188a91d3eaa 39 #ifndef __STM32F3xx_HAL_SMARTCARD_EX_H
Kojto 93:e188a91d3eaa 40 #define __STM32F3xx_HAL_SMARTCARD_EX_H
Kojto 93:e188a91d3eaa 41
Kojto 93:e188a91d3eaa 42 #ifdef __cplusplus
Kojto 93:e188a91d3eaa 43 extern "C" {
Kojto 93:e188a91d3eaa 44 #endif
Kojto 93:e188a91d3eaa 45
Kojto 93:e188a91d3eaa 46 /* Includes ------------------------------------------------------------------*/
Kojto 93:e188a91d3eaa 47 #include "stm32f3xx_hal_def.h"
Kojto 93:e188a91d3eaa 48
Kojto 93:e188a91d3eaa 49 /** @addtogroup STM32F3xx_HAL_Driver
Kojto 93:e188a91d3eaa 50 * @{
Kojto 93:e188a91d3eaa 51 */
Kojto 93:e188a91d3eaa 52
Kojto 93:e188a91d3eaa 53 /** @addtogroup SMARTCARDEx SMARTCARD Extended HAL module driver
Kojto 93:e188a91d3eaa 54 * @{
Kojto 93:e188a91d3eaa 55 */
Kojto 93:e188a91d3eaa 56
Kojto 93:e188a91d3eaa 57 /* Exported types ------------------------------------------------------------*/
Kojto 93:e188a91d3eaa 58 /* Exported constants --------------------------------------------------------*/
Kojto 93:e188a91d3eaa 59 /* Exported macro ------------------------------------------------------------*/
Kojto 93:e188a91d3eaa 60
Kojto 93:e188a91d3eaa 61 /** @defgroup SMARTCARDEx_Exported_Macros SMARTCARD Extended Exported Macros
Kojto 93:e188a91d3eaa 62 * @{
Kojto 93:e188a91d3eaa 63 */
Kojto 93:e188a91d3eaa 64
Kojto 93:e188a91d3eaa 65 /** @brief Reports the SMARTCARD clock source.
Kojto 93:e188a91d3eaa 66 * @param __HANDLE__: specifies the SMARTCARD Handle
Kojto 93:e188a91d3eaa 67 * @param __CLOCKSOURCE__ : output variable
Kojto 93:e188a91d3eaa 68 * @retval the SMARTCARD clocking source, written in __CLOCKSOURCE__.
Kojto 93:e188a91d3eaa 69 */
Kojto 93:e188a91d3eaa 70 #if defined(STM32F334x8) || defined(STM32F303x8) || defined(STM32F328xx)
Kojto 93:e188a91d3eaa 71 #define __HAL_SMARTCARD_GETCLOCKSOURCE(__HANDLE__,__CLOCKSOURCE__) \
Kojto 93:e188a91d3eaa 72 do { \
Kojto 93:e188a91d3eaa 73 if((__HANDLE__)->Instance == USART1) \
Kojto 93:e188a91d3eaa 74 { \
Kojto 93:e188a91d3eaa 75 switch(__HAL_RCC_GET_USART1_SOURCE()) \
Kojto 93:e188a91d3eaa 76 { \
Kojto 93:e188a91d3eaa 77 case RCC_USART1CLKSOURCE_PCLK1: \
Kojto 93:e188a91d3eaa 78 (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_PCLK1; \
Kojto 93:e188a91d3eaa 79 break; \
Kojto 93:e188a91d3eaa 80 case RCC_USART1CLKSOURCE_HSI: \
Kojto 93:e188a91d3eaa 81 (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_HSI; \
Kojto 93:e188a91d3eaa 82 break; \
Kojto 93:e188a91d3eaa 83 case RCC_USART1CLKSOURCE_SYSCLK: \
Kojto 93:e188a91d3eaa 84 (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_SYSCLK; \
Kojto 93:e188a91d3eaa 85 break; \
Kojto 93:e188a91d3eaa 86 case RCC_USART1CLKSOURCE_LSE: \
Kojto 93:e188a91d3eaa 87 (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_LSE; \
Kojto 93:e188a91d3eaa 88 break; \
Kojto 93:e188a91d3eaa 89 } \
Kojto 93:e188a91d3eaa 90 } \
Kojto 93:e188a91d3eaa 91 else if((__HANDLE__)->Instance == USART2) \
Kojto 93:e188a91d3eaa 92 { \
Kojto 93:e188a91d3eaa 93 switch(__HAL_RCC_GET_USART2_SOURCE()) \
Kojto 93:e188a91d3eaa 94 { \
Kojto 93:e188a91d3eaa 95 case RCC_USART2CLKSOURCE_PCLK1: \
Kojto 93:e188a91d3eaa 96 (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_PCLK1; \
Kojto 93:e188a91d3eaa 97 break; \
Kojto 93:e188a91d3eaa 98 case RCC_USART2CLKSOURCE_HSI: \
Kojto 93:e188a91d3eaa 99 (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_HSI; \
Kojto 93:e188a91d3eaa 100 break; \
Kojto 93:e188a91d3eaa 101 case RCC_USART2CLKSOURCE_SYSCLK: \
Kojto 93:e188a91d3eaa 102 (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_SYSCLK; \
Kojto 93:e188a91d3eaa 103 break; \
Kojto 93:e188a91d3eaa 104 case RCC_USART2CLKSOURCE_LSE: \
Kojto 93:e188a91d3eaa 105 (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_LSE; \
Kojto 93:e188a91d3eaa 106 break; \
Kojto 93:e188a91d3eaa 107 } \
Kojto 93:e188a91d3eaa 108 } \
Kojto 93:e188a91d3eaa 109 else if((__HANDLE__)->Instance == USART3) \
Kojto 93:e188a91d3eaa 110 { \
Kojto 93:e188a91d3eaa 111 switch(__HAL_RCC_GET_USART3_SOURCE()) \
Kojto 93:e188a91d3eaa 112 { \
Kojto 93:e188a91d3eaa 113 case RCC_USART3CLKSOURCE_PCLK1: \
Kojto 93:e188a91d3eaa 114 (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_PCLK1; \
Kojto 93:e188a91d3eaa 115 break; \
Kojto 93:e188a91d3eaa 116 case RCC_USART3CLKSOURCE_HSI: \
Kojto 93:e188a91d3eaa 117 (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_HSI; \
Kojto 93:e188a91d3eaa 118 break; \
Kojto 93:e188a91d3eaa 119 case RCC_USART3CLKSOURCE_SYSCLK: \
Kojto 93:e188a91d3eaa 120 (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_SYSCLK; \
Kojto 93:e188a91d3eaa 121 break; \
Kojto 93:e188a91d3eaa 122 case RCC_USART3CLKSOURCE_LSE: \
Kojto 93:e188a91d3eaa 123 (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_LSE; \
Kojto 93:e188a91d3eaa 124 break; \
Kojto 93:e188a91d3eaa 125 } \
Kojto 93:e188a91d3eaa 126 } \
Kojto 93:e188a91d3eaa 127 } while(0)
Kojto 93:e188a91d3eaa 128 #else
Kojto 93:e188a91d3eaa 129 #define __HAL_SMARTCARD_GETCLOCKSOURCE(__HANDLE__,__CLOCKSOURCE__) \
Kojto 93:e188a91d3eaa 130 do { \
Kojto 93:e188a91d3eaa 131 if((__HANDLE__)->Instance == USART1) \
Kojto 93:e188a91d3eaa 132 { \
Kojto 93:e188a91d3eaa 133 switch(__HAL_RCC_GET_USART1_SOURCE()) \
Kojto 93:e188a91d3eaa 134 { \
Kojto 93:e188a91d3eaa 135 case RCC_USART1CLKSOURCE_PCLK2: \
Kojto 93:e188a91d3eaa 136 (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_PCLK2; \
Kojto 93:e188a91d3eaa 137 break; \
Kojto 93:e188a91d3eaa 138 case RCC_USART1CLKSOURCE_HSI: \
Kojto 93:e188a91d3eaa 139 (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_HSI; \
Kojto 93:e188a91d3eaa 140 break; \
Kojto 93:e188a91d3eaa 141 case RCC_USART1CLKSOURCE_SYSCLK: \
Kojto 93:e188a91d3eaa 142 (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_SYSCLK; \
Kojto 93:e188a91d3eaa 143 break; \
Kojto 93:e188a91d3eaa 144 case RCC_USART1CLKSOURCE_LSE: \
Kojto 93:e188a91d3eaa 145 (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_LSE; \
Kojto 93:e188a91d3eaa 146 break; \
Kojto 93:e188a91d3eaa 147 } \
Kojto 93:e188a91d3eaa 148 } \
Kojto 93:e188a91d3eaa 149 else if((__HANDLE__)->Instance == USART2) \
Kojto 93:e188a91d3eaa 150 { \
Kojto 93:e188a91d3eaa 151 switch(__HAL_RCC_GET_USART2_SOURCE()) \
Kojto 93:e188a91d3eaa 152 { \
Kojto 93:e188a91d3eaa 153 case RCC_USART2CLKSOURCE_PCLK1: \
Kojto 93:e188a91d3eaa 154 (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_PCLK1; \
Kojto 93:e188a91d3eaa 155 break; \
Kojto 93:e188a91d3eaa 156 case RCC_USART2CLKSOURCE_HSI: \
Kojto 93:e188a91d3eaa 157 (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_HSI; \
Kojto 93:e188a91d3eaa 158 break; \
Kojto 93:e188a91d3eaa 159 case RCC_USART2CLKSOURCE_SYSCLK: \
Kojto 93:e188a91d3eaa 160 (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_SYSCLK; \
Kojto 93:e188a91d3eaa 161 break; \
Kojto 93:e188a91d3eaa 162 case RCC_USART2CLKSOURCE_LSE: \
Kojto 93:e188a91d3eaa 163 (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_LSE; \
Kojto 93:e188a91d3eaa 164 break; \
Kojto 93:e188a91d3eaa 165 } \
Kojto 93:e188a91d3eaa 166 } \
Kojto 93:e188a91d3eaa 167 else if((__HANDLE__)->Instance == USART3) \
Kojto 93:e188a91d3eaa 168 { \
Kojto 93:e188a91d3eaa 169 switch(__HAL_RCC_GET_USART3_SOURCE()) \
Kojto 93:e188a91d3eaa 170 { \
Kojto 93:e188a91d3eaa 171 case RCC_USART3CLKSOURCE_PCLK1: \
Kojto 93:e188a91d3eaa 172 (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_PCLK1; \
Kojto 93:e188a91d3eaa 173 break; \
Kojto 93:e188a91d3eaa 174 case RCC_USART3CLKSOURCE_HSI: \
Kojto 93:e188a91d3eaa 175 (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_HSI; \
Kojto 93:e188a91d3eaa 176 break; \
Kojto 93:e188a91d3eaa 177 case RCC_USART3CLKSOURCE_SYSCLK: \
Kojto 93:e188a91d3eaa 178 (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_SYSCLK; \
Kojto 93:e188a91d3eaa 179 break; \
Kojto 93:e188a91d3eaa 180 case RCC_USART3CLKSOURCE_LSE: \
Kojto 93:e188a91d3eaa 181 (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_LSE; \
Kojto 93:e188a91d3eaa 182 break; \
Kojto 93:e188a91d3eaa 183 } \
Kojto 93:e188a91d3eaa 184 } \
Kojto 93:e188a91d3eaa 185 } while(0)
Kojto 93:e188a91d3eaa 186 #endif
Kojto 93:e188a91d3eaa 187
Kojto 93:e188a91d3eaa 188 /**
Kojto 93:e188a91d3eaa 189 * @}
Kojto 93:e188a91d3eaa 190 */
Kojto 93:e188a91d3eaa 191
Kojto 93:e188a91d3eaa 192
Kojto 93:e188a91d3eaa 193 /* Exported functions --------------------------------------------------------*/
Kojto 93:e188a91d3eaa 194 /** @addtogroup SMARTCARDEx_Exported_Functions SMARTCARD Extended Exported Functions
Kojto 93:e188a91d3eaa 195 * @{
Kojto 93:e188a91d3eaa 196 */
Kojto 93:e188a91d3eaa 197
Kojto 93:e188a91d3eaa 198 /* Initialization and de-initialization functions ****************************/
Kojto 93:e188a91d3eaa 199 /* IO operation functions *****************************************************/
Kojto 93:e188a91d3eaa 200 /* Peripheral Control functions ***********************************************/
Kojto 93:e188a91d3eaa 201 /** @addtogroup SMARTCARDEx_Exported_Functions_Group1 Extended Peripheral Control functions
Kojto 93:e188a91d3eaa 202 * @{
Kojto 93:e188a91d3eaa 203 */
Kojto 93:e188a91d3eaa 204 void HAL_SMARTCARDEx_BlockLength_Config(SMARTCARD_HandleTypeDef *hsmartcard, uint8_t BlockLength);
Kojto 93:e188a91d3eaa 205 void HAL_SMARTCARDEx_TimeOut_Config(SMARTCARD_HandleTypeDef *hsmartcard, uint32_t TimeOutValue);
Kojto 93:e188a91d3eaa 206 HAL_StatusTypeDef HAL_SMARTCARDEx_EnableReceiverTimeOut(SMARTCARD_HandleTypeDef *hsmartcard);
Kojto 93:e188a91d3eaa 207 HAL_StatusTypeDef HAL_SMARTCARDEx_DisableReceiverTimeOut(SMARTCARD_HandleTypeDef *hsmartcard);
Kojto 93:e188a91d3eaa 208
Kojto 93:e188a91d3eaa 209 /* Peripheral State and Error functions ***************************************/
Kojto 93:e188a91d3eaa 210
Kojto 93:e188a91d3eaa 211 /**
Kojto 93:e188a91d3eaa 212 * @}
Kojto 93:e188a91d3eaa 213 */
Kojto 93:e188a91d3eaa 214
Kojto 93:e188a91d3eaa 215 /**
Kojto 93:e188a91d3eaa 216 * @}
Kojto 93:e188a91d3eaa 217 */
Kojto 93:e188a91d3eaa 218
Kojto 93:e188a91d3eaa 219 /**
Kojto 93:e188a91d3eaa 220 * @}
Kojto 93:e188a91d3eaa 221 */
Kojto 93:e188a91d3eaa 222
Kojto 93:e188a91d3eaa 223 /**
Kojto 93:e188a91d3eaa 224 * @}
Kojto 93:e188a91d3eaa 225 */
Kojto 93:e188a91d3eaa 226
Kojto 93:e188a91d3eaa 227 #ifdef __cplusplus
Kojto 93:e188a91d3eaa 228 }
Kojto 93:e188a91d3eaa 229 #endif
Kojto 93:e188a91d3eaa 230
Kojto 93:e188a91d3eaa 231 #endif /* __STM32F3xx_HAL_SMARTCARD_EX_H */
Kojto 93:e188a91d3eaa 232
Kojto 93:e188a91d3eaa 233 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/