Root/
Source at commit 1129 created 12 years 11 months ago. By meklort, Change options.o so that it reloads the system config as well. Also change it so that it uses that config for variables (NOTE: if the calue exists in chameleonConfig, it's used instead. | |
---|---|
1 | /*␊ |
2 | * Copyright (c) 1998-2006 Apple Computer, Inc. All rights reserved.␊ |
3 | *␊ |
4 | * @APPLE_LICENSE_HEADER_START@␊ |
5 | * ␊ |
6 | * This file contains Original Code and/or Modifications of Original Code␊ |
7 | * as defined in and that are subject to the Apple Public Source License␊ |
8 | * Version 2.0 (the 'License'). You may not use this file except in␊ |
9 | * compliance with the License. Please obtain a copy of the License at␊ |
10 | * http://www.opensource.apple.com/apsl/ and read it before using this␊ |
11 | * file.␊ |
12 | * ␊ |
13 | * The Original Code and all software distributed under the License are␊ |
14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER␊ |
15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,␊ |
16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,␊ |
17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.␊ |
18 | * Please see the License for the specific language governing rights and␊ |
19 | * limitations under the License.␊ |
20 | * ␊ |
21 | * @APPLE_LICENSE_HEADER_END@␊ |
22 | */␊ |
23 | ␊ |
24 | #ifndef _USBHUB_H␊ |
25 | #define _USBHUB_H␊ |
26 | ␊ |
27 | #include <IOKit/usb/USB.h>␊ |
28 | #include <IOKit/usb/USBSpec.h>␊ |
29 | ␊ |
30 | /*!␊ |
31 | @header USBHub.h␊ |
32 | @abstract Constants and definitions used with Hub devices.␊ |
33 | @discussion ␊ |
34 | */␊ |
35 | ␊ |
36 | /*!␊ |
37 | @enum Hub Descriptor Type␊ |
38 | @discussion␊ |
39 | */␊ |
40 | enum {␊ |
41 | kUSBHubDescriptorType = 0x29␊ |
42 | };␊ |
43 | ␊ |
44 | /*!␊ |
45 | @enum HubFeatures␊ |
46 | @discussion Used with SET_FEATURE to set hub and port features␊ |
47 | */␊ |
48 | enum {␊ |
49 | ␊ |
50 | kUSBHubLocalPowerChangeFeature = 0, /* Hub features */␊ |
51 | kUSBHubOverCurrentChangeFeature = 1,␊ |
52 | ␊ |
53 | kUSBHubPortConnectionFeature = 0, /* port features */␊ |
54 | kUSBHubPortEnableFeature = 1,␊ |
55 | kUSBHubPortSuspendFeature = 2,␊ |
56 | kUSBHubPortOverCurrentFeature = 3,␊ |
57 | kUSBHubPortResetFeature = 4,␊ |
58 | kUSBHubPortPowerFeature = 8,␊ |
59 | kUSBHubPortLowSpeedFeature = 9,␊ |
60 | kUSBHubPortConnectionChangeFeature = 16,␊ |
61 | kUSBHubPortEnableChangeFeature = 17,␊ |
62 | kUSBHubPortSuspendChangeFeature = 18,␊ |
63 | kUSBHubPortOverCurrentChangeFeature = 19,␊ |
64 | kUSBHubPortResetChangeFeature = 20,␊ |
65 | kUSBHubPortTestFeature␉␉␉␉= 21,␊ |
66 | ␉kUSBHubPortIndicatorFeature␉␉␉= 22␊ |
67 | };␊ |
68 | ␊ |
69 | /*!␊ |
70 | @enum HubPortStatus␊ |
71 | @discussion Used to decode the Port Status and Change ␊ |
72 | */␊ |
73 | enum {␊ |
74 | kHubPortConnection␉␉= 0x0001,␊ |
75 | kHubPortEnabled␉␉␉= 0x0002,␊ |
76 | kHubPortSuspend␉␉␉= 0x0004,␊ |
77 | kHubPortOverCurrent␉␉= 0x0008,␊ |
78 | kHubPortBeingReset␉␉= 0x0010,␊ |
79 | kHubPortPower␉␉␉= 0x0100,␊ |
80 | kHubPortLowSpeed␉␉= 0x0200,␊ |
81 | kHubPortHighSpeed␉␉= 0x0400,␊ |
82 | kHubPortTestMode␉␉= 0x0800,␊ |
83 | kHubPortIndicator␉␉= 0x1000,␊ |
84 | ␊ |
85 | // these are the bits which cause the hub port state machine to keep moving␊ |
86 | kHubPortStateChangeMask␉␉= kHubPortConnection | kHubPortEnabled | kHubPortSuspend | kHubPortOverCurrent | kHubPortBeingReset␊ |
87 | };␊ |
88 | ␊ |
89 | ␊ |
90 | /*!␊ |
91 | @enum HubStatus␊ |
92 | @discussion Used to decode the Hub Status and Change ␊ |
93 | */␊ |
94 | enum {␊ |
95 | kHubLocalPowerStatus = 1,␊ |
96 | kHubOverCurrentIndicator = 2,␊ |
97 | kHubLocalPowerStatusChange = 1,␊ |
98 | kHubOverCurrentIndicatorChange = 2␊ |
99 | };␊ |
100 | ␊ |
101 | /*!␊ |
102 | @enum HubCharacteristics␊ |
103 | @discussion ␊ |
104 | */␊ |
105 | enum {␊ |
106 | kPerPortSwitchingBit = (1 << 0),␊ |
107 | kNoPowerSwitchingBit = (1 << 1),␊ |
108 | kCompoundDeviceBit = (1 << 2),␊ |
109 | kPerPortOverCurrentBit = (1 << 3),␊ |
110 | kNoOverCurrentBit = (1 << 4),␊ |
111 | ␉␊ |
112 | ␉kHubPortIndicatorBit␉= 7,␊ |
113 | ␉kHubPortIndicatorMask␉= 0x0080␊ |
114 | };␊ |
115 | ␊ |
116 | /*!␊ |
117 | @enum PowerSwitching␊ |
118 | @discussion ␊ |
119 | */␊ |
120 | enum {␊ |
121 | ␉kHubSupportsGangPower␉= 0,␊ |
122 | ␉kHubSupportsIndividualPortPower = 1,␊ |
123 | ␉kHubPortSetPowerOff␉␉= 0,␊ |
124 | ␉kHubPortSetPowerOn␉␉= 1␊ |
125 | };␊ |
126 | ␊ |
127 | /*!␊ |
128 | @enum PortIndicatorSelectors␊ |
129 | @discussion ␊ |
130 | */␊ |
131 | enum {␊ |
132 | ␉kHubPortIndicatorAutomatic␉= 0,␊ |
133 | ␉kHubPortIndicatorAmber,␊ |
134 | ␉kHubPortIndicatorGreen,␊ |
135 | ␉kHubPortIndicatorOff␊ |
136 | };␊ |
137 | ␊ |
138 | /*!␊ |
139 | @enum Root Hub specific ␊ |
140 | @discussion ␊ |
141 | */␊ |
142 | enum {␊ |
143 | ␉kPrdRootHubApple␉␉␉= 0x8005,␉// ProductID for classic speed root hubs␊ |
144 | ␉kPrdRootHubAppleE␉␉␉= 0x8006,␉// ProductID for high speed root hubs␊ |
145 | ␉kUSBRootHubPollingRate␉␉= 32␉␉// Enpoint polling rate interval for root hubs␊ |
146 | };␊ |
147 | ␊ |
148 | /*!␊ |
149 | @enum Hub Device Requests␊ |
150 | @discussion Encoding of the hub specific standard requests␊ |
151 | <tt>␊ |
152 | <pre><b>␊ |
153 | Request bmRequestType bRequest wValue wIndex wLength Data</b>␊ |
154 | ClearHubFeature 0010 0000B CLEAR_FEATURE Feature Zero Zero None␊ |
155 | ClearPortFeature 0010 0011B Feature Port Zero None␊ |
156 | ␊ |
157 | GetBusState 1010 0011B GET_STATE Zero Port One Port Bus State␊ |
158 | ␊ |
159 | GetHubDescriptor 1010 0000B GET_DESCRIPTOR Type Zero Length Descriptor␊ |
160 | ␊ |
161 | GetHubStatus 1010 0000B GET_STATUS Zero Zero Four Hub Status␊ |
162 | GetPortStatus 1010 0011B Zero Port Four Port Status␊ |
163 | ␊ |
164 | SetHubDescriptor 0010 0000B SET_DESCRIPTOR Type Zero Length Descriptor␊ |
165 | ␊ |
166 | SetHubFeature 0010 0000B SET_FEATURE Feature Zero Zero None␊ |
167 | SetPortFeature 0010 0011B Feature Port Zero None␊ |
168 | </pre>␊ |
169 | </tt>␊ |
170 | */␊ |
171 | enum {␊ |
172 | kClearHubFeature = EncodeRequest(kUSBRqClearFeature, kUSBOut, kUSBClass, kUSBDevice),␊ |
173 | kClearPortFeature = EncodeRequest(kUSBRqClearFeature, kUSBOut, kUSBClass, kUSBOther),␊ |
174 | kGetPortState = EncodeRequest(kUSBRqGetState, kUSBIn, kUSBClass, kUSBOther),␊ |
175 | kGetHubDescriptor = EncodeRequest(kUSBRqGetDescriptor, kUSBIn, kUSBClass, kUSBDevice),␊ |
176 | kGetHubStatus = EncodeRequest(kUSBRqGetStatus, kUSBIn, kUSBClass, kUSBDevice),␊ |
177 | kGetPortStatus = EncodeRequest(kUSBRqGetStatus, kUSBIn, kUSBClass, kUSBOther),␊ |
178 | kSetHubDescriptor = EncodeRequest(kUSBRqGetDescriptor, kUSBOut, kUSBClass, kUSBDevice),␊ |
179 | kSetHubFeature = EncodeRequest(kUSBRqSetFeature, kUSBOut, kUSBClass, kUSBDevice),␊ |
180 | kSetPortFeature = EncodeRequest(kUSBRqSetFeature, kUSBOut, kUSBClass, kUSBOther)␊ |
181 | };␊ |
182 | ␊ |
183 | ␊ |
184 | /*!␊ |
185 | @typedef IOUSBHubDescriptor␊ |
186 | @discussion USB Hub Descriptor. See the USB HID Specification at <a href="http://www.usb.org"TARGET="_blank">http://www.usb.org</a>.␊ |
187 | */␊ |
188 | struct IOUSBHubDescriptor {␊ |
189 | UInt8 length;␊ |
190 | UInt8 hubType;␊ |
191 | UInt8 numPorts;␊ |
192 | UInt16 characteristics __attribute__((packed));␊ |
193 | UInt8 powerOnToGood; /* Port settling time, in 2ms */␊ |
194 | UInt8 hubCurrent;␊ |
195 | /* These are received packed, will have to be unpacked */␊ |
196 | UInt8 removablePortFlags[8];␊ |
197 | UInt8 pwrCtlPortFlags[8];␊ |
198 | };␊ |
199 | ␊ |
200 | typedef struct IOUSBHubDescriptor IOUSBHubDescriptor;␊ |
201 | ␊ |
202 | /*!␊ |
203 | @typedef IOUSBHubStatus␊ |
204 | @discussion Used to get the port status and change flags using GetPortStatus()␊ |
205 | */␊ |
206 | struct IOUSBHubStatus {␊ |
207 | UInt16 statusFlags;␊ |
208 | UInt16 changeFlags;␊ |
209 | };␊ |
210 | typedef struct IOUSBHubStatus IOUSBHubStatus;␊ |
211 | typedef IOUSBHubStatus * IOUSBHubStatusPtr;␊ |
212 | ␊ |
213 | typedef struct IOUSBHubStatus IOUSBHubPortStatus;␊ |
214 | ␊ |
215 | ␊ |
216 | /*!␊ |
217 | @typedef IOUSBHubPortReEnumerateParam␊ |
218 | @discussion Used to specify the port that needs to be reenumerated␊ |
219 | */␊ |
220 | typedef struct IOUSBHubPortReEnumerateParam IOUSBHubPortReEnumerateParam;␊ |
221 | ␊ |
222 | struct IOUSBHubPortReEnumerateParam {␊ |
223 | UInt32 portNumber;␊ |
224 | UInt32 options;␊ |
225 | };␊ |
226 | ␊ |
227 | typedef struct IOUSBHubPortClearTTParam IOUSBHubPortClearTTParam;␊ |
228 | ␊ |
229 | struct IOUSBHubPortClearTTParam {␊ |
230 | UInt32␉ portNumber;␊ |
231 | UInt32␉ options;␊ |
232 | #if 0␊ |
233 | UInt8 ␉ deviceAddress; <<0␊ |
234 | ␉UInt8␉ endpointNum; <<8␊ |
235 | ␉UInt8 ␉ endpointType;␉ <<16 // As split transaction. 00 Control, 10 Bulk␊ |
236 | ␉UInt8 ␉ IN;␉␉ <<24 // Direction, 1 = IN, 0 = OUT␊ |
237 | #endif␊ |
238 | };␊ |
239 | ␊ |
240 | #endif /* _USBHUB_H */␊ |
241 |