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