kernel/uart: fix GetChar for PL011
Check RX buffer status when GetChar is called in no-wait mode. This fixes an 'infinite keypress' issue that used to occur after 16 keypresses. Change-Id: I47762de387b07c4fed46cc192cd3b81fdabfb270 Reviewed-on: https://review.haiku-os.org/c/haiku/+/4732 Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
This commit is contained in:
parent
750ed8dd41
commit
191fa37376
@ -289,10 +289,14 @@ int
|
||||
ArchUARTPL011::GetChar(bool wait)
|
||||
{
|
||||
if (Enabled() == true) {
|
||||
// Wait until a character is received?
|
||||
if (wait) {
|
||||
// Wait until a character is received
|
||||
while ((In32(PL01x_FR) & PL01x_FR_RXFE) != 0)
|
||||
Barrier();
|
||||
} else {
|
||||
// Check if there is any data available in RX fifo
|
||||
if ((In32(PL01x_FR) & PL01x_FR_RXFE) != 0)
|
||||
return -1;
|
||||
}
|
||||
return In32(PL01x_DR);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user