}\r
\r
/**\r
- Starts the device with this driver.\r
+ Starts the keyboard device with this driver.\r
\r
This function produces Simple Text Input Protocol and Simple Text Input Ex Protocol,\r
initializes the keyboard device, and submit Asynchronous Interrupt Transfer to manage\r
EndpointNumber = UsbKeyboardDevice->InterfaceDescriptor.NumEndpoints;\r
\r
//\r
- // Traverse endpoints to find interrupt endpoints\r
+ // Traverse endpoints to find interrupt endpoint\r
//\r
Found = FALSE;\r
for (Index = 0; Index < EndpointNumber; Index++) {\r
&EndpointDescriptor\r
);\r
\r
- if ((EndpointDescriptor.Attributes & 0x03) == USB_ENDPOINT_INTERRUPT) {\r
+ if ((EndpointDescriptor.Attributes & (BIT0 | BIT1)) == USB_ENDPOINT_INTERRUPT) {\r
//\r
// We only care interrupt endpoint here\r
//\r
if (UsbKeyboardDevice->SimpleInputEx.WaitForKeyEx != NULL) {\r
gBS->CloseEvent (UsbKeyboardDevice->SimpleInputEx.WaitForKeyEx);\r
}\r
- gBS->FreePool (UsbKeyboardDevice);\r
+ FreePool (UsbKeyboardDevice);\r
UsbKeyboardDevice = NULL;\r
}\r
gBS->CloseProtocol (\r
FreeUnicodeStringTable (UsbKeyboardDevice->ControllerNameTable);\r
}\r
\r
- gBS->FreePool (UsbKeyboardDevice);\r
+ FreePool (UsbKeyboardDevice);\r
\r
return Status;\r
}\r
Link = GetFirstNode (NotifyList);\r
NotifyNode = CR (Link, KEYBOARD_CONSOLE_IN_EX_NOTIFY, NotifyEntry, USB_KB_CONSOLE_IN_EX_NOTIFY_SIGNATURE);\r
RemoveEntryList (Link);\r
- gBS->FreePool (NotifyNode);\r
+ FreePool (NotifyNode);\r
}\r
\r
return EFI_SUCCESS;\r
NULL\r
);\r
ASSERT_EFI_ERROR (Status);\r
- gBS->FreePool (CurrentNotify); \r
+ FreePool (CurrentNotify); \r
return EFI_SUCCESS;\r
}\r
}\r
);\r
\r
/**\r
- Starts the device with this driver.\r
+ Starts the keyboard device with this driver.\r
\r
This function produces Simple Text Input Protocol and Simple Text Input Ex Protocol,\r
initializes the keyboard device, and submit Asynchronous Interrupt Transfer to manage\r
KeyboardLayout\r
);\r
if (EFI_ERROR (Status)) {\r
- gBS->FreePool (KeyboardLayout);\r
+ FreePool (KeyboardLayout);\r
KeyboardLayout = NULL;\r
}\r
}\r
//\r
// Set boot protocol for the USB Keyboard.\r
// This driver only supports boot protocol.\r
- // The device that does not support boot protocol is not supported.\r
//\r
if (Protocol != BOOT_PROTOCOL) {\r
UsbSetProtocolRequest (\r
ZeroMem (UsbKeyboardDevice->LastKeyCodeArray, sizeof (UINT8) * 8);\r
\r
//\r
- // Set a timer for repeat keys' generation.\r
+ // Create event for repeat keys' generation.\r
//\r
if (UsbKeyboardDevice->RepeatTimer != NULL) {\r
gBS->CloseEvent (UsbKeyboardDevice->RepeatTimer);\r
UsbKeyboardDevice->RepeatTimer = NULL;\r
}\r
\r
- Status = gBS->CreateEvent (\r
- EVT_TIMER | EVT_NOTIFY_SIGNAL,\r
- TPL_NOTIFY,\r
- USBKeyboardRepeatHandler,\r
- UsbKeyboardDevice,\r
- &UsbKeyboardDevice->RepeatTimer\r
- );\r
+ gBS->CreateEvent (\r
+ EVT_TIMER | EVT_NOTIFY_SIGNAL,\r
+ TPL_NOTIFY,\r
+ USBKeyboardRepeatHandler,\r
+ UsbKeyboardDevice,\r
+ &UsbKeyboardDevice->RepeatTimer\r
+ );\r
\r
+ //\r
+ // Create event for delayed recovery, which deals with device error.\r
+ //\r
if (UsbKeyboardDevice->DelayedRecoveryEvent != NULL) {\r
gBS->CloseEvent (UsbKeyboardDevice->DelayedRecoveryEvent);\r
UsbKeyboardDevice->DelayedRecoveryEvent = NULL;\r
}\r
\r
- Status = gBS->CreateEvent (\r
- EVT_TIMER | EVT_NOTIFY_SIGNAL,\r
- TPL_NOTIFY,\r
- USBKeyboardRecoveryHandler,\r
- UsbKeyboardDevice,\r
- &UsbKeyboardDevice->DelayedRecoveryEvent\r
- );\r
+ gBS->CreateEvent (\r
+ EVT_TIMER | EVT_NOTIFY_SIGNAL,\r
+ TPL_NOTIFY,\r
+ USBKeyboardRecoveryHandler,\r
+ UsbKeyboardDevice,\r
+ &UsbKeyboardDevice->DelayedRecoveryEvent\r
+ );\r
\r
return EFI_SUCCESS;\r
}\r
if (Context != NULL) {\r
*Context = UsbBot;\r
} else {\r
- gBS->FreePool (UsbBot);\r
+ FreePool (UsbBot);\r
}\r
\r
return EFI_SUCCESS;\r
\r
ON_ERROR:\r
- gBS->FreePool (UsbBot);\r
+ FreePool (UsbBot);\r
return Status;\r
}\r
\r
IN VOID *Context\r
)\r
{\r
- gBS->FreePool (Context);\r
+ FreePool (Context);\r
return EFI_SUCCESS;\r
}\r
\r
if (Context != NULL) {\r
*Context = UsbCbi;\r
} else {\r
- gBS->FreePool (UsbCbi);\r
+ FreePool (UsbCbi);\r
}\r
\r
return EFI_SUCCESS;\r
\r
ON_ERROR:\r
- gBS->FreePool (UsbCbi);\r
+ FreePool (UsbCbi);\r
return Status;\r
}\r
\r
IN VOID *Context\r
)\r
{\r
- gBS->FreePool (Context);\r
+ FreePool (Context);\r
return EFI_SUCCESS;\r
}\r
return EFI_SUCCESS;\r
}\r
\r
-\r
/**\r
Event notification function for SIMPLE_POINTER.WaitForInput event.\r
\r
}\r
}\r
\r
-\r
/**\r
Handler for Delayed Recovery event.\r
\r
OUT CHAR16 **ControllerName\r
);\r
\r
+//\r
+// Functions of EFI_SIMPLE_POINTER_PROTOCOL\r
+//\r
+\r
+/**\r
+ Retrieves the current state of a pointer device.\r
+ \r
+ @param This A pointer to the EFI_SIMPLE_POINTER_PROTOCOL instance. \r
+ @param MouseState A pointer to the state information on the pointer device.\r
+ \r
+ @retval EFI_SUCCESS The state of the pointer device was returned in State.\r
+ @retval EFI_NOT_READY The state of the pointer device has not changed since the last call to\r
+ GetState(). \r
+ @retval EFI_DEVICE_ERROR A device error occurred while attempting to retrieve the pointer device's\r
+ current state. \r
+ @retval EFI_INVALID_PARAMETER MouseState is NULL. \r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+GetMouseState (\r
+ IN EFI_SIMPLE_POINTER_PROTOCOL *This,\r
+ OUT EFI_SIMPLE_POINTER_STATE *MouseState\r
+ );\r
+\r
+/** \r
+ Resets the pointer device hardware.\r
+ \r
+ @param This A pointer to the EFI_SIMPLE_POINTER_PROTOCOL instance.\r
+ @param ExtendedVerification Indicates that the driver may perform a more exhaustive\r
+ verification operation of the device during reset.\r
+ \r
+ @retval EFI_SUCCESS The device was reset.\r
+ @retval EFI_DEVICE_ERROR The device is not functioning correctly and could not be reset.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+UsbMouseReset (\r
+ IN EFI_SIMPLE_POINTER_PROTOCOL *This,\r
+ IN BOOLEAN ExtendedVerification\r
+ );\r
+\r
+/**\r
+ Event notification function for SIMPLE_POINTER.WaitForInput event.\r
+\r
+ @param Event Event to be signaled when there's input from mouse.\r
+ @param Context Points to USB_MOUSE_DEV instance.\r
+ \r
+**/\r
+VOID\r
+EFIAPI\r
+UsbMouseWaitForInput (\r
+ IN EFI_EVENT Event,\r
+ IN VOID *Context\r
+ );\r
+\r
//\r
// Internal worker functions\r
//\r
IN UINT32 Result\r
);\r
\r
-/**\r
- Retrieves the current state of a pointer device.\r
- \r
- @param This A pointer to the EFI_SIMPLE_POINTER_PROTOCOL instance. \r
- @param MouseState A pointer to the state information on the pointer device.\r
- \r
- @retval EFI_SUCCESS The state of the pointer device was returned in State.\r
- @retval EFI_NOT_READY The state of the pointer device has not changed since the last call to\r
- GetState(). \r
- @retval EFI_DEVICE_ERROR A device error occurred while attempting to retrieve the pointer device's\r
- current state. \r
- @retval EFI_INVALID_PARAMETER MouseState is NULL. \r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-GetMouseState (\r
- IN EFI_SIMPLE_POINTER_PROTOCOL *This,\r
- OUT EFI_SIMPLE_POINTER_STATE *MouseState\r
- );\r
-\r
-/** \r
- Resets the pointer device hardware.\r
- \r
- @param This A pointer to the EFI_SIMPLE_POINTER_PROTOCOL instance.\r
- @param ExtendedVerification Indicates that the driver may perform a more exhaustive\r
- verification operation of the device during reset.\r
- \r
- @retval EFI_SUCCESS The device was reset.\r
- @retval EFI_DEVICE_ERROR The device is not functioning correctly and could not be reset.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-UsbMouseReset (\r
- IN EFI_SIMPLE_POINTER_PROTOCOL *This,\r
- IN BOOLEAN ExtendedVerification\r
- );\r
-\r
-/**\r
- Event notification function for SIMPLE_POINTER.WaitForInput event.\r
-\r
- @param Event Event to be signaled when there's input from mouse.\r
- @param Context Points to USB_MOUSE_DEV instance.\r
- \r
-**/\r
-VOID\r
-EFIAPI\r
-UsbMouseWaitForInput (\r
- IN EFI_EVENT Event,\r
- IN VOID *Context\r
- );\r
-\r
/**\r
Handler for Delayed Recovery event.\r
\r