summaryrefslogtreecommitdiff
path: root/Platform/BroxtonPlatformPkg/Common/Library/BaseSerialPortParameterLibCmos
diff options
context:
space:
mode:
authorGuo Mang <mang.guo@intel.com>2016-12-23 13:33:16 +0800
committerGuo Mang <mang.guo@intel.com>2016-12-26 19:15:13 +0800
commita891a3c8d482b82c3836f87796ff622f46c48545 (patch)
treefe20e8981abbf0b903342e13d3fc8fe200b623b4 /Platform/BroxtonPlatformPkg/Common/Library/BaseSerialPortParameterLibCmos
parentd2a217ee6f815e569ea1ab8fd9f0070a80465f43 (diff)
downloadedk2-platforms-a891a3c8d482b82c3836f87796ff622f46c48545.tar.xz
BroxtonPlatformPkg: Add package Include and Library
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Guo Mang <mang.guo@intel.com>
Diffstat (limited to 'Platform/BroxtonPlatformPkg/Common/Library/BaseSerialPortParameterLibCmos')
-rw-r--r--Platform/BroxtonPlatformPkg/Common/Library/BaseSerialPortParameterLibCmos/BaseSerialPortParameterLibCmos.c74
-rw-r--r--Platform/BroxtonPlatformPkg/Common/Library/BaseSerialPortParameterLibCmos/BaseSerialPortParameterLibCmos.inf38
2 files changed, 112 insertions, 0 deletions
diff --git a/Platform/BroxtonPlatformPkg/Common/Library/BaseSerialPortParameterLibCmos/BaseSerialPortParameterLibCmos.c b/Platform/BroxtonPlatformPkg/Common/Library/BaseSerialPortParameterLibCmos/BaseSerialPortParameterLibCmos.c
new file mode 100644
index 0000000000..97e56daa2b
--- /dev/null
+++ b/Platform/BroxtonPlatformPkg/Common/Library/BaseSerialPortParameterLibCmos/BaseSerialPortParameterLibCmos.c
@@ -0,0 +1,74 @@
+/** @file
+ DebugPrintErrorLevel access library instance.
+
+ Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.<BR>
+
+ This program and the accompanying materials
+ are licensed and made available under the terms and conditions of the BSD License
+ which accompanies this distribution. The full text of the license may be found at
+ http://opensource.org/licenses/bsd-license.php.
+
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#include <Base.h>
+#include <Library/PcdLib.h>
+#include <Library/CmosAccessLib.h>
+
+
+/**
+ Returns the serial port baud rate.
+
+ @return Baud rate of serial port.
+
+**/
+UINT32
+EFIAPI
+GetSerialPortBaudRate (
+ VOID
+ )
+{
+ return ReadCmos32 (PcdGet8 (PcdSerialBaudRateCmosIndex));
+}
+
+
+/**
+ Sets the serial port baud rate value.
+
+ @param[in] Baud rate value to be set.
+
+ @retval TRUE The baud rate of serial port was sucessfully set.
+ @retval FALSE The baud rate of serial port could not be set.
+
+**/
+BOOLEAN
+EFIAPI
+SetSerialPortBaudRate (
+ UINT32 BaudRate
+ )
+{
+ RETURN_STATUS Status;
+
+ Status = WriteCmos32 (PcdGet8 (PcdSerialBaudRateCmosIndex), BaudRate);
+ return (BOOLEAN) (Status == RETURN_SUCCESS);
+}
+
+
+UINT8
+GetDebugInterface (
+ )
+{
+ return ReadCmos8 (PcdGet8 (PcdStatusCodeFlagsCmosIndex));
+}
+
+
+VOID
+SetDebugInterface (
+ UINT8 DebugInterface
+ )
+{
+ WriteCmos8 (PcdGet8 (PcdStatusCodeFlagsCmosIndex), DebugInterface);
+}
+
diff --git a/Platform/BroxtonPlatformPkg/Common/Library/BaseSerialPortParameterLibCmos/BaseSerialPortParameterLibCmos.inf b/Platform/BroxtonPlatformPkg/Common/Library/BaseSerialPortParameterLibCmos/BaseSerialPortParameterLibCmos.inf
new file mode 100644
index 0000000000..8d29686193
--- /dev/null
+++ b/Platform/BroxtonPlatformPkg/Common/Library/BaseSerialPortParameterLibCmos/BaseSerialPortParameterLibCmos.inf
@@ -0,0 +1,38 @@
+## @file
+# Get and/or set serial Port baud rate.
+#
+# Copyright (c) 2011 - 2016, Intel Corporation. All rights reserved.<BR>
+#
+# This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution. The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php.
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+##
+
+[Defines]
+ INF_VERSION = 0x00010017
+ BASE_NAME = BaseSerialPortParameterLibCmos
+ FILE_GUID = D9C952F8-87FD-4e0b-ADC7-95AD85B9B795
+ VERSION_STRING = 1.0
+ MODULE_TYPE = BASE
+ LIBRARY_CLASS = SerialPortParameterLib
+
+[LibraryClasses]
+ BaseLib
+ CmosAccessLib
+
+[Packages]
+ MdePkg/MdePkg.dec
+ BroxtonPlatformPkg/PlatformPkg.dec
+
+[Pcd]
+ gClientCommonModuleTokenSpaceGuid.PcdSerialBaudRateCmosIndex
+ gClientCommonModuleTokenSpaceGuid.PcdStatusCodeFlagsCmosIndex
+
+[Sources]
+ BaseSerialPortParameterLibCmos.c
+