]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Universal/Console/TerminalDxe/Terminal.h
1. Fixed bugs in DxeNetLib to meet consistence with network module DriverBinding...
[mirror_edk2.git] / MdeModulePkg / Universal / Console / TerminalDxe / Terminal.h
1 /*++
2
3 Copyright (c) 2006, Intel Corporation
4 All rights reserved. This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
8
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
11
12 Module Name:
13
14 terminal.h
15
16 Abstract:
17
18
19 Revision History
20
21 --*/
22
23 #ifndef _TERMINAL_H
24 #define _TERMINAL_H
25
26
27 #include <PiDxe.h>
28 #include <Protocol/SimpleTextOut.h>
29 #include <Protocol/SerialIo.h>
30 #include <Guid/GlobalVariable.h>
31 #include <Protocol/DevicePath.h>
32 #include <Protocol/SimpleTextIn.h>
33 #include <Protocol/SimpleTextInEx.h>
34 #include <Guid/HotPlugDevice.h>
35 #include <Guid/PcAnsi.h>
36 #include <Library/DebugLib.h>
37 #include <Library/UefiDriverEntryPoint.h>
38 #include <Library/UefiLib.h>
39 #include <Library/ReportStatusCodeLib.h>
40 #include <Library/BaseMemoryLib.h>
41 #include <Library/MemoryAllocationLib.h>
42 #include <Library/UefiBootServicesTableLib.h>
43 #include <Library/UefiRuntimeServicesTableLib.h>
44 #include <Library/DevicePathLib.h>
45 #include <Library/PcdLib.h>
46 #include <Library/BaseLib.h>
47
48
49 #define RAW_FIFO_MAX_NUMBER 256
50 #define FIFO_MAX_NUMBER 128
51
52 typedef struct {
53 UINT8 Head;
54 UINT8 Tail;
55 UINT8 Data[RAW_FIFO_MAX_NUMBER + 1];
56 } RAW_DATA_FIFO;
57
58 typedef struct {
59 UINT8 Head;
60 UINT8 Tail;
61 UINT16 Data[FIFO_MAX_NUMBER + 1];
62 } UNICODE_FIFO;
63
64 typedef struct {
65 UINT8 Head;
66 UINT8 Tail;
67 EFI_INPUT_KEY Data[FIFO_MAX_NUMBER + 1];
68 } EFI_KEY_FIFO;
69
70 #define TERMINAL_DEV_SIGNATURE EFI_SIGNATURE_32 ('t', 'm', 'n', 'l')
71
72 #define TERMINAL_CONSOLE_IN_EX_NOTIFY_SIGNATURE EFI_SIGNATURE_32 ('t', 'm', 'e', 'n')
73
74 typedef struct _TERMINAL_CONSOLE_IN_EX_NOTIFY {
75 UINTN Signature;
76 EFI_HANDLE NotifyHandle;
77 EFI_KEY_DATA KeyData;
78 EFI_KEY_NOTIFY_FUNCTION KeyNotificationFn;
79 LIST_ENTRY NotifyEntry;
80 } TERMINAL_CONSOLE_IN_EX_NOTIFY;
81 typedef struct {
82 UINTN Signature;
83 EFI_HANDLE Handle;
84 UINT8 TerminalType;
85 EFI_SERIAL_IO_PROTOCOL *SerialIo;
86 EFI_DEVICE_PATH_PROTOCOL *DevicePath;
87 EFI_SIMPLE_TEXT_INPUT_PROTOCOL SimpleInput;
88 EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL SimpleTextOutput;
89 EFI_SIMPLE_TEXT_OUTPUT_MODE SimpleTextOutputMode;
90 UINTN SerialInTimeOut;
91 RAW_DATA_FIFO RawFiFo;
92 UNICODE_FIFO UnicodeFiFo;
93 EFI_KEY_FIFO EfiKeyFiFo;
94 EFI_UNICODE_STRING_TABLE *ControllerNameTable;
95 EFI_EVENT TwoSecondTimeOut;
96 UINT32 InputState;
97 UINT32 ResetState;
98
99 //
100 // Esc could not be output to the screen by user,
101 // but the terminal driver need to output it to
102 // the terminal emulation software to send control sequence.
103 // This boolean is used by the terminal driver only
104 // to indicate whether the Esc could be sent or not.
105 //
106 BOOLEAN OutputEscChar;
107 EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL SimpleInputEx;
108 LIST_ENTRY NotifyList;
109 } TERMINAL_DEV;
110
111 #define INPUT_STATE_DEFAULT 0x00
112 #define INPUT_STATE_ESC 0x01
113 #define INPUT_STATE_CSI 0x02
114 #define INPUT_STATE_LEFTOPENBRACKET 0x04
115 #define INPUT_STATE_O 0x08
116 #define INPUT_STATE_2 0x10
117
118 #define RESET_STATE_DEFAULT 0x00
119 #define RESET_STATE_ESC_R 0x01
120 #define RESET_STATE_ESC_R_ESC_r 0x02
121
122 #define TERMINAL_CON_IN_DEV_FROM_THIS(a) CR (a, TERMINAL_DEV, SimpleInput, TERMINAL_DEV_SIGNATURE)
123 #define TERMINAL_CON_OUT_DEV_FROM_THIS(a) CR (a, TERMINAL_DEV, SimpleTextOutput, TERMINAL_DEV_SIGNATURE)
124 #define TERMINAL_CON_IN_EX_DEV_FROM_THIS(a) CR (a, TERMINAL_DEV, SimpleInputEx, TERMINAL_DEV_SIGNATURE)
125
126 typedef union {
127 UINT8 Utf8_1;
128 UINT8 Utf8_2[2];
129 UINT8 Utf8_3[3];
130 } UTF8_CHAR;
131
132 #define PcAnsiType 0
133 #define VT100Type 1
134 #define VT100PlusType 2
135 #define VTUTF8Type 3
136
137 #define LEFTOPENBRACKET 0x5b // '['
138 #define ACAP 0x41
139 #define BCAP 0x42
140 #define CCAP 0x43
141 #define DCAP 0x44
142
143 #define MODE0_COLUMN_COUNT 80
144 #define MODE0_ROW_COUNT 25
145
146 #define MODE1_COLUMN_COUNT 100
147 #define MODE1_ROW_COUNT 31
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 extern EFI_GUID gSimpleTextInExNotifyGuid;
172 //
173 // Prototypes
174 //
175 EFI_STATUS
176 EFIAPI
177 InitializeTerminal (
178 IN EFI_HANDLE ImageHandle,
179 IN EFI_SYSTEM_TABLE *SystemTable
180 )
181 ;
182
183 EFI_STATUS
184 EFIAPI
185 TerminalConInReset (
186 IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *This,
187 IN BOOLEAN ExtendedVerification
188 )
189 ;
190
191 EFI_STATUS
192 EFIAPI
193 TerminalConInReadKeyStroke (
194 IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *This,
195 OUT EFI_INPUT_KEY *Key
196 )
197 ;
198
199
200 BOOLEAN
201 IsKeyRegistered (
202 IN EFI_KEY_DATA *RegsiteredData,
203 IN EFI_KEY_DATA *InputData
204 )
205 /*++
206
207 Routine Description:
208
209 Arguments:
210
211 RegsiteredData - A pointer to a buffer that is filled in with the keystroke
212 state data for the key that was registered.
213 InputData - A pointer to a buffer that is filled in with the keystroke
214 state data for the key that was pressed.
215
216 Returns:
217 TRUE - Key be pressed matches a registered key.
218 FLASE - Match failed.
219
220 --*/
221 ;
222
223 VOID
224 EFIAPI
225 TerminalConInWaitForKeyEx (
226 IN EFI_EVENT Event,
227 IN VOID *Context
228 )
229 ;
230 //
231 // Simple Text Input Ex protocol prototypes
232 //
233
234 EFI_STATUS
235 EFIAPI
236 TerminalConInResetEx (
237 IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
238 IN BOOLEAN ExtendedVerification
239 )
240 /*++
241
242 Routine Description:
243 Reset the input device and optionaly run diagnostics
244
245 Arguments:
246 This - Protocol instance pointer.
247 ExtendedVerification - Driver may perform diagnostics on reset.
248
249 Returns:
250 EFI_SUCCESS - The device was reset.
251 EFI_DEVICE_ERROR - The device is not functioning properly and could
252 not be reset.
253
254 --*/
255 ;
256
257 EFI_STATUS
258 EFIAPI
259 TerminalConInReadKeyStrokeEx (
260 IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
261 OUT EFI_KEY_DATA *KeyData
262 )
263 /*++
264
265 Routine Description:
266 Reads the next keystroke from the input device. The WaitForKey Event can
267 be used to test for existance of a keystroke via WaitForEvent () call.
268
269 Arguments:
270 This - Protocol instance pointer.
271 KeyData - A pointer to a buffer that is filled in with the keystroke
272 state data for the key that was pressed.
273
274 Returns:
275 EFI_SUCCESS - The keystroke information was returned.
276 EFI_NOT_READY - There was no keystroke data availiable.
277 EFI_DEVICE_ERROR - The keystroke information was not returned due to
278 hardware errors.
279 EFI_INVALID_PARAMETER - KeyData is NULL.
280
281 --*/
282 ;
283
284 EFI_STATUS
285 EFIAPI
286 TerminalConInSetState (
287 IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
288 IN EFI_KEY_TOGGLE_STATE *KeyToggleState
289 )
290 /*++
291
292 Routine Description:
293 Set certain state for the input device.
294
295 Arguments:
296 This - Protocol instance pointer.
297 KeyToggleState - A pointer to the EFI_KEY_TOGGLE_STATE to set the
298 state for the input device.
299
300 Returns:
301 EFI_SUCCESS - The device state was set successfully.
302 EFI_DEVICE_ERROR - The device is not functioning correctly and could
303 not have the setting adjusted.
304 EFI_UNSUPPORTED - The device does not have the ability to set its state.
305 EFI_INVALID_PARAMETER - KeyToggleState is NULL.
306
307 --*/
308 ;
309
310 EFI_STATUS
311 EFIAPI
312 TerminalConInRegisterKeyNotify (
313 IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
314 IN EFI_KEY_DATA *KeyData,
315 IN EFI_KEY_NOTIFY_FUNCTION KeyNotificationFunction,
316 OUT EFI_HANDLE *NotifyHandle
317 )
318 /*++
319
320 Routine Description:
321 Register a notification function for a particular keystroke for the input device.
322
323 Arguments:
324 This - Protocol instance pointer.
325 KeyData - A pointer to a buffer that is filled in with the keystroke
326 information data for the key that was pressed.
327 KeyNotificationFunction - Points to the function to be called when the key
328 sequence is typed specified by KeyData.
329 NotifyHandle - Points to the unique handle assigned to the registered notification.
330
331 Returns:
332 EFI_SUCCESS - The notification function was registered successfully.
333 EFI_OUT_OF_RESOURCES - Unable to allocate resources for necesssary data structures.
334 EFI_INVALID_PARAMETER - KeyData or NotifyHandle is NULL.
335
336 --*/
337 ;
338
339 EFI_STATUS
340 EFIAPI
341 TerminalConInUnregisterKeyNotify (
342 IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
343 IN EFI_HANDLE NotificationHandle
344 )
345 /*++
346
347 Routine Description:
348 Remove a registered notification function from a particular keystroke.
349
350 Arguments:
351 This - Protocol instance pointer.
352 NotificationHandle - The handle of the notification function being unregistered.
353
354 Returns:
355 EFI_SUCCESS - The notification function was unregistered successfully.
356 EFI_INVALID_PARAMETER - The NotificationHandle is invalid.
357 EFI_NOT_FOUND - Can not find the matching entry in database.
358
359 --*/
360 ;
361
362 VOID
363 EFIAPI
364 TerminalConInWaitForKey (
365 IN EFI_EVENT Event,
366 IN VOID *Context
367 )
368 ;
369
370 EFI_STATUS
371 EFIAPI
372 TerminalConOutReset (
373 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
374 IN BOOLEAN ExtendedVerification
375 )
376 ;
377
378 EFI_STATUS
379 EFIAPI
380 TerminalConOutOutputString (
381 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
382 IN CHAR16 *WString
383 )
384 ;
385
386 EFI_STATUS
387 EFIAPI
388 TerminalConOutTestString (
389 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
390 IN CHAR16 *WString
391 )
392 ;
393
394 EFI_STATUS
395 EFIAPI
396 TerminalConOutQueryMode (
397 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
398 IN UINTN ModeNumber,
399 OUT UINTN *Columns,
400 OUT UINTN *Rows
401 )
402 ;
403
404 EFI_STATUS
405 EFIAPI
406 TerminalConOutSetMode (
407 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
408 IN UINTN ModeNumber
409 )
410 ;
411
412 EFI_STATUS
413 EFIAPI
414 TerminalConOutSetAttribute (
415 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
416 IN UINTN Attribute
417 )
418 ;
419
420 EFI_STATUS
421 EFIAPI
422 TerminalConOutClearScreen (
423 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This
424 )
425 ;
426
427 EFI_STATUS
428 EFIAPI
429 TerminalConOutSetCursorPosition (
430 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
431 IN UINTN Column,
432 IN UINTN Row
433 )
434 ;
435
436 EFI_STATUS
437 EFIAPI
438 TerminalConOutEnableCursor (
439 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
440 IN BOOLEAN Visible
441 )
442 ;
443
444 EFI_STATUS
445 EFIAPI
446 TerminalDriverBindingSupported (
447 IN EFI_DRIVER_BINDING_PROTOCOL *This,
448 IN EFI_HANDLE Controller,
449 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
450 );
451
452 EFI_STATUS
453 EFIAPI
454 TerminalDriverBindingStart (
455 IN EFI_DRIVER_BINDING_PROTOCOL *This,
456 IN EFI_HANDLE Controller,
457 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
458 );
459
460 EFI_STATUS
461 EFIAPI
462 TerminalDriverBindingStop (
463 IN EFI_DRIVER_BINDING_PROTOCOL *This,
464 IN EFI_HANDLE Controller,
465 IN UINTN NumberOfChildren,
466 IN EFI_HANDLE *ChildHandleBuffer
467 );
468
469 /**
470 Retrieves a Unicode string that is the user readable name of the driver.
471
472 This function retrieves the user readable name of a driver in the form of a
473 Unicode string. If the driver specified by This has a user readable name in
474 the language specified by Language, then a pointer to the driver name is
475 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
476 by This does not support the language specified by Language,
477 then EFI_UNSUPPORTED is returned.
478
479 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
480 EFI_COMPONENT_NAME_PROTOCOL instance.
481
482 @param Language[in] A pointer to a Null-terminated ASCII string
483 array indicating the language. This is the
484 language of the driver name that the caller is
485 requesting, and it must match one of the
486 languages specified in SupportedLanguages. The
487 number of languages supported by a driver is up
488 to the driver writer. Language is specified
489 in RFC 3066 or ISO 639-2 language code format.
490
491 @param DriverName[out] A pointer to the Unicode string to return.
492 This Unicode string is the name of the
493 driver specified by This in the language
494 specified by Language.
495
496 @retval EFI_SUCCESS The Unicode string for the Driver specified by
497 This and the language specified by Language was
498 returned in DriverName.
499
500 @retval EFI_INVALID_PARAMETER Language is NULL.
501
502 @retval EFI_INVALID_PARAMETER DriverName is NULL.
503
504 @retval EFI_UNSUPPORTED The driver specified by This does not support
505 the language specified by Language.
506
507 **/
508 EFI_STATUS
509 EFIAPI
510 TerminalComponentNameGetDriverName (
511 IN EFI_COMPONENT_NAME_PROTOCOL *This,
512 IN CHAR8 *Language,
513 OUT CHAR16 **DriverName
514 );
515
516
517 /**
518 Retrieves a Unicode string that is the user readable name of the controller
519 that is being managed by a driver.
520
521 This function retrieves the user readable name of the controller specified by
522 ControllerHandle and ChildHandle in the form of a Unicode string. If the
523 driver specified by This has a user readable name in the language specified by
524 Language, then a pointer to the controller name is returned in ControllerName,
525 and EFI_SUCCESS is returned. If the driver specified by This is not currently
526 managing the controller specified by ControllerHandle and ChildHandle,
527 then EFI_UNSUPPORTED is returned. If the driver specified by This does not
528 support the language specified by Language, then EFI_UNSUPPORTED is returned.
529
530 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
531 EFI_COMPONENT_NAME_PROTOCOL instance.
532
533 @param ControllerHandle[in] The handle of a controller that the driver
534 specified by This is managing. This handle
535 specifies the controller whose name is to be
536 returned.
537
538 @param ChildHandle[in] The handle of the child controller to retrieve
539 the name of. This is an optional parameter that
540 may be NULL. It will be NULL for device
541 drivers. It will also be NULL for a bus drivers
542 that wish to retrieve the name of the bus
543 controller. It will not be NULL for a bus
544 driver that wishes to retrieve the name of a
545 child controller.
546
547 @param Language[in] A pointer to a Null-terminated ASCII string
548 array indicating the language. This is the
549 language of the driver name that the caller is
550 requesting, and it must match one of the
551 languages specified in SupportedLanguages. The
552 number of languages supported by a driver is up
553 to the driver writer. Language is specified in
554 RFC 3066 or ISO 639-2 language code format.
555
556 @param ControllerName[out] A pointer to the Unicode string to return.
557 This Unicode string is the name of the
558 controller specified by ControllerHandle and
559 ChildHandle in the language specified by
560 Language from the point of view of the driver
561 specified by This.
562
563 @retval EFI_SUCCESS The Unicode string for the user readable name in
564 the language specified by Language for the
565 driver specified by This was returned in
566 DriverName.
567
568 @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
569
570 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
571 EFI_HANDLE.
572
573 @retval EFI_INVALID_PARAMETER Language is NULL.
574
575 @retval EFI_INVALID_PARAMETER ControllerName is NULL.
576
577 @retval EFI_UNSUPPORTED The driver specified by This is not currently
578 managing the controller specified by
579 ControllerHandle and ChildHandle.
580
581 @retval EFI_UNSUPPORTED The driver specified by This does not support
582 the language specified by Language.
583
584 **/
585 EFI_STATUS
586 EFIAPI
587 TerminalComponentNameGetControllerName (
588 IN EFI_COMPONENT_NAME_PROTOCOL *This,
589 IN EFI_HANDLE ControllerHandle,
590 IN EFI_HANDLE ChildHandle OPTIONAL,
591 IN CHAR8 *Language,
592 OUT CHAR16 **ControllerName
593 );
594
595
596 //
597 // internal functions
598 //
599 EFI_STATUS
600 TerminalConInCheckForKey (
601 IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *This
602 )
603 ;
604
605 VOID
606 TerminalUpdateConsoleDevVariable (
607 IN CHAR16 *VariableName,
608 IN EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath
609 )
610 ;
611
612 VOID
613 TerminalRemoveConsoleDevVariable (
614 IN CHAR16 *VariableName,
615 IN EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath
616 )
617 ;
618
619 VOID *
620 TerminalGetVariableAndSize (
621 IN CHAR16 *Name,
622 IN EFI_GUID *VendorGuid,
623 OUT UINTN *VariableSize
624 )
625 ;
626
627 EFI_STATUS
628 SetTerminalDevicePath (
629 IN UINT8 TerminalType,
630 IN EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath,
631 OUT EFI_DEVICE_PATH_PROTOCOL **TerminalDevicePath
632 )
633 ;
634
635 VOID
636 InitializeRawFiFo (
637 IN TERMINAL_DEV *TerminalDevice
638 )
639 ;
640
641 VOID
642 InitializeUnicodeFiFo (
643 IN TERMINAL_DEV *TerminalDevice
644 )
645 ;
646
647 VOID
648 InitializeEfiKeyFiFo (
649 IN TERMINAL_DEV *TerminalDevice
650 )
651 ;
652
653 EFI_STATUS
654 GetOneKeyFromSerial (
655 EFI_SERIAL_IO_PROTOCOL *SerialIo,
656 UINT8 *Input
657 )
658 ;
659
660 BOOLEAN
661 RawFiFoInsertOneKey (
662 TERMINAL_DEV *TerminalDevice,
663 UINT8 Input
664 )
665 ;
666
667 BOOLEAN
668 RawFiFoRemoveOneKey (
669 TERMINAL_DEV *TerminalDevice,
670 UINT8 *Output
671 )
672 ;
673
674 BOOLEAN
675 IsRawFiFoEmpty (
676 TERMINAL_DEV *TerminalDevice
677 )
678 ;
679
680 BOOLEAN
681 IsRawFiFoFull (
682 TERMINAL_DEV *TerminalDevice
683 )
684 ;
685
686 BOOLEAN
687 EfiKeyFiFoInsertOneKey (
688 TERMINAL_DEV *TerminalDevice,
689 EFI_INPUT_KEY Key
690 )
691 ;
692
693 BOOLEAN
694 EfiKeyFiFoRemoveOneKey (
695 TERMINAL_DEV *TerminalDevice,
696 EFI_INPUT_KEY *Output
697 )
698 ;
699
700 BOOLEAN
701 IsEfiKeyFiFoEmpty (
702 TERMINAL_DEV *TerminalDevice
703 )
704 ;
705
706 BOOLEAN
707 IsEfiKeyFiFoFull (
708 TERMINAL_DEV *TerminalDevice
709 )
710 ;
711
712 BOOLEAN
713 UnicodeFiFoInsertOneKey (
714 TERMINAL_DEV *TerminalDevice,
715 UINT16 Input
716 )
717 ;
718
719 BOOLEAN
720 UnicodeFiFoRemoveOneKey (
721 TERMINAL_DEV *TerminalDevice,
722 UINT16 *Output
723 )
724 ;
725
726 BOOLEAN
727 IsUnicodeFiFoEmpty (
728 TERMINAL_DEV *TerminalDevice
729 )
730 ;
731
732 BOOLEAN
733 IsUnicodeFiFoFull (
734 TERMINAL_DEV *TerminalDevice
735 )
736 ;
737
738 UINT8
739 UnicodeFiFoGetKeyCount (
740 TERMINAL_DEV *TerminalDevice
741 )
742 ;
743
744 VOID
745 TranslateRawDataToEfiKey (
746 IN TERMINAL_DEV *TerminalDevice
747 )
748 ;
749
750 //
751 // internal functions for PC ANSI
752 //
753 VOID
754 AnsiRawDataToUnicode (
755 IN TERMINAL_DEV *PcAnsiDevice
756 )
757 ;
758
759 VOID
760 UnicodeToEfiKey (
761 IN TERMINAL_DEV *PcAnsiDevice
762 )
763 ;
764
765 EFI_STATUS
766 AnsiTestString (
767 IN TERMINAL_DEV *TerminalDevice,
768 IN CHAR16 *WString
769 )
770 ;
771
772 //
773 // internal functions for VT100
774 //
775 EFI_STATUS
776 VT100TestString (
777 IN TERMINAL_DEV *VT100Device,
778 IN CHAR16 *WString
779 )
780 ;
781
782 //
783 // internal functions for VT100Plus
784 //
785 EFI_STATUS
786 VT100PlusTestString (
787 IN TERMINAL_DEV *TerminalDevice,
788 IN CHAR16 *WString
789 )
790 ;
791
792 //
793 // internal functions for VTUTF8
794 //
795 VOID
796 VTUTF8RawDataToUnicode (
797 IN TERMINAL_DEV *VtUtf8Device
798 )
799 ;
800
801 EFI_STATUS
802 VTUTF8TestString (
803 IN TERMINAL_DEV *TerminalDevice,
804 IN CHAR16 *WString
805 )
806 ;
807
808 VOID
809 UnicodeToUtf8 (
810 IN CHAR16 Unicode,
811 OUT UTF8_CHAR *Utf8Char,
812 OUT UINT8 *ValidBytes
813 )
814 ;
815
816 VOID
817 GetOneValidUtf8Char (
818 IN TERMINAL_DEV *Utf8Device,
819 OUT UTF8_CHAR *Utf8Char,
820 OUT UINT8 *ValidBytes
821 )
822 ;
823
824 VOID
825 Utf8ToUnicode (
826 IN UTF8_CHAR Utf8Char,
827 IN UINT8 ValidBytes,
828 OUT CHAR16 *UnicodeChar
829 )
830 ;
831
832 //
833 // functions for boxdraw unicode
834 //
835 BOOLEAN
836 TerminalIsValidTextGraphics (
837 IN CHAR16 Graphic,
838 OUT CHAR8 *PcAnsi, OPTIONAL
839 OUT CHAR8 *Ascii OPTIONAL
840 )
841 ;
842
843 BOOLEAN
844 TerminalIsValidAscii (
845 IN CHAR16 Ascii
846 )
847 ;
848
849 BOOLEAN
850 TerminalIsValidEfiCntlChar (
851 IN CHAR16 CharC
852 )
853 ;
854
855 #endif