#include "Terminal.h"\r
\r
/**\r
- Translate all raw data in the Raw FIFI into unicode, and insert\r
+ Translate all raw data in the Raw FIFO into unicode, and insert\r
them into Unicode FIFO.\r
\r
@param TerminalDevice The terminal device.\r
/** @file\r
- Produces Simple Text Input Protocl, Simple Text Input Extended Protocol and\r
+ Produces Simple Text Input Protocol, Simple Text Input Extended Protocol and\r
Simple Text Output Protocol upon Serial IO Protocol.\r
\r
Copyright (c) 2006 - 2008, Intel Corporation. <BR>\r
},\r
{ // SimpleTextOutputMode\r
1, // MaxMode\r
- 0, // Mode?\r
+ 0, // Mode\r
EFI_TEXT_ATTR (EFI_LIGHTGRAY, EFI_BLACK), // Attribute\r
0, // CursorColumn\r
0, // CursorRow\r
TRUE // CursorVisible\r
},\r
- 0,\r
- {\r
+ 0, // SerialInTimeOut\r
+ { // RawFiFo\r
0,\r
0,\r
{ 0 }\r
},\r
- {\r
+ { // UnicodeFiFo\r
0,\r
0,\r
{ 0 }\r
},\r
- {\r
+ { // EfiKeyFiFo\r
0,\r
0,\r
{ {0} }\r
},\r
NULL, // ControllerNameTable\r
- NULL,\r
+ NULL, // TwoSecondTimeOut\r
INPUT_STATE_DEFAULT,\r
RESET_STATE_DEFAULT,\r
FALSE,\r
TerminalConInRegisterKeyNotify,\r
TerminalConInUnregisterKeyNotify,\r
},\r
- {\r
+ { // NotifyList\r
NULL,\r
NULL,\r
}\r
};\r
\r
-\r
-/**\r
- Free notify functions list.\r
-\r
- @param ListHead The list head\r
-\r
- @retval EFI_SUCCESS Free the notify list successfully.\r
- @retval EFI_INVALID_PARAMETER ListHead is NULL.\r
-\r
-**/\r
-EFI_STATUS\r
-TerminalFreeNotifyList (\r
- IN OUT LIST_ENTRY *ListHead\r
- );\r
-\r
/**\r
Test to see if this driver supports Controller. \r
\r
UINTN EntryCount;\r
UINTN Index;\r
EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r
+ EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL SimpleTextOutput;\r
\r
TerminalDevice = NULL;\r
DefaultNode = NULL;\r
//\r
// Simple Text Output Protocol\r
//\r
- TerminalDevice->SimpleTextOutput.Reset = TerminalConOutReset;\r
- TerminalDevice->SimpleTextOutput.OutputString = TerminalConOutOutputString;\r
- TerminalDevice->SimpleTextOutput.TestString = TerminalConOutTestString;\r
- TerminalDevice->SimpleTextOutput.QueryMode = TerminalConOutQueryMode;\r
- TerminalDevice->SimpleTextOutput.SetMode = TerminalConOutSetMode;\r
- TerminalDevice->SimpleTextOutput.SetAttribute = TerminalConOutSetAttribute;\r
- TerminalDevice->SimpleTextOutput.ClearScreen = TerminalConOutClearScreen;\r
- TerminalDevice->SimpleTextOutput.SetCursorPosition = TerminalConOutSetCursorPosition;\r
- TerminalDevice->SimpleTextOutput.EnableCursor = TerminalConOutEnableCursor;\r
- TerminalDevice->SimpleTextOutput.Mode = &TerminalDevice->SimpleTextOutputMode;\r
+ SimpleTextOutput = TerminalDevice->SimpleTextOutput;\r
+ \r
+ SimpleTextOutput.Reset = TerminalConOutReset;\r
+ SimpleTextOutput.OutputString = TerminalConOutOutputString;\r
+ SimpleTextOutput.TestString = TerminalConOutTestString;\r
+ SimpleTextOutput.QueryMode = TerminalConOutQueryMode;\r
+ SimpleTextOutput.SetMode = TerminalConOutSetMode;\r
+ SimpleTextOutput.SetAttribute = TerminalConOutSetAttribute;\r
+ SimpleTextOutput.ClearScreen = TerminalConOutClearScreen;\r
+ SimpleTextOutput.SetCursorPosition = TerminalConOutSetCursorPosition;\r
+ SimpleTextOutput.EnableCursor = TerminalConOutEnableCursor;\r
+ SimpleTextOutput.Mode = &TerminalDevice->SimpleTextOutputMode;\r
\r
TerminalDevice->SimpleTextOutputMode.MaxMode = 3;\r
//\r
// For terminal devices, cursor is always visible\r
//\r
TerminalDevice->SimpleTextOutputMode.CursorVisible = TRUE;\r
- Status = TerminalDevice->SimpleTextOutput.SetAttribute (\r
- &TerminalDevice->SimpleTextOutput,\r
- EFI_TEXT_ATTR (EFI_LIGHTGRAY, EFI_BLACK)\r
- );\r
+ Status = SimpleTextOutput.SetAttribute (\r
+ &TerminalDevice->SimpleTextOutput,\r
+ EFI_TEXT_ATTR (EFI_LIGHTGRAY, EFI_BLACK)\r
+ );\r
if (EFI_ERROR (Status)) {\r
goto ReportError;\r
}\r
\r
- Status = TerminalDevice->SimpleTextOutput.Reset (\r
- &TerminalDevice->SimpleTextOutput,\r
- FALSE\r
- );\r
+ Status = SimpleTextOutput.Reset (\r
+ &TerminalDevice->SimpleTextOutput,\r
+ FALSE\r
+ );\r
if (EFI_ERROR (Status)) {\r
goto ReportError;\r
}\r
\r
- Status = TerminalDevice->SimpleTextOutput.SetMode (\r
- &TerminalDevice->SimpleTextOutput,\r
- 0\r
- );\r
+ Status = SimpleTextOutput.SetMode (\r
+ &TerminalDevice->SimpleTextOutput,\r
+ 0\r
+ );\r
if (EFI_ERROR (Status)) {\r
goto ReportError;\r
}\r
\r
- Status = TerminalDevice->SimpleTextOutput.EnableCursor (\r
- &TerminalDevice->SimpleTextOutput,\r
- TRUE\r
- );\r
+ Status = SimpleTextOutput.EnableCursor (\r
+ &TerminalDevice->SimpleTextOutput,\r
+ TRUE\r
+ );\r
if (EFI_ERROR (Status)) {\r
goto ReportError;\r
}\r
Update terminal device path in Console Device Environment Variables.\r
\r
@param VariableName The Console Device Environment Variable.\r
- @param ParentDevicePath The terminal devcie path to be updated.\r
+ @param ParentDevicePath The terminal device path to be updated.\r
\r
@return None.\r
\r
Remove terminal device path from Console Device Environment Variables.\r
\r
@param VariableName Console Device Environment Variables.\r
- @param ParentDevicePath The terminal devcie path to be updated.\r
+ @param ParentDevicePath The terminal device path to be updated.\r
\r
@return None.\r
\r
SetTerminalDevicePath (TerminalType, ParentDevicePath, &TempDevicePath);\r
\r
//\r
- // Compare the genterated device path to the current device path instance\r
+ // Compare the generated device path to the current device path instance\r
//\r
if (TempDevicePath != NULL) {\r
if (CompareMem (Instance, TempDevicePath, InstanceSize) == 0) {\r
@param VariableSize Returns the size of the EFI variable that was read\r
\r
@return Dynamically allocated memory that contains a copy of the EFI variable.\r
- Caller is repsoncible freeing the buffer. If variable was not read, \r
- NULL regturned.\r
+ Caller is responsible freeing the buffer. If variable was not read, \r
+ NULL returned.\r
\r
**/\r
VOID *\r
}\r
\r
/**\r
- Build termial device path according to terminal type.\r
+ Build terminal device path according to terminal type.\r
\r
@param TerminalType The terminal type is PC ANSI, VT100, VT100+ or VT-UTF8.\r
- @param ParentDevicePath Parent devcie path.\r
+ @param ParentDevicePath Parent device path.\r
@param TerminalDevicePath Returned terminal device path, if building successfully.\r
\r
@retval EFI_UNSUPPORTED Terminal does not belong to the supported type.\r
)\r
{\r
//\r
- // Make the raw fifo empty.\r
+ // Make the raw FIFO empty.\r
//\r
TerminalDevice->RawFiFo.Head = TerminalDevice->RawFiFo.Tail;\r
}\r
)\r
{\r
//\r
- // Make the unicode fifo empty\r
+ // Make the unicode FIFO empty\r
//\r
TerminalDevice->UnicodeFiFo.Head = TerminalDevice->UnicodeFiFo.Tail;\r
}\r
)\r
{\r
//\r
- // Make the efi key fifo empty\r
+ // Make the efi key FIFO empty\r
//\r
TerminalDevice->EfiKeyFiFo.Head = TerminalDevice->EfiKeyFiFo.Tail;\r
}\r
);\r
ASSERT_EFI_ERROR (Status);\r
\r
-\r
return Status;\r
}\r
//\r
\r
/**\r
- Reset the input device and optionaly run diagnostics\r
+ Reset the input device and optionally run diagnostics\r
\r
@param This Protocol instance pointer.\r
@param ExtendedVerification Driver may perform diagnostics on reset.\r
\r
/**\r
Reads the next keystroke from the input device. The WaitForKey Event can\r
- be used to test for existance of a keystroke via WaitForEvent () call.\r
+ be used to test for existence of a keystroke via WaitForEvent () call.\r
\r
@param This Protocol instance pointer.\r
@param KeyData A pointer to a buffer that is filled in with the\r
pressed.\r
\r
@retval EFI_SUCCESS The keystroke information was returned.\r
- @retval EFI_NOT_READY There was no keystroke data availiable.\r
+ @retval EFI_NOT_READY There was no keystroke data available.\r
@retval EFI_DEVICE_ERROR The keystroke information was not returned due\r
to hardware errors.\r
@retval EFI_INVALID_PARAMETER KeyData is NULL.\r
IN EFI_HANDLE *ChildHandleBuffer\r
);\r
\r
+/**\r
+ Free notify functions list.\r
+\r
+ @param ListHead The list head\r
+\r
+ @retval EFI_SUCCESS Free the notify list successfully.\r
+ @retval EFI_INVALID_PARAMETER ListHead is NULL.\r
+\r
+**/\r
+EFI_STATUS\r
+TerminalFreeNotifyList (\r
+ IN OUT LIST_ENTRY *ListHead\r
+ );\r
+\r
/**\r
Retrieves a Unicode string that is the user readable name of the driver.\r
\r
\r
@retval EFI_SUCCESS There is key pending.\r
@retval EFI_NOT_READY There is no key pending.\r
- @retval EFI_DEVICE_ERROR If Serial IO is not attched to serial device.\r
+ @retval EFI_DEVICE_ERROR If Serial IO is not attached to serial device.\r
\r
**/\r
EFI_STATUS\r
Update terminal device path in Console Device Environment Variables.\r
\r
@param VariableName The Console Device Environment Variable.\r
- @param ParentDevicePath The terminal devcie path to be updated.\r
+ @param ParentDevicePath The terminal device path to be updated.\r
\r
@return None.\r
\r
Build termial device path according to terminal type.\r
\r
@param TerminalType The terminal type is PC ANSI, VT100, VT100+ or VT-UTF8.\r
- @param ParentDevicePath Parent devcie path.\r
+ @param ParentDevicePath Parent device path.\r
@param TerminalDevicePath Returned terminal device path, if building successfully.\r
\r
@retval EFI_UNSUPPORTED Terminal does not belong to the supported type.\r
\r
UTF8 Encoding Table\r
Bits per Character | Unicode Character Range | Unicode Binary Encoding | UTF8 Binary Encoding\r
- 0-7 | 0x0000 - 0x007F | 00000000 0xxxxxxx | 0xxxxxxx\r
- 8-11 | 0x0080 - 0x07FF | 00000xxx xxxxxxxx | 110xxxxx 10xxxxxx\r
- 12-16 | 0x0800 - 0xFFFF | xxxxxxxx xxxxxxxx | 1110xxxx 10xxxxxx 10xxxxxx\r
+ 0-7 | 0x0000 - 0x007F | 00000000 0xxxxxxx | 0xxxxxxx\r
+ 8-11 | 0x0080 - 0x07FF | 00000xxx xxxxxxxx | 110xxxxx 10xxxxxx\r
+ 12-16 | 0x0800 - 0xFFFF | xxxxxxxx xxxxxxxx | 1110xxxx 10xxxxxx 10xxxxxx\r
\r
\r
@param Unicode Unicode character need translating.\r
\r
UTF8 Encoding Table\r
Bits per Character | Unicode Character Range | Unicode Binary Encoding | UTF8 Binary Encoding\r
- 0-7 | 0x0000 - 0x007F | 00000000 0xxxxxxx | 0xxxxxxx\r
- 8-11 | 0x0080 - 0x07FF | 00000xxx xxxxxxxx | 110xxxxx 10xxxxxx\r
- 12-16 | 0x0800 - 0xFFFF | xxxxxxxx xxxxxxxx | 1110xxxx 10xxxxxx 10xxxxxx\r
+ 0-7 | 0x0000 - 0x007F | 00000000 0xxxxxxx | 0xxxxxxx\r
+ 8-11 | 0x0080 - 0x07FF | 00000xxx xxxxxxxx | 110xxxxx 10xxxxxx\r
+ 12-16 | 0x0800 - 0xFFFF | xxxxxxxx xxxxxxxx | 1110xxxx 10xxxxxx 10xxxxxx\r
\r
\r
@param Utf8Char VT-UTF8 character set needs translating.\r
\r
/**\r
Reads the next keystroke from the input device. The WaitForKey Event can\r
- be used to test for existance of a keystroke via WaitForEvent () call.\r
+ be used to test for existence of a keystroke via WaitForEvent () call.\r
\r
@param TerminalDevice Terminal driver private structure\r
@param KeyData A pointer to a buffer that is filled in with the\r
pressed.\r
\r
@retval EFI_SUCCESS The keystroke information was returned.\r
- @retval EFI_NOT_READY There was no keystroke data availiable.\r
+ @retval EFI_NOT_READY There was no keystroke data available.\r
@retval EFI_DEVICE_ERROR The keystroke information was not returned due\r
to hardware errors.\r
@retval EFI_INVALID_PARAMETER KeyData is NULL.\r
{\r
EFI_STATUS Status;\r
LIST_ENTRY *Link;\r
+ LIST_ENTRY *NotifyList;\r
TERMINAL_CONSOLE_IN_EX_NOTIFY *CurrentNotify;\r
\r
if (KeyData == NULL) {\r
//\r
// Invoke notification functions if exist\r
//\r
- for (Link = TerminalDevice->NotifyList.ForwardLink; Link != &TerminalDevice->NotifyList; Link = Link->ForwardLink) {\r
+ NotifyList = &TerminalDevice->NotifyList;\r
+ for (Link = GetFirstNode (NotifyList); !IsNull (NotifyList,Link); Link = GetNextNode (NotifyList,Link)) {\r
CurrentNotify = CR (\r
Link,\r
TERMINAL_CONSOLE_IN_EX_NOTIFY,\r
\r
/**\r
Check if the key already has been registered.\r
+ \r
+ If both RegsiteredData and InputData is NULL, then ASSERT().\r
\r
@param RegsiteredData A pointer to a buffer that is filled in with the\r
keystroke state data for the key that was\r
//\r
\r
/**\r
- Reset the input device and optionaly run diagnostics\r
+ Reset the input device and optionally run diagnostics\r
\r
@param This Protocol instance pointer.\r
@param ExtendedVerification Driver may perform diagnostics on reset.\r
\r
/**\r
Reads the next keystroke from the input device. The WaitForKey Event can\r
- be used to test for existance of a keystroke via WaitForEvent () call.\r
+ be used to test for existence of a keystroke via WaitForEvent () call.\r
\r
@param This Protocol instance pointer.\r
@param KeyData A pointer to a buffer that is filled in with the\r
pressed.\r
\r
@retval EFI_SUCCESS The keystroke information was returned.\r
- @retval EFI_NOT_READY There was no keystroke data availiable.\r
+ @retval EFI_NOT_READY There was no keystroke data available.\r
@retval EFI_DEVICE_ERROR The keystroke information was not returned due\r
to hardware errors.\r
@retval EFI_INVALID_PARAMETER KeyData is NULL.\r
\r
@retval EFI_SUCCESS The notification function was registered\r
successfully.\r
- @retval EFI_OUT_OF_RESOURCES Unable to allocate resources for necesssary data\r
+ @retval EFI_OUT_OF_RESOURCES Unable to allocate resources for necessary data\r
structures.\r
@retval EFI_INVALID_PARAMETER KeyData or NotifyHandle is NULL.\r
\r
TERMINAL_DEV *TerminalDevice;\r
TERMINAL_CONSOLE_IN_EX_NOTIFY *NewNotify;\r
LIST_ENTRY *Link;\r
+ LIST_ENTRY *NotifyList;\r
TERMINAL_CONSOLE_IN_EX_NOTIFY *CurrentNotify;\r
\r
if (KeyData == NULL || NotifyHandle == NULL || KeyNotificationFunction == NULL) {\r
//\r
// Return EFI_SUCCESS if the (KeyData, NotificationFunction) is already registered.\r
//\r
- for (Link = TerminalDevice->NotifyList.ForwardLink; Link != &TerminalDevice->NotifyList; Link = Link->ForwardLink) {\r
+ NotifyList = &TerminalDevice->NotifyList;\r
+ for (Link = GetFirstNode (NotifyList); !IsNull (NotifyList,Link); Link = GetNextNode (NotifyList,Link)) {\r
CurrentNotify = CR (\r
Link,\r
TERMINAL_CONSOLE_IN_EX_NOTIFY,\r
TERMINAL_DEV *TerminalDevice;\r
LIST_ENTRY *Link;\r
TERMINAL_CONSOLE_IN_EX_NOTIFY *CurrentNotify;\r
-\r
+ LIST_ENTRY *NotifyList;\r
+ \r
if (NotificationHandle == NULL) {\r
return EFI_INVALID_PARAMETER;\r
}\r
\r
TerminalDevice = TERMINAL_CON_IN_EX_DEV_FROM_THIS (This);\r
\r
- for (Link = TerminalDevice->NotifyList.ForwardLink; Link != &TerminalDevice->NotifyList; Link = Link->ForwardLink) {\r
+ NotifyList = &TerminalDevice->NotifyList;\r
+ for (Link = GetFirstNode (NotifyList); !IsNull (NotifyList,Link); Link = GetNextNode (NotifyList,Link)) {\r
CurrentNotify = CR (\r
Link,\r
TERMINAL_CONSOLE_IN_EX_NOTIFY,\r
\r
@retval EFI_SUCCESS There is key pending.\r
@retval EFI_NOT_READY There is no key pending.\r
- @retval EFI_DEVICE_ERROR If Serial IO is not attched to serial device.\r
+ @retval EFI_DEVICE_ERROR If Serial IO is not attached to serial device.\r
\r
**/\r
EFI_STATUS\r
/**\r
Get one key out of serial buffer.\r
\r
- @param SerialIo Serial I/O protocl attached to the serial device.\r
+ @param SerialIo Serial I/O protocol attached to the serial device.\r
@param Output The fetched key.\r
\r
@return EFI_NOT_READY If serial buffer is empty.\r
)\r
{\r
EFI_INPUT_KEY Key;\r
-\r
- if ((TerminalDevice->InputState & INPUT_STATE_ESC) != 0) {\r
+ UINT32 InputState;\r
+ \r
+ InputState = TerminalDevice->InputState;\r
+ \r
+ if ((InputState & INPUT_STATE_ESC) != 0) {\r
Key.ScanCode = SCAN_ESC;\r
Key.UnicodeChar = 0;\r
EfiKeyFiFoInsertOneKey (TerminalDevice, Key);\r
}\r
\r
- if ((TerminalDevice->InputState & INPUT_STATE_CSI) != 0) {\r
+ if ((InputState & INPUT_STATE_CSI) != 0) {\r
Key.ScanCode = SCAN_NULL;\r
Key.UnicodeChar = CSI;\r
EfiKeyFiFoInsertOneKey (TerminalDevice, Key);\r
}\r
\r
- if ((TerminalDevice->InputState & INPUT_STATE_LEFTOPENBRACKET) != 0) {\r
+ if ((InputState & INPUT_STATE_LEFTOPENBRACKET) != 0) {\r
Key.ScanCode = SCAN_NULL;\r
Key.UnicodeChar = LEFTOPENBRACKET;\r
EfiKeyFiFoInsertOneKey (TerminalDevice, Key);\r
}\r
\r
- if ((TerminalDevice->InputState & INPUT_STATE_O) != 0) {\r
+ if ((InputState & INPUT_STATE_O) != 0) {\r
Key.ScanCode = SCAN_NULL;\r
Key.UnicodeChar = 'O';\r
EfiKeyFiFoInsertOneKey (TerminalDevice, Key);\r
}\r
\r
- if ((TerminalDevice->InputState & INPUT_STATE_2) != 0) {\r
+ if ((InputState & INPUT_STATE_2) != 0) {\r
Key.ScanCode = SCAN_NULL;\r
Key.UnicodeChar = '2';\r
EfiKeyFiFoInsertOneKey (TerminalDevice, Key);\r
\r
The table below shows the keyboard input mappings that this function supports.\r
If the ESC sequence listed in one of the columns is presented, then it is translated\r
- into the coorespoding EFI Scan Code. If a matching sequence is not found, then the raw\r
+ into the corresponding EFI Scan Code. If a matching sequence is not found, then the raw\r
key strokes are converted into EFI Keys.\r
\r
2 seconds are allowed for an ESC sequence to be completed. If the ESC sequence is not\r
\r
//\r
// Skip outputting the command string for the same attribute\r
- // It improves the terminal performance siginificantly\r
+ // It improves the terminal performance significantly\r
//\r
if (This->Mode->Attribute == (INT32) Attribute) {\r
return EFI_SUCCESS;\r
#/** @file\r
-# Component description file for Terminal module.\r
-#\r
-# This driver installs Simple Text In/Out protocol for terminal devices (serial devices or hotplug devices).\r
-# Copyright (c) 2006 - 2008, Intel Corporation\r
+# \r
+# Component description file for Terminal module.\r
#\r
+# This driver installs Simple Text In/Out protocol for terminal devices (serial devices or hotplug devices).\r
+# \r
+# Copyright (c) 2006 - 2008, Intel Corporation\r
# All rights reserved. This program and the accompanying materials\r
# are licensed and made available under the terms and conditions of the BSD License\r
# which accompanies this distribution. The full text of the license may be found at\r