mbed official / mbed

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

Committer:
Kojto
Date:
Thu Jul 07 14:34:11 2016 +0100
Revision:
122:f9eeca106725
Parent:
116:c0f6e94411f5
Release 122 of the mbed library

Changes:
- new targets - Nucleo L432KC, Beetle, Nucleo F446ZE, Nucleo L011K4
- Thread safety addition - mbed API should contain a statement about thread safety
- critical section API addition
- CAS API (core_util_atomic_incr/decr)
- DEVICE_ are generated from targets.json file, device.h deprecated
- Callback replaces FunctionPointer to provide std like interface
- mbed HAL API docs improvements
- toolchain - prexif attributes with MBED_
- add new attributes - packed, weak, forcedinline, align
- target.json - contains targets definitions
- ST - L1XX - Cube update to 1.5
- SPI clock selection fix (clock from APB domain)
- F7 - Cube update v1.4.0
- L0 - baudrate init fix
- L1 - Cube update v1.5
- F3 - baudrate init fix, 3 targets CAN support
- F4 - Cube update v1.12.0, 3 targets CAN support
- L4XX - Cube update v1.5.1
- F0 - update Cube to v1.5.0
- L4 - 2 targets (L476RG/VG) CAN support
- NXP - pwm clock fix for KSDK2 MCU
- LPC2368 - remove ARM toolchain support - due to regression
- KSDK2 - fix SPI , I2C address and repeat start
- Silabs - some fixes backported from mbed 3
- Renesas - RZ_A1H - SystemCoreClockUpdate addition

Who changed what in which revision?

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