From a891a3c8d482b82c3836f87796ff622f46c48545 Mon Sep 17 00:00:00 2001 From: Guo Mang Date: Fri, 23 Dec 2016 13:33:16 +0800 Subject: BroxtonPlatformPkg: Add package Include and Library Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Guo Mang --- .../BaseSerialPortParameterLibCmos.c | 74 ++++++++++++++++++++++ .../BaseSerialPortParameterLibCmos.inf | 38 +++++++++++ 2 files changed, 112 insertions(+) create mode 100644 Platform/BroxtonPlatformPkg/Common/Library/BaseSerialPortParameterLibCmos/BaseSerialPortParameterLibCmos.c create mode 100644 Platform/BroxtonPlatformPkg/Common/Library/BaseSerialPortParameterLibCmos/BaseSerialPortParameterLibCmos.inf (limited to 'Platform/BroxtonPlatformPkg/Common/Library/BaseSerialPortParameterLibCmos') 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.
+ + 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 +#include +#include + + +/** + 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.
+# +# 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 + -- cgit v1.2.3