]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Universal/Console/TerminalDxe/Terminal.h
Code scrub for Universal\Console\TerminalDxe.
[mirror_edk2.git] / MdeModulePkg / Universal / Console / TerminalDxe / Terminal.h
1 /** @file
2 Header file for Terminal driver.
3
4 Copyright (c) 2006 - 2008, Intel Corporation. <BR>
5 All rights reserved. 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
9
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.
12
13 **/
14
15 #ifndef _TERMINAL_H_
16 #define _TERMINAL_H_
17
18
19 #include <Uefi.h>
20 #include <Protocol/SimpleTextOut.h>
21 #include <Protocol/SerialIo.h>
22 #include <Guid/GlobalVariable.h>
23 #include <Protocol/DevicePath.h>
24 #include <Protocol/SimpleTextIn.h>
25 #include <Protocol/SimpleTextInEx.h>
26 #include <Guid/HotPlugDevice.h>
27 #include <Guid/PcAnsi.h>
28 #include <Library/DebugLib.h>
29 #include <Library/UefiDriverEntryPoint.h>
30 #include <Library/UefiLib.h>
31 #include <Library/ReportStatusCodeLib.h>
32 #include <Library/BaseMemoryLib.h>
33 #include <Library/MemoryAllocationLib.h>
34 #include <Library/UefiBootServicesTableLib.h>
35 #include <Library/UefiRuntimeServicesTableLib.h>
36 #include <Library/DevicePathLib.h>
37 #include <Library/PcdLib.h>
38 #include <Library/BaseLib.h>
39
40
41 #define RAW_FIFO_MAX_NUMBER 256
42 #define FIFO_MAX_NUMBER 128
43
44 typedef struct {
45 UINT8 Head;
46 UINT8 Tail;
47 UINT8 Data[RAW_FIFO_MAX_NUMBER + 1];
48 } RAW_DATA_FIFO;
49
50 typedef struct {
51 UINT8 Head;
52 UINT8 Tail;
53 UINT16 Data[FIFO_MAX_NUMBER + 1];
54 } UNICODE_FIFO;
55
56 typedef struct {
57 UINT8 Head;
58 UINT8 Tail;
59 EFI_INPUT_KEY Data[FIFO_MAX_NUMBER + 1];
60 } EFI_KEY_FIFO;
61
62 #define TERMINAL_DEV_SIGNATURE SIGNATURE_32 ('t', 'm', 'n', 'l')
63
64 #define TERMINAL_CONSOLE_IN_EX_NOTIFY_SIGNATURE SIGNATURE_32 ('t', 'm', 'e', 'n')
65
66 typedef struct _TERMINAL_CONSOLE_IN_EX_NOTIFY {
67 UINTN Signature;
68 EFI_HANDLE NotifyHandle;
69 EFI_KEY_DATA KeyData;
70 EFI_KEY_NOTIFY_FUNCTION KeyNotificationFn;
71 LIST_ENTRY NotifyEntry;
72 } TERMINAL_CONSOLE_IN_EX_NOTIFY;
73 typedef struct {
74 UINTN Signature;
75 EFI_HANDLE Handle;
76 UINT8 TerminalType;
77 EFI_SERIAL_IO_PROTOCOL *SerialIo;
78 EFI_DEVICE_PATH_PROTOCOL *DevicePath;
79 EFI_SIMPLE_TEXT_INPUT_PROTOCOL SimpleInput;
80 EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL SimpleTextOutput;
81 EFI_SIMPLE_TEXT_OUTPUT_MODE SimpleTextOutputMode;
82 UINTN SerialInTimeOut;
83 RAW_DATA_FIFO RawFiFo;
84 UNICODE_FIFO UnicodeFiFo;
85 EFI_KEY_FIFO EfiKeyFiFo;
86 EFI_UNICODE_STRING_TABLE *ControllerNameTable;
87 EFI_EVENT TwoSecondTimeOut;
88 UINT32 InputState;
89 UINT32 ResetState;
90
91 //
92 // Esc could not be output to the screen by user,
93 // but the terminal driver need to output it to
94 // the terminal emulation software to send control sequence.
95 // This boolean is used by the terminal driver only
96 // to indicate whether the Esc could be sent or not.
97 //
98 BOOLEAN OutputEscChar;
99 EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL SimpleInputEx;
100 LIST_ENTRY NotifyList;
101 } TERMINAL_DEV;
102
103 #define INPUT_STATE_DEFAULT 0x00
104 #define INPUT_STATE_ESC 0x01
105 #define INPUT_STATE_CSI 0x02
106 #define INPUT_STATE_LEFTOPENBRACKET 0x04
107 #define INPUT_STATE_O 0x08
108 #define INPUT_STATE_2 0x10
109
110 #define RESET_STATE_DEFAULT 0x00
111 #define RESET_STATE_ESC_R 0x01
112 #define RESET_STATE_ESC_R_ESC_r 0x02
113
114 #define TERMINAL_CON_IN_DEV_FROM_THIS(a) CR (a, TERMINAL_DEV, SimpleInput, TERMINAL_DEV_SIGNATURE)
115 #define TERMINAL_CON_OUT_DEV_FROM_THIS(a) CR (a, TERMINAL_DEV, SimpleTextOutput, TERMINAL_DEV_SIGNATURE)
116 #define TERMINAL_CON_IN_EX_DEV_FROM_THIS(a) CR (a, TERMINAL_DEV, SimpleInputEx, TERMINAL_DEV_SIGNATURE)
117
118 typedef union {
119 UINT8 Utf8_1;
120 UINT8 Utf8_2[2];
121 UINT8 Utf8_3[3];
122 } UTF8_CHAR;
123
124 #define PCANSITYPE 0
125 #define VT100TYPE 1
126 #define VT100PLUSTYPE 2
127 #define VTUTF8TYPE 3
128
129 #define LEFTOPENBRACKET 0x5b // '['
130 #define ACAP 0x41
131 #define BCAP 0x42
132 #define CCAP 0x43
133 #define DCAP 0x44
134
135 #define MODE0_COLUMN_COUNT 80
136 #define MODE0_ROW_COUNT 25
137
138 #define MODE1_COLUMN_COUNT 80
139 #define MODE1_ROW_COUNT 50
140
141 #define MODE2_COLUMN_COUNT 100
142 #define MODE2_ROW_COUNT 31
143
144 #define BACKSPACE 8
145 #define ESC 27
146 #define CSI 0x9B
147 #define DEL 127
148 #define BRIGHT_CONTROL_OFFSET 2
149 #define FOREGROUND_CONTROL_OFFSET 6
150 #define BACKGROUND_CONTROL_OFFSET 11
151 #define ROW_OFFSET 2
152 #define COLUMN_OFFSET 5
153
154 typedef struct {
155 UINT16 Unicode;
156 CHAR8 PcAnsi;
157 CHAR8 Ascii;
158 } UNICODE_TO_CHAR;
159
160 //
161 // Global Variables
162 //
163 extern EFI_DRIVER_BINDING_PROTOCOL gTerminalDriverBinding;
164 extern EFI_COMPONENT_NAME_PROTOCOL gTerminalComponentName;
165 extern EFI_COMPONENT_NAME2_PROTOCOL gTerminalComponentName2;
166
167 extern EFI_GUID gSimpleTextInExNotifyGuid;
168
169 /**
170 The user Entry Point for module Terminal. The user code starts with this function.
171
172 @param[in] ImageHandle The firmware allocated handle for the EFI image.
173 @param[in] SystemTable A pointer to the EFI System Table.
174
175 @retval EFI_SUCCESS The entry point is executed successfully.
176 @retval other Some error occurs when executing this entry point.
177
178 **/
179 EFI_STATUS
180 EFIAPI
181 InitializeTerminal (
182 IN EFI_HANDLE ImageHandle,
183 IN EFI_SYSTEM_TABLE *SystemTable
184 );
185
186 /**
187 Implements EFI_SIMPLE_TEXT_INPUT_PROTOCOL.Reset().
188 This driver only perform dependent serial device reset regardless of
189 the value of ExtendeVerification
190
191 @param This Indicates the calling context.
192 @param ExtendedVerification Skip by this driver.
193
194 @return EFI_SUCCESS The reset operation succeeds.
195 @return EFI_DEVICE_ERROR The dependent serial port reset fails.
196
197 **/
198 EFI_STATUS
199 EFIAPI
200 TerminalConInReset (
201 IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *This,
202 IN BOOLEAN ExtendedVerification
203 );
204
205
206 /**
207 Implements EFI_SIMPLE_TEXT_INPUT_PROTOCOL.ReadKeyStroke().
208
209 @param This Indicates the calling context.
210 @param Key A pointer to a buffer that is filled in with the
211 keystroke information for the key that was sent
212 from terminal.
213
214 @return EFI_SUCCESS The keystroke information is returned successfully.
215 @return EFI_NOT_READY There is no keystroke data available.
216 @return EFI_DEVICE_ERROR The dependent serial device encounters error.
217
218 **/
219 EFI_STATUS
220 EFIAPI
221 TerminalConInReadKeyStroke (
222 IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *This,
223 OUT EFI_INPUT_KEY *Key
224 );
225
226 /**
227 Check if the key already has been registered.
228
229 @param RegsiteredData A pointer to a buffer that is filled in with the
230 keystroke state data for the key that was
231 registered.
232 @param InputData A pointer to a buffer that is filled in with the
233 keystroke state data for the key that was
234 pressed.
235
236 @retval TRUE Key be pressed matches a registered key.
237 @retval FLASE Match failed.
238
239 **/
240 BOOLEAN
241 IsKeyRegistered (
242 IN EFI_KEY_DATA *RegsiteredData,
243 IN EFI_KEY_DATA *InputData
244 );
245
246 /**
247 Event notification function for EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL.WaitForKeyEx event
248 Signal the event if there is key available
249
250 @param Event Indicates the event that invoke this function.
251 @param Context Indicates the calling context.
252
253 @return none.
254
255 **/
256 VOID
257 EFIAPI
258 TerminalConInWaitForKeyEx (
259 IN EFI_EVENT Event,
260 IN VOID *Context
261 );
262
263 //
264 // Simple Text Input Ex protocol prototypes
265 //
266
267 /**
268 Reset the input device and optionally run diagnostics
269
270 @param This Protocol instance pointer.
271 @param ExtendedVerification Driver may perform diagnostics on reset.
272
273 @retval EFI_SUCCESS The device was reset.
274 @retval EFI_DEVICE_ERROR The device is not functioning properly and could
275 not be reset.
276
277 **/
278 EFI_STATUS
279 EFIAPI
280 TerminalConInResetEx (
281 IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
282 IN BOOLEAN ExtendedVerification
283 );
284
285 /**
286 Reads the next keystroke from the input device. The WaitForKey Event can
287 be used to test for existence of a keystroke via WaitForEvent () call.
288
289 @param This Protocol instance pointer.
290 @param KeyData A pointer to a buffer that is filled in with the
291 keystroke state data for the key that was
292 pressed.
293
294 @retval EFI_SUCCESS The keystroke information was returned.
295 @retval EFI_NOT_READY There was no keystroke data available.
296 @retval EFI_DEVICE_ERROR The keystroke information was not returned due
297 to hardware errors.
298 @retval EFI_INVALID_PARAMETER KeyData is NULL.
299
300 **/
301 EFI_STATUS
302 EFIAPI
303 TerminalConInReadKeyStrokeEx (
304 IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
305 OUT EFI_KEY_DATA *KeyData
306 );
307
308 /**
309 Set certain state for the input device.
310
311 @param This Protocol instance pointer.
312 @param KeyToggleState A pointer to the EFI_KEY_TOGGLE_STATE to set the
313 state for the input device.
314
315 @retval EFI_SUCCESS The device state was set successfully.
316 @retval EFI_DEVICE_ERROR The device is not functioning correctly and
317 could not have the setting adjusted.
318 @retval EFI_UNSUPPORTED The device does not have the ability to set its
319 state.
320 @retval EFI_INVALID_PARAMETER KeyToggleState is NULL.
321
322 **/
323 EFI_STATUS
324 EFIAPI
325 TerminalConInSetState (
326 IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
327 IN EFI_KEY_TOGGLE_STATE *KeyToggleState
328 );
329
330 /**
331 Register a notification function for a particular keystroke for the input device.
332
333 @param This Protocol instance pointer.
334 @param KeyData A pointer to a buffer that is filled in with the
335 keystroke information data for the key that was
336 pressed.
337 @param KeyNotificationFunction Points to the function to be called when the key
338 sequence is typed specified by KeyData.
339 @param NotifyHandle Points to the unique handle assigned to the
340 registered notification.
341
342 @retval EFI_SUCCESS The notification function was registered
343 successfully.
344 @retval EFI_OUT_OF_RESOURCES Unable to allocate resources for necesssary data
345 structures.
346 @retval EFI_INVALID_PARAMETER KeyData or NotifyHandle is NULL.
347
348 **/
349 EFI_STATUS
350 EFIAPI
351 TerminalConInRegisterKeyNotify (
352 IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
353 IN EFI_KEY_DATA *KeyData,
354 IN EFI_KEY_NOTIFY_FUNCTION KeyNotificationFunction,
355 OUT EFI_HANDLE *NotifyHandle
356 );
357
358 /**
359 Remove a registered notification function from a particular keystroke.
360
361 @param This Protocol instance pointer.
362 @param NotificationHandle The handle of the notification function being
363 unregistered.
364
365 @retval EFI_SUCCESS The notification function was unregistered
366 successfully.
367 @retval EFI_INVALID_PARAMETER The NotificationHandle is invalid.
368 @retval EFI_NOT_FOUND Can not find the matching entry in database.
369
370 **/
371 EFI_STATUS
372 EFIAPI
373 TerminalConInUnregisterKeyNotify (
374 IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
375 IN EFI_HANDLE NotificationHandle
376 );
377
378 /**
379 Event notification function for EFI_SIMPLE_TEXT_INPUT_PROTOCOL.WaitForKey event
380 Signal the event if there is key available
381
382 @param Event Indicates the event that invoke this function.
383 @param Context Indicates the calling context.
384
385 @return None
386
387 **/
388 VOID
389 EFIAPI
390 TerminalConInWaitForKey (
391 IN EFI_EVENT Event,
392 IN VOID *Context
393 );
394
395 /**
396 Implements EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.Reset().
397 If ExtendeVerification is TRUE, then perform dependent serial device reset,
398 and set display mode to mode 0.
399 If ExtendedVerification is FALSE, only set display mode to mode 0.
400
401 @param This Indicates the calling context.
402 @param ExtendedVerification Indicates that the driver may perform a more
403 exhaustive verification operation of the device
404 during reset.
405
406 @return EFI_SUCCESS The reset operation succeeds.
407 @return EFI_DEVICE_ERROR The terminal is not functioning correctly or the serial port reset fails.
408
409 **/
410 EFI_STATUS
411 EFIAPI
412 TerminalConOutReset (
413 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
414 IN BOOLEAN ExtendedVerification
415 );
416
417 /**
418 Implements EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.OutputString().
419 The Unicode string will be converted to terminal expressible data stream
420 and send to terminal via serial port.
421
422 @param This Indicates the calling context.
423 @param WString The Null-terminated Unicode string to be displayed
424 on the terminal screen.
425
426 @retval EFI_SUCCESS The string is output successfully.
427 @retval EFI_DEVICE_ERROR The serial port fails to send the string out.
428 @retval EFI_WARN_UNKNOWN_GLYPH Indicates that some of the characters in the Unicode string could not
429 be rendered and are skipped.
430 @retval EFI_UNSUPPORTED If current display mode is out of range.
431
432 **/
433 EFI_STATUS
434 EFIAPI
435 TerminalConOutOutputString (
436 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
437 IN CHAR16 *WString
438 );
439
440 /**
441 Implements EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.TestString().
442 If one of the characters in the *Wstring is
443 neither valid Unicode drawing characters,
444 not ASCII code, then this function will return
445 EFI_UNSUPPORTED.
446
447 @param This Indicates the calling context.
448 @param WString The Null-terminated Unicode string to be tested.
449
450 @return EFI_SUCCESS The terminal is capable of rendering the output string.
451 @return EFI_UNSUPPORTED Some of the characters in the Unicode string cannot be rendered.
452
453 **/
454 EFI_STATUS
455 EFIAPI
456 TerminalConOutTestString (
457 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
458 IN CHAR16 *WString
459 );
460
461 /**
462 Implements EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.QueryMode().
463 It returns information for an available text mode
464 that the terminal supports.
465 In this driver, we support text mode 80x25 (mode 0),
466 80x50 (mode 1), 100x31 (mode 2).
467
468 @param This Indicates the calling context.
469 @param ModeNumber The mode number to return information on.
470 @param Columns The returned columns of the requested mode.
471 @param Rows The returned rows of the requested mode.
472
473 @return EFI_SUCCESS The requested mode information is returned.
474 @return EFI_UNSUPPORTED The mode number is not valid.
475 @return EFI_DEVICE_ERROR
476
477 **/
478 EFI_STATUS
479 EFIAPI
480 TerminalConOutQueryMode (
481 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
482 IN UINTN ModeNumber,
483 OUT UINTN *Columns,
484 OUT UINTN *Rows
485 );
486
487 /**
488 Implements EFI_SIMPLE_TEXT_OUT.SetMode().
489 Set the terminal to a specified display mode.
490 In this driver, we only support mode 0.
491
492 @param This Indicates the calling context.
493 @param ModeNumber The text mode to set.
494
495 @return EFI_SUCCESS The requested text mode is set.
496 @return EFI_DEVICE_ERROR The requested text mode cannot be set
497 because of serial device error.
498 @return EFI_UNSUPPORTED The text mode number is not valid.
499
500 **/
501 EFI_STATUS
502 EFIAPI
503 TerminalConOutSetMode (
504 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
505 IN UINTN ModeNumber
506 );
507
508 /**
509 Implements EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.SetAttribute().
510
511 @param This Indicates the calling context.
512 @param Attribute The attribute to set. Only bit0..6 are valid, all other bits
513 are undefined and must be zero.
514
515 @return EFI_SUCCESS The requested attribute is set.
516 @return EFI_DEVICE_ERROR The requested attribute cannot be set due to serial port error.
517 @return EFI_UNSUPPORTED The attribute requested is not defined by EFI spec.
518
519 **/
520 EFI_STATUS
521 EFIAPI
522 TerminalConOutSetAttribute (
523 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
524 IN UINTN Attribute
525 );
526
527 /**
528 Implements EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.ClearScreen().
529 It clears the ANSI terminal's display to the
530 currently selected background color.
531
532 @param This Indicates the calling context.
533
534 @return EFI_SUCCESS The operation completed successfully.
535 @return EFI_DEVICE_ERROR The terminal screen cannot be cleared due to serial port error.
536 @return EFI_UNSUPPORTED The terminal is not in a valid display mode.
537
538 **/
539 EFI_STATUS
540 EFIAPI
541 TerminalConOutClearScreen (
542 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This
543 );
544
545 /**
546 Implements EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.SetCursorPosition().
547
548 @param This Indicates the calling context.
549 @param Column The row to set cursor to.
550 @param Row The column to set cursor to.
551
552 @return EFI_SUCCESS The operation completed successfully.
553 @return EFI_DEVICE_ERROR The request fails due to serial port error.
554 @return EFI_UNSUPPORTED The terminal is not in a valid text mode, or the cursor position
555 is invalid for current mode.
556
557 **/
558 EFI_STATUS
559 EFIAPI
560 TerminalConOutSetCursorPosition (
561 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
562 IN UINTN Column,
563 IN UINTN Row
564 );
565
566 /**
567 Implements SIMPLE_TEXT_OUTPUT.EnableCursor().
568 In this driver, the cursor cannot be hidden.
569
570 @param This Indicates the calling context.
571 @param Visible If TRUE, the cursor is set to be visible,
572 If FALSE, the cursor is set to be invisible.
573
574 @return EFI_SUCCESS The request is valid.
575 @return EFI_UNSUPPORTED The terminal does not support cursor hidden.
576
577 **/
578 EFI_STATUS
579 EFIAPI
580 TerminalConOutEnableCursor (
581 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
582 IN BOOLEAN Visible
583 );
584
585 /**
586 Test to see if this driver supports Controller.
587
588 @param This Protocol instance pointer.
589 @param ControllerHandle Handle of device to test
590 @param RemainingDevicePath Optional parameter use to pick a specific child
591 device to start.
592
593 @retval EFI_SUCCESS This driver supports this device.
594 @retval EFI_ALREADY_STARTED This driver is already running on this device.
595 @retval other This driver does not support this device.
596
597 **/
598 EFI_STATUS
599 EFIAPI
600 TerminalDriverBindingSupported (
601 IN EFI_DRIVER_BINDING_PROTOCOL *This,
602 IN EFI_HANDLE ControllerHandle,
603 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
604 );
605
606 /**
607 Start this driver on Controller by opening a Serial IO protocol,
608 reading Device Path, and creating a child handle with a Simple Text In,
609 Simple Text In Ex and Simple Text Out protocol, and device path protocol.
610 And store Console Device Environment Variables.
611
612 @param This Protocol instance pointer.
613 @param Controller Handle of device to bind driver to
614 @param RemainingDevicePath Optional parameter use to pick a specific child
615 device to start.
616
617 @retval EFI_SUCCESS This driver is added to Controller.
618 @retval EFI_ALREADY_STARTED This driver is already running on Controller.
619 @retval other This driver does not support this device.
620
621 **/
622 EFI_STATUS
623 EFIAPI
624 TerminalDriverBindingStart (
625 IN EFI_DRIVER_BINDING_PROTOCOL *This,
626 IN EFI_HANDLE Controller,
627 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
628 );
629
630
631 /**
632 Stop this driver on Controller by closing Simple Text In, Simple Text
633 In Ex, Simple Text Out protocol, and removing parent device path from
634 Console Device Environment Variables.
635
636 @param This Protocol instance pointer.
637 @param Controller Handle of device to stop driver on
638 @param NumberOfChildren Number of Handles in ChildHandleBuffer. If number of
639 children is zero stop the entire bus driver.
640 @param ChildHandleBuffer List of Child Handles to Stop.
641
642 @retval EFI_SUCCESS This driver is removed Controller.
643 @retval other This driver could not be removed from this device.
644
645 **/
646 EFI_STATUS
647 EFIAPI
648 TerminalDriverBindingStop (
649 IN EFI_DRIVER_BINDING_PROTOCOL *This,
650 IN EFI_HANDLE Controller,
651 IN UINTN NumberOfChildren,
652 IN EFI_HANDLE *ChildHandleBuffer
653 );
654
655 /**
656 Free notify functions list.
657
658 @param ListHead The list head
659
660 @retval EFI_SUCCESS Free the notify list successfully.
661 @retval EFI_INVALID_PARAMETER ListHead is NULL.
662
663 **/
664 EFI_STATUS
665 TerminalFreeNotifyList (
666 IN OUT LIST_ENTRY *ListHead
667 );
668
669 /**
670 Retrieves a Unicode string that is the user readable name of the driver.
671
672 This function retrieves the user readable name of a driver in the form of a
673 Unicode string. If the driver specified by This has a user readable name in
674 the language specified by Language, then a pointer to the driver name is
675 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
676 by This does not support the language specified by Language,
677 then EFI_UNSUPPORTED is returned.
678
679 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
680 EFI_COMPONENT_NAME_PROTOCOL instance.
681
682 @param Language[in] A pointer to a Null-terminated ASCII string
683 array indicating the language. This is the
684 language of the driver name that the caller is
685 requesting, and it must match one of the
686 languages specified in SupportedLanguages. The
687 number of languages supported by a driver is up
688 to the driver writer. Language is specified
689 in RFC 3066 or ISO 639-2 language code format.
690
691 @param DriverName[out] A pointer to the Unicode string to return.
692 This Unicode string is the name of the
693 driver specified by This in the language
694 specified by Language.
695
696 @retval EFI_SUCCESS The Unicode string for the Driver specified by
697 This and the language specified by Language was
698 returned in DriverName.
699
700 @retval EFI_INVALID_PARAMETER Language is NULL.
701
702 @retval EFI_INVALID_PARAMETER DriverName is NULL.
703
704 @retval EFI_UNSUPPORTED The driver specified by This does not support
705 the language specified by Language.
706
707 **/
708 EFI_STATUS
709 EFIAPI
710 TerminalComponentNameGetDriverName (
711 IN EFI_COMPONENT_NAME_PROTOCOL *This,
712 IN CHAR8 *Language,
713 OUT CHAR16 **DriverName
714 );
715
716
717 /**
718 Retrieves a Unicode string that is the user readable name of the controller
719 that is being managed by a driver.
720
721 This function retrieves the user readable name of the controller specified by
722 ControllerHandle and ChildHandle in the form of a Unicode string. If the
723 driver specified by This has a user readable name in the language specified by
724 Language, then a pointer to the controller name is returned in ControllerName,
725 and EFI_SUCCESS is returned. If the driver specified by This is not currently
726 managing the controller specified by ControllerHandle and ChildHandle,
727 then EFI_UNSUPPORTED is returned. If the driver specified by This does not
728 support the language specified by Language, then EFI_UNSUPPORTED is returned.
729
730 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
731 EFI_COMPONENT_NAME_PROTOCOL instance.
732
733 @param ControllerHandle[in] The handle of a controller that the driver
734 specified by This is managing. This handle
735 specifies the controller whose name is to be
736 returned.
737
738 @param ChildHandle[in] The handle of the child controller to retrieve
739 the name of. This is an optional parameter that
740 may be NULL. It will be NULL for device
741 drivers. It will also be NULL for a bus drivers
742 that wish to retrieve the name of the bus
743 controller. It will not be NULL for a bus
744 driver that wishes to retrieve the name of a
745 child controller.
746
747 @param Language[in] A pointer to a Null-terminated ASCII string
748 array indicating the language. This is the
749 language of the driver name that the caller is
750 requesting, and it must match one of the
751 languages specified in SupportedLanguages. The
752 number of languages supported by a driver is up
753 to the driver writer. Language is specified in
754 RFC 3066 or ISO 639-2 language code format.
755
756 @param ControllerName[out] A pointer to the Unicode string to return.
757 This Unicode string is the name of the
758 controller specified by ControllerHandle and
759 ChildHandle in the language specified by
760 Language from the point of view of the driver
761 specified by This.
762
763 @retval EFI_SUCCESS The Unicode string for the user readable name in
764 the language specified by Language for the
765 driver specified by This was returned in
766 DriverName.
767
768 @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
769
770 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
771 EFI_HANDLE.
772
773 @retval EFI_INVALID_PARAMETER Language is NULL.
774
775 @retval EFI_INVALID_PARAMETER ControllerName is NULL.
776
777 @retval EFI_UNSUPPORTED The driver specified by This is not currently
778 managing the controller specified by
779 ControllerHandle and ChildHandle.
780
781 @retval EFI_UNSUPPORTED The driver specified by This does not support
782 the language specified by Language.
783
784 **/
785 EFI_STATUS
786 EFIAPI
787 TerminalComponentNameGetControllerName (
788 IN EFI_COMPONENT_NAME_PROTOCOL *This,
789 IN EFI_HANDLE ControllerHandle,
790 IN EFI_HANDLE ChildHandle OPTIONAL,
791 IN CHAR8 *Language,
792 OUT CHAR16 **ControllerName
793 );
794
795
796 //
797 // internal functions
798 //
799
800 /**
801 Check for a pending key in the Efi Key FIFO or Serial device buffer.
802
803 @param This Indicates the calling context.
804
805 @retval EFI_SUCCESS There is key pending.
806 @retval EFI_NOT_READY There is no key pending.
807 @retval EFI_DEVICE_ERROR If Serial IO is not attached to serial device.
808
809 **/
810 EFI_STATUS
811 TerminalConInCheckForKey (
812 IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *This
813 );
814
815 /**
816 Update terminal device path in Console Device Environment Variables.
817
818 @param VariableName The Console Device Environment Variable.
819 @param ParentDevicePath The terminal device path to be updated.
820
821 @return None.
822
823 **/
824 VOID
825 TerminalUpdateConsoleDevVariable (
826 IN CHAR16 *VariableName,
827 IN EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath
828 );
829
830 /**
831 Remove console device variable.
832
833 @param VariableName A pointer to the variable name.
834 @param ParentDevicePath A pointer to the parent device path.
835
836 @return None.
837
838 **/
839 VOID
840 TerminalRemoveConsoleDevVariable (
841 IN CHAR16 *VariableName,
842 IN EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath
843 );
844
845 /**
846 Read the EFI variable (VendorGuid/Name) and return a dynamically allocated
847 buffer, and the size of the buffer. On failure return NULL.
848
849 @param Name String part of EFI variable name
850 @param VendorGuid GUID part of EFI variable name
851 @param VariableSize Returns the size of the EFI variable that was read
852
853 @return Dynamically allocated memory that contains a copy of the EFI variable.
854 Caller is repsoncible freeing the buffer. If variable was not read,
855 NULL regturned.
856
857 **/
858 VOID *
859 TerminalGetVariableAndSize (
860 IN CHAR16 *Name,
861 IN EFI_GUID *VendorGuid,
862 OUT UINTN *VariableSize
863 );
864
865 /**
866 Build termial device path according to terminal type.
867
868 @param TerminalType The terminal type is PC ANSI, VT100, VT100+ or VT-UTF8.
869 @param ParentDevicePath Parent device path.
870 @param TerminalDevicePath Returned terminal device path, if building successfully.
871
872 @retval EFI_UNSUPPORTED Terminal does not belong to the supported type.
873 @retval EFI_OUT_OF_RESOURCES Generate terminal device path failed.
874 @retval EFI_SUCCESS Build terminal device path successfully.
875
876 **/
877 EFI_STATUS
878 SetTerminalDevicePath (
879 IN UINT8 TerminalType,
880 IN EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath,
881 OUT EFI_DEVICE_PATH_PROTOCOL **TerminalDevicePath
882 );
883
884 /**
885 Initialize the Raw Data FIFO.
886
887 @param TerminalDevice The terminal device.
888
889 @return None.
890
891 **/
892 VOID
893 InitializeRawFiFo (
894 IN TERMINAL_DEV *TerminalDevice
895 );
896
897 /**
898 Initialize the Unicode FIFO.
899
900 @param TerminalDevice The terminal device.
901
902 @return None.
903
904 **/
905 VOID
906 InitializeUnicodeFiFo (
907 IN TERMINAL_DEV *TerminalDevice
908 );
909
910 /**
911 Initialize the EFI Key FIFO.
912
913 @param TerminalDevice The terminal device.
914
915 @return None.
916
917 **/
918 VOID
919 InitializeEfiKeyFiFo (
920 IN TERMINAL_DEV *TerminalDevice
921 );
922
923 /**
924 Get one key out of serial buffer.
925
926 @param SerialIo Serial I/O protocl attached to the serial device.
927 @param Input The fetched key.
928
929 @return EFI_NOT_READY If serial buffer is empty.
930 @return EFI_DEVICE_ERROR If reading serial buffer encounter error.
931 @return EFI_SUCCESS If reading serial buffer successfully, put
932 the fetched key to the parameter output.
933
934 **/
935 EFI_STATUS
936 GetOneKeyFromSerial (
937 EFI_SERIAL_IO_PROTOCOL *SerialIo,
938 UINT8 *Input
939 );
940
941 /**
942 Insert one byte raw data into the Raw Data FIFO.
943
944 @param TerminalDevice Terminal driver private structure.
945 @param Input The key will be input.
946
947 @return TRUE If insert successfully.
948 @return FLASE If Raw Data buffer is full before key insertion,
949 and the key is lost.
950
951 **/
952 BOOLEAN
953 RawFiFoInsertOneKey (
954 TERMINAL_DEV *TerminalDevice,
955 UINT8 Input
956 );
957
958 /**
959 Remove one pre-fetched key out of the Raw Data FIFO.
960
961 @param TerminalDevice Terminal driver private structure.
962 @param Output The key will be removed.
963
964 @return TRUE If insert successfully.
965 @return FLASE If Raw Data FIFO buffer is empty before remove operation.
966
967 **/
968 BOOLEAN
969 RawFiFoRemoveOneKey (
970 TERMINAL_DEV *TerminalDevice,
971 UINT8 *Output
972 );
973
974 /**
975 Clarify whether Raw Data FIFO buffer is empty.
976
977 @param TerminalDevice Terminal driver private structure
978
979 @return TRUE If Raw Data FIFO buffer is empty.
980 @return FLASE If Raw Data FIFO buffer is not empty.
981
982 **/
983 BOOLEAN
984 IsRawFiFoEmpty (
985 TERMINAL_DEV *TerminalDevice
986 );
987
988 /**
989 Clarify whether Raw Data FIFO buffer is full.
990
991 @param TerminalDevice Terminal driver private structure
992
993 @return TRUE If Raw Data FIFO buffer is full.
994 @return FLASE If Raw Data FIFO buffer is not full.
995
996 **/
997 BOOLEAN
998 IsRawFiFoFull (
999 TERMINAL_DEV *TerminalDevice
1000 );
1001
1002 /**
1003 Insert one pre-fetched key into the FIFO buffer.
1004
1005 @param TerminalDevice Terminal driver private structure.
1006 @param Key The key will be input.
1007
1008 @return TRUE If insert successfully.
1009 @return FLASE If FIFO buffer is full before key insertion,
1010 and the key is lost.
1011
1012 **/
1013 BOOLEAN
1014 EfiKeyFiFoInsertOneKey (
1015 TERMINAL_DEV *TerminalDevice,
1016 EFI_INPUT_KEY Key
1017 );
1018
1019 /**
1020 Remove one pre-fetched key out of the FIFO buffer.
1021
1022 @param TerminalDevice Terminal driver private structure.
1023 @param Output The key will be removed.
1024
1025 @return TRUE If insert successfully.
1026 @return FLASE If FIFO buffer is empty before remove operation.
1027
1028 **/
1029 BOOLEAN
1030 EfiKeyFiFoRemoveOneKey (
1031 TERMINAL_DEV *TerminalDevice,
1032 EFI_INPUT_KEY *Output
1033 );
1034
1035 /**
1036 Clarify whether FIFO buffer is empty.
1037
1038 @param TerminalDevice Terminal driver private structure
1039
1040 @return TRUE If FIFO buffer is empty.
1041 @return FLASE If FIFO buffer is not empty.
1042
1043 **/
1044 BOOLEAN
1045 IsEfiKeyFiFoEmpty (
1046 TERMINAL_DEV *TerminalDevice
1047 );
1048
1049 /**
1050 Clarify whether FIFO buffer is full.
1051
1052 @param TerminalDevice Terminal driver private structure
1053
1054 @return TRUE If FIFO buffer is full.
1055 @return FLASE If FIFO buffer is not full.
1056
1057 **/
1058 BOOLEAN
1059 IsEfiKeyFiFoFull (
1060 TERMINAL_DEV *TerminalDevice
1061 );
1062
1063 /**
1064 Insert one pre-fetched key into the Unicode FIFO buffer.
1065
1066 @param TerminalDevice Terminal driver private structure.
1067 @param Input The key will be input.
1068
1069 @return TRUE If insert successfully.
1070 @return FLASE If Unicode FIFO buffer is full before key insertion,
1071 and the key is lost.
1072
1073 **/
1074 BOOLEAN
1075 UnicodeFiFoInsertOneKey (
1076 TERMINAL_DEV *TerminalDevice,
1077 UINT16 Input
1078 );
1079
1080 /**
1081 Remove one pre-fetched key out of the Unicode FIFO buffer.
1082
1083 @param TerminalDevice Terminal driver private structure.
1084 @param Output The key will be removed.
1085
1086 @return TRUE If insert successfully.
1087 @return FLASE If Unicode FIFO buffer is empty before remove operation.
1088
1089 **/
1090 BOOLEAN
1091 UnicodeFiFoRemoveOneKey (
1092 TERMINAL_DEV *TerminalDevice,
1093 UINT16 *Output
1094 );
1095
1096 /**
1097 Clarify whether Unicode FIFO buffer is empty.
1098
1099 @param TerminalDevice Terminal driver private structure
1100
1101 @return TRUE If Unicode FIFO buffer is empty.
1102 @return FLASE If Unicode FIFO buffer is not empty.
1103
1104 **/
1105 BOOLEAN
1106 IsUnicodeFiFoEmpty (
1107 TERMINAL_DEV *TerminalDevice
1108 );
1109
1110 /**
1111 Clarify whether Unicode FIFO buffer is full.
1112
1113 @param TerminalDevice Terminal driver private structure
1114
1115 @return TRUE If Unicode FIFO buffer is full.
1116 @return FLASE If Unicode FIFO buffer is not full.
1117
1118 **/
1119 BOOLEAN
1120 IsUnicodeFiFoFull (
1121 TERMINAL_DEV *TerminalDevice
1122 );
1123
1124 /**
1125 Count Unicode FIFO buffer.
1126
1127 @param TerminalDevice Terminal driver private structure
1128
1129 @return The count in bytes of Unicode FIFO.
1130
1131 **/
1132 UINT8
1133 UnicodeFiFoGetKeyCount (
1134 TERMINAL_DEV *TerminalDevice
1135 );
1136
1137 /**
1138 Translate raw data into Unicode (according to different encode), and
1139 translate Unicode into key information. (according to different standard).
1140
1141 @param TerminalDevice Terminal driver private structure.
1142
1143 @return none.
1144
1145 **/
1146 VOID
1147 TranslateRawDataToEfiKey (
1148 IN TERMINAL_DEV *TerminalDevice
1149 );
1150
1151 //
1152 // internal functions for PC ANSI
1153 //
1154
1155 /**
1156 Translate all raw data in the Raw FIFI into unicode, and insert
1157 them into Unicode FIFO.
1158
1159 @param TerminalDevice The terminal device.
1160
1161 @return None.
1162
1163 **/
1164 VOID
1165 AnsiRawDataToUnicode (
1166 IN TERMINAL_DEV *TerminalDevice
1167 );
1168
1169 /**
1170 Converts a stream of Unicode characters from a terminal input device into EFI Keys that
1171 can be read through the Simple Input Protocol.
1172
1173 The table below shows the keyboard input mappings that this function supports.
1174 If the ESC sequence listed in one of the columns is presented, then it is translated
1175 into the coorespoding EFI Scan Code. If a matching sequence is not found, then the raw
1176 key strokes are converted into EFI Keys.
1177
1178 2 seconds are allowed for an ESC sequence to be completed. If the ESC sequence is not
1179 completed in 2 seconds, then the raw key strokes of the partial ESC sequence are
1180 converted into EFI Keys.
1181 There is one special input sequence that will force the system to reset.
1182 This is ESC R ESC r ESC R.
1183
1184 Symbols used in table below
1185 ===========================
1186 ESC = 0x1B
1187 CSI = 0x9B
1188 DEL = 0x7f
1189 ^ = CTRL
1190 +=========+======+===========+==========+==========+
1191 | | EFI | UEFI 2.0 | | |
1192 | | Scan | | VT100+ | |
1193 | KEY | Code | PC ANSI | VTUTF8 | VT100 |
1194 +=========+======+===========+==========+==========+
1195 | NULL | 0x00 | | | |
1196 | UP | 0x01 | ESC [ A | ESC [ A | ESC [ A |
1197 | DOWN | 0x02 | ESC [ B | ESC [ B | ESC [ B |
1198 | RIGHT | 0x03 | ESC [ C | ESC [ C | ESC [ C |
1199 | LEFT | 0x04 | ESC [ D | ESC [ D | ESC [ D |
1200 | HOME | 0x05 | ESC [ H | ESC h | ESC [ H |
1201 | END | 0x06 | ESC [ F | ESC k | ESC [ K |
1202 | INSERT | 0x07 | ESC [ @ | ESC + | ESC [ @ |
1203 | | | ESC [ L | | ESC [ L |
1204 | DELETE | 0x08 | ESC [ X | ESC - | ESC [ P |
1205 | PG UP | 0x09 | ESC [ I | ESC ? | ESC [ V |
1206 | | | | | ESC [ ? |
1207 | PG DOWN | 0x0A | ESC [ G | ESC / | ESC [ U |
1208 | | | | | ESC [ / |
1209 | F1 | 0x0B | ESC [ M | ESC 1 | ESC O P |
1210 | F2 | 0x0C | ESC [ N | ESC 2 | ESC O Q |
1211 | F3 | 0x0D | ESC [ O | ESC 3 | ESC O w |
1212 | F4 | 0x0E | ESC [ P | ESC 4 | ESC O x |
1213 | F5 | 0x0F | ESC [ Q | ESC 5 | ESC O t |
1214 | F6 | 0x10 | ESC [ R | ESC 6 | ESC O u |
1215 | F7 | 0x11 | ESC [ S | ESC 7 | ESC O q |
1216 | F8 | 0x12 | ESC [ T | ESC 8 | ESC O r |
1217 | F9 | 0x13 | ESC [ U | ESC 9 | ESC O p |
1218 | F10 | 0x14 | ESC [ V | ESC 0 | ESC O M |
1219 | Escape | 0x17 | ESC | ESC | ESC |
1220 | F11 | 0x15 | | ESC ! | |
1221 | F12 | 0x16 | | ESC @ | |
1222 +=========+======+===========+==========+==========+
1223
1224 Special Mappings
1225 ================
1226 ESC R ESC r ESC R = Reset System
1227
1228
1229 @param TerminalDevice The terminal device to use to translate raw input into EFI Keys
1230
1231 @return None.
1232
1233 **/
1234 VOID
1235 UnicodeToEfiKey (
1236 IN TERMINAL_DEV *TerminalDevice
1237 );
1238
1239 /**
1240 Check if input string is valid Ascii string, valid EFI control characters
1241 or valid text graphics.
1242
1243 @param TerminalDevice The terminal device.
1244 @param WString The input string.
1245
1246 @retval EFI_UNSUPPORTED If not all input characters are valid.
1247 @retval EFI_SUCCESS If all input characters are valid.
1248
1249 **/
1250 EFI_STATUS
1251 AnsiTestString (
1252 IN TERMINAL_DEV *TerminalDevice,
1253 IN CHAR16 *WString
1254 );
1255
1256 //
1257 // internal functions for VTUTF8
1258 //
1259
1260 /**
1261 Translate all VT-UTF8 characters in the Raw FIFI into unicode characters,
1262 and insert them into Unicode FIFO.
1263
1264 @param VtUtf8Device The terminal device.
1265
1266 @return None.
1267
1268 **/
1269 VOID
1270 VTUTF8RawDataToUnicode (
1271 IN TERMINAL_DEV *VtUtf8Device
1272 );
1273
1274 /**
1275 Check if input string is valid VT-UTF8 string.
1276
1277 @param TerminalDevice The terminal device.
1278 @param WString The input string.
1279
1280 @retval EFI_SUCCESS If all input characters are valid.
1281
1282 **/
1283 EFI_STATUS
1284 VTUTF8TestString (
1285 IN TERMINAL_DEV *TerminalDevice,
1286 IN CHAR16 *WString
1287 );
1288
1289 /**
1290 Translate one Unicode character into VT-UTF8 characters.
1291
1292 UTF8 Encoding Table
1293 Bits per Character | Unicode Character Range | Unicode Binary Encoding | UTF8 Binary Encoding
1294 0-7 | 0x0000 - 0x007F | 00000000 0xxxxxxx | 0xxxxxxx
1295 8-11 | 0x0080 - 0x07FF | 00000xxx xxxxxxxx | 110xxxxx 10xxxxxx
1296 12-16 | 0x0800 - 0xFFFF | xxxxxxxx xxxxxxxx | 1110xxxx 10xxxxxx 10xxxxxx
1297
1298
1299 @param Unicode Unicode character need translating.
1300 @param Utf8Char Return VT-UTF8 character set.
1301 @param ValidBytes The count of valid VT-UTF8 characters. If
1302 ValidBytes is zero, no valid VT-UTF8 returned.
1303
1304 @return None.
1305
1306 **/
1307 VOID
1308 UnicodeToUtf8 (
1309 IN CHAR16 Unicode,
1310 OUT UTF8_CHAR *Utf8Char,
1311 OUT UINT8 *ValidBytes
1312 );
1313
1314 /**
1315 Get one valid VT-UTF8 characters set from Raw Data FIFO.
1316
1317 @param Utf8Device The terminal device.
1318 @param Utf8Char Returned valid VT-UTF8 characters set.
1319 @param ValidBytes The count of returned VT-VTF8 characters.
1320 If ValidBytes is zero, no valid VT-UTF8 returned.
1321
1322 **/
1323 VOID
1324 GetOneValidUtf8Char (
1325 IN TERMINAL_DEV *Utf8Device,
1326 OUT UTF8_CHAR *Utf8Char,
1327 OUT UINT8 *ValidBytes
1328 );
1329
1330 /**
1331 Translate VT-UTF8 characters into one Unicode character.
1332
1333 UTF8 Encoding Table
1334 Bits per Character | Unicode Character Range | Unicode Binary Encoding | UTF8 Binary Encoding
1335 0-7 | 0x0000 - 0x007F | 00000000 0xxxxxxx | 0xxxxxxx
1336 8-11 | 0x0080 - 0x07FF | 00000xxx xxxxxxxx | 110xxxxx 10xxxxxx
1337 12-16 | 0x0800 - 0xFFFF | xxxxxxxx xxxxxxxx | 1110xxxx 10xxxxxx 10xxxxxx
1338
1339
1340 @param Utf8Char VT-UTF8 character set needs translating.
1341 @param ValidBytes The count of valid VT-UTF8 characters.
1342 @param UnicodeChar Returned unicode character.
1343
1344 @return None.
1345
1346 **/
1347 VOID
1348 Utf8ToUnicode (
1349 IN UTF8_CHAR Utf8Char,
1350 IN UINT8 ValidBytes,
1351 OUT CHAR16 *UnicodeChar
1352 );
1353
1354 //
1355 // functions for boxdraw unicode
1356 //
1357
1358 /**
1359 Detects if a Unicode char is for Box Drawing text graphics.
1360
1361 @param Graphic Unicode char to test.
1362 @param PcAnsi Optional pointer to return PCANSI equivalent of
1363 Graphic.
1364 @param Ascii Optional pointer to return ASCII equivalent of
1365 Graphic.
1366
1367 @return TRUE If Graphic is a supported Unicode Box Drawing character.
1368
1369 **/
1370 BOOLEAN
1371 TerminalIsValidTextGraphics (
1372 IN CHAR16 Graphic,
1373 OUT CHAR8 *PcAnsi, OPTIONAL
1374 OUT CHAR8 *Ascii OPTIONAL
1375 );
1376
1377 /**
1378 Detects if a valid ASCII char.
1379
1380 @param Ascii An ASCII character.
1381
1382 @retval TRUE If it is a valid ASCII character.
1383 @retval FALSE If it is not a valid ASCII character.
1384
1385 **/
1386 BOOLEAN
1387 TerminalIsValidAscii (
1388 IN CHAR16 Ascii
1389 );
1390
1391 /**
1392 Detects if a valid EFI control character.
1393
1394 @param CharC An input EFI Control character.
1395
1396 @retval TRUE If it is a valid EFI control character.
1397 @retval FALSE If it is not a valid EFI control character.
1398
1399 **/
1400 BOOLEAN
1401 TerminalIsValidEfiCntlChar (
1402 IN CHAR16 CharC
1403 );
1404
1405 #endif