]> git.donarmstrong.com Git - qmk_firmware.git/blob - tool/mbed/mbed-sdk/libraries/mbed/targets/cmsis/TARGET_STM/TARGET_STM32F4/stm32f4xx_hal_usart.h
Squashed 'tmk_core/' changes from 7967731..b9e0ea0
[qmk_firmware.git] / tool / mbed / mbed-sdk / libraries / mbed / targets / cmsis / TARGET_STM / TARGET_STM32F4 / stm32f4xx_hal_usart.h
1 /**
2   ******************************************************************************
3   * @file    stm32f4xx_hal_usart.h
4   * @author  MCD Application Team
5   * @version V1.1.0
6   * @date    19-June-2014
7   * @brief   Header file of USART 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 __STM32F4xx_HAL_USART_H
40 #define __STM32F4xx_HAL_USART_H
41
42 #ifdef __cplusplus
43  extern "C" {
44 #endif
45
46 /* Includes ------------------------------------------------------------------*/
47 #include "stm32f4xx_hal_def.h"
48
49 /** @addtogroup STM32F4xx_HAL_Driver
50   * @{
51   */
52
53 /** @addtogroup USART
54   * @{
55   */ 
56
57 /* Exported types ------------------------------------------------------------*/ 
58 /** 
59   * @brief USART Init Structure definition  
60   */ 
61 typedef struct
62 {
63   uint32_t BaudRate;                  /*!< This member configures the Usart communication baud rate.
64                                            The baud rate is computed using the following formula:
65                                            - IntegerDivider = ((PCLKx) / (8 * (husart->Init.BaudRate)))
66                                            - FractionalDivider = ((IntegerDivider - ((uint32_t) IntegerDivider)) * 8) + 0.5 */
67
68   uint32_t WordLength;                /*!< Specifies the number of data bits transmitted or received in a frame.
69                                            This parameter can be a value of @ref USART_Word_Length */
70
71   uint32_t StopBits;                  /*!< Specifies the number of stop bits transmitted.
72                                            This parameter can be a value of @ref USART_Stop_Bits */
73
74   uint32_t Parity;                   /*!< Specifies the parity mode.
75                                            This parameter can be a value of @ref USART_Parity
76                                            @note When parity is enabled, the computed parity is inserted
77                                                  at the MSB position of the transmitted data (9th bit when
78                                                  the word length is set to 9 data bits; 8th bit when the
79                                                  word length is set to 8 data bits). */
80  
81   uint32_t Mode;                      /*!< Specifies wether the Receive or Transmit mode is enabled or disabled.
82                                            This parameter can be a value of @ref USART_Mode */
83
84   uint32_t CLKPolarity;               /*!< Specifies the steady state of the serial clock.
85                                            This parameter can be a value of @ref USART_Clock_Polarity */
86
87   uint32_t CLKPhase;                  /*!< Specifies the clock transition on which the bit capture is made.
88                                            This parameter can be a value of @ref USART_Clock_Phase */
89
90   uint32_t CLKLastBit;                /*!< Specifies whether the clock pulse corresponding to the last transmitted
91                                            data bit (MSB) has to be output on the SCLK pin in synchronous mode.
92                                            This parameter can be a value of @ref USART_Last_Bit */
93 }USART_InitTypeDef;
94
95 /** 
96   * @brief HAL State structures definition  
97   */ 
98 typedef enum
99 {
100   HAL_USART_STATE_RESET             = 0x00,    /*!< Peripheral is not yet Initialized   */
101   HAL_USART_STATE_READY             = 0x01,    /*!< Peripheral Initialized and ready for use */
102   HAL_USART_STATE_BUSY              = 0x02,    /*!< an internal process is ongoing */   
103   HAL_USART_STATE_BUSY_TX           = 0x12,    /*!< Data Transmission process is ongoing */ 
104   HAL_USART_STATE_BUSY_RX           = 0x22,    /*!< Data Reception process is ongoing */
105   HAL_USART_STATE_BUSY_TX_RX        = 0x32,    /*!< Data Transmission Reception process is ongoing */
106   HAL_USART_STATE_TIMEOUT           = 0x03,    /*!< Timeout state */
107   HAL_USART_STATE_ERROR             = 0x04     /*!< Error */      
108 }HAL_USART_StateTypeDef;
109
110 /** 
111   * @brief  HAL USART Error Code structure definition  
112   */ 
113 typedef enum
114 {
115   HAL_USART_ERROR_NONE      = 0x00,    /*!< No error            */
116   HAL_USART_ERROR_PE        = 0x01,    /*!< Parity error        */
117   HAL_USART_ERROR_NE        = 0x02,    /*!< Noise error         */
118   HAL_USART_ERROR_FE        = 0x04,    /*!< frame error         */
119   HAL_USART_ERROR_ORE       = 0x08,    /*!< Overrun error       */
120   HAL_USART_ERROR_DMA       = 0x10     /*!< DMA transfer error  */
121 }HAL_USART_ErrorTypeDef;
122
123 /** 
124   * @brief  USART handle Structure definition  
125   */  
126 typedef struct
127 {
128   USART_TypeDef                 *Instance;        /* USART registers base address        */
129   
130   USART_InitTypeDef             Init;             /* Usart communication parameters      */
131   
132   uint8_t                       *pTxBuffPtr;      /* Pointer to Usart Tx transfer Buffer */
133   
134   uint16_t                      TxXferSize;       /* Usart Tx Transfer size              */
135   
136   __IO uint16_t                 TxXferCount;      /* Usart Tx Transfer Counter           */
137   
138   uint8_t                       *pRxBuffPtr;      /* Pointer to Usart Rx transfer Buffer */
139   
140   uint16_t                      RxXferSize;       /* Usart Rx Transfer size              */
141   
142   __IO uint16_t                 RxXferCount;      /* Usart Rx Transfer Counter           */  
143   
144   DMA_HandleTypeDef             *hdmatx;          /* Usart Tx DMA Handle parameters      */
145     
146   DMA_HandleTypeDef             *hdmarx;          /* Usart Rx DMA Handle parameters      */
147   
148   HAL_LockTypeDef                Lock;            /* Locking object                      */
149   
150   __IO HAL_USART_StateTypeDef    State;           /* Usart communication state           */
151   
152   __IO HAL_USART_ErrorTypeDef    ErrorCode;        /* USART Error code                    */
153   
154 }USART_HandleTypeDef;
155
156
157 /* Exported constants --------------------------------------------------------*/
158 /** @defgroup USART_Exported_Constants
159   * @{
160   */
161
162 /** @defgroup USART_Word_Length 
163   * @{
164   */
165 #define USART_WORDLENGTH_8B                  ((uint32_t)0x00000000)
166 #define USART_WORDLENGTH_9B                  ((uint32_t)USART_CR1_M)
167 #define IS_USART_WORD_LENGTH(LENGTH) (((LENGTH) == USART_WORDLENGTH_8B) || \
168                                           ((LENGTH) == USART_WORDLENGTH_9B))
169 /**
170   * @}
171   */
172
173 /** @defgroup USART_Stop_Bits 
174   * @{
175   */
176 #define USART_STOPBITS_1                     ((uint32_t)0x00000000)
177 #define USART_STOPBITS_0_5                   ((uint32_t)USART_CR2_STOP_0)
178 #define USART_STOPBITS_2                     ((uint32_t)USART_CR2_STOP_1)
179 #define USART_STOPBITS_1_5                   ((uint32_t)(USART_CR2_STOP_0 | USART_CR2_STOP_1))
180 #define IS_USART_STOPBITS(STOPBITS) (((STOPBITS) == USART_STOPBITS_1) || \
181                                          ((STOPBITS) == USART_STOPBITS_0_5) || \
182                                          ((STOPBITS) == USART_STOPBITS_1_5) || \
183                                          ((STOPBITS) == USART_STOPBITS_2))
184 /**
185   * @}
186   */ 
187
188 /** @defgroup USART_Parity 
189   * @{
190   */ 
191 #define USART_PARITY_NONE                    ((uint32_t)0x00000000)
192 #define USART_PARITY_EVEN                    ((uint32_t)USART_CR1_PCE)
193 #define USART_PARITY_ODD                     ((uint32_t)(USART_CR1_PCE | USART_CR1_PS)) 
194 #define IS_USART_PARITY(PARITY) (((PARITY) == USART_PARITY_NONE) || \
195                                      ((PARITY) == USART_PARITY_EVEN) || \
196                                      ((PARITY) == USART_PARITY_ODD))
197 /**
198   * @}
199   */ 
200
201 /** @defgroup USART_Mode 
202   * @{
203   */ 
204 #define USART_MODE_RX                        ((uint32_t)USART_CR1_RE)
205 #define USART_MODE_TX                        ((uint32_t)USART_CR1_TE)
206 #define USART_MODE_TX_RX                     ((uint32_t)(USART_CR1_TE |USART_CR1_RE))
207 #define IS_USART_MODE(MODE) ((((MODE) & (uint32_t)0xFFF3) == 0x00) && ((MODE) != (uint32_t)0x00))
208 /**
209   * @}
210   */
211     
212 /** @defgroup USART_Clock 
213   * @{
214   */ 
215 #define USART_CLOCK_DISABLED                 ((uint32_t)0x00000000)
216 #define USART_CLOCK_ENABLED                  ((uint32_t)USART_CR2_CLKEN)
217 #define IS_USART_CLOCK(CLOCK) (((CLOCK) == USART_CLOCK_DISABLED) || \
218                                    ((CLOCK) == USART_CLOCK_ENABLED))
219 /**
220   * @}
221   */ 
222
223 /** @defgroup USART_Clock_Polarity 
224   * @{
225   */
226 #define USART_POLARITY_LOW                   ((uint32_t)0x00000000)
227 #define USART_POLARITY_HIGH                  ((uint32_t)USART_CR2_CPOL)
228 #define IS_USART_POLARITY(CPOL) (((CPOL) == USART_POLARITY_LOW) || ((CPOL) == USART_POLARITY_HIGH))
229 /**
230   * @}
231   */ 
232
233 /** @defgroup USART_Clock_Phase
234   * @{
235   */
236 #define USART_PHASE_1EDGE                    ((uint32_t)0x00000000)
237 #define USART_PHASE_2EDGE                    ((uint32_t)USART_CR2_CPHA)
238 #define IS_USART_PHASE(CPHA) (((CPHA) == USART_PHASE_1EDGE) || ((CPHA) == USART_PHASE_2EDGE))
239 /**
240   * @}
241   */
242
243 /** @defgroup USART_Last_Bit
244   * @{
245   */
246 #define USART_LASTBIT_DISABLE                ((uint32_t)0x00000000)
247 #define USART_LASTBIT_ENABLE                 ((uint32_t)USART_CR2_LBCL)
248 #define IS_USART_LASTBIT(LASTBIT) (((LASTBIT) == USART_LASTBIT_DISABLE) || \
249                                        ((LASTBIT) == USART_LASTBIT_ENABLE))
250 /**
251   * @}
252   */
253
254 /** @defgroup USART_NACK_State 
255   * @{
256   */
257 #define USARTNACK_ENABLED           ((uint32_t)USART_CR3_NACK)
258 #define USARTNACK_DISABLED          ((uint32_t)0x00000000)
259 #define IS_USART_NACK_STATE(NACK) (((NACK) == USARTNACK_ENABLED) || \
260                                        ((NACK) == USARTNACK_DISABLED))
261 /**
262   * @}
263   */
264
265 /** @defgroup USART_Flags 
266   *        Elements values convention: 0xXXXX
267   *           - 0xXXXX  : Flag mask in the SR register
268   * @{
269   */
270
271 #define USART_FLAG_TXE                       ((uint32_t)0x00000080)
272 #define USART_FLAG_TC                        ((uint32_t)0x00000040)
273 #define USART_FLAG_RXNE                      ((uint32_t)0x00000020)
274 #define USART_FLAG_IDLE                      ((uint32_t)0x00000010)
275 #define USART_FLAG_ORE                       ((uint32_t)0x00000008)
276 #define USART_FLAG_NE                        ((uint32_t)0x00000004)
277 #define USART_FLAG_FE                        ((uint32_t)0x00000002)
278 #define USART_FLAG_PE                        ((uint32_t)0x00000001)
279 /**
280   * @}
281   */
282
283 /** @defgroup USART_Interrupt_definition 
284   *        Elements values convention: 0xY000XXXX
285   *           - XXXX  : Interrupt mask in the XX register
286   *           - Y  : Interrupt source register (2bits)
287   *                 - 01: CR1 register
288   *                 - 10: CR2 register
289   *                 - 11: CR3 register
290   *
291   * @{
292   */  
293 #define USART_IT_PE                          ((uint32_t)0x10000100)
294 #define USART_IT_TXE                         ((uint32_t)0x10000080)
295 #define USART_IT_TC                          ((uint32_t)0x10000040)
296 #define USART_IT_RXNE                        ((uint32_t)0x10000020)
297 #define USART_IT_IDLE                        ((uint32_t)0x10000010)
298
299 #define USART_IT_LBD                         ((uint32_t)0x20000040)
300 #define USART_IT_CTS                         ((uint32_t)0x30000400)
301
302 #define USART_IT_ERR                         ((uint32_t)0x30000001)
303
304
305 /**
306   * @}
307   */
308
309 /**
310   * @}
311   */
312   
313 /* Exported macro ------------------------------------------------------------*/
314 /** @brief Reset USART handle state
315   * @param  __HANDLE__: specifies the USART Handle.
316   *         This parameter can be USARTx where x: 1, 2, 3 or 6 to select the USART peripheral.
317   * @retval None
318   */
319 #define __HAL_USART_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_USART_STATE_RESET)
320
321 /** @brief  Checks whether the specified Smartcard flag is set or not.
322   * @param  __HANDLE__: specifies the USART Handle.
323   *         This parameter can be USARTx where x: 1, 2, 3 or 6 to select the USART peripheral.
324   * @param  __FLAG__: specifies the flag to check.
325   *        This parameter can be one of the following values:
326   *            @arg USART_FLAG_TXE:  Transmit data register empty flag
327   *            @arg USART_FLAG_TC:   Transmission Complete flag
328   *            @arg USART_FLAG_RXNE: Receive data register not empty flag
329   *            @arg USART_FLAG_IDLE: Idle Line detection flag
330   *            @arg USART_FLAG_ORE:  OverRun Error flag
331   *            @arg USART_FLAG_NE:   Noise Error flag
332   *            @arg USART_FLAG_FE:   Framing Error flag
333   *            @arg USART_FLAG_PE:   Parity Error flag
334   * @retval The new state of __FLAG__ (TRUE or FALSE).
335   */
336
337 #define __HAL_USART_GET_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->SR & (__FLAG__)) == (__FLAG__))
338
339 /** @brief  Clears the specified Smartcard pending flags.
340   * @param  __HANDLE__: specifies the USART Handle.
341   *         This parameter can be USARTx where x: 1, 2, 3 or 6 to select the USART peripheral.
342   * @param  __FLAG__: specifies the flag to check.
343   *          This parameter can be any combination of the following values:
344   *            @arg USART_FLAG_TC:   Transmission Complete flag.
345   *            @arg USART_FLAG_RXNE: Receive data register not empty flag.
346   *   
347   * @note   PE (Parity error), FE (Framing error), NE (Noise error), ORE (OverRun 
348   *          error) and IDLE (Idle line detected) flags are cleared by software 
349   *          sequence: a read operation to USART_SR register followed by a read
350   *          operation to USART_DR register.
351   * @note   RXNE flag can be also cleared by a read to the USART_DR register.
352   * @note   TC flag can be also cleared by software sequence: a read operation to 
353   *          USART_SR register followed by a write operation to USART_DR register.
354   * @note   TXE flag is cleared only by a write to the USART_DR register.
355   *   
356   * @retval None
357   */
358 #define __HAL_USART_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->SR = ~(__FLAG__))
359
360 /** @brief  Clear the USART PE pending flag.
361   * @param  __HANDLE__: specifies the USART Handle.
362   *         This parameter can be USARTx where x: 1, 2, 3 or 6 to select the USART peripheral.
363   * @retval None
364   */
365 #define __HAL_USART_CLEAR_PEFLAG(__HANDLE__) do{(__HANDLE__)->Instance->SR;\
366                                                 (__HANDLE__)->Instance->DR;}while(0)
367 /** @brief  Clear the USART FE pending flag.
368   * @param  __HANDLE__: specifies the USART Handle.
369   *         This parameter can be USARTx where x: 1, 2, 3 or 6 to select the USART peripheral.
370   * @retval None
371   */
372 #define __HAL_USART_CLEAR_FEFLAG(__HANDLE__) __HAL_USART_CLEAR_PEFLAG(__HANDLE__)
373
374 /** @brief  Clear the USART NE pending flag.
375   * @param  __HANDLE__: specifies the USART Handle.
376   *         This parameter can be USARTx where x: 1, 2, 3 or 6 to select the USART peripheral.
377   * @retval None
378   */
379 #define __HAL_USART_CLEAR_NEFLAG(__HANDLE__) __HAL_USART_CLEAR_PEFLAG(__HANDLE__)
380
381 /** @brief  Clear the UART ORE pending flag.
382   * @param  __HANDLE__: specifies the USART Handle.
383   *         This parameter can be USARTx where x: 1, 2, 3 or 6 to select the USART peripheral.
384   * @retval None
385   */
386 #define __HAL_USART_CLEAR_OREFLAG(__HANDLE__) __HAL_USART_CLEAR_PEFLAG(__HANDLE__)
387
388 /** @brief  Clear the USART IDLE pending flag.
389   * @param  __HANDLE__: specifies the USART Handle.
390   *         This parameter can be USARTx where x: 1, 2, 3 or 6 to select the USART peripheral.
391   * @retval None
392   */
393 #define __HAL_USART_CLEAR_IDLEFLAG(__HANDLE__) __HAL_USART_CLEAR_PEFLAG(__HANDLE__)
394
395 /** @brief  Enables or disables the specified Usart interrupts.
396   * @param  __HANDLE__: specifies the USART Handle.
397   *         This parameter can be USARTx where x: 1, 2, 3 or 6 to select the USART peripheral.
398   * @param  __INTERRUPT__: specifies the USART interrupt source to check.
399   *          This parameter can be one of the following values:
400   *            @arg USART_IT_TXE:  Transmit Data Register empty interrupt
401   *            @arg USART_IT_TC:   Transmission complete interrupt
402   *            @arg USART_IT_RXNE: Receive Data register not empty interrupt
403   *            @arg USART_IT_IDLE: Idle line detection interrupt
404   *            @arg USART_IT_PE:   Parity Error interrupt
405   *            @arg USART_IT_ERR:  Error interrupt(Frame error, noise error, overrun error)
406   * @param  NewState: new state of the specified Usart interrupt.
407   *          This parameter can be: ENABLE or DISABLE.
408   * @retval None
409   */
410 #define USART_IT_MASK  ((uint32_t)0x0000FFFF)
411 #define __USART_ENABLE_IT(__HANDLE__, __INTERRUPT__)   ((((__INTERRUPT__) >> 28) == 1)? ((__HANDLE__)->Instance->CR1 |= ((__INTERRUPT__) & USART_IT_MASK)): \
412                                                         (((__INTERRUPT__) >> 28) == 2)? ((__HANDLE__)->Instance->CR2 |=  ((__INTERRUPT__) & USART_IT_MASK)): \
413                                                         ((__HANDLE__)->Instance->CR3 |= ((__INTERRUPT__) & USART_IT_MASK)))
414 #define __USART_DISABLE_IT(__HANDLE__, __INTERRUPT__)  ((((__INTERRUPT__) >> 28) == 1)? ((__HANDLE__)->Instance->CR1 &= ~((__INTERRUPT__) & USART_IT_MASK)): \
415                                                         (((__INTERRUPT__) >> 28) == 2)? ((__HANDLE__)->Instance->CR2 &= ~((__INTERRUPT__) & USART_IT_MASK)): \
416                                                         ((__HANDLE__)->Instance->CR3 &= ~ ((__INTERRUPT__) & USART_IT_MASK)))
417
418     
419 /** @brief  Checks whether the specified Usart interrupt has occurred or not.
420   * @param  __HANDLE__: specifies the USART Handle.
421   *         This parameter can be USARTx where x: 1, 2, 3 or 6 to select the USART peripheral.
422   * @param  __IT__: specifies the USART interrupt source to check.
423   *          This parameter can be one of the following values:
424   *            @arg USART_IT_TXE: Transmit Data Register empty interrupt
425   *            @arg USART_IT_TC:  Transmission complete interrupt
426   *            @arg USART_IT_RXNE: Receive Data register not empty interrupt
427   *            @arg USART_IT_IDLE: Idle line detection interrupt
428   *            @arg USART_IT_ERR: Error interrupt
429   *            @arg USART_IT_PE: Parity Error interrupt
430   * @retval The new state of __IT__ (TRUE or FALSE).
431   */
432 #define __HAL_USART_GET_IT_SOURCE(__HANDLE__, __IT__) (((((__IT__) >> 28) == 1)? (__HANDLE__)->Instance->CR1:(((((uint32_t)(__IT__)) >> 28) == 2)? \
433                                                       (__HANDLE__)->Instance->CR2 : (__HANDLE__)->Instance->CR3)) & (((uint32_t)(__IT__)) & USART_IT_MASK))
434
435 #define __USART_ENABLE(__HANDLE__)               ( (__HANDLE__)->Instance->CR1 |=  USART_CR1_UE)
436 #define __USART_DISABLE(__HANDLE__)              ( (__HANDLE__)->Instance->CR1 &=  ~USART_CR1_UE)
437     
438 #define __DIV(_PCLK_, _BAUD_)                        (((_PCLK_)*25)/(4*(_BAUD_)))
439 #define __DIVMANT(_PCLK_, _BAUD_)                    (__DIV((_PCLK_), (_BAUD_))/100)
440 #define __DIVFRAQ(_PCLK_, _BAUD_)                    (((__DIV((_PCLK_), (_BAUD_)) - (__DIVMANT((_PCLK_), (_BAUD_)) * 100)) * 16 + 50) / 100)
441 #define __USART_BRR(_PCLK_, _BAUD_)              ((__DIVMANT((_PCLK_), (_BAUD_)) << 4)|(__DIVFRAQ((_PCLK_), (_BAUD_)) & 0x0F))
442
443 #define IS_USART_BAUDRATE(BAUDRATE) ((BAUDRATE) < 10500001)
444                                  
445 /* Exported functions --------------------------------------------------------*/
446 /* Initialization/de-initialization functions  **********************************/
447 HAL_StatusTypeDef HAL_USART_Init(USART_HandleTypeDef *husart);
448 HAL_StatusTypeDef HAL_USART_DeInit(USART_HandleTypeDef *husart);
449 void HAL_USART_MspInit(USART_HandleTypeDef *husart);
450 void HAL_USART_MspDeInit(USART_HandleTypeDef *husart);
451 /* IO operation functions *******************************************************/
452 HAL_StatusTypeDef HAL_USART_Transmit(USART_HandleTypeDef *husart, uint8_t *pTxData, uint16_t Size, uint32_t Timeout);
453 HAL_StatusTypeDef HAL_USART_Receive(USART_HandleTypeDef *husart, uint8_t *pRxData, uint16_t Size, uint32_t Timeout);
454 HAL_StatusTypeDef HAL_USART_TransmitReceive(USART_HandleTypeDef *husart, uint8_t *pTxData, uint8_t *pRxData, uint16_t Size, uint32_t Timeout);
455 HAL_StatusTypeDef HAL_USART_Transmit_IT(USART_HandleTypeDef *husart, uint8_t *pTxData, uint16_t Size);
456 HAL_StatusTypeDef HAL_USART_Receive_IT(USART_HandleTypeDef *husart, uint8_t *pRxData, uint16_t Size);
457 HAL_StatusTypeDef HAL_USART_TransmitReceive_IT(USART_HandleTypeDef *husart, uint8_t *pTxData, uint8_t *pRxData,  uint16_t Size);
458 HAL_StatusTypeDef HAL_USART_Transmit_DMA(USART_HandleTypeDef *husart, uint8_t *pTxData, uint16_t Size);
459 HAL_StatusTypeDef HAL_USART_Receive_DMA(USART_HandleTypeDef *husart, uint8_t *pRxData, uint16_t Size);
460 HAL_StatusTypeDef HAL_USART_TransmitReceive_DMA(USART_HandleTypeDef *husart, uint8_t *pTxData, uint8_t *pRxData, uint16_t Size);
461 HAL_StatusTypeDef HAL_USART_DMAPause(USART_HandleTypeDef *husart);
462 HAL_StatusTypeDef HAL_USART_DMAResume(USART_HandleTypeDef *husart);
463 HAL_StatusTypeDef HAL_USART_DMAStop(USART_HandleTypeDef *husart);
464 void HAL_USART_IRQHandler(USART_HandleTypeDef *husart);
465 void HAL_USART_TxCpltCallback(USART_HandleTypeDef *husart);
466 void HAL_USART_TxHalfCpltCallback(USART_HandleTypeDef *husart);
467 void HAL_USART_RxCpltCallback(USART_HandleTypeDef *husart);
468 void HAL_USART_RxHalfCpltCallback(USART_HandleTypeDef *husart);
469 void HAL_USART_TxRxCpltCallback(USART_HandleTypeDef *husart);
470 void HAL_USART_ErrorCallback(USART_HandleTypeDef *husart);
471
472 /* Peripheral State functions  **************************************************/
473 HAL_USART_StateTypeDef HAL_USART_GetState(USART_HandleTypeDef *husart);
474 uint32_t               HAL_USART_GetError(USART_HandleTypeDef *husart);
475
476 /**
477   * @}
478   */ 
479
480 /**
481   * @}
482   */
483   
484 #ifdef __cplusplus
485 }
486 #endif
487
488 #endif /* __STM32F4xx_HAL_USART_H */
489
490 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/