]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Bus/Usb/UsbBusDxe/UsbEnumer.h
Import Usb/UsbBusDxe and Usb/UsbMassStorageDxe into MdeModulePkg.
[mirror_edk2.git] / MdeModulePkg / Bus / Usb / UsbBusDxe / UsbEnumer.h
diff --git a/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbEnumer.h b/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbEnumer.h
new file mode 100644 (file)
index 0000000..e14b2d7
--- /dev/null
@@ -0,0 +1,153 @@
+/** @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
+    UsbEnumer.h\r
+\r
+  Abstract:\r
+\r
+    USB bus enumeration interface\r
+\r
+  Revision History\r
+\r
+\r
+**/\r
+\r
+#ifndef _USB_ENUMERATION_H_\r
+#define _USB_ENUMERATION_H_\r
+\r
+//\r
+// Advance the byte and bit to the next bit, adjust byte accordingly.\r
+//\r
+#define USB_NEXT_BIT(Byte, Bit)   \\r
+          do {                \\r
+            (Bit)++;          \\r
+            if ((Bit) > 7) {  \\r
+              (Byte)++;       \\r
+              (Bit) = 0;      \\r
+            }                 \\r
+          } while (0)\r
+\r
+\r
+//\r
+// Common interface used by usb bus enumeration process.\r
+// This interface is defined to mask the difference between\r
+// the root hub and normal hub. So, bus enumeration code\r
+// can be shared by both root hub and normal hub\r
+//\r
+typedef\r
+EFI_STATUS\r
+(*USB_HUB_INIT) (\r
+  IN USB_INTERFACE        *UsbIf\r
+  );\r
+\r
+//\r
+// Get the port status. This function is required to\r
+// ACK the port change bits although it will return\r
+// the port changes in PortState. Bus enumeration code\r
+// doesn't need to ACK the port change bits.\r
+//\r
+typedef\r
+EFI_STATUS\r
+(*USB_HUB_GET_PORT_STATUS) (\r
+  IN  USB_INTERFACE       *UsbIf,\r
+  IN  UINT8               Port,\r
+  OUT EFI_USB_PORT_STATUS *PortState\r
+  );\r
+\r
+typedef\r
+VOID\r
+(*USB_HUB_CLEAR_PORT_CHANGE) (\r
+  IN USB_INTERFACE        *HubIf,\r
+  IN UINT8                Port\r
+  );\r
+\r
+typedef\r
+EFI_STATUS\r
+(*USB_HUB_SET_PORT_FEATURE) (\r
+  IN USB_INTERFACE        *UsbIf,\r
+  IN UINT8                Port,\r
+  IN EFI_USB_PORT_FEATURE Feature\r
+  );\r
+\r
+typedef\r
+EFI_STATUS\r
+(*USB_HUB_CLEAR_PORT_FEATURE) (\r
+  IN USB_INTERFACE        *UsbIf,\r
+  IN UINT8                Port,\r
+  IN EFI_USB_PORT_FEATURE Feature\r
+  );\r
+\r
+typedef\r
+EFI_STATUS\r
+(*USB_HUB_RESET_PORT) (\r
+  IN USB_INTERFACE        *UsbIf,\r
+  IN UINT8                Port\r
+  );\r
+\r
+typedef\r
+EFI_STATUS\r
+(*USB_HUB_RELEASE) (\r
+  IN USB_INTERFACE        *UsbIf\r
+  );\r
+\r
+typedef struct _USB_HUB_API{\r
+  USB_HUB_INIT                Init;\r
+  USB_HUB_GET_PORT_STATUS     GetPortStatus;\r
+  USB_HUB_CLEAR_PORT_CHANGE   ClearPortChange;\r
+  USB_HUB_SET_PORT_FEATURE    SetPortFeature;\r
+  USB_HUB_CLEAR_PORT_FEATURE  ClearPortFeature;\r
+  USB_HUB_RESET_PORT          ResetPort;\r
+  USB_HUB_RELEASE             Release;\r
+} USB_HUB_API;\r
+\r
+USB_ENDPOINT_DESC*\r
+UsbGetEndpointDesc (\r
+  IN USB_INTERFACE        *UsbIf,\r
+  IN UINT8                EpAddr\r
+  );\r
+\r
+\r
+EFI_STATUS\r
+UsbSelectSetting (\r
+  IN USB_INTERFACE_DESC   *IfDesc,\r
+  IN UINT8                Alternate\r
+  );\r
+\r
+EFI_STATUS\r
+UsbSelectConfig (\r
+  IN USB_DEVICE           *Device,\r
+  IN UINT8                ConfigIndex\r
+  );\r
+\r
+VOID\r
+UsbRemoveConfig (\r
+  IN USB_DEVICE           *Device\r
+  );\r
+\r
+EFI_STATUS\r
+UsbRemoveDevice (\r
+  IN USB_DEVICE           *Device\r
+  );\r
+\r
+VOID\r
+UsbHubEnumeration (\r
+  IN EFI_EVENT            Event,\r
+  IN VOID                 *Context\r
+  );\r
+\r
+VOID\r
+UsbRootHubEnumeration (\r
+  IN EFI_EVENT            Event,\r
+  IN VOID                 *Context\r
+  );\r
+#endif\r