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