TianoCore EDK2 master
Loading...
Searching...
No Matches
DebugCommunicationLibSerialPort.c
Go to the documentation of this file.
1
9#include <Base.h>
10
13#include <Library/DebugLib.h>
14
51DEBUG_PORT_HANDLE
52EFIAPI
54 IN VOID *Context,
55 IN DEBUG_PORT_CONTINUE Function
56 )
57{
58 RETURN_STATUS Status;
59
60 Status = SerialPortInitialize ();
61 if (RETURN_ERROR (Status)) {
62 DEBUG ((DEBUG_ERROR, "Debug Serial Port: Initialization failed!\n"));
63 }
64
65 if (Function != NULL) {
66 Function (Context, NULL);
67 }
68
69 return NULL;
70}
71
90EFIAPI
92 IN DEBUG_PORT_HANDLE Handle,
93 IN UINT8 *Buffer,
94 IN UINTN NumberOfBytes,
95 IN UINTN Timeout
96 )
97{
98 if ((NumberOfBytes != 1) || (Buffer == NULL) || (Timeout != 0)) {
99 return 0;
100 }
101
102 return SerialPortRead (Buffer, 1);
103}
104
122UINTN
123EFIAPI
125 IN DEBUG_PORT_HANDLE Handle,
126 IN UINT8 *Buffer,
127 IN UINTN NumberOfBytes
128 )
129{
130 return SerialPortWrite (Buffer, NumberOfBytes);
131}
132
146BOOLEAN
147EFIAPI
149 IN DEBUG_PORT_HANDLE Handle
150 )
151{
152 return SerialPortPoll ();
153}
UINT64 UINTN
BOOLEAN EFIAPI SerialPortPoll(VOID)
UINTN EFIAPI SerialPortRead(OUT UINT8 *Buffer, IN UINTN NumberOfBytes)
RETURN_STATUS EFIAPI SerialPortInitialize(VOID)
Definition: SerialPortLib.c:25
UINTN EFIAPI SerialPortWrite(IN UINT8 *Buffer, IN UINTN NumberOfBytes)
Definition: SerialPortLib.c:52
VOID(EFIAPI * DEBUG_PORT_CONTINUE)(IN VOID *Context, IN DEBUG_PORT_HANDLE DebugPortHandle)
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)
BOOLEAN EFIAPI DebugPortPollBuffer(IN DEBUG_PORT_HANDLE Handle)
UINTN EFIAPI DebugPortWriteBuffer(IN DEBUG_PORT_HANDLE Handle, IN UINT8 *Buffer, IN UINTN NumberOfBytes)
#define NULL
Definition: Base.h:319
#define RETURN_ERROR(StatusCode)
Definition: Base.h:1061
#define IN
Definition: Base.h:279
#define DEBUG(Expression)
Definition: DebugLib.h:434