mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-05 21:04:24 +02:00
EmbeddedPkg/SerialDxe: Do not block UART when no data is available on the port
Signed-off-by: Olivier Martin <olivier.martin@arm.com> git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13255 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
c54de82204
commit
40ab42ddca
@ -34,7 +34,6 @@ PL011UartInitializePort (
|
|||||||
IN UINTN UartBase,
|
IN UINTN UartBase,
|
||||||
IN UINT64 BaudRate,
|
IN UINT64 BaudRate,
|
||||||
IN UINT32 ReceiveFifoDepth,
|
IN UINT32 ReceiveFifoDepth,
|
||||||
IN UINT32 Timeout,
|
|
||||||
IN EFI_PARITY_TYPE Parity,
|
IN EFI_PARITY_TYPE Parity,
|
||||||
IN UINT8 DataBits,
|
IN UINT8 DataBits,
|
||||||
IN EFI_STOP_BITS_TYPE StopBits
|
IN EFI_STOP_BITS_TYPE StopBits
|
||||||
|
@ -94,7 +94,6 @@ PL011UartInitializePort (
|
|||||||
IN UINTN UartBase,
|
IN UINTN UartBase,
|
||||||
IN UINT64 BaudRate,
|
IN UINT64 BaudRate,
|
||||||
IN UINT32 ReceiveFifoDepth,
|
IN UINT32 ReceiveFifoDepth,
|
||||||
IN UINT32 Timeout,
|
|
||||||
IN EFI_PARITY_TYPE Parity,
|
IN EFI_PARITY_TYPE Parity,
|
||||||
IN UINT8 DataBits,
|
IN UINT8 DataBits,
|
||||||
IN EFI_STOP_BITS_TYPE StopBits
|
IN EFI_STOP_BITS_TYPE StopBits
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
#include <Include/Base.h>
|
#include <Base.h>
|
||||||
|
|
||||||
#include <Library/IoLib.h>
|
#include <Library/IoLib.h>
|
||||||
#include <Library/PcdLib.h>
|
#include <Library/PcdLib.h>
|
||||||
@ -40,7 +40,6 @@ SerialPortInitialize (
|
|||||||
(UINTN)PcdGet64 (PcdSerialRegisterBase),
|
(UINTN)PcdGet64 (PcdSerialRegisterBase),
|
||||||
(UINTN)PcdGet64 (PcdUartDefaultBaudRate),
|
(UINTN)PcdGet64 (PcdUartDefaultBaudRate),
|
||||||
0, // Use the default value for Fifo depth
|
0, // Use the default value for Fifo depth
|
||||||
0, // Use the default value for Timeout,
|
|
||||||
(EFI_PARITY_TYPE)PcdGet8 (PcdUartDefaultParity),
|
(EFI_PARITY_TYPE)PcdGet8 (PcdUartDefaultParity),
|
||||||
PcdGet8 (PcdUartDefaultDataBits),
|
PcdGet8 (PcdUartDefaultDataBits),
|
||||||
(EFI_STOP_BITS_TYPE) PcdGet8 (PcdUartDefaultStopBits));
|
(EFI_STOP_BITS_TYPE) PcdGet8 (PcdUartDefaultStopBits));
|
||||||
|
@ -167,7 +167,7 @@ SerialWrite (
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Writes data to a serial device.
|
Reads data from a serial device.
|
||||||
|
|
||||||
@param This Protocol instance pointer.
|
@param This Protocol instance pointer.
|
||||||
@param BufferSize On input, the size of the Buffer. On output, the amount of
|
@param BufferSize On input, the size of the Buffer. On output, the amount of
|
||||||
@ -192,12 +192,13 @@ SerialRead (
|
|||||||
|
|
||||||
if (SerialPortPoll()) {
|
if (SerialPortPoll()) {
|
||||||
Count = SerialPortRead (Buffer, *BufferSize);
|
Count = SerialPortRead (Buffer, *BufferSize);
|
||||||
*BufferSize = Count;
|
|
||||||
return (Count == 0) ? EFI_DEVICE_ERROR : EFI_SUCCESS;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// No data to return
|
if (Count != *BufferSize) {
|
||||||
*BufferSize = 0;
|
*BufferSize = Count;
|
||||||
|
return EFI_TIMEOUT;
|
||||||
|
}
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user