The official mbed C/C SDK provides the software platform and libraries to build your applications.
Fork of mbed by
TARGET_MTS_MDOT_F411RE/stm32f4xx_hal_smartcard.h@93:e188a91d3eaa, 2015-02-03 (annotated)
- Committer:
- Kojto
- Date:
- Tue Feb 03 15:31:20 2015 +0000
- Revision:
- 93:e188a91d3eaa
Release 93 of the mbed library
Main changes:
- Renesas RZ_A1H bugfixes - i2c, ticker
- new targets - Nucleo F303RE, Nucleo F070RB, BLE SMURFS,
Dragonfly 411RE,
- BusXXX - is connected method, plus operators addition
- LPC8xx - I2c fixes
- timestamp_t reverted to uint32_t
- RTX - fixes regarding stack (alignment, magic word)
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Kojto | 93:e188a91d3eaa | 1 | /** |
Kojto | 93:e188a91d3eaa | 2 | ****************************************************************************** |
Kojto | 93:e188a91d3eaa | 3 | * @file stm32f4xx_hal_smartcard.h |
Kojto | 93:e188a91d3eaa | 4 | * @author MCD Application Team |
Kojto | 93:e188a91d3eaa | 5 | * @version V1.1.0 |
Kojto | 93:e188a91d3eaa | 6 | * @date 19-June-2014 |
Kojto | 93:e188a91d3eaa | 7 | * @brief Header file of SMARTCARD HAL module. |
Kojto | 93:e188a91d3eaa | 8 | ****************************************************************************** |
Kojto | 93:e188a91d3eaa | 9 | * @attention |
Kojto | 93:e188a91d3eaa | 10 | * |
Kojto | 93:e188a91d3eaa | 11 | * <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2> |
Kojto | 93:e188a91d3eaa | 12 | * |
Kojto | 93:e188a91d3eaa | 13 | * Redistribution and use in source and binary forms, with or without modification, |
Kojto | 93:e188a91d3eaa | 14 | * are permitted provided that the following conditions are met: |
Kojto | 93:e188a91d3eaa | 15 | * 1. Redistributions of source code must retain the above copyright notice, |
Kojto | 93:e188a91d3eaa | 16 | * this list of conditions and the following disclaimer. |
Kojto | 93:e188a91d3eaa | 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
Kojto | 93:e188a91d3eaa | 18 | * this list of conditions and the following disclaimer in the documentation |
Kojto | 93:e188a91d3eaa | 19 | * and/or other materials provided with the distribution. |
Kojto | 93:e188a91d3eaa | 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
Kojto | 93:e188a91d3eaa | 21 | * may be used to endorse or promote products derived from this software |
Kojto | 93:e188a91d3eaa | 22 | * without specific prior written permission. |
Kojto | 93:e188a91d3eaa | 23 | * |
Kojto | 93:e188a91d3eaa | 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
Kojto | 93:e188a91d3eaa | 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
Kojto | 93:e188a91d3eaa | 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
Kojto | 93:e188a91d3eaa | 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
Kojto | 93:e188a91d3eaa | 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
Kojto | 93:e188a91d3eaa | 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
Kojto | 93:e188a91d3eaa | 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
Kojto | 93:e188a91d3eaa | 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
Kojto | 93:e188a91d3eaa | 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
Kojto | 93:e188a91d3eaa | 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
Kojto | 93:e188a91d3eaa | 34 | * |
Kojto | 93:e188a91d3eaa | 35 | ****************************************************************************** |
Kojto | 93:e188a91d3eaa | 36 | */ |
Kojto | 93:e188a91d3eaa | 37 | |
Kojto | 93:e188a91d3eaa | 38 | /* Define to prevent recursive inclusion -------------------------------------*/ |
Kojto | 93:e188a91d3eaa | 39 | #ifndef __STM32F4xx_HAL_SMARTCARD_H |
Kojto | 93:e188a91d3eaa | 40 | #define __STM32F4xx_HAL_SMARTCARD_H |
Kojto | 93:e188a91d3eaa | 41 | |
Kojto | 93:e188a91d3eaa | 42 | #ifdef __cplusplus |
Kojto | 93:e188a91d3eaa | 43 | extern "C" { |
Kojto | 93:e188a91d3eaa | 44 | #endif |
Kojto | 93:e188a91d3eaa | 45 | |
Kojto | 93:e188a91d3eaa | 46 | /* Includes ------------------------------------------------------------------*/ |
Kojto | 93:e188a91d3eaa | 47 | #include "stm32f4xx_hal_def.h" |
Kojto | 93:e188a91d3eaa | 48 | |
Kojto | 93:e188a91d3eaa | 49 | /** @addtogroup STM32F4xx_HAL_Driver |
Kojto | 93:e188a91d3eaa | 50 | * @{ |
Kojto | 93:e188a91d3eaa | 51 | */ |
Kojto | 93:e188a91d3eaa | 52 | |
Kojto | 93:e188a91d3eaa | 53 | /** @addtogroup SMARTCARD |
Kojto | 93:e188a91d3eaa | 54 | * @{ |
Kojto | 93:e188a91d3eaa | 55 | */ |
Kojto | 93:e188a91d3eaa | 56 | |
Kojto | 93:e188a91d3eaa | 57 | /* Exported types ------------------------------------------------------------*/ |
Kojto | 93:e188a91d3eaa | 58 | /** |
Kojto | 93:e188a91d3eaa | 59 | * @brief SMARTCARD Init Structure definition |
Kojto | 93:e188a91d3eaa | 60 | */ |
Kojto | 93:e188a91d3eaa | 61 | typedef struct |
Kojto | 93:e188a91d3eaa | 62 | { |
Kojto | 93:e188a91d3eaa | 63 | uint32_t BaudRate; /*!< This member configures the SmartCard communication baud rate. |
Kojto | 93:e188a91d3eaa | 64 | The baud rate is computed using the following formula: |
Kojto | 93:e188a91d3eaa | 65 | - IntegerDivider = ((PCLKx) / (8 * (hirda->Init.BaudRate))) |
Kojto | 93:e188a91d3eaa | 66 | - FractionalDivider = ((IntegerDivider - ((uint32_t) IntegerDivider)) * 8) + 0.5 */ |
Kojto | 93:e188a91d3eaa | 67 | |
Kojto | 93:e188a91d3eaa | 68 | uint32_t WordLength; /*!< Specifies the number of data bits transmitted or received in a frame. |
Kojto | 93:e188a91d3eaa | 69 | This parameter can be a value of @ref SMARTCARD_Word_Length */ |
Kojto | 93:e188a91d3eaa | 70 | |
Kojto | 93:e188a91d3eaa | 71 | uint32_t StopBits; /*!< Specifies the number of stop bits transmitted. |
Kojto | 93:e188a91d3eaa | 72 | This parameter can be a value of @ref SMARTCARD_Stop_Bits */ |
Kojto | 93:e188a91d3eaa | 73 | |
Kojto | 93:e188a91d3eaa | 74 | uint32_t Parity; /*!< Specifies the parity mode. |
Kojto | 93:e188a91d3eaa | 75 | This parameter can be a value of @ref SMARTCARD_Parity |
Kojto | 93:e188a91d3eaa | 76 | @note When parity is enabled, the computed parity is inserted |
Kojto | 93:e188a91d3eaa | 77 | at the MSB position of the transmitted data (9th bit when |
Kojto | 93:e188a91d3eaa | 78 | the word length is set to 9 data bits; 8th bit when the |
Kojto | 93:e188a91d3eaa | 79 | word length is set to 8 data bits).*/ |
Kojto | 93:e188a91d3eaa | 80 | |
Kojto | 93:e188a91d3eaa | 81 | uint32_t Mode; /*!< Specifies wether the Receive or Transmit mode is enabled or disabled. |
Kojto | 93:e188a91d3eaa | 82 | This parameter can be a value of @ref SMARTCARD_Mode */ |
Kojto | 93:e188a91d3eaa | 83 | |
Kojto | 93:e188a91d3eaa | 84 | uint32_t CLKPolarity; /*!< Specifies the steady state of the serial clock. |
Kojto | 93:e188a91d3eaa | 85 | This parameter can be a value of @ref SMARTCARD_Clock_Polarity */ |
Kojto | 93:e188a91d3eaa | 86 | |
Kojto | 93:e188a91d3eaa | 87 | uint32_t CLKPhase; /*!< Specifies the clock transition on which the bit capture is made. |
Kojto | 93:e188a91d3eaa | 88 | This parameter can be a value of @ref SMARTCARD_Clock_Phase */ |
Kojto | 93:e188a91d3eaa | 89 | |
Kojto | 93:e188a91d3eaa | 90 | uint32_t CLKLastBit; /*!< Specifies whether the clock pulse corresponding to the last transmitted |
Kojto | 93:e188a91d3eaa | 91 | data bit (MSB) has to be output on the SCLK pin in synchronous mode. |
Kojto | 93:e188a91d3eaa | 92 | This parameter can be a value of @ref SMARTCARD_Last_Bit */ |
Kojto | 93:e188a91d3eaa | 93 | |
Kojto | 93:e188a91d3eaa | 94 | uint32_t Prescaler; /*!< Specifies the SmartCard Prescaler. |
Kojto | 93:e188a91d3eaa | 95 | This parameter must be a number between Min_Data = 0 and Max_Data = 255 */ |
Kojto | 93:e188a91d3eaa | 96 | |
Kojto | 93:e188a91d3eaa | 97 | uint32_t GuardTime; /*!< Specifies the SmartCard Guard Time. |
Kojto | 93:e188a91d3eaa | 98 | This parameter must be a number between Min_Data = 0 and Max_Data = 255 */ |
Kojto | 93:e188a91d3eaa | 99 | |
Kojto | 93:e188a91d3eaa | 100 | uint32_t NACKState; /*!< Specifies the SmartCard NACK Transmission state. |
Kojto | 93:e188a91d3eaa | 101 | This parameter can be a value of @ref SmartCard_NACK_State */ |
Kojto | 93:e188a91d3eaa | 102 | }SMARTCARD_InitTypeDef; |
Kojto | 93:e188a91d3eaa | 103 | |
Kojto | 93:e188a91d3eaa | 104 | /** |
Kojto | 93:e188a91d3eaa | 105 | * @brief HAL State structures definition |
Kojto | 93:e188a91d3eaa | 106 | */ |
Kojto | 93:e188a91d3eaa | 107 | typedef enum |
Kojto | 93:e188a91d3eaa | 108 | { |
Kojto | 93:e188a91d3eaa | 109 | HAL_SMARTCARD_STATE_RESET = 0x00, /*!< Peripheral is not yet Initialized */ |
Kojto | 93:e188a91d3eaa | 110 | HAL_SMARTCARD_STATE_READY = 0x01, /*!< Peripheral Initialized and ready for use */ |
Kojto | 93:e188a91d3eaa | 111 | HAL_SMARTCARD_STATE_BUSY = 0x02, /*!< an internal process is ongoing */ |
Kojto | 93:e188a91d3eaa | 112 | HAL_SMARTCARD_STATE_BUSY_TX = 0x12, /*!< Data Transmission process is ongoing */ |
Kojto | 93:e188a91d3eaa | 113 | HAL_SMARTCARD_STATE_BUSY_RX = 0x22, /*!< Data Reception process is ongoing */ |
Kojto | 93:e188a91d3eaa | 114 | HAL_SMARTCARD_STATE_BUSY_TX_RX = 0x32, /*!< Data Transmission and Reception process is ongoing */ |
Kojto | 93:e188a91d3eaa | 115 | HAL_SMARTCARD_STATE_TIMEOUT = 0x03, /*!< Timeout state */ |
Kojto | 93:e188a91d3eaa | 116 | HAL_SMARTCARD_STATE_ERROR = 0x04 /*!< Error */ |
Kojto | 93:e188a91d3eaa | 117 | }HAL_SMARTCARD_StateTypeDef; |
Kojto | 93:e188a91d3eaa | 118 | |
Kojto | 93:e188a91d3eaa | 119 | /** |
Kojto | 93:e188a91d3eaa | 120 | * @brief HAL SMARTCARD Error Code structure definition |
Kojto | 93:e188a91d3eaa | 121 | */ |
Kojto | 93:e188a91d3eaa | 122 | typedef enum |
Kojto | 93:e188a91d3eaa | 123 | { |
Kojto | 93:e188a91d3eaa | 124 | HAL_SMARTCARD_ERROR_NONE = 0x00, /*!< No error */ |
Kojto | 93:e188a91d3eaa | 125 | HAL_SMARTCARD_ERROR_PE = 0x01, /*!< Parity error */ |
Kojto | 93:e188a91d3eaa | 126 | HAL_SMARTCARD_ERROR_NE = 0x02, /*!< Noise error */ |
Kojto | 93:e188a91d3eaa | 127 | HAL_SMARTCARD_ERROR_FE = 0x04, /*!< frame error */ |
Kojto | 93:e188a91d3eaa | 128 | HAL_SMARTCARD_ERROR_ORE = 0x08, /*!< Overrun error */ |
Kojto | 93:e188a91d3eaa | 129 | HAL_SMARTCARD_ERROR_DMA = 0x10 /*!< DMA transfer error */ |
Kojto | 93:e188a91d3eaa | 130 | }HAL_SMARTCARD_ErrorTypeDef; |
Kojto | 93:e188a91d3eaa | 131 | |
Kojto | 93:e188a91d3eaa | 132 | /** |
Kojto | 93:e188a91d3eaa | 133 | * @brief SMARTCARD handle Structure definition |
Kojto | 93:e188a91d3eaa | 134 | */ |
Kojto | 93:e188a91d3eaa | 135 | typedef struct |
Kojto | 93:e188a91d3eaa | 136 | { |
Kojto | 93:e188a91d3eaa | 137 | USART_TypeDef *Instance; /* USART registers base address */ |
Kojto | 93:e188a91d3eaa | 138 | |
Kojto | 93:e188a91d3eaa | 139 | SMARTCARD_InitTypeDef Init; /* SmartCard communication parameters */ |
Kojto | 93:e188a91d3eaa | 140 | |
Kojto | 93:e188a91d3eaa | 141 | uint8_t *pTxBuffPtr; /* Pointer to SmartCard Tx transfer Buffer */ |
Kojto | 93:e188a91d3eaa | 142 | |
Kojto | 93:e188a91d3eaa | 143 | uint16_t TxXferSize; /* SmartCard Tx Transfer size */ |
Kojto | 93:e188a91d3eaa | 144 | |
Kojto | 93:e188a91d3eaa | 145 | uint16_t TxXferCount; /* SmartCard Tx Transfer Counter */ |
Kojto | 93:e188a91d3eaa | 146 | |
Kojto | 93:e188a91d3eaa | 147 | uint8_t *pRxBuffPtr; /* Pointer to SmartCard Rx transfer Buffer */ |
Kojto | 93:e188a91d3eaa | 148 | |
Kojto | 93:e188a91d3eaa | 149 | uint16_t RxXferSize; /* SmartCard Rx Transfer size */ |
Kojto | 93:e188a91d3eaa | 150 | |
Kojto | 93:e188a91d3eaa | 151 | uint16_t RxXferCount; /* SmartCard Rx Transfer Counter */ |
Kojto | 93:e188a91d3eaa | 152 | |
Kojto | 93:e188a91d3eaa | 153 | DMA_HandleTypeDef *hdmatx; /* SmartCard Tx DMA Handle parameters */ |
Kojto | 93:e188a91d3eaa | 154 | |
Kojto | 93:e188a91d3eaa | 155 | DMA_HandleTypeDef *hdmarx; /* SmartCard Rx DMA Handle parameters */ |
Kojto | 93:e188a91d3eaa | 156 | |
Kojto | 93:e188a91d3eaa | 157 | HAL_LockTypeDef Lock; /* Locking object */ |
Kojto | 93:e188a91d3eaa | 158 | |
Kojto | 93:e188a91d3eaa | 159 | __IO HAL_SMARTCARD_StateTypeDef State; /* SmartCard communication state */ |
Kojto | 93:e188a91d3eaa | 160 | |
Kojto | 93:e188a91d3eaa | 161 | __IO HAL_SMARTCARD_ErrorTypeDef ErrorCode; /* SMARTCARD Error code */ |
Kojto | 93:e188a91d3eaa | 162 | }SMARTCARD_HandleTypeDef; |
Kojto | 93:e188a91d3eaa | 163 | |
Kojto | 93:e188a91d3eaa | 164 | /* Exported constants --------------------------------------------------------*/ |
Kojto | 93:e188a91d3eaa | 165 | /** @defgroup SMARTCARD_Exported_Constants |
Kojto | 93:e188a91d3eaa | 166 | * @{ |
Kojto | 93:e188a91d3eaa | 167 | */ |
Kojto | 93:e188a91d3eaa | 168 | |
Kojto | 93:e188a91d3eaa | 169 | /** @defgroup SMARTCARD_Word_Length |
Kojto | 93:e188a91d3eaa | 170 | * @{ |
Kojto | 93:e188a91d3eaa | 171 | */ |
Kojto | 93:e188a91d3eaa | 172 | #define SMARTCARD_WORDLENGTH_8B ((uint32_t)0x00000000) |
Kojto | 93:e188a91d3eaa | 173 | #define SMARTCARD_WORDLENGTH_9B ((uint32_t)USART_CR1_M) |
Kojto | 93:e188a91d3eaa | 174 | #define IS_SMARTCARD_WORD_LENGTH(LENGTH) (((LENGTH) == SMARTCARD_WORDLENGTH_8B) || \ |
Kojto | 93:e188a91d3eaa | 175 | ((LENGTH) == SMARTCARD_WORDLENGTH_9B)) |
Kojto | 93:e188a91d3eaa | 176 | /** |
Kojto | 93:e188a91d3eaa | 177 | * @} |
Kojto | 93:e188a91d3eaa | 178 | */ |
Kojto | 93:e188a91d3eaa | 179 | |
Kojto | 93:e188a91d3eaa | 180 | /** @defgroup SMARTCARD_Stop_Bits |
Kojto | 93:e188a91d3eaa | 181 | * @{ |
Kojto | 93:e188a91d3eaa | 182 | */ |
Kojto | 93:e188a91d3eaa | 183 | #define SMARTCARD_STOPBITS_1 ((uint32_t)0x00000000) |
Kojto | 93:e188a91d3eaa | 184 | #define SMARTCARD_STOPBITS_0_5 ((uint32_t)USART_CR2_STOP_0) |
Kojto | 93:e188a91d3eaa | 185 | #define SMARTCARD_STOPBITS_2 ((uint32_t)USART_CR2_STOP_1) |
Kojto | 93:e188a91d3eaa | 186 | #define SMARTCARD_STOPBITS_1_5 ((uint32_t)(USART_CR2_STOP_0 | USART_CR2_STOP_1)) |
Kojto | 93:e188a91d3eaa | 187 | #define IS_SMARTCARD_STOPBITS(STOPBITS) (((STOPBITS) == SMARTCARD_STOPBITS_1) || \ |
Kojto | 93:e188a91d3eaa | 188 | ((STOPBITS) == SMARTCARD_STOPBITS_0_5) || \ |
Kojto | 93:e188a91d3eaa | 189 | ((STOPBITS) == SMARTCARD_STOPBITS_1_5) || \ |
Kojto | 93:e188a91d3eaa | 190 | ((STOPBITS) == SMARTCARD_STOPBITS_2)) |
Kojto | 93:e188a91d3eaa | 191 | /** |
Kojto | 93:e188a91d3eaa | 192 | * @} |
Kojto | 93:e188a91d3eaa | 193 | */ |
Kojto | 93:e188a91d3eaa | 194 | |
Kojto | 93:e188a91d3eaa | 195 | /** @defgroup SMARTCARD_Parity |
Kojto | 93:e188a91d3eaa | 196 | * @{ |
Kojto | 93:e188a91d3eaa | 197 | */ |
Kojto | 93:e188a91d3eaa | 198 | #define SMARTCARD_PARITY_NONE ((uint32_t)0x00000000) |
Kojto | 93:e188a91d3eaa | 199 | #define SMARTCARD_PARITY_EVEN ((uint32_t)USART_CR1_PCE) |
Kojto | 93:e188a91d3eaa | 200 | #define SMARTCARD_PARITY_ODD ((uint32_t)(USART_CR1_PCE | USART_CR1_PS)) |
Kojto | 93:e188a91d3eaa | 201 | #define IS_SMARTCARD_PARITY(PARITY) (((PARITY) == SMARTCARD_PARITY_NONE) || \ |
Kojto | 93:e188a91d3eaa | 202 | ((PARITY) == SMARTCARD_PARITY_EVEN) || \ |
Kojto | 93:e188a91d3eaa | 203 | ((PARITY) == SMARTCARD_PARITY_ODD)) |
Kojto | 93:e188a91d3eaa | 204 | /** |
Kojto | 93:e188a91d3eaa | 205 | * @} |
Kojto | 93:e188a91d3eaa | 206 | */ |
Kojto | 93:e188a91d3eaa | 207 | |
Kojto | 93:e188a91d3eaa | 208 | /** @defgroup SMARTCARD_Mode |
Kojto | 93:e188a91d3eaa | 209 | * @{ |
Kojto | 93:e188a91d3eaa | 210 | */ |
Kojto | 93:e188a91d3eaa | 211 | #define SMARTCARD_MODE_RX ((uint32_t)USART_CR1_RE) |
Kojto | 93:e188a91d3eaa | 212 | #define SMARTCARD_MODE_TX ((uint32_t)USART_CR1_TE) |
Kojto | 93:e188a91d3eaa | 213 | #define SMARTCARD_MODE_TX_RX ((uint32_t)(USART_CR1_TE |USART_CR1_RE)) |
Kojto | 93:e188a91d3eaa | 214 | #define IS_SMARTCARD_MODE(MODE) ((((MODE) & (uint32_t)0x0000FFF3) == 0x00) && ((MODE) != (uint32_t)0x000000)) |
Kojto | 93:e188a91d3eaa | 215 | /** |
Kojto | 93:e188a91d3eaa | 216 | * @} |
Kojto | 93:e188a91d3eaa | 217 | */ |
Kojto | 93:e188a91d3eaa | 218 | |
Kojto | 93:e188a91d3eaa | 219 | /** @defgroup SMARTCARD_Clock_Polarity |
Kojto | 93:e188a91d3eaa | 220 | * @{ |
Kojto | 93:e188a91d3eaa | 221 | */ |
Kojto | 93:e188a91d3eaa | 222 | #define SMARTCARD_POLARITY_LOW ((uint32_t)0x00000000) |
Kojto | 93:e188a91d3eaa | 223 | #define SMARTCARD_POLARITY_HIGH ((uint32_t)USART_CR2_CPOL) |
Kojto | 93:e188a91d3eaa | 224 | #define IS_SMARTCARD_POLARITY(CPOL) (((CPOL) == SMARTCARD_POLARITY_LOW) || ((CPOL) == SMARTCARD_POLARITY_HIGH)) |
Kojto | 93:e188a91d3eaa | 225 | /** |
Kojto | 93:e188a91d3eaa | 226 | * @} |
Kojto | 93:e188a91d3eaa | 227 | */ |
Kojto | 93:e188a91d3eaa | 228 | |
Kojto | 93:e188a91d3eaa | 229 | /** @defgroup SMARTCARD_Clock_Phase |
Kojto | 93:e188a91d3eaa | 230 | * @{ |
Kojto | 93:e188a91d3eaa | 231 | */ |
Kojto | 93:e188a91d3eaa | 232 | #define SMARTCARD_PHASE_1EDGE ((uint32_t)0x00000000) |
Kojto | 93:e188a91d3eaa | 233 | #define SMARTCARD_PHASE_2EDGE ((uint32_t)USART_CR2_CPHA) |
Kojto | 93:e188a91d3eaa | 234 | #define IS_SMARTCARD_PHASE(CPHA) (((CPHA) == SMARTCARD_PHASE_1EDGE) || ((CPHA) == SMARTCARD_PHASE_2EDGE)) |
Kojto | 93:e188a91d3eaa | 235 | /** |
Kojto | 93:e188a91d3eaa | 236 | * @} |
Kojto | 93:e188a91d3eaa | 237 | */ |
Kojto | 93:e188a91d3eaa | 238 | |
Kojto | 93:e188a91d3eaa | 239 | /** @defgroup SMARTCARD_Last_Bit |
Kojto | 93:e188a91d3eaa | 240 | * @{ |
Kojto | 93:e188a91d3eaa | 241 | */ |
Kojto | 93:e188a91d3eaa | 242 | #define SMARTCARD_LASTBIT_DISABLE ((uint32_t)0x00000000) |
Kojto | 93:e188a91d3eaa | 243 | #define SMARTCARD_LASTBIT_ENABLE ((uint32_t)USART_CR2_LBCL) |
Kojto | 93:e188a91d3eaa | 244 | #define IS_SMARTCARD_LASTBIT(LASTBIT) (((LASTBIT) == SMARTCARD_LASTBIT_DISABLE) || \ |
Kojto | 93:e188a91d3eaa | 245 | ((LASTBIT) == SMARTCARD_LASTBIT_ENABLE)) |
Kojto | 93:e188a91d3eaa | 246 | /** |
Kojto | 93:e188a91d3eaa | 247 | * @} |
Kojto | 93:e188a91d3eaa | 248 | */ |
Kojto | 93:e188a91d3eaa | 249 | |
Kojto | 93:e188a91d3eaa | 250 | /** @defgroup SmartCard_NACK_State |
Kojto | 93:e188a91d3eaa | 251 | * @{ |
Kojto | 93:e188a91d3eaa | 252 | */ |
Kojto | 93:e188a91d3eaa | 253 | #define SMARTCARD_NACK_ENABLED ((uint32_t)USART_CR3_NACK) |
Kojto | 93:e188a91d3eaa | 254 | #define SMARTCARD_NACK_DISABLED ((uint32_t)0x00000000) |
Kojto | 93:e188a91d3eaa | 255 | #define IS_SMARTCARD_NACK_STATE(NACK) (((NACK) == SMARTCARD_NACK_ENABLED) || \ |
Kojto | 93:e188a91d3eaa | 256 | ((NACK) == SMARTCARD_NACK_DISABLED)) |
Kojto | 93:e188a91d3eaa | 257 | /** |
Kojto | 93:e188a91d3eaa | 258 | * @} |
Kojto | 93:e188a91d3eaa | 259 | */ |
Kojto | 93:e188a91d3eaa | 260 | |
Kojto | 93:e188a91d3eaa | 261 | /** @defgroup SmartCard_DMA_Requests |
Kojto | 93:e188a91d3eaa | 262 | * @{ |
Kojto | 93:e188a91d3eaa | 263 | */ |
Kojto | 93:e188a91d3eaa | 264 | |
Kojto | 93:e188a91d3eaa | 265 | #define SMARTCARD_DMAREQ_TX ((uint32_t)USART_CR3_DMAT) |
Kojto | 93:e188a91d3eaa | 266 | #define SMARTCARD_DMAREQ_RX ((uint32_t)USART_CR3_DMAR) |
Kojto | 93:e188a91d3eaa | 267 | |
Kojto | 93:e188a91d3eaa | 268 | /** |
Kojto | 93:e188a91d3eaa | 269 | * @} |
Kojto | 93:e188a91d3eaa | 270 | */ |
Kojto | 93:e188a91d3eaa | 271 | |
Kojto | 93:e188a91d3eaa | 272 | /** @defgroup SmartCard_Flags |
Kojto | 93:e188a91d3eaa | 273 | * Elements values convention: 0xXXXX |
Kojto | 93:e188a91d3eaa | 274 | * - 0xXXXX : Flag mask in the SR register |
Kojto | 93:e188a91d3eaa | 275 | * @{ |
Kojto | 93:e188a91d3eaa | 276 | */ |
Kojto | 93:e188a91d3eaa | 277 | |
Kojto | 93:e188a91d3eaa | 278 | #define SMARTCARD_FLAG_TXE ((uint32_t)0x00000080) |
Kojto | 93:e188a91d3eaa | 279 | #define SMARTCARD_FLAG_TC ((uint32_t)0x00000040) |
Kojto | 93:e188a91d3eaa | 280 | #define SMARTCARD_FLAG_RXNE ((uint32_t)0x00000020) |
Kojto | 93:e188a91d3eaa | 281 | #define SMARTCARD_FLAG_IDLE ((uint32_t)0x00000010) |
Kojto | 93:e188a91d3eaa | 282 | #define SMARTCARD_FLAG_ORE ((uint32_t)0x00000008) |
Kojto | 93:e188a91d3eaa | 283 | #define SMARTCARD_FLAG_NE ((uint32_t)0x00000004) |
Kojto | 93:e188a91d3eaa | 284 | #define SMARTCARD_FLAG_FE ((uint32_t)0x00000002) |
Kojto | 93:e188a91d3eaa | 285 | #define SMARTCARD_FLAG_PE ((uint32_t)0x00000001) |
Kojto | 93:e188a91d3eaa | 286 | /** |
Kojto | 93:e188a91d3eaa | 287 | * @} |
Kojto | 93:e188a91d3eaa | 288 | */ |
Kojto | 93:e188a91d3eaa | 289 | |
Kojto | 93:e188a91d3eaa | 290 | /** @defgroup SmartCard_Interrupt_definition |
Kojto | 93:e188a91d3eaa | 291 | * Elements values convention: 0xY000XXXX |
Kojto | 93:e188a91d3eaa | 292 | * - XXXX : Interrupt mask in the XX register |
Kojto | 93:e188a91d3eaa | 293 | * - Y : Interrupt source register (2bits) |
Kojto | 93:e188a91d3eaa | 294 | * - 01: CR1 register |
Kojto | 93:e188a91d3eaa | 295 | * - 10: CR3 register |
Kojto | 93:e188a91d3eaa | 296 | |
Kojto | 93:e188a91d3eaa | 297 | * |
Kojto | 93:e188a91d3eaa | 298 | * @{ |
Kojto | 93:e188a91d3eaa | 299 | */ |
Kojto | 93:e188a91d3eaa | 300 | #define SMARTCARD_IT_PE ((uint32_t)0x10000100) |
Kojto | 93:e188a91d3eaa | 301 | #define SMARTCARD_IT_TXE ((uint32_t)0x10000080) |
Kojto | 93:e188a91d3eaa | 302 | #define SMARTCARD_IT_TC ((uint32_t)0x10000040) |
Kojto | 93:e188a91d3eaa | 303 | #define SMARTCARD_IT_RXNE ((uint32_t)0x10000020) |
Kojto | 93:e188a91d3eaa | 304 | #define SMARTCARD_IT_IDLE ((uint32_t)0x10000010) |
Kojto | 93:e188a91d3eaa | 305 | #define SMARTCARD_IT_ERR ((uint32_t)0x20000001) |
Kojto | 93:e188a91d3eaa | 306 | |
Kojto | 93:e188a91d3eaa | 307 | /** |
Kojto | 93:e188a91d3eaa | 308 | * @} |
Kojto | 93:e188a91d3eaa | 309 | */ |
Kojto | 93:e188a91d3eaa | 310 | |
Kojto | 93:e188a91d3eaa | 311 | /** |
Kojto | 93:e188a91d3eaa | 312 | * @} |
Kojto | 93:e188a91d3eaa | 313 | */ |
Kojto | 93:e188a91d3eaa | 314 | |
Kojto | 93:e188a91d3eaa | 315 | /* Exported macro ------------------------------------------------------------*/ |
Kojto | 93:e188a91d3eaa | 316 | |
Kojto | 93:e188a91d3eaa | 317 | /** @brief Reset SMARTCARD handle state |
Kojto | 93:e188a91d3eaa | 318 | * @param __HANDLE__: specifies the SMARTCARD Handle. |
Kojto | 93:e188a91d3eaa | 319 | * @retval None |
Kojto | 93:e188a91d3eaa | 320 | */ |
Kojto | 93:e188a91d3eaa | 321 | #define __HAL_SMARTCARD_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_SMARTCARD_STATE_RESET) |
Kojto | 93:e188a91d3eaa | 322 | |
Kojto | 93:e188a91d3eaa | 323 | /** @brief Flushs the Smartcard DR register |
Kojto | 93:e188a91d3eaa | 324 | * @param __HANDLE__: specifies the SMARTCARD Handle. |
Kojto | 93:e188a91d3eaa | 325 | */ |
Kojto | 93:e188a91d3eaa | 326 | #define __HAL_SMARTCARD_FLUSH_DRREGISTER(__HANDLE__) ((__HANDLE__)->Instance->DR) |
Kojto | 93:e188a91d3eaa | 327 | |
Kojto | 93:e188a91d3eaa | 328 | /** @brief Checks whether the specified Smartcard flag is set or not. |
Kojto | 93:e188a91d3eaa | 329 | * @param __HANDLE__: specifies the SMARTCARD Handle. |
Kojto | 93:e188a91d3eaa | 330 | * @param __FLAG__: specifies the flag to check. |
Kojto | 93:e188a91d3eaa | 331 | * This parameter can be one of the following values: |
Kojto | 93:e188a91d3eaa | 332 | * @arg SMARTCARD_FLAG_TXE: Transmit data register empty flag |
Kojto | 93:e188a91d3eaa | 333 | * @arg SMARTCARD_FLAG_TC: Transmission Complete flag |
Kojto | 93:e188a91d3eaa | 334 | * @arg SMARTCARD_FLAG_RXNE: Receive data register not empty flag |
Kojto | 93:e188a91d3eaa | 335 | * @arg SMARTCARD_FLAG_IDLE: Idle Line detection flag |
Kojto | 93:e188a91d3eaa | 336 | * @arg SMARTCARD_FLAG_ORE: OverRun Error flag |
Kojto | 93:e188a91d3eaa | 337 | * @arg SMARTCARD_FLAG_NE: Noise Error flag |
Kojto | 93:e188a91d3eaa | 338 | * @arg SMARTCARD_FLAG_FE: Framing Error flag |
Kojto | 93:e188a91d3eaa | 339 | * @arg SMARTCARD_FLAG_PE: Parity Error flag |
Kojto | 93:e188a91d3eaa | 340 | * @retval The new state of __FLAG__ (TRUE or FALSE). |
Kojto | 93:e188a91d3eaa | 341 | */ |
Kojto | 93:e188a91d3eaa | 342 | #define __HAL_SMARTCARD_GET_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->SR & (__FLAG__)) == (__FLAG__)) |
Kojto | 93:e188a91d3eaa | 343 | |
Kojto | 93:e188a91d3eaa | 344 | /** @brief Clears the specified Smartcard pending flags. |
Kojto | 93:e188a91d3eaa | 345 | * @param __HANDLE__: specifies the SMARTCARD Handle. |
Kojto | 93:e188a91d3eaa | 346 | * @param __FLAG__: specifies the flag to check. |
Kojto | 93:e188a91d3eaa | 347 | * This parameter can be any combination of the following values: |
Kojto | 93:e188a91d3eaa | 348 | * @arg SMARTCARD_FLAG_TC: Transmission Complete flag. |
Kojto | 93:e188a91d3eaa | 349 | * @arg SMARTCARD_FLAG_RXNE: Receive data register not empty flag. |
Kojto | 93:e188a91d3eaa | 350 | * |
Kojto | 93:e188a91d3eaa | 351 | * @note PE (Parity error), FE (Framing error), NE (Noise error) and ORE (OverRun |
Kojto | 93:e188a91d3eaa | 352 | * error) flags are cleared by software sequence: a read operation to |
Kojto | 93:e188a91d3eaa | 353 | * USART_SR register followed by a read operation to USART_DR register. |
Kojto | 93:e188a91d3eaa | 354 | * @note RXNE flag can be also cleared by a read to the USART_DR register. |
Kojto | 93:e188a91d3eaa | 355 | * @note TC flag can be also cleared by software sequence: a read operation to |
Kojto | 93:e188a91d3eaa | 356 | * USART_SR register followed by a write operation to USART_DR register. |
Kojto | 93:e188a91d3eaa | 357 | * @note TXE flag is cleared only by a write to the USART_DR register. |
Kojto | 93:e188a91d3eaa | 358 | */ |
Kojto | 93:e188a91d3eaa | 359 | #define __HAL_SMARTCARD_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->SR = ~(__FLAG__)) |
Kojto | 93:e188a91d3eaa | 360 | |
Kojto | 93:e188a91d3eaa | 361 | /** @brief Clear the SMARTCARD PE pending flag. |
Kojto | 93:e188a91d3eaa | 362 | * @param __HANDLE__: specifies the USART Handle. |
Kojto | 93:e188a91d3eaa | 363 | * This parameter can be USARTx where x: 1, 2, 3, 4, 5, 6, 7 or 8 to select the USART or |
Kojto | 93:e188a91d3eaa | 364 | * UART peripheral. |
Kojto | 93:e188a91d3eaa | 365 | * @retval None |
Kojto | 93:e188a91d3eaa | 366 | */ |
Kojto | 93:e188a91d3eaa | 367 | #define __HAL_SMARTCARD_CLEAR_PEFLAG(__HANDLE__) do{(__HANDLE__)->Instance->SR;\ |
Kojto | 93:e188a91d3eaa | 368 | (__HANDLE__)->Instance->DR;}while(0) |
Kojto | 93:e188a91d3eaa | 369 | /** @brief Clear the SMARTCARD FE pending flag. |
Kojto | 93:e188a91d3eaa | 370 | * @param __HANDLE__: specifies the USART Handle. |
Kojto | 93:e188a91d3eaa | 371 | * This parameter can be USARTx where x: 1, 2, 3, 4, 5, 6, 7 or 8 to select the USART or |
Kojto | 93:e188a91d3eaa | 372 | * UART peripheral. |
Kojto | 93:e188a91d3eaa | 373 | * @retval None |
Kojto | 93:e188a91d3eaa | 374 | */ |
Kojto | 93:e188a91d3eaa | 375 | #define __HAL_SMARTCARD_CLEAR_FEFLAG(__HANDLE__) __HAL_SMARTCARD_CLEAR_PEFLAG(__HANDLE__) |
Kojto | 93:e188a91d3eaa | 376 | |
Kojto | 93:e188a91d3eaa | 377 | /** @brief Clear the SMARTCARD NE pending flag. |
Kojto | 93:e188a91d3eaa | 378 | * @param __HANDLE__: specifies the USART Handle. |
Kojto | 93:e188a91d3eaa | 379 | * This parameter can be USARTx where x: 1, 2, 3, 4, 5, 6, 7 or 8 to select the USART or |
Kojto | 93:e188a91d3eaa | 380 | * UART peripheral. |
Kojto | 93:e188a91d3eaa | 381 | * @retval None |
Kojto | 93:e188a91d3eaa | 382 | */ |
Kojto | 93:e188a91d3eaa | 383 | #define __HAL_SMARTCARD_CLEAR_NEFLAG(__HANDLE__) __HAL_SMARTCARD_CLEAR_PEFLAG(__HANDLE__) |
Kojto | 93:e188a91d3eaa | 384 | |
Kojto | 93:e188a91d3eaa | 385 | /** @brief Clear the SMARTCARD ORE pending flag. |
Kojto | 93:e188a91d3eaa | 386 | * @param __HANDLE__: specifies the USART Handle. |
Kojto | 93:e188a91d3eaa | 387 | * This parameter can be USARTx where x: 1, 2, 3, 4, 5, 6, 7 or 8 to select the USART or |
Kojto | 93:e188a91d3eaa | 388 | * UART peripheral. |
Kojto | 93:e188a91d3eaa | 389 | * @retval None |
Kojto | 93:e188a91d3eaa | 390 | */ |
Kojto | 93:e188a91d3eaa | 391 | #define __HAL_SMARTCARD_CLEAR_OREFLAG(__HANDLE__) __HAL_SMARTCARD_CLEAR_PEFLAG(__HANDLE__) |
Kojto | 93:e188a91d3eaa | 392 | |
Kojto | 93:e188a91d3eaa | 393 | /** @brief Clear the SMARTCARD IDLE pending flag. |
Kojto | 93:e188a91d3eaa | 394 | * @param __HANDLE__: specifies the USART Handle. |
Kojto | 93:e188a91d3eaa | 395 | * This parameter can be USARTx where x: 1, 2, 3, 4, 5, 6, 7 or 8 to select the USART or |
Kojto | 93:e188a91d3eaa | 396 | * UART peripheral. |
Kojto | 93:e188a91d3eaa | 397 | * @retval None |
Kojto | 93:e188a91d3eaa | 398 | */ |
Kojto | 93:e188a91d3eaa | 399 | #define __HAL_SMARTCARD_CLEAR_IDLEFLAG(__HANDLE__) __HAL_SMARTCARD_CLEAR_PEFLAG(__HANDLE__) |
Kojto | 93:e188a91d3eaa | 400 | |
Kojto | 93:e188a91d3eaa | 401 | |
Kojto | 93:e188a91d3eaa | 402 | /** @brief Enables or disables the specified SmartCard interrupts. |
Kojto | 93:e188a91d3eaa | 403 | * @param __HANDLE__: specifies the SMARTCARD Handle. |
Kojto | 93:e188a91d3eaa | 404 | * @param __INTERRUPT__: specifies the SMARTCARD interrupt source to check. |
Kojto | 93:e188a91d3eaa | 405 | * This parameter can be one of the following values: |
Kojto | 93:e188a91d3eaa | 406 | * @arg SMARTCARD_IT_TXE: Transmit Data Register empty interrupt |
Kojto | 93:e188a91d3eaa | 407 | * @arg SMARTCARD_IT_TC: Transmission complete interrupt |
Kojto | 93:e188a91d3eaa | 408 | * @arg SMARTCARD_IT_RXNE: Receive Data register not empty interrupt |
Kojto | 93:e188a91d3eaa | 409 | * @arg SMARTCARD_IT_IDLE: Idle line detection interrupt |
Kojto | 93:e188a91d3eaa | 410 | * @arg SMARTCARD_IT_PE: Parity Error interrupt |
Kojto | 93:e188a91d3eaa | 411 | * @arg SMARTCARD_IT_ERR: Error interrupt(Frame error, noise error, overrun error) |
Kojto | 93:e188a91d3eaa | 412 | */ |
Kojto | 93:e188a91d3eaa | 413 | #define SMARTCARD_IT_MASK ((uint32_t)0x0000FFFF) |
Kojto | 93:e188a91d3eaa | 414 | #define __SMARTCARD_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((((__INTERRUPT__) >> 28) == 1)? ((__HANDLE__)->Instance->CR1 |= ((__INTERRUPT__) & SMARTCARD_IT_MASK)): \ |
Kojto | 93:e188a91d3eaa | 415 | ((__HANDLE__)->Instance->CR3 |= ((__INTERRUPT__) & SMARTCARD_IT_MASK))) |
Kojto | 93:e188a91d3eaa | 416 | #define __SMARTCARD_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((((__INTERRUPT__) >> 28) == 1)? ((__HANDLE__)->Instance->CR1 &= ~((__INTERRUPT__) & SMARTCARD_IT_MASK)): \ |
Kojto | 93:e188a91d3eaa | 417 | ((__HANDLE__)->Instance->CR3 &= ~ ((__INTERRUPT__) & SMARTCARD_IT_MASK))) |
Kojto | 93:e188a91d3eaa | 418 | |
Kojto | 93:e188a91d3eaa | 419 | /** @brief Checks whether the specified SmartCard interrupt has occurred or not. |
Kojto | 93:e188a91d3eaa | 420 | * @param __HANDLE__: specifies the SmartCard Handle. |
Kojto | 93:e188a91d3eaa | 421 | * @param __IT__: specifies the SMARTCARD interrupt source to check. |
Kojto | 93:e188a91d3eaa | 422 | * This parameter can be one of the following values: |
Kojto | 93:e188a91d3eaa | 423 | * @arg SMARTCARD_IT_TXE: Transmit Data Register empty interrupt |
Kojto | 93:e188a91d3eaa | 424 | * @arg SMARTCARD_IT_TC: Transmission complete interrupt |
Kojto | 93:e188a91d3eaa | 425 | * @arg SMARTCARD_IT_RXNE: Receive Data register not empty interrupt |
Kojto | 93:e188a91d3eaa | 426 | * @arg SMARTCARD_IT_IDLE: Idle line detection interrupt |
Kojto | 93:e188a91d3eaa | 427 | * @arg SMARTCARD_IT_ERR: Error interrupt |
Kojto | 93:e188a91d3eaa | 428 | * @arg SMARTCARD_IT_PE: Parity Error interrupt |
Kojto | 93:e188a91d3eaa | 429 | * @retval The new state of __IT__ (TRUE or FALSE). |
Kojto | 93:e188a91d3eaa | 430 | */ |
Kojto | 93:e188a91d3eaa | 431 | #define __HAL_SMARTCARD_GET_IT_SOURCE(__HANDLE__, __IT__) (((((__IT__) >> 28) == 1)? (__HANDLE__)->Instance->CR1: (__HANDLE__)->Instance->CR3) & (((uint32_t)(__IT__)) & SMARTCARD_IT_MASK)) |
Kojto | 93:e188a91d3eaa | 432 | |
Kojto | 93:e188a91d3eaa | 433 | /** @brief Macros to enable or disable the SmartCard interface. |
Kojto | 93:e188a91d3eaa | 434 | * @param __HANDLE__: specifies the SmartCard Handle. |
Kojto | 93:e188a91d3eaa | 435 | */ |
Kojto | 93:e188a91d3eaa | 436 | #define __SMARTCARD_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR1 |= USART_CR1_UE) |
Kojto | 93:e188a91d3eaa | 437 | #define __SMARTCARD_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR1 &= ~USART_CR1_UE) |
Kojto | 93:e188a91d3eaa | 438 | |
Kojto | 93:e188a91d3eaa | 439 | /** @brief Macros to enable or disable the SmartCard DMA request. |
Kojto | 93:e188a91d3eaa | 440 | * @param __HANDLE__: specifies the SmartCard Handle. |
Kojto | 93:e188a91d3eaa | 441 | * @param __REQUEST__: specifies the SmartCard DMA request. |
Kojto | 93:e188a91d3eaa | 442 | * This parameter can be one of the following values: |
Kojto | 93:e188a91d3eaa | 443 | * @arg SMARTCARD_DMAREQ_TX: SmartCard DMA transmit request |
Kojto | 93:e188a91d3eaa | 444 | * @arg SMARTCARD_DMAREQ_RX: SmartCard DMA receive request |
Kojto | 93:e188a91d3eaa | 445 | */ |
Kojto | 93:e188a91d3eaa | 446 | #define __SMARTCARD_DMA_REQUEST_ENABLE(__HANDLE__, __REQUEST__) ((__HANDLE__)->Instance->CR3 |= (__REQUEST__)) |
Kojto | 93:e188a91d3eaa | 447 | #define __SMARTCARD_DMA_REQUEST_DISABLE(__HANDLE__, __REQUEST__) ((__HANDLE__)->Instance->CR3 &= ~(__REQUEST__)) |
Kojto | 93:e188a91d3eaa | 448 | |
Kojto | 93:e188a91d3eaa | 449 | #define __DIV(_PCLK_, _BAUD_) (((_PCLK_)*25)/(4*(_BAUD_))) |
Kojto | 93:e188a91d3eaa | 450 | #define __DIVMANT(_PCLK_, _BAUD_) (__DIV((_PCLK_), (_BAUD_))/100) |
Kojto | 93:e188a91d3eaa | 451 | #define __DIVFRAQ(_PCLK_, _BAUD_) (((__DIV((_PCLK_), (_BAUD_)) - (__DIVMANT((_PCLK_), (_BAUD_)) * 100)) * 16 + 50) / 100) |
Kojto | 93:e188a91d3eaa | 452 | #define __SMARTCARD_BRR(_PCLK_, _BAUD_) ((__DIVMANT((_PCLK_), (_BAUD_)) << 4)|(__DIVFRAQ((_PCLK_), (_BAUD_)) & 0x0F)) |
Kojto | 93:e188a91d3eaa | 453 | |
Kojto | 93:e188a91d3eaa | 454 | #define IS_SMARTCARD_BAUDRATE(BAUDRATE) ((BAUDRATE) < 10500001) |
Kojto | 93:e188a91d3eaa | 455 | |
Kojto | 93:e188a91d3eaa | 456 | /* Exported functions --------------------------------------------------------*/ |
Kojto | 93:e188a91d3eaa | 457 | /* Initialization/de-initialization functions **********************************/ |
Kojto | 93:e188a91d3eaa | 458 | HAL_StatusTypeDef HAL_SMARTCARD_Init(SMARTCARD_HandleTypeDef *hsc); |
Kojto | 93:e188a91d3eaa | 459 | HAL_StatusTypeDef HAL_SMARTCARD_ReInit(SMARTCARD_HandleTypeDef *hsc); |
Kojto | 93:e188a91d3eaa | 460 | HAL_StatusTypeDef HAL_SMARTCARD_DeInit(SMARTCARD_HandleTypeDef *hsc); |
Kojto | 93:e188a91d3eaa | 461 | void HAL_SMARTCARD_MspInit(SMARTCARD_HandleTypeDef *hsc); |
Kojto | 93:e188a91d3eaa | 462 | void HAL_SMARTCARD_MspDeInit(SMARTCARD_HandleTypeDef *hsc); |
Kojto | 93:e188a91d3eaa | 463 | /* IO operation functions *******************************************************/ |
Kojto | 93:e188a91d3eaa | 464 | HAL_StatusTypeDef HAL_SMARTCARD_Transmit(SMARTCARD_HandleTypeDef *hsc, uint8_t *pData, uint16_t Size, uint32_t Timeout); |
Kojto | 93:e188a91d3eaa | 465 | HAL_StatusTypeDef HAL_SMARTCARD_Receive(SMARTCARD_HandleTypeDef *hsc, uint8_t *pData, uint16_t Size, uint32_t Timeout); |
Kojto | 93:e188a91d3eaa | 466 | HAL_StatusTypeDef HAL_SMARTCARD_Transmit_IT(SMARTCARD_HandleTypeDef *hsc, uint8_t *pData, uint16_t Size); |
Kojto | 93:e188a91d3eaa | 467 | HAL_StatusTypeDef HAL_SMARTCARD_Receive_IT(SMARTCARD_HandleTypeDef *hsc, uint8_t *pData, uint16_t Size); |
Kojto | 93:e188a91d3eaa | 468 | HAL_StatusTypeDef HAL_SMARTCARD_Transmit_DMA(SMARTCARD_HandleTypeDef *hsc, uint8_t *pData, uint16_t Size); |
Kojto | 93:e188a91d3eaa | 469 | HAL_StatusTypeDef HAL_SMARTCARD_Receive_DMA(SMARTCARD_HandleTypeDef *hsc, uint8_t *pData, uint16_t Size); |
Kojto | 93:e188a91d3eaa | 470 | void HAL_SMARTCARD_IRQHandler(SMARTCARD_HandleTypeDef *hsc); |
Kojto | 93:e188a91d3eaa | 471 | void HAL_SMARTCARD_TxCpltCallback(SMARTCARD_HandleTypeDef *hsc); |
Kojto | 93:e188a91d3eaa | 472 | void HAL_SMARTCARD_RxCpltCallback(SMARTCARD_HandleTypeDef *hsc); |
Kojto | 93:e188a91d3eaa | 473 | void HAL_SMARTCARD_ErrorCallback(SMARTCARD_HandleTypeDef *hsc); |
Kojto | 93:e188a91d3eaa | 474 | |
Kojto | 93:e188a91d3eaa | 475 | /* Peripheral State functions **************************************************/ |
Kojto | 93:e188a91d3eaa | 476 | HAL_SMARTCARD_StateTypeDef HAL_SMARTCARD_GetState(SMARTCARD_HandleTypeDef *hsc); |
Kojto | 93:e188a91d3eaa | 477 | uint32_t HAL_SMARTCARD_GetError(SMARTCARD_HandleTypeDef *hsc); |
Kojto | 93:e188a91d3eaa | 478 | |
Kojto | 93:e188a91d3eaa | 479 | /** |
Kojto | 93:e188a91d3eaa | 480 | * @} |
Kojto | 93:e188a91d3eaa | 481 | */ |
Kojto | 93:e188a91d3eaa | 482 | |
Kojto | 93:e188a91d3eaa | 483 | /** |
Kojto | 93:e188a91d3eaa | 484 | * @} |
Kojto | 93:e188a91d3eaa | 485 | */ |
Kojto | 93:e188a91d3eaa | 486 | |
Kojto | 93:e188a91d3eaa | 487 | #ifdef __cplusplus |
Kojto | 93:e188a91d3eaa | 488 | } |
Kojto | 93:e188a91d3eaa | 489 | #endif |
Kojto | 93:e188a91d3eaa | 490 | |
Kojto | 93:e188a91d3eaa | 491 | #endif /* __STM32F4xx_HAL_SMARTCARD_H */ |
Kojto | 93:e188a91d3eaa | 492 | |
Kojto | 93:e188a91d3eaa | 493 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |