X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=MdeModulePkg%2FUniversal%2FConsole%2FTerminalDxe%2FTerminal.h;h=d393acbc2073e1b7d9408058dd6676e95595b066;hp=4f4e4eb60cc453f4c5b16564e9f1719e4feec807;hb=5070befc3b9b013f36062c7cc08320c87c02f972;hpb=0254efc01e461445240512ae1a1c2fc48ed2f70e diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.h b/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.h index 4f4e4eb60c..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,6 +20,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include #include +#include #include #include @@ -61,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; @@ -81,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; @@ -111,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) @@ -134,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 @@ -234,7 +234,7 @@ TerminalConInReadKeyStroke ( pressed. @retval TRUE Key be pressed matches a registered key. - @retval FLASE Match failed. + @retval FALSE Match failed. **/ BOOLEAN @@ -350,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 ); /** @@ -370,7 +370,7 @@ EFI_STATUS EFIAPI TerminalConInUnregisterKeyNotify ( IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This, - IN EFI_HANDLE NotificationHandle + IN VOID *NotificationHandle ); /** @@ -761,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. @@ -836,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. @@ -900,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. **/ @@ -917,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 @@ -932,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 @@ -946,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 @@ -961,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 ); /** @@ -978,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 @@ -993,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 @@ -1007,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 @@ -1022,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. **/ @@ -1034,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 @@ -1054,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 @@ -1068,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 @@ -1362,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