Chameleon

Chameleon Svn Source Tree

Root/branches/Chimera/i386/include/IOKit/usb/USB.h

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 _USB_H
25#define _USB_H
26
27#if KERNEL
28#include <libkern/OSByteOrder.h>
29#include <IOKit/IOMemoryDescriptor.h>
30#else
31#include <libkern/OSByteOrder.h>
32#endif
33
34#include <IOKit/IOTypes.h>
35
36#if !defined(__USB__)
37# include <IOKit/usb/USBSpec.h>
38#endif
39
40#ifdef __cplusplus
41extern "C" {
42#endif
43
44 /*!
45 @headerUSB.h
46 @abstractPublic Interfaces to the USB implementation in Mac OS X.
47 @discussionThis header file contains definitions and structures that are used in the different USB API's in Mac OS X, both in the kernel and in the user space.
48 */
49
50 /*!
51 @definedEndian conversion definitions
52 @discussion The USB API's use a convention of specifying parameters in the host order. The USB spec specifies that multi-byte items should be
53 formatted in little endian order. The following macros allow one to translate multi-byte values from Host order to USB order and vice versa. There are separate macros for
54 in-kernel use and for user space use.
55 */
56#define USBToHostWord OSSwapLittleToHostInt16
57#define HostToUSBWord OSSwapHostToLittleInt16
58#define USBToHostLong OSSwapLittleToHostInt32
59#define HostToUSBLong OSSwapHostToLittleInt32
60
61 /*!
62 @enum Miscellaneous Constants
63 @discussion
64 */
65 enum {
66 kUSBDeviceIDShift = 7,
67 kUSBMaxDevices = 128,
68 kUSBMaxDevice = kUSBMaxDevices-1,
69 kUSBDeviceIDMask = 0x7f,
70
71 kUSBPipeIDMask = 0xf,
72 kUSBMaxPipes = 32,// In and Out pipes can have same pipe number.
73
74 kUSBInterfaceIDShift = 8,
75 kUSBMaxInterfaces = 1 << kUSBInterfaceIDShift,
76 kUSBInterfaceIDMask = kUSBMaxInterfaces-1,
77
78 kUSBEndPtShift = 7,
79 kUSBDeviceMask = ((1 << kUSBEndPtShift) -1),
80
81 kUSBNoPipeIdx = -1
82};
83
84/*!
85@enum bRequest Shifts and Masks
86@discussion These are used to create the macro to encode the bRequest filed of a Device Request
87*/
88enum {
89 kUSBRqDirnShift = 7,
90 kUSBRqDirnMask = 1,
91
92 kUSBRqTypeShift = 5,
93 kUSBRqTypeMask = 3,
94
95 kUSBRqRecipientMask = 0X1F
96};
97
98/*!
99@defined USBmakebmRequestType
100@discussion Macro to encode the bRequest field of a Device Request. It is used when constructing an IOUSBDevRequest.
101*/
102#define USBmakebmRequestType(direction, type, recipient)\
103 ((direction & kUSBRqDirnMask) << kUSBRqDirnShift) |\
104 ((type & kUSBRqTypeMask) << kUSBRqTypeShift) |\
105 (recipient & kUSBRqRecipientMask)
106
107/*!
108@enum kUSBMaxIsocFrameReqCount
109@discussion Maximum size in bytes allowed for one Isochronous frame
110*/
111enum {
112 kUSBMaxFSIsocEndpointReqCount = 1023,// max size (bytes) of any one Isoc frame for 1 FS endpoint
113kUSBMaxHSIsocEndpointReqCount = 3072,// max size (bytes) of any one Isoc frame for 1 HS endpoint
114kUSBMaxHSIsocFrameCount = 7168// max size (bytes) of all Isoc transfers in a HS frame
115};
116
117/*!
118@defined EncodeRequest
119@discussion Macro that encodes the bRequest and bRequestType fields of a IOUSBDevRequest into a single value. It is useful when one needs
120to know what type of request the IOUSBDevRequest encodes and simplifies comparisons.
121*/
122#define EncodeRequest(request, direction, type, recipient)\
123 (((UInt16)request << 8) + \
124 ((UInt16)recipient +\
125 ((UInt16)type << kUSBRqTypeShift) +\
126 ((UInt16)direction << kUSBRqDirnShift)))
127
128
129/*!
130@enum Standard Device Requests
131@discussion Encoding of the standard device requests.
132<tt>
133<pre><b>
134bmRequestType bRequest wValue wIndex wLength Data</b>
13500000000B CLEAR_FEATURE Feature Zero Zero None (device)
13600000001B Feature Interface Zero None (Interface)
13700000010B Feature Endpoint Zero None (Endpoint)
138
13910000000B GET_CONFIGURATION Zero Zero One Configuration
14010000000B GET_DESCRIPTOR Type LangID Length Descriptor
14110000001B GET_INTERFACE Zero Interface One Alternate
142
14310000000B GET_STATUS Zero Zero Two status (device)
14410000001B Zero Interface Two status (Interface)
14510000010B Zero Endpoint Two status (Endpoint)
146
14700000000B SET_ADDRESS Address Zero Zero None
14800000000B SET_CONFIGURATION Configuration Zero Zero None
14900000000B SET_DESCRIPTOR Type LangID Length Descriptor
150
15100000000B SET_FEATURE Feature Zero Zero None (device)
15200000001B Feature Interface Zero None (Interface)
15300000010B Feature Endpoint Zero None (Endpoint)
154
15500000001B SET_INTERFACE Alternate Interface Zero None
15610000010B SYNCH_FRAME Zero Endpoint Two Frame Number
157</pre>
158</tt>
159*/
160enum {
161 kClearDeviceFeature = EncodeRequest(kUSBRqClearFeature, kUSBOut, kUSBStandard, kUSBDevice),
162 kClearInterfaceFeature = EncodeRequest(kUSBRqClearFeature, kUSBOut, kUSBStandard, kUSBInterface),
163 kClearEndpointFeature = EncodeRequest(kUSBRqClearFeature, kUSBOut, kUSBStandard, kUSBEndpoint),
164 kGetConfiguration = EncodeRequest(kUSBRqGetConfig, kUSBIn, kUSBStandard, kUSBDevice),
165 kGetDescriptor = EncodeRequest(kUSBRqGetDescriptor, kUSBIn, kUSBStandard, kUSBDevice),
166 kGetInterface = EncodeRequest(kUSBRqGetInterface, kUSBIn, kUSBStandard, kUSBInterface),
167 kGetDeviceStatus = EncodeRequest(kUSBRqGetStatus, kUSBIn, kUSBStandard, kUSBDevice),
168 kGetInterfaceStatus = EncodeRequest(kUSBRqGetStatus, kUSBIn, kUSBStandard, kUSBInterface),
169 kGetEndpointStatus = EncodeRequest(kUSBRqGetStatus, kUSBIn, kUSBStandard, kUSBEndpoint),
170 kSetAddress = EncodeRequest(kUSBRqSetAddress, kUSBOut, kUSBStandard, kUSBDevice),
171 kSetConfiguration = EncodeRequest(kUSBRqSetConfig, kUSBOut, kUSBStandard, kUSBDevice),
172 kSetDescriptor = EncodeRequest(kUSBRqSetDescriptor, kUSBOut, kUSBStandard, kUSBDevice),
173 kSetDeviceFeature = EncodeRequest(kUSBRqSetFeature, kUSBOut, kUSBStandard, kUSBDevice),
174 kSetInterfaceFeature = EncodeRequest(kUSBRqSetFeature, kUSBOut, kUSBStandard, kUSBInterface),
175 kSetEndpointFeature = EncodeRequest(kUSBRqSetFeature, kUSBOut, kUSBStandard, kUSBEndpoint),
176 kSetInterface = EncodeRequest(kUSBRqSetInterface, kUSBOut, kUSBStandard, kUSBInterface),
177 kSyncFrame = EncodeRequest(kUSBRqSyncFrame, kUSBIn, kUSBStandard, kUSBEndpoint),
178};
179
180/*!
181@defined kCallInterfaceOpenWithGate
182 @discussion If the USB Device has this property, drivers for any of its interfaces will have their handleOpen method called while holding the workloop gate.
183 */
184#define kCallInterfaceOpenWithGate"kCallInterfaceOpenWithGate"
185
186// TYPES
187
188typedef UInt16 USBDeviceAddress;
189
190typedef uint32_t USBPhysicalAddress32;
191
192/*!
193 @typedef IOUSBIsocFrame
194 @discussion Structure used to encode information about each isoc frame.
195 @param frStatus Returns status associated with the frame.
196 @param frReqCount Input specifiying how many bytes to read or write.
197 @param frActCount Actual # of bytes transferred.
198*/
199typedef struct IOUSBIsocFrame {
200 IOReturn frStatus;
201 UInt16 frReqCount;
202 UInt16 frActCount;
203} IOUSBIsocFrame;
204
205
206/*!
207 @typedef IOUSBLowLatencyIsocFrame
208 @discussion Structure used to encode information about each isoc frame that is processed
209 at hardware interrupt time (low latency).
210 @param frStatus Returns status associated with the frame.
211 @param frReqCount Input specifiying how many bytes to read or write.
212 @param frActCount Actual # of bytes transferred.
213 @param frTimeStamp Time stamp that indicates time when frame was procesed.
214*/
215struct IOUSBLowLatencyIsocFrame {
216 IOReturn frStatus;
217 UInt16 frReqCount;
218 UInt16 frActCount;
219 AbsoluteTime frTimeStamp;
220};
221typedef struct IOUSBLowLatencyIsocFrame IOUSBLowLatencyIsocFrame;
222
223/*!
224@typedef IOUSBCompletionAction
225 @discussion Function called when USB I/O completes.
226 @param target The target specified in the IOUSBCompletion struct.
227 @param parameter The parameter specified in the IOUSBCompletion struct.
228 @param status Completion status.
229 @param bufferSizeRemaining Bytes left to be transferred.
230 */
231typedef void (*IOUSBCompletionAction)(
232 void *target,
233 void *parameter,
234 IOReturnstatus,
235 UInt32bufferSizeRemaining);
236
237/*!
238@typedef IOUSBCompletionActionWithTimeStamp
239 @discussion Function called when USB I/O completes.
240 @param target The target specified in the IOUSBCompletion struct.
241 @param parameter The parameter specified in the IOUSBCompletion struct.
242 @param status Completion status.
243 @param bufferSizeRemaining Bytes left to be transferred.
244 @param timeStamp Time at which the transaction was processed.
245 */
246typedef void (*IOUSBCompletionActionWithTimeStamp)(
247 void *target,
248 void *parameter,
249 IOReturnstatus,
250 UInt32bufferSizeRemaining,
251 AbsoluteTimetimeStamp);
252
253/*!
254 @typedef IOUSBIsocCompletionAction
255 @discussion Function called when Isochronous USB I/O completes.
256 @param target The target specified in the IOUSBIsocCompletionn struct.
257 @param parameter The parameter specified in the IOUSBIsocCompletion struct.
258 @param status Completion status.
259 @param pFrames Pointer to the frame list containing the status for each frame transferred.
260*/
261typedef void (*IOUSBIsocCompletionAction)(
262 void *target,
263 void *parameter,
264 IOReturnstatus,
265 IOUSBIsocFrame*pFrames);
266
267/*!
268 @typedef IOUSBLowLatencyIsocCompletionAction
269 @discussion Function called when Low Latency Isochronous USB I/O completes.
270 @param target The target specified in the IOUSBLowLatencyIsocCompletion struct.
271 @param parameter The parameter specified in the IOUSBLowLatencyIsocCompletion struct.
272 @param status Completion status.
273 @param pFrames Pointer to the low latency frame list containing the status for each frame transferred.
274*/
275typedef void (*IOUSBLowLatencyIsocCompletionAction)(
276 void *target,
277 void *parameter,
278 IOReturnstatus,
279 IOUSBLowLatencyIsocFrame*pFrames);
280
281/*!
282@typedef IOUSBCompletion
283 @discussion Struct specifying action to perform when a USB I/O completes.
284 @param target The target to pass to the action function.
285 @param action The function to call.
286 @param parameter The parameter to pass to the action function.
287 */
288typedef struct IOUSBCompletion {
289 void * target;
290 IOUSBCompletionActionaction;
291 void *parameter;
292} IOUSBCompletion;
293
294/*!
295@typedef IOUSBCompletionWithTimeStamp
296 @discussion Struct specifying action to perform when a USB I/O completes.
297 @param target The target to pass to the action function.
298 @param action The function to call.
299 @param parameter The parameter to pass to the action function.
300 */
301typedef struct IOUSBCompletionWithTimeStamp {
302 void * target;
303 IOUSBCompletionActionWithTimeStampaction;
304 void *parameter;
305} IOUSBCompletionWithTimeStamp;
306
307/*!
308 @typedef IOUSBIsocCompletion
309 @discussion Struct specifying action to perform when an Isochronous USB I/O completes.
310 @param target The target to pass to the action function.
311 @param action The function to call.
312 @param parameter The parameter to pass to the action function.
313*/
314typedef struct IOUSBIsocCompletion {
315 void * target;
316 IOUSBIsocCompletionActionaction;
317 void *parameter;
318} IOUSBIsocCompletion;
319
320/*!
321 @typedef IOUSBLowLatencyIsocCompletion
322 @discussion Struct specifying action to perform when an Low Latency Isochronous USB I/O completes.
323 @param target The target to pass to the action function.
324 @param action The function to call.
325 @param parameter The parameter to pass to the action function.
326*/
327typedef struct IOUSBLowLatencyIsocCompletion {
328 void * target;
329 IOUSBLowLatencyIsocCompletionActionaction;
330 void *parameter;
331} IOUSBLowLatencyIsocCompletion;
332
333
334/*!
335@defined IOUSBFamily error codes
336@discussion Errors specific to the IOUSBFamily. Note that the iokit_usb_err(x) translates to 0xe0004xxx, where xxx is the value in parenthesis as a hex number.
337*/
338#defineiokit_usb_err(return) (sys_iokit|sub_iokit_usb|return)
339#define kIOUSBUnknownPipeErr iokit_usb_err(0x61)// 0xe0004061 Pipe ref not recognized
340#define kIOUSBTooManyPipesErr iokit_usb_err(0x60)// 0xe0004060 Too many pipes
341#define kIOUSBNoAsyncPortErr iokit_usb_err(0x5f)// 0xe000405f no async port
342#define kIOUSBNotEnoughPipesErr iokit_usb_err(0x5e)// 0xe000405e not enough pipes in interface
343#define kIOUSBNotEnoughPowerErr iokit_usb_err(0x5d)// 0xe000405d not enough power for selected configuration
344#define kIOUSBEndpointNotFound iokit_usb_err(0x57)// 0xe0004057 Endpoint Not found
345#define kIOUSBConfigNotFound iokit_usb_err(0x56)// 0xe0004056 Configuration Not found
346#define kIOUSBTransactionTimeout iokit_usb_err(0x51)// 0xe0004051 Transaction timed out
347#define kIOUSBTransactionReturned iokit_usb_err(0x50)// 0xe0004050 The transaction has been returned to the caller
348#define kIOUSBPipeStalled iokit_usb_err(0x4f)// 0xe000404f Pipe has stalled, error needs to be cleared
349#define kIOUSBInterfaceNotFound iokit_usb_err(0x4e)// 0xe000404e Interface ref not recognized
350#define kIOUSBLowLatencyBufferNotPreviouslyAllocated iokit_usb_err(0x4d)// 0xe000404d Attempted to use user land low latency isoc calls w/out calling PrepareBuffer (on the data buffer) first
351#define kIOUSBLowLatencyFrameListNotPreviouslyAllocated iokit_usb_err(0x4c)// 0xe000404c Attempted to use user land low latency isoc calls w/out calling PrepareBuffer (on the frame list) first
352#define kIOUSBHighSpeedSplitError iokit_usb_err(0x4b)// 0xe000404b Error to hub on high speed bus trying to do split transaction
353#define kIOUSBSyncRequestOnWLThreadiokit_usb_err(0x4a)// 0xe000404a A synchronous USB request was made on the workloop thread (from a callback?). Only async requests are permitted in that case
354#define kIOUSBDeviceNotHighSpeediokit_usb_err(0x49)// 0xe0004049 The device is not a high speed device, so the EHCI driver returns an error
355#define kIOUSBDevicePortWasNotSuspended iokit_usb_err(0x50)// 0xe0004050 Port was not suspended
356
357/*!
358@defined IOUSBFamily hardware error codes
359@discussion These errors are returned by the OHCI controller. The # in parenthesis (xx) corresponds to the OHCI Completion Code.
360For the following Completion codes, we return a generic IOKit error instead of a USB specific error.
361<tt>
362<pre>
363Completion Code Error Returned Description
3649 kIOReturnUnderrun (Data Underrun) EP returned less data than max packet size
3658 kIOReturnOverrun (Data Overrun) Packet too large or more data than buffer
3665 kIOReturnNotResponding Device Not responding
3674 kIOUSBPipeStalled Endpoint returned a STALL PID
368</pre>
369</tt>
370*/
371#define kIOUSBLinkErr iokit_usb_err(0x10)// 0xe0004010
372#define kIOUSBNotSent2Err iokit_usb_err(0x0f)// 0xe000400f Transaction not sent
373#define kIOUSBNotSent1Err iokit_usb_err(0x0e)// 0xe000400e Transaction not sent
374#define kIOUSBBufferUnderrunErr iokit_usb_err(0x0d)// 0xe000400d Buffer Underrun (Host hardware failure on data out, PCI busy?)
375#define kIOUSBBufferOverrunErr iokit_usb_err(0x0c)// 0xe000400c Buffer Overrun (Host hardware failure on data out, PCI busy?)
376#define kIOUSBReserved2Err iokit_usb_err(0x0b)// 0xe000400b Reserved
377#define kIOUSBReserved1Err iokit_usb_err(0x0a)// 0xe000400a Reserved
378#define kIOUSBWrongPIDErr iokit_usb_err(0x07)// 0xe0004007 Pipe stall, Bad or wrong PID
379#define kIOUSBPIDCheckErr iokit_usb_err(0x06)// 0xe0004006 Pipe stall, PID CRC error
380#define kIOUSBDataToggleErr iokit_usb_err(0x03)// 0xe0004003 Pipe stall, Bad data toggle
381#define kIOUSBBitstufErr iokit_usb_err(0x02)// 0xe0004002 Pipe stall, bitstuffing
382#define kIOUSBCRCErr iokit_usb_err(0x01)// 0xe0004001 Pipe stall, bad CRC
383
384/*!
385@defined IOUSBFamily message codes
386@discussion Messages specific to the IOUSBFamily. Note that the iokit_usb_msg(x) translates to 0xe0004xxx, where xxx is the value in parenthesis as a hex number.
387*/
388#define iokit_usb_msg(message)(UInt32)(sys_iokit|sub_iokit_usb|message)
389#define kIOUSBMessageHubResetPortiokit_usb_msg(0x01)// 0xe0004001 Message sent to a hub to reset a particular port
390#define kIOUSBMessageHubSuspendPortiokit_usb_msg(0x02)// 0xe0004002 Message sent to a hub to suspend a particular port
391#define kIOUSBMessageHubResumePortiokit_usb_msg(0x03)// 0xe0004003 Message sent to a hub to resume a particular port
392#define kIOUSBMessageHubIsDeviceConnectediokit_usb_msg(0x04)// 0xe0004004 Message sent to a hub to inquire whether a particular port has a device connected or not
393#define kIOUSBMessageHubIsPortEnablediokit_usb_msg(0x05)// 0xe0004005 Message sent to a hub to inquire whether a particular port is enabled or not
394#define kIOUSBMessageHubReEnumeratePortiokit_usb_msg(0x06)// 0xe0004006 Message sent to a hub to reenumerate the device attached to a particular port
395#define kIOUSBMessagePortHasBeenResetiokit_usb_msg(0x0a)// 0xe000400a Message sent to a device indicating that the port it is attached to has been reset
396#define kIOUSBMessagePortHasBeenResumediokit_usb_msg(0x0b)// 0xe000400b Message sent to a device indicating that the port it is attached to has been resumed
397#define kIOUSBMessageHubPortClearTTiokit_usb_msg(0x0c)// 0xe000400c Message sent to a hub to clear the transaction translator
398#define kIOUSBMessagePortHasBeenSuspendediokit_usb_msg(0x0d)// 0xe000400d Message sent to a device indicating that the port it is attached to has been suspended
399#define kIOUSBMessageFromThirdPartyiokit_usb_msg(0x0e)// 0xe000400e Message sent from a third party. Uses IOUSBThirdPartyParam to encode the sender's ID
400#define kIOUSBMessagePortWasNotSuspendediokit_usb_msg(0x0f)// 0xe000400f Message indicating that the hub driver received a resume request for a port that was not suspended
401#define kIOUSBMessageExpressCardCantWakeiokit_usb_msg(0x10)// 0xe0004010 Message from a driver to a bus that an express card will disconnect on sleep and thus shouldn't wake
402#define kIOUSBMessageCompositeDriverReconfigured iokit_usb_msg(0x11)// 0xe0004011 Message from the composite driver indicating that it has finished re-configuring the device after a reset
403#define kIOUSBMessageHubSetPortRecoveryTimeiokit_usb_msg(0x12)// 0xe0004012 Message sent to a hub to set the # of ms required when resuming a particular port
404#define kIOUSBMessageOvercurrentConditioniokit_usb_msg(0x13) // 0xe0004013 Message sent to the clients of the device's hub parent, when a device causes an overcurrent condition. The message argument contains the locationID of the device
405#define kIOUSBMessageNotEnoughPoweriokit_usb_msg(0x14) // 0xe0004014 Message sent to the clients of the device's hub parent, when a device causes an low power notice to be displayed. The message argument contains the locationID of the device
406#define kIOUSBMessageControlleriokit_usb_msg(0x15)// 0xe0004015 Generic message sent from controller user client to controllers
407#definekIOUSBMessageRootHubWakeEventiokit_usb_msg(0x16)// 0xe0004016 Message from the HC Wakeup code indicating that a Root Hub port has a wake event
408
409// Obsolete
410//
411struct IOUSBMouseData {
412 UInt16 buttons;
413 SInt16 XDelta;
414 SInt16 YDelta;
415};
416typedef struct IOUSBMouseDataIOUSBMouseData;
417typedef IOUSBMouseData *IOUSBMouseDataPtr;
418
419// Obsolete
420//
421struct IOUSBKeyboardData {
422 UInt16 keycount;
423 UInt16 usbkeycode[32];
424};
425typedef struct IOUSBKeyboardDataIOUSBKeyboardData;
426typedef IOUSBKeyboardData *IOUSBKeyboardDataPtr;
427
428// Obsolete
429//
430union IOUSBHIDData {
431 IOUSBKeyboardData kbd;
432 IOUSBMouseData mouse;
433};
434typedef union IOUSBHIDDataIOUSBHIDData;
435typedef IOUSBHIDData *IOUSBHIDDataPtr;
436
437/*!
438 @typedef IOUSBDeviceDescriptor
439 @discussion Descriptor for a USB Device. See the USB Specification at <a href="http://www.usb.org"TARGET="_blank">http://www.usb.org</a>.
440*/
441struct IOUSBDeviceDescriptor {
442UInt8 bLength;
443UInt8 bDescriptorType;
444UInt16 bcdUSB;
445UInt8 bDeviceClass;
446UInt8 bDeviceSubClass;
447UInt8 bDeviceProtocol;
448UInt8 bMaxPacketSize0;
449UInt16 idVendor;
450UInt16 idProduct;
451UInt16 bcdDevice;
452UInt8 iManufacturer;
453UInt8 iProduct;
454UInt8 iSerialNumber;
455UInt8 bNumConfigurations;
456};
457typedef struct IOUSBDeviceDescriptorIOUSBDeviceDescriptor;
458typedef IOUSBDeviceDescriptor *IOUSBDeviceDescriptorPtr;
459
460/*!
461 @typedef IOUSBDescriptorHeader
462 @discussion Standard header used for all USB descriptors. Used to read the length of a descriptor so that we can allocate storage for the whole descriptor later on.
463*/
464struct IOUSBDescriptorHeader {
465UInt8 bLength;
466UInt8 bDescriptorType;
467};
468typedef struct IOUSBDescriptorHeaderIOUSBDescriptorHeader;
469typedef IOUSBDescriptorHeader *IOUSBDescriptorHeaderPtr;
470
471/*!
472 @typedef IOUSBConfigurationDescriptor
473 @discussion Standard USB Configuration Descriptor. It is variable length, so this only specifies the known fields. We use the wTotalLength field to read the whole descriptor.
474 See the USB Specification at <a href="http://www.usb.org"TARGET="_blank">http://www.usb.org</a>.
475*/
476struct IOUSBConfigurationDescriptor {
477UInt8 bLength;
478UInt8 bDescriptorType;
479UInt16 wTotalLength;
480UInt8 bNumInterfaces;
481UInt8 bConfigurationValue;
482UInt8 iConfiguration;
483UInt8 bmAttributes;
484UInt8 MaxPower;
485};
486typedef struct IOUSBConfigurationDescriptor IOUSBConfigurationDescriptor;
487typedef IOUSBConfigurationDescriptor *IOUSBConfigurationDescriptorPtr;
488
489/*!
490 @typedef IOUSBConfigurationDescHeader
491 @discussion Header of a IOUSBConfigurationDescriptor. Used to get the total length of the descriptor.
492*/
493struct IOUSBConfigurationDescHeader {
494UInt8 bLength;
495UInt8 bDescriptorType;
496UInt16 wTotalLength;
497};
498typedef struct IOUSBConfigurationDescHeader IOUSBConfigurationDescHeader;
499typedef IOUSBConfigurationDescHeader *IOUSBConfigurationDescHeaderPtr;
500
501/*!
502 @typedef IOUSBInterfaceDescriptor
503 @discussion Descriptor for a USB Interface. See the USB Specification at <a href="http://www.usb.org"TARGET="_blank">http://www.usb.org</a>.
504*/
505struct IOUSBInterfaceDescriptor {
506UInt8 bLength;
507UInt8 bDescriptorType;
508UInt8 bInterfaceNumber;
509UInt8 bAlternateSetting;
510UInt8 bNumEndpoints;
511UInt8 bInterfaceClass;
512UInt8 bInterfaceSubClass;
513UInt8 bInterfaceProtocol;
514UInt8 iInterface;
515};
516typedef struct IOUSBInterfaceDescriptorIOUSBInterfaceDescriptor;
517typedef IOUSBInterfaceDescriptor *IOUSBInterfaceDescriptorPtr;
518
519/*!
520 @typedef IOUSBEndpointDescriptor
521 @discussion Descriptor for a USB Endpoint. See the USB Specification at <a href="http://www.usb.org"TARGET="_blank">http://www.usb.org</a>.
522*/
523struct IOUSBEndpointDescriptor {
524UInt8 bLength;
525UInt8 bDescriptorType;
526UInt8 bEndpointAddress;
527UInt8 bmAttributes;
528UInt16 wMaxPacketSize;
529UInt8 bInterval;
530};
531typedef struct IOUSBEndpointDescriptorIOUSBEndpointDescriptor;
532typedef IOUSBEndpointDescriptor *IOUSBEndpointDescriptorPtr;
533
534enum{addPacketShift = 11}; // Bits for additional packets in maxPacketField. (Table 9-13)
535#define mungeMaxPacketSize(w) ((w>1024)?(((w>>(addPacketShift))+1)*(w&((1<<addPacketShift)-1))):w)
536
537/*!
538 @typedef IOUSBHIDDescriptor
539 @discussion USB HID Descriptor. See the USB HID Specification at <a href="http://www.usb.org"TARGET="_blank">http://www.usb.org</a>. (This structure
540 should have used the #pragma pack(1) compiler directive to get byte alignment.
541*/
542struct IOUSBHIDDescriptor {
543UInt8 descLen;
544UInt8 descType;
545UInt16 descVersNum;
546UInt8 hidCountryCode;
547UInt8 hidNumDescriptors;
548UInt8 hidDescriptorType;
549UInt8 hidDescriptorLengthLo;
550UInt8 hidDescriptorLengthHi;
551};
552typedef struct IOUSBHIDDescriptorIOUSBHIDDescriptor;
553typedef IOUSBHIDDescriptor *IOUSBHIDDescriptorPtr;
554
555/*!
556 @typedef IOUSBHIDReportDesc
557 @discussion USB HID Report Descriptor header. See the USB HID Specification at <a href="http://www.usb.org"TARGET="_blank">http://www.usb.org</a>. (This structure
558 should have used the #pragma pack(1) compiler directive to get byte alignment.
559*/
560struct IOUSBHIDReportDesc {
561UInt8 hidDescriptorType;
562UInt8 hidDescriptorLengthLo;
563UInt8 hidDescriptorLengthHi;
564};
565typedef struct IOUSBHIDReportDescIOUSBHIDReportDesc;
566typedef IOUSBHIDReportDesc *IOUSBHIDReportDescPtr;
567
568/*!
569 @typedef IOUSBDeviceQualifierDescriptor
570 @discussion USB Device Qualifier Descriptor. See the USB Specification at <a href="http://www.usb.org"TARGET="_blank">http://www.usb.org</a>.
571*/
572#pragma pack(1)
573struct IOUSBDeviceQualifierDescriptor
574{
575UInt8 bLength;
576UInt8 bDescriptorType;
577UInt16 bcdUSB;
578UInt8 bDeviceClass;
579UInt8 bDeviceSubClass;
580UInt8 bDeviceProtocol;
581UInt8 bMaxPacketSize0;
582UInt8 bNumConfigurations;
583UInt8 bReserved;
584};
585typedef struct IOUSBDeviceQualifierDescriptorIOUSBDeviceQualifierDescriptor;
586typedef IOUSBDeviceQualifierDescriptor *IOUSBDeviceQualifierDescriptorPtr;
587#pragma options align=reset
588
589/*!
590 @typedef IOUSBDFUDescriptor
591 @discussion USB Device Firmware Update Descriptor. See the USB Device Firmware Update Specification at <a href="http://www.usb.org"TARGET="_blank">http://www.usb.org</a>.
592*/
593#pragma pack(1)
594struct IOUSBDFUDescriptor
595{
596 UInt8 bLength;
597 UInt8 bDescriptorType;
598 UInt8 bmAttributes;
599 UInt16 wDetachTimeout;
600 UInt16 wTransferSize;
601};
602typedef struct IOUSBDFUDescriptor IOUSBDFUDescriptor;
603typedef IOUSBDFUDescriptor *IOUSBDFUDescriptorPtr;
604
605#pragma options align=reset
606
607/*!
608@typedef IOUSBInterfaceAssociationDescriptor
609 @discussion USB Inerface Association Descriptor. ECN to the USB 2.0 Spec. See the USB Specification at <a href="http://www.usb.org"TARGET="_blank">http://www.usb.org</a>.
610 */
611#pragma pack(1)
612struct IOUSBInterfaceAssociationDescriptor
613{
614 UInt8 bLength;
615 UInt8 bDescriptorType;
616 UInt8 bFirstInterface;
617 UInt8 bInterfaceCount;
618 UInt8 bFunctionClass;
619 UInt8 bFunctionSubClass;
620 UInt8 bFunctionProtocol;
621 UInt8iFunction;
622};
623typedef struct IOUSBInterfaceAssociationDescriptorIOUSBInterfaceAssociationDescriptor;
624typedef IOUSBInterfaceAssociationDescriptor *IOUSBInterfaceAssociationDescriptorPtr;
625#pragma options align=reset
626
627/*!
628 @typedef USBStatus
629 @discussion Type used to get a DeviceStatus as a single quantity.
630*/
631typedef UInt16USBStatus;
632typedef USBStatus *USBStatusPtr;
633
634// These constants are obsolete
635//
636enum {
637 kIOUSBAnyClass= 0xFFFF,
638 kIOUSBAnySubClass= 0xFFFF,
639 kIOUSBAnyProtocol= 0xFFFF,
640 kIOUSBAnyVendor= 0xFFFF,
641 kIOUSBAnyProduct= 0xFFFF
642};
643
644// This structure are obsolete
645//
646typedef struct IOUSBMatch {
647 UInt16usbClass;
648 UInt16usbSubClass;
649 UInt16usbProtocol;
650 UInt16usbVendor;
651 UInt16usbProduct;
652} IOUSBMatch;
653
654/*!
655 @typedef IOUSBFindEndpointRequest
656 @discussion Struct used to find endpoints of an interface
657 type and direction are used to match endpoints,
658 type, direction, maxPacketSize and interval are updated
659 with the properties of the found endpoint.
660 @field type Type of endpoint: kUSBControl, kUSBIsoc, kUSBBulk, kUSBInterrupt, kUSBAnyType. If kUSBAnyType is specified, this field is treated as a don't care.
661 @field direction Direction of endpoint: kUSBOut, kUSBIn, kUSBAnyDirn. If kUSBAnyDirn is specified, this field is treated as a don't care.
662 @field maxPacketSize maximum packet size of endpoint.
663 @field interval Polling interval in mSec for endpoint.
664*/
665typedef struct {
666UInt8 type;
667UInt8 direction;
668 UInt16 maxPacketSize;
669 UInt8 interval;
670} IOUSBFindEndpointRequest;
671
672/*!
673 @struct IOUSBDevRequest
674 @discussion Parameter block for control requests, using a simple pointer
675 for the data to be transferred.
676 @field bmRequestType Request type: kUSBStandard, kUSBClass or kUSBVendor
677 @field bRequest Request code
678 @field wValue 16 bit parameter for request, host endianess
679 @field wIndex 16 bit parameter for request, host endianess
680 @field wLength Length of data part of request, 16 bits, host endianess
681 @field pData Pointer to data for request - data returned in bus endianess
682 @field wLenDone Set by standard completion routine to number of data bytes
683actually transferred
684*/
685typedef struct {
686 UInt8 bmRequestType;
687 UInt8 bRequest;
688 UInt16 wValue;
689 UInt16 wIndex;
690 UInt16 wLength;
691 void * pData;
692 UInt32 wLenDone;
693} IOUSBDevRequest;
694typedef IOUSBDevRequest * IOUSBDeviceRequestPtr;
695
696/*!
697 @struct IOUSBDevRequestTO
698 @discussion Parameter block for control requests with timeouts, using a simple pointer
699 for the data to be transferred. Same as a IOUSBDevRequest except for the two extra timeout fields.
700 @field bmRequestType Request type: kUSBStandard, kUSBClass or kUSBVendor
701 @field bRequest Request code
702 @field wValue 16 bit parameter for request, host endianess
703 @field wIndex 16 bit parameter for request, host endianess
704 @field wLength Length of data part of request, 16 bits, host endianess
705 @field pData Pointer to data for request - data returned in bus endianess
706 @field wLenDone Set by standard completion routine to number of data bytes
707actually transferred
708 @field noDataTimeout Specifies a time value in milliseconds. Once the request is queued on the bus, if no data is transferred in this amount of time, the request will be aborted and returned.
709 @field completionTimeout Specifies a time value in milliseconds. Once the request is queued on the bus, if the entire request is not completed in this amount of time, the request will be aborted and returned
710*/
711typedef struct {
712 UInt8 bmRequestType;
713 UInt8 bRequest;
714 UInt16 wValue;
715 UInt16 wIndex;
716 UInt16 wLength;
717 void * pData;
718 UInt32 wLenDone;
719 UInt32 noDataTimeout;
720 UInt32 completionTimeout;
721} IOUSBDevRequestTO;
722
723/*!
724 @enum Default timeout values
725 @discussion default values used for data and completion timeouts.
726*/
727enum
728{
729 kUSBDefaultControlNoDataTimeoutMS = 5000,
730 kUSBDefaultControlCompletionTimeoutMS = 0
731};
732
733// Internal structure to pass parameters between IOUSBLib and UserClient
734//
735typedef struct
736{
737 UInt32 pipeRef;
738 void * buf;
739 UInt32 size;
740 UInt32 noDataTimeout;
741 UInt32 completionTimeout;
742} IOUSBBulkPipeReq;
743
744
745#if KERNEL
746/*!
747 @struct IOUSBDevRequestDesc
748 @discussion Parameter block for control requests, using a memory descriptor
749 for the data to be transferred. Only available in the kernel.
750 @field bmRequestType Request type: kUSBStandard, kUSBClass or kUSBVendor
751 @field bRequest Request code
752 @field wValue 16 bit parameter for request, host endianess
753 @field wIndex 16 bit parameter for request, host endianess
754 @field wLength Length of data part of request, 16 bits, host endianess
755 @field pData Pointer to memory descriptor for data for request - data returned in bus endianess
756 @field wLenDone Set by standard completion routine to number of data bytes
757 actually transferred
758*/
759typedef struct {
760 UInt8 bmRequestType;
761 UInt8 bRequest;
762 UInt16 wValue;
763 UInt16 wIndex;
764 UInt16 wLength;
765 IOMemoryDescriptor * pData;
766 UInt32 wLenDone;
767} IOUSBDevRequestDesc;
768
769
770/*!
771 @enum IOOptionBits
772 @discussion Parameter passed to an IOService::open() call.
773 @constant kIOUSBInterfaceOpenAlt Open the alternate interface specified when creating the interface.
774*/
775enum {
776 kIOUSBInterfaceOpenAlt= 0x00010000
777};
778
779#endif
780
781// Internal structure to pass parameters between IOUSBLib and UserClient
782//
783// use a structure because there's a limit of 6 total arguments
784// to a user client method.
785typedef struct {
786 UInt8 bmRequestType;
787 UInt8 bRequest;
788 UInt16 wValue;
789 UInt16 wIndex;
790 UInt16wLength;
791 void * pData;// data pointer
792 UInt32wLenDone;// # bytes transferred
793 UInt8pipeRef;
794} IOUSBDevReqOOL;
795
796// Internal structure to pass parameters between IOUSBLib and UserClient
797//
798typedef struct {
799 UInt8 bmRequestType;
800 UInt8 bRequest;
801 UInt16 wValue;
802 UInt16 wIndex;
803 UInt16wLength;
804 void * pData;// data pointer
805 UInt32wLenDone;// # bytes transferred
806 UInt8pipeRef;
807 UInt32noDataTimeout;
808 UInt32completionTimeout;
809} IOUSBDevReqOOLTO;
810
811// Internal structure to pass parameters between IOUSBLib and UserClient
812//
813// Structure to request isochronous transfer
814//
815typedef struct {
816 UInt32 fPipe;
817 void *fBuffer;
818 UInt32 fBufSize;
819 UInt64 fStartFrame;
820 UInt32 fNumFrames;
821 IOUSBIsocFrame *fFrameCounts;
822} IOUSBIsocStruct;
823
824// Internal structure to pass parameters between IOUSBLib and UserClient
825//
826// Structure to request low latency isochronous transfer
827//
828struct IOUSBLowLatencyIsocStruct {
829 UInt32 fPipe;
830 UInt32 fBufSize;
831 UInt64 fStartFrame;
832 UInt32 fNumFrames;
833 UInt32fUpdateFrequency;
834 UInt32fDataBufferCookie;
835 UInt32fDataBufferOffset;
836 UInt32fFrameListBufferCookie;
837 UInt32fFrameListBufferOffset;
838};
839
840typedef struct IOUSBLowLatencyIsocStruct IOUSBLowLatencyIsocStruct;
841
842
843/*!
844 @struct IOUSBGetFrameStruct
845 @discussion Structure used from user space to return the frame number and a timestamp on when the frame register was read.
846 @field frame frame number
847 @field timeStamp AbsoluteTime when the frame was updated
848*/
849typedef struct {
850 UInt64frame;
851 AbsoluteTimetimeStamp;
852} IOUSBGetFrameStruct;
853
854
855/*!
856 @struct IOUSBFindInterfaceRequest
857 @discussion Structure used with FindNextInterface.
858*/
859typedef struct {
860 UInt16bInterfaceClass;// requested class
861 UInt16 bInterfaceSubClass;// requested subclass
862 UInt16 bInterfaceProtocol;// requested protocol
863 UInt16bAlternateSetting;// requested alt setting
864} IOUSBFindInterfaceRequest;
865
866/*!
867 @enum kIOUSBFindInterfaceDontCare
868 @discussion Constant that can be used for the fields of IOUSBFindInterfaceRequest to specify that they should not be matched.
869*/
870enum {
871 kIOUSBFindInterfaceDontCare= 0xFFFF
872 };
873
874/*!
875 @enum kIOUSBVendorIDAppleComputer
876 @discussion USB Vendor ID for Apple Computer, Inc.
877*/
878enum {
879kIOUSBVendorIDAppleComputer= 0x05AC
880 };
881
882/*!
883 @enum USBDeviceSpeed
884 @discussion Returns the speed of a particular USB device.
885 @constantkUSBDeviceSpeedLowThe device a low speed device.
886 @constantkUSBDeviceSpeedFullThe device a full speed device.
887 @constantkUSBDeviceSpeedHighThe device a high speed device.
888*/
889enum {
890 kUSBDeviceSpeedLow= 0,
891 kUSBDeviceSpeedFull= 1,
892 kUSBDeviceSpeedHigh= 2
893 };
894
895/*!
896 @enum MicrosecondsInFrame
897 @discussion Returns the number of microseconds in a USB frame.
898 @constantkUSBFullSpeedMicrosecondsInFrameThe device is attached to a bus running at full speed (1 ms / frame).
899 @constantkUSBHighSpeedMicrosecondsInFrameThe device is attached to a bus running at high speed (125 microseconds / frame).
900*/
901enum {
902 kUSBFullSpeedMicrosecondsInFrame= 1000,
903 kUSBHighSpeedMicrosecondsInFrame= 125
904};
905
906// During low latency transfers, the stack will set the frStatus for each frame to this value. A client can check that to see if the transfer has completed. We set the frStatus to a
907// valid return code when the transfer completes.
908//
909enum {
910 kUSBLowLatencyIsochTransferKey= 'llit'// Set frStatus field of first frame in isoch transfer to designate as low latency
911 };
912
913// This structure is DEPRECATED. See the LowLatencyUserBufferInfoV2
914//
915typedef struct LowLatencyUserBufferInfo LowLatencyUserBufferInfo;
916
917struct LowLatencyUserBufferInfo {
918 UInt32cookie;
919 void *bufferAddress;
920 IOByteCountbufferSize;
921 UInt32bufferType;
922 BooleanisPrepared;
923 LowLatencyUserBufferInfo *nextBuffer;
924};
925
926// This structure is DEPRECATED. See the LowLatencyUserBufferInfoV3
927
928typedef struct LowLatencyUserBufferInfoV2 LowLatencyUserBufferInfoV2;
929
930struct LowLatencyUserBufferInfoV2
931{
932UInt32cookie;
933void *bufferAddress;
934IOByteCountbufferSize;
935UInt32bufferType;
936BooleanisPrepared;
937void *mappedUHCIAddress;
938LowLatencyUserBufferInfoV2 *nextBuffer;
939};
940
941
942// This structure is used to pass information for the low latency calls between user space and the kernel.
943//
944typedef struct LowLatencyUserBufferInfoV3 LowLatencyUserBufferInfoV3;
945
946struct LowLatencyUserBufferInfoV3
947{
948uint64_tcookie;
949mach_vm_address_tbufferAddress;
950mach_vm_size_tbufferSize;
951uint64_tbufferType;
952uint64_tisPrepared;
953mach_vm_address_tmappedUHCIAddress;
954LowLatencyUserBufferInfoV3 *nextBuffer;
955};
956
957
958/*!
959 @enum USBLowLatencyBufferType
960 @discussion Used to specify what kind of buffer to create when calling LowLatencyCreateBuffer().
961 @constantkUSBLowLatencyWriteBufferThe buffer will be used to write data out to a device.
962 @constantkUSBLowLatencyReadBufferThe buffer will be used to read data from a device.
963 @constantkUSBLowLatencyFrameListBufferThe buffer will be used for a low latency isoch frame list.
964*/
965typedef enum {
966 kUSBLowLatencyWriteBuffer = 0,
967 kUSBLowLatencyReadBuffer= 1,
968 kUSBLowLatencyFrameListBuffer= 2
969} USBLowLatencyBufferType;
970
971// USB User Notification Types
972//
973enum {
974 kUSBNoUserNotificationType= 0,
975 kUSBNotEnoughPowerNotificationType= 1,
976 kUSBIndividualOverCurrentNotificationType= 2,
977 kUSBGangOverCurrentNotificationType= 3
978};
979
980/*!
981 @defined Property Definitions
982 @discussion Useful property names in USB land.
983*/
984#define kUSBDevicePropertySpeed "Device Speed"
985#define kUSBDevicePropertyBusPowerAvailable "Bus Power Available"
986#define kUSBDevicePropertyAddress "USB Address"
987#define kUSBDevicePropertyLocationID "locationID"
988#define kUSBProductIDMask"idProductMask"
989#define kUSBPreferredConfiguration"Preferred Configuration"
990#define kUSBSuspendPort"kSuspendPort"
991#define kUSBExpressCardCantWake"ExpressCardCantWake"
992#define kUSBControllerNeedsContiguousMemoryForIsoch"Need contiguous memory for isoch"
993#define kUSBHubDontAllowLowPower"kUSBHubDontAllowLowPower"
994#define kUSBDeviceResumeRecoveryTime"kUSBDeviceResumeRecoveryTime"
995#define kUSBOutOfSpecMPSOK"Out of spec MPS OK"
996#define kConfigurationDescriptorOverride"ConfigurationDescriptorOverride"
997#define kOverrideIfAtLocationID"OverrideIfAtLocationID"
998
999/*!
1000@enum USBReEnumerateOptions
1001 @discussion Options used when calling ReEnumerateDevice.
1002 @constantkUSBAddExtraResetTimeBitSetting this bit will cause the Hub driver to wait 100ms before addressing the device after the reset following the re-enumeration.
1003 */
1004typedef enum {
1005 kUSBAddExtraResetTimeBit = 31,
1006 kUSBAddExtraResetTimeMask= ( 1 << kUSBAddExtraResetTimeBit)
1007} USBReEnumerateOptions;
1008
1009/*!
1010 @enum USBDeviceInformationBits
1011 @discussion GetUSBDeviceInformation will return a unit32_t value with bits set indicating that a particular state is present in the USB device. These bits are described here
1012
1013 @constantkUSBInformationDeviceIsCaptiveBitThe USB device is directly attached to its hub and cannot be removed.
1014 @constantkUSBInformationDeviceIsAttachedToRootHubBitThe USB device is directly attached to the root hub
1015 @constantkUSBInformationDeviceIsInternalBitThe USB device is internal to the computer (all the hubs it attaches to are captive)
1016 @constantkUSBInformationDeviceIsConnectedBitThe USB device is connected to its hub
1017 @constantkUSBInformationDeviceIsEnabledBitThe hub port to which the USB device is attached is enabled
1018 @constantkUSBInformationDeviceIsSuspendedBitThe hub port to which the USB device is attached is suspended
1019 @constantkUSBInformationDeviceIsInResetBitThe hub port to which the USB device is attached is being reset
1020 @constantkUSBInformationDeviceOvercurrentBitThe USB device generated an overcurrent
1021 @constantkUSBInformationDevicePortIsInTestModeBitThe hub port to which the USB device is attached is in test mode
1022 @constant kUSBInformationDeviceIsRootHubThe device is actually the root hub simulation
1023 @constant kUSBInformationRootHubisBuiltInIf this is a root hub simulation and it's built into the machine, this bit is set. If it's on an expansion card, it will be cleared
1024
1025 */
1026typedef enum {
1027kUSBInformationDeviceIsCaptiveBit= 0,
1028kUSBInformationDeviceIsAttachedToRootHubBit= 1,
1029kUSBInformationDeviceIsInternalBit= 2,
1030kUSBInformationDeviceIsConnectedBit= 3,
1031kUSBInformationDeviceIsEnabledBit= 4,
1032kUSBInformationDeviceIsSuspendedBit= 5,
1033kUSBInformationDeviceIsInResetBit= 6,
1034kUSBInformationDeviceOvercurrentBit= 7,
1035kUSBInformationDevicePortIsInTestModeBit= 8,
1036kUSBInformationDeviceIsRootHub= 9,
1037kUSBInformationRootHubisBuiltIn= 10,
1038kUSBInformationDeviceIsRemote= 11,
1039kUSBInformationDeviceIsCaptiveMask= (1 << kUSBInformationDeviceIsCaptiveBit),
1040kUSBInformationDeviceIsAttachedToRootHubMask= (1 << kUSBInformationDeviceIsAttachedToRootHubBit),
1041kUSBInformationDeviceIsInternalMask= (1 << kUSBInformationDeviceIsInternalBit),
1042kUSBInformationDeviceIsConnectedMask= (1 << kUSBInformationDeviceIsConnectedBit),
1043kUSBInformationDeviceIsEnabledMask= (1 << kUSBInformationDeviceIsEnabledBit),
1044kUSBInformationDeviceIsSuspendedMask= (1 << kUSBInformationDeviceIsSuspendedBit),
1045kUSBInformationDeviceIsInResetMask= (1 << kUSBInformationDeviceIsInResetBit),
1046kUSBInformationDeviceOvercurrentMask= (1 << kUSBInformationDeviceOvercurrentBit),
1047kUSBInformationDevicePortIsInTestModeMask= (1 << kUSBInformationDevicePortIsInTestModeBit),
1048kUSBInformationDeviceIsRootHubMask= (1 << kUSBInformationDeviceIsRootHub),
1049kUSBInformationRootHubisBuiltInMask= (1 << kUSBInformationRootHubisBuiltIn),
1050kUSBInformationDeviceIsRemoteMask= (1 << kUSBInformationDeviceIsRemote)
1051} USBDeviceInformationBits;
1052
1053/*!
1054 @enum USBPowerRequestTypes
1055 @discussion Used to specify what kind of power will be reserved using the IOUSBDevice RequestExtraPower and ReturnExtraPower APIs.
1056 @constantkUSBPowerDuringSleepThe power is to be used during sleep.
1057 @constantkUSBPowerDuringWakeThe power is to be used while the system is awake (i.e not sleeping)
1058 */
1059typedef enum {
1060kUSBPowerDuringSleep = 0,
1061kUSBPowerDuringWake= 1
1062} USBPowerRequestTypes;
1063
1064// Apple specific properties
1065#define kAppleCurrentAvailable"AAPL,current-available"
1066#define kAppleCurrentInSleep"AAPL,current-in-sleep"
1067#define kAppleCurrentExtra"AAPL,current-extra"
1068#define kAppleInternalUSBDevice"AAPL,device-internal"
1069#define kUSBBusID"AAPL,bus-id"
1070
1071
1072#ifdef __cplusplus
1073}
1074#endif
1075
1076#endif /* _USB_H */
1077

Archive Download this file

Revision: 2225