-/*++\r
+/** @file\r
+ Common Dxe Libarary for USB\r
\r
-Copyright (c) 2006, 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
-http://opensource.org/licenses/bsd-license.php \r
- \r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
+ Copyright (c) 2006, Intel Corporation<BR>\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
+ http://opensource.org/licenses/bsd-license.php\r
\r
- Module Name:\r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
\r
- UsbDxeLib.h\r
+**/\r
\r
- Abstract:\r
\r
- Common Dxe Libarary for USB\r
- Add Constants & structure definitions for Usb HID\r
+#ifndef __USB_DXE_LIB_H__\r
+#define __USB_DXE_LIB_H__\r
\r
- Revision History\r
+#include <Protocol/UsbIo.h>\r
\r
---*/\r
+//\r
+// Standard device request and request type\r
+// By [Spec-USB20/Chapter-9.4]\r
+//\r
+#define USB_DEV_GET_STATUS 0x00\r
+#define USB_DEV_GET_STATUS_REQ_TYPE_D 0x80 // Receiver : Device\r
+#define USB_DEV_GET_STATUS_REQ_TYPE_I 0x81 // Receiver : Interface\r
+#define USB_DEV_GET_STATUS_REQ_TYPE_E 0x82 // Receiver : Endpoint\r
+\r
+#define USB_DEV_CLEAR_FEATURE 0x01\r
+#define USB_DEV_CLEAR_FEATURE_REQ_TYPE_D 0x00 // Receiver : Device\r
+#define USB_DEV_CLEAR_FEATURE_REQ_TYPE_I 0x01 // Receiver : Interface\r
+#define USB_DEV_CLEAR_FEATURE_REQ_TYPE_E 0x02 // Receiver : Endpoint\r
+\r
+#define USB_DEV_SET_FEATURE 0x03\r
+#define USB_DEV_SET_FEATURE_REQ_TYPE_D 0x00 // Receiver : Device\r
+#define USB_DEV_SET_FEATURE_REQ_TYPE_I 0x01 // Receiver : Interface\r
+#define USB_DEV_SET_FEATURE_REQ_TYPE_E 0x02 // Receiver : Endpoint\r
+\r
+#define USB_DEV_SET_ADDRESS 0x05\r
+#define USB_DEV_SET_ADDRESS_REQ_TYPE 0x00\r
+\r
+#define USB_DEV_GET_DESCRIPTOR 0x06\r
+#define USB_DEV_GET_DESCRIPTOR_REQ_TYPE 0x80\r
+\r
+#define USB_DEV_SET_DESCRIPTOR 0x07\r
+#define USB_DEV_SET_DESCRIPTOR_REQ_TYPE 0x00\r
+\r
+#define USB_DEV_GET_CONFIGURATION 0x08\r
+#define USB_DEV_GET_CONFIGURATION_REQ_TYPE 0x80\r
+\r
+#define USB_DEV_SET_CONFIGURATION 0x09\r
+#define USB_DEV_SET_CONFIGURATION_REQ_TYPE 0x00\r
+\r
+#define USB_DEV_GET_INTERFACE 0x0A\r
+#define USB_DEV_GET_INTERFACE_REQ_TYPE 0x81\r
\r
-#ifndef _USB_DXE_LIB_H\r
-#define _USB_DXE_LIB_H\r
+#define USB_DEV_SET_INTERFACE 0x0B\r
+#define USB_DEV_SET_INTERFACE_REQ_TYPE 0x01\r
+\r
+#define USB_DEV_SYNCH_FRAME 0x0C\r
+#define USB_DEV_SYNCH_FRAME_REQ_TYPE 0x82\r
\r
//\r
// define the timeout time as 3ms\r
IN UINT8 *Report\r
);\r
\r
-//\r
-// Get Device Descriptor\r
-//\r
+typedef enum {\r
+ EfiUsbEndpointHalt,\r
+ EfiUsbDeviceRemoteWakeup\r
+} EFI_USB_STANDARD_FEATURE_SELECTOR;\r
+\r
EFI_STATUS\r
UsbGetDescriptor (\r
IN EFI_USB_IO_PROTOCOL *UsbIo,\r
OUT UINT32 *Status\r
);\r
\r
-//\r
-// Set Device Descriptor\r
-//\r
EFI_STATUS\r
UsbSetDescriptor (\r
IN EFI_USB_IO_PROTOCOL *UsbIo,\r
OUT UINT32 *Status\r
);\r
\r
-//\r
-// Get device Interface\r
-//\r
EFI_STATUS\r
-UsbGetDeviceInterface (\r
+UsbGetInterface (\r
IN EFI_USB_IO_PROTOCOL *UsbIo,\r
IN UINT16 Index,\r
OUT UINT8 *AltSetting,\r
OUT UINT32 *Status\r
);\r
\r
-//\r
-// Set device interface\r
-//\r
EFI_STATUS\r
-UsbSetDeviceInterface (\r
+UsbSetInterface (\r
IN EFI_USB_IO_PROTOCOL *UsbIo,\r
IN UINT16 InterfaceNo,\r
IN UINT16 AltSetting,\r
OUT UINT32 *Status\r
);\r
\r
-//\r
-// Get device configuration\r
-//\r
EFI_STATUS\r
-UsbGetDeviceConfiguration (\r
+UsbGetConfiguration (\r
IN EFI_USB_IO_PROTOCOL *UsbIo,\r
OUT UINT8 *ConfigValue,\r
OUT UINT32 *Status\r
);\r
\r
-//\r
-// Set device configuration\r
-//\r
EFI_STATUS\r
-UsbSetDeviceConfiguration (\r
+UsbSetConfiguration (\r
IN EFI_USB_IO_PROTOCOL *UsbIo,\r
IN UINT16 Value,\r
OUT UINT32 *Status\r
);\r
\r
-//\r
-// Set Device Feature\r
-//\r
EFI_STATUS\r
-UsbSetDeviceFeature (\r
+UsbSetFeature (\r
IN EFI_USB_IO_PROTOCOL *UsbIo,\r
- IN EFI_USB_RECIPIENT Recipient,\r
+ IN UINTN Recipient,\r
IN UINT16 Value,\r
IN UINT16 Target,\r
OUT UINT32 *Status\r
);\r
\r
-//\r
-// Clear Device Feature\r
-//\r
EFI_STATUS\r
-UsbClearDeviceFeature (\r
+UsbClearFeature (\r
IN EFI_USB_IO_PROTOCOL *UsbIo,\r
- IN EFI_USB_RECIPIENT Recipient,\r
+ IN UINTN Recipient,\r
IN UINT16 Value,\r
IN UINT16 Target,\r
OUT UINT32 *Status\r
);\r
\r
-//\r
-// Get Device Status\r
-//\r
EFI_STATUS\r
-UsbGetDeviceStatus (\r
+UsbGetStatus (\r
IN EFI_USB_IO_PROTOCOL *UsbIo,\r
- IN EFI_USB_RECIPIENT Recipient,\r
+ IN UINTN Recipient,\r
IN UINT16 Target,\r
OUT UINT16 *DevStatus,\r
OUT UINT32 *Status\r
);\r
\r
-//\r
-// The following APIs are not basic library, but they are common used.\r
-//\r
-//\r
-// Usb Get String\r
-//\r
EFI_STATUS\r
-UsbGetString (\r
+UsbGetHubDescriptor (\r
IN EFI_USB_IO_PROTOCOL *UsbIo,\r
- IN UINT16 LangID,\r
- IN UINT8 Index,\r
- IN VOID *Buf,\r
- IN UINTN BufSize,\r
+ IN UINT16 Value,\r
+ IN UINT16 Index,\r
+ IN UINT16 DescriptorLength,\r
+ OUT VOID *Descriptor,\r
OUT UINT32 *Status\r
);\r
\r