serial/uart_ns16500: poll THRE to determine when data can be written

TEMT is Transmitter Empty bit which is set only when the full FIFO
is empty. It makes sense to poll for THRE (Transmitter Holding
Register Empty) which is set when UART can buffer new character
for transmission (there is room in FIFO). This allows using the
FIFO in full.

Signed-off-by: Timo Teräs <timo.teras@iki.fi>
This commit is contained in:
Timo Teräs 2017-08-17 20:05:08 +03:00 committed by Anas Nashif
commit 5829965278

View file

@ -401,7 +401,7 @@ static unsigned char uart_ns16550_poll_out(struct device *dev,
unsigned char c) unsigned char c)
{ {
/* wait for transmitter to ready to accept a character */ /* wait for transmitter to ready to accept a character */
while ((INBYTE(LSR(dev)) & LSR_TEMT) == 0) while ((INBYTE(LSR(dev)) & LSR_THRE) == 0)
; ;
OUTBYTE(THR(dev), c); OUTBYTE(THR(dev), c);