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