mirror of
https://github.com/hermitcore/libhermit.git
synced 2025-03-09 00:00:03 +01:00
before writing to UART, check if the fifo is free
This commit is contained in:
parent
ab6dee0db7
commit
8ce912ef03
2 changed files with 20 additions and 0 deletions
|
@ -111,8 +111,18 @@ static inline unsigned char read_from_uart(uint32_t off)
|
|||
return c;
|
||||
}
|
||||
|
||||
static inline int is_transmit_empty(void)
|
||||
{
|
||||
if (uartport)
|
||||
return inportb(uartport + UART_LSR) & 0x20;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static inline void write_to_uart(uint32_t off, unsigned char c)
|
||||
{
|
||||
while (is_transmit_empty() == 0) { PAUSE; }
|
||||
|
||||
if (uartport)
|
||||
outportb(uartport + off, c);
|
||||
}
|
||||
|
|
|
@ -104,8 +104,18 @@ static inline unsigned char read_from_uart(uint32_t off)
|
|||
return c;
|
||||
}
|
||||
|
||||
static inline int is_transmit_empty(void)
|
||||
{
|
||||
if (uartport)
|
||||
return inportb(uartport + UART_LSR) & 0x20;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void write_to_uart(uint32_t off, unsigned char c)
|
||||
{
|
||||
while (is_transmit_empty() == 0) ;
|
||||
|
||||
if (uartport)
|
||||
outportb(uartport + off, c);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue