mbed library sources

Fork of mbed-src by mbed official

Committer:
mbed_official
Date:
Mon Nov 03 10:30:07 2014 +0000
Revision:
381:5460fc57b6e4
Synchronized with git revision 02478cd1f27fc7b9643486472635eb515b2bca81

Full URL: https://github.com/mbedmicro/mbed/commit/02478cd1f27fc7b9643486472635eb515b2bca81/

Target: LPC1549 - Fix serial interrupt issues (issue report #616)

Who changed what in which revision?

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