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