X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=MdeModulePkg%2FUniversal%2FConsole%2FTerminalDxe%2FTerminal.h;h=b2f0901fc167bfa941d61c3ab4517b7f21cb53a7;hb=9d510e61fceee7b92955ef9a3c20343752d8ce3f;hp=1aedfee78856e858f6610336bcbb22f721c377c1;hpb=f3f2e05db8c89628498ec4efdb16184747824c63;p=mirror_edk2.git diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.h b/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.h index 1aedfee788..b2f0901fc1 100644 --- a/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.h +++ b/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.h @@ -1,14 +1,9 @@ /** @file Header file for Terminal driver. -Copyright (c) 2006 - 2008, 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 - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
+Copyright (C) 2016 Silicon Graphics, Inc. All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause-Patent **/ @@ -17,14 +12,18 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include + +#include +#include +#include +#include + #include #include -#include #include #include #include -#include -#include + #include #include #include @@ -59,34 +58,54 @@ 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; } TERMINAL_CONSOLE_IN_EX_NOTIFY; + +typedef enum { + TerminalTypePcAnsi, + TerminalTypeVt100, + TerminalTypeVt100Plus, + TerminalTypeVtUtf8, + TerminalTypeTtyTerm +} TERMINAL_TYPE; + typedef struct { UINTN Signature; EFI_HANDLE Handle; - UINT8 TerminalType; + TERMINAL_TYPE TerminalType; EFI_SERIAL_IO_PROTOCOL *SerialIo; EFI_DEVICE_PATH_PROTOCOL *DevicePath; 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; + RAW_DATA_FIFO *RawFiFo; + UNICODE_FIFO *UnicodeFiFo; + EFI_KEY_FIFO *EfiKeyFiFo; + EFI_KEY_FIFO *EfiKeyFiFoForNotify; EFI_UNICODE_STRING_TABLE *ControllerNameTable; + EFI_EVENT TimerEvent; EFI_EVENT TwoSecondTimeOut; UINT32 InputState; UINT32 ResetState; + UINT16 TtyEscapeStr[3]; + INTN TtyEscapeIndex; // // Esc could not be output to the screen by user, @@ -98,6 +117,7 @@ typedef struct { BOOLEAN OutputEscChar; EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL SimpleInputEx; LIST_ENTRY NotifyList; + EFI_EVENT KeyNotifyProcessEvent; } TERMINAL_DEV; #define INPUT_STATE_DEFAULT 0x00 @@ -106,10 +126,11 @@ typedef struct { #define INPUT_STATE_LEFTOPENBRACKET 0x04 #define INPUT_STATE_O 0x08 #define INPUT_STATE_2 0x10 +#define INPUT_STATE_LEFTOPENBRACKET_2 0x20 #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) @@ -121,26 +142,12 @@ typedef union { UINT8 Utf8_3[3]; } UTF8_CHAR; -#define PCANSITYPE 0 -#define VT100TYPE 1 -#define VT100PLUSTYPE 2 -#define VTUTF8TYPE 3 - #define LEFTOPENBRACKET 0x5b // '[' #define ACAP 0x41 #define BCAP 0x42 #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 @@ -150,6 +157,7 @@ typedef union { #define BACKGROUND_CONTROL_OFFSET 11 #define ROW_OFFSET 2 #define COLUMN_OFFSET 5 +#define FW_BACK_OFFSET 2 typedef struct { UINT16 Unicode; @@ -164,8 +172,6 @@ extern EFI_DRIVER_BINDING_PROTOCOL gTerminalDriverBinding; extern EFI_COMPONENT_NAME_PROTOCOL gTerminalComponentName; extern EFI_COMPONENT_NAME2_PROTOCOL gTerminalComponentName2; -extern EFI_GUID gSimpleTextInExNotifyGuid; - /** The user Entry Point for module Terminal. The user code starts with this function. @@ -191,8 +197,8 @@ InitializeTerminal ( @param This Indicates the calling context. @param ExtendedVerification Skip by this driver. - @return EFI_SUCCESS The reset operation succeeds. - @return EFI_DEVICE_ERROR The dependent serial port reset fails. + @retval EFI_SUCCESS The reset operation succeeds. + @retval EFI_DEVICE_ERROR The dependent serial port reset fails. **/ EFI_STATUS @@ -211,9 +217,9 @@ TerminalConInReset ( keystroke information for the key that was sent from terminal. - @return EFI_SUCCESS The keystroke information is returned successfully. - @return EFI_NOT_READY There is no keystroke data available. - @return EFI_DEVICE_ERROR The dependent serial device encounters error. + @retval EFI_SUCCESS The keystroke information is returned successfully. + @retval EFI_NOT_READY There is no keystroke data available. + @retval EFI_DEVICE_ERROR The dependent serial device encounters error. **/ EFI_STATUS @@ -234,7 +240,7 @@ TerminalConInReadKeyStroke ( pressed. @retval TRUE Key be pressed matches a registered key. - @retval FLASE Match failed. + @retval FALSE Match failed. **/ BOOLEAN @@ -250,8 +256,6 @@ IsKeyRegistered ( @param Event Indicates the event that invoke this function. @param Context Indicates the calling context. - @return none. - **/ VOID EFIAPI @@ -265,7 +269,7 @@ TerminalConInWaitForKeyEx ( // /** - Reset the input device and optionaly run diagnostics + Reset the input device and optionally run diagnostics @param This Protocol instance pointer. @param ExtendedVerification Driver may perform diagnostics on reset. @@ -284,7 +288,7 @@ TerminalConInResetEx ( /** Reads the next keystroke from the input device. The WaitForKey Event can - be used to test for existance of a keystroke via WaitForEvent () call. + be used to test for existence of a keystroke via WaitForEvent () call. @param This Protocol instance pointer. @param KeyData A pointer to a buffer that is filled in with the @@ -292,7 +296,7 @@ TerminalConInResetEx ( pressed. @retval EFI_SUCCESS The keystroke information was returned. - @retval EFI_NOT_READY There was no keystroke data availiable. + @retval EFI_NOT_READY There was no keystroke data available. @retval EFI_DEVICE_ERROR The keystroke information was not returned due to hardware errors. @retval EFI_INVALID_PARAMETER KeyData is NULL. @@ -333,9 +337,12 @@ TerminalConInSetState ( @param This Protocol instance pointer. @param KeyData A pointer to a buffer that is filled in with the keystroke information data for the key that was - pressed. + pressed. If KeyData.Key, KeyData.KeyState.KeyToggleState + and KeyData.KeyState.KeyShiftState are 0, then any incomplete + keystroke will trigger a notification of the KeyNotificationFunction. @param KeyNotificationFunction Points to the function to be called when the key - sequence is typed specified by KeyData. + sequence is typed specified by KeyData. This notification function + should be called at <=TPL_CALLBACK. @param NotifyHandle Points to the unique handle assigned to the registered notification. @@ -352,7 +359,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 ); /** @@ -372,7 +379,7 @@ EFI_STATUS EFIAPI TerminalConInUnregisterKeyNotify ( IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This, - IN EFI_HANDLE NotificationHandle + IN VOID *NotificationHandle ); /** @@ -382,8 +389,6 @@ TerminalConInUnregisterKeyNotify ( @param Event Indicates the event that invoke this function. @param Context Indicates the calling context. - @return None - **/ VOID EFIAPI @@ -403,8 +408,8 @@ TerminalConInWaitForKey ( exhaustive verification operation of the device during reset. - @return EFI_SUCCESS The reset operation succeeds. - @return EFI_DEVICE_ERROR The terminal is not functioning correctly or the serial port reset fails. + @retval EFI_SUCCESS The reset operation succeeds. + @retval EFI_DEVICE_ERROR The terminal is not functioning correctly or the serial port reset fails. **/ EFI_STATUS @@ -447,8 +452,8 @@ TerminalConOutOutputString ( @param This Indicates the calling context. @param WString The Null-terminated Unicode string to be tested. - @return EFI_SUCCESS The terminal is capable of rendering the output string. - @return EFI_UNSUPPORTED Some of the characters in the Unicode string cannot be rendered. + @retval EFI_SUCCESS The terminal is capable of rendering the output string. + @retval EFI_UNSUPPORTED Some of the characters in the Unicode string cannot be rendered. **/ EFI_STATUS @@ -470,9 +475,9 @@ TerminalConOutTestString ( @param Columns The returned columns of the requested mode. @param Rows The returned rows of the requested mode. - @return EFI_SUCCESS The requested mode information is returned. - @return EFI_UNSUPPORTED The mode number is not valid. - @return EFI_DEVICE_ERROR + @retval EFI_SUCCESS The requested mode information is returned. + @retval EFI_UNSUPPORTED The mode number is not valid. + @retval EFI_DEVICE_ERROR **/ EFI_STATUS @@ -492,10 +497,10 @@ TerminalConOutQueryMode ( @param This Indicates the calling context. @param ModeNumber The text mode to set. - @return EFI_SUCCESS The requested text mode is set. - @return EFI_DEVICE_ERROR The requested text mode cannot be set + @retval EFI_SUCCESS The requested text mode is set. + @retval EFI_DEVICE_ERROR The requested text mode cannot be set because of serial device error. - @return EFI_UNSUPPORTED The text mode number is not valid. + @retval EFI_UNSUPPORTED The text mode number is not valid. **/ EFI_STATUS @@ -512,9 +517,9 @@ TerminalConOutSetMode ( @param Attribute The attribute to set. Only bit0..6 are valid, all other bits are undefined and must be zero. - @return EFI_SUCCESS The requested attribute is set. - @return EFI_DEVICE_ERROR The requested attribute cannot be set due to serial port error. - @return EFI_UNSUPPORTED The attribute requested is not defined by EFI spec. + @retval EFI_SUCCESS The requested attribute is set. + @retval EFI_DEVICE_ERROR The requested attribute cannot be set due to serial port error. + @retval EFI_UNSUPPORTED The attribute requested is not defined by EFI spec. **/ EFI_STATUS @@ -531,9 +536,9 @@ TerminalConOutSetAttribute ( @param This Indicates the calling context. - @return EFI_SUCCESS The operation completed successfully. - @return EFI_DEVICE_ERROR The terminal screen cannot be cleared due to serial port error. - @return EFI_UNSUPPORTED The terminal is not in a valid display mode. + @retval EFI_SUCCESS The operation completed successfully. + @retval EFI_DEVICE_ERROR The terminal screen cannot be cleared due to serial port error. + @retval EFI_UNSUPPORTED The terminal is not in a valid display mode. **/ EFI_STATUS @@ -549,9 +554,9 @@ TerminalConOutClearScreen ( @param Column The row to set cursor to. @param Row The column to set cursor to. - @return EFI_SUCCESS The operation completed successfully. - @return EFI_DEVICE_ERROR The request fails due to serial port error. - @return EFI_UNSUPPORTED The terminal is not in a valid text mode, or the cursor position + @retval EFI_SUCCESS The operation completed successfully. + @retval EFI_DEVICE_ERROR The request fails due to serial port error. + @retval EFI_UNSUPPORTED The terminal is not in a valid text mode, or the cursor position is invalid for current mode. **/ @@ -571,8 +576,8 @@ TerminalConOutSetCursorPosition ( @param Visible If TRUE, the cursor is set to be visible, If FALSE, the cursor is set to be invisible. - @return EFI_SUCCESS The request is valid. - @return EFI_UNSUPPORTED The terminal does not support cursor hidden. + @retval EFI_SUCCESS The request is valid. + @retval EFI_UNSUPPORTED The terminal does not support cursor hidden. **/ EFI_STATUS @@ -583,7 +588,7 @@ TerminalConOutEnableCursor ( ); /** - Test to see if this driver supports Controller. + Test to see if this driver supports Controller. @param This Protocol instance pointer. @param ControllerHandle Handle of device to test @@ -631,7 +636,7 @@ TerminalDriverBindingStart ( /** Stop this driver on Controller by closing Simple Text In, Simple Text In Ex, Simple Text Out protocol, and removing parent device path from - Console Device Environment Variables. + Console Device Environment Variables. @param This Protocol instance pointer. @param Controller Handle of device to stop driver on @@ -652,6 +657,20 @@ TerminalDriverBindingStop ( IN EFI_HANDLE *ChildHandleBuffer ); +/** + Free notify functions list. + + @param ListHead The list head + + @retval EFI_SUCCESS Free the notify list successfully. + @retval EFI_INVALID_PARAMETER ListHead is NULL. + +**/ +EFI_STATUS +TerminalFreeNotifyList ( + IN OUT LIST_ENTRY *ListHead + ); + /** Retrieves a Unicode string that is the user readable name of the driver. @@ -672,7 +691,7 @@ TerminalDriverBindingStop ( 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 @@ -737,7 +756,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 @@ -751,7 +770,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. @@ -790,7 +809,7 @@ TerminalComponentNameGetControllerName ( @retval EFI_SUCCESS There is key pending. @retval EFI_NOT_READY There is no key pending. - @retval EFI_DEVICE_ERROR If Serial IO is not attched to serial device. + @retval EFI_DEVICE_ERROR If Serial IO is not attached to serial device. **/ EFI_STATUS @@ -802,7 +821,7 @@ TerminalConInCheckForKey ( Update terminal device path in Console Device Environment Variables. @param VariableName The Console Device Environment Variable. - @param ParentDevicePath The terminal devcie path to be updated. + @param ParentDevicePath The terminal device path to be updated. @return None. @@ -819,8 +838,6 @@ TerminalUpdateConsoleDevVariable ( @param VariableName A pointer to the variable name. @param ParentDevicePath A pointer to the parent device path. - @return None. - **/ VOID TerminalRemoveConsoleDevVariable ( @@ -828,31 +845,11 @@ 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. @param TerminalType The terminal type is PC ANSI, VT100, VT100+ or VT-UTF8. - @param ParentDevicePath Parent devcie path. + @param ParentDevicePath Parent device path. @param TerminalDevicePath Returned terminal device path, if building successfully. @retval EFI_UNSUPPORTED Terminal does not belong to the supported type. @@ -862,59 +859,20 @@ TerminalGetVariableAndSize ( **/ EFI_STATUS SetTerminalDevicePath ( - IN UINT8 TerminalType, + IN TERMINAL_TYPE TerminalType, IN EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath, OUT EFI_DEVICE_PATH_PROTOCOL **TerminalDevicePath ); -/** - Initialize the Raw Data FIFO. - - @param TerminalDevice The terminal device. - - @return None. - -**/ -VOID -InitializeRawFiFo ( - IN TERMINAL_DEV *TerminalDevice - ); - -/** - Initialize the Unicode FIFO. - - @param TerminalDevice The terminal device. - - @return None. - -**/ -VOID -InitializeUnicodeFiFo ( - IN TERMINAL_DEV *TerminalDevice - ); - -/** - Initialize the EFI Key FIFO. - - @param TerminalDevice The terminal device. - - @return None. - -**/ -VOID -InitializeEfiKeyFiFo ( - IN TERMINAL_DEV *TerminalDevice - ); - /** Get one key out of serial buffer. @param SerialIo Serial I/O protocl attached to the serial device. @param Input The fetched key. - @return EFI_NOT_READY If serial buffer is empty. - @return EFI_DEVICE_ERROR If reading serial buffer encounter error. - @return EFI_SUCCESS If reading serial buffer successfully, put + @retval EFI_NOT_READY If serial buffer is empty. + @retval EFI_DEVICE_ERROR If reading serial buffer encounter error. + @retval EFI_SUCCESS If reading serial buffer successfully, put the fetched key to the parameter output. **/ @@ -930,8 +888,8 @@ GetOneKeyFromSerial ( @param TerminalDevice Terminal driver private structure. @param Input The key will be input. - @return TRUE If insert successfully. - @return FLASE If Raw Data buffer is full before key insertion, + @retval TRUE If insert successfully. + @retval FALSE If Raw Data buffer is full before key insertion, and the key is lost. **/ @@ -947,8 +905,8 @@ RawFiFoInsertOneKey ( @param TerminalDevice Terminal driver private structure. @param Output The key will be removed. - @return TRUE If insert successfully. - @return FLASE If Raw Data FIFO buffer is empty before remove operation. + @retval TRUE If insert successfully. + @retval FALSE If Raw Data FIFO buffer is empty before remove operation. **/ BOOLEAN @@ -962,8 +920,8 @@ RawFiFoRemoveOneKey ( @param TerminalDevice Terminal driver private structure - @return TRUE If Raw Data FIFO buffer is empty. - @return FLASE If Raw Data FIFO buffer is not empty. + @retval TRUE If Raw Data FIFO buffer is empty. + @retval FALSE If Raw Data FIFO buffer is not empty. **/ BOOLEAN @@ -976,8 +934,8 @@ IsRawFiFoEmpty ( @param TerminalDevice Terminal driver private structure - @return TRUE If Raw Data FIFO buffer is full. - @return FLASE If Raw Data FIFO buffer is not full. + @retval TRUE If Raw Data FIFO buffer is full. + @retval FALSE If Raw Data FIFO buffer is not full. **/ BOOLEAN @@ -985,21 +943,82 @@ IsRawFiFoFull ( TERMINAL_DEV *TerminalDevice ); +/** + Insert one pre-fetched key into the FIFO buffer. + + @param EfiKeyFiFo Pointer to instance of EFI_KEY_FIFO. + @param Input The key will be input. + + @retval TRUE If insert successfully. + @retval FALSE If FIFO buffer is full before key insertion, + and the key is lost. + +**/ +BOOLEAN +EfiKeyFiFoForNotifyInsertOneKey ( + EFI_KEY_FIFO *EfiKeyFiFo, + EFI_INPUT_KEY *Input + ); + +/** + Remove one pre-fetched key out of the FIFO buffer. + + @param EfiKeyFiFo Pointer to instance of EFI_KEY_FIFO. + @param Output The key will be removed. + + @retval TRUE If insert successfully. + @retval FALSE If FIFO buffer is empty before remove operation. + +**/ +BOOLEAN +EfiKeyFiFoForNotifyRemoveOneKey ( + EFI_KEY_FIFO *EfiKeyFiFo, + EFI_INPUT_KEY *Output + ); + +/** + Clarify whether FIFO buffer is empty. + + @param EfiKeyFiFo Pointer to instance of EFI_KEY_FIFO. + + @retval TRUE If FIFO buffer is empty. + @retval FALSE If FIFO buffer is not empty. + +**/ +BOOLEAN +IsEfiKeyFiFoForNotifyEmpty ( + IN EFI_KEY_FIFO *EfiKeyFiFo + ); + +/** + Clarify whether FIFO buffer is full. + + @param EfiKeyFiFo Pointer to instance of EFI_KEY_FIFO. + + @retval TRUE If FIFO buffer is full. + @retval FALSE If FIFO buffer is not full. + +**/ +BOOLEAN +IsEfiKeyFiFoForNotifyFull ( + EFI_KEY_FIFO *EfiKeyFiFo + ); + /** Insert one pre-fetched key into the FIFO buffer. @param TerminalDevice Terminal driver private structure. @param Key The key will be input. - @return TRUE If insert successfully. - @return FLASE If FIFO buffer is full before key insertion, + @retval TRUE If insert successfully. + @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 ); /** @@ -1008,8 +1027,8 @@ EfiKeyFiFoInsertOneKey ( @param TerminalDevice Terminal driver private structure. @param Output The key will be removed. - @return TRUE If insert successfully. - @return FLASE If FIFO buffer is empty before remove operation. + @retval TRUE If insert successfully. + @retval FALSE If FIFO buffer is empty before remove operation. **/ BOOLEAN @@ -1023,8 +1042,8 @@ EfiKeyFiFoRemoveOneKey ( @param TerminalDevice Terminal driver private structure - @return TRUE If FIFO buffer is empty. - @return FLASE If FIFO buffer is not empty. + @retval TRUE If FIFO buffer is empty. + @retval FALSE If FIFO buffer is not empty. **/ BOOLEAN @@ -1037,8 +1056,8 @@ IsEfiKeyFiFoEmpty ( @param TerminalDevice Terminal driver private structure - @return TRUE If FIFO buffer is full. - @return FLASE If FIFO buffer is not full. + @retval TRUE If FIFO buffer is full. + @retval FALSE If FIFO buffer is not full. **/ BOOLEAN @@ -1052,8 +1071,8 @@ IsEfiKeyFiFoFull ( @param TerminalDevice Terminal driver private structure. @param Input The key will be input. - @return TRUE If insert successfully. - @return FLASE If Unicode FIFO buffer is full before key insertion, + @retval TRUE If insert successfully. + @retval FALSE If Unicode FIFO buffer is full before key insertion, and the key is lost. **/ @@ -1065,15 +1084,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. - @return TRUE If insert successfully. - @return FLASE If Unicode FIFO buffer is empty before remove operation. - **/ -BOOLEAN +VOID UnicodeFiFoRemoveOneKey ( TERMINAL_DEV *TerminalDevice, UINT16 *Output @@ -1084,8 +1102,8 @@ UnicodeFiFoRemoveOneKey ( @param TerminalDevice Terminal driver private structure - @return TRUE If Unicode FIFO buffer is empty. - @return FLASE If Unicode FIFO buffer is not empty. + @retval TRUE If Unicode FIFO buffer is empty. + @retval FALSE If Unicode FIFO buffer is not empty. **/ BOOLEAN @@ -1098,8 +1116,8 @@ IsUnicodeFiFoEmpty ( @param TerminalDevice Terminal driver private structure - @return TRUE If Unicode FIFO buffer is full. - @return FLASE If Unicode FIFO buffer is not full. + @retval TRUE If Unicode FIFO buffer is full. + @retval FALSE If Unicode FIFO buffer is not full. **/ BOOLEAN @@ -1107,27 +1125,13 @@ IsUnicodeFiFoFull ( TERMINAL_DEV *TerminalDevice ); -/** - Count Unicode FIFO buffer. - - @param TerminalDevice Terminal driver private structure - - @return The count in bytes of Unicode FIFO. - -**/ -UINT8 -UnicodeFiFoGetKeyCount ( - TERMINAL_DEV *TerminalDevice - ); /** - Translate raw data into Unicode (according to different encode), and - translate Unicode into key information. (according to different standard). + Translate raw data into Unicode (according to different encode), and + translate Unicode into key information. (according to different standard). @param TerminalDevice Terminal driver private structure. - @return none. - **/ VOID TranslateRawDataToEfiKey ( @@ -1144,8 +1148,6 @@ TranslateRawDataToEfiKey ( @param TerminalDevice The terminal device. - @return None. - **/ VOID AnsiRawDataToUnicode ( @@ -1154,8 +1156,8 @@ AnsiRawDataToUnicode ( /** Converts a stream of Unicode characters from a terminal input device into EFI Keys that - can be read through the Simple Input Protocol. - + can be read through the Simple Input Protocol. + The table below shows the keyboard input mappings that this function supports. If the ESC sequence listed in one of the columns is presented, then it is translated into the coorespoding EFI Scan Code. If a matching sequence is not found, then the raw @@ -1206,7 +1208,7 @@ AnsiRawDataToUnicode ( | F11 | 0x15 | | ESC ! | | | F12 | 0x16 | | ESC @ | | +=========+======+===========+==========+==========+ - + Special Mappings ================ ESC R ESC r ESC R = Reset System @@ -1214,8 +1216,6 @@ AnsiRawDataToUnicode ( @param TerminalDevice The terminal device to use to translate raw input into EFI Keys - @return None. - **/ VOID UnicodeToEfiKey ( @@ -1227,8 +1227,8 @@ UnicodeToEfiKey ( or valid text graphics. @param TerminalDevice The terminal device. - @param WString The input string. - + @param WString The input string. + @retval EFI_UNSUPPORTED If not all input characters are valid. @retval EFI_SUCCESS If all input characters are valid. @@ -1244,13 +1244,11 @@ AnsiTestString ( // /** - Translate all VT-UTF8 characters in the Raw FIFI into unicode characters, + Translate all VT-UTF8 characters in the Raw FIFI into unicode characters, and insert them into Unicode FIFO. @param VtUtf8Device The terminal device. - @return None. - **/ VOID VTUTF8RawDataToUnicode ( @@ -1261,8 +1259,8 @@ VTUTF8RawDataToUnicode ( Check if input string is valid VT-UTF8 string. @param TerminalDevice The terminal device. - @param WString The input string. - + @param WString The input string. + @retval EFI_SUCCESS If all input characters are valid. **/ @@ -1272,22 +1270,20 @@ VTUTF8TestString ( IN CHAR16 *WString ); -/** +/** Translate one Unicode character into VT-UTF8 characters. UTF8 Encoding Table - Bits per Character | Unicode Character Range | Unicode Binary Encoding | UTF8 Binary Encoding - 0-7 | 0x0000 - 0x007F | 00000000 0xxxxxxx | 0xxxxxxx - 8-11 | 0x0080 - 0x07FF | 00000xxx xxxxxxxx | 110xxxxx 10xxxxxx - 12-16 | 0x0800 - 0xFFFF | xxxxxxxx xxxxxxxx | 1110xxxx 10xxxxxx 10xxxxxx + Bits per Character | Unicode Character Range | Unicode Binary Encoding | UTF8 Binary Encoding + 0-7 | 0x0000 - 0x007F | 00000000 0xxxxxxx | 0xxxxxxx + 8-11 | 0x0080 - 0x07FF | 00000xxx xxxxxxxx | 110xxxxx 10xxxxxx + 12-16 | 0x0800 - 0xFFFF | xxxxxxxx xxxxxxxx | 1110xxxx 10xxxxxx 10xxxxxx @param Unicode Unicode character need translating. @param Utf8Char Return VT-UTF8 character set. @param ValidBytes The count of valid VT-UTF8 characters. If ValidBytes is zero, no valid VT-UTF8 returned. - - @return None. **/ VOID @@ -1302,7 +1298,7 @@ UnicodeToUtf8 ( @param Utf8Device The terminal device. @param Utf8Char Returned valid VT-UTF8 characters set. - @param ValidBytes The count of returned VT-VTF8 characters. + @param ValidBytes The count of returned VT-VTF8 characters. If ValidBytes is zero, no valid VT-UTF8 returned. **/ @@ -1313,21 +1309,19 @@ GetOneValidUtf8Char ( OUT UINT8 *ValidBytes ); -/** +/** Translate VT-UTF8 characters into one Unicode character. UTF8 Encoding Table - Bits per Character | Unicode Character Range | Unicode Binary Encoding | UTF8 Binary Encoding - 0-7 | 0x0000 - 0x007F | 00000000 0xxxxxxx | 0xxxxxxx - 8-11 | 0x0080 - 0x07FF | 00000xxx xxxxxxxx | 110xxxxx 10xxxxxx - 12-16 | 0x0800 - 0xFFFF | xxxxxxxx xxxxxxxx | 1110xxxx 10xxxxxx 10xxxxxx + Bits per Character | Unicode Character Range | Unicode Binary Encoding | UTF8 Binary Encoding + 0-7 | 0x0000 - 0x007F | 00000000 0xxxxxxx | 0xxxxxxx + 8-11 | 0x0080 - 0x07FF | 00000xxx xxxxxxxx | 110xxxxx 10xxxxxx + 12-16 | 0x0800 - 0xFFFF | xxxxxxxx xxxxxxxx | 1110xxxx 10xxxxxx 10xxxxxx @param Utf8Char VT-UTF8 character set needs translating. @param ValidBytes The count of valid VT-UTF8 characters. - @param UnicodeChar Returned unicode character. - - @return None. + @param UnicodeChar Returned unicode character. **/ VOID @@ -1350,7 +1344,7 @@ Utf8ToUnicode ( @param Ascii Optional pointer to return ASCII equivalent of Graphic. - @return TRUE If Graphic is a supported Unicode Box Drawing character. + @retval TRUE If Graphic is a supported Unicode Box Drawing character. **/ BOOLEAN @@ -1364,7 +1358,7 @@ TerminalIsValidTextGraphics ( Detects if a valid ASCII char. @param Ascii An ASCII character. - + @retval TRUE If it is a valid ASCII character. @retval FALSE If it is not a valid ASCII character. @@ -1378,7 +1372,7 @@ TerminalIsValidAscii ( Detects if a valid EFI control character. @param CharC An input EFI Control character. - + @retval TRUE If it is a valid EFI control character. @retval FALSE If it is not a valid EFI control character. @@ -1388,4 +1382,48 @@ TerminalIsValidEfiCntlChar ( IN CHAR16 CharC ); +/** + Check if the device supports hot-plug through its device path. + + This function could be updated to check more types of Hot Plug devices. + Currently, it checks USB and PCCard device. + + @param DevicePath Pointer to device's device path. + + @retval TRUE The devcie is a hot-plug device + @retval FALSE The devcie is not a hot-plug device. + +**/ +BOOLEAN +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 + ); + + +/** + Process key notify. + + @param Event Indicates the event that invoke this function. + @param Context Indicates the calling context. +**/ +VOID +EFIAPI +KeyNotifyProcessHandler ( + IN EFI_EVENT Event, + IN VOID *Context + ); + #endif