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