X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=MdeModulePkg%2FUniversal%2FConsole%2FTerminalDxe%2FTerminal.h;h=d393acbc2073e1b7d9408058dd6676e95595b066;hp=7327da003a8bb2e318627726585c7a58f3217446;hb=5070befc3b9b013f36062c7cc08320c87c02f972;hpb=aa8f4f55ff80d0c1b1efcdae6d45db76849fc265 diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.h b/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.h index 7327da003a..d393acbc20 100644 --- a/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.h +++ b/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.h @@ -1,8 +1,8 @@ /** @file Header file for Terminal driver. -Copyright (c) 2006 - 2008, Intel Corporation.
-All rights reserved. This program and the accompanying materials +Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
+This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php @@ -20,8 +20,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include #include +#include -#include #include #include #include @@ -62,13 +62,19 @@ typedef struct { EFI_INPUT_KEY Data[FIFO_MAX_NUMBER + 1]; } EFI_KEY_FIFO; +typedef struct { + UINTN Columns; + UINTN Rows; +} TERMINAL_CONSOLE_MODE_DATA; + +#define KEYBOARD_TIMER_INTERVAL 200000 // 0.02s + #define TERMINAL_DEV_SIGNATURE SIGNATURE_32 ('t', 'm', 'n', 'l') #define TERMINAL_CONSOLE_IN_EX_NOTIFY_SIGNATURE SIGNATURE_32 ('t', 'm', 'e', 'n') typedef struct _TERMINAL_CONSOLE_IN_EX_NOTIFY { UINTN Signature; - EFI_HANDLE NotifyHandle; EFI_KEY_DATA KeyData; EFI_KEY_NOTIFY_FUNCTION KeyNotificationFn; LIST_ENTRY NotifyEntry; @@ -82,11 +88,13 @@ typedef struct { EFI_SIMPLE_TEXT_INPUT_PROTOCOL SimpleInput; EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL SimpleTextOutput; EFI_SIMPLE_TEXT_OUTPUT_MODE SimpleTextOutputMode; + TERMINAL_CONSOLE_MODE_DATA *TerminalConsoleModeData; UINTN SerialInTimeOut; RAW_DATA_FIFO *RawFiFo; UNICODE_FIFO *UnicodeFiFo; EFI_KEY_FIFO *EfiKeyFiFo; EFI_UNICODE_STRING_TABLE *ControllerNameTable; + EFI_EVENT TimerEvent; EFI_EVENT TwoSecondTimeOut; UINT32 InputState; UINT32 ResetState; @@ -112,7 +120,7 @@ typedef struct { #define RESET_STATE_DEFAULT 0x00 #define RESET_STATE_ESC_R 0x01 -#define RESET_STATE_ESC_R_ESC_r 0x02 +#define RESET_STATE_ESC_R_ESC_R 0x02 #define TERMINAL_CON_IN_DEV_FROM_THIS(a) CR (a, TERMINAL_DEV, SimpleInput, TERMINAL_DEV_SIGNATURE) #define TERMINAL_CON_OUT_DEV_FROM_THIS(a) CR (a, TERMINAL_DEV, SimpleTextOutput, TERMINAL_DEV_SIGNATURE) @@ -135,15 +143,6 @@ typedef union { #define CCAP 0x43 #define DCAP 0x44 -#define MODE0_COLUMN_COUNT 80 -#define MODE0_ROW_COUNT 25 - -#define MODE1_COLUMN_COUNT 80 -#define MODE1_ROW_COUNT 50 - -#define MODE2_COLUMN_COUNT 100 -#define MODE2_ROW_COUNT 31 - #define BACKSPACE 8 #define ESC 27 #define CSI 0x9B @@ -235,7 +234,7 @@ TerminalConInReadKeyStroke ( pressed. @retval TRUE Key be pressed matches a registered key. - @retval FLASE Match failed. + @retval FALSE Match failed. **/ BOOLEAN @@ -351,7 +350,7 @@ TerminalConInRegisterKeyNotify ( IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This, IN EFI_KEY_DATA *KeyData, IN EFI_KEY_NOTIFY_FUNCTION KeyNotificationFunction, - OUT EFI_HANDLE *NotifyHandle + OUT VOID **NotifyHandle ); /** @@ -371,7 +370,7 @@ EFI_STATUS EFIAPI TerminalConInUnregisterKeyNotify ( IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This, - IN EFI_HANDLE NotificationHandle + IN VOID *NotificationHandle ); /** @@ -683,7 +682,7 @@ TerminalFreeNotifyList ( languages specified in SupportedLanguages. The number of languages supported by a driver is up to the driver writer. Language is specified - in RFC 3066 or ISO 639-2 language code format. + in RFC 4646 or ISO 639-2 language code format. @param DriverName[out] A pointer to the Unicode string to return. This Unicode string is the name of the @@ -748,7 +747,7 @@ TerminalComponentNameGetDriverName ( languages specified in SupportedLanguages. The number of languages supported by a driver is up to the driver writer. Language is specified in - RFC 3066 or ISO 639-2 language code format. + RFC 4646 or ISO 639-2 language code format. @param ControllerName[out] A pointer to the Unicode string to return. This Unicode string is the name of the @@ -762,7 +761,7 @@ TerminalComponentNameGetDriverName ( driver specified by This was returned in DriverName. - @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE. + @retval EFI_INVALID_PARAMETER ControllerHandle is NULL. @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid EFI_HANDLE. @@ -837,26 +836,6 @@ TerminalRemoveConsoleDevVariable ( IN EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath ); -/** - Read the EFI variable (VendorGuid/Name) and return a dynamically allocated - buffer, and the size of the buffer. On failure return NULL. - - @param Name String part of EFI variable name - @param VendorGuid GUID part of EFI variable name - @param VariableSize Returns the size of the EFI variable that was read - - @return Dynamically allocated memory that contains a copy of the EFI variable. - Caller is repsoncible freeing the buffer. If variable was not read, - NULL regturned. - -**/ -VOID * -TerminalGetVariableAndSize ( - IN CHAR16 *Name, - IN EFI_GUID *VendorGuid, - OUT UINTN *VariableSize - ); - /** Build termial device path according to terminal type. @@ -901,7 +880,7 @@ GetOneKeyFromSerial ( @param Input The key will be input. @retval TRUE If insert successfully. - @retval FLASE If Raw Data buffer is full before key insertion, + @retval FALSE If Raw Data buffer is full before key insertion, and the key is lost. **/ @@ -918,7 +897,7 @@ RawFiFoInsertOneKey ( @param Output The key will be removed. @retval TRUE If insert successfully. - @retval FLASE If Raw Data FIFO buffer is empty before remove operation. + @retval FALSE If Raw Data FIFO buffer is empty before remove operation. **/ BOOLEAN @@ -933,7 +912,7 @@ RawFiFoRemoveOneKey ( @param TerminalDevice Terminal driver private structure @retval TRUE If Raw Data FIFO buffer is empty. - @retval FLASE If Raw Data FIFO buffer is not empty. + @retval FALSE If Raw Data FIFO buffer is not empty. **/ BOOLEAN @@ -947,7 +926,7 @@ IsRawFiFoEmpty ( @param TerminalDevice Terminal driver private structure @retval TRUE If Raw Data FIFO buffer is full. - @retval FLASE If Raw Data FIFO buffer is not full. + @retval FALSE If Raw Data FIFO buffer is not full. **/ BOOLEAN @@ -962,14 +941,14 @@ IsRawFiFoFull ( @param Key The key will be input. @retval TRUE If insert successfully. - @retval FLASE If FIFO buffer is full before key insertion, + @retval FALSE If FIFO buffer is full before key insertion, and the key is lost. **/ BOOLEAN EfiKeyFiFoInsertOneKey ( TERMINAL_DEV *TerminalDevice, - EFI_INPUT_KEY Key + EFI_INPUT_KEY *Key ); /** @@ -979,7 +958,7 @@ EfiKeyFiFoInsertOneKey ( @param Output The key will be removed. @retval TRUE If insert successfully. - @retval FLASE If FIFO buffer is empty before remove operation. + @retval FALSE If FIFO buffer is empty before remove operation. **/ BOOLEAN @@ -994,7 +973,7 @@ EfiKeyFiFoRemoveOneKey ( @param TerminalDevice Terminal driver private structure @retval TRUE If FIFO buffer is empty. - @retval FLASE If FIFO buffer is not empty. + @retval FALSE If FIFO buffer is not empty. **/ BOOLEAN @@ -1008,7 +987,7 @@ IsEfiKeyFiFoEmpty ( @param TerminalDevice Terminal driver private structure @retval TRUE If FIFO buffer is full. - @retval FLASE If FIFO buffer is not full. + @retval FALSE If FIFO buffer is not full. **/ BOOLEAN @@ -1023,7 +1002,7 @@ IsEfiKeyFiFoFull ( @param Input The key will be input. @retval TRUE If insert successfully. - @retval FLASE If Unicode FIFO buffer is full before key insertion, + @retval FALSE If Unicode FIFO buffer is full before key insertion, and the key is lost. **/ @@ -1035,15 +1014,14 @@ UnicodeFiFoInsertOneKey ( /** Remove one pre-fetched key out of the Unicode FIFO buffer. + The caller should guarantee that Unicode FIFO buffer is not empty + by IsUnicodeFiFoEmpty (). @param TerminalDevice Terminal driver private structure. @param Output The key will be removed. - @retval TRUE If insert successfully. - @retval FLASE If Unicode FIFO buffer is empty before remove operation. - **/ -BOOLEAN +VOID UnicodeFiFoRemoveOneKey ( TERMINAL_DEV *TerminalDevice, UINT16 *Output @@ -1055,7 +1033,7 @@ UnicodeFiFoRemoveOneKey ( @param TerminalDevice Terminal driver private structure @retval TRUE If Unicode FIFO buffer is empty. - @retval FLASE If Unicode FIFO buffer is not empty. + @retval FALSE If Unicode FIFO buffer is not empty. **/ BOOLEAN @@ -1069,7 +1047,7 @@ IsUnicodeFiFoEmpty ( @param TerminalDevice Terminal driver private structure @retval TRUE If Unicode FIFO buffer is full. - @retval FLASE If Unicode FIFO buffer is not full. + @retval FALSE If Unicode FIFO buffer is not full. **/ BOOLEAN @@ -1363,4 +1341,16 @@ IsHotPlugDevice ( IN EFI_DEVICE_PATH_PROTOCOL *DevicePath ); +/** + Timer handler to poll the key from serial. + + @param Event Indicates the event that invoke this function. + @param Context Indicates the calling context. +**/ +VOID +EFIAPI +TerminalConInTimerHandler ( + IN EFI_EVENT Event, + IN VOID *Context + ); #endif