21BOOLEAN gCtrlCBreakFlag =
FALSE;
28BOOLEAN gProcessingFPacket =
FALSE;
48 gCtrlCBreakFlag =
TRUE;
69 if (Packet[0] !=
'F') {
77 for ( ; *Packet !=
'\0' && *Packet !=
','; Packet++) {
80 if (*Packet ==
'\0') {
88 for ( ; *Packet !=
'\0' && *Packet !=
','; Packet++) {
91 if (*Packet ==
'\0') {
95 if (*(++Packet) ==
'C') {
125 BOOLEAN ReceiveDone =
FALSE;
135 Size =
AsciiSPrint (Packet,
sizeof (Packet),
"Fread,%x,%x,%x", FileDescriptor, Buffer, Count);
137 ASSERT (Size <
sizeof (Packet));
139 gProcessingFPacket =
TRUE;
141 Print ((CHAR16 *)L
"Packet sent..\n");
146 Print ((CHAR16 *)L
"Command received..%c\n", Packet[0]);
169 }
while (ReceiveDone ==
FALSE);
172 Print ((CHAR16 *)L
"RetCode: %x..ErrNo: %x..\n", RetCode, ErrNo);
179 gProcessingFPacket =
FALSE;
207 BOOLEAN ReceiveDone =
FALSE;
217 Size =
AsciiSPrint (Packet,
sizeof (Packet),
"Fwrite,%x,%x,%x", FileDescriptor, Buffer, Count);
219 ASSERT (Size <
sizeof (Packet));
222 Print ((CHAR16 *)L
"Packet sent..\n");
227 Print ((CHAR16 *)L
"Command received..%c\n", Packet[0]);
250 }
while (ReceiveDone ==
FALSE);
253 Print ((CHAR16 *)L
"RetCode: %x..ErrNo: %x..\n", RetCode, ErrNo);
312 IN UINT32 ReceiveFifoDepth,
319 return EFI_UNSUPPORTED;
340 return EFI_UNSUPPORTED;
360 return EFI_UNSUPPORTED;
387 SerialDev = GDB_SERIAL_DEV_FROM_THIS (This);
389 Return =
GdbWrite (SerialDev->OutFileDescriptor, Buffer, *BufferSize);
390 if (Return == (
UINTN)-1) {
391 return EFI_DEVICE_ERROR;
394 if (Return != *BufferSize) {
395 *BufferSize = Return;
425 SerialDev = GDB_SERIAL_DEV_FROM_THIS (This);
427 Return =
GdbRead (SerialDev->InFileDescriptor, Buffer, *BufferSize);
428 if (Return == (
UINTN)-1) {
429 return EFI_DEVICE_ERROR;
432 if (Return != *BufferSize) {
433 *BufferSize = Return;
443 GDB_SERIAL_DEV_SIGNATURE,
447 SERIAL_IO_INTERFACE_REVISION,
475 EFI_SERIAL_IO_PROTOCOL_GUID
479 END_DEVICE_PATH_TYPE,
480 END_ENTIRE_DEVICE_PATH_SUBTYPE,
508 ASSERT (StdOutSerialDev !=
NULL);
511 StdOutSerialDev->SerialIo.
Mode = &StdOutSerialDev->SerialMode;
514 ASSERT (StdErrSerialDev !=
NULL);
517 StdErrSerialDev->SerialIo.
Mode = &StdErrSerialDev->SerialMode;
518 StdErrSerialDev->DevicePath.Index = 1;
519 StdErrSerialDev->OutFileDescriptor = GDB_STDERR;
522 Status =
gBS->InstallMultipleProtocolInterfaces (
523 &StdOutSerialDev->Handle,
524 &gEfiSerialIoProtocolGuid,
525 &StdOutSerialDev->SerialIo,
526 &gEfiDevicePathProtocolGuid,
527 &StdOutSerialDev->DevicePath,
533 Status =
gBS->InstallMultipleProtocolInterfaces (
534 &StdErrSerialDev->Handle,
535 &gEfiSerialIoProtocolGuid,
536 &StdErrSerialDev->SerialIo,
537 &gEfiDevicePathProtocolGuid,
538 &StdErrSerialDev->DevicePath,
UINTN EFIAPI AsciiStrHexToUintn(IN CONST CHAR8 *String)
#define HARDWARE_DEVICE_PATH
VOID GdbInitializeSerialConsole(VOID)
EFI_STATUS EFIAPI GdbSerialGetControl(IN EFI_SERIAL_IO_PROTOCOL *This, OUT UINT32 *Control)
VOID GdbCtrlCBreakMessage(IN UINTN ErrNo)
EFI_STATUS EFIAPI GdbSerialRead(IN EFI_SERIAL_IO_PROTOCOL *This, IN OUT UINTN *BufferSize, OUT VOID *Buffer)
INTN GdbParseFReplyPacket(IN CHAR8 *Packet, OUT UINTN *ErrNo)
EFI_STATUS EFIAPI GdbSerialReset(IN EFI_SERIAL_IO_PROTOCOL *This)
EFI_STATUS EFIAPI GdbSerialWrite(IN EFI_SERIAL_IO_PROTOCOL *This, IN OUT UINTN *BufferSize, IN VOID *Buffer)
EFI_STATUS EFIAPI GdbSerialSetAttributes(IN EFI_SERIAL_IO_PROTOCOL *This, IN UINT64 BaudRate, IN UINT32 ReceiveFifoDepth, IN UINT32 Timeout, IN EFI_PARITY_TYPE Parity, IN UINT8 DataBits, IN EFI_STOP_BITS_TYPE StopBits)
INTN GdbWrite(IN INTN FileDescriptor, OUT CONST VOID *Buffer, IN UINTN Count)
EFI_STATUS EFIAPI GdbSerialSetControl(IN EFI_SERIAL_IO_PROTOCOL *This, IN UINT32 Control)
INTN GdbRead(IN INTN FileDescriptor, OUT VOID *Buffer, IN UINTN Count)
VOID *EFIAPI AllocateCopyPool(IN UINTN AllocationSize, IN CONST VOID *Buffer)
VOID EFIAPI WriteToMemory(IN CHAR8 *PacketData)
VOID EFIAPI ReadFromMemory(CHAR8 *PacketData)
VOID EFIAPI SendNotSupported(VOID)
UINTN SendPacket(IN CHAR8 *PacketData)
UINTN ReceivePacket(OUT CHAR8 *PacketData, IN UINTN PacketDataSize)
VOID EFIAPI SendError(IN UINT8 ErrorNum)
UINTN EFIAPI AsciiSPrint(OUT CHAR8 *StartOfBuffer, IN UINTN BufferSize, IN CONST CHAR8 *FormatString,...)
#define ASSERT_EFI_ERROR(StatusParameter)
UINTN EFIAPI Print(IN CONST CHAR16 *Format,...)
EFI_SERIAL_IO_MODE * Mode