mbed library sources. Supersedes mbed-src.
Dependents: Nucleo_Hello_Encoder BLE_iBeaconScan AM1805_DEMO DISCO-F429ZI_ExportTemplate1 ... more
targets/TARGET_STM/TARGET_STM32F7/device/stm32f7xx_hal_smartcard_ex.c@149:156823d33999, 2016-10-28 (annotated)
- Committer:
- <>
- Date:
- Fri Oct 28 11:17:30 2016 +0100
- Revision:
- 149:156823d33999
- Parent:
- targets/cmsis/TARGET_STM/TARGET_STM32F7/stm32f7xx_hal_smartcard_ex.c@144:ef7eb2e8f9f7
- Child:
- 157:ff67d9f36b67
This updates the lib to the mbed lib v128
NOTE: This release includes a restructuring of the file and directory locations and thus some
include paths in your code may need updating accordingly.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
<> | 144:ef7eb2e8f9f7 | 1 | /** |
<> | 144:ef7eb2e8f9f7 | 2 | ****************************************************************************** |
<> | 144:ef7eb2e8f9f7 | 3 | * @file stm32f7xx_hal_smartcard_ex.c |
<> | 144:ef7eb2e8f9f7 | 4 | * @author MCD Application Team |
<> | 144:ef7eb2e8f9f7 | 5 | * @version V1.1.0 |
<> | 144:ef7eb2e8f9f7 | 6 | * @date 22-April-2016 |
<> | 144:ef7eb2e8f9f7 | 7 | * @brief SMARTCARD HAL module driver. |
<> | 144:ef7eb2e8f9f7 | 8 | * |
<> | 144:ef7eb2e8f9f7 | 9 | * This file provides extended firmware functions to manage the following |
<> | 144:ef7eb2e8f9f7 | 10 | * functionalities of the SmartCard. |
<> | 144:ef7eb2e8f9f7 | 11 | * + Initialization and de-initialization functions |
<> | 144:ef7eb2e8f9f7 | 12 | * + Peripheral Control functions |
<> | 144:ef7eb2e8f9f7 | 13 | @verbatim |
<> | 144:ef7eb2e8f9f7 | 14 | =============================================================================== |
<> | 144:ef7eb2e8f9f7 | 15 | ##### How to use this driver ##### |
<> | 144:ef7eb2e8f9f7 | 16 | =============================================================================== |
<> | 144:ef7eb2e8f9f7 | 17 | [..] |
<> | 144:ef7eb2e8f9f7 | 18 | The Extended SMARTCARD HAL driver can be used as follow: |
<> | 144:ef7eb2e8f9f7 | 19 | |
<> | 144:ef7eb2e8f9f7 | 20 | (#) After having configured the SMARTCARD basic features with HAL_SMARTCARD_Init(), |
<> | 144:ef7eb2e8f9f7 | 21 | then if required, program SMARTCARD advanced features (TX/RX pins swap, TimeOut, |
<> | 144:ef7eb2e8f9f7 | 22 | auto-retry counter,...) in the hsc AdvancedInit structure. |
<> | 144:ef7eb2e8f9f7 | 23 | |
<> | 144:ef7eb2e8f9f7 | 24 | @endverbatim |
<> | 144:ef7eb2e8f9f7 | 25 | ****************************************************************************** |
<> | 144:ef7eb2e8f9f7 | 26 | * @attention |
<> | 144:ef7eb2e8f9f7 | 27 | * |
<> | 144:ef7eb2e8f9f7 | 28 | * <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2> |
<> | 144:ef7eb2e8f9f7 | 29 | * |
<> | 144:ef7eb2e8f9f7 | 30 | * Redistribution and use in source and binary forms, with or without modification, |
<> | 144:ef7eb2e8f9f7 | 31 | * are permitted provided that the following conditions are met: |
<> | 144:ef7eb2e8f9f7 | 32 | * 1. Redistributions of source code must retain the above copyright notice, |
<> | 144:ef7eb2e8f9f7 | 33 | * this list of conditions and the following disclaimer. |
<> | 144:ef7eb2e8f9f7 | 34 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
<> | 144:ef7eb2e8f9f7 | 35 | * this list of conditions and the following disclaimer in the documentation |
<> | 144:ef7eb2e8f9f7 | 36 | * and/or other materials provided with the distribution. |
<> | 144:ef7eb2e8f9f7 | 37 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
<> | 144:ef7eb2e8f9f7 | 38 | * may be used to endorse or promote products derived from this software |
<> | 144:ef7eb2e8f9f7 | 39 | * without specific prior written permission. |
<> | 144:ef7eb2e8f9f7 | 40 | * |
<> | 144:ef7eb2e8f9f7 | 41 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
<> | 144:ef7eb2e8f9f7 | 42 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
<> | 144:ef7eb2e8f9f7 | 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
<> | 144:ef7eb2e8f9f7 | 44 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
<> | 144:ef7eb2e8f9f7 | 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
<> | 144:ef7eb2e8f9f7 | 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
<> | 144:ef7eb2e8f9f7 | 47 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
<> | 144:ef7eb2e8f9f7 | 48 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
<> | 144:ef7eb2e8f9f7 | 49 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
<> | 144:ef7eb2e8f9f7 | 50 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
<> | 144:ef7eb2e8f9f7 | 51 | * |
<> | 144:ef7eb2e8f9f7 | 52 | ****************************************************************************** |
<> | 144:ef7eb2e8f9f7 | 53 | */ |
<> | 144:ef7eb2e8f9f7 | 54 | |
<> | 144:ef7eb2e8f9f7 | 55 | /* Includes ------------------------------------------------------------------*/ |
<> | 144:ef7eb2e8f9f7 | 56 | #include "stm32f7xx_hal.h" |
<> | 144:ef7eb2e8f9f7 | 57 | |
<> | 144:ef7eb2e8f9f7 | 58 | /** @addtogroup STM32F7xx_HAL_Driver |
<> | 144:ef7eb2e8f9f7 | 59 | * @{ |
<> | 144:ef7eb2e8f9f7 | 60 | */ |
<> | 144:ef7eb2e8f9f7 | 61 | |
<> | 144:ef7eb2e8f9f7 | 62 | /** @defgroup SMARTCARDEx SMARTCARDEx |
<> | 144:ef7eb2e8f9f7 | 63 | * @brief SMARTCARD Extended HAL module driver |
<> | 144:ef7eb2e8f9f7 | 64 | * @{ |
<> | 144:ef7eb2e8f9f7 | 65 | */ |
<> | 144:ef7eb2e8f9f7 | 66 | #ifdef HAL_SMARTCARD_MODULE_ENABLED |
<> | 144:ef7eb2e8f9f7 | 67 | |
<> | 144:ef7eb2e8f9f7 | 68 | /* Private typedef -----------------------------------------------------------*/ |
<> | 144:ef7eb2e8f9f7 | 69 | /* Private define ------------------------------------------------------------*/ |
<> | 144:ef7eb2e8f9f7 | 70 | /* Private macro -------------------------------------------------------------*/ |
<> | 144:ef7eb2e8f9f7 | 71 | /* Private variables ---------------------------------------------------------*/ |
<> | 144:ef7eb2e8f9f7 | 72 | /* Private function prototypes -----------------------------------------------*/ |
<> | 144:ef7eb2e8f9f7 | 73 | /* Private functions ---------------------------------------------------------*/ |
<> | 144:ef7eb2e8f9f7 | 74 | |
<> | 144:ef7eb2e8f9f7 | 75 | /** @defgroup SMARTCARDEx_Exported_Functions SMARTCARDEx Exported Functions |
<> | 144:ef7eb2e8f9f7 | 76 | * @{ |
<> | 144:ef7eb2e8f9f7 | 77 | */ |
<> | 144:ef7eb2e8f9f7 | 78 | |
<> | 144:ef7eb2e8f9f7 | 79 | /** @defgroup SMARTCARDEx_Group1 Extended Peripheral Control functions |
<> | 144:ef7eb2e8f9f7 | 80 | * @brief Extended control functions |
<> | 144:ef7eb2e8f9f7 | 81 | * |
<> | 144:ef7eb2e8f9f7 | 82 | @verbatim |
<> | 144:ef7eb2e8f9f7 | 83 | =============================================================================== |
<> | 144:ef7eb2e8f9f7 | 84 | ##### Peripheral Control functions ##### |
<> | 144:ef7eb2e8f9f7 | 85 | =============================================================================== |
<> | 144:ef7eb2e8f9f7 | 86 | [..] |
<> | 144:ef7eb2e8f9f7 | 87 | This subsection provides a set of functions allowing to initialize the SMARTCARD. |
<> | 144:ef7eb2e8f9f7 | 88 | (+) HAL_SMARTCARDEx_BlockLength_Config() API allows to configure the Block Length on the fly |
<> | 144:ef7eb2e8f9f7 | 89 | (+) HAL_SMARTCARDEx_TimeOut_Config() API allows to configure the receiver timeout value on the fly |
<> | 144:ef7eb2e8f9f7 | 90 | (+) HAL_SMARTCARDEx_EnableReceiverTimeOut() API enables the receiver timeout feature |
<> | 144:ef7eb2e8f9f7 | 91 | (+) HAL_SMARTCARDEx_DisableReceiverTimeOut() API disables the receiver timeout feature |
<> | 144:ef7eb2e8f9f7 | 92 | |
<> | 144:ef7eb2e8f9f7 | 93 | @endverbatim |
<> | 144:ef7eb2e8f9f7 | 94 | * @{ |
<> | 144:ef7eb2e8f9f7 | 95 | */ |
<> | 144:ef7eb2e8f9f7 | 96 | |
<> | 144:ef7eb2e8f9f7 | 97 | /** |
<> | 144:ef7eb2e8f9f7 | 98 | * @brief Update on the fly the SMARTCARD block length in RTOR register |
<> | 144:ef7eb2e8f9f7 | 99 | * @param hsc: SMARTCARD handle |
<> | 144:ef7eb2e8f9f7 | 100 | * @param BlockLength: SMARTCARD block length (8-bit long at most) |
<> | 144:ef7eb2e8f9f7 | 101 | * @retval None |
<> | 144:ef7eb2e8f9f7 | 102 | */ |
<> | 144:ef7eb2e8f9f7 | 103 | void HAL_SMARTCARDEx_BlockLength_Config(SMARTCARD_HandleTypeDef *hsc, uint8_t BlockLength) |
<> | 144:ef7eb2e8f9f7 | 104 | { |
<> | 144:ef7eb2e8f9f7 | 105 | MODIFY_REG(hsc->Instance->RTOR, USART_RTOR_BLEN, ((uint32_t)BlockLength << SMARTCARD_RTOR_BLEN_LSB_POS)); |
<> | 144:ef7eb2e8f9f7 | 106 | } |
<> | 144:ef7eb2e8f9f7 | 107 | |
<> | 144:ef7eb2e8f9f7 | 108 | /** |
<> | 144:ef7eb2e8f9f7 | 109 | * @brief Update on the fly the receiver timeout value in RTOR register |
<> | 144:ef7eb2e8f9f7 | 110 | * @param hsc: SMARTCARD handle |
<> | 144:ef7eb2e8f9f7 | 111 | * @param TimeOutValue: receiver timeout value in number of baud blocks. The timeout |
<> | 144:ef7eb2e8f9f7 | 112 | * value must be less or equal to 0x0FFFFFFFF. |
<> | 144:ef7eb2e8f9f7 | 113 | * @retval None |
<> | 144:ef7eb2e8f9f7 | 114 | */ |
<> | 144:ef7eb2e8f9f7 | 115 | void HAL_SMARTCARDEx_TimeOut_Config(SMARTCARD_HandleTypeDef *hsc, uint32_t TimeOutValue) |
<> | 144:ef7eb2e8f9f7 | 116 | { |
<> | 144:ef7eb2e8f9f7 | 117 | assert_param(IS_SMARTCARD_TIMEOUT_VALUE(hsc->Init.TimeOutValue)); |
<> | 144:ef7eb2e8f9f7 | 118 | MODIFY_REG(hsc->Instance->RTOR, USART_RTOR_RTO, TimeOutValue); |
<> | 144:ef7eb2e8f9f7 | 119 | } |
<> | 144:ef7eb2e8f9f7 | 120 | |
<> | 144:ef7eb2e8f9f7 | 121 | /** |
<> | 144:ef7eb2e8f9f7 | 122 | * @brief Enable the SMARTCARD receiver timeout feature |
<> | 144:ef7eb2e8f9f7 | 123 | * @param hsc: SMARTCARD handle |
<> | 144:ef7eb2e8f9f7 | 124 | * @retval HAL status |
<> | 144:ef7eb2e8f9f7 | 125 | */ |
<> | 144:ef7eb2e8f9f7 | 126 | HAL_StatusTypeDef HAL_SMARTCARDEx_EnableReceiverTimeOut(SMARTCARD_HandleTypeDef *hsc) |
<> | 144:ef7eb2e8f9f7 | 127 | { |
<> | 144:ef7eb2e8f9f7 | 128 | /* Process Locked */ |
<> | 144:ef7eb2e8f9f7 | 129 | __HAL_LOCK(hsc); |
<> | 144:ef7eb2e8f9f7 | 130 | |
<> | 144:ef7eb2e8f9f7 | 131 | hsc->gState = HAL_SMARTCARD_STATE_BUSY; |
<> | 144:ef7eb2e8f9f7 | 132 | |
<> | 144:ef7eb2e8f9f7 | 133 | /* Set the USART RTOEN bit */ |
<> | 144:ef7eb2e8f9f7 | 134 | hsc->Instance->CR2 |= USART_CR2_RTOEN; |
<> | 144:ef7eb2e8f9f7 | 135 | |
<> | 144:ef7eb2e8f9f7 | 136 | hsc->gState = HAL_SMARTCARD_STATE_READY; |
<> | 144:ef7eb2e8f9f7 | 137 | |
<> | 144:ef7eb2e8f9f7 | 138 | /* Process Unlocked */ |
<> | 144:ef7eb2e8f9f7 | 139 | __HAL_UNLOCK(hsc); |
<> | 144:ef7eb2e8f9f7 | 140 | |
<> | 144:ef7eb2e8f9f7 | 141 | return HAL_OK; |
<> | 144:ef7eb2e8f9f7 | 142 | } |
<> | 144:ef7eb2e8f9f7 | 143 | |
<> | 144:ef7eb2e8f9f7 | 144 | /** |
<> | 144:ef7eb2e8f9f7 | 145 | * @brief Disable the SMARTCARD receiver timeout feature |
<> | 144:ef7eb2e8f9f7 | 146 | * @param hsc: SMARTCARD handle |
<> | 144:ef7eb2e8f9f7 | 147 | * @retval HAL status |
<> | 144:ef7eb2e8f9f7 | 148 | */ |
<> | 144:ef7eb2e8f9f7 | 149 | HAL_StatusTypeDef HAL_SMARTCARDEx_DisableReceiverTimeOut(SMARTCARD_HandleTypeDef *hsc) |
<> | 144:ef7eb2e8f9f7 | 150 | { |
<> | 144:ef7eb2e8f9f7 | 151 | /* Process Locked */ |
<> | 144:ef7eb2e8f9f7 | 152 | __HAL_LOCK(hsc); |
<> | 144:ef7eb2e8f9f7 | 153 | |
<> | 144:ef7eb2e8f9f7 | 154 | hsc->gState = HAL_SMARTCARD_STATE_BUSY; |
<> | 144:ef7eb2e8f9f7 | 155 | |
<> | 144:ef7eb2e8f9f7 | 156 | /* Clear the USART RTOEN bit */ |
<> | 144:ef7eb2e8f9f7 | 157 | hsc->Instance->CR2 &= ~(USART_CR2_RTOEN); |
<> | 144:ef7eb2e8f9f7 | 158 | |
<> | 144:ef7eb2e8f9f7 | 159 | hsc->gState = HAL_SMARTCARD_STATE_READY; |
<> | 144:ef7eb2e8f9f7 | 160 | |
<> | 144:ef7eb2e8f9f7 | 161 | /* Process Unlocked */ |
<> | 144:ef7eb2e8f9f7 | 162 | __HAL_UNLOCK(hsc); |
<> | 144:ef7eb2e8f9f7 | 163 | |
<> | 144:ef7eb2e8f9f7 | 164 | return HAL_OK; |
<> | 144:ef7eb2e8f9f7 | 165 | } |
<> | 144:ef7eb2e8f9f7 | 166 | |
<> | 144:ef7eb2e8f9f7 | 167 | /** |
<> | 144:ef7eb2e8f9f7 | 168 | * @} |
<> | 144:ef7eb2e8f9f7 | 169 | */ |
<> | 144:ef7eb2e8f9f7 | 170 | |
<> | 144:ef7eb2e8f9f7 | 171 | /** |
<> | 144:ef7eb2e8f9f7 | 172 | * @} |
<> | 144:ef7eb2e8f9f7 | 173 | */ |
<> | 144:ef7eb2e8f9f7 | 174 | |
<> | 144:ef7eb2e8f9f7 | 175 | #endif /* HAL_SMARTCARD_MODULE_ENABLED */ |
<> | 144:ef7eb2e8f9f7 | 176 | /** |
<> | 144:ef7eb2e8f9f7 | 177 | * @} |
<> | 144:ef7eb2e8f9f7 | 178 | */ |
<> | 144:ef7eb2e8f9f7 | 179 | |
<> | 144:ef7eb2e8f9f7 | 180 | /** |
<> | 144:ef7eb2e8f9f7 | 181 | * @} |
<> | 144:ef7eb2e8f9f7 | 182 | */ |
<> | 144:ef7eb2e8f9f7 | 183 | |
<> | 144:ef7eb2e8f9f7 | 184 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |