#ifndef _USB_H
#define _USB_H
#if KERNEL
#include <libkern/OSByteOrder.h>
#include <IOKit/IOMemoryDescriptor.h>
#else
#include <libkern/OSByteOrder.h>
#endif
#include <IOKit/IOTypes.h>
#if !defined(__USB__)
# include <IOKit/usb/USBSpec.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
#define USBToHostWord OSSwapLittleToHostInt16
#define HostToUSBWord OSSwapHostToLittleInt16
#define USBToHostLong OSSwapLittleToHostInt32
#define HostToUSBLong OSSwapHostToLittleInt32
enum {
kUSBDeviceIDShift = 7,
kUSBMaxDevices = 128,
kUSBMaxDevice = kUSBMaxDevices-1,
kUSBDeviceIDMask = 0x7f,
kUSBPipeIDMask = 0xf,
kUSBMaxPipes = 32,
kUSBInterfaceIDShift = 8,
kUSBMaxInterfaces = 1 << kUSBInterfaceIDShift,
kUSBInterfaceIDMask = kUSBMaxInterfaces-1,
kUSBEndPtShift = 7,
kUSBDeviceMask = ((1 << kUSBEndPtShift) -1),
kUSBNoPipeIdx = -1
};
enum {
kUSBRqDirnShift = 7,
kUSBRqDirnMask = 1,
kUSBRqTypeShift = 5,
kUSBRqTypeMask = 3,
kUSBRqRecipientMask = 0X1F
};
#define USBmakebmRequestType(direction, type, recipient) \
((direction & kUSBRqDirnMask) << kUSBRqDirnShift) | \
((type & kUSBRqTypeMask) << kUSBRqTypeShift) | \
(recipient & kUSBRqRecipientMask)
enum {
kUSBMaxFSIsocEndpointReqCount = 1023, kUSBMaxHSIsocEndpointReqCount = 3072, kUSBMaxHSIsocFrameCount = 7168 };
#define EncodeRequest(request, direction, type, recipient) \
(((UInt16)request << 8) + \
((UInt16)recipient + \
((UInt16)type << kUSBRqTypeShift) + \
((UInt16)direction << kUSBRqDirnShift)))
enum {
kClearDeviceFeature = EncodeRequest(kUSBRqClearFeature, kUSBOut, kUSBStandard, kUSBDevice),
kClearInterfaceFeature = EncodeRequest(kUSBRqClearFeature, kUSBOut, kUSBStandard, kUSBInterface),
kClearEndpointFeature = EncodeRequest(kUSBRqClearFeature, kUSBOut, kUSBStandard, kUSBEndpoint),
kGetConfiguration = EncodeRequest(kUSBRqGetConfig, kUSBIn, kUSBStandard, kUSBDevice),
kGetDescriptor = EncodeRequest(kUSBRqGetDescriptor, kUSBIn, kUSBStandard, kUSBDevice),
kGetInterface = EncodeRequest(kUSBRqGetInterface, kUSBIn, kUSBStandard, kUSBInterface),
kGetDeviceStatus = EncodeRequest(kUSBRqGetStatus, kUSBIn, kUSBStandard, kUSBDevice),
kGetInterfaceStatus = EncodeRequest(kUSBRqGetStatus, kUSBIn, kUSBStandard, kUSBInterface),
kGetEndpointStatus = EncodeRequest(kUSBRqGetStatus, kUSBIn, kUSBStandard, kUSBEndpoint),
kSetAddress = EncodeRequest(kUSBRqSetAddress, kUSBOut, kUSBStandard, kUSBDevice),
kSetConfiguration = EncodeRequest(kUSBRqSetConfig, kUSBOut, kUSBStandard, kUSBDevice),
kSetDescriptor = EncodeRequest(kUSBRqSetDescriptor, kUSBOut, kUSBStandard, kUSBDevice),
kSetDeviceFeature = EncodeRequest(kUSBRqSetFeature, kUSBOut, kUSBStandard, kUSBDevice),
kSetInterfaceFeature = EncodeRequest(kUSBRqSetFeature, kUSBOut, kUSBStandard, kUSBInterface),
kSetEndpointFeature = EncodeRequest(kUSBRqSetFeature, kUSBOut, kUSBStandard, kUSBEndpoint),
kSetInterface = EncodeRequest(kUSBRqSetInterface, kUSBOut, kUSBStandard, kUSBInterface),
kSyncFrame = EncodeRequest(kUSBRqSyncFrame, kUSBIn, kUSBStandard, kUSBEndpoint),
};
#define kCallInterfaceOpenWithGate "kCallInterfaceOpenWithGate"
typedef UInt16 USBDeviceAddress;
typedef uint32_t USBPhysicalAddress32;
typedef struct IOUSBIsocFrame {
IOReturn frStatus;
UInt16 frReqCount;
UInt16 frActCount;
} IOUSBIsocFrame;
struct IOUSBLowLatencyIsocFrame {
IOReturn frStatus;
UInt16 frReqCount;
UInt16 frActCount;
AbsoluteTime frTimeStamp;
};
typedef struct IOUSBLowLatencyIsocFrame IOUSBLowLatencyIsocFrame;
typedef void (*IOUSBCompletionAction)(
void * target,
void * parameter,
IOReturn status,
UInt32 bufferSizeRemaining);
typedef void (*IOUSBCompletionActionWithTimeStamp)(
void * target,
void * parameter,
IOReturn status,
UInt32 bufferSizeRemaining,
AbsoluteTime timeStamp);
typedef void (*IOUSBIsocCompletionAction)(
void * target,
void * parameter,
IOReturn status,
IOUSBIsocFrame *pFrames);
typedef void (*IOUSBLowLatencyIsocCompletionAction)(
void * target,
void * parameter,
IOReturn status,
IOUSBLowLatencyIsocFrame *pFrames);
typedef struct IOUSBCompletion {
void * target;
IOUSBCompletionAction action;
void * parameter;
} IOUSBCompletion;
typedef struct IOUSBCompletionWithTimeStamp {
void * target;
IOUSBCompletionActionWithTimeStamp action;
void * parameter;
} IOUSBCompletionWithTimeStamp;
typedef struct IOUSBIsocCompletion {
void * target;
IOUSBIsocCompletionAction action;
void * parameter;
} IOUSBIsocCompletion;
typedef struct IOUSBLowLatencyIsocCompletion {
void * target;
IOUSBLowLatencyIsocCompletionAction action;
void * parameter;
} IOUSBLowLatencyIsocCompletion;
#define iokit_usb_err(return) (sys_iokit|sub_iokit_usb|return)
#define kIOUSBUnknownPipeErr iokit_usb_err(0x61) // 0xe0004061 Pipe ref not recognized
#define kIOUSBTooManyPipesErr iokit_usb_err(0x60) // 0xe0004060 Too many pipes
#define kIOUSBNoAsyncPortErr iokit_usb_err(0x5f) // 0xe000405f no async port
#define kIOUSBNotEnoughPipesErr iokit_usb_err(0x5e) // 0xe000405e not enough pipes in interface
#define kIOUSBNotEnoughPowerErr iokit_usb_err(0x5d) // 0xe000405d not enough power for selected configuration
#define kIOUSBEndpointNotFound iokit_usb_err(0x57) // 0xe0004057 Endpoint Not found
#define kIOUSBConfigNotFound iokit_usb_err(0x56) // 0xe0004056 Configuration Not found
#define kIOUSBTransactionTimeout iokit_usb_err(0x51) // 0xe0004051 Transaction timed out
#define kIOUSBTransactionReturned iokit_usb_err(0x50) // 0xe0004050 The transaction has been returned to the caller
#define kIOUSBPipeStalled iokit_usb_err(0x4f) // 0xe000404f Pipe has stalled, error needs to be cleared
#define kIOUSBInterfaceNotFound iokit_usb_err(0x4e) // 0xe000404e Interface ref not recognized
#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
#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
#define kIOUSBHighSpeedSplitError iokit_usb_err(0x4b) // 0xe000404b Error to hub on high speed bus trying to do split transaction
#define kIOUSBSyncRequestOnWLThread iokit_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
#define kIOUSBDeviceNotHighSpeed iokit_usb_err(0x49) // 0xe0004049 The device is not a high speed device, so the EHCI driver returns an error
#define kIOUSBDevicePortWasNotSuspended iokit_usb_err(0x50) // 0xe0004050 Port was not suspended
#define kIOUSBLinkErr iokit_usb_err(0x10) // 0xe0004010
#define kIOUSBNotSent2Err iokit_usb_err(0x0f) // 0xe000400f Transaction not sent
#define kIOUSBNotSent1Err iokit_usb_err(0x0e) // 0xe000400e Transaction not sent
#define kIOUSBBufferUnderrunErr iokit_usb_err(0x0d) // 0xe000400d Buffer Underrun (Host hardware failure on data out, PCI busy?)
#define kIOUSBBufferOverrunErr iokit_usb_err(0x0c) // 0xe000400c Buffer Overrun (Host hardware failure on data out, PCI busy?)
#define kIOUSBReserved2Err iokit_usb_err(0x0b) // 0xe000400b Reserved
#define kIOUSBReserved1Err iokit_usb_err(0x0a) // 0xe000400a Reserved
#define kIOUSBWrongPIDErr iokit_usb_err(0x07) // 0xe0004007 Pipe stall, Bad or wrong PID
#define kIOUSBPIDCheckErr iokit_usb_err(0x06) // 0xe0004006 Pipe stall, PID CRC error
#define kIOUSBDataToggleErr iokit_usb_err(0x03) // 0xe0004003 Pipe stall, Bad data toggle
#define kIOUSBBitstufErr iokit_usb_err(0x02) // 0xe0004002 Pipe stall, bitstuffing
#define kIOUSBCRCErr iokit_usb_err(0x01) // 0xe0004001 Pipe stall, bad CRC
#define iokit_usb_msg(message) (UInt32)(sys_iokit|sub_iokit_usb|message)
#define kIOUSBMessageHubResetPort iokit_usb_msg(0x01) // 0xe0004001 Message sent to a hub to reset a particular port
#define kIOUSBMessageHubSuspendPort iokit_usb_msg(0x02) // 0xe0004002 Message sent to a hub to suspend a particular port
#define kIOUSBMessageHubResumePort iokit_usb_msg(0x03) // 0xe0004003 Message sent to a hub to resume a particular port
#define kIOUSBMessageHubIsDeviceConnected iokit_usb_msg(0x04) // 0xe0004004 Message sent to a hub to inquire whether a particular port has a device connected or not
#define kIOUSBMessageHubIsPortEnabled iokit_usb_msg(0x05) // 0xe0004005 Message sent to a hub to inquire whether a particular port is enabled or not
#define kIOUSBMessageHubReEnumeratePort iokit_usb_msg(0x06) // 0xe0004006 Message sent to a hub to reenumerate the device attached to a particular port
#define kIOUSBMessagePortHasBeenReset iokit_usb_msg(0x0a) // 0xe000400a Message sent to a device indicating that the port it is attached to has been reset
#define kIOUSBMessagePortHasBeenResumed iokit_usb_msg(0x0b) // 0xe000400b Message sent to a device indicating that the port it is attached to has been resumed
#define kIOUSBMessageHubPortClearTT iokit_usb_msg(0x0c) // 0xe000400c Message sent to a hub to clear the transaction translator
#define kIOUSBMessagePortHasBeenSuspended iokit_usb_msg(0x0d) // 0xe000400d Message sent to a device indicating that the port it is attached to has been suspended
#define kIOUSBMessageFromThirdParty iokit_usb_msg(0x0e) // 0xe000400e Message sent from a third party. Uses IOUSBThirdPartyParam to encode the sender's ID
#define kIOUSBMessagePortWasNotSuspended iokit_usb_msg(0x0f) // 0xe000400f Message indicating that the hub driver received a resume request for a port that was not suspended
#define kIOUSBMessageExpressCardCantWake iokit_usb_msg(0x10) // 0xe0004010 Message from a driver to a bus that an express card will disconnect on sleep and thus shouldn't wake
#define kIOUSBMessageCompositeDriverReconfigured iokit_usb_msg(0x11) // 0xe0004011 Message from the composite driver indicating that it has finished re-configuring the device after a reset
#define kIOUSBMessageHubSetPortRecoveryTime iokit_usb_msg(0x12) // 0xe0004012 Message sent to a hub to set the # of ms required when resuming a particular port
#define kIOUSBMessageOvercurrentCondition iokit_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
#define kIOUSBMessageNotEnoughPower iokit_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
struct IOUSBMouseData {
UInt16 buttons;
SInt16 XDelta;
SInt16 YDelta;
};
typedef struct IOUSBMouseData IOUSBMouseData;
typedef IOUSBMouseData * IOUSBMouseDataPtr;
struct IOUSBKeyboardData {
UInt16 keycount;
UInt16 usbkeycode[32];
};
typedef struct IOUSBKeyboardData IOUSBKeyboardData;
typedef IOUSBKeyboardData * IOUSBKeyboardDataPtr;
union IOUSBHIDData {
IOUSBKeyboardData kbd;
IOUSBMouseData mouse;
};
typedef union IOUSBHIDData IOUSBHIDData;
typedef IOUSBHIDData * IOUSBHIDDataPtr;
struct IOUSBDeviceDescriptor {
UInt8 bLength;
UInt8 bDescriptorType;
UInt16 bcdUSB;
UInt8 bDeviceClass;
UInt8 bDeviceSubClass;
UInt8 bDeviceProtocol;
UInt8 bMaxPacketSize0;
UInt16 idVendor;
UInt16 idProduct;
UInt16 bcdDevice;
UInt8 iManufacturer;
UInt8 iProduct;
UInt8 iSerialNumber;
UInt8 bNumConfigurations;
};
typedef struct IOUSBDeviceDescriptor IOUSBDeviceDescriptor;
typedef IOUSBDeviceDescriptor * IOUSBDeviceDescriptorPtr;
struct IOUSBDescriptorHeader {
UInt8 bLength;
UInt8 bDescriptorType;
};
typedef struct IOUSBDescriptorHeader IOUSBDescriptorHeader;
typedef IOUSBDescriptorHeader * IOUSBDescriptorHeaderPtr;
struct IOUSBConfigurationDescriptor {
UInt8 bLength;
UInt8 bDescriptorType;
UInt16 wTotalLength;
UInt8 bNumInterfaces;
UInt8 bConfigurationValue;
UInt8 iConfiguration;
UInt8 bmAttributes;
UInt8 MaxPower;
};
typedef struct IOUSBConfigurationDescriptor IOUSBConfigurationDescriptor;
typedef IOUSBConfigurationDescriptor * IOUSBConfigurationDescriptorPtr;
struct IOUSBConfigurationDescHeader {
UInt8 bLength;
UInt8 bDescriptorType;
UInt16 wTotalLength;
};
typedef struct IOUSBConfigurationDescHeader IOUSBConfigurationDescHeader;
typedef IOUSBConfigurationDescHeader * IOUSBConfigurationDescHeaderPtr;
struct IOUSBInterfaceDescriptor {
UInt8 bLength;
UInt8 bDescriptorType;
UInt8 bInterfaceNumber;
UInt8 bAlternateSetting;
UInt8 bNumEndpoints;
UInt8 bInterfaceClass;
UInt8 bInterfaceSubClass;
UInt8 bInterfaceProtocol;
UInt8 iInterface;
};
typedef struct IOUSBInterfaceDescriptor IOUSBInterfaceDescriptor;
typedef IOUSBInterfaceDescriptor * IOUSBInterfaceDescriptorPtr;
struct IOUSBEndpointDescriptor {
UInt8 bLength;
UInt8 bDescriptorType;
UInt8 bEndpointAddress;
UInt8 bmAttributes;
UInt16 wMaxPacketSize;
UInt8 bInterval;
};
typedef struct IOUSBEndpointDescriptor IOUSBEndpointDescriptor;
typedef IOUSBEndpointDescriptor * IOUSBEndpointDescriptorPtr;
enum{addPacketShift = 11}; #define mungeMaxPacketSize(w) ((w>1024)?(((w>>(addPacketShift))+1)*(w&((1<<addPacketShift)-1))):w)
struct IOUSBHIDDescriptor {
UInt8 descLen;
UInt8 descType;
UInt16 descVersNum;
UInt8 hidCountryCode;
UInt8 hidNumDescriptors;
UInt8 hidDescriptorType;
UInt8 hidDescriptorLengthLo;
UInt8 hidDescriptorLengthHi;
};
typedef struct IOUSBHIDDescriptor IOUSBHIDDescriptor;
typedef IOUSBHIDDescriptor *IOUSBHIDDescriptorPtr;
struct IOUSBHIDReportDesc {
UInt8 hidDescriptorType;
UInt8 hidDescriptorLengthLo;
UInt8 hidDescriptorLengthHi;
};
typedef struct IOUSBHIDReportDesc IOUSBHIDReportDesc;
typedef IOUSBHIDReportDesc * IOUSBHIDReportDescPtr;
#pragma pack(1)
struct IOUSBDeviceQualifierDescriptor
{
UInt8 bLength;
UInt8 bDescriptorType;
UInt16 bcdUSB;
UInt8 bDeviceClass;
UInt8 bDeviceSubClass;
UInt8 bDeviceProtocol;
UInt8 bMaxPacketSize0;
UInt8 bNumConfigurations;
UInt8 bReserved;
};
typedef struct IOUSBDeviceQualifierDescriptor IOUSBDeviceQualifierDescriptor;
typedef IOUSBDeviceQualifierDescriptor * IOUSBDeviceQualifierDescriptorPtr;
#pragma options align=reset
#pragma pack(1)
struct IOUSBDFUDescriptor
{
UInt8 bLength;
UInt8 bDescriptorType;
UInt8 bmAttributes;
UInt16 wDetachTimeout;
UInt16 wTransferSize;
};
typedef struct IOUSBDFUDescriptor IOUSBDFUDescriptor;
typedef IOUSBDFUDescriptor * IOUSBDFUDescriptorPtr;
#pragma options align=reset
#pragma pack(1)
struct IOUSBInterfaceAssociationDescriptor
{
UInt8 bLength;
UInt8 bDescriptorType;
UInt8 bFirstInterface;
UInt8 bInterfaceCount;
UInt8 bFunctionClass;
UInt8 bFunctionSubClass;
UInt8 bFunctionProtocol;
UInt8 iFunction;
};
typedef struct IOUSBInterfaceAssociationDescriptor IOUSBInterfaceAssociationDescriptor;
typedef IOUSBInterfaceAssociationDescriptor * IOUSBInterfaceAssociationDescriptorPtr;
#pragma options align=reset
typedef UInt16 USBStatus;
typedef USBStatus * USBStatusPtr;
enum {
kIOUSBAnyClass = 0xFFFF,
kIOUSBAnySubClass = 0xFFFF,
kIOUSBAnyProtocol = 0xFFFF,
kIOUSBAnyVendor = 0xFFFF,
kIOUSBAnyProduct = 0xFFFF
};
typedef struct IOUSBMatch {
UInt16 usbClass;
UInt16 usbSubClass;
UInt16 usbProtocol;
UInt16 usbVendor;
UInt16 usbProduct;
} IOUSBMatch;
typedef struct {
UInt8 type;
UInt8 direction;
UInt16 maxPacketSize;
UInt8 interval;
} IOUSBFindEndpointRequest;
typedef struct {
UInt8 bmRequestType;
UInt8 bRequest;
UInt16 wValue;
UInt16 wIndex;
UInt16 wLength;
void * pData;
UInt32 wLenDone;
} IOUSBDevRequest;
typedef IOUSBDevRequest * IOUSBDeviceRequestPtr;
typedef struct {
UInt8 bmRequestType;
UInt8 bRequest;
UInt16 wValue;
UInt16 wIndex;
UInt16 wLength;
void * pData;
UInt32 wLenDone;
UInt32 noDataTimeout;
UInt32 completionTimeout;
} IOUSBDevRequestTO;
enum
{
kUSBDefaultControlNoDataTimeoutMS = 5000,
kUSBDefaultControlCompletionTimeoutMS = 0
};
typedef struct
{
UInt32 pipeRef;
void * buf;
UInt32 size;
UInt32 noDataTimeout;
UInt32 completionTimeout;
} IOUSBBulkPipeReq;
#if KERNEL
typedef struct {
UInt8 bmRequestType;
UInt8 bRequest;
UInt16 wValue;
UInt16 wIndex;
UInt16 wLength;
IOMemoryDescriptor * pData;
UInt32 wLenDone;
} IOUSBDevRequestDesc;
enum {
kIOUSBInterfaceOpenAlt = 0x00010000
};
#endif
typedef struct {
UInt8 bmRequestType;
UInt8 bRequest;
UInt16 wValue;
UInt16 wIndex;
UInt16 wLength;
void * pData; UInt32 wLenDone; UInt8 pipeRef;
} IOUSBDevReqOOL;
typedef struct {
UInt8 bmRequestType;
UInt8 bRequest;
UInt16 wValue;
UInt16 wIndex;
UInt16 wLength;
void * pData; UInt32 wLenDone; UInt8 pipeRef;
UInt32 noDataTimeout;
UInt32 completionTimeout;
} IOUSBDevReqOOLTO;
typedef struct {
UInt32 fPipe;
void *fBuffer;
UInt32 fBufSize;
UInt64 fStartFrame;
UInt32 fNumFrames;
IOUSBIsocFrame *fFrameCounts;
} IOUSBIsocStruct;
struct IOUSBLowLatencyIsocStruct {
UInt32 fPipe;
UInt32 fBufSize;
UInt64 fStartFrame;
UInt32 fNumFrames;
UInt32 fUpdateFrequency;
UInt32 fDataBufferCookie;
UInt32 fDataBufferOffset;
UInt32 fFrameListBufferCookie;
UInt32 fFrameListBufferOffset;
};
typedef struct IOUSBLowLatencyIsocStruct IOUSBLowLatencyIsocStruct;
typedef struct {
UInt64 frame;
AbsoluteTime timeStamp;
} IOUSBGetFrameStruct;
typedef struct {
UInt16 bInterfaceClass; UInt16 bInterfaceSubClass; UInt16 bInterfaceProtocol; UInt16 bAlternateSetting; } IOUSBFindInterfaceRequest;
enum {
kIOUSBFindInterfaceDontCare = 0xFFFF
};
enum {
kIOUSBVendorIDAppleComputer = 0x05AC
};
enum {
kUSBDeviceSpeedLow = 0,
kUSBDeviceSpeedFull = 1,
kUSBDeviceSpeedHigh = 2
};
enum {
kUSBFullSpeedMicrosecondsInFrame = 1000,
kUSBHighSpeedMicrosecondsInFrame = 125
};
enum {
kUSBLowLatencyIsochTransferKey = 'llit' };
typedef struct LowLatencyUserBufferInfo LowLatencyUserBufferInfo;
struct LowLatencyUserBufferInfo {
UInt32 cookie;
void * bufferAddress;
IOByteCount bufferSize;
UInt32 bufferType;
Boolean isPrepared;
LowLatencyUserBufferInfo * nextBuffer;
};
typedef struct LowLatencyUserBufferInfoV2 LowLatencyUserBufferInfoV2;
struct LowLatencyUserBufferInfoV2
{
UInt32 cookie;
void * bufferAddress;
IOByteCount bufferSize;
UInt32 bufferType;
Boolean isPrepared;
void * mappedUHCIAddress;
LowLatencyUserBufferInfoV2 * nextBuffer;
};
typedef struct LowLatencyUserBufferInfoV3 LowLatencyUserBufferInfoV3;
struct LowLatencyUserBufferInfoV3
{
uint64_t cookie;
mach_vm_address_t bufferAddress;
mach_vm_size_t bufferSize;
uint64_t bufferType;
uint64_t isPrepared;
mach_vm_address_t mappedUHCIAddress;
LowLatencyUserBufferInfoV3 * nextBuffer;
};
typedef enum {
kUSBLowLatencyWriteBuffer = 0,
kUSBLowLatencyReadBuffer = 1,
kUSBLowLatencyFrameListBuffer = 2
} USBLowLatencyBufferType;
enum {
kUSBNoUserNotificationType = 0,
kUSBNotEnoughPowerNotificationType = 1,
kUSBIndividualOverCurrentNotificationType = 2,
kUSBGangOverCurrentNotificationType = 3
};
#define kUSBDevicePropertySpeed "Device Speed"
#define kUSBDevicePropertyBusPowerAvailable "Bus Power Available"
#define kUSBDevicePropertyAddress "USB Address"
#define kUSBDevicePropertyLocationID "locationID"
#define kUSBProductIDMask "idProductMask"
#define kUSBPreferredConfiguration "Preferred Configuration"
#define kUSBSuspendPort "kSuspendPort"
#define kUSBExpressCardCantWake "ExpressCardCantWake"
#define kUSBControllerNeedsContiguousMemoryForIsoch "Need contiguous memory for isoch"
#define kUSBHubDontAllowLowPower "kUSBHubDontAllowLowPower"
#define kUSBDeviceResumeRecoveryTime "kUSBDeviceResumeRecoveryTime"
#define kUSBOutOfSpecMPSOK "Out of spec MPS OK"
typedef enum {
kUSBAddExtraResetTimeBit = 31,
kUSBAddExtraResetTimeMask = ( 1 << kUSBAddExtraResetTimeBit)
} USBReEnumerateOptions;
typedef enum {
kUSBInformationDeviceIsCaptiveBit = 0,
kUSBInformationDeviceIsAttachedToRootHubBit = 1,
kUSBInformationDeviceIsInternalBit = 2,
kUSBInformationDeviceIsConnectedBit = 3,
kUSBInformationDeviceIsEnabledBit = 4,
kUSBInformationDeviceIsSuspendedBit = 5,
kUSBInformationDeviceIsInResetBit = 6,
kUSBInformationDeviceOvercurrentBit = 7,
kUSBInformationDevicePortIsInTestModeBit = 8,
kUSBInformationDeviceIsRootHub = 9,
kUSBInformationRootHubisBuiltIn = 10,
kUSBInformationDeviceIsCaptiveMask = (1 << kUSBInformationDeviceIsCaptiveBit),
kUSBInformationDeviceIsAttachedToRootHubMask = (1 << kUSBInformationDeviceIsAttachedToRootHubBit),
kUSBInformationDeviceIsInternalMask = (1 << kUSBInformationDeviceIsInternalBit),
kUSBInformationDeviceIsConnectedMask = (1 << kUSBInformationDeviceIsConnectedBit),
kUSBInformationDeviceIsEnabledMask = (1 << kUSBInformationDeviceIsEnabledBit),
kUSBInformationDeviceIsSuspendedMask = (1 << kUSBInformationDeviceIsSuspendedBit),
kUSBInformationDeviceIsInResetMask = (1 << kUSBInformationDeviceIsInResetBit),
kUSBInformationDeviceOvercurrentMask = (1 << kUSBInformationDeviceOvercurrentBit),
kUSBInformationDevicePortIsInTestModeMask = (1 << kUSBInformationDevicePortIsInTestModeBit),
kUSBInformationDeviceIsRootHubMask = (1 << kUSBInformationDeviceIsRootHub),
kUSBInformationRootHubisBuiltInMask = (1 << kUSBInformationRootHubisBuiltIn)
} USBDeviceInformationBits;
typedef enum {
kUSBPowerDuringSleep = 0,
kUSBPowerDuringWake = 1
} USBPowerRequestTypes;
#define kAppleCurrentAvailable "AAPL,current-available"
#define kAppleCurrentInSleep "AAPL,current-in-sleep"
#define kAppleCurrentExtra "AAPL,current-extra"
#define kAppleInternalUSBDevice "AAPL,device-internal"
#define kUSBBusID "AAPL,bus-id"
#ifdef __cplusplus
}
#endif
#endif