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