Kernel: busy wait until serial out has finished

This commit is contained in:
Thomas Veerman 2012-10-17 14:57:08 +00:00
parent aefc6db005
commit 87de141141
2 changed files with 8 additions and 2 deletions

View file

@ -9,9 +9,14 @@ void omap3_ser_putc(char c)
/* Wait until FIFO's empty */
for (i = 0; i < 100000; i++)
if (mmio_read(OMAP3_UART3_LSR) & OMAP3_LSR_TX_FIFO_E)
if (mmio_read(OMAP3_UART3_LSR) & OMAP3_LSR_THRE)
break;
/* Write character */
mmio_write(OMAP3_UART3_THR, c);
/* And wait again until FIFO's empty to prevent TTY from overwriting */
for (i = 0; i < 100000; i++)
if (mmio_read(OMAP3_UART3_LSR) & (OMAP3_LSR_THRE | OMAP3_LSR_TEMT))
break;
}

View file

@ -12,7 +12,8 @@
#define OMAP3_SSR 0x044 /* Supplementary status register */
/* Line status register fields */
#define OMAP3_LSR_TX_FIFO_E (1 << 5) /* Transmit FIFO empty */
#define OMAP3_LSR_TEMT 0x40 /* Transmitter empty */
#define OMAP3_LSR_THRE 0x20 /* Transmit-hold-register empty */
/* Supplementary status register fields */
#define OMAP3_SSR_TX_FIFO_FULL (1 << 0) /* Transmit FIFO full */