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 <[email protected]>
This commit is contained in:
committed by
Adrien Destugues
parent
750ed8dd41
commit
191fa37376
@@ -289,10 +289,14 @@ int
|
|||||||
ArchUARTPL011::GetChar(bool wait)
|
ArchUARTPL011::GetChar(bool wait)
|
||||||
{
|
{
|
||||||
if (Enabled() == true) {
|
if (Enabled() == true) {
|
||||||
// Wait until a character is received?
|
|
||||||
if (wait) {
|
if (wait) {
|
||||||
|
// Wait until a character is received
|
||||||
while ((In32(PL01x_FR) & PL01x_FR_RXFE) != 0)
|
while ((In32(PL01x_FR) & PL01x_FR_RXFE) != 0)
|
||||||
Barrier();
|
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);
|
return In32(PL01x_DR);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user