Make PL011 UART to wait on putc only when TX FIFO is full
Instead of waiting for empty TX FIFO it is more reasonable to block on full FIFO. As soon as FIFO slot is free the character can be transmitted. In case of TX FIFO disabled, TXFF bit indicates that transmit register is not empty. Obtained from: Semihalf Reviewed by: andrew, emaste Sponsored by: The FreeBSD Foundation
This commit is contained in:
parent
4b63a7c678
commit
17d2ee0132
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=274451
@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$");
|
||||
#define DR_OE (1 << 11) /* Overrun error */
|
||||
|
||||
#define UART_FR 0x06 /* Flag register */
|
||||
#define FR_TXFF (1 << 5) /* Transmit FIFO/reg full */
|
||||
#define FR_RXFF (1 << 6) /* Receive FIFO/reg full */
|
||||
#define FR_TXFE (1 << 7) /* Transmit FIFO/reg empty */
|
||||
|
||||
@ -194,7 +195,8 @@ static void
|
||||
uart_pl011_putc(struct uart_bas *bas, int c)
|
||||
{
|
||||
|
||||
while (!(__uart_getreg(bas, UART_FR) & FR_TXFE))
|
||||
/* Wait when TX FIFO full. Push character otherwise. */
|
||||
while (__uart_getreg(bas, UART_FR) & FR_TXFF)
|
||||
;
|
||||
__uart_setreg(bas, UART_DR, c & 0xff);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user