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