52 IN UINT64 Timeout OPTIONAL
64 Status =
gBS->CreateEvent (EVT_TIMER, 0,
NULL,
NULL, &TimerEvent);
65 if (!EFI_ERROR (Status)) {
79 WaitList[1] = TimerEvent;
80 Status =
gBS->WaitForEvent (2, WaitList, &Index);
81 gBS->CloseEvent (TimerEvent);
86 if (!EFI_ERROR (Status) && (Index == 1)) {
94 Status =
gBS->WaitForEvent (1, &Event, &Index);
95 ASSERT (!EFI_ERROR (Status));
119 ASSERT (Column !=
NULL);
120 ASSERT (Row !=
NULL);
126 (*Column) = LineLength - 1;
158 ASSERT (Column !=
NULL);
159 ASSERT (Row !=
NULL);
165 if (*Column >= LineLength) {
167 if ((*Row) < TotalRow - 1) {
173CHAR16 mBackupSpace[EFI_DEBUG_INPUS_BUFFER_SIZE];
174CHAR16 mInputBufferHistory[EFI_DEBUG_INPUS_BUFFER_SIZE];
188 IN CHAR16 *Prompt OPTIONAL,
219 ASSERT (ConOut !=
NULL);
220 ASSERT (ConIn !=
NULL);
221 ASSERT (InStr !=
NULL);
223 if (Prompt !=
NULL) {
224 ConOut->OutputString (ConOut, Prompt);
248 StartColumn = ConOut->Mode->CursorColumn;
249 Column = StartColumn;
250 Row = ConOut->Mode->CursorRow;
251 ConOut->QueryMode (ConOut, ConOut->Mode->Mode, &LineLength, &TotalRow);
252 if (LineLength == 0) {
256 SetMem (InStr, StrLength *
sizeof (CHAR16), 0);
263 ConIn->ReadKeyStroke (ConIn, &Key);
265 switch (Key.UnicodeChar) {
266 case CHAR_CARRIAGE_RETURN:
270 TailRow = Row + (Len - StrPos + Column) / LineLength;
271 TailColumn = (Len - StrPos + Column) % LineLength;
284 CopyMem (InStr + StrPos, InStr + StrPos + 1,
sizeof (CHAR16) * (Len - StrPos));
297 if (Key.UnicodeChar >=
' ') {
301 if ((Len == StrLength - 1) && (InsertMode || (StrPos == Len))) {
311 for (Index = Len; Index > StrPos; Index -= 1) {
312 InStr[Index] = InStr[Index - 1];
316 InStr[StrPos] = Key.UnicodeChar;
326 switch (Key.ScanCode) {
334 CopyMem (InStr + StrPos, InStr + StrPos + 1,
sizeof (CHAR16) * (Len - StrPos));
367 Row -= (StrPos + StartColumn) / LineLength;
368 Column = StartColumn;
376 TailRow = Row + (Len - StrPos + Column) / LineLength;
377 TailColumn = (Len - StrPos + Column) % LineLength;
390 Row -= (StrPos + StartColumn) / LineLength;
391 Column = StartColumn;
401 InsertMode = (BOOLEAN) !InsertMode;
409 CopyMem (InStr, mInputBufferHistory, StrLength *
sizeof (CHAR16));
410 StrPos =
StrLen (mInputBufferHistory);
415 TailRow = Row + (StrPos + StartColumn) / LineLength;
416 TailColumn = (StrPos + StartColumn) % LineLength;
421 ConOut->SetCursorPosition (ConOut, StartColumn, Row);
422 for (SubIndex = 0; SubIndex < EFI_DEBUG_INPUS_BUFFER_SIZE - (StartColumn - EFI_DEBUG_PROMPT_COLUMN); SubIndex++) {
423 mBackupSpace[SubIndex] = L
' ';
427 SetMem (mBackupSpace, (EFI_DEBUG_INPUS_BUFFER_SIZE - (StartColumn - EFI_DEBUG_PROMPT_COLUMN)) *
sizeof (CHAR16), 0);
429 ConOut->SetCursorPosition (ConOut, StartColumn, Row);
447 if (CommandStr !=
NULL) {
448 StrnCpyS (InStr, StrLength, CommandStr, StrLength - 1);
465 ConOut->SetCursorPosition (ConOut, Column, Row);
466 for (SubIndex = 0; SubIndex < EFI_DEBUG_INPUS_BUFFER_SIZE - (Column - EFI_DEBUG_PROMPT_COLUMN); SubIndex++) {
467 mBackupSpace[SubIndex] = L
' ';
471 SetMem (mBackupSpace, (EFI_DEBUG_INPUS_BUFFER_SIZE - (Column - EFI_DEBUG_PROMPT_COLUMN)) *
sizeof (CHAR16), 0);
472 ConOut->SetCursorPosition (ConOut, Column, Row);
480 SetMem (InStr + Len, Delete *
sizeof (CHAR16), 0x00);
494 if ((Key.UnicodeChar != CHAR_BACKSPACE) && !((Key.UnicodeChar == 0) && (Key.ScanCode == SCAN_DELETE))) {
498 TailRow = Row + (Len - StrPos + Column + OutputLength) / LineLength;
499 TailColumn = (Len - StrPos + Column + OutputLength) % LineLength;
508 if ((TailColumn == 0) && (TailRow >= TotalRow) && ((
UINTN)Row != TailRow)) {
517 if (Column + OutputLength >= LineLength) {
518 SkipLength = OutputLength - (LineLength - Column);
520 Row += SkipLength / LineLength + 1;
521 if ((
UINTN)Row > TotalRow - 1) {
525 Column = SkipLength % LineLength;
527 Column += OutputLength;
537 SetCursorPosition (ConOut, Column, Row, LineLength, TotalRow, InStr, StrPos, Len);
540 CopyMem (mInputBufferHistory, InStr, StrLength *
sizeof (CHAR16));
576 ASSERT (ConOut !=
NULL);
577 ASSERT (Str !=
NULL);
581 ConOut->SetCursorPosition (ConOut, Column, Row);
585 if (Len - StrPos > Column * Row) {
586 Backup = *(Str + StrPos + Column * Row);
587 *(Str + StrPos + Column * Row) = 0;
591 if (Len - StrPos > Column * Row) {
592 *(Str + StrPos + Column * Row) = Backup;
595 ConOut->SetCursorPosition (ConOut, 0, 0);
616 if (!mDebuggerPrivate.EnablePageBreak) {
636 if (Key.UnicodeChar == CHAR_NULL) {
637 if (Key.ScanCode == SCAN_ESC) {
646 if (Key.UnicodeChar == CHAR_CARRIAGE_RETURN) {
654 Str[1] = Key.UnicodeChar;
655 if (Str[1] == CHAR_BACKSPACE) {
661 if ((Str[1] == L
'q') || (Str[1] == L
'Q')) {
667 Str[0] = CHAR_BACKSPACE;
690 CHAR16 Buffer[EFI_DEBUG_MAX_PRINT_BUFFER];
693 Return =
UnicodeVSPrint (Buffer,
sizeof (Buffer), Format, Marker);
729 ASSERT (BufferSize > 0);
763 ASSERT (BufferSize - (Offset *
sizeof (CHAR16)) > 0);
766 Return =
UnicodeVSPrint (Buffer + Offset, (
UINTN)(BufferSize - (Offset *
sizeof (CHAR16))), Format, Marker);
RETURN_STATUS EFIAPI StrnCpyS(OUT CHAR16 *Destination, IN UINTN DestMax, IN CONST CHAR16 *Source, IN UINTN Length)
UINTN EFIAPI StrLen(IN CONST CHAR16 *String)
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
VOID *EFIAPI SetMem(OUT VOID *Buffer, IN UINTN Length, IN UINT8 Value)
CHAR16 * GetCommandNameByKey(IN EFI_INPUT_KEY CommandKey)
UINTN EFIAPI EDBSPrint(OUT CHAR16 *Buffer, IN INTN BufferSize, IN CONST CHAR16 *Format,...)
BOOLEAN EFIAPI SetPageBreak(VOID)
VOID EFIAPI ConMoveCursorBackward(IN UINTN LineLength, IN OUT UINTN *Column, IN OUT UINTN *Row)
UINTN EFIAPI EDBPrint(IN CONST CHAR16 *Format,...)
VOID EFIAPI Input(IN CHAR16 *Prompt OPTIONAL, OUT CHAR16 *InStr, IN UINTN StrLength)
UINTN EFIAPI EDBSPrintWithOffset(OUT CHAR16 *Buffer, IN INTN BufferSize, IN UINTN Offset, IN CONST CHAR16 *Format,...)
EFI_STATUS EFIAPI WaitForSingleEvent(IN EFI_EVENT Event, IN UINT64 Timeout OPTIONAL)
VOID EFIAPI SetCursorPosition(IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *ConOut, IN UINTN Column, IN INTN Row, IN UINTN LineLength, IN UINTN TotalRow, IN CHAR16 *Str, IN UINTN StrPos, IN UINTN Len)
VOID EFIAPI ConMoveCursorForward(IN UINTN LineLength, IN UINTN TotalRow, IN OUT UINTN *Column, IN OUT UINTN *Row)
UINTN EFIAPI UnicodeVSPrint(OUT CHAR16 *StartOfBuffer, IN UINTN BufferSize, IN CONST CHAR16 *FormatString, IN VA_LIST Marker)
#define VA_START(Marker, Parameter)
EFI_SIMPLE_TEXT_INPUT_PROTOCOL * ConIn
EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL * ConOut