]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ArmPlatformPkg/PL011Uart: PL011UartWrite() stop to transmit if the buffer is full
authoroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 2 Aug 2012 14:22:51 +0000 (14:22 +0000)
committeroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 2 Aug 2012 14:22:51 +0000 (14:22 +0000)
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

ArmPlatformPkg/Drivers/PL011Uart/PL011Uart.c

index d728121b299fb156f42b935e538267d9ae0a58bd..1f33bd1ef09d9b1eb7d977ce3864b3982a819cf9 100644 (file)
@@ -304,10 +304,12 @@ PL011UartWrite (
   IN UINTN     NumberOfBytes\r
   )\r
 {\r
-  UINTN  Count;\r
+  UINT8* CONST Final = &Buffer[NumberOfBytes];\r
 \r
-  for (Count = 0; Count < NumberOfBytes; Count++, Buffer++) {\r
-    while ((MmioRead32 (UartBase + UARTFR) & UART_TX_EMPTY_FLAG_MASK) == 0);\r
+  while (Buffer < Final) {\r
+    // Wait until UART able to accept another char\r
+    while ((MmioRead32 (UartBase + UARTFR) & UART_TX_FULL_FLAG_MASK));\r
+    \r
     MmioWrite8 (UartBase + UARTDR, *Buffer);\r
   }\r
 \r