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