2 Implementation for EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL protocol.
4 Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
18 // This list is used to define the valid extend chars.
19 // It also provides a mapping from Unicode to PCANSI or
20 // ASCII. The ASCII mapping we just made up.
23 UNICODE_TO_CHAR UnicodeToPcAnsiOrAscii
[] = {
24 { BOXDRAW_HORIZONTAL
, 0xc4, L
'-' },
25 { BOXDRAW_VERTICAL
, 0xb3, L
'|' },
26 { BOXDRAW_DOWN_RIGHT
, 0xda, L
'/' },
27 { BOXDRAW_DOWN_LEFT
, 0xbf, L
'\\' },
28 { BOXDRAW_UP_RIGHT
, 0xc0, L
'\\' },
29 { BOXDRAW_UP_LEFT
, 0xd9, L
'/' },
30 { BOXDRAW_VERTICAL_RIGHT
, 0xc3, L
'|' },
31 { BOXDRAW_VERTICAL_LEFT
, 0xb4, L
'|' },
32 { BOXDRAW_DOWN_HORIZONTAL
, 0xc2, L
'+' },
33 { BOXDRAW_UP_HORIZONTAL
, 0xc1, L
'+' },
34 { BOXDRAW_VERTICAL_HORIZONTAL
, 0xc5, L
'+' },
35 { BOXDRAW_DOUBLE_HORIZONTAL
, 0xcd, L
'-' },
36 { BOXDRAW_DOUBLE_VERTICAL
, 0xba, L
'|' },
37 { BOXDRAW_DOWN_RIGHT_DOUBLE
, 0xd5, L
'/' },
38 { BOXDRAW_DOWN_DOUBLE_RIGHT
, 0xd6, L
'/' },
39 { BOXDRAW_DOUBLE_DOWN_RIGHT
, 0xc9, L
'/' },
40 { BOXDRAW_DOWN_LEFT_DOUBLE
, 0xb8, L
'\\' },
41 { BOXDRAW_DOWN_DOUBLE_LEFT
, 0xb7, L
'\\' },
42 { BOXDRAW_DOUBLE_DOWN_LEFT
, 0xbb, L
'\\' },
43 { BOXDRAW_UP_RIGHT_DOUBLE
, 0xd4, L
'\\' },
44 { BOXDRAW_UP_DOUBLE_RIGHT
, 0xd3, L
'\\' },
45 { BOXDRAW_DOUBLE_UP_RIGHT
, 0xc8, L
'\\' },
46 { BOXDRAW_UP_LEFT_DOUBLE
, 0xbe, L
'/' },
47 { BOXDRAW_UP_DOUBLE_LEFT
, 0xbd, L
'/' },
48 { BOXDRAW_DOUBLE_UP_LEFT
, 0xbc, L
'/' },
49 { BOXDRAW_VERTICAL_RIGHT_DOUBLE
, 0xc6, L
'|' },
50 { BOXDRAW_VERTICAL_DOUBLE_RIGHT
, 0xc7, L
'|' },
51 { BOXDRAW_DOUBLE_VERTICAL_RIGHT
, 0xcc, L
'|' },
52 { BOXDRAW_VERTICAL_LEFT_DOUBLE
, 0xb5, L
'|' },
53 { BOXDRAW_VERTICAL_DOUBLE_LEFT
, 0xb6, L
'|' },
54 { BOXDRAW_DOUBLE_VERTICAL_LEFT
, 0xb9, L
'|' },
55 { BOXDRAW_DOWN_HORIZONTAL_DOUBLE
, 0xd1, L
'+' },
56 { BOXDRAW_DOWN_DOUBLE_HORIZONTAL
, 0xd2, L
'+' },
57 { BOXDRAW_DOUBLE_DOWN_HORIZONTAL
, 0xcb, L
'+' },
58 { BOXDRAW_UP_HORIZONTAL_DOUBLE
, 0xcf, L
'+' },
59 { BOXDRAW_UP_DOUBLE_HORIZONTAL
, 0xd0, L
'+' },
60 { BOXDRAW_DOUBLE_UP_HORIZONTAL
, 0xca, L
'+' },
61 { BOXDRAW_VERTICAL_HORIZONTAL_DOUBLE
, 0xd8, L
'+' },
62 { BOXDRAW_VERTICAL_DOUBLE_HORIZONTAL
, 0xd7, L
'+' },
63 { BOXDRAW_DOUBLE_VERTICAL_HORIZONTAL
, 0xce, L
'+' },
65 { BLOCKELEMENT_FULL_BLOCK
, 0xdb, L
'*' },
66 { BLOCKELEMENT_LIGHT_SHADE
, 0xb0, L
'+' },
68 { GEOMETRICSHAPE_UP_TRIANGLE
, 0x1e, L
'^' },
69 { GEOMETRICSHAPE_RIGHT_TRIANGLE
, 0x10, L
'>' },
70 { GEOMETRICSHAPE_DOWN_TRIANGLE
, 0x1f, L
'v' },
71 { GEOMETRICSHAPE_LEFT_TRIANGLE
, 0x11, L
'<' },
73 { ARROW_LEFT
, 0x3c, L
'<' },
74 { ARROW_UP
, 0x18, L
'^' },
75 { ARROW_RIGHT
, 0x3e, L
'>' },
76 { ARROW_DOWN
, 0x19, L
'v' },
78 { 0x0000, 0x00, L
'\0' }
81 CHAR16 mSetModeString
[] = { ESC
, '[', '=', '3', 'h', 0 };
82 CHAR16 mSetAttributeString
[] = { ESC
, '[', '0', 'm', ESC
, '[', '4', '0', 'm', ESC
, '[', '4', '0', 'm', 0 };
83 CHAR16 mClearScreenString
[] = { ESC
, '[', '2', 'J', 0 };
84 CHAR16 mSetCursorPositionString
[] = { ESC
, '[', '0', '0', ';', '0', '0', 'H', 0 };
87 // Body of the ConOut functions
91 Implements EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.Reset().
93 If ExtendeVerification is TRUE, then perform dependent serial device reset,
94 and set display mode to mode 0.
95 If ExtendedVerification is FALSE, only set display mode to mode 0.
97 @param This Indicates the calling context.
98 @param ExtendedVerification Indicates that the driver may perform a more
99 exhaustive verification operation of the device
102 @retval EFI_SUCCESS The reset operation succeeds.
103 @retval EFI_DEVICE_ERROR The terminal is not functioning correctly or the serial port reset fails.
108 TerminalConOutReset (
109 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
*This
,
110 IN BOOLEAN ExtendedVerification
114 TERMINAL_DEV
*TerminalDevice
;
116 TerminalDevice
= TERMINAL_CON_OUT_DEV_FROM_THIS (This
);
119 // Perform a more exhaustive reset by resetting the serial port.
121 if (ExtendedVerification
) {
123 // Report progress code here
125 REPORT_STATUS_CODE_WITH_DEVICE_PATH (
127 (EFI_PERIPHERAL_REMOTE_CONSOLE
| EFI_P_PC_RESET
),
128 TerminalDevice
->DevicePath
131 Status
= TerminalDevice
->SerialIo
->Reset (TerminalDevice
->SerialIo
);
132 if (EFI_ERROR (Status
)) {
134 // Report error code here
136 REPORT_STATUS_CODE_WITH_DEVICE_PATH (
137 EFI_ERROR_CODE
| EFI_ERROR_MINOR
,
138 (EFI_PERIPHERAL_REMOTE_CONSOLE
| EFI_P_EC_CONTROLLER_ERROR
),
139 TerminalDevice
->DevicePath
146 This
->SetAttribute (This
, EFI_TEXT_ATTR (This
->Mode
->Attribute
& 0x0F, EFI_BLACK
));
148 Status
= This
->SetMode (This
, 0);
155 Implements EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.OutputString().
157 The Unicode string will be converted to terminal expressible data stream
158 and send to terminal via serial port.
160 @param This Indicates the calling context.
161 @param WString The Null-terminated Unicode string to be displayed
162 on the terminal screen.
164 @retval EFI_SUCCESS The string is output successfully.
165 @retval EFI_DEVICE_ERROR The serial port fails to send the string out.
166 @retval EFI_WARN_UNKNOWN_GLYPH Indicates that some of the characters in the Unicode string could not
167 be rendered and are skipped.
168 @retval EFI_UNSUPPORTED If current display mode is out of range.
173 TerminalConOutOutputString (
174 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
*This
,
178 TERMINAL_DEV
*TerminalDevice
;
179 EFI_SIMPLE_TEXT_OUTPUT_MODE
*Mode
;
189 // flag used to indicate whether condition happens which will cause
190 // return EFI_WARN_UNKNOWN_GLYPH
199 // get Terminal device data structure pointer.
201 TerminalDevice
= TERMINAL_CON_OUT_DEV_FROM_THIS (This
);
204 // Get current display mode
208 if (Mode
->Mode
>= TERMINAL_MAX_MODE
) {
209 return EFI_UNSUPPORTED
;
219 for (; *WString
!= CHAR_NULL
; WString
++) {
221 switch (TerminalDevice
->TerminalType
) {
227 if (!TerminalIsValidTextGraphics (*WString
, &GraphicChar
, &AsciiChar
)) {
229 // If it's not a graphic character convert Unicode to ASCII.
231 GraphicChar
= (CHAR8
) *WString
;
233 if (!(TerminalIsValidAscii (GraphicChar
) || TerminalIsValidEfiCntlChar (GraphicChar
))) {
235 // when this driver use the OutputString to output control string,
236 // TerminalDevice->OutputEscChar is set to let the Esc char
237 // to be output to the terminal emulation software.
239 if ((GraphicChar
== 27) && TerminalDevice
->OutputEscChar
) {
247 AsciiChar
= GraphicChar
;
251 if (TerminalDevice
->TerminalType
!= PCANSITYPE
) {
252 GraphicChar
= AsciiChar
;
257 Status
= TerminalDevice
->SerialIo
->Write (
258 TerminalDevice
->SerialIo
,
263 if (EFI_ERROR (Status
)) {
270 UnicodeToUtf8 (*WString
, &Utf8Char
, &ValidBytes
);
272 Status
= TerminalDevice
->SerialIo
->Write (
273 TerminalDevice
->SerialIo
,
277 if (EFI_ERROR (Status
)) {
283 // Update cursor position.
288 if (Mode
->CursorColumn
> 0) {
289 Mode
->CursorColumn
--;
294 if (Mode
->CursorRow
< (INT32
) (MaxRow
- 1)) {
299 case CHAR_CARRIAGE_RETURN
:
300 Mode
->CursorColumn
= 0;
304 if (Mode
->CursorColumn
< (INT32
) (MaxColumn
- 1)) {
306 Mode
->CursorColumn
++;
310 Mode
->CursorColumn
= 0;
311 if (Mode
->CursorRow
< (INT32
) (MaxRow
- 1)) {
323 return EFI_WARN_UNKNOWN_GLYPH
;
329 REPORT_STATUS_CODE_WITH_DEVICE_PATH (
330 EFI_ERROR_CODE
| EFI_ERROR_MINOR
,
331 (EFI_PERIPHERAL_REMOTE_CONSOLE
| EFI_P_EC_OUTPUT_ERROR
),
332 TerminalDevice
->DevicePath
335 return EFI_DEVICE_ERROR
;
340 Implements EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.TestString().
342 If one of the characters in the *Wstring is
343 neither valid Unicode drawing characters,
344 not ASCII code, then this function will return
347 @param This Indicates the calling context.
348 @param WString The Null-terminated Unicode string to be tested.
350 @retval EFI_SUCCESS The terminal is capable of rendering the output string.
351 @retval EFI_UNSUPPORTED Some of the characters in the Unicode string cannot be rendered.
356 TerminalConOutTestString (
357 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
*This
,
361 TERMINAL_DEV
*TerminalDevice
;
365 // get Terminal device data structure pointer.
367 TerminalDevice
= TERMINAL_CON_OUT_DEV_FROM_THIS (This
);
369 switch (TerminalDevice
->TerminalType
) {
374 Status
= AnsiTestString (TerminalDevice
, WString
);
378 Status
= VTUTF8TestString (TerminalDevice
, WString
);
382 Status
= EFI_UNSUPPORTED
;
391 Implements EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.QueryMode().
393 It returns information for an available text mode
394 that the terminal supports.
395 In this driver, we support text mode 80x25 (mode 0),
396 80x50 (mode 1), 100x31 (mode 2).
398 @param This Indicates the calling context.
399 @param ModeNumber The mode number to return information on.
400 @param Columns The returned columns of the requested mode.
401 @param Rows The returned rows of the requested mode.
403 @retval EFI_SUCCESS The requested mode information is returned.
404 @retval EFI_UNSUPPORTED The mode number is not valid.
405 @retval EFI_DEVICE_ERROR
410 TerminalConOutQueryMode (
411 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
*This
,
417 if (This
->Mode
->MaxMode
> TERMINAL_MAX_MODE
) {
418 return EFI_DEVICE_ERROR
;
421 if (ModeNumber
== 0) {
422 *Columns
= MODE0_COLUMN_COUNT
;
423 *Rows
= MODE0_ROW_COUNT
;
425 } else if (ModeNumber
== 1) {
426 *Columns
= MODE1_COLUMN_COUNT
;
427 *Rows
= MODE1_ROW_COUNT
;
429 } else if (ModeNumber
== 2) {
430 *Columns
= MODE2_COLUMN_COUNT
;
431 *Rows
= MODE2_ROW_COUNT
;
433 } else if (ModeNumber
== 3) {
434 *Columns
= (UINTN
) PcdGet32 (PcdConOutColumn
);
436 *Columns
= MODE0_COLUMN_COUNT
;
438 *Rows
= (UINTN
) PcdGet32 (PcdConOutRow
);
440 *Rows
= MODE0_ROW_COUNT
;
445 return EFI_UNSUPPORTED
;
450 Implements EFI_SIMPLE_TEXT_OUT.SetMode().
452 Set the terminal to a specified display mode.
453 In this driver, we only support mode 0.
455 @param This Indicates the calling context.
456 @param ModeNumber The text mode to set.
458 @retval EFI_SUCCESS The requested text mode is set.
459 @retval EFI_DEVICE_ERROR The requested text mode cannot be set
460 because of serial device error.
461 @retval EFI_UNSUPPORTED The text mode number is not valid.
466 TerminalConOutSetMode (
467 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
*This
,
472 TERMINAL_DEV
*TerminalDevice
;
475 // get Terminal device data structure pointer.
477 TerminalDevice
= TERMINAL_CON_OUT_DEV_FROM_THIS (This
);
479 if (ModeNumber
>= TERMINAL_MAX_MODE
) {
480 return EFI_UNSUPPORTED
;
484 // Set the current mode
486 This
->Mode
->Mode
= (INT32
) ModeNumber
;
488 This
->ClearScreen (This
);
490 TerminalDevice
->OutputEscChar
= TRUE
;
491 Status
= This
->OutputString (This
, mSetModeString
);
492 TerminalDevice
->OutputEscChar
= FALSE
;
494 if (EFI_ERROR (Status
)) {
495 return EFI_DEVICE_ERROR
;
498 This
->Mode
->Mode
= (INT32
) ModeNumber
;
500 Status
= This
->ClearScreen (This
);
501 if (EFI_ERROR (Status
)) {
502 return EFI_DEVICE_ERROR
;
511 Implements EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.SetAttribute().
513 @param This Indicates the calling context.
514 @param Attribute The attribute to set. Only bit0..6 are valid, all other bits
515 are undefined and must be zero.
517 @retval EFI_SUCCESS The requested attribute is set.
518 @retval EFI_DEVICE_ERROR The requested attribute cannot be set due to serial port error.
519 @retval EFI_UNSUPPORTED The attribute requested is not defined by EFI spec.
524 TerminalConOutSetAttribute (
525 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
*This
,
529 UINT8 ForegroundControl
;
530 UINT8 BackgroundControl
;
535 TERMINAL_DEV
*TerminalDevice
;
541 // get Terminal device data structure pointer.
543 TerminalDevice
= TERMINAL_CON_OUT_DEV_FROM_THIS (This
);
546 // only the bit0..6 of the Attribute is valid
548 if ((Attribute
| 0x7f) != 0x7f) {
549 return EFI_UNSUPPORTED
;
553 // Skip outputting the command string for the same attribute
554 // It improves the terminal performance significantly
556 if (This
->Mode
->Attribute
== (INT32
) Attribute
) {
561 // convert Attribute value to terminal emulator
562 // understandable foreground color
564 switch (Attribute
& 0x07) {
567 ForegroundControl
= 30;
571 ForegroundControl
= 34;
575 ForegroundControl
= 32;
579 ForegroundControl
= 36;
583 ForegroundControl
= 31;
587 ForegroundControl
= 35;
591 ForegroundControl
= 33;
597 ForegroundControl
= 37;
602 // bit4 of the Attribute indicates bright control
603 // of terminal emulator.
605 BrightControl
= (UINT8
) ((Attribute
>> 3) & 1);
608 // convert Attribute value to terminal emulator
609 // understandable background color.
611 switch ((Attribute
>> 4) & 0x07) {
614 BackgroundControl
= 40;
618 BackgroundControl
= 44;
622 BackgroundControl
= 42;
626 BackgroundControl
= 46;
630 BackgroundControl
= 41;
634 BackgroundControl
= 45;
638 BackgroundControl
= 43;
644 BackgroundControl
= 47;
648 // terminal emulator's control sequence to set attributes
650 mSetAttributeString
[BRIGHT_CONTROL_OFFSET
] = (CHAR16
) ('0' + BrightControl
);
651 mSetAttributeString
[FOREGROUND_CONTROL_OFFSET
+ 0] = (CHAR16
) ('0' + (ForegroundControl
/ 10));
652 mSetAttributeString
[FOREGROUND_CONTROL_OFFSET
+ 1] = (CHAR16
) ('0' + (ForegroundControl
% 10));
653 mSetAttributeString
[BACKGROUND_CONTROL_OFFSET
+ 0] = (CHAR16
) ('0' + (BackgroundControl
/ 10));
654 mSetAttributeString
[BACKGROUND_CONTROL_OFFSET
+ 1] = (CHAR16
) ('0' + (BackgroundControl
% 10));
657 // save current column and row
658 // for future scrolling back use.
660 SavedColumn
= This
->Mode
->CursorColumn
;
661 SavedRow
= This
->Mode
->CursorRow
;
663 TerminalDevice
->OutputEscChar
= TRUE
;
664 Status
= This
->OutputString (This
, mSetAttributeString
);
665 TerminalDevice
->OutputEscChar
= FALSE
;
667 if (EFI_ERROR (Status
)) {
668 return EFI_DEVICE_ERROR
;
671 // scroll back to saved cursor position.
673 This
->Mode
->CursorColumn
= SavedColumn
;
674 This
->Mode
->CursorRow
= SavedRow
;
676 This
->Mode
->Attribute
= (INT32
) Attribute
;
684 Implements EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.ClearScreen().
685 It clears the ANSI terminal's display to the
686 currently selected background color.
688 @param This Indicates the calling context.
690 @retval EFI_SUCCESS The operation completed successfully.
691 @retval EFI_DEVICE_ERROR The terminal screen cannot be cleared due to serial port error.
692 @retval EFI_UNSUPPORTED The terminal is not in a valid display mode.
697 TerminalConOutClearScreen (
698 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
*This
702 TERMINAL_DEV
*TerminalDevice
;
704 TerminalDevice
= TERMINAL_CON_OUT_DEV_FROM_THIS (This
);
707 // control sequence for clear screen request
709 TerminalDevice
->OutputEscChar
= TRUE
;
710 Status
= This
->OutputString (This
, mClearScreenString
);
711 TerminalDevice
->OutputEscChar
= FALSE
;
713 if (EFI_ERROR (Status
)) {
714 return EFI_DEVICE_ERROR
;
717 Status
= This
->SetCursorPosition (This
, 0, 0);
724 Implements EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.SetCursorPosition().
726 @param This Indicates the calling context.
727 @param Column The row to set cursor to.
728 @param Row The column to set cursor to.
730 @retval EFI_SUCCESS The operation completed successfully.
731 @retval EFI_DEVICE_ERROR The request fails due to serial port error.
732 @retval EFI_UNSUPPORTED The terminal is not in a valid text mode, or the cursor position
733 is invalid for current mode.
738 TerminalConOutSetCursorPosition (
739 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
*This
,
744 EFI_SIMPLE_TEXT_OUTPUT_MODE
*Mode
;
748 TERMINAL_DEV
*TerminalDevice
;
750 TerminalDevice
= TERMINAL_CON_OUT_DEV_FROM_THIS (This
);
758 // get geometry of current mode
760 Status
= This
->QueryMode (
766 if (EFI_ERROR (Status
)) {
767 return EFI_UNSUPPORTED
;
770 if (Column
>= MaxColumn
|| Row
>= MaxRow
) {
771 return EFI_UNSUPPORTED
;
774 // control sequence to move the cursor
776 mSetCursorPositionString
[ROW_OFFSET
+ 0] = (CHAR16
) ('0' + ((Row
+ 1) / 10));
777 mSetCursorPositionString
[ROW_OFFSET
+ 1] = (CHAR16
) ('0' + ((Row
+ 1) % 10));
778 mSetCursorPositionString
[COLUMN_OFFSET
+ 0] = (CHAR16
) ('0' + ((Column
+ 1) / 10));
779 mSetCursorPositionString
[COLUMN_OFFSET
+ 1] = (CHAR16
) ('0' + ((Column
+ 1) % 10));
781 TerminalDevice
->OutputEscChar
= TRUE
;
782 Status
= This
->OutputString (This
, mSetCursorPositionString
);
783 TerminalDevice
->OutputEscChar
= FALSE
;
785 if (EFI_ERROR (Status
)) {
786 return EFI_DEVICE_ERROR
;
789 // update current cursor position
790 // in the Mode data structure.
792 Mode
->CursorColumn
= (INT32
) Column
;
793 Mode
->CursorRow
= (INT32
) Row
;
800 Implements SIMPLE_TEXT_OUTPUT.EnableCursor().
802 In this driver, the cursor cannot be hidden.
804 @param This Indicates the calling context.
805 @param Visible If TRUE, the cursor is set to be visible,
806 If FALSE, the cursor is set to be invisible.
808 @retval EFI_SUCCESS The request is valid.
809 @retval EFI_UNSUPPORTED The terminal does not support cursor hidden.
814 TerminalConOutEnableCursor (
815 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
*This
,
820 return EFI_UNSUPPORTED
;
828 Detects if a Unicode char is for Box Drawing text graphics.
830 @param Graphic Unicode char to test.
831 @param PcAnsi Optional pointer to return PCANSI equivalent of
833 @param Ascii Optional pointer to return ASCII equivalent of
836 @retval TRUE If Graphic is a supported Unicode Box Drawing character.
840 TerminalIsValidTextGraphics (
842 OUT CHAR8
*PcAnsi
, OPTIONAL
843 OUT CHAR8
*Ascii OPTIONAL
846 UNICODE_TO_CHAR
*Table
;
848 if ((((Graphic
& 0xff00) != 0x2500) && ((Graphic
& 0xff00) != 0x2100))) {
850 // Unicode drawing code charts are all in the 0x25xx range,
856 for (Table
= UnicodeToPcAnsiOrAscii
; Table
->Unicode
!= 0x0000; Table
++) {
857 if (Graphic
== Table
->Unicode
) {
858 if (PcAnsi
!= NULL
) {
859 *PcAnsi
= Table
->PcAnsi
;
863 *Ascii
= Table
->Ascii
;
874 Detects if a valid ASCII char.
876 @param Ascii An ASCII character.
878 @retval TRUE If it is a valid ASCII character.
879 @retval FALSE If it is not a valid ASCII character.
883 TerminalIsValidAscii (
888 // valid ascii code lies in the extent of 0x20 ~ 0x7f
890 if ((Ascii
>= 0x20) && (Ascii
<= 0x7f)) {
898 Detects if a valid EFI control character.
900 @param CharC An input EFI Control character.
902 @retval TRUE If it is a valid EFI control character.
903 @retval FALSE If it is not a valid EFI control character.
907 TerminalIsValidEfiCntlChar (
912 // only support four control characters.
914 if (CharC
== CHAR_NULL
||
915 CharC
== CHAR_BACKSPACE
||
916 CharC
== CHAR_LINEFEED
||
917 CharC
== CHAR_CARRIAGE_RETURN
||