uart.h 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460
  1. /******************************************************************************
  2. * @file uart.h
  3. * @version V3.00
  4. * $Revision: 36 $
  5. * $Date: 15/08/11 10:26a $
  6. * @brief M451 series UART driver header file
  7. *
  8. * @note
  9. * Copyright (C) 2013~2015 Nuvoton Technology Corp. All rights reserved.
  10. *****************************************************************************/
  11. #ifndef __UART_H__
  12. #define __UART_H__
  13. #ifdef __cplusplus
  14. extern "C"
  15. {
  16. #endif
  17. /** @addtogroup Standard_Driver Standard Driver
  18. @{
  19. */
  20. /** @addtogroup UART_Driver UART Driver
  21. @{
  22. */
  23. /** @addtogroup UART_EXPORTED_CONSTANTS UART Exported Constants
  24. @{
  25. */
  26. /*---------------------------------------------------------------------------------------------------------*/
  27. /* UART FIFO size constants definitions */
  28. /*---------------------------------------------------------------------------------------------------------*/
  29. #define UART0_FIFO_SIZE 16 /*!< UART0 supports separated receive/transmit 16/16 bytes entry FIFO */
  30. #define UART1_FIFO_SIZE 16 /*!< UART1 supports separated receive/transmit 16/16 bytes entry FIFO */
  31. #define UART2_FIFO_SIZE 16 /*!< UART2 supports separated receive/transmit 16/16 bytes entry FIFO */
  32. #define UART3_FIFO_SIZE 16 /*!< UART3 supports separated receive/transmit 16/16 bytes entry FIFO */
  33. /*---------------------------------------------------------------------------------------------------------*/
  34. /* UART_FIFO constants definitions */
  35. /*---------------------------------------------------------------------------------------------------------*/
  36. #define UART_FIFO_RFITL_1BYTE (0x0 << UART_FIFO_RFITL_Pos) /*!< UART_FIFO setting to set RX FIFO Trigger Level to 1 byte */
  37. #define UART_FIFO_RFITL_4BYTES (0x1 << UART_FIFO_RFITL_Pos) /*!< UART_FIFO setting to set RX FIFO Trigger Level to 4 bytes */
  38. #define UART_FIFO_RFITL_8BYTES (0x2 << UART_FIFO_RFITL_Pos) /*!< UART_FIFO setting to set RX FIFO Trigger Level to 8 bytes */
  39. #define UART_FIFO_RFITL_14BYTES (0x3 << UART_FIFO_RFITL_Pos) /*!< UART_FIFO setting to set RX FIFO Trigger Level to 14 bytes */
  40. #define UART_FIFO_RTSTRGLV_1BYTE (0x0 << UART_FIFO_RTSTRGLV_Pos) /*!< UART_FIFO setting to set RTS Trigger Level to 1 byte */
  41. #define UART_FIFO_RTSTRGLV_4BYTES (0x1 << UART_FIFO_RTSTRGLV_Pos) /*!< UART_FIFO setting to set RTS Trigger Level to 4 bytes */
  42. #define UART_FIFO_RTSTRGLV_8BYTES (0x2 << UART_FIFO_RTSTRGLV_Pos) /*!< UART_FIFO setting to set RTS Trigger Level to 8 bytes */
  43. #define UART_FIFO_RTSTRGLV_14BYTES (0x3 << UART_FIFO_RTSTRGLV_Pos) /*!< UART_FIFO setting to set RTS Trigger Level to 14 bytes */
  44. /*---------------------------------------------------------------------------------------------------------*/
  45. /* UART_LINE constants definitions */
  46. /*---------------------------------------------------------------------------------------------------------*/
  47. #define UART_WORD_LEN_5 (0) /*!< UART_LINE setting to set UART word length to 5 bits */
  48. #define UART_WORD_LEN_6 (1) /*!< UART_LINE setting to set UART word length to 6 bits */
  49. #define UART_WORD_LEN_7 (2) /*!< UART_LINE setting to set UART word length to 7 bits */
  50. #define UART_WORD_LEN_8 (3) /*!< UART_LINE setting to set UART word length to 8 bits */
  51. #define UART_PARITY_NONE (0x0 << UART_LINE_PBE_Pos) /*!< UART_LINE setting to set UART as no parity */
  52. #define UART_PARITY_ODD (0x1 << UART_LINE_PBE_Pos) /*!< UART_LINE setting to set UART as odd parity */
  53. #define UART_PARITY_EVEN (0x3 << UART_LINE_PBE_Pos) /*!< UART_LINE setting to set UART as even parity */
  54. #define UART_PARITY_MARK (0x5 << UART_LINE_PBE_Pos) /*!< UART_LINE setting to keep parity bit as '1' */
  55. #define UART_PARITY_SPACE (0x7 << UART_LINE_PBE_Pos) /*!< UART_LINE setting to keep parity bit as '0' */
  56. #define UART_STOP_BIT_1 (0x0 << UART_LINE_NSB_Pos) /*!< UART_LINE setting for one stop bit */
  57. #define UART_STOP_BIT_1_5 (0x1 << UART_LINE_NSB_Pos) /*!< UART_LINE setting for 1.5 stop bit when 5-bit word length */
  58. #define UART_STOP_BIT_2 (0x1 << UART_LINE_NSB_Pos) /*!< UART_LINE setting for two stop bit when 6, 7, 8-bit word length */
  59. /*---------------------------------------------------------------------------------------------------------*/
  60. /* UART RTS ACTIVE LEVEL constants definitions */
  61. /*---------------------------------------------------------------------------------------------------------*/
  62. #define UART_RTS_IS_LOW_LEV_ACTIVE (0x1 << UART_MODEM_RTSACTLV_Pos) /*!< Set RTS is Low Level Active */
  63. #define UART_RTS_IS_HIGH_LEV_ACTIVE (0x0 << UART_MODEM_RTSACTLV_Pos) /*!< Set RTS is High Level Active */
  64. /*---------------------------------------------------------------------------------------------------------*/
  65. /* UART_IRDA constants definitions */
  66. /*---------------------------------------------------------------------------------------------------------*/
  67. #define UART_IRDA_TXEN (0x1 << UART_IRDA_TXEN_Pos) /*!< Set IrDA function Tx mode */
  68. #define UART_IRDA_RXEN (0x0 << UART_IRDA_TXEN_Pos) /*!< Set IrDA function Rx mode */
  69. /*---------------------------------------------------------------------------------------------------------*/
  70. /* UART_FUNCSEL constants definitions */
  71. /*---------------------------------------------------------------------------------------------------------*/
  72. #define UART_FUNCSEL_UART (0x0 << UART_FUNCSEL_FUNCSEL_Pos) /*!< UART_FUNCSEL setting to set UART Function (Default) */
  73. #define UART_FUNCSEL_LIN (0x1 << UART_FUNCSEL_FUNCSEL_Pos) /*!< UART_FUNCSEL setting to set LIN Function */
  74. #define UART_FUNCSEL_IrDA (0x2 << UART_FUNCSEL_FUNCSEL_Pos) /*!< UART_FUNCSEL setting to set IrDA Function */
  75. #define UART_FUNCSEL_RS485 (0x3 << UART_FUNCSEL_FUNCSEL_Pos) /*!< UART_FUNCSEL setting to set RS485 Function */
  76. /*---------------------------------------------------------------------------------------------------------*/
  77. /* UART_LINCTL constants definitions */
  78. /*---------------------------------------------------------------------------------------------------------*/
  79. #define UART_LINCTL_BRKFL(x) (((x)-1) << UART_LINCTL_BRKFL_Pos) /*!< UART_LINCTL setting to set LIN Break Field Length, x = 10 ~ 15, default value is 12 */
  80. #define UART_LINCTL_BSL(x) (((x)-1) << UART_LINCTL_BSL_Pos) /*!< UART_LINCTL setting to set LIN Break/Sync Delimiter Length, x = 1 ~ 4 */
  81. #define UART_LINCTL_HSEL_BREAK (0x0UL << UART_LINCTL_HSEL_Pos) /*!< UART_LINCTL setting to set LIN Header Select to break field */
  82. #define UART_LINCTL_HSEL_BREAK_SYNC (0x1UL << UART_LINCTL_HSEL_Pos) /*!< UART_LINCTL setting to set LIN Header Select to break field and sync field */
  83. #define UART_LINCTL_HSEL_BREAK_SYNC_ID (0x2UL << UART_LINCTL_HSEL_Pos) /*!< UART_LINCTL setting to set LIN Header Select to break field, sync field and ID field*/
  84. #define UART_LINCTL_PID(x) ((x) << UART_LINCTL_PID_Pos) /*!< UART_LINCTL setting to set LIN PID value */
  85. /*---------------------------------------------------------------------------------------------------------*/
  86. /* UART BAUDRATE MODE constants definitions */
  87. /*---------------------------------------------------------------------------------------------------------*/
  88. #define UART_BAUD_MODE0 (0) /*!< Set UART Baudrate Mode is Mode0 */
  89. #define UART_BAUD_MODE2 (UART_BAUD_BAUDM1_Msk | UART_BAUD_BAUDM0_Msk) /*!< Set UART Baudrate Mode is Mode2 */
  90. /*@}*/ /* end of group UART_EXPORTED_CONSTANTS */
  91. /** @addtogroup UART_EXPORTED_FUNCTIONS UART Exported Functions
  92. @{
  93. */
  94. /**
  95. * @brief Calculate UART baudrate mode0 divider
  96. *
  97. * @param[in] u32SrcFreq UART clock frequency
  98. * @param[in] u32BaudRate Baudrate of UART module
  99. *
  100. * @return UART baudrate mode0 divider
  101. *
  102. * @details This macro calculate UART baudrate mode0 divider.
  103. */
  104. #define UART_BAUD_MODE0_DIVIDER(u32SrcFreq, u32BaudRate) ((((u32SrcFreq) + ((u32BaudRate)*8)) / (u32BaudRate) >> 4)-2)
  105. /**
  106. * @brief Calculate UART baudrate mode2 divider
  107. *
  108. * @param[in] u32SrcFreq UART clock frequency
  109. * @param[in] u32BaudRate Baudrate of UART module
  110. *
  111. * @return UART baudrate mode2 divider
  112. *
  113. * @details This macro calculate UART baudrate mode2 divider.
  114. */
  115. #define UART_BAUD_MODE2_DIVIDER(u32SrcFreq, u32BaudRate) ((((u32SrcFreq) + ((u32BaudRate)/2)) / (u32BaudRate))-2)
  116. /**
  117. * @brief Write UART data
  118. *
  119. * @param[in] uart The pointer of the specified UART module
  120. * @param[in] u8Data Data byte to transmit.
  121. *
  122. * @return None
  123. *
  124. * @details This macro write Data to Tx data register.
  125. */
  126. #define UART_WRITE(uart, u8Data) ((uart)->DAT = (u8Data))
  127. /**
  128. * @brief Read UART data
  129. *
  130. * @param[in] uart The pointer of the specified UART module
  131. *
  132. * @return The oldest data byte in RX FIFO.
  133. *
  134. * @details This macro read Rx data register.
  135. */
  136. #define UART_READ(uart) ((uart)->DAT)
  137. /**
  138. * @brief Get Tx empty
  139. *
  140. * @param[in] uart The pointer of the specified UART module
  141. *
  142. * @retval 0 Tx FIFO is not empty
  143. * @retval >=1 Tx FIFO is empty
  144. *
  145. * @details This macro get Transmitter FIFO empty register value.
  146. */
  147. #define UART_GET_TX_EMPTY(uart) ((uart)->FIFOSTS & UART_FIFOSTS_TXEMPTY_Msk)
  148. /**
  149. * @brief Get Rx empty
  150. *
  151. * @param[in] uart The pointer of the specified UART module
  152. *
  153. * @retval 0 Rx FIFO is not empty
  154. * @retval >=1 Rx FIFO is empty
  155. *
  156. * @details This macro get Receiver FIFO empty register value.
  157. */
  158. #define UART_GET_RX_EMPTY(uart) ((uart)->FIFOSTS & UART_FIFOSTS_RXEMPTY_Msk)
  159. /**
  160. * @brief Check specified uart port transmission is over.
  161. *
  162. * @param[in] uart The pointer of the specified UART module
  163. *
  164. * @retval 0 Tx transmission is not over
  165. * @retval 1 Tx transmission is over
  166. *
  167. * @details This macro return Transmitter Empty Flag register bit value.
  168. * It indicates if specified uart port transmission is over nor not.
  169. */
  170. #define UART_IS_TX_EMPTY(uart) (((uart)->FIFOSTS & UART_FIFOSTS_TXEMPTYF_Msk) >> UART_FIFOSTS_TXEMPTYF_Pos)
  171. /**
  172. * @brief Wait specified uart port transmission is over
  173. *
  174. * @param[in] uart The pointer of the specified UART module
  175. *
  176. * @return None
  177. *
  178. * @details This macro wait specified uart port transmission is over.
  179. */
  180. #define UART_WAIT_TX_EMPTY(uart) while(!((((uart)->FIFOSTS) & UART_FIFOSTS_TXEMPTYF_Msk) >> UART_FIFOSTS_TXEMPTYF_Pos))
  181. /**
  182. * @brief Check RX is ready or not
  183. *
  184. * @param[in] uart The pointer of the specified UART module
  185. *
  186. * @retval 0 The number of bytes in the RX FIFO is less than the RFITL
  187. * @retval 1 The number of bytes in the RX FIFO equals or larger than RFITL
  188. *
  189. * @details This macro check receive data available interrupt flag is set or not.
  190. */
  191. #define UART_IS_RX_READY(uart) (((uart)->INTSTS & UART_INTSTS_RDAIF_Msk)>>UART_INTSTS_RDAIF_Pos)
  192. /**
  193. * @brief Check TX FIFO is full or not
  194. *
  195. * @param[in] uart The pointer of the specified UART module
  196. *
  197. * @retval 1 TX FIFO is full
  198. * @retval 0 TX FIFO is not full
  199. *
  200. * @details This macro check TX FIFO is full or not.
  201. */
  202. #define UART_IS_TX_FULL(uart) (((uart)->FIFOSTS & UART_FIFOSTS_TXFULL_Msk)>>UART_FIFOSTS_TXFULL_Pos)
  203. /**
  204. * @brief Check RX FIFO is full or not
  205. *
  206. * @param[in] uart The pointer of the specified UART module
  207. *
  208. * @retval 1 RX FIFO is full
  209. * @retval 0 RX FIFO is not full
  210. *
  211. * @details This macro check RX FIFO is full or not.
  212. */
  213. #define UART_IS_RX_FULL(uart) (((uart)->FIFOSTS & UART_FIFOSTS_RXFULL_Msk)>>UART_FIFOSTS_RXFULL_Pos)
  214. /**
  215. * @brief Get Tx full register value
  216. *
  217. * @param[in] uart The pointer of the specified UART module
  218. *
  219. * @retval 0 Tx FIFO is not full.
  220. * @retval >=1 Tx FIFO is full.
  221. *
  222. * @details This macro get Tx full register value.
  223. */
  224. #define UART_GET_TX_FULL(uart) ((uart)->FIFOSTS & UART_FIFOSTS_TXFULL_Msk)
  225. /**
  226. * @brief Get Rx full register value
  227. *
  228. * @param[in] uart The pointer of the specified UART module
  229. *
  230. * @retval 0 Rx FIFO is not full.
  231. * @retval >=1 Rx FIFO is full.
  232. *
  233. * @details This macro get Rx full register value.
  234. */
  235. #define UART_GET_RX_FULL(uart) ((uart)->FIFOSTS & UART_FIFOSTS_RXFULL_Msk)
  236. /**
  237. * @brief Enable specified UART interrupt
  238. *
  239. * @param[in] uart The pointer of the specified UART module
  240. * @param[in] u32eIntSel Interrupt type select
  241. * - \ref UART_INTEN_ABRIEN_Msk : Auto baud rate interrupt
  242. * - \ref UART_INTEN_WKCTSIEN_Msk : CTS wakeup interrupt
  243. * - \ref UART_INTEN_WKDATIEN_Msk : Data wakeup interrupt
  244. * - \ref UART_INTEN_LINIEN_Msk : Lin bus interrupt
  245. * - \ref UART_INTEN_BUFERRIEN_Msk : Buffer Error interrupt
  246. * - \ref UART_INTEN_RXTOIEN_Msk : Rx time-out interrupt
  247. * - \ref UART_INTEN_MODEMIEN_Msk : Modem interrupt
  248. * - \ref UART_INTEN_RLSIEN_Msk : Rx Line status interrupt
  249. * - \ref UART_INTEN_THREIEN_Msk : Tx empty interrupt
  250. * - \ref UART_INTEN_RDAIEN_Msk : Rx ready interrupt
  251. *
  252. * @return None
  253. *
  254. * @details This macro enable specified UART interrupt.
  255. */
  256. #define UART_ENABLE_INT(uart, u32eIntSel) ((uart)->INTEN |= (u32eIntSel))
  257. /**
  258. * @brief Disable specified UART interrupt
  259. *
  260. * @param[in] uart The pointer of the specified UART module
  261. * @param[in] u32eIntSel Interrupt type select
  262. * - \ref UART_INTEN_ABRIEN_Msk : Auto baud rate interrupt
  263. * - \ref UART_INTEN_WKCTSIEN_Msk : CTS wakeup interrupt
  264. * - \ref UART_INTEN_WKDATIEN_Msk : Data wakeup interrupt
  265. * - \ref UART_INTEN_LINIEN_Msk : Lin bus interrupt
  266. * - \ref UART_INTEN_BUFERRIEN_Msk : Buffer Error interrupt
  267. * - \ref UART_INTEN_RXTOIEN_Msk : Rx time-out interrupt
  268. * - \ref UART_INTEN_MODEMIEN_Msk : Modem status interrupt
  269. * - \ref UART_INTEN_RLSIEN_Msk : Receive Line status interrupt
  270. * - \ref UART_INTEN_THREIEN_Msk : Tx empty interrupt
  271. * - \ref UART_INTEN_RDAIEN_Msk : Rx ready interrupt
  272. *
  273. * @return None
  274. *
  275. * @details This macro enable specified UART interrupt.
  276. */
  277. #define UART_DISABLE_INT(uart, u32eIntSel) ((uart)->INTEN &= ~ (u32eIntSel))
  278. /**
  279. * @brief Get specified interrupt flag/status
  280. *
  281. * @param[in] uart The pointer of the specified UART module
  282. * @param[in] u32eIntTypeFlag Interrupt Type Flag, should be
  283. * - \ref UART_INTSTS_HWBUFEINT_Msk : In DMA Mode, Buffer Error Interrupt Indicator
  284. * - \ref UART_INTSTS_HWTOINT_Msk : In DMA Mode, Time-out Interrupt Indicator
  285. * - \ref UART_INTSTS_HWMODINT_Msk : In DMA Mode, MODEM Status Interrupt Indicator
  286. * - \ref UART_INTSTS_HWRLSINT_Msk : In DMA Mode, Receive Line Status Interrupt Indicator
  287. * - \ref UART_INTSTS_HWBUFEIF_Msk : In DMA Mode, Buffer Error Interrupt Flag
  288. * - \ref UART_INTSTS_HWTOIF_Msk : In DMA Mode, Time-out Interrupt Flag
  289. * - \ref UART_INTSTS_HWMODIF_Msk : In DMA Mode, MODEM Interrupt Flag
  290. * - \ref UART_INTSTS_HWRLSIF_Msk : In DMA Mode, Receive Line Status Flag
  291. * - \ref UART_INTSTS_LININT_Msk : LIN Bus Interrupt Indicator
  292. * - \ref UART_INTSTS_BUFERRINT_Msk : Buffer Error Interrupt Indicator
  293. * - \ref UART_INTSTS_RXTOINT_Msk : Time-out Interrupt Indicator
  294. * - \ref UART_INTSTS_MODEMINT_Msk : Modem Status Interrupt Indicator
  295. * - \ref UART_INTSTS_RLSINT_Msk : Receive Line Status Interrupt Indicator
  296. * - \ref UART_INTSTS_THREINT_Msk : Transmit Holding Register Empty Interrupt Indicator
  297. * - \ref UART_INTSTS_RDAINT_Msk : Receive Data Available Interrupt Indicator
  298. * - \ref UART_INTSTS_LINIF_Msk : LIN Bus Flag
  299. * - \ref UART_INTSTS_BUFERRIF_Msk : Buffer Error Interrupt Flag
  300. * - \ref UART_INTSTS_RXTOIF_Msk : Rx Time-out Interrupt Flag
  301. * - \ref UART_INTSTS_MODEMIF_Msk : Modem Interrupt Flag
  302. * - \ref UART_INTSTS_RLSIF_Msk : Receive Line Status Interrupt Flag
  303. * - \ref UART_INTSTS_THREIF_Msk : Tx Empty Interrupt Flag
  304. * - \ref UART_INTSTS_RDAIF_Msk : Rx Ready Interrupt Flag
  305. *
  306. * @retval 0 The specified interrupt is not happened.
  307. * 1 The specified interrupt is happened.
  308. *
  309. * @details This macro get specified interrupt flag or interrupt indicator status.
  310. */
  311. #define UART_GET_INT_FLAG(uart,u32eIntTypeFlag) (((uart)->INTSTS & (u32eIntTypeFlag))?1:0)
  312. /**
  313. * @brief Set RTS pin to low
  314. *
  315. * @param[in] uart The pointer of the specified UART module
  316. *
  317. * @return None
  318. *
  319. * @details This macro set RTS pin to low.
  320. */
  321. __STATIC_INLINE void UART_CLEAR_RTS(UART_T* uart)
  322. {
  323. uart->MODEM |= UART_MODEM_RTSACTLV_Msk;
  324. uart->MODEM &= ~UART_MODEM_RTS_Msk;
  325. }
  326. /**
  327. * @brief Set RTS pin to high
  328. *
  329. * @param[in] uart The pointer of the specified UART module
  330. *
  331. * @return None
  332. *
  333. * @details This macro set RTS pin to high.
  334. */
  335. __STATIC_INLINE void UART_SET_RTS(UART_T* uart)
  336. {
  337. uart->MODEM |= UART_MODEM_RTSACTLV_Msk | UART_MODEM_RTS_Msk;
  338. }
  339. /**
  340. * @brief Clear RS-485 Address Byte Detection Flag
  341. *
  342. * @param[in] uart The pointer of the specified UART module
  343. *
  344. * @return None
  345. *
  346. * @details This macro clear RS-485 address byte detection flag.
  347. */
  348. #define UART_RS485_CLEAR_ADDR_FLAG(uart) ((uart)->FIFOSTS = UART_FIFOSTS_ADDRDETF_Msk)
  349. /**
  350. * @brief Get RS-485 Address Byte Detection Flag
  351. *
  352. * @param[in] uart The pointer of the specified UART module
  353. *
  354. * @retval 0 Receiver detects a data that is not an address bit.
  355. * @retval 1 Receiver detects a data that is an address bit.
  356. *
  357. * @details This macro get RS-485 address byte detection flag.
  358. */
  359. #define UART_RS485_GET_ADDR_FLAG(uart) (((uart)->FIFOSTS & UART_FIFOSTS_ADDRDETF_Msk) >> UART_FIFOSTS_ADDRDETF_Pos)
  360. void UART_ClearIntFlag(UART_T* uart , uint32_t u32InterruptFlag);
  361. void UART_Close(UART_T* uart);
  362. void UART_DisableFlowCtrl(UART_T* uart);
  363. void UART_DisableInt(UART_T* uart, uint32_t u32InterruptFlag);
  364. void UART_EnableFlowCtrl(UART_T* uart);
  365. void UART_EnableInt(UART_T* uart, uint32_t u32InterruptFlag);
  366. void UART_Open(UART_T* uart, uint32_t u32baudrate);
  367. uint32_t UART_Read(UART_T* uart, uint8_t *pu8RxBuf, uint32_t u32ReadBytes);
  368. void UART_SetLine_Config(UART_T* uart, uint32_t u32baudrate, uint32_t u32data_width, uint32_t u32parity, uint32_t u32stop_bits);
  369. void UART_SetTimeoutCnt(UART_T* uart, uint32_t u32TOC);
  370. void UART_SelectIrDAMode(UART_T* uart, uint32_t u32Buadrate, uint32_t u32Direction);
  371. void UART_SelectRS485Mode(UART_T* uart, uint32_t u32Mode, uint32_t u32Addr);
  372. void UART_SelectLINMode(UART_T* uart, uint32_t u32Mode, uint32_t u32BreakLength);
  373. uint32_t UART_Write(UART_T* uart, uint8_t *pu8TxBuf, uint32_t u32WriteBytes);
  374. /*@}*/ /* end of group UART_EXPORTED_FUNCTIONS */
  375. /*@}*/ /* end of group UART_Driver */
  376. /*@}*/ /* end of group Standard_Driver */
  377. #ifdef __cplusplus
  378. }
  379. #endif
  380. #endif //__UART_H__
  381. /*** (C) COPYRIGHT 2013~2015 Nuvoton Technology Corp. ***/