Serial I/O Port library functions with no library constructor/destructor\r
\r
Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.<BR>\r
- Copyright (c) 2011 - 2012, ARM Ltd. All rights reserved.<BR>\r
+ Copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.<BR>\r
\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
UINT32 LineControl;\r
UINT32 Divisor;\r
\r
- // The BaudRate must be passed\r
- if (BaudRate == 0) {\r
- return RETURN_INVALID_PARAMETER;\r
- }\r
-\r
LineControl = 0;\r
\r
// The PL011 supports a buffer of either 1 or 32 chars. Therefore we can accept\r
//\r
// Baud Rate\r
//\r
- if (PcdGet32(PL011UartInteger) != 0) {\r
- MmioWrite32 (UartBase + UARTIBRD, PcdGet32(PL011UartInteger));\r
- MmioWrite32 (UartBase + UARTFBRD, PcdGet32(PL011UartFractional));\r
- } else {\r
+\r
+ // If BaudRate is zero then use default baud rate\r
+ if (BaudRate == 0) {\r
+ if (PcdGet32 (PL011UartInteger) != 0) {\r
+ MmioWrite32 (UartBase + UARTIBRD, PcdGet32 (PL011UartInteger));\r
+ MmioWrite32 (UartBase + UARTFBRD, PcdGet32 (PL011UartFractional));\r
+ } else {\r
+ BaudRate = PcdGet32 (PcdSerialBaudRate);\r
+ ASSERT (BaudRate != 0);\r
+ }\r
+ }\r
+\r
+ // If BaudRate != 0 then we must calculate the divisor from the value\r
+ if (BaudRate != 0) {\r
Divisor = (PcdGet32 (PL011UartClkInHz) * 4) / BaudRate;\r
MmioWrite32 (UartBase + UARTIBRD, Divisor >> 6);\r
MmioWrite32 (UartBase + UARTFBRD, Divisor & 0x3F);\r
# \r
# Component description file for PL011Uart module\r
# \r
-# Copyright (c) 2011-2012, ARM Ltd. All rights reserved.<BR>\r
+# Copyright (c) 2011-2013, ARM Ltd. All rights reserved.<BR>\r
# \r
# This program and the accompanying materials\r
# are licensed and made available under the terms and conditions of the BSD License\r
\r
[Packages]\r
MdePkg/MdePkg.dec\r
+ MdeModulePkg/MdeModulePkg.dec\r
ArmPlatformPkg/ArmPlatformPkg.dec\r
\r
[Pcd]\r
+ gEfiMdeModulePkgTokenSpaceGuid.PcdSerialBaudRate\r
+\r
gArmPlatformTokenSpaceGuid.PL011UartClkInHz\r
gArmPlatformTokenSpaceGuid.PL011UartInteger\r
gArmPlatformTokenSpaceGuid.PL011UartFractional\r