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