mbed library sources

Fork of mbed-src by mbed official

Committer:
moirans2
Date:
Wed Jan 14 20:53:08 2015 +0000
Revision:
445:9a3ffe6cfa19
Parent:
441:d2c15dda23c1
internal clock stm32L051

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 340:28d1f895c6fe 1 /**
mbed_official 340:28d1f895c6fe 2 ******************************************************************************
mbed_official 340:28d1f895c6fe 3 * @file stm32f0xx_hal_smartcard.h
mbed_official 340:28d1f895c6fe 4 * @author MCD Application Team
mbed_official 441:d2c15dda23c1 5 * @version V1.2.0
mbed_official 441:d2c15dda23c1 6 * @date 11-December-2014
mbed_official 340:28d1f895c6fe 7 * @brief Header file of SMARTCARD HAL module.
mbed_official 340:28d1f895c6fe 8 ******************************************************************************
mbed_official 340:28d1f895c6fe 9 * @attention
mbed_official 340:28d1f895c6fe 10 *
mbed_official 340:28d1f895c6fe 11 * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
mbed_official 340:28d1f895c6fe 12 *
mbed_official 340:28d1f895c6fe 13 * Redistribution and use in source and binary forms, with or without modification,
mbed_official 340:28d1f895c6fe 14 * are permitted provided that the following conditions are met:
mbed_official 340:28d1f895c6fe 15 * 1. Redistributions of source code must retain the above copyright notice,
mbed_official 340:28d1f895c6fe 16 * this list of conditions and the following disclaimer.
mbed_official 340:28d1f895c6fe 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
mbed_official 340:28d1f895c6fe 18 * this list of conditions and the following disclaimer in the documentation
mbed_official 340:28d1f895c6fe 19 * and/or other materials provided with the distribution.
mbed_official 340:28d1f895c6fe 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
mbed_official 340:28d1f895c6fe 21 * may be used to endorse or promote products derived from this software
mbed_official 340:28d1f895c6fe 22 * without specific prior written permission.
mbed_official 340:28d1f895c6fe 23 *
mbed_official 340:28d1f895c6fe 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
mbed_official 340:28d1f895c6fe 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
mbed_official 340:28d1f895c6fe 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
mbed_official 340:28d1f895c6fe 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
mbed_official 340:28d1f895c6fe 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
mbed_official 340:28d1f895c6fe 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
mbed_official 340:28d1f895c6fe 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
mbed_official 340:28d1f895c6fe 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
mbed_official 340:28d1f895c6fe 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
mbed_official 340:28d1f895c6fe 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
mbed_official 340:28d1f895c6fe 34 *
mbed_official 340:28d1f895c6fe 35 ******************************************************************************
mbed_official 340:28d1f895c6fe 36 */
mbed_official 340:28d1f895c6fe 37
mbed_official 340:28d1f895c6fe 38 /* Define to prevent recursive inclusion -------------------------------------*/
mbed_official 340:28d1f895c6fe 39 #ifndef __STM32F0xx_HAL_SMARTCARD_H
mbed_official 340:28d1f895c6fe 40 #define __STM32F0xx_HAL_SMARTCARD_H
mbed_official 340:28d1f895c6fe 41
mbed_official 340:28d1f895c6fe 42 #ifdef __cplusplus
mbed_official 340:28d1f895c6fe 43 extern "C" {
mbed_official 340:28d1f895c6fe 44 #endif
mbed_official 340:28d1f895c6fe 45
mbed_official 441:d2c15dda23c1 46 #if !defined(STM32F030x6) && !defined(STM32F030x8) && !defined(STM32F070x6) && !defined(STM32F070xB) && !defined(STM32F030xC)
mbed_official 340:28d1f895c6fe 47
mbed_official 340:28d1f895c6fe 48 /* Includes ------------------------------------------------------------------*/
mbed_official 340:28d1f895c6fe 49 #include "stm32f0xx_hal_def.h"
mbed_official 340:28d1f895c6fe 50
mbed_official 340:28d1f895c6fe 51 /** @addtogroup STM32F0xx_HAL_Driver
mbed_official 340:28d1f895c6fe 52 * @{
mbed_official 340:28d1f895c6fe 53 */
mbed_official 340:28d1f895c6fe 54
mbed_official 340:28d1f895c6fe 55 /** @addtogroup SMARTCARD
mbed_official 340:28d1f895c6fe 56 * @{
mbed_official 340:28d1f895c6fe 57 */
mbed_official 340:28d1f895c6fe 58
mbed_official 340:28d1f895c6fe 59 /* Exported types ------------------------------------------------------------*/
mbed_official 340:28d1f895c6fe 60 /** @defgroup SMARTCARD_Exported_Types SMARTCARD Exported Types
mbed_official 340:28d1f895c6fe 61 * @{
mbed_official 340:28d1f895c6fe 62 */
mbed_official 340:28d1f895c6fe 63
mbed_official 340:28d1f895c6fe 64
mbed_official 340:28d1f895c6fe 65 /**
mbed_official 340:28d1f895c6fe 66 * @brief SMARTCARD Init Structure definition
mbed_official 340:28d1f895c6fe 67 */
mbed_official 340:28d1f895c6fe 68 typedef struct
mbed_official 340:28d1f895c6fe 69 {
mbed_official 340:28d1f895c6fe 70 uint32_t BaudRate; /*!< Configures the SmartCard communication baud rate.
mbed_official 340:28d1f895c6fe 71 The baud rate register is computed using the following formula:
mbed_official 340:28d1f895c6fe 72 Baud Rate Register = ((PCLKx) / ((hsmartcard->Init.BaudRate))) */
mbed_official 340:28d1f895c6fe 73
mbed_official 340:28d1f895c6fe 74 uint32_t WordLength; /*!< Specifies the number of data bits transmitted or received in a frame.
mbed_official 340:28d1f895c6fe 75 This parameter @ref SMARTCARD_Word_Length can only be set to 9 (8 data + 1 parity bits). */
mbed_official 340:28d1f895c6fe 76
mbed_official 340:28d1f895c6fe 77 uint32_t StopBits; /*!< Specifies the number of stop bits @ref SMARTCARD_Stop_Bits.
mbed_official 340:28d1f895c6fe 78 Only 1.5 stop bits are authorized in SmartCard mode. */
mbed_official 340:28d1f895c6fe 79
mbed_official 340:28d1f895c6fe 80 uint16_t Parity; /*!< Specifies the parity mode.
mbed_official 340:28d1f895c6fe 81 This parameter can be a value of @ref SMARTCARD_Parity
mbed_official 340:28d1f895c6fe 82 @note The parity is enabled by default (PCE is forced to 1).
mbed_official 340:28d1f895c6fe 83 Since the WordLength is forced to 8 bits + parity, M is
mbed_official 340:28d1f895c6fe 84 forced to 1 and the parity bit is the 9th bit. */
mbed_official 340:28d1f895c6fe 85
mbed_official 340:28d1f895c6fe 86 uint16_t Mode; /*!< Specifies whether the Receive or Transmit mode is enabled or disabled.
mbed_official 340:28d1f895c6fe 87 This parameter can be a value of @ref SMARTCARD_Mode */
mbed_official 340:28d1f895c6fe 88
mbed_official 340:28d1f895c6fe 89 uint16_t CLKPolarity; /*!< Specifies the steady state of the serial clock.
mbed_official 340:28d1f895c6fe 90 This parameter can be a value of @ref SMARTCARD_Clock_Polarity */
mbed_official 340:28d1f895c6fe 91
mbed_official 340:28d1f895c6fe 92 uint16_t CLKPhase; /*!< Specifies the clock transition on which the bit capture is made.
mbed_official 340:28d1f895c6fe 93 This parameter can be a value of @ref SMARTCARD_Clock_Phase */
mbed_official 340:28d1f895c6fe 94
mbed_official 340:28d1f895c6fe 95 uint16_t CLKLastBit; /*!< Specifies whether the clock pulse corresponding to the last transmitted
mbed_official 340:28d1f895c6fe 96 data bit (MSB) has to be output on the SCLK pin in synchronous mode.
mbed_official 340:28d1f895c6fe 97 This parameter can be a value of @ref SMARTCARD_Last_Bit */
mbed_official 340:28d1f895c6fe 98
mbed_official 340:28d1f895c6fe 99 uint16_t OneBitSampling; /*!< Specifies whether a single sample or three samples' majority vote is selected.
mbed_official 340:28d1f895c6fe 100 Selecting the single sample method increases the receiver tolerance to clock
mbed_official 340:28d1f895c6fe 101 deviations. This parameter can be a value of @ref SMARTCARD_OneBit_Sampling. */
mbed_official 340:28d1f895c6fe 102
mbed_official 340:28d1f895c6fe 103 uint8_t Prescaler; /*!< Specifies the SmartCard Prescaler */
mbed_official 340:28d1f895c6fe 104
mbed_official 340:28d1f895c6fe 105 uint8_t GuardTime; /*!< Specifies the SmartCard Guard Time */
mbed_official 340:28d1f895c6fe 106
mbed_official 340:28d1f895c6fe 107 uint16_t NACKEnable; /*!< Specifies whether the SmartCard NACK transmission is enabled
mbed_official 340:28d1f895c6fe 108 in case of parity error.
mbed_official 441:d2c15dda23c1 109 This parameter can be a value of @ref SMARTCARD_NACK_Enable */
mbed_official 340:28d1f895c6fe 110
mbed_official 340:28d1f895c6fe 111 uint32_t TimeOutEnable; /*!< Specifies whether the receiver timeout is enabled.
mbed_official 340:28d1f895c6fe 112 This parameter can be a value of @ref SMARTCARD_Timeout_Enable*/
mbed_official 340:28d1f895c6fe 113
mbed_official 340:28d1f895c6fe 114 uint32_t TimeOutValue; /*!< Specifies the receiver time out value in number of baud blocks:
mbed_official 340:28d1f895c6fe 115 it is used to implement the Character Wait Time (CWT) and
mbed_official 340:28d1f895c6fe 116 Block Wait Time (BWT). It is coded over 24 bits. */
mbed_official 340:28d1f895c6fe 117
mbed_official 340:28d1f895c6fe 118 uint8_t BlockLength; /*!< Specifies the SmartCard Block Length in T=1 Reception mode.
mbed_official 340:28d1f895c6fe 119 This parameter can be any value from 0x0 to 0xFF */
mbed_official 340:28d1f895c6fe 120
mbed_official 340:28d1f895c6fe 121 uint8_t AutoRetryCount; /*!< Specifies the SmartCard auto-retry count (number of retries in
mbed_official 340:28d1f895c6fe 122 receive and transmit mode). When set to 0, retransmission is
mbed_official 340:28d1f895c6fe 123 disabled. Otherwise, its maximum value is 7 (before signalling
mbed_official 340:28d1f895c6fe 124 an error) */
mbed_official 340:28d1f895c6fe 125
mbed_official 340:28d1f895c6fe 126 }SMARTCARD_InitTypeDef;
mbed_official 340:28d1f895c6fe 127
mbed_official 340:28d1f895c6fe 128 /**
mbed_official 340:28d1f895c6fe 129 * @brief SMARTCARD advanced features initalization structure definition
mbed_official 340:28d1f895c6fe 130 */
mbed_official 340:28d1f895c6fe 131 typedef struct
mbed_official 340:28d1f895c6fe 132 {
mbed_official 340:28d1f895c6fe 133 uint32_t AdvFeatureInit; /*!< Specifies which advanced SMARTCARD features is initialized. Several
mbed_official 340:28d1f895c6fe 134 advanced features may be initialized at the same time. This parameter
mbed_official 340:28d1f895c6fe 135 can be a value of @ref SMARTCARD_Advanced_Features_Initialization_Type */
mbed_official 340:28d1f895c6fe 136
mbed_official 340:28d1f895c6fe 137 uint32_t TxPinLevelInvert; /*!< Specifies whether the TX pin active level is inverted.
mbed_official 340:28d1f895c6fe 138 This parameter can be a value of @ref SMARTCARD_Tx_Inv */
mbed_official 340:28d1f895c6fe 139
mbed_official 340:28d1f895c6fe 140 uint32_t RxPinLevelInvert; /*!< Specifies whether the RX pin active level is inverted.
mbed_official 340:28d1f895c6fe 141 This parameter can be a value of @ref SMARTCARD_Rx_Inv */
mbed_official 340:28d1f895c6fe 142
mbed_official 340:28d1f895c6fe 143 uint32_t DataInvert; /*!< Specifies whether data are inverted (positive/direct logic
mbed_official 340:28d1f895c6fe 144 vs negative/inverted logic).
mbed_official 340:28d1f895c6fe 145 This parameter can be a value of @ref SMARTCARD_Data_Inv */
mbed_official 340:28d1f895c6fe 146
mbed_official 340:28d1f895c6fe 147 uint32_t Swap; /*!< Specifies whether TX and RX pins are swapped.
mbed_official 340:28d1f895c6fe 148 This parameter can be a value of @ref SMARTCARD_Rx_Tx_Swap */
mbed_official 340:28d1f895c6fe 149
mbed_official 340:28d1f895c6fe 150 uint32_t OverrunDisable; /*!< Specifies whether the reception overrun detection is disabled.
mbed_official 340:28d1f895c6fe 151 This parameter can be a value of @ref SMARTCARD_Overrun_Disable */
mbed_official 340:28d1f895c6fe 152
mbed_official 340:28d1f895c6fe 153 uint32_t DMADisableonRxError; /*!< Specifies whether the DMA is disabled in case of reception error.
mbed_official 340:28d1f895c6fe 154 This parameter can be a value of @ref SMARTCARD_DMA_Disable_on_Rx_Error */
mbed_official 340:28d1f895c6fe 155
mbed_official 340:28d1f895c6fe 156 uint32_t MSBFirst; /*!< Specifies whether MSB is sent first on UART line.
mbed_official 340:28d1f895c6fe 157 This parameter can be a value of @ref SMARTCARD_MSB_First */
mbed_official 340:28d1f895c6fe 158 }SMARTCARD_AdvFeatureInitTypeDef;
mbed_official 340:28d1f895c6fe 159
mbed_official 340:28d1f895c6fe 160 /**
mbed_official 340:28d1f895c6fe 161 * @brief HAL State structures definition
mbed_official 340:28d1f895c6fe 162 */
mbed_official 340:28d1f895c6fe 163 typedef enum
mbed_official 340:28d1f895c6fe 164 {
mbed_official 340:28d1f895c6fe 165 HAL_SMARTCARD_STATE_RESET = 0x00, /*!< Peripheral is not initialized */
mbed_official 340:28d1f895c6fe 166 HAL_SMARTCARD_STATE_READY = 0x01, /*!< Peripheral Initialized and ready for use */
mbed_official 340:28d1f895c6fe 167 HAL_SMARTCARD_STATE_BUSY = 0x02, /*!< an internal process is ongoing */
mbed_official 340:28d1f895c6fe 168 HAL_SMARTCARD_STATE_BUSY_TX = 0x12, /*!< Data Transmission process is ongoing */
mbed_official 340:28d1f895c6fe 169 HAL_SMARTCARD_STATE_BUSY_RX = 0x22, /*!< Data Reception process is ongoing */
mbed_official 340:28d1f895c6fe 170 HAL_SMARTCARD_STATE_BUSY_TX_RX = 0x32, /*!< Data Transmission and Reception process is ongoing */
mbed_official 340:28d1f895c6fe 171 HAL_SMARTCARD_STATE_TIMEOUT = 0x03, /*!< Timeout state */
mbed_official 340:28d1f895c6fe 172 HAL_SMARTCARD_STATE_ERROR = 0x04 /*!< Error */
mbed_official 340:28d1f895c6fe 173 }HAL_SMARTCARD_StateTypeDef;
mbed_official 340:28d1f895c6fe 174
mbed_official 340:28d1f895c6fe 175 /**
mbed_official 340:28d1f895c6fe 176 * @brief SMARTCARD clock sources
mbed_official 340:28d1f895c6fe 177 */
mbed_official 340:28d1f895c6fe 178 typedef enum
mbed_official 340:28d1f895c6fe 179 {
mbed_official 340:28d1f895c6fe 180 SMARTCARD_CLOCKSOURCE_PCLK1 = 0x00, /*!< PCLK1 clock source */
mbed_official 340:28d1f895c6fe 181 SMARTCARD_CLOCKSOURCE_HSI = 0x02, /*!< HSI clock source */
mbed_official 340:28d1f895c6fe 182 SMARTCARD_CLOCKSOURCE_SYSCLK = 0x04, /*!< SYSCLK clock source */
mbed_official 340:28d1f895c6fe 183 SMARTCARD_CLOCKSOURCE_LSE = 0x08, /*!< LSE clock source */
mbed_official 340:28d1f895c6fe 184 SMARTCARD_CLOCKSOURCE_UNDEFINED = 0x10 /*!< undefined clock source */
mbed_official 340:28d1f895c6fe 185 }SMARTCARD_ClockSourceTypeDef;
mbed_official 340:28d1f895c6fe 186
mbed_official 340:28d1f895c6fe 187 /**
mbed_official 340:28d1f895c6fe 188 * @brief SMARTCARD handle Structure definition
mbed_official 340:28d1f895c6fe 189 */
mbed_official 340:28d1f895c6fe 190 typedef struct
mbed_official 340:28d1f895c6fe 191 {
mbed_official 441:d2c15dda23c1 192 USART_TypeDef *Instance; /*!< USART registers base address */
mbed_official 340:28d1f895c6fe 193
mbed_official 441:d2c15dda23c1 194 SMARTCARD_InitTypeDef Init; /*!< SmartCard communication parameters */
mbed_official 340:28d1f895c6fe 195
mbed_official 441:d2c15dda23c1 196 SMARTCARD_AdvFeatureInitTypeDef AdvancedInit; /*!< SmartCard advanced features initialization parameters */
mbed_official 340:28d1f895c6fe 197
mbed_official 441:d2c15dda23c1 198 uint8_t *pTxBuffPtr; /*!< Pointer to SmartCard Tx transfer Buffer */
mbed_official 340:28d1f895c6fe 199
mbed_official 441:d2c15dda23c1 200 uint16_t TxXferSize; /*!< SmartCard Tx Transfer size */
mbed_official 340:28d1f895c6fe 201
mbed_official 441:d2c15dda23c1 202 uint16_t TxXferCount; /*!< SmartCard Tx Transfer Counter */
mbed_official 340:28d1f895c6fe 203
mbed_official 441:d2c15dda23c1 204 uint8_t *pRxBuffPtr; /*!< Pointer to SmartCard Rx transfer Buffer */
mbed_official 340:28d1f895c6fe 205
mbed_official 441:d2c15dda23c1 206 uint16_t RxXferSize; /*!< SmartCard Rx Transfer size */
mbed_official 340:28d1f895c6fe 207
mbed_official 441:d2c15dda23c1 208 uint16_t RxXferCount; /*!< SmartCard Rx Transfer Counter */
mbed_official 340:28d1f895c6fe 209
mbed_official 441:d2c15dda23c1 210 DMA_HandleTypeDef *hdmatx; /*!< SmartCard Tx DMA Handle parameters */
mbed_official 340:28d1f895c6fe 211
mbed_official 441:d2c15dda23c1 212 DMA_HandleTypeDef *hdmarx; /*!< SmartCard Rx DMA Handle parameters */
mbed_official 340:28d1f895c6fe 213
mbed_official 441:d2c15dda23c1 214 HAL_LockTypeDef Lock; /*!< Locking object */
mbed_official 340:28d1f895c6fe 215
mbed_official 441:d2c15dda23c1 216 HAL_SMARTCARD_StateTypeDef State; /*!< SmartCard communication state */
mbed_official 340:28d1f895c6fe 217
mbed_official 441:d2c15dda23c1 218 __IO uint32_t ErrorCode; /*!< SmartCard Error code
mbed_official 441:d2c15dda23c1 219 This parameter can be a value of @ref SMARTCARD_Error */
mbed_official 340:28d1f895c6fe 220
mbed_official 340:28d1f895c6fe 221 }SMARTCARD_HandleTypeDef;
mbed_official 340:28d1f895c6fe 222
mbed_official 340:28d1f895c6fe 223 /**
mbed_official 340:28d1f895c6fe 224 * @}
mbed_official 340:28d1f895c6fe 225 */
mbed_official 340:28d1f895c6fe 226
mbed_official 340:28d1f895c6fe 227 /* Exported constants --------------------------------------------------------*/
mbed_official 340:28d1f895c6fe 228 /** @defgroup SMARTCARD_Exported_Constants SMARTCARD Exported constants
mbed_official 340:28d1f895c6fe 229 * @{
mbed_official 340:28d1f895c6fe 230 */
mbed_official 340:28d1f895c6fe 231
mbed_official 441:d2c15dda23c1 232 /** @defgroup SMARTCARD_Error SMARTCARD Error
mbed_official 441:d2c15dda23c1 233 * @{
mbed_official 441:d2c15dda23c1 234 */
mbed_official 441:d2c15dda23c1 235 #define HAL_SMARTCARD_ERROR_NONE ((uint32_t)0x00000000) /*!< No error */
mbed_official 441:d2c15dda23c1 236 #define HAL_SMARTCARD_ERROR_PE ((uint32_t)0x00000001) /*!< Parity error */
mbed_official 441:d2c15dda23c1 237 #define HAL_SMARTCARD_ERROR_NE ((uint32_t)0x00000002) /*!< Noise error */
mbed_official 441:d2c15dda23c1 238 #define HAL_SMARTCARD_ERROR_FE ((uint32_t)0x00000004) /*!< frame error */
mbed_official 441:d2c15dda23c1 239 #define HAL_SMARTCARD_ERROR_ORE ((uint32_t)0x00000008) /*!< Overrun error */
mbed_official 441:d2c15dda23c1 240 #define HAL_SMARTCARD_ERROR_DMA ((uint32_t)0x00000010) /*!< DMA transfer error */
mbed_official 441:d2c15dda23c1 241 #define HAL_SMARTCARD_ERROR_RTO ((uint32_t)0x00000020) /*!< Receiver TimeOut error */
mbed_official 441:d2c15dda23c1 242 /**
mbed_official 441:d2c15dda23c1 243 * @}
mbed_official 441:d2c15dda23c1 244 */
mbed_official 441:d2c15dda23c1 245
mbed_official 340:28d1f895c6fe 246 /** @defgroup SMARTCARD_Word_Length SMARTCARD Word Length
mbed_official 340:28d1f895c6fe 247 * @{
mbed_official 340:28d1f895c6fe 248 */
mbed_official 340:28d1f895c6fe 249 #define SMARTCARD_WORDLENGTH_9B ((uint32_t)USART_CR1_M0)
mbed_official 340:28d1f895c6fe 250 #define IS_SMARTCARD_WORD_LENGTH(LENGTH) ((LENGTH) == SMARTCARD_WORDLENGTH_9B)
mbed_official 340:28d1f895c6fe 251 /**
mbed_official 340:28d1f895c6fe 252 * @}
mbed_official 340:28d1f895c6fe 253 */
mbed_official 340:28d1f895c6fe 254
mbed_official 340:28d1f895c6fe 255 /** @defgroup SMARTCARD_Stop_Bits SMARTCARD Stop Bits
mbed_official 340:28d1f895c6fe 256 * @{
mbed_official 340:28d1f895c6fe 257 */
mbed_official 340:28d1f895c6fe 258 #define SMARTCARD_STOPBITS_1_5 ((uint32_t)(USART_CR2_STOP))
mbed_official 340:28d1f895c6fe 259 #define IS_SMARTCARD_STOPBITS(STOPBITS) ((STOPBITS) == SMARTCARD_STOPBITS_1_5)
mbed_official 340:28d1f895c6fe 260 /**
mbed_official 340:28d1f895c6fe 261 * @}
mbed_official 340:28d1f895c6fe 262 */
mbed_official 340:28d1f895c6fe 263
mbed_official 340:28d1f895c6fe 264 /** @defgroup SMARTCARD_Parity SMARTCARD Parity
mbed_official 340:28d1f895c6fe 265 * @{
mbed_official 340:28d1f895c6fe 266 */
mbed_official 340:28d1f895c6fe 267 #define SMARTCARD_PARITY_EVEN ((uint16_t)USART_CR1_PCE)
mbed_official 340:28d1f895c6fe 268 #define SMARTCARD_PARITY_ODD ((uint16_t)(USART_CR1_PCE | USART_CR1_PS))
mbed_official 340:28d1f895c6fe 269 #define IS_SMARTCARD_PARITY(PARITY) (((PARITY) == SMARTCARD_PARITY_EVEN) || \
mbed_official 340:28d1f895c6fe 270 ((PARITY) == SMARTCARD_PARITY_ODD))
mbed_official 340:28d1f895c6fe 271 /**
mbed_official 340:28d1f895c6fe 272 * @}
mbed_official 340:28d1f895c6fe 273 */
mbed_official 340:28d1f895c6fe 274
mbed_official 340:28d1f895c6fe 275 /** @defgroup SMARTCARD_Mode SMARTCARD Transfer Mode
mbed_official 340:28d1f895c6fe 276 * @{
mbed_official 340:28d1f895c6fe 277 */
mbed_official 340:28d1f895c6fe 278 #define SMARTCARD_MODE_RX ((uint16_t)USART_CR1_RE)
mbed_official 340:28d1f895c6fe 279 #define SMARTCARD_MODE_TX ((uint16_t)USART_CR1_TE)
mbed_official 340:28d1f895c6fe 280 #define SMARTCARD_MODE_TX_RX ((uint16_t)(USART_CR1_TE |USART_CR1_RE))
mbed_official 340:28d1f895c6fe 281 #define IS_SMARTCARD_MODE(MODE) ((((MODE) & (uint16_t)0xFFF3) == 0x00) && ((MODE) != (uint16_t)0x00))
mbed_official 340:28d1f895c6fe 282 /**
mbed_official 340:28d1f895c6fe 283 * @}
mbed_official 340:28d1f895c6fe 284 */
mbed_official 340:28d1f895c6fe 285
mbed_official 340:28d1f895c6fe 286 /** @defgroup SMARTCARD_Clock_Polarity SMARTCARD Clock Polarity
mbed_official 340:28d1f895c6fe 287 * @{
mbed_official 340:28d1f895c6fe 288 */
mbed_official 340:28d1f895c6fe 289 #define SMARTCARD_POLARITY_LOW ((uint16_t)0x0000)
mbed_official 340:28d1f895c6fe 290 #define SMARTCARD_POLARITY_HIGH ((uint16_t)USART_CR2_CPOL)
mbed_official 340:28d1f895c6fe 291 #define IS_SMARTCARD_POLARITY(CPOL) (((CPOL) == SMARTCARD_POLARITY_LOW) || ((CPOL) == SMARTCARD_POLARITY_HIGH))
mbed_official 340:28d1f895c6fe 292 /**
mbed_official 340:28d1f895c6fe 293 * @}
mbed_official 340:28d1f895c6fe 294 */
mbed_official 340:28d1f895c6fe 295
mbed_official 340:28d1f895c6fe 296 /** @defgroup SMARTCARD_Clock_Phase SMARTCARD Clock Phase
mbed_official 340:28d1f895c6fe 297 * @{
mbed_official 340:28d1f895c6fe 298 */
mbed_official 340:28d1f895c6fe 299 #define SMARTCARD_PHASE_1EDGE ((uint16_t)0x0000)
mbed_official 340:28d1f895c6fe 300 #define SMARTCARD_PHASE_2EDGE ((uint16_t)USART_CR2_CPHA)
mbed_official 340:28d1f895c6fe 301 #define IS_SMARTCARD_PHASE(CPHA) (((CPHA) == SMARTCARD_PHASE_1EDGE) || ((CPHA) == SMARTCARD_PHASE_2EDGE))
mbed_official 340:28d1f895c6fe 302 /**
mbed_official 340:28d1f895c6fe 303 * @}
mbed_official 340:28d1f895c6fe 304 */
mbed_official 340:28d1f895c6fe 305
mbed_official 340:28d1f895c6fe 306 /** @defgroup SMARTCARD_Last_Bit SMARTCARD Last Bit
mbed_official 340:28d1f895c6fe 307 * @{
mbed_official 340:28d1f895c6fe 308 */
mbed_official 340:28d1f895c6fe 309 #define SMARTCARD_LASTBIT_DISABLED ((uint16_t)0x0000)
mbed_official 340:28d1f895c6fe 310 #define SMARTCARD_LASTBIT_ENABLED ((uint16_t)USART_CR2_LBCL)
mbed_official 340:28d1f895c6fe 311 #define IS_SMARTCARD_LASTBIT(LASTBIT) (((LASTBIT) == SMARTCARD_LASTBIT_DISABLED) || \
mbed_official 340:28d1f895c6fe 312 ((LASTBIT) == SMARTCARD_LASTBIT_ENABLED))
mbed_official 340:28d1f895c6fe 313 /**
mbed_official 340:28d1f895c6fe 314 * @}
mbed_official 340:28d1f895c6fe 315 */
mbed_official 340:28d1f895c6fe 316
mbed_official 340:28d1f895c6fe 317 /** @defgroup SMARTCARD_OneBit_Sampling SMARTCARD One Bit Sampling Method
mbed_official 340:28d1f895c6fe 318 * @{
mbed_official 340:28d1f895c6fe 319 */
mbed_official 340:28d1f895c6fe 320 #define SMARTCARD_ONEBIT_SAMPLING_DISABLED ((uint16_t)0x0000)
mbed_official 340:28d1f895c6fe 321 #define SMARTCARD_ONEBIT_SAMPLING_ENABLED ((uint16_t)USART_CR3_ONEBIT)
mbed_official 340:28d1f895c6fe 322 #define IS_SMARTCARD_ONEBIT_SAMPLING(ONEBIT) (((ONEBIT) == SMARTCARD_ONEBIT_SAMPLING_DISABLED) || \
mbed_official 340:28d1f895c6fe 323 ((ONEBIT) == SMARTCARD_ONEBIT_SAMPLING_ENABLED))
mbed_official 340:28d1f895c6fe 324 /**
mbed_official 340:28d1f895c6fe 325 * @}
mbed_official 340:28d1f895c6fe 326 */
mbed_official 340:28d1f895c6fe 327
mbed_official 441:d2c15dda23c1 328
mbed_official 441:d2c15dda23c1 329 /** @defgroup SMARTCARD_NACK_Enable SMARTCARD NACK Enable
mbed_official 340:28d1f895c6fe 330 * @{
mbed_official 340:28d1f895c6fe 331 */
mbed_official 340:28d1f895c6fe 332 #define SMARTCARD_NACK_ENABLED ((uint16_t)USART_CR3_NACK)
mbed_official 340:28d1f895c6fe 333 #define SMARTCARD_NACK_DISABLED ((uint16_t)0x0000)
mbed_official 340:28d1f895c6fe 334 #define IS_SMARTCARD_NACK(NACK) (((NACK) == SMARTCARD_NACK_ENABLED) || \
mbed_official 340:28d1f895c6fe 335 ((NACK) == SMARTCARD_NACK_DISABLED))
mbed_official 340:28d1f895c6fe 336 /**
mbed_official 340:28d1f895c6fe 337 * @}
mbed_official 340:28d1f895c6fe 338 */
mbed_official 340:28d1f895c6fe 339
mbed_official 340:28d1f895c6fe 340 /** @defgroup SMARTCARD_Timeout_Enable SMARTCARD Timeout Enable
mbed_official 340:28d1f895c6fe 341 * @{
mbed_official 340:28d1f895c6fe 342 */
mbed_official 340:28d1f895c6fe 343 #define SMARTCARD_TIMEOUT_DISABLED ((uint32_t)0x00000000)
mbed_official 340:28d1f895c6fe 344 #define SMARTCARD_TIMEOUT_ENABLED ((uint32_t)USART_CR2_RTOEN)
mbed_official 340:28d1f895c6fe 345 #define IS_SMARTCARD_TIMEOUT(TIMEOUT) (((TIMEOUT) == SMARTCARD_TIMEOUT_DISABLED) || \
mbed_official 340:28d1f895c6fe 346 ((TIMEOUT) == SMARTCARD_TIMEOUT_ENABLED))
mbed_official 340:28d1f895c6fe 347 /**
mbed_official 340:28d1f895c6fe 348 * @}
mbed_official 340:28d1f895c6fe 349 */
mbed_official 340:28d1f895c6fe 350
mbed_official 340:28d1f895c6fe 351 /** @defgroup SMARTCARD_Advanced_Features_Initialization_Type SMARTCARD advanced feature initialization type
mbed_official 340:28d1f895c6fe 352 * @{
mbed_official 340:28d1f895c6fe 353 */
mbed_official 340:28d1f895c6fe 354 #define SMARTCARD_ADVFEATURE_NO_INIT ((uint32_t)0x00000000)
mbed_official 340:28d1f895c6fe 355 #define SMARTCARD_ADVFEATURE_TXINVERT_INIT ((uint32_t)0x00000001)
mbed_official 340:28d1f895c6fe 356 #define SMARTCARD_ADVFEATURE_RXINVERT_INIT ((uint32_t)0x00000002)
mbed_official 340:28d1f895c6fe 357 #define SMARTCARD_ADVFEATURE_DATAINVERT_INIT ((uint32_t)0x00000004)
mbed_official 340:28d1f895c6fe 358 #define SMARTCARD_ADVFEATURE_SWAP_INIT ((uint32_t)0x00000008)
mbed_official 340:28d1f895c6fe 359 #define SMARTCARD_ADVFEATURE_RXOVERRUNDISABLE_INIT ((uint32_t)0x00000010)
mbed_official 340:28d1f895c6fe 360 #define SMARTCARD_ADVFEATURE_DMADISABLEONERROR_INIT ((uint32_t)0x00000020)
mbed_official 340:28d1f895c6fe 361 #define SMARTCARD_ADVFEATURE_MSBFIRST_INIT ((uint32_t)0x00000080)
mbed_official 340:28d1f895c6fe 362 #define IS_SMARTCARD_ADVFEATURE_INIT(INIT) ((INIT) <= (SMARTCARD_ADVFEATURE_NO_INIT | \
mbed_official 340:28d1f895c6fe 363 SMARTCARD_ADVFEATURE_TXINVERT_INIT | \
mbed_official 340:28d1f895c6fe 364 SMARTCARD_ADVFEATURE_RXINVERT_INIT | \
mbed_official 340:28d1f895c6fe 365 SMARTCARD_ADVFEATURE_DATAINVERT_INIT | \
mbed_official 340:28d1f895c6fe 366 SMARTCARD_ADVFEATURE_SWAP_INIT | \
mbed_official 340:28d1f895c6fe 367 SMARTCARD_ADVFEATURE_RXOVERRUNDISABLE_INIT | \
mbed_official 340:28d1f895c6fe 368 SMARTCARD_ADVFEATURE_DMADISABLEONERROR_INIT | \
mbed_official 340:28d1f895c6fe 369 SMARTCARD_ADVFEATURE_MSBFIRST_INIT))
mbed_official 340:28d1f895c6fe 370 /**
mbed_official 340:28d1f895c6fe 371 * @}
mbed_official 340:28d1f895c6fe 372 */
mbed_official 340:28d1f895c6fe 373
mbed_official 340:28d1f895c6fe 374 /** @defgroup SMARTCARD_Tx_Inv SMARTCARD advanced feature TX pin active level inversion
mbed_official 340:28d1f895c6fe 375 * @{
mbed_official 340:28d1f895c6fe 376 */
mbed_official 340:28d1f895c6fe 377 #define SMARTCARD_ADVFEATURE_TXINV_DISABLE ((uint32_t)0x00000000)
mbed_official 340:28d1f895c6fe 378 #define SMARTCARD_ADVFEATURE_TXINV_ENABLE ((uint32_t)USART_CR2_TXINV)
mbed_official 340:28d1f895c6fe 379 #define IS_SMARTCARD_ADVFEATURE_TXINV(TXINV) (((TXINV) == SMARTCARD_ADVFEATURE_TXINV_DISABLE) || \
mbed_official 340:28d1f895c6fe 380 ((TXINV) == SMARTCARD_ADVFEATURE_TXINV_ENABLE))
mbed_official 340:28d1f895c6fe 381 /**
mbed_official 340:28d1f895c6fe 382 * @}
mbed_official 340:28d1f895c6fe 383 */
mbed_official 340:28d1f895c6fe 384
mbed_official 340:28d1f895c6fe 385 /** @defgroup SMARTCARD_Rx_Inv SMARTCARD advanced feature RX pin active level inversion
mbed_official 340:28d1f895c6fe 386 * @{
mbed_official 340:28d1f895c6fe 387 */
mbed_official 340:28d1f895c6fe 388 #define SMARTCARD_ADVFEATURE_RXINV_DISABLE ((uint32_t)0x00000000)
mbed_official 340:28d1f895c6fe 389 #define SMARTCARD_ADVFEATURE_RXINV_ENABLE ((uint32_t)USART_CR2_RXINV)
mbed_official 340:28d1f895c6fe 390 #define IS_SMARTCARD_ADVFEATURE_RXINV(RXINV) (((RXINV) == SMARTCARD_ADVFEATURE_RXINV_DISABLE) || \
mbed_official 340:28d1f895c6fe 391 ((RXINV) == SMARTCARD_ADVFEATURE_RXINV_ENABLE))
mbed_official 340:28d1f895c6fe 392 /**
mbed_official 340:28d1f895c6fe 393 * @}
mbed_official 340:28d1f895c6fe 394 */
mbed_official 340:28d1f895c6fe 395
mbed_official 340:28d1f895c6fe 396 /** @defgroup SMARTCARD_Data_Inv SMARTCARD advanced feature Binary Data inversion
mbed_official 340:28d1f895c6fe 397 * @{
mbed_official 340:28d1f895c6fe 398 */
mbed_official 340:28d1f895c6fe 399 #define SMARTCARD_ADVFEATURE_DATAINV_DISABLE ((uint32_t)0x00000000)
mbed_official 340:28d1f895c6fe 400 #define SMARTCARD_ADVFEATURE_DATAINV_ENABLE ((uint32_t)USART_CR2_DATAINV)
mbed_official 340:28d1f895c6fe 401 #define IS_SMARTCARD_ADVFEATURE_DATAINV(DATAINV) (((DATAINV) == SMARTCARD_ADVFEATURE_DATAINV_DISABLE) || \
mbed_official 340:28d1f895c6fe 402 ((DATAINV) == SMARTCARD_ADVFEATURE_DATAINV_ENABLE))
mbed_official 340:28d1f895c6fe 403 /**
mbed_official 340:28d1f895c6fe 404 * @}
mbed_official 340:28d1f895c6fe 405 */
mbed_official 340:28d1f895c6fe 406
mbed_official 340:28d1f895c6fe 407 /** @defgroup SMARTCARD_Rx_Tx_Swap SMARTCARD advanced feature RX TX pins swap
mbed_official 340:28d1f895c6fe 408 * @{
mbed_official 340:28d1f895c6fe 409 */
mbed_official 340:28d1f895c6fe 410 #define SMARTCARD_ADVFEATURE_SWAP_DISABLE ((uint32_t)0x00000000)
mbed_official 340:28d1f895c6fe 411 #define SMARTCARD_ADVFEATURE_SWAP_ENABLE ((uint32_t)USART_CR2_SWAP)
mbed_official 340:28d1f895c6fe 412 #define IS_SMARTCARD_ADVFEATURE_SWAP(SWAP) (((SWAP) == SMARTCARD_ADVFEATURE_SWAP_DISABLE) || \
mbed_official 340:28d1f895c6fe 413 ((SWAP) == SMARTCARD_ADVFEATURE_SWAP_ENABLE))
mbed_official 340:28d1f895c6fe 414 /**
mbed_official 340:28d1f895c6fe 415 * @}
mbed_official 340:28d1f895c6fe 416 */
mbed_official 340:28d1f895c6fe 417
mbed_official 340:28d1f895c6fe 418 /** @defgroup SMARTCARD_Overrun_Disable SMARTCARD advanced feature Overrun Disable
mbed_official 340:28d1f895c6fe 419 * @{
mbed_official 340:28d1f895c6fe 420 */
mbed_official 340:28d1f895c6fe 421 #define SMARTCARD_ADVFEATURE_OVERRUN_ENABLE ((uint32_t)0x00000000)
mbed_official 340:28d1f895c6fe 422 #define SMARTCARD_ADVFEATURE_OVERRUN_DISABLE ((uint32_t)USART_CR3_OVRDIS)
mbed_official 340:28d1f895c6fe 423 #define IS_SMARTCARD_OVERRUN(OVERRUN) (((OVERRUN) == SMARTCARD_ADVFEATURE_OVERRUN_ENABLE) || \
mbed_official 340:28d1f895c6fe 424 ((OVERRUN) == SMARTCARD_ADVFEATURE_OVERRUN_DISABLE))
mbed_official 340:28d1f895c6fe 425 /**
mbed_official 340:28d1f895c6fe 426 * @}
mbed_official 340:28d1f895c6fe 427 */
mbed_official 340:28d1f895c6fe 428
mbed_official 340:28d1f895c6fe 429 /** @defgroup SMARTCARD_DMA_Disable_on_Rx_Error SMARTCARD advanced feature DMA Disable on Rx Error
mbed_official 340:28d1f895c6fe 430 * @{
mbed_official 340:28d1f895c6fe 431 */
mbed_official 340:28d1f895c6fe 432 #define SMARTCARD_ADVFEATURE_DMA_ENABLEONRXERROR ((uint32_t)0x00000000)
mbed_official 340:28d1f895c6fe 433 #define SMARTCARD_ADVFEATURE_DMA_DISABLEONRXERROR ((uint32_t)USART_CR3_DDRE)
mbed_official 340:28d1f895c6fe 434 #define IS_SMARTCARD_ADVFEATURE_DMAONRXERROR(DMA) (((DMA) == SMARTCARD_ADVFEATURE_DMA_ENABLEONRXERROR) || \
mbed_official 340:28d1f895c6fe 435 ((DMA) == SMARTCARD_ADVFEATURE_DMA_DISABLEONRXERROR))
mbed_official 340:28d1f895c6fe 436 /**
mbed_official 340:28d1f895c6fe 437 * @}
mbed_official 340:28d1f895c6fe 438 */
mbed_official 340:28d1f895c6fe 439
mbed_official 340:28d1f895c6fe 440 /** @defgroup SMARTCARD_MSB_First SMARTCARD advanced feature MSB first
mbed_official 340:28d1f895c6fe 441 * @{
mbed_official 340:28d1f895c6fe 442 */
mbed_official 340:28d1f895c6fe 443 #define SMARTCARD_ADVFEATURE_MSBFIRST_DISABLE ((uint32_t)0x00000000)
mbed_official 340:28d1f895c6fe 444 #define SMARTCARD_ADVFEATURE_MSBFIRST_ENABLE ((uint32_t)USART_CR2_MSBFIRST)
mbed_official 340:28d1f895c6fe 445 #define IS_SMARTCARD_ADVFEATURE_MSBFIRST(MSBFIRST) (((MSBFIRST) == SMARTCARD_ADVFEATURE_MSBFIRST_DISABLE) || \
mbed_official 340:28d1f895c6fe 446 ((MSBFIRST) == SMARTCARD_ADVFEATURE_MSBFIRST_ENABLE))
mbed_official 340:28d1f895c6fe 447 /**
mbed_official 340:28d1f895c6fe 448 * @}
mbed_official 340:28d1f895c6fe 449 */
mbed_official 340:28d1f895c6fe 450
mbed_official 340:28d1f895c6fe 451 /** @defgroup SMARTCARD_Flags SMARTCARD Flags
mbed_official 340:28d1f895c6fe 452 * Elements values convention: 0xXXXX
mbed_official 340:28d1f895c6fe 453 * - 0xXXXX : Flag mask in the ISR register
mbed_official 340:28d1f895c6fe 454 * @{
mbed_official 340:28d1f895c6fe 455 */
mbed_official 340:28d1f895c6fe 456 #define SMARTCARD_FLAG_REACK ((uint32_t)0x00400000)
mbed_official 340:28d1f895c6fe 457 #define SMARTCARD_FLAG_TEACK ((uint32_t)0x00200000)
mbed_official 340:28d1f895c6fe 458 #define SMARTCARD_FLAG_BUSY ((uint32_t)0x00010000)
mbed_official 340:28d1f895c6fe 459 #define SMARTCARD_FLAG_EOBF ((uint32_t)0x00001000)
mbed_official 340:28d1f895c6fe 460 #define SMARTCARD_FLAG_RTOF ((uint32_t)0x00000800)
mbed_official 340:28d1f895c6fe 461 #define SMARTCARD_FLAG_TXE ((uint32_t)0x00000080)
mbed_official 340:28d1f895c6fe 462 #define SMARTCARD_FLAG_TC ((uint32_t)0x00000040)
mbed_official 340:28d1f895c6fe 463 #define SMARTCARD_FLAG_RXNE ((uint32_t)0x00000020)
mbed_official 340:28d1f895c6fe 464 #define SMARTCARD_FLAG_ORE ((uint32_t)0x00000008)
mbed_official 340:28d1f895c6fe 465 #define SMARTCARD_FLAG_NE ((uint32_t)0x00000004)
mbed_official 340:28d1f895c6fe 466 #define SMARTCARD_FLAG_FE ((uint32_t)0x00000002)
mbed_official 340:28d1f895c6fe 467 #define SMARTCARD_FLAG_PE ((uint32_t)0x00000001)
mbed_official 340:28d1f895c6fe 468 /**
mbed_official 340:28d1f895c6fe 469 * @}
mbed_official 340:28d1f895c6fe 470 */
mbed_official 340:28d1f895c6fe 471
mbed_official 340:28d1f895c6fe 472 /** @defgroup SMARTCARD_Interrupt_definition SMARTCARD Interrupts Definition
mbed_official 340:28d1f895c6fe 473 * Elements values convention: 0000ZZZZ0XXYYYYYb
mbed_official 340:28d1f895c6fe 474 * - YYYYY : Interrupt source position in the XX register (5bits)
mbed_official 340:28d1f895c6fe 475 * - XX : Interrupt source register (2bits)
mbed_official 340:28d1f895c6fe 476 * - 01: CR1 register
mbed_official 340:28d1f895c6fe 477 * - 10: CR2 register
mbed_official 340:28d1f895c6fe 478 * - 11: CR3 register
mbed_official 340:28d1f895c6fe 479 * - ZZZZ : Flag position in the ISR register(4bits)
mbed_official 340:28d1f895c6fe 480 * @{
mbed_official 340:28d1f895c6fe 481 */
mbed_official 340:28d1f895c6fe 482
mbed_official 340:28d1f895c6fe 483 #define SMARTCARD_IT_PE ((uint16_t)0x0028)
mbed_official 340:28d1f895c6fe 484 #define SMARTCARD_IT_TXE ((uint16_t)0x0727)
mbed_official 340:28d1f895c6fe 485 #define SMARTCARD_IT_TC ((uint16_t)0x0626)
mbed_official 340:28d1f895c6fe 486 #define SMARTCARD_IT_RXNE ((uint16_t)0x0525)
mbed_official 340:28d1f895c6fe 487
mbed_official 340:28d1f895c6fe 488 #define SMARTCARD_IT_ERR ((uint16_t)0x0060)
mbed_official 340:28d1f895c6fe 489 #define SMARTCARD_IT_ORE ((uint16_t)0x0300)
mbed_official 340:28d1f895c6fe 490 #define SMARTCARD_IT_NE ((uint16_t)0x0200)
mbed_official 340:28d1f895c6fe 491 #define SMARTCARD_IT_FE ((uint16_t)0x0100)
mbed_official 340:28d1f895c6fe 492
mbed_official 340:28d1f895c6fe 493 #define SMARTCARD_IT_EOB ((uint16_t)0x0C3B)
mbed_official 340:28d1f895c6fe 494 #define SMARTCARD_IT_RTO ((uint16_t)0x0B3A)
mbed_official 340:28d1f895c6fe 495 /**
mbed_official 340:28d1f895c6fe 496 * @}
mbed_official 340:28d1f895c6fe 497 */
mbed_official 340:28d1f895c6fe 498
mbed_official 340:28d1f895c6fe 499
mbed_official 340:28d1f895c6fe 500 /** @defgroup SMARTCARD_IT_CLEAR_Flags SMARTCARD Interruption Clear Flags
mbed_official 340:28d1f895c6fe 501 * @{
mbed_official 340:28d1f895c6fe 502 */
mbed_official 340:28d1f895c6fe 503 #define SMARTCARD_CLEAR_PEF USART_ICR_PECF /*!< Parity Error Clear Flag */
mbed_official 340:28d1f895c6fe 504 #define SMARTCARD_CLEAR_FEF USART_ICR_FECF /*!< Framing Error Clear Flag */
mbed_official 340:28d1f895c6fe 505 #define SMARTCARD_CLEAR_NEF USART_ICR_NCF /*!< Noise detected Clear Flag */
mbed_official 340:28d1f895c6fe 506 #define SMARTCARD_CLEAR_OREF USART_ICR_ORECF /*!< OverRun Error Clear Flag */
mbed_official 340:28d1f895c6fe 507 #define SMARTCARD_CLEAR_TCF USART_ICR_TCCF /*!< Transmission Complete Clear Flag */
mbed_official 340:28d1f895c6fe 508 #define SMARTCARD_CLEAR_RTOF USART_ICR_RTOCF /*!< Receiver Time Out Clear Flag */
mbed_official 340:28d1f895c6fe 509 #define SMARTCARD_CLEAR_EOBF USART_ICR_EOBCF /*!< End Of Block Clear Flag */
mbed_official 340:28d1f895c6fe 510 /**
mbed_official 340:28d1f895c6fe 511 * @}
mbed_official 340:28d1f895c6fe 512 */
mbed_official 340:28d1f895c6fe 513
mbed_official 340:28d1f895c6fe 514 /** @defgroup SMARTCARD_Request_Parameters SMARTCARD Request Parameters
mbed_official 340:28d1f895c6fe 515 * @{
mbed_official 340:28d1f895c6fe 516 */
mbed_official 340:28d1f895c6fe 517 #define SMARTCARD_RXDATA_FLUSH_REQUEST ((uint16_t)USART_RQR_RXFRQ) /*!< Receive Data flush Request */
mbed_official 340:28d1f895c6fe 518 #define SMARTCARD_TXDATA_FLUSH_REQUEST ((uint16_t)USART_RQR_TXFRQ) /*!< Transmit data flush Request */
mbed_official 340:28d1f895c6fe 519 #define IS_SMARTCARD_REQUEST_PARAMETER(PARAM) (((PARAM) == SMARTCARD_RXDATA_FLUSH_REQUEST) || \
mbed_official 340:28d1f895c6fe 520 ((PARAM) == SMARTCARD_TXDATA_FLUSH_REQUEST))
mbed_official 340:28d1f895c6fe 521 /**
mbed_official 340:28d1f895c6fe 522 * @}
mbed_official 340:28d1f895c6fe 523 */
mbed_official 340:28d1f895c6fe 524
mbed_official 340:28d1f895c6fe 525
mbed_official 340:28d1f895c6fe 526 /** @defgroup SMARTCARD_CR3_SCARCNT_LSB_POS SMARTCARD auto retry counter LSB position in CR3 register
mbed_official 340:28d1f895c6fe 527 * @{
mbed_official 340:28d1f895c6fe 528 */
mbed_official 340:28d1f895c6fe 529 #define SMARTCARD_CR3_SCARCNT_LSB_POS ((uint32_t) 17)
mbed_official 340:28d1f895c6fe 530 /**
mbed_official 340:28d1f895c6fe 531 * @}
mbed_official 340:28d1f895c6fe 532 */
mbed_official 340:28d1f895c6fe 533
mbed_official 340:28d1f895c6fe 534 /** @defgroup SMARTCARD_GTPR_GT_LSB_POS SMARTCARD guard time value LSB position in GTPR register
mbed_official 340:28d1f895c6fe 535 * @{
mbed_official 340:28d1f895c6fe 536 */
mbed_official 340:28d1f895c6fe 537 #define SMARTCARD_GTPR_GT_LSB_POS ((uint32_t) 8)
mbed_official 340:28d1f895c6fe 538 /**
mbed_official 340:28d1f895c6fe 539 * @}
mbed_official 340:28d1f895c6fe 540 */
mbed_official 340:28d1f895c6fe 541
mbed_official 340:28d1f895c6fe 542 /** @defgroup SMARTCARD_RTOR_BLEN_LSB_POS SMARTCARD block length LSB position in RTOR register
mbed_official 340:28d1f895c6fe 543 * @{
mbed_official 340:28d1f895c6fe 544 */
mbed_official 340:28d1f895c6fe 545 #define SMARTCARD_RTOR_BLEN_LSB_POS ((uint32_t) 24)
mbed_official 340:28d1f895c6fe 546 /**
mbed_official 340:28d1f895c6fe 547 * @}
mbed_official 340:28d1f895c6fe 548 */
mbed_official 340:28d1f895c6fe 549
mbed_official 340:28d1f895c6fe 550 /** @defgroup SMARTCARD_Interruption_Mask SMARTCARD interruptions flag mask
mbed_official 340:28d1f895c6fe 551 * @{
mbed_official 340:28d1f895c6fe 552 */
mbed_official 340:28d1f895c6fe 553 #define SMARTCARD_IT_MASK ((uint16_t)0x001F)
mbed_official 340:28d1f895c6fe 554 /**
mbed_official 340:28d1f895c6fe 555 * @}
mbed_official 340:28d1f895c6fe 556 */
mbed_official 340:28d1f895c6fe 557
mbed_official 340:28d1f895c6fe 558 /**
mbed_official 340:28d1f895c6fe 559 * @}
mbed_official 340:28d1f895c6fe 560 */
mbed_official 340:28d1f895c6fe 561
mbed_official 340:28d1f895c6fe 562 /* Exported macro ------------------------------------------------------------*/
mbed_official 340:28d1f895c6fe 563 /** @defgroup SMARTCARD_Exported_Macros SMARTCARD Exported Macros
mbed_official 340:28d1f895c6fe 564 * @{
mbed_official 340:28d1f895c6fe 565 */
mbed_official 340:28d1f895c6fe 566
mbed_official 340:28d1f895c6fe 567 /** @brief Reset SMARTCARD handle state
mbed_official 340:28d1f895c6fe 568 * @param __HANDLE__: SMARTCARD handle.
mbed_official 340:28d1f895c6fe 569 * @retval None
mbed_official 340:28d1f895c6fe 570 */
mbed_official 340:28d1f895c6fe 571 #define __HAL_SMARTCARD_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_SMARTCARD_STATE_RESET)
mbed_official 340:28d1f895c6fe 572
mbed_official 340:28d1f895c6fe 573 /** @brief Checks whether the specified Smartcard flag is set or not.
mbed_official 340:28d1f895c6fe 574 * @param __HANDLE__: specifies the SMARTCARD Handle.
mbed_official 340:28d1f895c6fe 575 * The Handle Instance can be USARTx where x: 1, 2 or 3 to select the USART peripheral.
mbed_official 340:28d1f895c6fe 576 * @param __FLAG__: specifies the flag to check.
mbed_official 340:28d1f895c6fe 577 * This parameter can be one of the following values:
mbed_official 340:28d1f895c6fe 578 * @arg SMARTCARD_FLAG_REACK: Receive enable ackowledge flag
mbed_official 340:28d1f895c6fe 579 * @arg SMARTCARD_FLAG_TEACK: Transmit enable ackowledge flag
mbed_official 340:28d1f895c6fe 580 * @arg SMARTCARD_FLAG_BUSY: Busy flag
mbed_official 340:28d1f895c6fe 581 * @arg SMARTCARD_FLAG_EOBF: End of block flag
mbed_official 340:28d1f895c6fe 582 * @arg SMARTCARD_FLAG_RTOF: Receiver timeout flag
mbed_official 340:28d1f895c6fe 583 * @arg SMARTCARD_FLAG_TXE: Transmit data register empty flag
mbed_official 340:28d1f895c6fe 584 * @arg SMARTCARD_FLAG_TC: Transmission Complete flag
mbed_official 340:28d1f895c6fe 585 * @arg SMARTCARD_FLAG_RXNE: Receive data register not empty flag
mbed_official 340:28d1f895c6fe 586 * @arg SMARTCARD_FLAG_ORE: OverRun Error flag
mbed_official 340:28d1f895c6fe 587 * @arg SMARTCARD_FLAG_NE: Noise Error flag
mbed_official 340:28d1f895c6fe 588 * @arg SMARTCARD_FLAG_FE: Framing Error flag
mbed_official 340:28d1f895c6fe 589 * @arg SMARTCARD_FLAG_PE: Parity Error flag
mbed_official 340:28d1f895c6fe 590 * @retval The new state of __FLAG__ (TRUE or FALSE).
mbed_official 340:28d1f895c6fe 591 */
mbed_official 340:28d1f895c6fe 592 #define __HAL_SMARTCARD_GET_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->ISR & (__FLAG__)) == (__FLAG__))
mbed_official 340:28d1f895c6fe 593
mbed_official 340:28d1f895c6fe 594
mbed_official 340:28d1f895c6fe 595 /** @brief Enables the specified SmartCard interrupt.
mbed_official 340:28d1f895c6fe 596 * @param __HANDLE__: specifies the SMARTCARD Handle.
mbed_official 340:28d1f895c6fe 597 * The Handle Instance can be USARTx where x: 1, 2 or 3 to select the USART peripheral.
mbed_official 340:28d1f895c6fe 598 * @param __INTERRUPT__: specifies the SMARTCARD interrupt to enable.
mbed_official 340:28d1f895c6fe 599 * This parameter can be one of the following values:
mbed_official 340:28d1f895c6fe 600 * @arg SMARTCARD_IT_EOBF: End Of Block interrupt
mbed_official 340:28d1f895c6fe 601 * @arg SMARTCARD_IT_RTOF: Receive TimeOut interrupt
mbed_official 340:28d1f895c6fe 602 * @arg SMARTCARD_IT_TXE: Transmit Data Register empty interrupt
mbed_official 340:28d1f895c6fe 603 * @arg SMARTCARD_IT_TC: Transmission complete interrupt
mbed_official 340:28d1f895c6fe 604 * @arg SMARTCARD_IT_RXNE: Receive Data register not empty interrupt
mbed_official 340:28d1f895c6fe 605 * @arg SMARTCARD_IT_PE: Parity Error interrupt
mbed_official 340:28d1f895c6fe 606 * @arg SMARTCARD_IT_ERR: Error interrupt(Frame error, noise error, overrun error)
mbed_official 340:28d1f895c6fe 607 * @retval None
mbed_official 340:28d1f895c6fe 608 */
mbed_official 340:28d1f895c6fe 609 #define __HAL_SMARTCARD_ENABLE_IT(__HANDLE__, __INTERRUPT__) (((((uint8_t)(__INTERRUPT__)) >> 5U) == 1)? ((__HANDLE__)->Instance->CR1 |= (1U << ((__INTERRUPT__) & SMARTCARD_IT_MASK))): \
mbed_official 340:28d1f895c6fe 610 ((((uint8_t)(__INTERRUPT__)) >> 5U) == 2)? ((__HANDLE__)->Instance->CR2 |= (1U << ((__INTERRUPT__) & SMARTCARD_IT_MASK))): \
mbed_official 340:28d1f895c6fe 611 ((__HANDLE__)->Instance->CR3 |= (1U << ((__INTERRUPT__) & SMARTCARD_IT_MASK))))
mbed_official 340:28d1f895c6fe 612
mbed_official 340:28d1f895c6fe 613 /** @brief Disables the specified SmartCard interrupt.
mbed_official 340:28d1f895c6fe 614 * @param __HANDLE__: specifies the SMARTCARD Handle.
mbed_official 340:28d1f895c6fe 615 * The Handle Instance can be USARTx where x: 1, 2 or 3 to select the USART peripheral.
mbed_official 340:28d1f895c6fe 616 * @param __INTERRUPT__: specifies the SMARTCARD interrupt to disable.
mbed_official 340:28d1f895c6fe 617 * This parameter can be one of the following values:
mbed_official 340:28d1f895c6fe 618 * @arg SMARTCARD_IT_EOBF: End Of Block interrupt
mbed_official 340:28d1f895c6fe 619 * @arg SMARTCARD_IT_RTOF: Receive TimeOut interrupt
mbed_official 340:28d1f895c6fe 620 * @arg SMARTCARD_IT_TXE: Transmit Data Register empty interrupt
mbed_official 340:28d1f895c6fe 621 * @arg SMARTCARD_IT_TC: Transmission complete interrupt
mbed_official 340:28d1f895c6fe 622 * @arg SMARTCARD_IT_RXNE: Receive Data register not empty interrupt
mbed_official 340:28d1f895c6fe 623 * @arg SMARTCARD_IT_PE: Parity Error interrupt
mbed_official 340:28d1f895c6fe 624 * @arg SMARTCARD_IT_ERR: Error interrupt(Frame error, noise error, overrun error)
mbed_official 340:28d1f895c6fe 625 * @retval None
mbed_official 340:28d1f895c6fe 626 */
mbed_official 340:28d1f895c6fe 627 #define __HAL_SMARTCARD_DISABLE_IT(__HANDLE__, __INTERRUPT__) (((((uint8_t)(__INTERRUPT__)) >> 5U) == 1)? ((__HANDLE__)->Instance->CR1 &= ~ (1U << ((__INTERRUPT__) & SMARTCARD_IT_MASK))): \
mbed_official 340:28d1f895c6fe 628 ((((uint8_t)(__INTERRUPT__)) >> 5U) == 2)? ((__HANDLE__)->Instance->CR2 &= ~ (1U << ((__INTERRUPT__) & SMARTCARD_IT_MASK))): \
mbed_official 340:28d1f895c6fe 629 ((__HANDLE__)->Instance->CR3 &= ~ (1U << ((__INTERRUPT__) & SMARTCARD_IT_MASK))))
mbed_official 340:28d1f895c6fe 630
mbed_official 340:28d1f895c6fe 631
mbed_official 340:28d1f895c6fe 632 /** @brief Checks whether the specified SmartCard interrupt has occurred or not.
mbed_official 340:28d1f895c6fe 633 * @param __HANDLE__: specifies the SMARTCARD Handle.
mbed_official 340:28d1f895c6fe 634 * The Handle Instance can be USARTx where x: 1, 2 or 3 to select the USART peripheral.
mbed_official 340:28d1f895c6fe 635 * @param __IT__: specifies the SMARTCARD interrupt to check.
mbed_official 340:28d1f895c6fe 636 * This parameter can be one of the following values:
mbed_official 340:28d1f895c6fe 637 * @arg SMARTCARD_IT_EOBF: End Of Block interrupt
mbed_official 340:28d1f895c6fe 638 * @arg SMARTCARD_IT_RTOF: Receive TimeOut interrupt
mbed_official 340:28d1f895c6fe 639 * @arg SMARTCARD_IT_TXE: Transmit Data Register empty interrupt
mbed_official 340:28d1f895c6fe 640 * @arg SMARTCARD_IT_TC: Transmission complete interrupt
mbed_official 340:28d1f895c6fe 641 * @arg SMARTCARD_IT_RXNE: Receive Data register not empty interrupt
mbed_official 340:28d1f895c6fe 642 * @arg SMARTCARD_IT_ORE: OverRun Error interrupt
mbed_official 340:28d1f895c6fe 643 * @arg SMARTCARD_IT_NE: Noise Error interrupt
mbed_official 340:28d1f895c6fe 644 * @arg SMARTCARD_IT_FE: Framing Error interrupt
mbed_official 340:28d1f895c6fe 645 * @arg SMARTCARD_IT_PE: Parity Error interrupt
mbed_official 340:28d1f895c6fe 646 * @retval The new state of __IT__ (TRUE or FALSE).
mbed_official 340:28d1f895c6fe 647 */
mbed_official 340:28d1f895c6fe 648 #define __HAL_SMARTCARD_GET_IT(__HANDLE__, __IT__) ((__HANDLE__)->Instance->ISR & ((uint32_t)1 << ((__IT__)>> 0x08)))
mbed_official 340:28d1f895c6fe 649
mbed_official 340:28d1f895c6fe 650 /** @brief Checks whether the specified SmartCard interrupt interrupt source is enabled.
mbed_official 340:28d1f895c6fe 651 * @param __HANDLE__: specifies the SMARTCARD Handle.
mbed_official 340:28d1f895c6fe 652 * The Handle Instance can be USARTx where x: 1, 2 or 3 to select the USART peripheral.
mbed_official 340:28d1f895c6fe 653 * @param __IT__: specifies the SMARTCARD interrupt source to check.
mbed_official 340:28d1f895c6fe 654 * This parameter can be one of the following values:
mbed_official 340:28d1f895c6fe 655 * @arg SMARTCARD_IT_EOBF: End Of Block interrupt
mbed_official 340:28d1f895c6fe 656 * @arg SMARTCARD_IT_RTOF: Receive TimeOut interrupt
mbed_official 340:28d1f895c6fe 657 * @arg SMARTCARD_IT_TXE: Transmit Data Register empty interrupt
mbed_official 340:28d1f895c6fe 658 * @arg SMARTCARD_IT_TC: Transmission complete interrupt
mbed_official 340:28d1f895c6fe 659 * @arg SMARTCARD_IT_RXNE: Receive Data register not empty interrupt
mbed_official 340:28d1f895c6fe 660 * @arg SMARTCARD_IT_ORE: OverRun Error interrupt
mbed_official 340:28d1f895c6fe 661 * @arg SMARTCARD_IT_NE: Noise Error interrupt
mbed_official 340:28d1f895c6fe 662 * @arg SMARTCARD_IT_FE: Framing Error interrupt
mbed_official 340:28d1f895c6fe 663 * @arg SMARTCARD_IT_PE: Parity Error interrupt
mbed_official 340:28d1f895c6fe 664 * @retval The new state of __IT__ (TRUE or FALSE).
mbed_official 340:28d1f895c6fe 665 */
mbed_official 340:28d1f895c6fe 666 #define __HAL_SMARTCARD_GET_IT_SOURCE(__HANDLE__, __IT__) ((((((uint8_t)(__IT__)) >> 5U) == 1)? (__HANDLE__)->Instance->CR1 : \
mbed_official 340:28d1f895c6fe 667 (((((uint8_t)(__IT__)) >> 5U) == 2)? (__HANDLE__)->Instance->CR2 : \
mbed_official 340:28d1f895c6fe 668 (__HANDLE__)->Instance->CR3)) & ((uint32_t)1 << (((uint16_t)(__IT__)) & SMARTCARD_IT_MASK)))
mbed_official 340:28d1f895c6fe 669
mbed_official 340:28d1f895c6fe 670
mbed_official 340:28d1f895c6fe 671 /** @brief Clears the specified SMARTCARD ISR flag, in setting the proper ICR register flag.
mbed_official 340:28d1f895c6fe 672 * @param __HANDLE__: specifies the SMARTCARD Handle.
mbed_official 340:28d1f895c6fe 673 * The Handle Instance can be USARTx where x: 1, 2 or 3 to select the USART peripheral.
mbed_official 340:28d1f895c6fe 674 * @param __IT_CLEAR__: specifies the interrupt clear register flag that needs to be set
mbed_official 340:28d1f895c6fe 675 * to clear the corresponding interrupt
mbed_official 340:28d1f895c6fe 676 * This parameter can be one of the following values:
mbed_official 340:28d1f895c6fe 677 * @arg USART_CLEAR_PEF: Parity Error Clear Flag
mbed_official 340:28d1f895c6fe 678 * @arg USART_CLEAR_FEF: Framing Error Clear Flag
mbed_official 340:28d1f895c6fe 679 * @arg USART_CLEAR_NEF: Noise detected Clear Flag
mbed_official 340:28d1f895c6fe 680 * @arg USART_CLEAR_OREF: OverRun Error Clear Flag
mbed_official 340:28d1f895c6fe 681 * @arg USART_CLEAR_TCF: Transmission Complete Clear Flag
mbed_official 340:28d1f895c6fe 682 * @arg USART_CLEAR_RTOF: Receiver Time Out Clear Flag
mbed_official 340:28d1f895c6fe 683 * @arg USART_CLEAR_EOBF: End Of Block Clear Flag
mbed_official 340:28d1f895c6fe 684 * @retval None
mbed_official 340:28d1f895c6fe 685 */
mbed_official 340:28d1f895c6fe 686 #define __HAL_SMARTCARD_CLEAR_IT(__HANDLE__, __IT_CLEAR__) ((__HANDLE__)->Instance->ICR = (uint32_t)(__IT_CLEAR__))
mbed_official 340:28d1f895c6fe 687
mbed_official 340:28d1f895c6fe 688 /** @brief Set a specific SMARTCARD request flag.
mbed_official 340:28d1f895c6fe 689 * @param __HANDLE__: specifies the SMARTCARD Handle.
mbed_official 340:28d1f895c6fe 690 * The Handle Instance can be USARTx where x: 1, 2 or 3 to select the USART peripheral.
mbed_official 340:28d1f895c6fe 691 * @param __REQ__: specifies the request flag to set
mbed_official 340:28d1f895c6fe 692 * This parameter can be one of the following values:
mbed_official 340:28d1f895c6fe 693 * @arg SMARTCARD_RXDATA_FLUSH_REQUEST: Receive Data flush Request
mbed_official 340:28d1f895c6fe 694 * @arg SMARTCARD_TXDATA_FLUSH_REQUEST: Transmit data flush Request
mbed_official 340:28d1f895c6fe 695 *
mbed_official 340:28d1f895c6fe 696 * @retval None
mbed_official 340:28d1f895c6fe 697 */
mbed_official 340:28d1f895c6fe 698 #define __HAL_SMARTCARD_SEND_REQ(__HANDLE__, __REQ__) ((__HANDLE__)->Instance->RQR |= (uint16_t)(__REQ__))
mbed_official 340:28d1f895c6fe 699
mbed_official 340:28d1f895c6fe 700 /** @brief Enable the USART associated to the SMARTCARD Handle
mbed_official 340:28d1f895c6fe 701 * @param __HANDLE__: specifies the SMARTCARD Handle.
mbed_official 340:28d1f895c6fe 702 * The Handle Instance can be UARTx where x: 1, 2, 3 to select the USART peripheral
mbed_official 340:28d1f895c6fe 703 * @retval None
mbed_official 340:28d1f895c6fe 704 */
mbed_official 340:28d1f895c6fe 705 #define __HAL_SMARTCARD_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR1 |= USART_CR1_UE)
mbed_official 340:28d1f895c6fe 706
mbed_official 340:28d1f895c6fe 707 /** @brief Disable the USART associated to the SMARTCARD Handle
mbed_official 340:28d1f895c6fe 708 * @param __HANDLE__: specifies the SMARTCARD Handle.
mbed_official 340:28d1f895c6fe 709 * The Handle Instance can be UARTx where x: 1, 2, 3 to select the USART peripheral
mbed_official 340:28d1f895c6fe 710 * @retval None
mbed_official 340:28d1f895c6fe 711 */
mbed_official 340:28d1f895c6fe 712 #define __HAL_SMARTCARD_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR1 &= ~USART_CR1_UE)
mbed_official 340:28d1f895c6fe 713
mbed_official 340:28d1f895c6fe 714 /** @brief Check the Baud rate range. The maximum Baud Rate is derived from the
mbed_official 340:28d1f895c6fe 715 * maximum clock on F0 (i.e. 48 MHz) divided by the oversampling used
mbed_official 340:28d1f895c6fe 716 * on the SMARTCARD (i.e. 16)
mbed_official 340:28d1f895c6fe 717 * @param __BAUDRATE__: Baud rate set by the configuration function.
mbed_official 340:28d1f895c6fe 718 * @retval Test result (TRUE or FALSE)
mbed_official 340:28d1f895c6fe 719 */
mbed_official 340:28d1f895c6fe 720 #define IS_SMARTCARD_BAUDRATE(__BAUDRATE__) ((__BAUDRATE__) < 4500001)
mbed_official 340:28d1f895c6fe 721
mbed_official 340:28d1f895c6fe 722 /** @brief Check the block length range. The maximum SMARTCARD block length is 0xFF.
mbed_official 340:28d1f895c6fe 723 * @param __LENGTH__: block length.
mbed_official 340:28d1f895c6fe 724 * @retval Test result (TRUE or FALSE)
mbed_official 340:28d1f895c6fe 725 */
mbed_official 340:28d1f895c6fe 726 #define IS_SMARTCARD_BLOCKLENGTH(__LENGTH__) ((__LENGTH__) <= 0xFF)
mbed_official 340:28d1f895c6fe 727
mbed_official 340:28d1f895c6fe 728 /** @brief Check the receiver timeout value. The maximum SMARTCARD receiver timeout
mbed_official 340:28d1f895c6fe 729 * value is 0xFFFFFF.
mbed_official 340:28d1f895c6fe 730 * @param __TIMEOUTVALUE__: receiver timeout value.
mbed_official 340:28d1f895c6fe 731 * @retval Test result (TRUE or FALSE)
mbed_official 340:28d1f895c6fe 732 */
mbed_official 340:28d1f895c6fe 733 #define IS_SMARTCARD_TIMEOUT_VALUE(__TIMEOUTVALUE__) ((__TIMEOUTVALUE__) <= 0xFFFFFF)
mbed_official 340:28d1f895c6fe 734
mbed_official 340:28d1f895c6fe 735 /** @brief Check the SMARTCARD autoretry counter value. The maximum number of
mbed_official 340:28d1f895c6fe 736 * retransmissions is 0x7.
mbed_official 340:28d1f895c6fe 737 * @param __COUNT__: number of retransmissions
mbed_official 340:28d1f895c6fe 738 * @retval Test result (TRUE or FALSE)
mbed_official 340:28d1f895c6fe 739 */
mbed_official 340:28d1f895c6fe 740 #define IS_SMARTCARD_AUTORETRY_COUNT(__COUNT__) ((__COUNT__) <= 0x7)
mbed_official 340:28d1f895c6fe 741
mbed_official 340:28d1f895c6fe 742 /**
mbed_official 340:28d1f895c6fe 743 * @}
mbed_official 340:28d1f895c6fe 744 */
mbed_official 340:28d1f895c6fe 745
mbed_official 441:d2c15dda23c1 746 /* Include SMARTCARD HAL Extended module */
mbed_official 340:28d1f895c6fe 747 #include "stm32f0xx_hal_smartcard_ex.h"
mbed_official 340:28d1f895c6fe 748
mbed_official 340:28d1f895c6fe 749
mbed_official 340:28d1f895c6fe 750 /* Exported functions --------------------------------------------------------*/
mbed_official 340:28d1f895c6fe 751
mbed_official 340:28d1f895c6fe 752 /** @addtogroup SMARTCARD_Exported_Functions SMARTCARD Exported Functions
mbed_official 340:28d1f895c6fe 753 * @{
mbed_official 340:28d1f895c6fe 754 */
mbed_official 340:28d1f895c6fe 755
mbed_official 340:28d1f895c6fe 756 /** @addtogroup SMARTCARD_Exported_Functions_Group1 Initialization and de-initialization functions
mbed_official 340:28d1f895c6fe 757 * @{
mbed_official 340:28d1f895c6fe 758 */
mbed_official 340:28d1f895c6fe 759
mbed_official 340:28d1f895c6fe 760 /* Initialization and de-initialization functions ****************************/
mbed_official 340:28d1f895c6fe 761 HAL_StatusTypeDef HAL_SMARTCARD_Init(SMARTCARD_HandleTypeDef *hsmartcard);
mbed_official 340:28d1f895c6fe 762 HAL_StatusTypeDef HAL_SMARTCARD_DeInit(SMARTCARD_HandleTypeDef *hsmartcard);
mbed_official 340:28d1f895c6fe 763 void HAL_SMARTCARD_MspInit(SMARTCARD_HandleTypeDef *hsmartcard);
mbed_official 340:28d1f895c6fe 764 void HAL_SMARTCARD_MspDeInit(SMARTCARD_HandleTypeDef *hsmartcard);
mbed_official 340:28d1f895c6fe 765 /**
mbed_official 340:28d1f895c6fe 766 * @}
mbed_official 340:28d1f895c6fe 767 */
mbed_official 340:28d1f895c6fe 768
mbed_official 340:28d1f895c6fe 769 /** @addtogroup SMARTCARD_Exported_Functions_Group2 IO operation functions
mbed_official 340:28d1f895c6fe 770 * @{
mbed_official 340:28d1f895c6fe 771 */
mbed_official 340:28d1f895c6fe 772 /* IO operation functions *****************************************************/
mbed_official 340:28d1f895c6fe 773 HAL_StatusTypeDef HAL_SMARTCARD_Transmit(SMARTCARD_HandleTypeDef *hsmartcard, uint8_t *pData, uint16_t Size, uint32_t Timeout);
mbed_official 340:28d1f895c6fe 774 HAL_StatusTypeDef HAL_SMARTCARD_Receive(SMARTCARD_HandleTypeDef *hsmartcard, uint8_t *pData, uint16_t Size, uint32_t Timeout);
mbed_official 340:28d1f895c6fe 775 HAL_StatusTypeDef HAL_SMARTCARD_Transmit_IT(SMARTCARD_HandleTypeDef *hsmartcard, uint8_t *pData, uint16_t Size);
mbed_official 340:28d1f895c6fe 776 HAL_StatusTypeDef HAL_SMARTCARD_Receive_IT(SMARTCARD_HandleTypeDef *hsmartcard, uint8_t *pData, uint16_t Size);
mbed_official 340:28d1f895c6fe 777 HAL_StatusTypeDef HAL_SMARTCARD_Transmit_DMA(SMARTCARD_HandleTypeDef *hsmartcard, uint8_t *pData, uint16_t Size);
mbed_official 340:28d1f895c6fe 778 HAL_StatusTypeDef HAL_SMARTCARD_Receive_DMA(SMARTCARD_HandleTypeDef *hsmartcard, uint8_t *pData, uint16_t Size);
mbed_official 340:28d1f895c6fe 779 void HAL_SMARTCARD_IRQHandler(SMARTCARD_HandleTypeDef *hsmartcard);
mbed_official 340:28d1f895c6fe 780 void HAL_SMARTCARD_TxCpltCallback(SMARTCARD_HandleTypeDef *hsmartcard);
mbed_official 340:28d1f895c6fe 781 void HAL_SMARTCARD_RxCpltCallback(SMARTCARD_HandleTypeDef *hsmartcard);
mbed_official 340:28d1f895c6fe 782 void HAL_SMARTCARD_ErrorCallback(SMARTCARD_HandleTypeDef *hsmartcard);
mbed_official 340:28d1f895c6fe 783 /**
mbed_official 340:28d1f895c6fe 784 * @}
mbed_official 340:28d1f895c6fe 785 */
mbed_official 340:28d1f895c6fe 786
mbed_official 340:28d1f895c6fe 787 /** @addtogroup SMARTCARD_Exported_Functions_Group3 Peripheral State and Errors functions
mbed_official 340:28d1f895c6fe 788 * @{
mbed_official 340:28d1f895c6fe 789 */
mbed_official 340:28d1f895c6fe 790 /* Peripheral State and Error functions ***************************************/
mbed_official 340:28d1f895c6fe 791 HAL_SMARTCARD_StateTypeDef HAL_SMARTCARD_GetState(SMARTCARD_HandleTypeDef *hsmartcard);
mbed_official 340:28d1f895c6fe 792 uint32_t HAL_SMARTCARD_GetError(SMARTCARD_HandleTypeDef *hsmartcard);
mbed_official 340:28d1f895c6fe 793 /**
mbed_official 340:28d1f895c6fe 794 * @}
mbed_official 340:28d1f895c6fe 795 */
mbed_official 340:28d1f895c6fe 796
mbed_official 340:28d1f895c6fe 797 /**
mbed_official 340:28d1f895c6fe 798 * @}
mbed_official 340:28d1f895c6fe 799 */
mbed_official 340:28d1f895c6fe 800
mbed_official 340:28d1f895c6fe 801 /**
mbed_official 340:28d1f895c6fe 802 * @}
mbed_official 340:28d1f895c6fe 803 */
mbed_official 340:28d1f895c6fe 804
mbed_official 340:28d1f895c6fe 805 /**
mbed_official 340:28d1f895c6fe 806 * @}
mbed_official 340:28d1f895c6fe 807 */
mbed_official 340:28d1f895c6fe 808
mbed_official 441:d2c15dda23c1 809 #endif /* !defined(STM32F030x6) && !defined(STM32F030x8)&& !defined(STM32F070x6) && !defined(STM32F070xB) && !defined(STM32F030xC) */
mbed_official 340:28d1f895c6fe 810
mbed_official 340:28d1f895c6fe 811 #ifdef __cplusplus
mbed_official 340:28d1f895c6fe 812 }
mbed_official 340:28d1f895c6fe 813 #endif
mbed_official 340:28d1f895c6fe 814
mbed_official 340:28d1f895c6fe 815 #endif /* __STM32F0xx_HAL_SMARTCARD_H */
mbed_official 340:28d1f895c6fe 816
mbed_official 340:28d1f895c6fe 817 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
mbed_official 340:28d1f895c6fe 818