mbed library sources modified for open wear
Dependents: openwear-lifelogger-example
Fork of mbed-src by
targets/cmsis/TARGET_STM/TARGET_NUCLEO_F401RE/stm32f4xx_hal_smartcard.c@310:6188e0254baa, 2014-09-16 (annotated)
- Committer:
- janekm
- Date:
- Tue Sep 16 22:42:01 2014 +0000
- Revision:
- 310:6188e0254baa
- Parent:
- 226:b062af740e40
N/A
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mbed_official | 87:085cde657901 | 1 | /** |
mbed_official | 87:085cde657901 | 2 | ****************************************************************************** |
mbed_official | 87:085cde657901 | 3 | * @file stm32f4xx_hal_smartcard.c |
mbed_official | 87:085cde657901 | 4 | * @author MCD Application Team |
mbed_official | 226:b062af740e40 | 5 | * @version V1.1.0RC2 |
mbed_official | 226:b062af740e40 | 6 | * @date 14-May-2014 |
mbed_official | 87:085cde657901 | 7 | * @brief SMARTCARD HAL module driver. |
mbed_official | 87:085cde657901 | 8 | * This file provides firmware functions to manage the following |
mbed_official | 87:085cde657901 | 9 | * functionalities of the SMARTCARD peripheral: |
mbed_official | 87:085cde657901 | 10 | * + Initialization and de-initialization functions |
mbed_official | 87:085cde657901 | 11 | * + IO operation functions |
mbed_official | 87:085cde657901 | 12 | * + Peripheral State and Errors functions |
mbed_official | 87:085cde657901 | 13 | * |
mbed_official | 87:085cde657901 | 14 | @verbatim |
mbed_official | 87:085cde657901 | 15 | ============================================================================== |
mbed_official | 87:085cde657901 | 16 | ##### How to use this driver ##### |
mbed_official | 87:085cde657901 | 17 | ============================================================================== |
mbed_official | 87:085cde657901 | 18 | [..] |
mbed_official | 226:b062af740e40 | 19 | The SMARTCARD HAL driver can be used as follows: |
mbed_official | 87:085cde657901 | 20 | |
mbed_official | 87:085cde657901 | 21 | (#) Declare a SMARTCARD_HandleTypeDef handle structure. |
mbed_official | 226:b062af740e40 | 22 | (#) Initialize the SMARTCARD low level resources by implementing the HAL_SMARTCARD_MspInit() API: |
mbed_official | 87:085cde657901 | 23 | (##) Enable the USARTx interface clock. |
mbed_official | 87:085cde657901 | 24 | (##) SMARTCARD pins configuration: |
mbed_official | 87:085cde657901 | 25 | (+++) Enable the clock for the SMARTCARD GPIOs. |
mbed_official | 87:085cde657901 | 26 | (+++) Configure these SMARTCARD pins as alternate function pull-up. |
mbed_official | 87:085cde657901 | 27 | (##) NVIC configuration if you need to use interrupt process (HAL_SMARTCARD_Transmit_IT() |
mbed_official | 87:085cde657901 | 28 | and HAL_SMARTCARD_Receive_IT() APIs): |
mbed_official | 87:085cde657901 | 29 | (+++) Configure the USARTx interrupt priority. |
mbed_official | 87:085cde657901 | 30 | (+++) Enable the NVIC USART IRQ handle. |
mbed_official | 87:085cde657901 | 31 | (##) DMA Configuration if you need to use DMA process (HAL_SMARTCARD_Transmit_DMA() |
mbed_official | 87:085cde657901 | 32 | and HAL_SMARTCARD_Receive_DMA() APIs): |
mbed_official | 87:085cde657901 | 33 | (+++) Declare a DMA handle structure for the Tx/Rx stream. |
mbed_official | 87:085cde657901 | 34 | (+++) Enable the DMAx interface clock. |
mbed_official | 87:085cde657901 | 35 | (+++) Configure the declared DMA handle structure with the required Tx/Rx parameters. |
mbed_official | 87:085cde657901 | 36 | (+++) Configure the DMA Tx/Rx Stream. |
mbed_official | 87:085cde657901 | 37 | (+++) Associate the initilalized DMA handle to the SMARTCARD DMA Tx/Rx handle. |
mbed_official | 87:085cde657901 | 38 | (+++) Configure the priority and enable the NVIC for the transfer complete interrupt on the DMA Tx/Rx Stream. |
mbed_official | 87:085cde657901 | 39 | |
mbed_official | 87:085cde657901 | 40 | (#) Program the Baud Rate, Word Length , Stop Bit, Parity, Hardware |
mbed_official | 226:b062af740e40 | 41 | flow control and Mode(Receiver/Transmitter) in the SMARTCARD Init structure. |
mbed_official | 87:085cde657901 | 42 | |
mbed_official | 87:085cde657901 | 43 | (#) Initialize the SMARTCARD registers by calling the HAL_SMARTCARD_Init() API: |
mbed_official | 226:b062af740e40 | 44 | (++) These APIs configure also the low level Hardware GPIO, CLOCK, CORTEX...etc) |
mbed_official | 226:b062af740e40 | 45 | by calling the customed HAL_SMARTCARD_MspInit() API. |
mbed_official | 226:b062af740e40 | 46 | [..] |
mbed_official | 226:b062af740e40 | 47 | (@) The specific SMARTCARD interrupts (Transmission complete interrupt, |
mbed_official | 226:b062af740e40 | 48 | RXNE interrupt and Error Interrupts) will be managed using the macros |
mbed_official | 226:b062af740e40 | 49 | __SMARTCARD_ENABLE_IT() and __SMARTCARD_DISABLE_IT() inside the transmit and receive process. |
mbed_official | 226:b062af740e40 | 50 | |
mbed_official | 226:b062af740e40 | 51 | [..] |
mbed_official | 226:b062af740e40 | 52 | Three operation modes are available within this driver : |
mbed_official | 87:085cde657901 | 53 | |
mbed_official | 87:085cde657901 | 54 | *** Polling mode IO operation *** |
mbed_official | 87:085cde657901 | 55 | ================================= |
mbed_official | 87:085cde657901 | 56 | [..] |
mbed_official | 87:085cde657901 | 57 | (+) Send an amount of data in blocking mode using HAL_SMARTCARD_Transmit() |
mbed_official | 87:085cde657901 | 58 | (+) Receive an amount of data in blocking mode using HAL_SMARTCARD_Receive() |
mbed_official | 87:085cde657901 | 59 | |
mbed_official | 87:085cde657901 | 60 | *** Interrupt mode IO operation *** |
mbed_official | 87:085cde657901 | 61 | =================================== |
mbed_official | 87:085cde657901 | 62 | [..] |
mbed_official | 87:085cde657901 | 63 | (+) Send an amount of data in non blocking mode using HAL_SMARTCARD_Transmit_IT() |
mbed_official | 87:085cde657901 | 64 | (+) At transmission end of transfer HAL_SMARTCARD_TxCpltCallback is executed and user can |
mbed_official | 87:085cde657901 | 65 | add his own code by customization of function pointer HAL_SMARTCARD_TxCpltCallback |
mbed_official | 87:085cde657901 | 66 | (+) Receive an amount of data in non blocking mode using HAL_SMARTCARD_Receive_IT() |
mbed_official | 87:085cde657901 | 67 | (+) At reception end of transfer HAL_SMARTCARD_RxCpltCallback is executed and user can |
mbed_official | 106:ced8cbb51063 | 68 | add his own code by customization of function pointer HAL_SMARTCARD_RxCpltCallback |
mbed_official | 87:085cde657901 | 69 | (+) In case of transfer Error, HAL_SMARTCARD_ErrorCallback() function is executed and user can |
mbed_official | 87:085cde657901 | 70 | add his own code by customization of function pointer HAL_SMARTCARD_ErrorCallback |
mbed_official | 87:085cde657901 | 71 | |
mbed_official | 87:085cde657901 | 72 | *** DMA mode IO operation *** |
mbed_official | 87:085cde657901 | 73 | ============================== |
mbed_official | 87:085cde657901 | 74 | [..] |
mbed_official | 87:085cde657901 | 75 | (+) Send an amount of data in non blocking mode (DMA) using HAL_SMARTCARD_Transmit_DMA() |
mbed_official | 87:085cde657901 | 76 | (+) At transmission end of transfer HAL_SMARTCARD_TxCpltCallback is executed and user can |
mbed_official | 87:085cde657901 | 77 | add his own code by customization of function pointer HAL_SMARTCARD_TxCpltCallback |
mbed_official | 87:085cde657901 | 78 | (+) Receive an amount of data in non blocking mode (DMA) using HAL_SMARTCARD_Receive_DMA() |
mbed_official | 87:085cde657901 | 79 | (+) At reception end of transfer HAL_SMARTCARD_RxCpltCallback is executed and user can |
mbed_official | 106:ced8cbb51063 | 80 | add his own code by customization of function pointer HAL_SMARTCARD_RxCpltCallback |
mbed_official | 87:085cde657901 | 81 | (+) In case of transfer Error, HAL_SMARTCARD_ErrorCallback() function is executed and user can |
mbed_official | 87:085cde657901 | 82 | add his own code by customization of function pointer HAL_SMARTCARD_ErrorCallback |
mbed_official | 87:085cde657901 | 83 | |
mbed_official | 87:085cde657901 | 84 | *** SMARTCARD HAL driver macros list *** |
mbed_official | 87:085cde657901 | 85 | ============================================= |
mbed_official | 87:085cde657901 | 86 | [..] |
mbed_official | 87:085cde657901 | 87 | Below the list of most used macros in SMARTCARD HAL driver. |
mbed_official | 87:085cde657901 | 88 | |
mbed_official | 87:085cde657901 | 89 | (+) __HAL_SMARTCARD_ENABLE: Enable the SMARTCARD peripheral |
mbed_official | 87:085cde657901 | 90 | (+) __HAL_SMARTCARD_DISABLE: Disable the SMARTCARD peripheral |
mbed_official | 226:b062af740e40 | 91 | (+) __HAL_SMARTCARD_GET_FLAG : Check whether the specified SMARTCARD flag is set or not |
mbed_official | 226:b062af740e40 | 92 | (+) __HAL_SMARTCARD_CLEAR_FLAG : Clear the specified SMARTCARD pending flag |
mbed_official | 226:b062af740e40 | 93 | (+) __HAL_SMARTCARD_ENABLE_IT: Enable the specified SMARTCARD interrupt |
mbed_official | 226:b062af740e40 | 94 | (+) __HAL_SMARTCARD_DISABLE_IT: Disable the specified SMARTCARD interrupt |
mbed_official | 87:085cde657901 | 95 | |
mbed_official | 87:085cde657901 | 96 | [..] |
mbed_official | 87:085cde657901 | 97 | (@) You can refer to the SMARTCARD HAL driver header file for more useful macros |
mbed_official | 87:085cde657901 | 98 | |
mbed_official | 87:085cde657901 | 99 | @endverbatim |
mbed_official | 87:085cde657901 | 100 | ****************************************************************************** |
mbed_official | 87:085cde657901 | 101 | * @attention |
mbed_official | 87:085cde657901 | 102 | * |
mbed_official | 87:085cde657901 | 103 | * <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2> |
mbed_official | 87:085cde657901 | 104 | * |
mbed_official | 87:085cde657901 | 105 | * Redistribution and use in source and binary forms, with or without modification, |
mbed_official | 87:085cde657901 | 106 | * are permitted provided that the following conditions are met: |
mbed_official | 87:085cde657901 | 107 | * 1. Redistributions of source code must retain the above copyright notice, |
mbed_official | 87:085cde657901 | 108 | * this list of conditions and the following disclaimer. |
mbed_official | 87:085cde657901 | 109 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
mbed_official | 87:085cde657901 | 110 | * this list of conditions and the following disclaimer in the documentation |
mbed_official | 87:085cde657901 | 111 | * and/or other materials provided with the distribution. |
mbed_official | 87:085cde657901 | 112 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
mbed_official | 87:085cde657901 | 113 | * may be used to endorse or promote products derived from this software |
mbed_official | 87:085cde657901 | 114 | * without specific prior written permission. |
mbed_official | 87:085cde657901 | 115 | * |
mbed_official | 87:085cde657901 | 116 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
mbed_official | 87:085cde657901 | 117 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
mbed_official | 87:085cde657901 | 118 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
mbed_official | 87:085cde657901 | 119 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
mbed_official | 87:085cde657901 | 120 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
mbed_official | 87:085cde657901 | 121 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
mbed_official | 87:085cde657901 | 122 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
mbed_official | 87:085cde657901 | 123 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
mbed_official | 87:085cde657901 | 124 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
mbed_official | 87:085cde657901 | 125 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
mbed_official | 87:085cde657901 | 126 | * |
mbed_official | 87:085cde657901 | 127 | ****************************************************************************** |
mbed_official | 87:085cde657901 | 128 | */ |
mbed_official | 87:085cde657901 | 129 | |
mbed_official | 87:085cde657901 | 130 | /* Includes ------------------------------------------------------------------*/ |
mbed_official | 87:085cde657901 | 131 | #include "stm32f4xx_hal.h" |
mbed_official | 87:085cde657901 | 132 | |
mbed_official | 87:085cde657901 | 133 | /** @addtogroup STM32F4xx_HAL_Driver |
mbed_official | 87:085cde657901 | 134 | * @{ |
mbed_official | 87:085cde657901 | 135 | */ |
mbed_official | 87:085cde657901 | 136 | |
mbed_official | 87:085cde657901 | 137 | /** @defgroup SMARTCARD |
mbed_official | 87:085cde657901 | 138 | * @brief HAL USART SMARTCARD module driver |
mbed_official | 87:085cde657901 | 139 | * @{ |
mbed_official | 87:085cde657901 | 140 | */ |
mbed_official | 87:085cde657901 | 141 | #ifdef HAL_SMARTCARD_MODULE_ENABLED |
mbed_official | 87:085cde657901 | 142 | /* Private typedef -----------------------------------------------------------*/ |
mbed_official | 87:085cde657901 | 143 | /* Private define ------------------------------------------------------------*/ |
mbed_official | 106:ced8cbb51063 | 144 | #define SMARTCARD_TIMEOUT_VALUE 22000 |
mbed_official | 87:085cde657901 | 145 | /* Private macro -------------------------------------------------------------*/ |
mbed_official | 87:085cde657901 | 146 | /* Private variables ---------------------------------------------------------*/ |
mbed_official | 87:085cde657901 | 147 | /* Private function prototypes -----------------------------------------------*/ |
mbed_official | 87:085cde657901 | 148 | static void SMARTCARD_SetConfig (SMARTCARD_HandleTypeDef *hsc); |
mbed_official | 87:085cde657901 | 149 | static HAL_StatusTypeDef SMARTCARD_Transmit_IT(SMARTCARD_HandleTypeDef *hsc); |
mbed_official | 87:085cde657901 | 150 | static HAL_StatusTypeDef SMARTCARD_Receive_IT(SMARTCARD_HandleTypeDef *hsc); |
mbed_official | 87:085cde657901 | 151 | static void SMARTCARD_DMATransmitCplt(DMA_HandleTypeDef *hdma); |
mbed_official | 87:085cde657901 | 152 | static void SMARTCARD_DMAReceiveCplt(DMA_HandleTypeDef *hdma); |
mbed_official | 87:085cde657901 | 153 | static void SMARTCARD_DMAError(DMA_HandleTypeDef *hdma); |
mbed_official | 87:085cde657901 | 154 | static HAL_StatusTypeDef SMARTCARD_WaitOnFlagUntilTimeout(SMARTCARD_HandleTypeDef *hsc, uint32_t Flag, FlagStatus Status, uint32_t Timeout); |
mbed_official | 87:085cde657901 | 155 | /* Private functions ---------------------------------------------------------*/ |
mbed_official | 87:085cde657901 | 156 | |
mbed_official | 87:085cde657901 | 157 | /** @defgroup SMARTCARD_Private_Functions |
mbed_official | 87:085cde657901 | 158 | * @{ |
mbed_official | 87:085cde657901 | 159 | */ |
mbed_official | 87:085cde657901 | 160 | |
mbed_official | 87:085cde657901 | 161 | /** @defgroup SMARTCARD_Group1 SmartCard Initialization and de-initialization functions |
mbed_official | 87:085cde657901 | 162 | * @brief Initialization and Configuration functions |
mbed_official | 87:085cde657901 | 163 | * |
mbed_official | 87:085cde657901 | 164 | @verbatim |
mbed_official | 87:085cde657901 | 165 | =============================================================================== |
mbed_official | 87:085cde657901 | 166 | ##### Initialization and Configuration functions ##### |
mbed_official | 87:085cde657901 | 167 | =============================================================================== |
mbed_official | 87:085cde657901 | 168 | [..] |
mbed_official | 87:085cde657901 | 169 | This subsection provides a set of functions allowing to initialize the USART |
mbed_official | 87:085cde657901 | 170 | in Smartcard mode. |
mbed_official | 87:085cde657901 | 171 | [..] |
mbed_official | 87:085cde657901 | 172 | The Smartcard interface is designed to support asynchronous protocol Smartcards as |
mbed_official | 87:085cde657901 | 173 | defined in the ISO 7816-3 standard. |
mbed_official | 87:085cde657901 | 174 | [..] |
mbed_official | 87:085cde657901 | 175 | The USART can provide a clock to the smartcard through the SCLK output. |
mbed_official | 87:085cde657901 | 176 | In smartcard mode, SCLK is not associated to the communication but is simply derived |
mbed_official | 87:085cde657901 | 177 | from the internal peripheral input clock through a 5-bit prescaler. |
mbed_official | 87:085cde657901 | 178 | [..] |
mbed_official | 87:085cde657901 | 179 | (+) For the asynchronous mode only these parameters can be configured: |
mbed_official | 87:085cde657901 | 180 | (++) Baud Rate |
mbed_official | 87:085cde657901 | 181 | (++) Word Length |
mbed_official | 87:085cde657901 | 182 | (++) Stop Bit |
mbed_official | 87:085cde657901 | 183 | (++) Parity: If the parity is enabled, then the MSB bit of the data written |
mbed_official | 87:085cde657901 | 184 | in the data register is transmitted but is changed by the parity bit. |
mbed_official | 87:085cde657901 | 185 | Depending on the frame length defined by the M bit (8-bits or 9-bits), |
mbed_official | 226:b062af740e40 | 186 | please refer to Reference manual for possible SMARTDARD frame formats. |
mbed_official | 87:085cde657901 | 187 | (++) USART polarity |
mbed_official | 87:085cde657901 | 188 | (++) USART phase |
mbed_official | 87:085cde657901 | 189 | (++) USART LastBit |
mbed_official | 87:085cde657901 | 190 | (++) Receiver/transmitter modes |
mbed_official | 87:085cde657901 | 191 | (++) Prescaler |
mbed_official | 87:085cde657901 | 192 | (++) GuardTime |
mbed_official | 87:085cde657901 | 193 | (++) NACKState: The Smartcard NACK state |
mbed_official | 87:085cde657901 | 194 | |
mbed_official | 87:085cde657901 | 195 | (+) Recommended SmartCard interface configuration to get the Answer to Reset from the Card: |
mbed_official | 87:085cde657901 | 196 | (++) Word Length = 9 Bits |
mbed_official | 87:085cde657901 | 197 | (++) 1.5 Stop Bit |
mbed_official | 87:085cde657901 | 198 | (++) Even parity |
mbed_official | 87:085cde657901 | 199 | (++) BaudRate = 12096 baud |
mbed_official | 87:085cde657901 | 200 | (++) Tx and Rx enabled |
mbed_official | 87:085cde657901 | 201 | [..] |
mbed_official | 87:085cde657901 | 202 | Please refer to the ISO 7816-3 specification for more details. |
mbed_official | 87:085cde657901 | 203 | |
mbed_official | 87:085cde657901 | 204 | -@- It is also possible to choose 0.5 stop bit for receiving but it is recommended |
mbed_official | 87:085cde657901 | 205 | to use 1.5 stop bits for both transmitting and receiving to avoid switching |
mbed_official | 87:085cde657901 | 206 | between the two configurations. |
mbed_official | 87:085cde657901 | 207 | [..] |
mbed_official | 87:085cde657901 | 208 | The HAL_SMARTCARD_Init() function follows the USART SmartCard configuration |
mbed_official | 87:085cde657901 | 209 | procedure (details for the procedure are available in reference manual (RM0329)). |
mbed_official | 87:085cde657901 | 210 | |
mbed_official | 87:085cde657901 | 211 | @endverbatim |
mbed_official | 87:085cde657901 | 212 | * @{ |
mbed_official | 87:085cde657901 | 213 | */ |
mbed_official | 87:085cde657901 | 214 | |
mbed_official | 87:085cde657901 | 215 | /** |
mbed_official | 87:085cde657901 | 216 | * @brief Initializes the SmartCard mode according to the specified |
mbed_official | 87:085cde657901 | 217 | * parameters in the SMARTCARD_InitTypeDef and create the associated handle . |
mbed_official | 226:b062af740e40 | 218 | * @param hsc: pointer to a SMARTCARD_HandleTypeDef structure that contains |
mbed_official | 226:b062af740e40 | 219 | * the configuration information for SMARTCARD module. |
mbed_official | 87:085cde657901 | 220 | * @retval HAL status |
mbed_official | 87:085cde657901 | 221 | */ |
mbed_official | 87:085cde657901 | 222 | HAL_StatusTypeDef HAL_SMARTCARD_Init(SMARTCARD_HandleTypeDef *hsc) |
mbed_official | 87:085cde657901 | 223 | { |
mbed_official | 87:085cde657901 | 224 | /* Check the SMARTCARD handle allocation */ |
mbed_official | 87:085cde657901 | 225 | if(hsc == NULL) |
mbed_official | 87:085cde657901 | 226 | { |
mbed_official | 87:085cde657901 | 227 | return HAL_ERROR; |
mbed_official | 87:085cde657901 | 228 | } |
mbed_official | 87:085cde657901 | 229 | |
mbed_official | 87:085cde657901 | 230 | /* Check the parameters */ |
mbed_official | 87:085cde657901 | 231 | assert_param(IS_SMARTCARD_INSTANCE(hsc->Instance)); |
mbed_official | 87:085cde657901 | 232 | assert_param(IS_SMARTCARD_NACK_STATE(hsc->Init.NACKState)); |
mbed_official | 87:085cde657901 | 233 | |
mbed_official | 87:085cde657901 | 234 | if(hsc->State == HAL_SMARTCARD_STATE_RESET) |
mbed_official | 87:085cde657901 | 235 | { |
mbed_official | 87:085cde657901 | 236 | /* Init the low level hardware : GPIO, CLOCK, CORTEX...etc */ |
mbed_official | 87:085cde657901 | 237 | HAL_SMARTCARD_MspInit(hsc); |
mbed_official | 87:085cde657901 | 238 | } |
mbed_official | 87:085cde657901 | 239 | |
mbed_official | 87:085cde657901 | 240 | hsc->State = HAL_SMARTCARD_STATE_BUSY; |
mbed_official | 87:085cde657901 | 241 | |
mbed_official | 87:085cde657901 | 242 | /* Set the Prescaler */ |
mbed_official | 87:085cde657901 | 243 | MODIFY_REG(hsc->Instance->GTPR, USART_GTPR_PSC, hsc->Init.Prescaler); |
mbed_official | 87:085cde657901 | 244 | |
mbed_official | 87:085cde657901 | 245 | /* Set the Guard Time */ |
mbed_official | 87:085cde657901 | 246 | MODIFY_REG(hsc->Instance->GTPR, USART_GTPR_GT, ((hsc->Init.GuardTime)<<8)); |
mbed_official | 87:085cde657901 | 247 | |
mbed_official | 87:085cde657901 | 248 | /* Set the Smartcard Communication parameters */ |
mbed_official | 87:085cde657901 | 249 | SMARTCARD_SetConfig(hsc); |
mbed_official | 87:085cde657901 | 250 | |
mbed_official | 87:085cde657901 | 251 | /* In SmartCard mode, the following bits must be kept cleared: |
mbed_official | 87:085cde657901 | 252 | - LINEN bit in the USART_CR2 register |
mbed_official | 87:085cde657901 | 253 | - HDSEL and IREN bits in the USART_CR3 register.*/ |
mbed_official | 87:085cde657901 | 254 | hsc->Instance->CR2 &= ~USART_CR2_LINEN; |
mbed_official | 87:085cde657901 | 255 | hsc->Instance->CR3 &= ~(USART_CR3_IREN | USART_CR3_HDSEL); |
mbed_official | 87:085cde657901 | 256 | |
mbed_official | 87:085cde657901 | 257 | /* Enable the SMARTCARD Parity Error Interrupt */ |
mbed_official | 87:085cde657901 | 258 | __SMARTCARD_ENABLE_IT(hsc, SMARTCARD_IT_PE); |
mbed_official | 87:085cde657901 | 259 | |
mbed_official | 87:085cde657901 | 260 | /* Enable the SMARTCARD Framing Error Interrupt */ |
mbed_official | 87:085cde657901 | 261 | __SMARTCARD_ENABLE_IT(hsc, SMARTCARD_IT_ERR); |
mbed_official | 87:085cde657901 | 262 | |
mbed_official | 87:085cde657901 | 263 | /* Enable the Peripharal */ |
mbed_official | 87:085cde657901 | 264 | __SMARTCARD_ENABLE(hsc); |
mbed_official | 87:085cde657901 | 265 | |
mbed_official | 87:085cde657901 | 266 | /* Configure the Smartcard NACK state */ |
mbed_official | 87:085cde657901 | 267 | MODIFY_REG(hsc->Instance->CR3, USART_CR3_NACK, hsc->Init.NACKState); |
mbed_official | 87:085cde657901 | 268 | |
mbed_official | 87:085cde657901 | 269 | /* Enable the SC mode by setting the SCEN bit in the CR3 register */ |
mbed_official | 87:085cde657901 | 270 | hsc->Instance->CR3 |= (USART_CR3_SCEN); |
mbed_official | 87:085cde657901 | 271 | |
mbed_official | 87:085cde657901 | 272 | /* Initialize the SMARTCARD state*/ |
mbed_official | 87:085cde657901 | 273 | hsc->ErrorCode = HAL_SMARTCARD_ERROR_NONE; |
mbed_official | 87:085cde657901 | 274 | hsc->State= HAL_SMARTCARD_STATE_READY; |
mbed_official | 87:085cde657901 | 275 | |
mbed_official | 87:085cde657901 | 276 | return HAL_OK; |
mbed_official | 87:085cde657901 | 277 | } |
mbed_official | 87:085cde657901 | 278 | |
mbed_official | 87:085cde657901 | 279 | /** |
mbed_official | 87:085cde657901 | 280 | * @brief DeInitializes the USART SmartCard peripheral |
mbed_official | 226:b062af740e40 | 281 | * @param hsc: pointer to a SMARTCARD_HandleTypeDef structure that contains |
mbed_official | 226:b062af740e40 | 282 | * the configuration information for SMARTCARD module. |
mbed_official | 87:085cde657901 | 283 | * @retval HAL status |
mbed_official | 87:085cde657901 | 284 | */ |
mbed_official | 87:085cde657901 | 285 | HAL_StatusTypeDef HAL_SMARTCARD_DeInit(SMARTCARD_HandleTypeDef *hsc) |
mbed_official | 87:085cde657901 | 286 | { |
mbed_official | 106:ced8cbb51063 | 287 | /* Check the SMARTCARD handle allocation */ |
mbed_official | 87:085cde657901 | 288 | if(hsc == NULL) |
mbed_official | 87:085cde657901 | 289 | { |
mbed_official | 87:085cde657901 | 290 | return HAL_ERROR; |
mbed_official | 87:085cde657901 | 291 | } |
mbed_official | 87:085cde657901 | 292 | |
mbed_official | 87:085cde657901 | 293 | /* Check the parameters */ |
mbed_official | 87:085cde657901 | 294 | assert_param(IS_SMARTCARD_INSTANCE(hsc->Instance)); |
mbed_official | 87:085cde657901 | 295 | |
mbed_official | 87:085cde657901 | 296 | hsc->State = HAL_SMARTCARD_STATE_BUSY; |
mbed_official | 87:085cde657901 | 297 | |
mbed_official | 87:085cde657901 | 298 | /* DeInit the low level hardware */ |
mbed_official | 87:085cde657901 | 299 | HAL_SMARTCARD_MspDeInit(hsc); |
mbed_official | 87:085cde657901 | 300 | |
mbed_official | 87:085cde657901 | 301 | hsc->ErrorCode = HAL_SMARTCARD_ERROR_NONE; |
mbed_official | 87:085cde657901 | 302 | hsc->State = HAL_SMARTCARD_STATE_RESET; |
mbed_official | 87:085cde657901 | 303 | |
mbed_official | 106:ced8cbb51063 | 304 | /* Release Lock */ |
mbed_official | 106:ced8cbb51063 | 305 | __HAL_UNLOCK(hsc); |
mbed_official | 106:ced8cbb51063 | 306 | |
mbed_official | 87:085cde657901 | 307 | return HAL_OK; |
mbed_official | 87:085cde657901 | 308 | } |
mbed_official | 87:085cde657901 | 309 | |
mbed_official | 87:085cde657901 | 310 | /** |
mbed_official | 87:085cde657901 | 311 | * @brief SMARTCARD MSP Init |
mbed_official | 226:b062af740e40 | 312 | * @param hsc: pointer to a SMARTCARD_HandleTypeDef structure that contains |
mbed_official | 226:b062af740e40 | 313 | * the configuration information for SMARTCARD module. |
mbed_official | 87:085cde657901 | 314 | * @retval None |
mbed_official | 87:085cde657901 | 315 | */ |
mbed_official | 87:085cde657901 | 316 | __weak void HAL_SMARTCARD_MspInit(SMARTCARD_HandleTypeDef *hsc) |
mbed_official | 87:085cde657901 | 317 | { |
mbed_official | 87:085cde657901 | 318 | /* NOTE : This function Should not be modified, when the callback is needed, |
mbed_official | 87:085cde657901 | 319 | the HAL_SMARTCARD_MspInit could be implenetd in the user file |
mbed_official | 87:085cde657901 | 320 | */ |
mbed_official | 87:085cde657901 | 321 | } |
mbed_official | 87:085cde657901 | 322 | |
mbed_official | 87:085cde657901 | 323 | /** |
mbed_official | 87:085cde657901 | 324 | * @brief SMARTCARD MSP DeInit |
mbed_official | 226:b062af740e40 | 325 | * @param hsc: pointer to a SMARTCARD_HandleTypeDef structure that contains |
mbed_official | 226:b062af740e40 | 326 | * the configuration information for SMARTCARD module. |
mbed_official | 87:085cde657901 | 327 | * @retval None |
mbed_official | 87:085cde657901 | 328 | */ |
mbed_official | 87:085cde657901 | 329 | __weak void HAL_SMARTCARD_MspDeInit(SMARTCARD_HandleTypeDef *hsc) |
mbed_official | 87:085cde657901 | 330 | { |
mbed_official | 87:085cde657901 | 331 | /* NOTE : This function Should not be modified, when the callback is needed, |
mbed_official | 87:085cde657901 | 332 | the HAL_SMARTCARD_MspDeInit could be implenetd in the user file |
mbed_official | 87:085cde657901 | 333 | */ |
mbed_official | 87:085cde657901 | 334 | } |
mbed_official | 87:085cde657901 | 335 | |
mbed_official | 87:085cde657901 | 336 | /** |
mbed_official | 87:085cde657901 | 337 | * @} |
mbed_official | 87:085cde657901 | 338 | */ |
mbed_official | 87:085cde657901 | 339 | |
mbed_official | 87:085cde657901 | 340 | /** @defgroup SMARTCARD_Group2 IO operation functions |
mbed_official | 87:085cde657901 | 341 | * @brief SMARTCARD Transmit and Receive functions |
mbed_official | 87:085cde657901 | 342 | * |
mbed_official | 87:085cde657901 | 343 | @verbatim |
mbed_official | 87:085cde657901 | 344 | =============================================================================== |
mbed_official | 87:085cde657901 | 345 | ##### IO operation functions ##### |
mbed_official | 87:085cde657901 | 346 | =============================================================================== |
mbed_official | 87:085cde657901 | 347 | This subsection provides a set of functions allowing to manage the SMARTCARD data transfers. |
mbed_official | 87:085cde657901 | 348 | [..] |
mbed_official | 87:085cde657901 | 349 | IrDA is a half duplex communication protocol. If the Transmitter is busy, any data |
mbed_official | 87:085cde657901 | 350 | on the IrDA receive line will be ignored by the IrDA decoder and if the Receiver |
mbed_official | 87:085cde657901 | 351 | is busy, data on the TX from the USART to IrDA will not be encoded by IrDA. |
mbed_official | 87:085cde657901 | 352 | While receiving data, transmission should be avoided as the data to be transmitted |
mbed_official | 87:085cde657901 | 353 | could be corrupted. |
mbed_official | 87:085cde657901 | 354 | |
mbed_official | 226:b062af740e40 | 355 | (#) There are two modes of transfer: |
mbed_official | 87:085cde657901 | 356 | (++) Blocking mode: The communication is performed in polling mode. |
mbed_official | 87:085cde657901 | 357 | The HAL status of all data processing is returned by the same function |
mbed_official | 87:085cde657901 | 358 | after finishing transfer. |
mbed_official | 226:b062af740e40 | 359 | (++) Non Blocking mode: The communication is performed using Interrupts |
mbed_official | 226:b062af740e40 | 360 | or DMA, These APIs return the HAL status. |
mbed_official | 87:085cde657901 | 361 | The end of the data processing will be indicated through the |
mbed_official | 87:085cde657901 | 362 | dedicated SMARTCARD IRQ when using Interrupt mode or the DMA IRQ when |
mbed_official | 87:085cde657901 | 363 | using DMA mode. |
mbed_official | 87:085cde657901 | 364 | The HAL_SMARTCARD_TxCpltCallback(), HAL_SMARTCARD_RxCpltCallback() user callbacks |
mbed_official | 226:b062af740e40 | 365 | will be executed respectivelly at the end of the Transmit or Receive process |
mbed_official | 226:b062af740e40 | 366 | The HAL_SMARTCARD_ErrorCallback() user callback will be executed when a communication error is detected |
mbed_official | 87:085cde657901 | 367 | |
mbed_official | 226:b062af740e40 | 368 | (#) Blocking mode APIs are : |
mbed_official | 87:085cde657901 | 369 | (++) HAL_SMARTCARD_Transmit() |
mbed_official | 87:085cde657901 | 370 | (++) HAL_SMARTCARD_Receive() |
mbed_official | 87:085cde657901 | 371 | |
mbed_official | 226:b062af740e40 | 372 | (#) Non Blocking mode APIs with Interrupt are : |
mbed_official | 87:085cde657901 | 373 | (++) HAL_SMARTCARD_Transmit_IT() |
mbed_official | 87:085cde657901 | 374 | (++) HAL_SMARTCARD_Receive_IT() |
mbed_official | 87:085cde657901 | 375 | (++) HAL_SMARTCARD_IRQHandler() |
mbed_official | 87:085cde657901 | 376 | |
mbed_official | 226:b062af740e40 | 377 | (#) Non Blocking mode functions with DMA are : |
mbed_official | 87:085cde657901 | 378 | (++) HAL_SMARTCARD_Transmit_DMA() |
mbed_official | 87:085cde657901 | 379 | (++) HAL_SMARTCARD_Receive_DMA() |
mbed_official | 87:085cde657901 | 380 | |
mbed_official | 226:b062af740e40 | 381 | (#) A set of Transfer Complete Callbacks are provided in non Blocking mode: |
mbed_official | 87:085cde657901 | 382 | (++) HAL_SMARTCARD_TxCpltCallback() |
mbed_official | 87:085cde657901 | 383 | (++) HAL_SMARTCARD_RxCpltCallback() |
mbed_official | 87:085cde657901 | 384 | (++) HAL_SMARTCARD_ErrorCallback() |
mbed_official | 87:085cde657901 | 385 | |
mbed_official | 87:085cde657901 | 386 | @endverbatim |
mbed_official | 87:085cde657901 | 387 | * @{ |
mbed_official | 87:085cde657901 | 388 | */ |
mbed_official | 87:085cde657901 | 389 | |
mbed_official | 87:085cde657901 | 390 | /** |
mbed_official | 87:085cde657901 | 391 | * @brief Send an amount of data in blocking mode |
mbed_official | 226:b062af740e40 | 392 | * @param hsc: pointer to a SMARTCARD_HandleTypeDef structure that contains |
mbed_official | 226:b062af740e40 | 393 | * the configuration information for SMARTCARD module. |
mbed_official | 87:085cde657901 | 394 | * @param pData: pointer to data buffer |
mbed_official | 87:085cde657901 | 395 | * @param Size: amount of data to be sent |
mbed_official | 226:b062af740e40 | 396 | * @param Timeout: Timeout duration |
mbed_official | 87:085cde657901 | 397 | * @retval HAL status |
mbed_official | 87:085cde657901 | 398 | */ |
mbed_official | 87:085cde657901 | 399 | HAL_StatusTypeDef HAL_SMARTCARD_Transmit(SMARTCARD_HandleTypeDef *hsc, uint8_t *pData, uint16_t Size, uint32_t Timeout) |
mbed_official | 87:085cde657901 | 400 | { |
mbed_official | 87:085cde657901 | 401 | uint16_t* tmp; |
mbed_official | 226:b062af740e40 | 402 | uint32_t tmp1 = 0; |
mbed_official | 226:b062af740e40 | 403 | |
mbed_official | 226:b062af740e40 | 404 | tmp1 = hsc->State; |
mbed_official | 226:b062af740e40 | 405 | if((tmp1 == HAL_SMARTCARD_STATE_READY) || (tmp1 == HAL_SMARTCARD_STATE_BUSY_RX)) |
mbed_official | 87:085cde657901 | 406 | { |
mbed_official | 87:085cde657901 | 407 | if((pData == NULL) || (Size == 0)) |
mbed_official | 87:085cde657901 | 408 | { |
mbed_official | 87:085cde657901 | 409 | return HAL_ERROR; |
mbed_official | 87:085cde657901 | 410 | } |
mbed_official | 87:085cde657901 | 411 | |
mbed_official | 87:085cde657901 | 412 | /* Process Locked */ |
mbed_official | 87:085cde657901 | 413 | __HAL_LOCK(hsc); |
mbed_official | 87:085cde657901 | 414 | |
mbed_official | 87:085cde657901 | 415 | hsc->ErrorCode = HAL_SMARTCARD_ERROR_NONE; |
mbed_official | 226:b062af740e40 | 416 | /* Check if a non-blocking receive process is ongoing or not */ |
mbed_official | 226:b062af740e40 | 417 | if(hsc->State == HAL_SMARTCARD_STATE_BUSY_RX) |
mbed_official | 226:b062af740e40 | 418 | { |
mbed_official | 226:b062af740e40 | 419 | hsc->State = HAL_SMARTCARD_STATE_BUSY_TX_RX; |
mbed_official | 226:b062af740e40 | 420 | } |
mbed_official | 226:b062af740e40 | 421 | else |
mbed_official | 226:b062af740e40 | 422 | { |
mbed_official | 226:b062af740e40 | 423 | hsc->State = HAL_SMARTCARD_STATE_BUSY_TX; |
mbed_official | 226:b062af740e40 | 424 | } |
mbed_official | 226:b062af740e40 | 425 | |
mbed_official | 87:085cde657901 | 426 | hsc->TxXferSize = Size; |
mbed_official | 87:085cde657901 | 427 | hsc->TxXferCount = Size; |
mbed_official | 87:085cde657901 | 428 | while(hsc->TxXferCount > 0) |
mbed_official | 87:085cde657901 | 429 | { |
mbed_official | 87:085cde657901 | 430 | hsc->TxXferCount--; |
mbed_official | 87:085cde657901 | 431 | if(hsc->Init.WordLength == SMARTCARD_WORDLENGTH_9B) |
mbed_official | 87:085cde657901 | 432 | { |
mbed_official | 87:085cde657901 | 433 | if(SMARTCARD_WaitOnFlagUntilTimeout(hsc, SMARTCARD_FLAG_TXE, RESET, Timeout) != HAL_OK) |
mbed_official | 87:085cde657901 | 434 | { |
mbed_official | 87:085cde657901 | 435 | return HAL_TIMEOUT; |
mbed_official | 87:085cde657901 | 436 | } |
mbed_official | 87:085cde657901 | 437 | tmp = (uint16_t*) pData; |
mbed_official | 87:085cde657901 | 438 | hsc->Instance->DR = (*tmp & (uint16_t)0x01FF); |
mbed_official | 87:085cde657901 | 439 | if(hsc->Init.Parity == SMARTCARD_PARITY_NONE) |
mbed_official | 87:085cde657901 | 440 | { |
mbed_official | 87:085cde657901 | 441 | pData +=2; |
mbed_official | 87:085cde657901 | 442 | } |
mbed_official | 87:085cde657901 | 443 | else |
mbed_official | 87:085cde657901 | 444 | { |
mbed_official | 87:085cde657901 | 445 | pData +=1; |
mbed_official | 87:085cde657901 | 446 | } |
mbed_official | 87:085cde657901 | 447 | } |
mbed_official | 87:085cde657901 | 448 | else |
mbed_official | 87:085cde657901 | 449 | { |
mbed_official | 87:085cde657901 | 450 | if(SMARTCARD_WaitOnFlagUntilTimeout(hsc, SMARTCARD_FLAG_TXE, RESET, Timeout) != HAL_OK) |
mbed_official | 87:085cde657901 | 451 | { |
mbed_official | 87:085cde657901 | 452 | return HAL_TIMEOUT; |
mbed_official | 87:085cde657901 | 453 | } |
mbed_official | 87:085cde657901 | 454 | hsc->Instance->DR = (*pData++ & (uint8_t)0xFF); |
mbed_official | 87:085cde657901 | 455 | } |
mbed_official | 87:085cde657901 | 456 | } |
mbed_official | 87:085cde657901 | 457 | |
mbed_official | 87:085cde657901 | 458 | if(SMARTCARD_WaitOnFlagUntilTimeout(hsc, SMARTCARD_FLAG_TC, RESET, Timeout) != HAL_OK) |
mbed_official | 87:085cde657901 | 459 | { |
mbed_official | 87:085cde657901 | 460 | return HAL_TIMEOUT; |
mbed_official | 87:085cde657901 | 461 | } |
mbed_official | 87:085cde657901 | 462 | |
mbed_official | 226:b062af740e40 | 463 | /* Check if a non-blocking receive process is ongoing or not */ |
mbed_official | 226:b062af740e40 | 464 | if(hsc->State == HAL_SMARTCARD_STATE_BUSY_TX_RX) |
mbed_official | 226:b062af740e40 | 465 | { |
mbed_official | 226:b062af740e40 | 466 | hsc->State = HAL_SMARTCARD_STATE_BUSY_RX; |
mbed_official | 226:b062af740e40 | 467 | } |
mbed_official | 226:b062af740e40 | 468 | else |
mbed_official | 226:b062af740e40 | 469 | { |
mbed_official | 226:b062af740e40 | 470 | hsc->State = HAL_SMARTCARD_STATE_READY; |
mbed_official | 226:b062af740e40 | 471 | } |
mbed_official | 87:085cde657901 | 472 | /* Process Unlocked */ |
mbed_official | 87:085cde657901 | 473 | __HAL_UNLOCK(hsc); |
mbed_official | 87:085cde657901 | 474 | |
mbed_official | 87:085cde657901 | 475 | return HAL_OK; |
mbed_official | 87:085cde657901 | 476 | } |
mbed_official | 87:085cde657901 | 477 | else |
mbed_official | 87:085cde657901 | 478 | { |
mbed_official | 87:085cde657901 | 479 | return HAL_BUSY; |
mbed_official | 87:085cde657901 | 480 | } |
mbed_official | 87:085cde657901 | 481 | } |
mbed_official | 87:085cde657901 | 482 | |
mbed_official | 87:085cde657901 | 483 | /** |
mbed_official | 87:085cde657901 | 484 | * @brief Receive an amount of data in blocking mode |
mbed_official | 226:b062af740e40 | 485 | * @param hsc: pointer to a SMARTCARD_HandleTypeDef structure that contains |
mbed_official | 226:b062af740e40 | 486 | * the configuration information for SMARTCARD module. |
mbed_official | 87:085cde657901 | 487 | * @param pData: pointer to data buffer |
mbed_official | 87:085cde657901 | 488 | * @param Size: amount of data to be received |
mbed_official | 226:b062af740e40 | 489 | * @param Timeout: Timeout duration |
mbed_official | 87:085cde657901 | 490 | * @retval HAL status |
mbed_official | 87:085cde657901 | 491 | */ |
mbed_official | 87:085cde657901 | 492 | HAL_StatusTypeDef HAL_SMARTCARD_Receive(SMARTCARD_HandleTypeDef *hsc, uint8_t *pData, uint16_t Size, uint32_t Timeout) |
mbed_official | 87:085cde657901 | 493 | { |
mbed_official | 87:085cde657901 | 494 | uint16_t* tmp; |
mbed_official | 226:b062af740e40 | 495 | uint32_t tmp1 = 0; |
mbed_official | 226:b062af740e40 | 496 | |
mbed_official | 226:b062af740e40 | 497 | tmp1 = hsc->State; |
mbed_official | 226:b062af740e40 | 498 | if((tmp1 == HAL_SMARTCARD_STATE_READY) || (tmp1 == HAL_SMARTCARD_STATE_BUSY_TX)) |
mbed_official | 87:085cde657901 | 499 | { |
mbed_official | 87:085cde657901 | 500 | if((pData == NULL) || (Size == 0)) |
mbed_official | 87:085cde657901 | 501 | { |
mbed_official | 87:085cde657901 | 502 | return HAL_ERROR; |
mbed_official | 87:085cde657901 | 503 | } |
mbed_official | 87:085cde657901 | 504 | |
mbed_official | 87:085cde657901 | 505 | /* Process Locked */ |
mbed_official | 87:085cde657901 | 506 | __HAL_LOCK(hsc); |
mbed_official | 87:085cde657901 | 507 | |
mbed_official | 87:085cde657901 | 508 | hsc->ErrorCode = HAL_SMARTCARD_ERROR_NONE; |
mbed_official | 226:b062af740e40 | 509 | |
mbed_official | 226:b062af740e40 | 510 | /* Check if a non-blocking transmit process is ongoing or not */ |
mbed_official | 226:b062af740e40 | 511 | if(hsc->State == HAL_SMARTCARD_STATE_BUSY_TX) |
mbed_official | 226:b062af740e40 | 512 | { |
mbed_official | 226:b062af740e40 | 513 | hsc->State = HAL_SMARTCARD_STATE_BUSY_TX_RX; |
mbed_official | 226:b062af740e40 | 514 | } |
mbed_official | 226:b062af740e40 | 515 | else |
mbed_official | 226:b062af740e40 | 516 | { |
mbed_official | 226:b062af740e40 | 517 | hsc->State = HAL_SMARTCARD_STATE_BUSY_RX; |
mbed_official | 226:b062af740e40 | 518 | } |
mbed_official | 87:085cde657901 | 519 | |
mbed_official | 87:085cde657901 | 520 | hsc->RxXferSize = Size; |
mbed_official | 87:085cde657901 | 521 | hsc->RxXferCount = Size; |
mbed_official | 87:085cde657901 | 522 | /* Check the remain data to be received */ |
mbed_official | 87:085cde657901 | 523 | while(hsc->RxXferCount > 0) |
mbed_official | 87:085cde657901 | 524 | { |
mbed_official | 87:085cde657901 | 525 | hsc->RxXferCount--; |
mbed_official | 87:085cde657901 | 526 | if(hsc->Init.WordLength == SMARTCARD_WORDLENGTH_9B) |
mbed_official | 87:085cde657901 | 527 | { |
mbed_official | 87:085cde657901 | 528 | if(SMARTCARD_WaitOnFlagUntilTimeout(hsc, SMARTCARD_FLAG_RXNE, RESET, Timeout) != HAL_OK) |
mbed_official | 87:085cde657901 | 529 | { |
mbed_official | 87:085cde657901 | 530 | return HAL_TIMEOUT; |
mbed_official | 87:085cde657901 | 531 | } |
mbed_official | 87:085cde657901 | 532 | tmp = (uint16_t*) pData; |
mbed_official | 87:085cde657901 | 533 | if(hsc->Init.Parity == SMARTCARD_PARITY_NONE) |
mbed_official | 87:085cde657901 | 534 | { |
mbed_official | 87:085cde657901 | 535 | *tmp = (uint16_t)(hsc->Instance->DR & (uint16_t)0x01FF); |
mbed_official | 87:085cde657901 | 536 | pData +=2; |
mbed_official | 87:085cde657901 | 537 | } |
mbed_official | 87:085cde657901 | 538 | else |
mbed_official | 87:085cde657901 | 539 | { |
mbed_official | 87:085cde657901 | 540 | *tmp = (uint16_t)(hsc->Instance->DR & (uint16_t)0x00FF); |
mbed_official | 87:085cde657901 | 541 | pData +=1; |
mbed_official | 87:085cde657901 | 542 | } |
mbed_official | 87:085cde657901 | 543 | } |
mbed_official | 87:085cde657901 | 544 | else |
mbed_official | 87:085cde657901 | 545 | { |
mbed_official | 87:085cde657901 | 546 | if(SMARTCARD_WaitOnFlagUntilTimeout(hsc, SMARTCARD_FLAG_RXNE, RESET, Timeout) != HAL_OK) |
mbed_official | 87:085cde657901 | 547 | { |
mbed_official | 87:085cde657901 | 548 | return HAL_TIMEOUT; |
mbed_official | 87:085cde657901 | 549 | } |
mbed_official | 87:085cde657901 | 550 | if(hsc->Init.Parity == SMARTCARD_PARITY_NONE) |
mbed_official | 87:085cde657901 | 551 | { |
mbed_official | 87:085cde657901 | 552 | *pData++ = (uint8_t)(hsc->Instance->DR & (uint8_t)0x00FF); |
mbed_official | 87:085cde657901 | 553 | } |
mbed_official | 87:085cde657901 | 554 | else |
mbed_official | 87:085cde657901 | 555 | { |
mbed_official | 87:085cde657901 | 556 | *pData++ = (uint8_t)(hsc->Instance->DR & (uint8_t)0x007F); |
mbed_official | 87:085cde657901 | 557 | } |
mbed_official | 87:085cde657901 | 558 | } |
mbed_official | 87:085cde657901 | 559 | } |
mbed_official | 226:b062af740e40 | 560 | |
mbed_official | 226:b062af740e40 | 561 | /* Check if a non-blocking transmit process is ongoing or not */ |
mbed_official | 226:b062af740e40 | 562 | if(hsc->State == HAL_SMARTCARD_STATE_BUSY_TX_RX) |
mbed_official | 226:b062af740e40 | 563 | { |
mbed_official | 226:b062af740e40 | 564 | hsc->State = HAL_SMARTCARD_STATE_BUSY_TX; |
mbed_official | 226:b062af740e40 | 565 | } |
mbed_official | 226:b062af740e40 | 566 | else |
mbed_official | 226:b062af740e40 | 567 | { |
mbed_official | 226:b062af740e40 | 568 | hsc->State = HAL_SMARTCARD_STATE_READY; |
mbed_official | 226:b062af740e40 | 569 | } |
mbed_official | 87:085cde657901 | 570 | |
mbed_official | 87:085cde657901 | 571 | /* Process Unlocked */ |
mbed_official | 87:085cde657901 | 572 | __HAL_UNLOCK(hsc); |
mbed_official | 87:085cde657901 | 573 | |
mbed_official | 87:085cde657901 | 574 | return HAL_OK; |
mbed_official | 87:085cde657901 | 575 | } |
mbed_official | 87:085cde657901 | 576 | else |
mbed_official | 87:085cde657901 | 577 | { |
mbed_official | 87:085cde657901 | 578 | return HAL_BUSY; |
mbed_official | 87:085cde657901 | 579 | } |
mbed_official | 87:085cde657901 | 580 | } |
mbed_official | 87:085cde657901 | 581 | |
mbed_official | 87:085cde657901 | 582 | /** |
mbed_official | 87:085cde657901 | 583 | * @brief Send an amount of data in non blocking mode |
mbed_official | 226:b062af740e40 | 584 | * @param hsc: pointer to a SMARTCARD_HandleTypeDef structure that contains |
mbed_official | 226:b062af740e40 | 585 | * the configuration information for SMARTCARD module. |
mbed_official | 87:085cde657901 | 586 | * @param pData: pointer to data buffer |
mbed_official | 87:085cde657901 | 587 | * @param Size: amount of data to be sent |
mbed_official | 87:085cde657901 | 588 | * @retval HAL status |
mbed_official | 87:085cde657901 | 589 | */ |
mbed_official | 87:085cde657901 | 590 | HAL_StatusTypeDef HAL_SMARTCARD_Transmit_IT(SMARTCARD_HandleTypeDef *hsc, uint8_t *pData, uint16_t Size) |
mbed_official | 87:085cde657901 | 591 | { |
mbed_official | 226:b062af740e40 | 592 | uint32_t tmp1 = 0; |
mbed_official | 226:b062af740e40 | 593 | |
mbed_official | 226:b062af740e40 | 594 | tmp1 = hsc->State; |
mbed_official | 226:b062af740e40 | 595 | if((tmp1 == HAL_SMARTCARD_STATE_READY) || (tmp1 == HAL_SMARTCARD_STATE_BUSY_RX)) |
mbed_official | 87:085cde657901 | 596 | { |
mbed_official | 87:085cde657901 | 597 | if((pData == NULL) || (Size == 0)) |
mbed_official | 87:085cde657901 | 598 | { |
mbed_official | 87:085cde657901 | 599 | return HAL_ERROR; |
mbed_official | 87:085cde657901 | 600 | } |
mbed_official | 87:085cde657901 | 601 | |
mbed_official | 87:085cde657901 | 602 | /* Process Locked */ |
mbed_official | 87:085cde657901 | 603 | __HAL_LOCK(hsc); |
mbed_official | 87:085cde657901 | 604 | |
mbed_official | 87:085cde657901 | 605 | hsc->pTxBuffPtr = pData; |
mbed_official | 87:085cde657901 | 606 | hsc->TxXferSize = Size; |
mbed_official | 87:085cde657901 | 607 | hsc->TxXferCount = Size; |
mbed_official | 87:085cde657901 | 608 | |
mbed_official | 87:085cde657901 | 609 | hsc->ErrorCode = HAL_SMARTCARD_ERROR_NONE; |
mbed_official | 226:b062af740e40 | 610 | /* Check if a non-blocking receive process is ongoing or not */ |
mbed_official | 226:b062af740e40 | 611 | if(hsc->State == HAL_SMARTCARD_STATE_BUSY_RX) |
mbed_official | 226:b062af740e40 | 612 | { |
mbed_official | 226:b062af740e40 | 613 | hsc->State = HAL_SMARTCARD_STATE_BUSY_TX_RX; |
mbed_official | 226:b062af740e40 | 614 | } |
mbed_official | 226:b062af740e40 | 615 | else |
mbed_official | 226:b062af740e40 | 616 | { |
mbed_official | 226:b062af740e40 | 617 | hsc->State = HAL_SMARTCARD_STATE_BUSY_TX; |
mbed_official | 226:b062af740e40 | 618 | } |
mbed_official | 87:085cde657901 | 619 | |
mbed_official | 87:085cde657901 | 620 | /* Enable the SMARTCARD Parity Error Interrupt */ |
mbed_official | 87:085cde657901 | 621 | __SMARTCARD_ENABLE_IT(hsc, SMARTCARD_IT_PE); |
mbed_official | 87:085cde657901 | 622 | |
mbed_official | 87:085cde657901 | 623 | /* Enable the SMARTCARD Error Interrupt: (Frame error, noise error, overrun error) */ |
mbed_official | 87:085cde657901 | 624 | __SMARTCARD_ENABLE_IT(hsc, SMARTCARD_IT_ERR); |
mbed_official | 87:085cde657901 | 625 | |
mbed_official | 87:085cde657901 | 626 | /* Process Unlocked */ |
mbed_official | 87:085cde657901 | 627 | __HAL_UNLOCK(hsc); |
mbed_official | 87:085cde657901 | 628 | |
mbed_official | 87:085cde657901 | 629 | /* Enable the SMARTCARD Transmit Complete Interrupt */ |
mbed_official | 87:085cde657901 | 630 | __SMARTCARD_ENABLE_IT(hsc, SMARTCARD_IT_TC); |
mbed_official | 87:085cde657901 | 631 | |
mbed_official | 87:085cde657901 | 632 | return HAL_OK; |
mbed_official | 87:085cde657901 | 633 | } |
mbed_official | 87:085cde657901 | 634 | else |
mbed_official | 87:085cde657901 | 635 | { |
mbed_official | 87:085cde657901 | 636 | return HAL_BUSY; |
mbed_official | 87:085cde657901 | 637 | } |
mbed_official | 87:085cde657901 | 638 | } |
mbed_official | 87:085cde657901 | 639 | |
mbed_official | 87:085cde657901 | 640 | /** |
mbed_official | 87:085cde657901 | 641 | * @brief Receive an amount of data in non blocking mode |
mbed_official | 226:b062af740e40 | 642 | * @param hsc: pointer to a SMARTCARD_HandleTypeDef structure that contains |
mbed_official | 226:b062af740e40 | 643 | * the configuration information for SMARTCARD module. |
mbed_official | 87:085cde657901 | 644 | * @param pData: pointer to data buffer |
mbed_official | 87:085cde657901 | 645 | * @param Size: amount of data to be received |
mbed_official | 87:085cde657901 | 646 | * @retval HAL status |
mbed_official | 87:085cde657901 | 647 | */ |
mbed_official | 87:085cde657901 | 648 | HAL_StatusTypeDef HAL_SMARTCARD_Receive_IT(SMARTCARD_HandleTypeDef *hsc, uint8_t *pData, uint16_t Size) |
mbed_official | 87:085cde657901 | 649 | { |
mbed_official | 226:b062af740e40 | 650 | uint32_t tmp1 = 0; |
mbed_official | 226:b062af740e40 | 651 | |
mbed_official | 226:b062af740e40 | 652 | tmp1 = hsc->State; |
mbed_official | 226:b062af740e40 | 653 | if((tmp1 == HAL_SMARTCARD_STATE_READY) || (tmp1 == HAL_SMARTCARD_STATE_BUSY_TX)) |
mbed_official | 87:085cde657901 | 654 | { |
mbed_official | 87:085cde657901 | 655 | if((pData == NULL) || (Size == 0)) |
mbed_official | 87:085cde657901 | 656 | { |
mbed_official | 87:085cde657901 | 657 | return HAL_ERROR; |
mbed_official | 87:085cde657901 | 658 | } |
mbed_official | 87:085cde657901 | 659 | |
mbed_official | 87:085cde657901 | 660 | /* Process Locked */ |
mbed_official | 87:085cde657901 | 661 | __HAL_LOCK(hsc); |
mbed_official | 87:085cde657901 | 662 | |
mbed_official | 87:085cde657901 | 663 | hsc->pRxBuffPtr = pData; |
mbed_official | 87:085cde657901 | 664 | hsc->RxXferSize = Size; |
mbed_official | 87:085cde657901 | 665 | hsc->RxXferCount = Size; |
mbed_official | 87:085cde657901 | 666 | |
mbed_official | 87:085cde657901 | 667 | hsc->ErrorCode = HAL_SMARTCARD_ERROR_NONE; |
mbed_official | 226:b062af740e40 | 668 | /* Check if a non-blocking transmit process is ongoing or not */ |
mbed_official | 226:b062af740e40 | 669 | if(hsc->State == HAL_SMARTCARD_STATE_BUSY_TX) |
mbed_official | 226:b062af740e40 | 670 | { |
mbed_official | 226:b062af740e40 | 671 | hsc->State = HAL_SMARTCARD_STATE_BUSY_TX_RX; |
mbed_official | 226:b062af740e40 | 672 | } |
mbed_official | 226:b062af740e40 | 673 | else |
mbed_official | 226:b062af740e40 | 674 | { |
mbed_official | 226:b062af740e40 | 675 | hsc->State = HAL_SMARTCARD_STATE_BUSY_RX; |
mbed_official | 226:b062af740e40 | 676 | } |
mbed_official | 87:085cde657901 | 677 | |
mbed_official | 87:085cde657901 | 678 | /* Enable the SMARTCARD Data Register not empty Interrupt */ |
mbed_official | 87:085cde657901 | 679 | __SMARTCARD_ENABLE_IT(hsc, SMARTCARD_IT_RXNE); |
mbed_official | 87:085cde657901 | 680 | |
mbed_official | 87:085cde657901 | 681 | /* Enable the SMARTCARD Parity Error Interrupt */ |
mbed_official | 87:085cde657901 | 682 | __SMARTCARD_ENABLE_IT(hsc, SMARTCARD_IT_PE); |
mbed_official | 87:085cde657901 | 683 | |
mbed_official | 87:085cde657901 | 684 | /* Enable the SMARTCARD Error Interrupt: (Frame error, noise error, overrun error) */ |
mbed_official | 87:085cde657901 | 685 | __SMARTCARD_ENABLE_IT(hsc, SMARTCARD_IT_ERR); |
mbed_official | 87:085cde657901 | 686 | |
mbed_official | 87:085cde657901 | 687 | /* Process Unlocked */ |
mbed_official | 87:085cde657901 | 688 | __HAL_UNLOCK(hsc); |
mbed_official | 87:085cde657901 | 689 | |
mbed_official | 87:085cde657901 | 690 | return HAL_OK; |
mbed_official | 87:085cde657901 | 691 | } |
mbed_official | 87:085cde657901 | 692 | else |
mbed_official | 87:085cde657901 | 693 | { |
mbed_official | 87:085cde657901 | 694 | return HAL_BUSY; |
mbed_official | 87:085cde657901 | 695 | } |
mbed_official | 87:085cde657901 | 696 | } |
mbed_official | 87:085cde657901 | 697 | |
mbed_official | 87:085cde657901 | 698 | /** |
mbed_official | 87:085cde657901 | 699 | * @brief Send an amount of data in non blocking mode |
mbed_official | 226:b062af740e40 | 700 | * @param hsc: pointer to a SMARTCARD_HandleTypeDef structure that contains |
mbed_official | 226:b062af740e40 | 701 | * the configuration information for SMARTCARD module. |
mbed_official | 87:085cde657901 | 702 | * @param pData: pointer to data buffer |
mbed_official | 87:085cde657901 | 703 | * @param Size: amount of data to be sent |
mbed_official | 87:085cde657901 | 704 | * @retval HAL status |
mbed_official | 87:085cde657901 | 705 | */ |
mbed_official | 87:085cde657901 | 706 | HAL_StatusTypeDef HAL_SMARTCARD_Transmit_DMA(SMARTCARD_HandleTypeDef *hsc, uint8_t *pData, uint16_t Size) |
mbed_official | 87:085cde657901 | 707 | { |
mbed_official | 87:085cde657901 | 708 | uint32_t *tmp; |
mbed_official | 226:b062af740e40 | 709 | uint32_t tmp1 = 0; |
mbed_official | 87:085cde657901 | 710 | |
mbed_official | 226:b062af740e40 | 711 | tmp1 = hsc->State; |
mbed_official | 226:b062af740e40 | 712 | if((tmp1 == HAL_SMARTCARD_STATE_READY) || (tmp1 == HAL_SMARTCARD_STATE_BUSY_RX)) |
mbed_official | 87:085cde657901 | 713 | { |
mbed_official | 87:085cde657901 | 714 | if((pData == NULL) || (Size == 0)) |
mbed_official | 87:085cde657901 | 715 | { |
mbed_official | 87:085cde657901 | 716 | return HAL_ERROR; |
mbed_official | 87:085cde657901 | 717 | } |
mbed_official | 87:085cde657901 | 718 | |
mbed_official | 87:085cde657901 | 719 | /* Process Locked */ |
mbed_official | 87:085cde657901 | 720 | __HAL_LOCK(hsc); |
mbed_official | 87:085cde657901 | 721 | |
mbed_official | 87:085cde657901 | 722 | hsc->pTxBuffPtr = pData; |
mbed_official | 87:085cde657901 | 723 | hsc->TxXferSize = Size; |
mbed_official | 87:085cde657901 | 724 | hsc->TxXferCount = Size; |
mbed_official | 87:085cde657901 | 725 | |
mbed_official | 87:085cde657901 | 726 | hsc->ErrorCode = HAL_SMARTCARD_ERROR_NONE; |
mbed_official | 226:b062af740e40 | 727 | /* Check if a non-blocking receive process is ongoing or not */ |
mbed_official | 226:b062af740e40 | 728 | if(hsc->State == HAL_SMARTCARD_STATE_BUSY_RX) |
mbed_official | 226:b062af740e40 | 729 | { |
mbed_official | 226:b062af740e40 | 730 | hsc->State = HAL_SMARTCARD_STATE_BUSY_TX_RX; |
mbed_official | 226:b062af740e40 | 731 | } |
mbed_official | 226:b062af740e40 | 732 | else |
mbed_official | 226:b062af740e40 | 733 | { |
mbed_official | 226:b062af740e40 | 734 | hsc->State = HAL_SMARTCARD_STATE_BUSY_TX; |
mbed_official | 226:b062af740e40 | 735 | } |
mbed_official | 87:085cde657901 | 736 | |
mbed_official | 87:085cde657901 | 737 | /* Set the SMARTCARD DMA transfert complete callback */ |
mbed_official | 87:085cde657901 | 738 | hsc->hdmatx->XferCpltCallback = SMARTCARD_DMATransmitCplt; |
mbed_official | 87:085cde657901 | 739 | |
mbed_official | 87:085cde657901 | 740 | /* Set the DMA error callback */ |
mbed_official | 87:085cde657901 | 741 | hsc->hdmatx->XferErrorCallback = SMARTCARD_DMAError; |
mbed_official | 87:085cde657901 | 742 | |
mbed_official | 87:085cde657901 | 743 | /* Enable the SMARTCARD transmit DMA Stream */ |
mbed_official | 87:085cde657901 | 744 | tmp = (uint32_t*)&pData; |
mbed_official | 87:085cde657901 | 745 | HAL_DMA_Start_IT(hsc->hdmatx, *(uint32_t*)tmp, (uint32_t)&hsc->Instance->DR, Size); |
mbed_official | 87:085cde657901 | 746 | |
mbed_official | 87:085cde657901 | 747 | /* Enable the DMA transfer for transmit request by setting the DMAT bit |
mbed_official | 87:085cde657901 | 748 | in the SMARTCARD CR3 register */ |
mbed_official | 87:085cde657901 | 749 | hsc->Instance->CR3 |= USART_CR3_DMAT; |
mbed_official | 87:085cde657901 | 750 | |
mbed_official | 87:085cde657901 | 751 | /* Process Unlocked */ |
mbed_official | 87:085cde657901 | 752 | __HAL_UNLOCK(hsc); |
mbed_official | 87:085cde657901 | 753 | |
mbed_official | 87:085cde657901 | 754 | return HAL_OK; |
mbed_official | 87:085cde657901 | 755 | } |
mbed_official | 87:085cde657901 | 756 | else |
mbed_official | 87:085cde657901 | 757 | { |
mbed_official | 87:085cde657901 | 758 | return HAL_BUSY; |
mbed_official | 87:085cde657901 | 759 | } |
mbed_official | 87:085cde657901 | 760 | } |
mbed_official | 87:085cde657901 | 761 | |
mbed_official | 87:085cde657901 | 762 | /** |
mbed_official | 87:085cde657901 | 763 | * @brief Receive an amount of data in non blocking mode |
mbed_official | 226:b062af740e40 | 764 | * @param hsc: pointer to a SMARTCARD_HandleTypeDef structure that contains |
mbed_official | 226:b062af740e40 | 765 | * the configuration information for SMARTCARD module. |
mbed_official | 87:085cde657901 | 766 | * @param pData: pointer to data buffer |
mbed_official | 87:085cde657901 | 767 | * @param Size: amount of data to be received |
mbed_official | 87:085cde657901 | 768 | * @note When the SMARTCARD parity is enabled (PCE = 1) the data received contain the parity bit.s |
mbed_official | 87:085cde657901 | 769 | * @retval HAL status |
mbed_official | 87:085cde657901 | 770 | */ |
mbed_official | 87:085cde657901 | 771 | HAL_StatusTypeDef HAL_SMARTCARD_Receive_DMA(SMARTCARD_HandleTypeDef *hsc, uint8_t *pData, uint16_t Size) |
mbed_official | 87:085cde657901 | 772 | { |
mbed_official | 87:085cde657901 | 773 | uint32_t *tmp; |
mbed_official | 226:b062af740e40 | 774 | uint32_t tmp1 = 0; |
mbed_official | 87:085cde657901 | 775 | |
mbed_official | 226:b062af740e40 | 776 | tmp1 = hsc->State; |
mbed_official | 226:b062af740e40 | 777 | if((tmp1 == HAL_SMARTCARD_STATE_READY) || (tmp1 == HAL_SMARTCARD_STATE_BUSY_TX)) |
mbed_official | 87:085cde657901 | 778 | { |
mbed_official | 87:085cde657901 | 779 | if((pData == NULL) || (Size == 0)) |
mbed_official | 87:085cde657901 | 780 | { |
mbed_official | 87:085cde657901 | 781 | return HAL_ERROR; |
mbed_official | 87:085cde657901 | 782 | } |
mbed_official | 87:085cde657901 | 783 | |
mbed_official | 87:085cde657901 | 784 | /* Process Locked */ |
mbed_official | 87:085cde657901 | 785 | __HAL_LOCK(hsc); |
mbed_official | 87:085cde657901 | 786 | |
mbed_official | 87:085cde657901 | 787 | hsc->pRxBuffPtr = pData; |
mbed_official | 87:085cde657901 | 788 | hsc->RxXferSize = Size; |
mbed_official | 87:085cde657901 | 789 | |
mbed_official | 87:085cde657901 | 790 | hsc->ErrorCode = HAL_SMARTCARD_ERROR_NONE; |
mbed_official | 226:b062af740e40 | 791 | /* Check if a non-blocking transmit process is ongoing or not */ |
mbed_official | 226:b062af740e40 | 792 | if(hsc->State == HAL_SMARTCARD_STATE_BUSY_TX) |
mbed_official | 226:b062af740e40 | 793 | { |
mbed_official | 226:b062af740e40 | 794 | hsc->State = HAL_SMARTCARD_STATE_BUSY_TX_RX; |
mbed_official | 226:b062af740e40 | 795 | } |
mbed_official | 226:b062af740e40 | 796 | else |
mbed_official | 226:b062af740e40 | 797 | { |
mbed_official | 226:b062af740e40 | 798 | hsc->State = HAL_SMARTCARD_STATE_BUSY_RX; |
mbed_official | 226:b062af740e40 | 799 | } |
mbed_official | 87:085cde657901 | 800 | |
mbed_official | 87:085cde657901 | 801 | /* Set the SMARTCARD DMA transfert complete callback */ |
mbed_official | 87:085cde657901 | 802 | hsc->hdmarx->XferCpltCallback = SMARTCARD_DMAReceiveCplt; |
mbed_official | 87:085cde657901 | 803 | |
mbed_official | 87:085cde657901 | 804 | /* Set the DMA error callback */ |
mbed_official | 87:085cde657901 | 805 | hsc->hdmarx->XferErrorCallback = SMARTCARD_DMAError; |
mbed_official | 87:085cde657901 | 806 | |
mbed_official | 87:085cde657901 | 807 | /* Enable the DMA Stream */ |
mbed_official | 87:085cde657901 | 808 | tmp = (uint32_t*)&pData; |
mbed_official | 87:085cde657901 | 809 | HAL_DMA_Start_IT(hsc->hdmarx, (uint32_t)&hsc->Instance->DR, *(uint32_t*)tmp, Size); |
mbed_official | 87:085cde657901 | 810 | |
mbed_official | 87:085cde657901 | 811 | /* Enable the DMA transfer for the receiver request by setting the DMAR bit |
mbed_official | 87:085cde657901 | 812 | in the SMARTCARD CR3 register */ |
mbed_official | 87:085cde657901 | 813 | hsc->Instance->CR3 |= USART_CR3_DMAR; |
mbed_official | 87:085cde657901 | 814 | |
mbed_official | 87:085cde657901 | 815 | /* Process Unlocked */ |
mbed_official | 87:085cde657901 | 816 | __HAL_UNLOCK(hsc); |
mbed_official | 87:085cde657901 | 817 | |
mbed_official | 87:085cde657901 | 818 | return HAL_OK; |
mbed_official | 87:085cde657901 | 819 | } |
mbed_official | 87:085cde657901 | 820 | else |
mbed_official | 87:085cde657901 | 821 | { |
mbed_official | 87:085cde657901 | 822 | return HAL_BUSY; |
mbed_official | 87:085cde657901 | 823 | } |
mbed_official | 87:085cde657901 | 824 | } |
mbed_official | 87:085cde657901 | 825 | |
mbed_official | 87:085cde657901 | 826 | /** |
mbed_official | 87:085cde657901 | 827 | * @brief This function handles SMARTCARD interrupt request. |
mbed_official | 226:b062af740e40 | 828 | * @param hsc: pointer to a SMARTCARD_HandleTypeDef structure that contains |
mbed_official | 226:b062af740e40 | 829 | * the configuration information for SMARTCARD module. |
mbed_official | 87:085cde657901 | 830 | * @retval None |
mbed_official | 87:085cde657901 | 831 | */ |
mbed_official | 87:085cde657901 | 832 | void HAL_SMARTCARD_IRQHandler(SMARTCARD_HandleTypeDef *hsc) |
mbed_official | 87:085cde657901 | 833 | { |
mbed_official | 87:085cde657901 | 834 | uint32_t tmp1 = 0, tmp2 = 0; |
mbed_official | 87:085cde657901 | 835 | |
mbed_official | 226:b062af740e40 | 836 | tmp1 = hsc->Instance->SR; |
mbed_official | 87:085cde657901 | 837 | tmp2 = __HAL_SMARTCARD_GET_IT_SOURCE(hsc, SMARTCARD_IT_PE); |
mbed_official | 226:b062af740e40 | 838 | |
mbed_official | 87:085cde657901 | 839 | /* SMARTCARD parity error interrupt occured --------------------------------*/ |
mbed_official | 226:b062af740e40 | 840 | if(((tmp1 & SMARTCARD_FLAG_PE) != RESET) && (tmp2 != RESET)) |
mbed_official | 87:085cde657901 | 841 | { |
mbed_official | 87:085cde657901 | 842 | __HAL_SMARTCARD_CLEAR_FLAG(hsc, SMARTCARD_FLAG_PE); |
mbed_official | 87:085cde657901 | 843 | hsc->ErrorCode |= HAL_SMARTCARD_ERROR_PE; |
mbed_official | 87:085cde657901 | 844 | } |
mbed_official | 87:085cde657901 | 845 | |
mbed_official | 87:085cde657901 | 846 | tmp2 = __HAL_SMARTCARD_GET_IT_SOURCE(hsc, SMARTCARD_IT_ERR); |
mbed_official | 87:085cde657901 | 847 | /* SMARTCARD frame error interrupt occured ---------------------------------*/ |
mbed_official | 226:b062af740e40 | 848 | if(((tmp1 & SMARTCARD_FLAG_FE) != RESET) && (tmp2 != RESET)) |
mbed_official | 87:085cde657901 | 849 | { |
mbed_official | 87:085cde657901 | 850 | __HAL_SMARTCARD_CLEAR_FLAG(hsc, SMARTCARD_FLAG_FE); |
mbed_official | 87:085cde657901 | 851 | hsc->ErrorCode |= HAL_SMARTCARD_ERROR_FE; |
mbed_official | 87:085cde657901 | 852 | } |
mbed_official | 87:085cde657901 | 853 | |
mbed_official | 87:085cde657901 | 854 | tmp2 = __HAL_SMARTCARD_GET_IT_SOURCE(hsc, SMARTCARD_IT_ERR); |
mbed_official | 87:085cde657901 | 855 | /* SMARTCARD noise error interrupt occured ---------------------------------*/ |
mbed_official | 226:b062af740e40 | 856 | if(((tmp1 & SMARTCARD_FLAG_NE) != RESET) && (tmp2 != RESET)) |
mbed_official | 87:085cde657901 | 857 | { |
mbed_official | 87:085cde657901 | 858 | __HAL_SMARTCARD_CLEAR_FLAG(hsc, SMARTCARD_FLAG_NE); |
mbed_official | 87:085cde657901 | 859 | hsc->ErrorCode |= HAL_SMARTCARD_ERROR_NE; |
mbed_official | 87:085cde657901 | 860 | } |
mbed_official | 226:b062af740e40 | 861 | |
mbed_official | 87:085cde657901 | 862 | tmp2 = __HAL_SMARTCARD_GET_IT_SOURCE(hsc, SMARTCARD_IT_ERR); |
mbed_official | 87:085cde657901 | 863 | /* SMARTCARD Over-Run interrupt occured ------------------------------------*/ |
mbed_official | 226:b062af740e40 | 864 | if(((tmp1 & SMARTCARD_FLAG_ORE) != RESET) && (tmp2 != RESET)) |
mbed_official | 87:085cde657901 | 865 | { |
mbed_official | 87:085cde657901 | 866 | __HAL_SMARTCARD_CLEAR_FLAG(hsc, SMARTCARD_FLAG_ORE); |
mbed_official | 87:085cde657901 | 867 | hsc->ErrorCode |= HAL_SMARTCARD_ERROR_ORE; |
mbed_official | 87:085cde657901 | 868 | } |
mbed_official | 87:085cde657901 | 869 | |
mbed_official | 87:085cde657901 | 870 | tmp2 = __HAL_SMARTCARD_GET_IT_SOURCE(hsc, SMARTCARD_IT_RXNE); |
mbed_official | 87:085cde657901 | 871 | /* SMARTCARD in mode Receiver ----------------------------------------------*/ |
mbed_official | 226:b062af740e40 | 872 | if(((tmp1 & SMARTCARD_FLAG_RXNE) != RESET) && (tmp2 != RESET)) |
mbed_official | 87:085cde657901 | 873 | { |
mbed_official | 87:085cde657901 | 874 | SMARTCARD_Receive_IT(hsc); |
mbed_official | 87:085cde657901 | 875 | __HAL_SMARTCARD_CLEAR_FLAG(hsc, SMARTCARD_FLAG_RXNE); |
mbed_official | 87:085cde657901 | 876 | } |
mbed_official | 226:b062af740e40 | 877 | |
mbed_official | 87:085cde657901 | 878 | tmp2 = __HAL_SMARTCARD_GET_IT_SOURCE(hsc, SMARTCARD_IT_TC); |
mbed_official | 87:085cde657901 | 879 | /* SMARTCARD in mode Transmitter -------------------------------------------*/ |
mbed_official | 226:b062af740e40 | 880 | if(((tmp1 & SMARTCARD_FLAG_TC) != RESET) && (tmp2 != RESET)) |
mbed_official | 87:085cde657901 | 881 | { |
mbed_official | 87:085cde657901 | 882 | SMARTCARD_Transmit_IT(hsc); |
mbed_official | 87:085cde657901 | 883 | __HAL_SMARTCARD_CLEAR_FLAG(hsc, SMARTCARD_FLAG_TC); |
mbed_official | 87:085cde657901 | 884 | } |
mbed_official | 87:085cde657901 | 885 | |
mbed_official | 87:085cde657901 | 886 | /* Call the Error call Back in case of Errors */ |
mbed_official | 87:085cde657901 | 887 | if(hsc->ErrorCode != HAL_SMARTCARD_ERROR_NONE) |
mbed_official | 87:085cde657901 | 888 | { |
mbed_official | 87:085cde657901 | 889 | /* Set the SMARTCARD state ready to be able to start again the process */ |
mbed_official | 87:085cde657901 | 890 | hsc->State= HAL_SMARTCARD_STATE_READY; |
mbed_official | 87:085cde657901 | 891 | HAL_SMARTCARD_ErrorCallback(hsc); |
mbed_official | 87:085cde657901 | 892 | } |
mbed_official | 87:085cde657901 | 893 | } |
mbed_official | 87:085cde657901 | 894 | |
mbed_official | 87:085cde657901 | 895 | /** |
mbed_official | 87:085cde657901 | 896 | * @brief Tx Transfer completed callbacks |
mbed_official | 226:b062af740e40 | 897 | * @param hsc: pointer to a SMARTCARD_HandleTypeDef structure that contains |
mbed_official | 226:b062af740e40 | 898 | * the configuration information for SMARTCARD module. |
mbed_official | 87:085cde657901 | 899 | * @retval None |
mbed_official | 87:085cde657901 | 900 | */ |
mbed_official | 87:085cde657901 | 901 | __weak void HAL_SMARTCARD_TxCpltCallback(SMARTCARD_HandleTypeDef *hsc) |
mbed_official | 87:085cde657901 | 902 | { |
mbed_official | 87:085cde657901 | 903 | /* NOTE : This function Should not be modified, when the callback is needed, |
mbed_official | 87:085cde657901 | 904 | the HAL_SMARTCARD_TxCpltCallback could be implemented in the user file |
mbed_official | 87:085cde657901 | 905 | */ |
mbed_official | 87:085cde657901 | 906 | } |
mbed_official | 87:085cde657901 | 907 | |
mbed_official | 87:085cde657901 | 908 | /** |
mbed_official | 87:085cde657901 | 909 | * @brief Rx Transfer completed callbacks |
mbed_official | 226:b062af740e40 | 910 | * @param hsc: pointer to a SMARTCARD_HandleTypeDef structure that contains |
mbed_official | 226:b062af740e40 | 911 | * the configuration information for SMARTCARD module. |
mbed_official | 87:085cde657901 | 912 | * @retval None |
mbed_official | 87:085cde657901 | 913 | */ |
mbed_official | 87:085cde657901 | 914 | __weak void HAL_SMARTCARD_RxCpltCallback(SMARTCARD_HandleTypeDef *hsc) |
mbed_official | 87:085cde657901 | 915 | { |
mbed_official | 87:085cde657901 | 916 | /* NOTE : This function Should not be modified, when the callback is needed, |
mbed_official | 87:085cde657901 | 917 | the HAL_SMARTCARD_TxCpltCallback could be implemented in the user file |
mbed_official | 87:085cde657901 | 918 | */ |
mbed_official | 87:085cde657901 | 919 | } |
mbed_official | 87:085cde657901 | 920 | |
mbed_official | 87:085cde657901 | 921 | /** |
mbed_official | 87:085cde657901 | 922 | * @brief SMARTCARD error callbacks |
mbed_official | 226:b062af740e40 | 923 | * @param hsc: pointer to a SMARTCARD_HandleTypeDef structure that contains |
mbed_official | 226:b062af740e40 | 924 | * the configuration information for SMARTCARD module. |
mbed_official | 87:085cde657901 | 925 | * @retval None |
mbed_official | 87:085cde657901 | 926 | */ |
mbed_official | 87:085cde657901 | 927 | __weak void HAL_SMARTCARD_ErrorCallback(SMARTCARD_HandleTypeDef *hsc) |
mbed_official | 87:085cde657901 | 928 | { |
mbed_official | 87:085cde657901 | 929 | /* NOTE : This function Should not be modified, when the callback is needed, |
mbed_official | 87:085cde657901 | 930 | the HAL_SMARTCARD_ErrorCallback could be implemented in the user file |
mbed_official | 87:085cde657901 | 931 | */ |
mbed_official | 87:085cde657901 | 932 | } |
mbed_official | 87:085cde657901 | 933 | |
mbed_official | 87:085cde657901 | 934 | /** |
mbed_official | 87:085cde657901 | 935 | * @} |
mbed_official | 87:085cde657901 | 936 | */ |
mbed_official | 87:085cde657901 | 937 | |
mbed_official | 87:085cde657901 | 938 | /** @defgroup SMARTCARD_Group3 Peripheral State and Errors functions |
mbed_official | 87:085cde657901 | 939 | * @brief SMARTCARD State and Errors functions |
mbed_official | 87:085cde657901 | 940 | * |
mbed_official | 87:085cde657901 | 941 | @verbatim |
mbed_official | 87:085cde657901 | 942 | =============================================================================== |
mbed_official | 87:085cde657901 | 943 | ##### Peripheral State and Errors functions ##### |
mbed_official | 87:085cde657901 | 944 | =============================================================================== |
mbed_official | 87:085cde657901 | 945 | [..] |
mbed_official | 87:085cde657901 | 946 | This subsection provides a set of functions allowing to control the SmartCard. |
mbed_official | 87:085cde657901 | 947 | (+) HAL_SMARTCARD_GetState() API can be helpful to check in run-time the state of the SmartCard peripheral. |
mbed_official | 87:085cde657901 | 948 | (+) HAL_SMARTCARD_GetError() check in run-time errors that could be occured durung communication. |
mbed_official | 87:085cde657901 | 949 | @endverbatim |
mbed_official | 87:085cde657901 | 950 | * @{ |
mbed_official | 87:085cde657901 | 951 | */ |
mbed_official | 87:085cde657901 | 952 | |
mbed_official | 87:085cde657901 | 953 | /** |
mbed_official | 87:085cde657901 | 954 | * @brief return the SMARTCARD state |
mbed_official | 226:b062af740e40 | 955 | * @param hsc: pointer to a SMARTCARD_HandleTypeDef structure that contains |
mbed_official | 226:b062af740e40 | 956 | * the configuration information for SMARTCARD module. |
mbed_official | 87:085cde657901 | 957 | * @retval HAL state |
mbed_official | 87:085cde657901 | 958 | */ |
mbed_official | 87:085cde657901 | 959 | HAL_SMARTCARD_StateTypeDef HAL_SMARTCARD_GetState(SMARTCARD_HandleTypeDef *hsc) |
mbed_official | 87:085cde657901 | 960 | { |
mbed_official | 87:085cde657901 | 961 | return hsc->State; |
mbed_official | 87:085cde657901 | 962 | } |
mbed_official | 87:085cde657901 | 963 | |
mbed_official | 87:085cde657901 | 964 | /** |
mbed_official | 87:085cde657901 | 965 | * @brief Return the SMARTCARD error code |
mbed_official | 87:085cde657901 | 966 | * @param hsc : pointer to a SMARTCARD_HandleTypeDef structure that contains |
mbed_official | 87:085cde657901 | 967 | * the configuration information for the specified SMARTCARD. |
mbed_official | 87:085cde657901 | 968 | * @retval SMARTCARD Error Code |
mbed_official | 87:085cde657901 | 969 | */ |
mbed_official | 87:085cde657901 | 970 | uint32_t HAL_SMARTCARD_GetError(SMARTCARD_HandleTypeDef *hsc) |
mbed_official | 87:085cde657901 | 971 | { |
mbed_official | 87:085cde657901 | 972 | return hsc->ErrorCode; |
mbed_official | 87:085cde657901 | 973 | } |
mbed_official | 87:085cde657901 | 974 | |
mbed_official | 87:085cde657901 | 975 | /** |
mbed_official | 87:085cde657901 | 976 | * @} |
mbed_official | 87:085cde657901 | 977 | */ |
mbed_official | 87:085cde657901 | 978 | |
mbed_official | 87:085cde657901 | 979 | /** |
mbed_official | 87:085cde657901 | 980 | * @brief DMA SMARTCARD transmit process complete callback |
mbed_official | 226:b062af740e40 | 981 | * @param hdma: pointer to a DMA_HandleTypeDef structure that contains |
mbed_official | 226:b062af740e40 | 982 | * the configuration information for the specified DMA module. |
mbed_official | 87:085cde657901 | 983 | * @retval None |
mbed_official | 87:085cde657901 | 984 | */ |
mbed_official | 106:ced8cbb51063 | 985 | static void SMARTCARD_DMATransmitCplt(DMA_HandleTypeDef *hdma) |
mbed_official | 87:085cde657901 | 986 | { |
mbed_official | 87:085cde657901 | 987 | SMARTCARD_HandleTypeDef* hsc = ( SMARTCARD_HandleTypeDef* )((DMA_HandleTypeDef* )hdma)->Parent; |
mbed_official | 87:085cde657901 | 988 | |
mbed_official | 87:085cde657901 | 989 | hsc->TxXferCount = 0; |
mbed_official | 87:085cde657901 | 990 | |
mbed_official | 87:085cde657901 | 991 | /* Disable the DMA transfer for transmit request by setting the DMAT bit |
mbed_official | 87:085cde657901 | 992 | in the USART CR3 register */ |
mbed_official | 87:085cde657901 | 993 | hsc->Instance->CR3 &= (uint32_t)~((uint32_t)USART_CR3_DMAT); |
mbed_official | 106:ced8cbb51063 | 994 | |
mbed_official | 106:ced8cbb51063 | 995 | /* Wait for SMARTCARD TC Flag */ |
mbed_official | 106:ced8cbb51063 | 996 | if(SMARTCARD_WaitOnFlagUntilTimeout(hsc, SMARTCARD_FLAG_TC, RESET, SMARTCARD_TIMEOUT_VALUE) != HAL_OK) |
mbed_official | 106:ced8cbb51063 | 997 | { |
mbed_official | 106:ced8cbb51063 | 998 | /* Timeout Occured */ |
mbed_official | 106:ced8cbb51063 | 999 | hsc->State = HAL_SMARTCARD_STATE_TIMEOUT; |
mbed_official | 106:ced8cbb51063 | 1000 | HAL_SMARTCARD_ErrorCallback(hsc); |
mbed_official | 106:ced8cbb51063 | 1001 | } |
mbed_official | 106:ced8cbb51063 | 1002 | else |
mbed_official | 106:ced8cbb51063 | 1003 | { |
mbed_official | 106:ced8cbb51063 | 1004 | /* No Timeout */ |
mbed_official | 226:b062af740e40 | 1005 | /* Check if a non-blocking receive process is ongoing or not */ |
mbed_official | 226:b062af740e40 | 1006 | if(hsc->State == HAL_SMARTCARD_STATE_BUSY_TX_RX) |
mbed_official | 226:b062af740e40 | 1007 | { |
mbed_official | 226:b062af740e40 | 1008 | hsc->State = HAL_SMARTCARD_STATE_BUSY_RX; |
mbed_official | 226:b062af740e40 | 1009 | } |
mbed_official | 226:b062af740e40 | 1010 | else |
mbed_official | 226:b062af740e40 | 1011 | { |
mbed_official | 226:b062af740e40 | 1012 | hsc->State = HAL_SMARTCARD_STATE_READY; |
mbed_official | 226:b062af740e40 | 1013 | } |
mbed_official | 106:ced8cbb51063 | 1014 | HAL_SMARTCARD_TxCpltCallback(hsc); |
mbed_official | 106:ced8cbb51063 | 1015 | } |
mbed_official | 87:085cde657901 | 1016 | } |
mbed_official | 87:085cde657901 | 1017 | |
mbed_official | 87:085cde657901 | 1018 | /** |
mbed_official | 87:085cde657901 | 1019 | * @brief DMA SMARTCARD receive process complete callback |
mbed_official | 226:b062af740e40 | 1020 | * @param hdma: pointer to a DMA_HandleTypeDef structure that contains |
mbed_official | 226:b062af740e40 | 1021 | * the configuration information for the specified DMA module. |
mbed_official | 87:085cde657901 | 1022 | * @retval None |
mbed_official | 87:085cde657901 | 1023 | */ |
mbed_official | 87:085cde657901 | 1024 | static void SMARTCARD_DMAReceiveCplt(DMA_HandleTypeDef *hdma) |
mbed_official | 87:085cde657901 | 1025 | { |
mbed_official | 87:085cde657901 | 1026 | SMARTCARD_HandleTypeDef* hsc = ( SMARTCARD_HandleTypeDef* )((DMA_HandleTypeDef* )hdma)->Parent; |
mbed_official | 87:085cde657901 | 1027 | |
mbed_official | 87:085cde657901 | 1028 | hsc->RxXferCount = 0; |
mbed_official | 87:085cde657901 | 1029 | |
mbed_official | 87:085cde657901 | 1030 | /* Disable the DMA transfer for the receiver request by setting the DMAR bit |
mbed_official | 87:085cde657901 | 1031 | in the USART CR3 register */ |
mbed_official | 87:085cde657901 | 1032 | hsc->Instance->CR3 &= (uint32_t)~((uint32_t)USART_CR3_DMAR); |
mbed_official | 87:085cde657901 | 1033 | |
mbed_official | 226:b062af740e40 | 1034 | /* Check if a non-blocking transmit process is ongoing or not */ |
mbed_official | 226:b062af740e40 | 1035 | if(hsc->State == HAL_SMARTCARD_STATE_BUSY_TX_RX) |
mbed_official | 226:b062af740e40 | 1036 | { |
mbed_official | 226:b062af740e40 | 1037 | hsc->State = HAL_SMARTCARD_STATE_BUSY_TX; |
mbed_official | 226:b062af740e40 | 1038 | } |
mbed_official | 226:b062af740e40 | 1039 | else |
mbed_official | 226:b062af740e40 | 1040 | { |
mbed_official | 226:b062af740e40 | 1041 | hsc->State = HAL_SMARTCARD_STATE_READY; |
mbed_official | 226:b062af740e40 | 1042 | } |
mbed_official | 226:b062af740e40 | 1043 | |
mbed_official | 87:085cde657901 | 1044 | HAL_SMARTCARD_RxCpltCallback(hsc); |
mbed_official | 87:085cde657901 | 1045 | } |
mbed_official | 87:085cde657901 | 1046 | |
mbed_official | 87:085cde657901 | 1047 | /** |
mbed_official | 87:085cde657901 | 1048 | * @brief DMA SMARTCARD communication error callback |
mbed_official | 226:b062af740e40 | 1049 | * @param hdma: pointer to a DMA_HandleTypeDef structure that contains |
mbed_official | 226:b062af740e40 | 1050 | * the configuration information for the specified DMA module. |
mbed_official | 87:085cde657901 | 1051 | * @retval None |
mbed_official | 87:085cde657901 | 1052 | */ |
mbed_official | 87:085cde657901 | 1053 | static void SMARTCARD_DMAError(DMA_HandleTypeDef *hdma) |
mbed_official | 87:085cde657901 | 1054 | { |
mbed_official | 87:085cde657901 | 1055 | SMARTCARD_HandleTypeDef* hsc = ( SMARTCARD_HandleTypeDef* )((DMA_HandleTypeDef* )hdma)->Parent; |
mbed_official | 87:085cde657901 | 1056 | |
mbed_official | 87:085cde657901 | 1057 | hsc->RxXferCount = 0; |
mbed_official | 87:085cde657901 | 1058 | hsc->TxXferCount = 0; |
mbed_official | 87:085cde657901 | 1059 | hsc->ErrorCode = HAL_SMARTCARD_ERROR_DMA; |
mbed_official | 87:085cde657901 | 1060 | hsc->State= HAL_SMARTCARD_STATE_READY; |
mbed_official | 87:085cde657901 | 1061 | |
mbed_official | 87:085cde657901 | 1062 | HAL_SMARTCARD_ErrorCallback(hsc); |
mbed_official | 87:085cde657901 | 1063 | } |
mbed_official | 87:085cde657901 | 1064 | |
mbed_official | 87:085cde657901 | 1065 | /** |
mbed_official | 87:085cde657901 | 1066 | * @brief This function handles SMARTCARD Communication Timeout. |
mbed_official | 87:085cde657901 | 1067 | * @param hsc: SMARTCARD handle |
mbed_official | 87:085cde657901 | 1068 | * @param Flag: specifies the SMARTCARD flag to check. |
mbed_official | 87:085cde657901 | 1069 | * @param Status: The new Flag status (SET or RESET). |
mbed_official | 87:085cde657901 | 1070 | * @param Timeout: Timeout duration |
mbed_official | 87:085cde657901 | 1071 | * @retval HAL status |
mbed_official | 87:085cde657901 | 1072 | */ |
mbed_official | 87:085cde657901 | 1073 | static HAL_StatusTypeDef SMARTCARD_WaitOnFlagUntilTimeout(SMARTCARD_HandleTypeDef *hsc, uint32_t Flag, FlagStatus Status, uint32_t Timeout) |
mbed_official | 87:085cde657901 | 1074 | { |
mbed_official | 87:085cde657901 | 1075 | uint32_t timeout = 0; |
mbed_official | 87:085cde657901 | 1076 | |
mbed_official | 87:085cde657901 | 1077 | timeout = HAL_GetTick() + Timeout; |
mbed_official | 87:085cde657901 | 1078 | |
mbed_official | 87:085cde657901 | 1079 | /* Wait until flag is set */ |
mbed_official | 87:085cde657901 | 1080 | if(Status == RESET) |
mbed_official | 87:085cde657901 | 1081 | { |
mbed_official | 87:085cde657901 | 1082 | while(__HAL_SMARTCARD_GET_FLAG(hsc, Flag) == RESET) |
mbed_official | 87:085cde657901 | 1083 | { |
mbed_official | 87:085cde657901 | 1084 | /* Check for the Timeout */ |
mbed_official | 87:085cde657901 | 1085 | if(Timeout != HAL_MAX_DELAY) |
mbed_official | 87:085cde657901 | 1086 | { |
mbed_official | 87:085cde657901 | 1087 | if(HAL_GetTick() >= timeout) |
mbed_official | 87:085cde657901 | 1088 | { |
mbed_official | 87:085cde657901 | 1089 | /* Disable TXE and RXNE interrupts for the interrupt process */ |
mbed_official | 87:085cde657901 | 1090 | __SMARTCARD_DISABLE_IT(hsc, SMARTCARD_IT_TXE); |
mbed_official | 87:085cde657901 | 1091 | __SMARTCARD_DISABLE_IT(hsc, SMARTCARD_IT_RXNE); |
mbed_official | 87:085cde657901 | 1092 | |
mbed_official | 87:085cde657901 | 1093 | hsc->State= HAL_SMARTCARD_STATE_READY; |
mbed_official | 87:085cde657901 | 1094 | |
mbed_official | 87:085cde657901 | 1095 | /* Process Unlocked */ |
mbed_official | 87:085cde657901 | 1096 | __HAL_UNLOCK(hsc); |
mbed_official | 87:085cde657901 | 1097 | |
mbed_official | 87:085cde657901 | 1098 | return HAL_TIMEOUT; |
mbed_official | 87:085cde657901 | 1099 | } |
mbed_official | 87:085cde657901 | 1100 | } |
mbed_official | 87:085cde657901 | 1101 | } |
mbed_official | 87:085cde657901 | 1102 | } |
mbed_official | 87:085cde657901 | 1103 | else |
mbed_official | 87:085cde657901 | 1104 | { |
mbed_official | 87:085cde657901 | 1105 | while(__HAL_SMARTCARD_GET_FLAG(hsc, Flag) != RESET) |
mbed_official | 87:085cde657901 | 1106 | { |
mbed_official | 87:085cde657901 | 1107 | /* Check for the Timeout */ |
mbed_official | 87:085cde657901 | 1108 | if(Timeout != HAL_MAX_DELAY) |
mbed_official | 87:085cde657901 | 1109 | { |
mbed_official | 87:085cde657901 | 1110 | if(HAL_GetTick() >= timeout) |
mbed_official | 87:085cde657901 | 1111 | { |
mbed_official | 87:085cde657901 | 1112 | /* Disable TXE and RXNE interrupts for the interrupt process */ |
mbed_official | 87:085cde657901 | 1113 | __SMARTCARD_DISABLE_IT(hsc, SMARTCARD_IT_TXE); |
mbed_official | 87:085cde657901 | 1114 | __SMARTCARD_DISABLE_IT(hsc, SMARTCARD_IT_RXNE); |
mbed_official | 87:085cde657901 | 1115 | |
mbed_official | 87:085cde657901 | 1116 | hsc->State= HAL_SMARTCARD_STATE_READY; |
mbed_official | 87:085cde657901 | 1117 | |
mbed_official | 87:085cde657901 | 1118 | /* Process Unlocked */ |
mbed_official | 87:085cde657901 | 1119 | __HAL_UNLOCK(hsc); |
mbed_official | 87:085cde657901 | 1120 | |
mbed_official | 87:085cde657901 | 1121 | return HAL_TIMEOUT; |
mbed_official | 87:085cde657901 | 1122 | } |
mbed_official | 87:085cde657901 | 1123 | } |
mbed_official | 87:085cde657901 | 1124 | } |
mbed_official | 87:085cde657901 | 1125 | } |
mbed_official | 87:085cde657901 | 1126 | return HAL_OK; |
mbed_official | 87:085cde657901 | 1127 | } |
mbed_official | 87:085cde657901 | 1128 | |
mbed_official | 87:085cde657901 | 1129 | /** |
mbed_official | 87:085cde657901 | 1130 | * @brief Send an amount of data in non blocking mode |
mbed_official | 226:b062af740e40 | 1131 | * @param hsc: pointer to a SMARTCARD_HandleTypeDef structure that contains |
mbed_official | 226:b062af740e40 | 1132 | * the configuration information for SMARTCARD module. |
mbed_official | 87:085cde657901 | 1133 | * @retval HAL status |
mbed_official | 87:085cde657901 | 1134 | */ |
mbed_official | 87:085cde657901 | 1135 | static HAL_StatusTypeDef SMARTCARD_Transmit_IT(SMARTCARD_HandleTypeDef *hsc) |
mbed_official | 87:085cde657901 | 1136 | { |
mbed_official | 87:085cde657901 | 1137 | uint16_t* tmp; |
mbed_official | 226:b062af740e40 | 1138 | uint32_t tmp1 = 0; |
mbed_official | 226:b062af740e40 | 1139 | |
mbed_official | 226:b062af740e40 | 1140 | tmp1 = hsc->State; |
mbed_official | 226:b062af740e40 | 1141 | if((tmp1 == HAL_SMARTCARD_STATE_BUSY_TX) || (tmp1 == HAL_SMARTCARD_STATE_BUSY_TX_RX)) |
mbed_official | 87:085cde657901 | 1142 | { |
mbed_official | 87:085cde657901 | 1143 | if(hsc->Init.WordLength == SMARTCARD_WORDLENGTH_9B) |
mbed_official | 87:085cde657901 | 1144 | { |
mbed_official | 87:085cde657901 | 1145 | tmp = (uint16_t*) hsc->pTxBuffPtr; |
mbed_official | 87:085cde657901 | 1146 | hsc->Instance->DR = (uint16_t)(*tmp & (uint16_t)0x01FF); |
mbed_official | 87:085cde657901 | 1147 | if(hsc->Init.Parity == SMARTCARD_PARITY_NONE) |
mbed_official | 87:085cde657901 | 1148 | { |
mbed_official | 87:085cde657901 | 1149 | hsc->pTxBuffPtr += 2; |
mbed_official | 87:085cde657901 | 1150 | } |
mbed_official | 87:085cde657901 | 1151 | else |
mbed_official | 87:085cde657901 | 1152 | { |
mbed_official | 87:085cde657901 | 1153 | hsc->pTxBuffPtr += 1; |
mbed_official | 87:085cde657901 | 1154 | } |
mbed_official | 87:085cde657901 | 1155 | } |
mbed_official | 87:085cde657901 | 1156 | else |
mbed_official | 87:085cde657901 | 1157 | { |
mbed_official | 87:085cde657901 | 1158 | hsc->Instance->DR = (uint8_t)(*hsc->pTxBuffPtr++ & (uint8_t)0x00FF); |
mbed_official | 87:085cde657901 | 1159 | } |
mbed_official | 87:085cde657901 | 1160 | |
mbed_official | 87:085cde657901 | 1161 | if(--hsc->TxXferCount == 0) |
mbed_official | 87:085cde657901 | 1162 | { |
mbed_official | 87:085cde657901 | 1163 | /* Disable the SMARTCARD Transmit Complete Interrupt */ |
mbed_official | 87:085cde657901 | 1164 | __SMARTCARD_DISABLE_IT(hsc, SMARTCARD_IT_TC); |
mbed_official | 87:085cde657901 | 1165 | |
mbed_official | 87:085cde657901 | 1166 | /* Disable the SMARTCARD Parity Error Interrupt */ |
mbed_official | 87:085cde657901 | 1167 | __SMARTCARD_DISABLE_IT(hsc, SMARTCARD_IT_PE); |
mbed_official | 87:085cde657901 | 1168 | |
mbed_official | 87:085cde657901 | 1169 | /* Disable the SMARTCARD Error Interrupt: (Frame error, noise error, overrun error) */ |
mbed_official | 87:085cde657901 | 1170 | __SMARTCARD_DISABLE_IT(hsc, SMARTCARD_IT_ERR); |
mbed_official | 87:085cde657901 | 1171 | |
mbed_official | 226:b062af740e40 | 1172 | /* Check if a non-blocking receive process is ongoing or not */ |
mbed_official | 226:b062af740e40 | 1173 | if(hsc->State == HAL_SMARTCARD_STATE_BUSY_TX_RX) |
mbed_official | 226:b062af740e40 | 1174 | { |
mbed_official | 226:b062af740e40 | 1175 | hsc->State = HAL_SMARTCARD_STATE_BUSY_RX; |
mbed_official | 226:b062af740e40 | 1176 | } |
mbed_official | 226:b062af740e40 | 1177 | else |
mbed_official | 226:b062af740e40 | 1178 | { |
mbed_official | 226:b062af740e40 | 1179 | hsc->State = HAL_SMARTCARD_STATE_READY; |
mbed_official | 226:b062af740e40 | 1180 | } |
mbed_official | 87:085cde657901 | 1181 | |
mbed_official | 87:085cde657901 | 1182 | HAL_SMARTCARD_TxCpltCallback(hsc); |
mbed_official | 87:085cde657901 | 1183 | |
mbed_official | 87:085cde657901 | 1184 | return HAL_OK; |
mbed_official | 87:085cde657901 | 1185 | } |
mbed_official | 87:085cde657901 | 1186 | |
mbed_official | 87:085cde657901 | 1187 | return HAL_OK; |
mbed_official | 87:085cde657901 | 1188 | } |
mbed_official | 87:085cde657901 | 1189 | else |
mbed_official | 87:085cde657901 | 1190 | { |
mbed_official | 87:085cde657901 | 1191 | return HAL_BUSY; |
mbed_official | 87:085cde657901 | 1192 | } |
mbed_official | 87:085cde657901 | 1193 | } |
mbed_official | 87:085cde657901 | 1194 | |
mbed_official | 87:085cde657901 | 1195 | /** |
mbed_official | 87:085cde657901 | 1196 | * @brief Receive an amount of data in non blocking mode |
mbed_official | 226:b062af740e40 | 1197 | * @param hsc: pointer to a SMARTCARD_HandleTypeDef structure that contains |
mbed_official | 226:b062af740e40 | 1198 | * the configuration information for SMARTCARD module. |
mbed_official | 87:085cde657901 | 1199 | * @retval HAL status |
mbed_official | 87:085cde657901 | 1200 | */ |
mbed_official | 87:085cde657901 | 1201 | static HAL_StatusTypeDef SMARTCARD_Receive_IT(SMARTCARD_HandleTypeDef *hsc) |
mbed_official | 87:085cde657901 | 1202 | { |
mbed_official | 87:085cde657901 | 1203 | uint16_t* tmp; |
mbed_official | 226:b062af740e40 | 1204 | uint32_t tmp1 = 0; |
mbed_official | 226:b062af740e40 | 1205 | |
mbed_official | 226:b062af740e40 | 1206 | tmp1 = hsc->State; |
mbed_official | 226:b062af740e40 | 1207 | if((tmp1 == HAL_SMARTCARD_STATE_BUSY_RX) || (tmp1 == HAL_SMARTCARD_STATE_BUSY_TX_RX)) |
mbed_official | 87:085cde657901 | 1208 | { |
mbed_official | 87:085cde657901 | 1209 | if(hsc->Init.WordLength == SMARTCARD_WORDLENGTH_9B) |
mbed_official | 87:085cde657901 | 1210 | { |
mbed_official | 87:085cde657901 | 1211 | tmp = (uint16_t*) hsc->pRxBuffPtr; |
mbed_official | 87:085cde657901 | 1212 | if(hsc->Init.Parity == SMARTCARD_PARITY_NONE) |
mbed_official | 87:085cde657901 | 1213 | { |
mbed_official | 87:085cde657901 | 1214 | *tmp = (uint16_t)(hsc->Instance->DR & (uint16_t)0x01FF); |
mbed_official | 87:085cde657901 | 1215 | hsc->pRxBuffPtr += 2; |
mbed_official | 87:085cde657901 | 1216 | } |
mbed_official | 87:085cde657901 | 1217 | else |
mbed_official | 87:085cde657901 | 1218 | { |
mbed_official | 87:085cde657901 | 1219 | *tmp = (uint16_t)(hsc->Instance->DR & (uint16_t)0x00FF); |
mbed_official | 87:085cde657901 | 1220 | hsc->pRxBuffPtr += 1; |
mbed_official | 87:085cde657901 | 1221 | } |
mbed_official | 87:085cde657901 | 1222 | } |
mbed_official | 87:085cde657901 | 1223 | else |
mbed_official | 87:085cde657901 | 1224 | { |
mbed_official | 87:085cde657901 | 1225 | if(hsc->Init.Parity == SMARTCARD_PARITY_NONE) |
mbed_official | 87:085cde657901 | 1226 | { |
mbed_official | 87:085cde657901 | 1227 | *hsc->pRxBuffPtr++ = (uint8_t)(hsc->Instance->DR & (uint8_t)0x00FF); |
mbed_official | 87:085cde657901 | 1228 | } |
mbed_official | 87:085cde657901 | 1229 | else |
mbed_official | 87:085cde657901 | 1230 | { |
mbed_official | 87:085cde657901 | 1231 | *hsc->pRxBuffPtr++ = (uint8_t)(hsc->Instance->DR & (uint8_t)0x007F); |
mbed_official | 87:085cde657901 | 1232 | } |
mbed_official | 87:085cde657901 | 1233 | } |
mbed_official | 87:085cde657901 | 1234 | |
mbed_official | 87:085cde657901 | 1235 | if(--hsc->RxXferCount == 0) |
mbed_official | 87:085cde657901 | 1236 | { |
mbed_official | 87:085cde657901 | 1237 | while(HAL_IS_BIT_SET(hsc->Instance->SR, SMARTCARD_FLAG_RXNE)) |
mbed_official | 87:085cde657901 | 1238 | { |
mbed_official | 87:085cde657901 | 1239 | } |
mbed_official | 87:085cde657901 | 1240 | __SMARTCARD_DISABLE_IT(hsc, SMARTCARD_IT_RXNE); |
mbed_official | 87:085cde657901 | 1241 | |
mbed_official | 87:085cde657901 | 1242 | /* Disable the SMARTCARD Parity Error Interrupt */ |
mbed_official | 87:085cde657901 | 1243 | __SMARTCARD_DISABLE_IT(hsc, SMARTCARD_IT_PE); |
mbed_official | 87:085cde657901 | 1244 | |
mbed_official | 87:085cde657901 | 1245 | /* Disable the SMARTCARD Error Interrupt: (Frame error, noise error, overrun error) */ |
mbed_official | 87:085cde657901 | 1246 | __SMARTCARD_DISABLE_IT(hsc, SMARTCARD_IT_ERR); |
mbed_official | 87:085cde657901 | 1247 | |
mbed_official | 226:b062af740e40 | 1248 | /* Check if a non-blocking transmit process is ongoing or not */ |
mbed_official | 226:b062af740e40 | 1249 | if(hsc->State == HAL_SMARTCARD_STATE_BUSY_TX_RX) |
mbed_official | 226:b062af740e40 | 1250 | { |
mbed_official | 226:b062af740e40 | 1251 | hsc->State = HAL_SMARTCARD_STATE_BUSY_TX; |
mbed_official | 226:b062af740e40 | 1252 | } |
mbed_official | 226:b062af740e40 | 1253 | else |
mbed_official | 226:b062af740e40 | 1254 | { |
mbed_official | 226:b062af740e40 | 1255 | hsc->State = HAL_SMARTCARD_STATE_READY; |
mbed_official | 226:b062af740e40 | 1256 | } |
mbed_official | 87:085cde657901 | 1257 | |
mbed_official | 87:085cde657901 | 1258 | HAL_SMARTCARD_RxCpltCallback(hsc); |
mbed_official | 87:085cde657901 | 1259 | |
mbed_official | 87:085cde657901 | 1260 | return HAL_OK; |
mbed_official | 87:085cde657901 | 1261 | } |
mbed_official | 87:085cde657901 | 1262 | return HAL_OK; |
mbed_official | 87:085cde657901 | 1263 | } |
mbed_official | 87:085cde657901 | 1264 | else |
mbed_official | 87:085cde657901 | 1265 | { |
mbed_official | 87:085cde657901 | 1266 | return HAL_BUSY; |
mbed_official | 87:085cde657901 | 1267 | } |
mbed_official | 87:085cde657901 | 1268 | } |
mbed_official | 87:085cde657901 | 1269 | |
mbed_official | 87:085cde657901 | 1270 | /** |
mbed_official | 87:085cde657901 | 1271 | * @brief Configure the SMARTCARD peripheral |
mbed_official | 226:b062af740e40 | 1272 | * @param hsc: pointer to a SMARTCARD_HandleTypeDef structure that contains |
mbed_official | 226:b062af740e40 | 1273 | * the configuration information for SMARTCARD module. |
mbed_official | 87:085cde657901 | 1274 | * @retval None |
mbed_official | 87:085cde657901 | 1275 | */ |
mbed_official | 87:085cde657901 | 1276 | static void SMARTCARD_SetConfig(SMARTCARD_HandleTypeDef *hsc) |
mbed_official | 87:085cde657901 | 1277 | { |
mbed_official | 87:085cde657901 | 1278 | uint32_t tmpreg = 0x00; |
mbed_official | 87:085cde657901 | 1279 | |
mbed_official | 87:085cde657901 | 1280 | /* Check the parameters */ |
mbed_official | 87:085cde657901 | 1281 | assert_param(IS_SMARTCARD_INSTANCE(hsc->Instance)); |
mbed_official | 87:085cde657901 | 1282 | assert_param(IS_SMARTCARD_POLARITY(hsc->Init.CLKPolarity)); |
mbed_official | 87:085cde657901 | 1283 | assert_param(IS_SMARTCARD_PHASE(hsc->Init.CLKPhase)); |
mbed_official | 87:085cde657901 | 1284 | assert_param(IS_SMARTCARD_LASTBIT(hsc->Init.CLKLastBit)); |
mbed_official | 87:085cde657901 | 1285 | assert_param(IS_SMARTCARD_BAUDRATE(hsc->Init.BaudRate)); |
mbed_official | 87:085cde657901 | 1286 | assert_param(IS_SMARTCARD_WORD_LENGTH(hsc->Init.WordLength)); |
mbed_official | 87:085cde657901 | 1287 | assert_param(IS_SMARTCARD_STOPBITS(hsc->Init.StopBits)); |
mbed_official | 87:085cde657901 | 1288 | assert_param(IS_SMARTCARD_PARITY(hsc->Init.Parity)); |
mbed_official | 87:085cde657901 | 1289 | assert_param(IS_SMARTCARD_MODE(hsc->Init.Mode)); |
mbed_official | 87:085cde657901 | 1290 | assert_param(IS_SMARTCARD_NACK_STATE(hsc->Init.NACKState)); |
mbed_official | 87:085cde657901 | 1291 | |
mbed_official | 87:085cde657901 | 1292 | /* The LBCL, CPOL and CPHA bits have to be selected when both the transmitter and the |
mbed_official | 87:085cde657901 | 1293 | receiver are disabled (TE=RE=0) to ensure that the clock pulses function correctly. */ |
mbed_official | 87:085cde657901 | 1294 | hsc->Instance->CR1 &= (uint32_t)~((uint32_t)(USART_CR1_TE | USART_CR1_RE)); |
mbed_official | 87:085cde657901 | 1295 | |
mbed_official | 87:085cde657901 | 1296 | /*---------------------------- USART CR2 Configuration ---------------------*/ |
mbed_official | 87:085cde657901 | 1297 | tmpreg = hsc->Instance->CR2; |
mbed_official | 87:085cde657901 | 1298 | /* Clear CLKEN, CPOL, CPHA and LBCL bits */ |
mbed_official | 87:085cde657901 | 1299 | tmpreg &= (uint32_t)~((uint32_t)(USART_CR2_CPHA | USART_CR2_CPOL | USART_CR2_CLKEN | USART_CR2_LBCL)); |
mbed_official | 87:085cde657901 | 1300 | /* Configure the SMARTCARD Clock, CPOL, CPHA and LastBit -----------------------*/ |
mbed_official | 87:085cde657901 | 1301 | /* Set CPOL bit according to hsc->Init.CLKPolarity value */ |
mbed_official | 87:085cde657901 | 1302 | /* Set CPHA bit according to hsc->Init.CLKPhase value */ |
mbed_official | 87:085cde657901 | 1303 | /* Set LBCL bit according to hsc->Init.CLKLastBit value */ |
mbed_official | 87:085cde657901 | 1304 | /* Set Stop Bits: Set STOP[13:12] bits according to hsc->Init.StopBits value */ |
mbed_official | 87:085cde657901 | 1305 | tmpreg |= (uint32_t)(USART_CR2_CLKEN | hsc->Init.CLKPolarity | |
mbed_official | 87:085cde657901 | 1306 | hsc->Init.CLKPhase| hsc->Init.CLKLastBit | hsc->Init.StopBits); |
mbed_official | 87:085cde657901 | 1307 | /* Write to USART CR2 */ |
mbed_official | 87:085cde657901 | 1308 | hsc->Instance->CR2 = (uint32_t)tmpreg; |
mbed_official | 87:085cde657901 | 1309 | |
mbed_official | 87:085cde657901 | 1310 | tmpreg = hsc->Instance->CR2; |
mbed_official | 87:085cde657901 | 1311 | |
mbed_official | 87:085cde657901 | 1312 | /* Clear STOP[13:12] bits */ |
mbed_official | 87:085cde657901 | 1313 | tmpreg &= (uint32_t)~((uint32_t)USART_CR2_STOP); |
mbed_official | 87:085cde657901 | 1314 | |
mbed_official | 87:085cde657901 | 1315 | /* Set Stop Bits: Set STOP[13:12] bits according to hsc->Init.StopBits value */ |
mbed_official | 87:085cde657901 | 1316 | tmpreg |= (uint32_t)(hsc->Init.StopBits); |
mbed_official | 87:085cde657901 | 1317 | |
mbed_official | 87:085cde657901 | 1318 | /* Write to USART CR2 */ |
mbed_official | 87:085cde657901 | 1319 | hsc->Instance->CR2 = (uint32_t)tmpreg; |
mbed_official | 87:085cde657901 | 1320 | |
mbed_official | 87:085cde657901 | 1321 | /*-------------------------- USART CR1 Configuration -----------------------*/ |
mbed_official | 87:085cde657901 | 1322 | tmpreg = hsc->Instance->CR1; |
mbed_official | 87:085cde657901 | 1323 | |
mbed_official | 87:085cde657901 | 1324 | /* Clear M, PCE, PS, TE and RE bits */ |
mbed_official | 87:085cde657901 | 1325 | tmpreg &= (uint32_t)~((uint32_t)(USART_CR1_M | USART_CR1_PCE | USART_CR1_PS | USART_CR1_TE | \ |
mbed_official | 87:085cde657901 | 1326 | USART_CR1_RE)); |
mbed_official | 87:085cde657901 | 1327 | |
mbed_official | 87:085cde657901 | 1328 | /* Configure the SMARTCARD Word Length, Parity and mode: |
mbed_official | 87:085cde657901 | 1329 | Set the M bits according to hsc->Init.WordLength value |
mbed_official | 87:085cde657901 | 1330 | Set PCE and PS bits according to hsc->Init.Parity value |
mbed_official | 87:085cde657901 | 1331 | Set TE and RE bits according to hsc->Init.Mode value */ |
mbed_official | 87:085cde657901 | 1332 | tmpreg |= (uint32_t)hsc->Init.WordLength | hsc->Init.Parity | hsc->Init.Mode; |
mbed_official | 87:085cde657901 | 1333 | |
mbed_official | 87:085cde657901 | 1334 | /* Write to USART CR1 */ |
mbed_official | 87:085cde657901 | 1335 | hsc->Instance->CR1 = (uint32_t)tmpreg; |
mbed_official | 87:085cde657901 | 1336 | |
mbed_official | 87:085cde657901 | 1337 | /*-------------------------- USART CR3 Configuration -----------------------*/ |
mbed_official | 87:085cde657901 | 1338 | /* Clear CTSE and RTSE bits */ |
mbed_official | 87:085cde657901 | 1339 | hsc->Instance->CR3 &= (uint32_t)~((uint32_t)(USART_CR3_RTSE | USART_CR3_CTSE)); |
mbed_official | 87:085cde657901 | 1340 | |
mbed_official | 87:085cde657901 | 1341 | /*-------------------------- USART BRR Configuration -----------------------*/ |
mbed_official | 87:085cde657901 | 1342 | if((hsc->Instance == USART1) || (hsc->Instance == USART6)) |
mbed_official | 87:085cde657901 | 1343 | { |
mbed_official | 87:085cde657901 | 1344 | hsc->Instance->BRR = __SMARTCARD_BRR(HAL_RCC_GetPCLK2Freq(), hsc->Init.BaudRate); |
mbed_official | 87:085cde657901 | 1345 | } |
mbed_official | 87:085cde657901 | 1346 | else |
mbed_official | 87:085cde657901 | 1347 | { |
mbed_official | 87:085cde657901 | 1348 | hsc->Instance->BRR = __SMARTCARD_BRR(HAL_RCC_GetPCLK1Freq(), hsc->Init.BaudRate); |
mbed_official | 87:085cde657901 | 1349 | } |
mbed_official | 87:085cde657901 | 1350 | } |
mbed_official | 87:085cde657901 | 1351 | |
mbed_official | 87:085cde657901 | 1352 | /** |
mbed_official | 87:085cde657901 | 1353 | * @} |
mbed_official | 87:085cde657901 | 1354 | */ |
mbed_official | 87:085cde657901 | 1355 | |
mbed_official | 87:085cde657901 | 1356 | #endif /* HAL_SMARTCARD_MODULE_ENABLED */ |
mbed_official | 87:085cde657901 | 1357 | /** |
mbed_official | 87:085cde657901 | 1358 | * @} |
mbed_official | 87:085cde657901 | 1359 | */ |
mbed_official | 87:085cde657901 | 1360 | |
mbed_official | 87:085cde657901 | 1361 | /** |
mbed_official | 87:085cde657901 | 1362 | * @} |
mbed_official | 87:085cde657901 | 1363 | */ |
mbed_official | 87:085cde657901 | 1364 | |
mbed_official | 87:085cde657901 | 1365 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |