]> git.donarmstrong.com Git - qmk_firmware.git/blob - tool/mbed/mbed-sdk/libraries/mbed/targets/cmsis/TARGET_STM/TARGET_STM32F0/stm32f0xx_hal_smartcard_ex.h
Squashed 'tmk_core/' changes from 7967731..b9e0ea0
[qmk_firmware.git] / tool / mbed / mbed-sdk / libraries / mbed / targets / cmsis / TARGET_STM / TARGET_STM32F0 / stm32f0xx_hal_smartcard_ex.h
1 /**
2   ******************************************************************************
3   * @file    stm32f0xx_hal_smartcard_ex.h
4   * @author  MCD Application Team
5   * @version V1.2.0
6   * @date    11-December-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 __STM32F0xx_HAL_SMARTCARD_EX_H
40 #define __STM32F0xx_HAL_SMARTCARD_EX_H
41
42 #ifdef __cplusplus
43  extern "C" {
44 #endif
45
46 #if !defined(STM32F030x6) && !defined(STM32F030x8) && !defined(STM32F070x6) && !defined(STM32F070xB) && !defined(STM32F030xC) 
47
48 /* Includes ------------------------------------------------------------------*/
49 #include "stm32f0xx_hal_def.h"
50
51 /** @addtogroup STM32F0xx_HAL_Driver
52   * @{
53   */
54
55 /** @addtogroup SMARTCARDEx
56   * @{
57   */ 
58
59 /* Exported types ------------------------------------------------------------*/ 
60 /* Exported constants --------------------------------------------------------*/
61 /* Exported macro ------------------------------------------------------------*/
62
63 /** @defgroup SMARTCARD_Extended_Exported_Macros SMARTCARDEx Exported Macros
64   * @{
65   */
66
67 /** @brief  Reports the SMARTCARD clock source.
68   * @param  __HANDLE__: specifies the SMARTCARD Handle
69   * @param  __CLOCKSOURCE__ : output variable   
70   * @retval the SMARTCARD clocking source, written in __CLOCKSOURCE__.
71   */
72 #if defined(STM32F031x6) || defined(STM32F038xx)
73 #define __HAL_SMARTCARD_GETCLOCKSOURCE(__HANDLE__,__CLOCKSOURCE__) \
74   do {                                                             \
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       default:                                                     \
90         (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_UNDEFINED;       \
91         break;                                                     \
92      }                                                             \
93   } while(0)
94 #elif defined (STM32F030x8) ||                                     \
95       defined (STM32F042x6) || defined (STM32F048xx) ||            \
96       defined (STM32F051x8) || defined (STM32F058xx)
97 #define __HAL_SMARTCARD_GETCLOCKSOURCE(__HANDLE__,__CLOCKSOURCE__) \
98   do {                                                             \
99     if((__HANDLE__)->Instance == USART1)                           \
100     {                                                              \
101        switch(__HAL_RCC_GET_USART1_SOURCE())                       \
102        {                                                           \
103         case RCC_USART1CLKSOURCE_PCLK1:                            \
104           (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_PCLK1;         \
105           break;                                                   \
106         case RCC_USART1CLKSOURCE_HSI:                              \
107           (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_HSI;           \
108           break;                                                   \
109         case RCC_USART1CLKSOURCE_SYSCLK:                           \
110           (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_SYSCLK;        \
111           break;                                                   \
112         case RCC_USART1CLKSOURCE_LSE:                              \
113           (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_LSE;           \
114           break;                                                   \
115         default:                                                   \
116           (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_UNDEFINED;     \
117           break;                                                   \
118        }                                                           \
119     }                                                              \
120     else if((__HANDLE__)->Instance == USART2)                      \
121     {                                                              \
122       (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_PCLK1;             \
123     }                                                              \
124     else                                                           \
125     {                                                              \
126       (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_UNDEFINED;         \
127     }                                                              \
128   } while(0) 
129 #elif defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx)   
130 #define __HAL_SMARTCARD_GETCLOCKSOURCE(__HANDLE__,__CLOCKSOURCE__) \
131   do {                                                             \
132     if((__HANDLE__)->Instance == USART1)                           \
133     {                                                              \
134        switch(__HAL_RCC_GET_USART1_SOURCE())                       \
135        {                                                           \
136         case RCC_USART1CLKSOURCE_PCLK1:                            \
137           (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_PCLK1;         \
138           break;                                                   \
139         case RCC_USART1CLKSOURCE_HSI:                              \
140           (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_HSI;           \
141           break;                                                   \
142         case RCC_USART1CLKSOURCE_SYSCLK:                           \
143           (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_SYSCLK;        \
144           break;                                                   \
145         case RCC_USART1CLKSOURCE_LSE:                              \
146           (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_LSE;           \
147           break;                                                   \
148         default:                                                   \
149           (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_UNDEFINED;     \
150           break;                                                   \
151        }                                                           \
152     }                                                              \
153     else if((__HANDLE__)->Instance == USART2)                      \
154     {                                                              \
155        switch(__HAL_RCC_GET_USART2_SOURCE())                       \
156        {                                                           \
157         case RCC_USART2CLKSOURCE_PCLK1:                            \
158           (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_PCLK1;         \
159           break;                                                   \
160         case RCC_USART2CLKSOURCE_HSI:                              \
161           (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_HSI;           \
162           break;                                                   \
163         case RCC_USART2CLKSOURCE_SYSCLK:                           \
164           (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_SYSCLK;        \
165           break;                                                   \
166         case RCC_USART2CLKSOURCE_LSE:                              \
167           (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_LSE;           \
168           break;                                                   \
169         default:                                                   \
170           (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_UNDEFINED;     \
171           break;                                                   \
172        }                                                           \
173     }                                                              \
174     else if((__HANDLE__)->Instance == USART3)                      \
175     {                                                              \
176       (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_PCLK1;             \
177     }                                                              \
178     else if((__HANDLE__)->Instance == USART4)                      \
179     {                                                              \
180       (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_PCLK1;             \
181     }                                                              \
182     else                                                           \
183     {                                                              \
184       (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_UNDEFINED;         \
185     }                                                              \
186   } while(0) 
187 #elif defined(STM32F091xC) || defined(STM32F098xx) 
188 #define __HAL_SMARTCARD_GETCLOCKSOURCE(__HANDLE__,__CLOCKSOURCE__) \
189   do {                                                             \
190     if((__HANDLE__)->Instance == USART1)                           \
191     {                                                              \
192        switch(__HAL_RCC_GET_USART1_SOURCE())                       \
193        {                                                           \
194         case RCC_USART1CLKSOURCE_PCLK1:                            \
195           (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_PCLK1;         \
196           break;                                                   \
197         case RCC_USART1CLKSOURCE_HSI:                              \
198           (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_HSI;           \
199           break;                                                   \
200         case RCC_USART1CLKSOURCE_SYSCLK:                           \
201           (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_SYSCLK;        \
202           break;                                                   \
203         case RCC_USART1CLKSOURCE_LSE:                              \
204           (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_LSE;           \
205           break;                                                   \
206         default:                                                   \
207           (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_UNDEFINED;     \
208           break;                                                   \
209        }                                                           \
210     }                                                              \
211     else if((__HANDLE__)->Instance == USART2)                      \
212     {                                                              \
213        switch(__HAL_RCC_GET_USART2_SOURCE())                       \
214        {                                                           \
215         case RCC_USART2CLKSOURCE_PCLK1:                            \
216           (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_PCLK1;         \
217           break;                                                   \
218         case RCC_USART2CLKSOURCE_HSI:                              \
219           (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_HSI;           \
220           break;                                                   \
221         case RCC_USART2CLKSOURCE_SYSCLK:                           \
222           (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_SYSCLK;        \
223           break;                                                   \
224         case RCC_USART2CLKSOURCE_LSE:                              \
225           (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_LSE;           \
226           break;                                                   \
227         default:                                                   \
228           (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_UNDEFINED;     \
229           break;                                                   \
230        }                                                           \
231     }                                                              \
232     else if((__HANDLE__)->Instance == USART3)                      \
233     {                                                              \
234        switch(__HAL_RCC_GET_USART3_SOURCE())                       \
235        {                                                           \
236         case RCC_USART3CLKSOURCE_PCLK1:                            \
237           (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_PCLK1;         \
238           break;                                                   \
239         case RCC_USART3CLKSOURCE_HSI:                              \
240           (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_HSI;           \
241           break;                                                   \
242         case RCC_USART3CLKSOURCE_SYSCLK:                           \
243           (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_SYSCLK;        \
244           break;                                                   \
245         case RCC_USART3CLKSOURCE_LSE:                              \
246           (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_LSE;           \
247           break;                                                   \
248         default:                                                   \
249           (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_UNDEFINED;     \
250           break;                                                   \
251        }                                                           \
252     }                                                              \
253     else if((__HANDLE__)->Instance == USART4)                      \
254     {                                                              \
255       (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_PCLK1;             \
256     }                                                              \
257     else if((__HANDLE__)->Instance == USART5)                      \
258     {                                                              \
259       (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_PCLK1;             \
260     }                                                              \
261     else if((__HANDLE__)->Instance == USART6)                      \
262     {                                                              \
263       (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_PCLK1;             \
264     }                                                              \
265     else if((__HANDLE__)->Instance == USART7)                      \
266     {                                                              \
267       (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_PCLK1;             \
268     }                                                              \
269     else if((__HANDLE__)->Instance == USART8)                      \
270     {                                                              \
271       (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_PCLK1;             \
272     }                                                              \
273     else                                                           \
274     {                                                              \
275       (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_UNDEFINED;         \
276     }                                                              \
277   } while(0)      
278 #endif /* defined(STM32F031x6) || defined(STM32F038xx) */
279
280 /**
281   * @}
282   */                                
283
284 /* Exported functions --------------------------------------------------------*/
285
286 /* Initialization and de-initialization functions  ****************************/
287 /* IO operation functions *****************************************************/
288
289 /** @addtogroup SMARTCARDEx_Exported_Functions
290   * @{
291   */
292
293 /** @addtogroup SMARTCARDEx_Exported_Functions_Group1
294   * @{
295   */
296   
297 /* Peripheral Control functions ***********************************************/
298 void HAL_SMARTCARDEx_BlockLength_Config(SMARTCARD_HandleTypeDef *hsmartcard, uint8_t BlockLength);
299 void HAL_SMARTCARDEx_TimeOut_Config(SMARTCARD_HandleTypeDef *hsmartcard, uint32_t TimeOutValue);
300 HAL_StatusTypeDef HAL_SMARTCARDEx_EnableReceiverTimeOut(SMARTCARD_HandleTypeDef *hsmartcard);
301 HAL_StatusTypeDef HAL_SMARTCARDEx_DisableReceiverTimeOut(SMARTCARD_HandleTypeDef *hsmartcard);
302
303 /* Peripheral State and Error functions ***************************************/
304
305 /**
306   * @}
307   */ 
308
309 /**
310   * @}
311   */
312
313 /**
314   * @}
315   */ 
316
317 /**
318   * @}
319   */
320
321 #endif /* !defined(STM32F030x6) && !defined(STM32F030x8)&& !defined(STM32F070x6) && !defined(STM32F070xB) && !defined(STM32F030xC)  */  
322   
323 #ifdef __cplusplus
324 }
325 #endif
326
327 #endif /* __STM32F0xx_HAL_SMARTCARD_EX_H */
328
329 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
330