Check the serial buffer empty status before performing the serial IO reading operation.

Signed-off-by: niruiyu
Reviewed-by: vanjeff

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12581 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
niruiyu 2011-10-27 05:38:42 +00:00
parent bdfbe63efa
commit 59d88f42ca
1 changed files with 22 additions and 15 deletions

View File

@ -515,6 +515,7 @@ TerminalConInTimerHandler (
{ {
EFI_STATUS Status; EFI_STATUS Status;
TERMINAL_DEV *TerminalDevice; TERMINAL_DEV *TerminalDevice;
UINT32 Control;
UINT8 Input; UINT8 Input;
EFI_SERIAL_IO_MODE *Mode; EFI_SERIAL_IO_MODE *Mode;
EFI_SERIAL_IO_PROTOCOL *SerialIo; EFI_SERIAL_IO_PROTOCOL *SerialIo;
@ -558,7 +559,12 @@ TerminalConInTimerHandler (
TerminalDevice->SerialInTimeOut = SerialInTimeOut; TerminalDevice->SerialInTimeOut = SerialInTimeOut;
} }
} }
//
// Check whether serial buffer is empty.
//
Status = SerialIo->GetControl (SerialIo, &Control);
if ((Control & EFI_SERIAL_INPUT_BUFFER_EMPTY) == 0) {
// //
// Fetch all the keys in the serial buffer, // Fetch all the keys in the serial buffer,
// and insert the byte stream into RawFIFO. // and insert the byte stream into RawFIFO.
@ -580,6 +586,7 @@ TerminalConInTimerHandler (
RawFiFoInsertOneKey (TerminalDevice, Input); RawFiFoInsertOneKey (TerminalDevice, Input);
} }
}
// //
// Translate all the raw data in RawFIFO into EFI Key, // Translate all the raw data in RawFIFO into EFI Key,