Skip to content

Commit

Permalink
serial/uart_ns16500: poll THRE to determine when data can be written
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
fabled authored and galak committed Aug 18, 2017
1 parent 32598a3 commit ef13028
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/serial/uart_ns16550.c
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ static unsigned char uart_ns16550_poll_out(struct device *dev,
unsigned char c)
{
/* 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);
Expand Down

0 comments on commit ef13028

Please sign in to comment.