drivers/serial: Add a timeout to uart_tcdrain(). Even if tcflush() is used to discard buffered data, the close() can still hang if (a) hardware flow control is enabled, (b) CTS == 1, and (c) there is data stuck in the hardware Tx FIFO. tcflush() does not currently clear the MCU serial drivers' hardware Tx FIFOs. This is a workaround for that.

This commit is contained in:
Gregory Nutt
2018-05-27 11:39:34 -06:00
parent ca1a7c2b28
commit f3392e0a6c
2 changed files with 30 additions and 9 deletions

View File

@@ -222,9 +222,8 @@
/* Line Control (used with tcflush()) */
#define TCIFLUSH 0 /* Flush pending input. Flush untransmitted
* output */
#define TCIOFLUSH 1 /* Flush both pending input and untransmitte
#define TCIFLUSH 0 /* Flush pending input */
#define TCIOFLUSH 1 /* Flush both pending input and untransmitted
* output */
#define TCOFLUSH 2 /* Flush untransmitted output */