summaryrefslogtreecommitdiff
path: root/SourceLevelDebugPkg/Library/DebugCommunicationLibSerialPort
diff options
context:
space:
mode:
authorkx <kx@radix.pro>2024-06-04 06:43:08 +0300
committerkx <kx@radix.pro>2024-06-04 06:43:08 +0300
commit7e2ccccace24636f29ddc210b94606abd4c7e42b (patch)
tree545d43ea12671048956cafeb12303e84d601e571 /SourceLevelDebugPkg/Library/DebugCommunicationLibSerialPort
parent27b044605cd5f6b33a3d231576003850b3fe305b (diff)
downloadedk2-trunk.tar.xz
Renormalized end-of-lines from master@27b044605cd5f6b33a3d231576003850b3fe305btrunk
Diffstat (limited to 'SourceLevelDebugPkg/Library/DebugCommunicationLibSerialPort')
-rw-r--r--SourceLevelDebugPkg/Library/DebugCommunicationLibSerialPort/DebugCommunicationLibSerialPort.c306
-rw-r--r--SourceLevelDebugPkg/Library/DebugCommunicationLibSerialPort/DebugCommunicationLibSerialPort.inf66
-rw-r--r--SourceLevelDebugPkg/Library/DebugCommunicationLibSerialPort/DebugCommunicationLibSerialPort.uni32
3 files changed, 202 insertions, 202 deletions
diff --git a/SourceLevelDebugPkg/Library/DebugCommunicationLibSerialPort/DebugCommunicationLibSerialPort.c b/SourceLevelDebugPkg/Library/DebugCommunicationLibSerialPort/DebugCommunicationLibSerialPort.c
index 9953904725..c7794ee031 100644
--- a/SourceLevelDebugPkg/Library/DebugCommunicationLibSerialPort/DebugCommunicationLibSerialPort.c
+++ b/SourceLevelDebugPkg/Library/DebugCommunicationLibSerialPort/DebugCommunicationLibSerialPort.c
@@ -1,153 +1,153 @@
-/** @file
- Debug Port Library implementation based on serial port.
-
- Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#include <Base.h>
-
-#include <Library/DebugCommunicationLib.h>
-#include <Library/SerialPortLib.h>
-#include <Library/DebugLib.h>
-
-/**
- Initialize the debug port.
-
- This function will initialize debug port to get it ready for data transmission. If
- certain Debug Communication Library instance has to save some private data in the
- stack, this function must work on the mode that doesn't return to the caller, then
- the caller needs to wrap up all rest of logic after DebugPortInitialize() into one
- function and pass it into DebugPortInitialize(). DebugPortInitialize() is
- responsible to invoke the passing-in function at the end of DebugPortInitialize().
-
- If the parameter Function is not NULL, Debug Communication Library instance will
- invoke it by passing in the Context to be the first parameter. Debug Communication
- Library instance could create one debug port handle to be the second parameter
- passing into the Function. Debug Communication Library instance also could pass
- NULL to be the second parameter if it doesn't create the debug port handle.
-
- If the parameter Function is NULL, and Context is not NULL. At this time, Context
- is the debug port handle created by the previous Debug Communication Library
- instance.
- a) If the instance can understand and continue use the private data of the previous
- instance, it could return the same handle as passed in (as Context parameter).
- b) If the instance does not understand, or does not want to continue use the
- private data of the previous instance, it could ignore the input Context parameter
- and create the new handle to be returned.
-
- If Function() is NULL and Context is NULL, Debug Communication Library could create a
- new handle and return it. NULL is also a valid handle to be returned.
-
- @param[in] Context Context needed by callback function; it was optional.
- @param[in] Function Continue function called by Debug Communication library;
- it was optional.
-
- @return The debug port handle created by Debug Communication Library if Function
- is not NULL.
-
-**/
-DEBUG_PORT_HANDLE
-EFIAPI
-DebugPortInitialize (
- IN VOID *Context,
- IN DEBUG_PORT_CONTINUE Function
- )
-{
- RETURN_STATUS Status;
-
- Status = SerialPortInitialize ();
- if (RETURN_ERROR (Status)) {
- DEBUG ((DEBUG_ERROR, "Debug Serial Port: Initialization failed!\n"));
- }
-
- if (Function != NULL) {
- Function (Context, NULL);
- }
-
- return NULL;
-}
-
-/**
- Read data from debug device and save the data in a buffer.
-
- Reads NumberOfBytes data bytes from a debug device into the buffer
- specified by Buffer. The number of bytes actually read is returned.
- If the return value is less than NumberOfBytes, then the rest operation failed.
- If NumberOfBytes is zero, then return 0.
-
- @param Handle Debug port handle.
- @param Buffer Pointer to the data buffer to store the data read from the debug device.
- @param NumberOfBytes Number of bytes which will be read.
- @param Timeout Timeout value for reading from debug device. It unit is Microsecond.
-
- @retval 0 Read data failed, no data is to be read.
- @retval >0 Actual number of bytes read from debug device.
-
-**/
-UINTN
-EFIAPI
-DebugPortReadBuffer (
- IN DEBUG_PORT_HANDLE Handle,
- IN UINT8 *Buffer,
- IN UINTN NumberOfBytes,
- IN UINTN Timeout
- )
-{
- if ((NumberOfBytes != 1) || (Buffer == NULL) || (Timeout != 0)) {
- return 0;
- }
-
- return SerialPortRead (Buffer, 1);
-}
-
-/**
- Write data from buffer to debug device.
-
- Writes NumberOfBytes data bytes from Buffer to the debug device.
- The number of bytes actually written to the debug device is returned.
- If the return value is less than NumberOfBytes, then the write operation failed.
- If NumberOfBytes is zero, then return 0.
-
- @param Handle Debug port handle.
- @param Buffer Pointer to the data buffer to be written.
- @param NumberOfBytes Number of bytes to written to the debug device.
-
- @retval 0 NumberOfBytes is 0.
- @retval >0 The number of bytes written to the debug device.
- If this value is less than NumberOfBytes, then the read operation failed.
-
-**/
-UINTN
-EFIAPI
-DebugPortWriteBuffer (
- IN DEBUG_PORT_HANDLE Handle,
- IN UINT8 *Buffer,
- IN UINTN NumberOfBytes
- )
-{
- return SerialPortWrite (Buffer, NumberOfBytes);
-}
-
-/**
- Polls a debug device to see if there is any data waiting to be read.
-
- Polls a debug device to see if there is any data waiting to be read.
- If there is data waiting to be read from the debug device, then TRUE is returned.
- If there is no data waiting to be read from the debug device, then FALSE is returned.
-
- @param Handle Debug port handle.
-
- @retval TRUE Data is waiting to be read from the debug device.
- @retval FALSE There is no data waiting to be read from the serial device.
-
-**/
-BOOLEAN
-EFIAPI
-DebugPortPollBuffer (
- IN DEBUG_PORT_HANDLE Handle
- )
-{
- return SerialPortPoll ();
-}
+/** @file
+ Debug Port Library implementation based on serial port.
+
+ Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <Base.h>
+
+#include <Library/DebugCommunicationLib.h>
+#include <Library/SerialPortLib.h>
+#include <Library/DebugLib.h>
+
+/**
+ Initialize the debug port.
+
+ This function will initialize debug port to get it ready for data transmission. If
+ certain Debug Communication Library instance has to save some private data in the
+ stack, this function must work on the mode that doesn't return to the caller, then
+ the caller needs to wrap up all rest of logic after DebugPortInitialize() into one
+ function and pass it into DebugPortInitialize(). DebugPortInitialize() is
+ responsible to invoke the passing-in function at the end of DebugPortInitialize().
+
+ If the parameter Function is not NULL, Debug Communication Library instance will
+ invoke it by passing in the Context to be the first parameter. Debug Communication
+ Library instance could create one debug port handle to be the second parameter
+ passing into the Function. Debug Communication Library instance also could pass
+ NULL to be the second parameter if it doesn't create the debug port handle.
+
+ If the parameter Function is NULL, and Context is not NULL. At this time, Context
+ is the debug port handle created by the previous Debug Communication Library
+ instance.
+ a) If the instance can understand and continue use the private data of the previous
+ instance, it could return the same handle as passed in (as Context parameter).
+ b) If the instance does not understand, or does not want to continue use the
+ private data of the previous instance, it could ignore the input Context parameter
+ and create the new handle to be returned.
+
+ If Function() is NULL and Context is NULL, Debug Communication Library could create a
+ new handle and return it. NULL is also a valid handle to be returned.
+
+ @param[in] Context Context needed by callback function; it was optional.
+ @param[in] Function Continue function called by Debug Communication library;
+ it was optional.
+
+ @return The debug port handle created by Debug Communication Library if Function
+ is not NULL.
+
+**/
+DEBUG_PORT_HANDLE
+EFIAPI
+DebugPortInitialize (
+ IN VOID *Context,
+ IN DEBUG_PORT_CONTINUE Function
+ )
+{
+ RETURN_STATUS Status;
+
+ Status = SerialPortInitialize ();
+ if (RETURN_ERROR (Status)) {
+ DEBUG ((DEBUG_ERROR, "Debug Serial Port: Initialization failed!\n"));
+ }
+
+ if (Function != NULL) {
+ Function (Context, NULL);
+ }
+
+ return NULL;
+}
+
+/**
+ Read data from debug device and save the data in a buffer.
+
+ Reads NumberOfBytes data bytes from a debug device into the buffer
+ specified by Buffer. The number of bytes actually read is returned.
+ If the return value is less than NumberOfBytes, then the rest operation failed.
+ If NumberOfBytes is zero, then return 0.
+
+ @param Handle Debug port handle.
+ @param Buffer Pointer to the data buffer to store the data read from the debug device.
+ @param NumberOfBytes Number of bytes which will be read.
+ @param Timeout Timeout value for reading from debug device. It unit is Microsecond.
+
+ @retval 0 Read data failed, no data is to be read.
+ @retval >0 Actual number of bytes read from debug device.
+
+**/
+UINTN
+EFIAPI
+DebugPortReadBuffer (
+ IN DEBUG_PORT_HANDLE Handle,
+ IN UINT8 *Buffer,
+ IN UINTN NumberOfBytes,
+ IN UINTN Timeout
+ )
+{
+ if ((NumberOfBytes != 1) || (Buffer == NULL) || (Timeout != 0)) {
+ return 0;
+ }
+
+ return SerialPortRead (Buffer, 1);
+}
+
+/**
+ Write data from buffer to debug device.
+
+ Writes NumberOfBytes data bytes from Buffer to the debug device.
+ The number of bytes actually written to the debug device is returned.
+ If the return value is less than NumberOfBytes, then the write operation failed.
+ If NumberOfBytes is zero, then return 0.
+
+ @param Handle Debug port handle.
+ @param Buffer Pointer to the data buffer to be written.
+ @param NumberOfBytes Number of bytes to written to the debug device.
+
+ @retval 0 NumberOfBytes is 0.
+ @retval >0 The number of bytes written to the debug device.
+ If this value is less than NumberOfBytes, then the read operation failed.
+
+**/
+UINTN
+EFIAPI
+DebugPortWriteBuffer (
+ IN DEBUG_PORT_HANDLE Handle,
+ IN UINT8 *Buffer,
+ IN UINTN NumberOfBytes
+ )
+{
+ return SerialPortWrite (Buffer, NumberOfBytes);
+}
+
+/**
+ Polls a debug device to see if there is any data waiting to be read.
+
+ Polls a debug device to see if there is any data waiting to be read.
+ If there is data waiting to be read from the debug device, then TRUE is returned.
+ If there is no data waiting to be read from the debug device, then FALSE is returned.
+
+ @param Handle Debug port handle.
+
+ @retval TRUE Data is waiting to be read from the debug device.
+ @retval FALSE There is no data waiting to be read from the serial device.
+
+**/
+BOOLEAN
+EFIAPI
+DebugPortPollBuffer (
+ IN DEBUG_PORT_HANDLE Handle
+ )
+{
+ return SerialPortPoll ();
+}
diff --git a/SourceLevelDebugPkg/Library/DebugCommunicationLibSerialPort/DebugCommunicationLibSerialPort.inf b/SourceLevelDebugPkg/Library/DebugCommunicationLibSerialPort/DebugCommunicationLibSerialPort.inf
index 21af18cfb0..143fa2eef4 100644
--- a/SourceLevelDebugPkg/Library/DebugCommunicationLibSerialPort/DebugCommunicationLibSerialPort.inf
+++ b/SourceLevelDebugPkg/Library/DebugCommunicationLibSerialPort/DebugCommunicationLibSerialPort.inf
@@ -1,33 +1,33 @@
-## @file
-# Debug Communication Library instance based on serial port.
-#
-# Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR>
-#
-# SPDX-License-Identifier: BSD-2-Clause-Patent
-#
-#
-##
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = DebugCommunicationLibSerialPort
- MODULE_UNI_FILE = DebugCommunicationLibSerialPort.uni
- FILE_GUID = 8CC435C5-6330-4269-B0C3-E3BD05C86FB8
- MODULE_TYPE = BASE
- VERSION_STRING = 0.7
- LIBRARY_CLASS = DebugCommunicationLib
-
-#
-# VALID_ARCHITECTURES = IA32 X64
-#
-
-[Sources.common]
- DebugCommunicationLibSerialPort.c
-
-[Packages]
- MdePkg/MdePkg.dec
- SourceLevelDebugPkg/SourceLevelDebugPkg.dec
-
-[LibraryClasses]
- SerialPortLib
- DebugLib
+## @file
+# Debug Communication Library instance based on serial port.
+#
+# Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+#
+##
+
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = DebugCommunicationLibSerialPort
+ MODULE_UNI_FILE = DebugCommunicationLibSerialPort.uni
+ FILE_GUID = 8CC435C5-6330-4269-B0C3-E3BD05C86FB8
+ MODULE_TYPE = BASE
+ VERSION_STRING = 0.7
+ LIBRARY_CLASS = DebugCommunicationLib
+
+#
+# VALID_ARCHITECTURES = IA32 X64
+#
+
+[Sources.common]
+ DebugCommunicationLibSerialPort.c
+
+[Packages]
+ MdePkg/MdePkg.dec
+ SourceLevelDebugPkg/SourceLevelDebugPkg.dec
+
+[LibraryClasses]
+ SerialPortLib
+ DebugLib
diff --git a/SourceLevelDebugPkg/Library/DebugCommunicationLibSerialPort/DebugCommunicationLibSerialPort.uni b/SourceLevelDebugPkg/Library/DebugCommunicationLibSerialPort/DebugCommunicationLibSerialPort.uni
index 4bea6d51e0..cf56ff28bd 100644
--- a/SourceLevelDebugPkg/Library/DebugCommunicationLibSerialPort/DebugCommunicationLibSerialPort.uni
+++ b/SourceLevelDebugPkg/Library/DebugCommunicationLibSerialPort/DebugCommunicationLibSerialPort.uni
@@ -1,16 +1,16 @@
-// /** @file
-// Debug Communication Library instance based on serial port.
-//
-// Debug Communication Library instance based on serial port.
-//
-// Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR>
-//
-// SPDX-License-Identifier: BSD-2-Clause-Patent
-//
-// **/
-
-
-#string STR_MODULE_ABSTRACT #language en-US "Debug Communication Library instance based on serial port"
-
-#string STR_MODULE_DESCRIPTION #language en-US "Debug Communication Library instance based on serial port."
-
+// /** @file
+// Debug Communication Library instance based on serial port.
+//
+// Debug Communication Library instance based on serial port.
+//
+// Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR>
+//
+// SPDX-License-Identifier: BSD-2-Clause-Patent
+//
+// **/
+
+
+#string STR_MODULE_ABSTRACT #language en-US "Debug Communication Library instance based on serial port"
+
+#string STR_MODULE_DESCRIPTION #language en-US "Debug Communication Library instance based on serial port."
+