]> git.friedersdorff.com Git - max/tmk_keyboard.git/blob - tmk_core/tool/mbed/mbed-sdk/libraries/mbed/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_smartcard_ex.h
Merge commit '4d116a04e94cf0d19317d5b44e4fa9f34a3e5594'
[max/tmk_keyboard.git] / tmk_core / tool / mbed / mbed-sdk / libraries / mbed / targets / cmsis / TARGET_STM / TARGET_STM32F3 / stm32f3xx_hal_smartcard_ex.h
1 /**
2   ******************************************************************************
3   * @file    stm32f3xx_hal_smartcard_ex.h
4   * @author  MCD Application Team
5   * @version V1.1.0
6   * @date    12-Sept-2014
7   * @brief   Header file of SMARTCARD HAL module.
8   ******************************************************************************
9   * @attention
10   *
11   * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
12   *
13   * Redistribution and use in source and binary forms, with or without modification,
14   * are permitted provided that the following conditions are met:
15   *   1. Redistributions of source code must retain the above copyright notice,
16   *      this list of conditions and the following disclaimer.
17   *   2. Redistributions in binary form must reproduce the above copyright notice,
18   *      this list of conditions and the following disclaimer in the documentation
19   *      and/or other materials provided with the distribution.
20   *   3. Neither the name of STMicroelectronics nor the names of its contributors
21   *      may be used to endorse or promote products derived from this software
22   *      without specific prior written permission.
23   *
24   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25   * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26   * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
27   * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
28   * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29   * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
30   * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
31   * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
32   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33   * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34   *
35   ******************************************************************************  
36   */
37
38 /* Define to prevent recursive inclusion -------------------------------------*/
39 #ifndef __STM32F3xx_HAL_SMARTCARD_EX_H
40 #define __STM32F3xx_HAL_SMARTCARD_EX_H
41
42 #ifdef __cplusplus
43  extern "C" {
44 #endif
45
46 /* Includes ------------------------------------------------------------------*/
47 #include "stm32f3xx_hal_def.h"
48
49 /** @addtogroup STM32F3xx_HAL_Driver
50   * @{
51   */
52
53 /** @addtogroup SMARTCARDEx SMARTCARD Extended HAL module driver
54   * @{
55   */ 
56
57 /* Exported types ------------------------------------------------------------*/ 
58 /* Exported constants --------------------------------------------------------*/    
59 /* Exported macro ------------------------------------------------------------*/
60
61 /** @defgroup SMARTCARDEx_Exported_Macros SMARTCARD Extended Exported Macros
62   * @{
63   */
64
65 /** @brief  Reports the SMARTCARD clock source.
66   * @param  __HANDLE__: specifies the SMARTCARD Handle
67   * @param  __CLOCKSOURCE__ : output variable   
68   * @retval the SMARTCARD clocking source, written in __CLOCKSOURCE__.
69   */
70 #if defined(STM32F334x8) || defined(STM32F303x8) || defined(STM32F328xx)
71 #define __HAL_SMARTCARD_GETCLOCKSOURCE(__HANDLE__,__CLOCKSOURCE__) \
72   do {                                                         \
73     if((__HANDLE__)->Instance == USART1)                       \
74     {                                                          \
75        switch(__HAL_RCC_GET_USART1_SOURCE())                   \
76        {                                                       \
77         case RCC_USART1CLKSOURCE_PCLK1:                        \
78           (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_PCLK1;     \
79           break;                                               \
80         case RCC_USART1CLKSOURCE_HSI:                          \
81           (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_HSI;       \
82           break;                                               \
83         case RCC_USART1CLKSOURCE_SYSCLK:                       \
84           (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_SYSCLK;    \
85           break;                                               \
86         case RCC_USART1CLKSOURCE_LSE:                          \
87           (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_LSE;       \
88           break;                                               \
89        }                                                       \
90     }                                                          \
91     else if((__HANDLE__)->Instance == USART2)                  \
92     {                                                          \
93        switch(__HAL_RCC_GET_USART2_SOURCE())                   \
94        {                                                       \
95         case RCC_USART2CLKSOURCE_PCLK1:                        \
96           (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_PCLK1;     \
97           break;                                               \
98         case RCC_USART2CLKSOURCE_HSI:                          \
99           (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_HSI;       \
100           break;                                               \
101         case RCC_USART2CLKSOURCE_SYSCLK:                       \
102           (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_SYSCLK;    \
103           break;                                               \
104         case RCC_USART2CLKSOURCE_LSE:                          \
105           (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_LSE;       \
106           break;                                               \
107        }                                                       \
108     }                                                          \
109     else if((__HANDLE__)->Instance == USART3)                  \
110     {                                                          \
111        switch(__HAL_RCC_GET_USART3_SOURCE())                   \
112        {                                                       \
113         case RCC_USART3CLKSOURCE_PCLK1:                        \
114           (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_PCLK1;     \
115           break;                                               \
116         case RCC_USART3CLKSOURCE_HSI:                          \
117           (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_HSI;       \
118           break;                                               \
119         case RCC_USART3CLKSOURCE_SYSCLK:                       \
120           (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_SYSCLK;    \
121           break;                                               \
122         case RCC_USART3CLKSOURCE_LSE:                          \
123           (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_LSE;       \
124           break;                                               \
125        }                                                       \
126     }                                                          \
127   } while(0)
128 #else  
129 #define __HAL_SMARTCARD_GETCLOCKSOURCE(__HANDLE__,__CLOCKSOURCE__) \
130   do {                                                         \
131     if((__HANDLE__)->Instance == USART1)                       \
132     {                                                          \
133        switch(__HAL_RCC_GET_USART1_SOURCE())                   \
134        {                                                       \
135         case RCC_USART1CLKSOURCE_PCLK2:                        \
136           (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_PCLK2;     \
137           break;                                               \
138         case RCC_USART1CLKSOURCE_HSI:                          \
139           (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_HSI;       \
140           break;                                               \
141         case RCC_USART1CLKSOURCE_SYSCLK:                       \
142           (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_SYSCLK;    \
143           break;                                               \
144         case RCC_USART1CLKSOURCE_LSE:                          \
145           (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_LSE;       \
146           break;                                               \
147        }                                                       \
148     }                                                          \
149     else if((__HANDLE__)->Instance == USART2)                  \
150     {                                                          \
151        switch(__HAL_RCC_GET_USART2_SOURCE())                   \
152        {                                                       \
153         case RCC_USART2CLKSOURCE_PCLK1:                        \
154           (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_PCLK1;     \
155           break;                                               \
156         case RCC_USART2CLKSOURCE_HSI:                          \
157           (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_HSI;       \
158           break;                                               \
159         case RCC_USART2CLKSOURCE_SYSCLK:                       \
160           (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_SYSCLK;    \
161           break;                                               \
162         case RCC_USART2CLKSOURCE_LSE:                          \
163           (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_LSE;       \
164           break;                                               \
165        }                                                       \
166     }                                                          \
167     else if((__HANDLE__)->Instance == USART3)                  \
168     {                                                          \
169        switch(__HAL_RCC_GET_USART3_SOURCE())                   \
170        {                                                       \
171         case RCC_USART3CLKSOURCE_PCLK1:                        \
172           (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_PCLK1;     \
173           break;                                               \
174         case RCC_USART3CLKSOURCE_HSI:                          \
175           (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_HSI;       \
176           break;                                               \
177         case RCC_USART3CLKSOURCE_SYSCLK:                       \
178           (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_SYSCLK;    \
179           break;                                               \
180         case RCC_USART3CLKSOURCE_LSE:                          \
181           (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_LSE;       \
182           break;                                               \
183        }                                                       \
184     }                                                          \
185   } while(0)
186 #endif
187
188 /**
189   * @}
190   */ 
191
192
193 /* Exported functions --------------------------------------------------------*/
194 /** @addtogroup SMARTCARDEx_Exported_Functions SMARTCARD Extended Exported Functions
195   * @{
196   */
197
198 /* Initialization and de-initialization functions  ****************************/
199 /* IO operation functions *****************************************************/
200 /* Peripheral Control functions ***********************************************/
201 /** @addtogroup SMARTCARDEx_Exported_Functions_Group1 Extended Peripheral Control functions
202   * @{
203   */
204 void HAL_SMARTCARDEx_BlockLength_Config(SMARTCARD_HandleTypeDef *hsmartcard, uint8_t BlockLength);
205 void HAL_SMARTCARDEx_TimeOut_Config(SMARTCARD_HandleTypeDef *hsmartcard, uint32_t TimeOutValue);
206 HAL_StatusTypeDef HAL_SMARTCARDEx_EnableReceiverTimeOut(SMARTCARD_HandleTypeDef *hsmartcard);
207 HAL_StatusTypeDef HAL_SMARTCARDEx_DisableReceiverTimeOut(SMARTCARD_HandleTypeDef *hsmartcard);
208
209 /* Peripheral State and Error functions ***************************************/
210
211 /**
212   * @}
213   */ 
214
215 /**
216   * @}
217   */ 
218
219 /**
220   * @}
221   */ 
222
223 /**
224   * @}
225   */
226   
227 #ifdef __cplusplus
228 }
229 #endif
230
231 #endif /* __STM32F3xx_HAL_SMARTCARD_EX_H */
232
233 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/