]>
Commit | Line | Data |
---|---|---|
e237e7ae | 1 | /** @file\r |
2 | \r | |
8616fc4c | 3 | USB bus enumeration interface.\r |
4 | \r | |
e237e7ae | 5 | Copyright (c) 2007, Intel Corporation\r |
6 | All rights reserved. This program and the accompanying materials\r | |
7 | are licensed and made available under the terms and conditions of the BSD License\r | |
8 | which accompanies this distribution. The full text of the license may be found at\r | |
9 | http://opensource.org/licenses/bsd-license.php\r | |
10 | \r | |
11 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
12 | WITHOUT 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 | |
38 | typedef\r | |
39 | EFI_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 | |
50 | typedef\r | |
51 | EFI_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 | |
58 | typedef\r | |
59 | VOID\r | |
60 | (*USB_HUB_CLEAR_PORT_CHANGE) (\r | |
61 | IN USB_INTERFACE *HubIf,\r | |
62 | IN UINT8 Port\r | |
63 | );\r | |
64 | \r | |
65 | typedef\r | |
66 | EFI_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 | |
73 | typedef\r | |
74 | EFI_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 | |
81 | typedef\r | |
82 | EFI_STATUS\r | |
83 | (*USB_HUB_RESET_PORT) (\r | |
84 | IN USB_INTERFACE *UsbIf,\r | |
85 | IN UINT8 Port\r | |
86 | );\r | |
87 | \r | |
88 | typedef\r | |
89 | EFI_STATUS\r | |
90 | (*USB_HUB_RELEASE) (\r | |
91 | IN USB_INTERFACE *UsbIf\r | |
92 | );\r | |
93 | \r | |
c52fa98c | 94 | struct _USB_HUB_API{\r |
e237e7ae | 95 | USB_HUB_INIT Init;\r |
96 | USB_HUB_GET_PORT_STATUS GetPortStatus;\r | |
97 | USB_HUB_CLEAR_PORT_CHANGE ClearPortChange;\r | |
98 | USB_HUB_SET_PORT_FEATURE SetPortFeature;\r | |
99 | USB_HUB_CLEAR_PORT_FEATURE ClearPortFeature;\r | |
100 | USB_HUB_RESET_PORT ResetPort;\r | |
101 | USB_HUB_RELEASE Release;\r | |
c52fa98c | 102 | };\r |
e237e7ae | 103 | \r |
8616fc4c | 104 | /**\r |
105 | Return the endpoint descriptor in this interface.\r | |
106 | \r | |
107 | @param UsbIf The interface to search in.\r | |
108 | @param EpAddr The address of the endpoint to return.\r | |
109 | \r | |
110 | @return The endpoint descriptor or NULL.\r | |
111 | \r | |
112 | **/\r | |
e237e7ae | 113 | USB_ENDPOINT_DESC*\r |
114 | UsbGetEndpointDesc (\r | |
115 | IN USB_INTERFACE *UsbIf,\r | |
116 | IN UINT8 EpAddr\r | |
117 | );\r | |
118 | \r | |
8616fc4c | 119 | /**\r |
120 | Select an alternate setting for the interface.\r | |
121 | Each interface can have several mutually exclusive\r | |
122 | settings. Only one setting is active. It will\r | |
123 | also reset its endpoints' toggle to zero.\r | |
124 | \r | |
125 | @param IfDesc The interface descriptor to set.\r | |
126 | @param Alternate The alternate setting number to locate.\r | |
127 | \r | |
128 | @retval EFI_NOT_FOUND There is no setting with this alternate index.\r | |
129 | @retval EFI_SUCCESS The interface is set to Alternate setting.\r | |
e237e7ae | 130 | \r |
8616fc4c | 131 | **/\r |
e237e7ae | 132 | EFI_STATUS\r |
133 | UsbSelectSetting (\r | |
134 | IN USB_INTERFACE_DESC *IfDesc,\r | |
135 | IN UINT8 Alternate\r | |
136 | );\r | |
137 | \r | |
8616fc4c | 138 | /**\r |
139 | Select a new configuration for the device. Each\r | |
140 | device may support several configurations.\r | |
141 | \r | |
142 | @param Device The device to select configuration.\r | |
143 | @param ConfigIndex The index of the configuration ( != 0).\r | |
144 | \r | |
145 | @retval EFI_NOT_FOUND There is no configuration with the index.\r | |
146 | @retval EFI_OUT_OF_RESOURCES Failed to allocate resource.\r | |
147 | @retval EFI_SUCCESS The configuration is selected.\r | |
148 | \r | |
149 | **/\r | |
e237e7ae | 150 | EFI_STATUS\r |
151 | UsbSelectConfig (\r | |
152 | IN USB_DEVICE *Device,\r | |
153 | IN UINT8 ConfigIndex\r | |
154 | );\r | |
155 | \r | |
8616fc4c | 156 | /**\r |
157 | Remove the current device configuration.\r | |
158 | \r | |
159 | @param Device The USB device to remove configuration from.\r | |
160 | \r | |
161 | @return None.\r | |
162 | \r | |
163 | **/\r | |
e237e7ae | 164 | VOID\r |
165 | UsbRemoveConfig (\r | |
166 | IN USB_DEVICE *Device\r | |
167 | );\r | |
168 | \r | |
8616fc4c | 169 | /**\r |
170 | Remove the device and all its children from the bus.\r | |
171 | \r | |
172 | @param Device The device to remove.\r | |
173 | \r | |
174 | @retval EFI_SUCCESS The device is removed.\r | |
175 | \r | |
176 | **/\r | |
e237e7ae | 177 | EFI_STATUS\r |
178 | UsbRemoveDevice (\r | |
179 | IN USB_DEVICE *Device\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 | 191 | VOID\r |
ecb575d9 | 192 | EFIAPI\r |
e237e7ae | 193 | UsbHubEnumeration (\r |
194 | IN EFI_EVENT Event,\r | |
195 | IN VOID *Context\r | |
196 | );\r | |
197 | \r | |
8616fc4c | 198 | /**\r |
199 | Enumerate all the changed hub ports.\r | |
200 | \r | |
201 | @param Event The event that is triggered.\r | |
202 | @param Context The context to the event.\r | |
203 | \r | |
204 | @return None.\r | |
205 | \r | |
206 | **/\r | |
e237e7ae | 207 | VOID\r |
eb1f5ab3 | 208 | EFIAPI\r |
e237e7ae | 209 | UsbRootHubEnumeration (\r |
210 | IN EFI_EVENT Event,\r | |
211 | IN VOID *Context\r | |
212 | );\r | |
213 | #endif\r |