summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>2012-08-02 14:22:51 +0000
committeroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>2012-08-02 14:22:51 +0000
commitebef1b74218b53f72859b08f1d6710407789a14b (patch)
tree17ac7afb0aac6e45cf8b0fb7c93c3cb992680362
parent93b429fc213bd935b5d90c71e8e8b4523253e445 (diff)
downloadedk2-platforms-ebef1b74218b53f72859b08f1d6710407789a14b.tar.xz
ArmPlatformPkg/PL011Uart: PL011UartWrite() stop to transmit if the buffer is full
Before we were waiting the buffer to be empty before to continue to send data. Signed-off-by: Olivier Martin <olivier.martin@arm.com> git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13587 6f19259b-4bc3-4df7-8a09-765794883524
-rw-r--r--ArmPlatformPkg/Drivers/PL011Uart/PL011Uart.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/ArmPlatformPkg/Drivers/PL011Uart/PL011Uart.c b/ArmPlatformPkg/Drivers/PL011Uart/PL011Uart.c
index d728121b29..1f33bd1ef0 100644
--- a/ArmPlatformPkg/Drivers/PL011Uart/PL011Uart.c
+++ b/ArmPlatformPkg/Drivers/PL011Uart/PL011Uart.c
@@ -304,10 +304,12 @@ PL011UartWrite (
IN UINTN NumberOfBytes
)
{
- UINTN Count;
+ UINT8* CONST Final = &Buffer[NumberOfBytes];
- for (Count = 0; Count < NumberOfBytes; Count++, Buffer++) {
- while ((MmioRead32 (UartBase + UARTFR) & UART_TX_EMPTY_FLAG_MASK) == 0);
+ while (Buffer < Final) {
+ // Wait until UART able to accept another char
+ while ((MmioRead32 (UartBase + UARTFR) & UART_TX_FULL_FLAG_MASK));
+
MmioWrite8 (UartBase + UARTDR, *Buffer);
}