--- /dev/null
+/** @file\r
+\r
+Copyright (c) 2007, 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
+\r
+ Module Name:\r
+\r
+ UsbDesc.h\r
+\r
+ Abstract:\r
+\r
+ Manage Usb Descriptor List\r
+\r
+ Revision History\r
+\r
+\r
+**/\r
+\r
+#ifndef _USB_DESCRIPTOR_H_\r
+#define _USB_DESCRIPTOR_H_\r
+\r
+enum {\r
+ USB_MAX_INTERFACE_SETTING = 8,\r
+};\r
+\r
+//\r
+// The RequestType in EFI_USB_DEVICE_REQUEST is composed of\r
+// three fields: One bit direction, 2 bit type, and 5 bit\r
+// target.\r
+//\r
+#define USB_REQUEST_TYPE(Dir, Type, Target) \\r
+ ((UINT8)((((Dir) == EfiUsbDataIn ? 0x01 : 0) << 7) | (Type) | (Target)))\r
+\r
+//\r
+// A common header for usb standard descriptor.\r
+// Each stand descriptor has a length and type.\r
+//\r
+#pragma pack(1)\r
+typedef struct {\r
+ UINT8 Len;\r
+ UINT8 Type;\r
+} USB_DESC_HEAD;\r
+#pragma pack()\r
+\r
+\r
+//\r
+// Each USB device has a device descriptor. Each device may\r
+// have several configures. Each configure contains several\r
+// interfaces. Each interface may have several settings. Each\r
+// setting has several endpoints.\r
+//\r
+// EFI_USB_..._DESCRIPTOR must be the first member of the\r
+// structure.\r
+//\r
+typedef struct {\r
+ EFI_USB_ENDPOINT_DESCRIPTOR Desc;\r
+ UINT8 Toggle;\r
+} USB_ENDPOINT_DESC;\r
+\r
+typedef struct {\r
+ EFI_USB_INTERFACE_DESCRIPTOR Desc;\r
+ USB_ENDPOINT_DESC **Endpoints;\r
+} USB_INTERFACE_SETTING;\r
+\r
+//\r
+// An interface may have several settings. Use a\r
+// fixed max number of settings to simplify code.\r
+// It should sufice in most environments.\r
+//\r
+typedef struct {\r
+ USB_INTERFACE_SETTING* Settings[USB_MAX_INTERFACE_SETTING];\r
+ UINTN NumOfSetting;\r
+ UINT8 ActiveIndex; // Index of active setting\r
+} USB_INTERFACE_DESC;\r
+\r
+typedef struct {\r
+ EFI_USB_CONFIG_DESCRIPTOR Desc;\r
+ USB_INTERFACE_DESC **Interfaces;\r
+} USB_CONFIG_DESC;\r
+\r
+typedef struct {\r
+ EFI_USB_DEVICE_DESCRIPTOR Desc;\r
+ USB_CONFIG_DESC **Configs;\r
+} USB_DEVICE_DESC;\r
+\r
+EFI_STATUS\r
+UsbCtrlRequest (\r
+ IN USB_DEVICE *UsbDev,\r
+ IN EFI_USB_DATA_DIRECTION Direction,\r
+ IN UINTN Type,\r
+ IN UINTN Target,\r
+ IN UINTN Request,\r
+ IN UINT16 Value,\r
+ IN UINT16 Index,\r
+ IN OUT VOID *Buf,\r
+ IN UINTN Length\r
+ );\r
+\r
+EFI_STATUS\r
+UsbGetMaxPacketSize0 (\r
+ IN USB_DEVICE *UsbDev\r
+ );\r
+\r
+VOID\r
+UsbFreeDevDesc (\r
+ IN USB_DEVICE_DESC *DevDesc\r
+ );\r
+\r
+EFI_USB_STRING_DESCRIPTOR*\r
+UsbGetOneString (\r
+ IN USB_DEVICE *UsbDev,\r
+ IN UINT8 StringIndex,\r
+ IN UINT16 LangId\r
+ );\r
+\r
+EFI_STATUS\r
+UsbBuildDescTable (\r
+ IN USB_DEVICE *UsbDev\r
+ );\r
+\r
+EFI_STATUS\r
+UsbSetAddress (\r
+ IN USB_DEVICE *UsbDev,\r
+ IN UINT8 Address\r
+ );\r
+\r
+EFI_STATUS\r
+UsbSetConfig (\r
+ IN USB_DEVICE *UsbDev,\r
+ IN UINT8 ConfigIndex\r
+ );\r
+\r
+EFI_STATUS\r
+UsbIoClearFeature (\r
+ IN EFI_USB_IO_PROTOCOL *UsbIo,\r
+ IN UINTN Target,\r
+ IN UINT16 Feature,\r
+ IN UINT16 Index\r
+ );\r
+#endif\r