\r
\r
/**\r
- Test to see if this driver supports ControllerHandle. \r
+ Test to see if this driver supports Controller. \r
\r
@param This Protocol instance pointer.\r
- @param ControllerHandle Handle of device to test\r
+ @param Controller Handle of device to test\r
@param RemainingDevicePath Optional parameter use to pick a specific child\r
device to start.\r
\r
- @retval EFI_SUCCESS This driver supports this device\r
- @retval EFI_ALREADY_STARTED This driver is already running on this device\r
- @retval other This driver does not support this device\r
+ @retval EFI_SUCCESS This driver supports this device.\r
+ @retval EFI_ALREADY_STARTED This driver is already running on this device.\r
+ @retval other This driver does not support this device.\r
\r
**/\r
EFI_STATUS\r
}\r
\r
/**\r
- Start this driver on ControllerHandle by opening a Serial IO protocol,\r
+ Start this driver on Controller by opening a Serial IO protocol,\r
reading Device Path, and creating a child handle with a Simple Text In,\r
Simple Text In Ex and Simple Text Out protocol, and device path protocol.\r
And store Console Device Environment Variables.\r
\r
@param This Protocol instance pointer.\r
- @param ControllerHandle Handle of device to bind driver to\r
+ @param Controller Handle of device to bind driver to\r
@param RemainingDevicePath Optional parameter use to pick a specific child\r
device to start.\r
\r
- @retval EFI_SUCCESS This driver is added to ControllerHandle\r
- @retval EFI_ALREADY_STARTED This driver is already running on ControllerHandle\r
- @retval other This driver does not support this device\r
+ @retval EFI_SUCCESS This driver is added to Controller.\r
+ @retval EFI_ALREADY_STARTED This driver is already running on Controller.\r
+ @retval other This driver does not support this device.\r
\r
**/\r
EFI_STATUS\r
ASSERT (TerminalType <= VTUTF8TYPE);\r
\r
CopyMem (&DefaultNode->Guid, gTerminalType[TerminalType], sizeof (EFI_GUID));\r
- RemainingDevicePath = (EFI_DEVICE_PATH_PROTOCOL*)DefaultNode;\r
+ RemainingDevicePath = (EFI_DEVICE_PATH_PROTOCOL *) DefaultNode;\r
} else {\r
//\r
// Use the RemainingDevicePath to determine the terminal type\r
}\r
\r
/**\r
- Stop this driver on ControllerHandle by closing Simple Text In, Simple Text\r
+ Stop this driver on Controller by closing Simple Text In, Simple Text\r
In Ex, Simple Text Out protocol, and removing parent device path from\r
Console Device Environment Variables. \r
\r
@param This Protocol instance pointer.\r
- @param ControllerHandle Handle of device to stop driver on\r
+ @param Controller Handle of device to stop driver on\r
@param NumberOfChildren Number of Handles in ChildHandleBuffer. If number of\r
children is zero stop the entire bus driver.\r
@param ChildHandleBuffer List of Child Handles to Stop.\r
\r
- @retval EFI_SUCCESS This driver is removed ControllerHandle.\r
+ @retval EFI_SUCCESS This driver is removed Controller.\r
@retval other This driver could not be removed from this device.\r
\r
**/\r
TERMINAL_CONSOLE_IN_EX_NOTIFY_SIGNATURE\r
);\r
RemoveEntryList (ListHead->ForwardLink);\r
- gBS->FreePool (NotifyNode);\r
+ FreePool (NotifyNode);\r
}\r
\r
return EFI_SUCCESS;\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
- @return Caller is repsoncible freeing the buffer.\r
- @retval NULL Variable was not read\r
+ Caller is repsoncible freeing the buffer. If variable was not read, \r
+ NULL regturned.\r
\r
**/\r
VOID *\r
Node.Header.SubType = MSG_VENDOR_DP;\r
\r
//\r
- // generate terminal device path node according to terminal type.\r
+ // Generate terminal device path node according to terminal type.\r
//\r
switch (TerminalType) {\r
\r
case PCANSITYPE:\r
- CopyMem (\r
- &Node.Guid,\r
- &gEfiPcAnsiGuid,\r
- sizeof (EFI_GUID)\r
- );\r
+ CopyGuid (&Node.Guid, &gEfiPcAnsiGuid);\r
break;\r
\r
case VT100TYPE:\r
- CopyMem (\r
- &Node.Guid,\r
- &gEfiVT100Guid,\r
- sizeof (EFI_GUID)\r
- );\r
+ CopyGuid (&Node.Guid, &gEfiVT100Guid);\r
break;\r
\r
case VT100PLUSTYPE:\r
- CopyMem (\r
- &Node.Guid,\r
- &gEfiVT100PlusGuid,\r
- sizeof (EFI_GUID)\r
- );\r
+ CopyGuid (&Node.Guid, &gEfiVT100PlusGuid);\r
break;\r
\r
case VTUTF8TYPE:\r
- CopyMem (\r
- &Node.Guid,\r
- &gEfiVTUTF8Guid,\r
- sizeof (EFI_GUID)\r
- );\r
+ CopyGuid (&Node.Guid, &gEfiVTUTF8Guid);\r
break;\r
\r
default:\r
return EFI_UNSUPPORTED;\r
- break;\r
}\r
\r
+ //\r
+ // Get VENDOR_DEVCIE_PATH size and put into Node.Header\r
+ //\r
SetDevicePathNodeLength (\r
&Node.Header,\r
sizeof (VENDOR_DEVICE_PATH)\r
);\r
+\r
//\r
- // append the terminal node onto parent device path\r
+ // Append the terminal node onto parent device path\r
// to generate a complete terminal device path.\r
//\r
*TerminalDevicePath = AppendDevicePathNode (\r
/**\r
The user Entry Point for module Terminal. The user code starts with this function.\r
\r
- @param[in] ImageHandle The firmware allocated handle for the EFI image.\r
- @param[in] SystemTable A pointer to the EFI System Table.\r
+ @param ImageHandle The firmware allocated handle for the EFI image.\r
+ @param SystemTable A pointer to the EFI System Table.\r
\r
@retval EFI_SUCCESS The entry point is executed successfully.\r
@retval other Some error occurs when executing this entry point.\r
;\r
\r
/**\r
- Test to see if this driver supports ControllerHandle. \r
+ Test to see if this driver supports Controller. \r
\r
@param This Protocol instance pointer.\r
- @param ControllerHandle Handle of device to test\r
+ @param Controller Handle of device to test\r
@param RemainingDevicePath Optional parameter use to pick a specific child\r
device to start.\r
\r
- @retval EFI_SUCCESS This driver supports this device\r
- @retval EFI_ALREADY_STARTED This driver is already running on this device\r
- @retval other This driver does not support this device\r
+ @retval EFI_SUCCESS This driver supports this device.\r
+ @retval EFI_ALREADY_STARTED This driver is already running on this device.\r
+ @retval other This driver does not support this device.\r
\r
**/\r
EFI_STATUS\r
EFIAPI\r
TerminalDriverBindingSupported (\r
IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
- IN EFI_HANDLE Controller,\r
+ IN EFI_HANDLE ControllerHandle,\r
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
);\r
\r
/**\r
- Start this driver on ControllerHandle by opening a Serial IO protocol,\r
+ Start this driver on Controller by opening a Serial IO protocol,\r
reading Device Path, and creating a child handle with a Simple Text In,\r
Simple Text In Ex and Simple Text Out protocol, and device path protocol.\r
And store Console Device Environment Variables.\r
\r
@param This Protocol instance pointer.\r
- @param ControllerHandle Handle of device to bind driver to\r
+ @param Controller Handle of device to bind driver to\r
@param RemainingDevicePath Optional parameter use to pick a specific child\r
device to start.\r
\r
- @retval EFI_SUCCESS This driver is added to ControllerHandle\r
- @retval EFI_ALREADY_STARTED This driver is already running on ControllerHandle\r
- @retval other This driver does not support this device\r
+ @retval EFI_SUCCESS This driver is added to Controller.\r
+ @retval EFI_ALREADY_STARTED This driver is already running on Controller.\r
+ @retval other This driver does not support this device.\r
\r
**/\r
EFI_STATUS\r
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
);\r
\r
+\r
/**\r
- Stop this driver on ControllerHandle by closing Simple Text In, Simple Text\r
+ Stop this driver on Controller by closing Simple Text In, Simple Text\r
In Ex, Simple Text Out protocol, and removing parent device path from\r
Console Device Environment Variables. \r
\r
@param This Protocol instance pointer.\r
- @param ControllerHandle Handle of device to stop driver on\r
+ @param Controller Handle of device to stop driver on\r
@param NumberOfChildren Number of Handles in ChildHandleBuffer. If number of\r
children is zero stop the entire bus driver.\r
@param ChildHandleBuffer List of Child Handles to Stop.\r
\r
- @retval EFI_SUCCESS This driver is removed ControllerHandle.\r
+ @retval EFI_SUCCESS This driver is removed Controller.\r
@retval other This driver could not be removed from this device.\r
\r
**/\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
- @return Caller is repsoncible freeing the buffer.\r
- @retval NULL Variable was not read\r
+ Caller is repsoncible freeing the buffer. If variable was not read, \r
+ NULL regturned.\r
\r
**/\r
VOID *\r
**/\r
VOID\r
UnicodeToEfiKey (\r
- IN TERMINAL_DEV *PcAnsiDevice\r
+ IN TERMINAL_DEV *TerminalDevice\r
)\r
;\r
\r
#include "Terminal.h"\r
\r
\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
\r
SerialInTimeOut = 0;\r
if (Mode->BaudRate != 0) {\r
+ //\r
+ // According to BAUD rate to calculate the timeout value.\r
+ //\r
SerialInTimeOut = (1 + Mode->DataBits + Mode->StopBits) * 2 * 1000000 / (UINTN) Mode->BaudRate;\r
}\r
\r
}\r
}\r
//\r
- // check whether serial buffer is empty\r
+ // Check whether serial buffer is empty.\r
//\r
Status = SerialIo->GetControl (SerialIo, &Control);\r
\r
- if (0 != (Control & EFI_SERIAL_INPUT_BUFFER_EMPTY)) {\r
+ if ((Control & EFI_SERIAL_INPUT_BUFFER_EMPTY) != 0) {\r
//\r
// Translate all the raw data in RawFIFO into EFI Key,\r
// according to different terminal type supported.\r
Size = 1;\r
*Output = 0;\r
\r
+ //\r
+ // Read one key from serial I/O device.\r
+ //\r
Status = SerialIo->Read (SerialIo, &Size, Output);\r
\r
if (EFI_ERROR (Status)) {\r
{\r
EFI_INPUT_KEY Key;\r
\r
- if (0 != (TerminalDevice->InputState & INPUT_STATE_ESC)) {\r
+ if ((TerminalDevice->InputState & INPUT_STATE_ESC) != 0) {\r
Key.ScanCode = SCAN_ESC;\r
Key.UnicodeChar = 0;\r
EfiKeyFiFoInsertOneKey (TerminalDevice, Key);\r
}\r
\r
- if (0 != (TerminalDevice->InputState & INPUT_STATE_CSI)) {\r
+ if ((TerminalDevice->InputState & INPUT_STATE_CSI) != 0) {\r
Key.ScanCode = SCAN_NULL;\r
Key.UnicodeChar = CSI;\r
EfiKeyFiFoInsertOneKey (TerminalDevice, Key);\r
}\r
\r
- if (0 != (TerminalDevice->InputState & INPUT_STATE_LEFTOPENBRACKET)) {\r
+ if ((TerminalDevice->InputState & INPUT_STATE_LEFTOPENBRACKET) != 0) {\r
Key.ScanCode = SCAN_NULL;\r
Key.UnicodeChar = LEFTOPENBRACKET;\r
EfiKeyFiFoInsertOneKey (TerminalDevice, Key);\r
}\r
\r
- if (0 != (TerminalDevice->InputState & INPUT_STATE_O)) {\r
+ if ((TerminalDevice->InputState & INPUT_STATE_O) != 0) {\r
Key.ScanCode = SCAN_NULL;\r
Key.UnicodeChar = 'O';\r
EfiKeyFiFoInsertOneKey (TerminalDevice, Key);\r
}\r
\r
- if (0 != (TerminalDevice->InputState & INPUT_STATE_2)) {\r
+ if ((TerminalDevice->InputState & INPUT_STATE_2) != 0) {\r
Key.ScanCode = SCAN_NULL;\r
Key.UnicodeChar = '2';\r
EfiKeyFiFoInsertOneKey (TerminalDevice, Key);\r
}\r
\r
+ //\r
+ // Cancel the timer.\r
+ //\r
gBS->SetTimer (\r
TerminalDevice->TwoSecondTimeOut,\r
TimerCancel,\r
{ GEOMETRICSHAPE_DOWN_TRIANGLE, 0x1f, L'v' },\r
{ GEOMETRICSHAPE_LEFT_TRIANGLE, 0x11, L'<' },\r
\r
- { ARROW_LEFT, 0x3c, L'<' },\r
- { ARROW_UP, 0x18, L'^' },\r
- { ARROW_RIGHT, 0x3e, L'>' },\r
- { ARROW_DOWN, 0x19, L'v' },\r
+ { ARROW_LEFT, 0x3c, L'<' },\r
+ { ARROW_UP, 0x18, L'^' },\r
+ { ARROW_RIGHT, 0x3e, L'>' },\r
+ { ARROW_DOWN, 0x19, L'v' },\r
\r
{ 0x0000, 0x00, L'\0' }\r
};\r
\r
-CHAR16 mSetModeString[] = { ESC, '[', '=', '3', 'h', 0 };\r
-CHAR16 mSetAttributeString[] = { ESC, '[', '0', 'm', ESC, '[', '4', '0', 'm', ESC, '[', '4', '0', 'm', 0 };\r
-CHAR16 mClearScreenString[] = { ESC, '[', '2', 'J', 0 };\r
-CHAR16 mSetCursorPositionString[] = { ESC, '[', '0', '0', ';', '0', '0', 'H', 0 };\r
+STATIC CHAR16 mSetModeString[] = { ESC, '[', '=', '3', 'h', 0 };\r
+STATIC CHAR16 mSetAttributeString[] = { ESC, '[', '0', 'm', ESC, '[', '4', '0', 'm', ESC, '[', '4', '0', 'm', 0 };\r
+STATIC CHAR16 mClearScreenString[] = { ESC, '[', '2', 'J', 0 };\r
+STATIC CHAR16 mSetCursorPositionString[] = { ESC, '[', '0', '0', ';', '0', '0', 'H', 0 };\r
\r
//\r
// Body of the ConOut functions\r
\r
/**\r
Implements EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.Reset().\r
+\r
If ExtendeVerification is TRUE, then perform dependent serial device reset,\r
and set display mode to mode 0.\r
If ExtendedVerification is FALSE, only set display mode to mode 0.\r
\r
/**\r
Implements EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.OutputString().\r
+\r
The Unicode string will be converted to terminal expressible data stream\r
and send to terminal via serial port.\r
\r
\r
/**\r
Implements EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.TestString().\r
+\r
If one of the characters in the *Wstring is\r
neither valid Unicode drawing characters,\r
not ASCII code, then this function will return\r
\r
/**\r
Implements EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.QueryMode().\r
+\r
It returns information for an available text mode\r
that the terminal supports.\r
In this driver, we support text mode 80x25 (mode 0),\r
\r
/**\r
Implements EFI_SIMPLE_TEXT_OUT.SetMode().\r
+\r
Set the terminal to a specified display mode.\r
In this driver, we only support mode 0.\r
\r
\r
/**\r
Implements SIMPLE_TEXT_OUTPUT.EnableCursor().\r
+\r
In this driver, the cursor cannot be hidden.\r
\r
@param This Indicates the calling context.\r