TianoCore EDK2 master
|
Go to the source code of this file.
Typedefs | |
typedef VOID * | DEBUG_PORT_HANDLE |
typedef VOID(EFIAPI * | DEBUG_PORT_CONTINUE) (IN VOID *Context, IN DEBUG_PORT_HANDLE DebugPortHandle) |
Functions | |
DEBUG_PORT_HANDLE EFIAPI | DebugPortInitialize (IN VOID *Context, IN DEBUG_PORT_CONTINUE Function) |
UINTN EFIAPI | DebugPortReadBuffer (IN DEBUG_PORT_HANDLE Handle, IN UINT8 *Buffer, IN UINTN NumberOfBytes, IN UINTN Timeout) |
UINTN EFIAPI | DebugPortWriteBuffer (IN DEBUG_PORT_HANDLE Handle, IN UINT8 *Buffer, IN UINTN NumberOfBytes) |
BOOLEAN EFIAPI | DebugPortPollBuffer (IN DEBUG_PORT_HANDLE Handle) |
Debug Communication Library definitions.
Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file DebugCommunicationLib.h.
Caller provided function to be invoked at the end of DebugPortInitialize().
Refer to the description for DebugPortInitialize() for more details.
[in] | Context | The first input argument of DebugPortInitialize(). |
[in] | DebugPortHandle | Debug port handle created by Debug Communication Library. |
Definition at line 24 of file DebugCommunicationLib.h.
typedef VOID* DEBUG_PORT_HANDLE |
Definition at line 12 of file DebugCommunicationLib.h.
DEBUG_PORT_HANDLE EFIAPI DebugPortInitialize | ( | IN VOID * | Context, |
IN DEBUG_PORT_CONTINUE | Function | ||
) |
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.
[in] | Context | Context needed by callback function; it was optional. |
[in] | Function | Continue function called by Debug Communication library; it was optional. |
Initialize the debug port.
If Function is not NULL, Debug Communication Library will call this function by passing in the Context to be the first parameter. If needed, Debug Communication Library will create one debug port handle to be the second argument passing in calling the Function, otherwise it will pass NULL to be the second argument of Function.
If Function is NULL, and Context is not NULL, the Debug Communication Library could a) Return the same handle as passed in (as Context parameter). b) Ignore the input Context parameter and create new handle to be returned.
If parameter Function is NULL and Context is NULL, Debug Communication Library could created a new handle if needed and return it, otherwise it will return NULL.
[in] | Context | Context needed by callback function; it was optional. |
[in] | Function | Continue function called by Debug Communication library; it was optional. |
Definition at line 53 of file DebugCommunicationLibSerialPort.c.
BOOLEAN EFIAPI DebugPortPollBuffer | ( | IN DEBUG_PORT_HANDLE | Handle | ) |
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.
Handle | Debug port handle. |
TRUE | Data is waiting to be read from the debug device. |
FALSE | There is no data waiting to be read from the debug device. |
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.
Handle | Debug port handle. |
TRUE | Data is waiting to be read from the debug device. |
FALSE | There is no data waiting to be read from the serial device. |
Definition at line 148 of file DebugCommunicationLibSerialPort.c.
UINTN EFIAPI DebugPortReadBuffer | ( | IN DEBUG_PORT_HANDLE | Handle, |
IN UINT8 * | Buffer, | ||
IN UINTN | NumberOfBytes, | ||
IN UINTN | Timeout | ||
) |
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.
Handle | Debug port handle. |
Buffer | Pointer to the data buffer to store the data read from the debug device. |
NumberOfBytes | Number of bytes which will be read. |
Timeout | Timeout value for reading from debug device. Its unit is Microsecond. |
0 | Read data failed, no data is to be read. |
>0 | Actual number of bytes read from debug device. |
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.
Handle | Debug port handle. |
Buffer | Pointer to the data buffer to store the data read from the debug device. |
NumberOfBytes | Number of bytes which will be read. |
Timeout | Timeout value for reading from debug device. It unit is Microsecond. |
0 | Read data failed, no data is to be read. |
>0 | Actual number of bytes read from debug device. |
Read data from debug device and save the data in 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.
Handle | Debug port handle. |
Buffer | Pointer to the data buffer to store the data read from the debug device. |
NumberOfBytes | Number of bytes which will be read. |
Timeout | Timeout value for reading from debug device. Its unit is Microsecond. |
0 | Read data failed, no data is to be read. |
>0 | Actual number of bytes read from debug device. |
Definition at line 91 of file DebugCommunicationLibSerialPort.c.
UINTN EFIAPI DebugPortWriteBuffer | ( | IN DEBUG_PORT_HANDLE | Handle, |
IN UINT8 * | Buffer, | ||
IN UINTN | NumberOfBytes | ||
) |
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.
Handle | Debug port handle. |
Buffer | Pointer to the data buffer to be written. |
NumberOfBytes | Number of bytes to written to the debug device. |
0 | NumberOfBytes is 0. |
>0 | The number of bytes written to the debug device. If this value is less than NumberOfBytes, then the write operation failed. |
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.
Handle | Debug port handle. |
Buffer | Pointer to the data buffer to be written. |
NumberOfBytes | Number of bytes to written to the debug device. |
0 | NumberOfBytes is 0. |
>0 | The number of bytes written to the debug device. If this value is less than NumberOfBytes, then the read operation failed. |
Definition at line 124 of file DebugCommunicationLibSerialPort.c.