]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Bus/Usb/UsbBusDxe/UsbEnumer.h
MdeModulePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdeModulePkg / Bus / Usb / UsbBusDxe / UsbEnumer.h
CommitLineData
e237e7ae 1/** @file\r
2\r
8616fc4c 3 USB bus enumeration interface.\r
4\r
cd5ebaa0 5Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>\r
9d510e61 6SPDX-License-Identifier: BSD-2-Clause-Patent\r
e237e7ae 7\r
e237e7ae 8**/\r
9\r
10#ifndef _USB_ENUMERATION_H_\r
11#define _USB_ENUMERATION_H_\r
12\r
13//\r
14// Advance the byte and bit to the next bit, adjust byte accordingly.\r
15//\r
16#define USB_NEXT_BIT(Byte, Bit) \\r
17 do { \\r
18 (Bit)++; \\r
19 if ((Bit) > 7) { \\r
20 (Byte)++; \\r
21 (Bit) = 0; \\r
22 } \\r
23 } while (0)\r
24\r
25\r
26//\r
27// Common interface used by usb bus enumeration process.\r
28// This interface is defined to mask the difference between\r
29// the root hub and normal hub. So, bus enumeration code\r
30// can be shared by both root hub and normal hub\r
31//\r
32typedef\r
33EFI_STATUS\r
34(*USB_HUB_INIT) (\r
35 IN USB_INTERFACE *UsbIf\r
36 );\r
37\r
38//\r
39// Get the port status. This function is required to\r
40// ACK the port change bits although it will return\r
41// the port changes in PortState. Bus enumeration code\r
42// doesn't need to ACK the port change bits.\r
43//\r
44typedef\r
45EFI_STATUS\r
46(*USB_HUB_GET_PORT_STATUS) (\r
47 IN USB_INTERFACE *UsbIf,\r
48 IN UINT8 Port,\r
49 OUT EFI_USB_PORT_STATUS *PortState\r
50 );\r
51\r
52typedef\r
53VOID\r
54(*USB_HUB_CLEAR_PORT_CHANGE) (\r
55 IN USB_INTERFACE *HubIf,\r
56 IN UINT8 Port\r
57 );\r
58\r
59typedef\r
60EFI_STATUS\r
61(*USB_HUB_SET_PORT_FEATURE) (\r
62 IN USB_INTERFACE *UsbIf,\r
63 IN UINT8 Port,\r
64 IN EFI_USB_PORT_FEATURE Feature\r
65 );\r
66\r
67typedef\r
68EFI_STATUS\r
69(*USB_HUB_CLEAR_PORT_FEATURE) (\r
70 IN USB_INTERFACE *UsbIf,\r
71 IN UINT8 Port,\r
72 IN EFI_USB_PORT_FEATURE Feature\r
73 );\r
74\r
75typedef\r
76EFI_STATUS\r
77(*USB_HUB_RESET_PORT) (\r
78 IN USB_INTERFACE *UsbIf,\r
79 IN UINT8 Port\r
80 );\r
81\r
82typedef\r
83EFI_STATUS\r
84(*USB_HUB_RELEASE) (\r
85 IN USB_INTERFACE *UsbIf\r
86 );\r
87\r
8616fc4c 88/**\r
89 Return the endpoint descriptor in this interface.\r
90\r
91 @param UsbIf The interface to search in.\r
92 @param EpAddr The address of the endpoint to return.\r
93\r
94 @return The endpoint descriptor or NULL.\r
95\r
96**/\r
e237e7ae 97USB_ENDPOINT_DESC*\r
98UsbGetEndpointDesc (\r
99 IN USB_INTERFACE *UsbIf,\r
100 IN UINT8 EpAddr\r
101 );\r
102\r
8616fc4c 103/**\r
104 Select an alternate setting for the interface.\r
105 Each interface can have several mutually exclusive\r
106 settings. Only one setting is active. It will\r
107 also reset its endpoints' toggle to zero.\r
108\r
109 @param IfDesc The interface descriptor to set.\r
110 @param Alternate The alternate setting number to locate.\r
111\r
112 @retval EFI_NOT_FOUND There is no setting with this alternate index.\r
113 @retval EFI_SUCCESS The interface is set to Alternate setting.\r
e237e7ae 114\r
8616fc4c 115**/\r
e237e7ae 116EFI_STATUS\r
117UsbSelectSetting (\r
118 IN USB_INTERFACE_DESC *IfDesc,\r
119 IN UINT8 Alternate\r
120 );\r
121\r
8616fc4c 122/**\r
123 Select a new configuration for the device. Each\r
124 device may support several configurations.\r
125\r
126 @param Device The device to select configuration.\r
127 @param ConfigIndex The index of the configuration ( != 0).\r
128\r
129 @retval EFI_NOT_FOUND There is no configuration with the index.\r
130 @retval EFI_OUT_OF_RESOURCES Failed to allocate resource.\r
131 @retval EFI_SUCCESS The configuration is selected.\r
132\r
133**/\r
e237e7ae 134EFI_STATUS\r
135UsbSelectConfig (\r
136 IN USB_DEVICE *Device,\r
137 IN UINT8 ConfigIndex\r
138 );\r
139\r
8616fc4c 140/**\r
141 Remove the current device configuration.\r
142\r
143 @param Device The USB device to remove configuration from.\r
144\r
145 @return None.\r
146\r
147**/\r
127884c5 148EFI_STATUS\r
e237e7ae 149UsbRemoveConfig (\r
150 IN USB_DEVICE *Device\r
151 );\r
152\r
8616fc4c 153/**\r
154 Remove the device and all its children from the bus.\r
155\r
156 @param Device The device to remove.\r
157\r
158 @retval EFI_SUCCESS The device is removed.\r
159\r
160**/\r
e237e7ae 161EFI_STATUS\r
162UsbRemoveDevice (\r
163 IN USB_DEVICE *Device\r
164 );\r
165\r
8616fc4c 166/**\r
167 Enumerate all the changed hub ports.\r
168\r
169 @param Event The event that is triggered.\r
170 @param Context The context to the event.\r
171\r
172 @return None.\r
173\r
174**/\r
e237e7ae 175VOID\r
ecb575d9 176EFIAPI\r
e237e7ae 177UsbHubEnumeration (\r
178 IN EFI_EVENT Event,\r
179 IN VOID *Context\r
180 );\r
181\r
8616fc4c 182/**\r
183 Enumerate all the changed hub ports.\r
184\r
185 @param Event The event that is triggered.\r
186 @param Context The context to the event.\r
187\r
188 @return None.\r
189\r
190**/\r
e237e7ae 191VOID\r
eb1f5ab3 192EFIAPI\r
e237e7ae 193UsbRootHubEnumeration (\r
194 IN EFI_EVENT Event,\r
195 IN VOID *Context\r
196 );\r
197#endif\r