ADC Home > Reference Library > Reference > Hardware & Drivers > I/O Kit Framework Reference
|
USB.h |
Include Path : | <IOKit/usb> |
Path: | /System/Library/Frameworks/IOKit.framework/Versions/A/Headers/usb/USB.h |
Includes: |
This header contains the public interfaces to the USB implementation in Mac OS X. It includes definitions and structures that are used in the USB APIs in Mac OS X, both in the kernel and in user space.
IOUSBCompletion |
typedef struct IOUSBCompletion { void *target; IOUSBCompletionAction action; void *parameter; } IOUSBCompletion;
target
The target to pass to the action function.
action
The function to call.
parameter
The parameter to pass to the action function.
Struct specifying action to perform when a USB I/O completes.
IOUSBCompletionAction |
typedef void ( *IOUSBCompletionAction)( void *target, void *parameter, IOReturn status, UInt32 bufferSizeRemaining);
target
The target specified in the IOUSBCompletion struct.
parameter
The parameter specified in the IOUSBCompletion struct.
status
Completion status.
bufferSizeRemaining
Bytes left to be transferred.
Function called when USB I/O completes.
IOUSBCompletionActionWithTimeStamp |
typedef void ( *IOUSBCompletionActionWithTimeStamp)( void *target, void *parameter, IOReturn status, UInt32 bufferSizeRemaining, AbsoluteTime timeStamp);
target
The target specified in the IOUSBCompletion struct.
parameter
The parameter specified in the IOUSBCompletion struct.
status
Completion status.
bufferSizeRemaining
Bytes left to be transferred.
timeStamp
Time at which the transaction was processed.
Function called when USB I/O completes.
IOUSBCompletionWithTimeStamp |
typedef struct IOUSBCompletionWithTimeStamp { void *target; IOUSBCompletionActionWithTimeStamp action; void *parameter; } IOUSBCompletionWithTimeStamp;
target
The target to pass to the action function.
action
The function to call.
parameter
The parameter to pass to the action function.
Struct specifying action to perform when a USB I/O completes.
IOUSBConfigurationDescHeader |
typedef struct IOUSBConfigurationDescHeader IOUSBConfigurationDescHeader;
Header of a IOUSBConfigurationDescriptor. Used to get the total length of the descriptor.
IOUSBConfigurationDescriptor |
typedef struct IOUSBConfigurationDescriptor IOUSBConfigurationDescriptor;
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. See the USB Specification at http://www.usb.org.
IOUSBDescriptorHeader |
typedef struct IOUSBDescriptorHeader IOUSBDescriptorHeader;
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.
IOUSBDeviceDescriptor |
typedef struct IOUSBDeviceDescriptor IOUSBDeviceDescriptor;
Descriptor for a USB Device. See the USB Specification at http://www.usb.org.
IOUSBDeviceQualifierDescriptor |
typedef struct IOUSBDeviceQualifierDescriptor IOUSBDeviceQualifierDescriptor;
USB Device Qualifier Descriptor. See the USB Specification at http://www.usb.org.
IOUSBDevRequest |
typedef struct { UInt8 bmRequestType; UInt8 bRequest; UInt16 wValue; UInt16 wIndex; UInt16 wLength; void *pData; UInt32 wLenDone; } IOUSBDevRequest;
bmRequestType
An encoded value that contains the direction, type, and recipient of the request. Use the USBmakebmRequestType macro to encode this field.
bRequest
Request code
wValue
16 bit parameter for request, host endianess
wIndex
16 bit parameter for request, host endianess
wLength
Length of data part of request, 16 bits, host endianess
pData
Pointer to data for request - data returned in bus endianess
wLenDone
Set by standard completion routine to number of data bytes actually transferred
Parameter block for control requests, using a simple pointer for the data to be transferred.
IOUSBDevRequestDesc |
typedef struct { UInt8 bmRequestType; UInt8 bRequest; UInt16 wValue; UInt16 wIndex; UInt16 wLength; IOMemoryDescriptor *pData; UInt32 wLenDone; } IOUSBDevRequestDesc;
bmRequestType
An encoded value that contains the direction, type, and recipient of the request. Use the USBmakebmRequestType macro to encode this field.
bRequest
Request code
wValue
16 bit parameter for request, host endianess
wIndex
16 bit parameter for request, host endianess
wLength
Length of data part of request, 16 bits, host endianess
pData
Pointer to memory descriptor for data for request - data returned in bus endianess
wLenDone
Set by standard completion routine to number of data bytes actually transferred
Parameter block for control requests, using a memory descriptor for the data to be transferred. Only available in the kernel.
IOUSBDevRequestTO |
typedef struct { UInt8 bmRequestType; UInt8 bRequest; UInt16 wValue; UInt16 wIndex; UInt16 wLength; void *pData; UInt32 wLenDone; UInt32 noDataTimeout; UInt32 completionTimeout; } IOUSBDevRequestTO;
bmRequestType
An encoded value that contains the direction, type, and recipient of the request. Use the USBmakebmRequestType macro to encode this field.
bRequest
Request code
wValue
16 bit parameter for request, host endianess
wIndex
16 bit parameter for request, host endianess
wLength
Length of data part of request, 16 bits, host endianess
pData
Pointer to data for request - data returned in bus endianess
wLenDone
Set by standard completion routine to number of data bytes actually transferred
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.
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
Parameter block for control requests with timeouts, using a simple pointer for the data to be transferred. Same as a IOUSBDevRequest except for the two extra timeout fields.
IOUSBDFUDescriptor |
typedef struct IOUSBDFUDescriptor IOUSBDFUDescriptor;
USB Device Firmware Update Descriptor. See the USB Device Firmware Update Specification at http://www.usb.org.
IOUSBEndpointDescriptor |
typedef struct IOUSBEndpointDescriptor IOUSBEndpointDescriptor;
Descriptor for a USB Endpoint. See the USB Specification at http://www.usb.org.
IOUSBFindEndpointRequest |
typedef struct { UInt8 type; UInt8 direction; UInt16 maxPacketSize; UInt8 interval; } IOUSBFindEndpointRequest;
type
Type of endpoint: kUSBControl, kUSBIsoc, kUSBBulk, kUSBInterrupt, kUSBAnyType. If kUSBAnyType is specified, this field is treated as a don't care.
direction
Direction of endpoint: kUSBOut, kUSBIn, kUSBAnyDirn. If kUSBAnyDirn is specified, this field is treated as a don't care.
maxPacketSize
maximum packet size of endpoint.
interval
Polling interval in mSec for endpoint.
Struct used to find endpoints of an interface type and direction are used to match endpoints, type, direction, maxPacketSize and interval are updated with the properties of the found endpoint.
IOUSBFindInterfaceRequest |
typedef struct { UInt16 bInterfaceClass; // requested class UInt16 bInterfaceSubClass; // requested subclass UInt16 bInterfaceProtocol; // requested protocol UInt16 bAlternateSetting; // requested alt setting } IOUSBFindInterfaceRequest;
Structure used with FindNextInterface.
IOUSBGetFrameStruct |
typedef struct { UInt64 frame; AbsoluteTime timeStamp; } IOUSBGetFrameStruct;
frame
frame number
timeStamp
AbsoluteTime when the frame was updated
Structure used from user space to return the frame number and a timestamp on when the frame register was read.
IOUSBHIDDescriptor |
typedef struct IOUSBHIDDescriptor IOUSBHIDDescriptor;
USB HID Descriptor. See the USB HID Specification at http://www.usb.org. (This structure should have used the #pragma pack(1) compiler directive to get byte alignment.
IOUSBHIDReportDesc |
typedef struct IOUSBHIDReportDesc IOUSBHIDReportDesc;
USB HID Report Descriptor header. See the USB HID Specification at http://www.usb.org. (This structure should have used the #pragma pack(1) compiler directive to get byte alignment.
IOUSBInterfaceAssociationDescriptor |
typedef struct IOUSBInterfaceAssociationDescriptor IOUSBInterfaceAssociationDescriptor;
USB Inerface Association Descriptor. ECN to the USB 2.0 Spec. See the USB Specification at http://www.usb.org.
IOUSBInterfaceDescriptor |
typedef struct IOUSBInterfaceDescriptor IOUSBInterfaceDescriptor;
Descriptor for a USB Interface. See the USB Specification at http://www.usb.org.
IOUSBIsocCompletion |
typedef struct IOUSBIsocCompletion { void *target; IOUSBIsocCompletionAction action; void *parameter; } IOUSBIsocCompletion;
target
The target to pass to the action function.
action
The function to call.
parameter
The parameter to pass to the action function.
Struct specifying action to perform when an Isochronous USB I/O completes.
IOUSBIsocCompletionAction |
typedef void ( *IOUSBIsocCompletionAction)( void *target, void *parameter, IOReturn status, IOUSBIsocFrame *pFrames);
target
The target specified in the IOUSBIsocCompletionn struct.
parameter
The parameter specified in the IOUSBIsocCompletion struct.
status
Completion status.
pFrames
Pointer to the frame list containing the status for each frame transferred.
Function called when Isochronous USB I/O completes.
IOUSBIsocFrame |
typedef struct IOUSBIsocFrame { IOReturn frStatus; UInt16 frReqCount; UInt16 frActCount; } IOUSBIsocFrame;
frStatus
Returns status associated with the frame.
frReqCount
Input specifiying how many bytes to read or write.
frActCount
Actual # of bytes transferred.
Structure used to encode information about each isoc frame.
IOUSBLowLatencyIsocCompletion |
typedef struct IOUSBLowLatencyIsocCompletion { void *target; IOUSBLowLatencyIsocCompletionAction action; void *parameter; } IOUSBLowLatencyIsocCompletion;
target
The target to pass to the action function.
action
The function to call.
parameter
The parameter to pass to the action function.
Struct specifying action to perform when an Low Latency Isochronous USB I/O completes.
IOUSBLowLatencyIsocCompletionAction |
typedef void ( *IOUSBLowLatencyIsocCompletionAction)( void *target, void *parameter, IOReturn status, IOUSBLowLatencyIsocFrame *pFrames);
target
The target specified in the IOUSBLowLatencyIsocCompletion struct.
parameter
The parameter specified in the IOUSBLowLatencyIsocCompletion struct.
status
Completion status.
pFrames
Pointer to the low latency frame list containing the status for each frame transferred.
Function called when Low Latency Isochronous USB I/O completes.
IOUSBLowLatencyIsocFrame |
typedef struct IOUSBLowLatencyIsocFrame IOUSBLowLatencyIsocFrame;
frStatus
Returns status associated with the frame.
frReqCount
Input specifiying how many bytes to read or write.
frActCount
Actual # of bytes transferred.
frTimeStamp
Time stamp that indicates time when frame was procesed.
Structure used to encode information about each isoc frame that is processed at hardware interrupt time (low latency).
USBLowLatencyBufferType |
typedef enum { kUSBLowLatencyWriteBuffer = 0, kUSBLowLatencyReadBuffer = 1, kUSBLowLatencyFrameListBuffer = 2 } USBLowLatencyBufferType;
kUSBLowLatencyWriteBuffer
The buffer will be used to write data out to a device.
kUSBLowLatencyReadBuffer
The buffer will be used to read data from a device.
kUSBLowLatencyFrameListBuffer
The buffer will be used for a low latency isoch frame list.
Used to specify what kind of buffer to create when calling LowLatencyCreateBuffer().
USBReEnumerateOptions |
typedef enum { kUSBAddExtraResetTimeBit = 31, kUSBAddExtraResetTimeMask = ( 1 << kUSBAddExtraResetTimeBit) } USBReEnumerateOptions;
kUSBAddExtraResetTimeBit
Setting this bit will cause the Hub driver to wait 100ms before addressing the device after the reset following the re-enumeration.
Options used when calling ReEnumerateDevice.
USBStatus |
typedef UInt16 USBStatus;
Type used to get a DeviceStatus as a single quantity.
IOUSBConfigurationDescHeader |
struct IOUSBConfigurationDescHeader { UInt8 bLength; UInt8 bDescriptorType; UInt16 wTotalLength; };
Header of a IOUSBConfigurationDescriptor. Used to get the total length of the descriptor.
IOUSBConfigurationDescriptor |
struct IOUSBConfigurationDescriptor { UInt8 bLength; UInt8 bDescriptorType; UInt16 wTotalLength; UInt8 bNumInterfaces; UInt8 bConfigurationValue; UInt8 iConfiguration; UInt8 bmAttributes; UInt8 MaxPower; };
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. See the USB Specification at http://www.usb.org.
IOUSBDescriptorHeader |
struct IOUSBDescriptorHeader { UInt8 bLength; UInt8 bDescriptorType; };
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.
IOUSBDeviceDescriptor |
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; };
Descriptor for a USB Device. See the USB Specification at http://www.usb.org.
IOUSBDeviceQualifierDescriptor |
struct IOUSBDeviceQualifierDescriptor { UInt8 bLength; UInt8 bDescriptorType; UInt16 bcdUSB; UInt8 bDeviceClass; UInt8 bDeviceSubClass; UInt8 bDeviceProtocol; UInt8 bMaxPacketSize0; UInt8 bNumConfigurations; UInt8 bReserved; };
USB Device Qualifier Descriptor. See the USB Specification at http://www.usb.org.
IOUSBDFUDescriptor |
struct IOUSBDFUDescriptor { UInt8 bLength; UInt8 bDescriptorType; UInt8 bmAttributes; UInt16 wDetachTimeout; UInt16 wTransferSize; };
USB Device Firmware Update Descriptor. See the USB Device Firmware Update Specification at http://www.usb.org.
IOUSBEndpointDescriptor |
struct IOUSBEndpointDescriptor { UInt8 bLength; UInt8 bDescriptorType; UInt8 bEndpointAddress; UInt8 bmAttributes; UInt16 wMaxPacketSize; UInt8 bInterval; };
Descriptor for a USB Endpoint. See the USB Specification at http://www.usb.org.
IOUSBHIDDescriptor |
struct IOUSBHIDDescriptor { UInt8 descLen; UInt8 descType; UInt16 descVersNum; UInt8 hidCountryCode; UInt8 hidNumDescriptors; UInt8 hidDescriptorType; UInt8 hidDescriptorLengthLo; UInt8 hidDescriptorLengthHi; };
USB HID Descriptor. See the USB HID Specification at http://www.usb.org. (This structure should have used the #pragma pack(1) compiler directive to get byte alignment.
IOUSBHIDReportDesc |
struct IOUSBHIDReportDesc { UInt8 hidDescriptorType; UInt8 hidDescriptorLengthLo; UInt8 hidDescriptorLengthHi; };
USB HID Report Descriptor header. See the USB HID Specification at http://www.usb.org. (This structure should have used the #pragma pack(1) compiler directive to get byte alignment.
IOUSBInterfaceAssociationDescriptor |
struct IOUSBInterfaceAssociationDescriptor { UInt8 bLength; UInt8 bDescriptorType; UInt8 bFirstInterface; UInt8 bInterfaceCount; UInt8 bFunctionClass; UInt8 bFunctionSubClass; UInt8 bFunctionProtocol; UInt8 iFunction; };
USB Inerface Association Descriptor. ECN to the USB 2.0 Spec. See the USB Specification at http://www.usb.org.
IOUSBInterfaceDescriptor |
struct IOUSBInterfaceDescriptor { UInt8 bLength; UInt8 bDescriptorType; UInt8 bInterfaceNumber; UInt8 bAlternateSetting; UInt8 bNumEndpoints; UInt8 bInterfaceClass; UInt8 bInterfaceSubClass; UInt8 bInterfaceProtocol; UInt8 iInterface; };
Descriptor for a USB Interface. See the USB Specification at http://www.usb.org.
IOUSBLowLatencyIsocFrame |
struct IOUSBLowLatencyIsocFrame { IOReturn frStatus; UInt16 frReqCount; UInt16 frActCount; AbsoluteTime frTimeStamp; };
frStatus
Returns status associated with the frame.
frReqCount
Input specifiying how many bytes to read or write.
frActCount
Actual # of bytes transferred.
frTimeStamp
Time stamp that indicates time when frame was procesed.
Structure used to encode information about each isoc frame that is processed at hardware interrupt time (low latency).
bRequest Shifts and Masks |
enum { kUSBRqDirnShift = 7, kUSBRqDirnMask = 1, kUSBRqTypeShift = 5, kUSBRqTypeMask = 3, kUSBRqRecipientMask = 0X1F };
These are used to create the macro to encode the bRequest filed of a Device Request
Default timeout values |
enum { kUSBDefaultControlNoDataTimeoutMS = 5000, kUSBDefaultControlCompletionTimeoutMS = 0 };
default values used for data and completion timeouts.
IOOptionBits |
enum { kIOUSBInterfaceOpenAlt = 0x00010000 };
kIOUSBInterfaceOpenAlt
Open the alternate interface specified when creating the interface.
Parameter passed to an IOService::open() call.
kIOUSBFindInterfaceDontCare |
enum { kIOUSBFindInterfaceDontCare = 0xFFFF };
Constant that can be used for the fields of IOUSBFindInterfaceRequest to specify that they should not be matched.
kIOUSBVendorIDAppleComputer |
enum { kIOUSBVendorIDAppleComputer = 0x05AC };
USB Vendor ID for Apple Computer, Inc.
kUSBMaxIsocFrameReqCount |
enum { kUSBMaxFSIsocEndpointReqCount = 1023, // max size (bytes) of any one Isoc frame for 1 FS endpoint kUSBMaxHSIsocEndpointReqCount = 3072, // max size (bytes) of any one Isoc frame for 1 HS endpoint kUSBMaxHSIsocFrameCount = 7168 // max size (bytes) of all Isoc transfers in a HS frame };
Maximum size in bytes allowed for one Isochronous frame
MicrosecondsInFrame |
enum { kUSBFullSpeedMicrosecondsInFrame = 1000, kUSBHighSpeedMicrosecondsInFrame = 125 };
kUSBFullSpeedMicrosecondsInFrame
The device is attached to a bus running at full speed (1 ms / frame).
kUSBHighSpeedMicrosecondsInFrame
The device is attached to a bus running at high speed (125 microseconds / frame).
Returns the number of microseconds in a USB frame.
Miscellaneous Constants |
enum { kUSBDeviceIDShift = 7, kUSBMaxDevices = 128, kUSBMaxDevice = kUSBMaxDevices-1, kUSBDeviceIDMask = 0x7f, kUSBPipeIDMask = 0xf, kUSBMaxPipes = 32, // In and Out pipes can have same pipe number. kUSBInterfaceIDShift = 8, kUSBMaxInterfaces = 1 << kUSBInterfaceIDShift, kUSBInterfaceIDMask = kUSBMaxInterfaces-1, kUSBEndPtShift = 7, kUSBDeviceMask = ( ( 1 << kUSBEndPtShift) -1), kUSBNoPipeIdx = -1 };
Standard Device Requests |
enum { kClearDeviceFeature = ( ( ( UInt16)kUSBRqClearFeature << 8) + ( ( UInt16) kUSBDevice + ( ( UInt16) kUSBStandard << kUSBRqTypeShift) + ( ( UInt16) kUSBOut << kUSBRqDirnShift))), kClearInterfaceFeature = ( ( ( UInt16)kUSBRqClearFeature << 8) + ( ( UInt16) kUSBInterface + ( ( UInt16) kUSBStandard << kUSBRqTypeShift) + ( ( UInt16) kUSBOut << kUSBRqDirnShift))), kClearEndpointFeature = ( ( ( UInt16)kUSBRqClearFeature << 8) + ( ( UInt16) kUSBEndpoint + ( ( UInt16) kUSBStandard << kUSBRqTypeShift) + ( ( UInt16) kUSBOut << kUSBRqDirnShift))), kGetConfiguration = ( ( ( UInt16)kUSBRqGetConfig << 8) + ( ( UInt16) kUSBDevice + ( ( UInt16) kUSBStandard << kUSBRqTypeShift) + ( ( UInt16) kUSBIn << kUSBRqDirnShift))), kGetDescriptor = ( ( ( UInt16)kUSBRqGetDescriptor << 8) + ( ( UInt16) kUSBDevice + ( ( UInt16) kUSBStandard << kUSBRqTypeShift) + ( ( UInt16) kUSBIn << kUSBRqDirnShift))), kGetInterface = ( ( ( UInt16)kUSBRqGetInterface << 8) + ( ( UInt16) kUSBInterface + ( ( UInt16) kUSBStandard << kUSBRqTypeShift) + ( ( UInt16) kUSBIn << kUSBRqDirnShift))), kGetDeviceStatus = ( ( ( UInt16)kUSBRqGetStatus << 8) + ( ( UInt16) kUSBDevice + ( ( UInt16) kUSBStandard << kUSBRqTypeShift) + ( ( UInt16) kUSBIn << kUSBRqDirnShift))), kGetInterfaceStatus = ( ( ( UInt16)kUSBRqGetStatus << 8) + ( ( UInt16) kUSBInterface + ( ( UInt16) kUSBStandard << kUSBRqTypeShift) + ( ( UInt16) kUSBIn << kUSBRqDirnShift))), kGetEndpointStatus = ( ( ( UInt16)kUSBRqGetStatus << 8) + ( ( UInt16) kUSBEndpoint + ( ( UInt16) kUSBStandard << kUSBRqTypeShift) + ( ( UInt16) kUSBIn << kUSBRqDirnShift))), kSetAddress = ( ( ( UInt16)kUSBRqSetAddress << 8) + ( ( UInt16) kUSBDevice + ( ( UInt16) kUSBStandard << kUSBRqTypeShift) + ( ( UInt16) kUSBOut << kUSBRqDirnShift))), kSetConfiguration = ( ( ( UInt16)kUSBRqSetConfig << 8) + ( ( UInt16) kUSBDevice + ( ( UInt16) kUSBStandard << kUSBRqTypeShift) + ( ( UInt16) kUSBOut << kUSBRqDirnShift))), kSetDescriptor = ( ( ( UInt16)kUSBRqSetDescriptor << 8) + ( ( UInt16) kUSBDevice + ( ( UInt16) kUSBStandard << kUSBRqTypeShift) + ( ( UInt16) kUSBOut << kUSBRqDirnShift))), kSetDeviceFeature = ( ( ( UInt16)kUSBRqSetFeature << 8) + ( ( UInt16) kUSBDevice + ( ( UInt16) kUSBStandard << kUSBRqTypeShift) + ( ( UInt16) kUSBOut << kUSBRqDirnShift))), kSetInterfaceFeature = ( ( ( UInt16)kUSBRqSetFeature << 8) + ( ( UInt16) kUSBInterface + ( ( UInt16) kUSBStandard << kUSBRqTypeShift) + ( ( UInt16) kUSBOut << kUSBRqDirnShift))), kSetEndpointFeature = ( ( ( UInt16)kUSBRqSetFeature << 8) + ( ( UInt16) kUSBEndpoint + ( ( UInt16) kUSBStandard << kUSBRqTypeShift) + ( ( UInt16) kUSBOut << kUSBRqDirnShift))), kSetInterface = ( ( ( UInt16)kUSBRqSetInterface << 8) + ( ( UInt16) kUSBInterface + ( ( UInt16) kUSBStandard << kUSBRqTypeShift) + ( ( UInt16) kUSBOut << kUSBRqDirnShift))), kSyncFrame = ( ( ( UInt16)kUSBRqSyncFrame << 8) + ( ( UInt16) kUSBEndpoint + ( ( UInt16) kUSBStandard << kUSBRqTypeShift) + ( ( UInt16) kUSBIn << kUSBRqDirnShift))), };
Encoding of the standard device requests.
bmRequestType bRequest wValue wIndex wLength Data 00000000B CLEAR_FEATURE Feature Zero Zero None (device) 00000001B Feature Interface Zero None (Interface) 00000010B Feature Endpoint Zero None (Endpoint) 10000000B GET_CONFIGURATION Zero Zero One Configuration 10000000B GET_DESCRIPTOR Type LangID Length Descriptor 10000001B GET_INTERFACE Zero Interface One Alternate 10000000B GET_STATUS Zero Zero Two status (device) 10000001B Zero Interface Two status (Interface) 10000010B Zero Endpoint Two status (Endpoint) 00000000B SET_ADDRESS Address Zero Zero None 00000000B SET_CONFIGURATION Configuration Zero Zero None 00000000B SET_DESCRIPTOR Type LangID Length Descriptor 00000000B SET_FEATURE Feature Zero Zero None (device) 00000001B Feature Interface Zero None (Interface) 00000010B Feature Endpoint Zero None (Endpoint) 00000001B SET_INTERFACE Alternate Interface Zero None 10000010B SYNCH_FRAME Zero Endpoint Two Frame Number
USBDeviceSpeed |
enum { kUSBDeviceSpeedLow = 0, kUSBDeviceSpeedFull = 1, kUSBDeviceSpeedHigh = 2 };
kUSBDeviceSpeedLow
The device a low speed device.
kUSBDeviceSpeedFull
The device a full speed device.
kUSBDeviceSpeedHigh
The device a high speed device.
Returns the speed of a particular USB device.
EncodeRequest |
#define EncodeRequest(request, direction, type, recipient) \ (((UInt16)request << 8) + \ ((UInt16)recipient + \ ((UInt16)type << kUSBRqTypeShift) + \ ((UInt16)direction << kUSBRqDirnShift)))
Macro that encodes the bRequest and bRequestType fields of a IOUSBDevRequest into a single value. It is useful when one needs to know what type of request the IOUSBDevRequest encodes and simplifies comparisons.
HostToUSBLong |
#define HostToUSBLong NXSwapHostLongToLittle
The USB APIs use a convention of specifying parameters in the host order. The USB spec specifies that multi-byte items should be 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 in-kernel use and for user space use.
HostToUSBWord |
#define HostToUSBWord NXSwapHostShortToLittle
The USB APIs use a convention of specifying parameters in the host order. The USB spec specifies that multi-byte items should be 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 in-kernel use and for user space use.
iokit_usb_err |
#define iokit_usb_err(return)
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.
iokit_usb_msg |
#define iokit_usb_msg(message)
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.
IOUSBFamily error codes |
#define iokit_usb_err(return)
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.
IOUSBFamily hardware error codes |
#define kIOUSBLinkErr
These errors are returned by the OHCI controller. The # in parenthesis (xx) corresponds to the OHCI Completion Code. For the following Completion codes, we return a generic IOKit error instead of a USB specific error.
Completion Code Error Returned Description 9 kIOReturnUnderrun (Data Underrun) EP returned less data than max packet size 8 kIOReturnOverrun (Data Overrun) Packet too large or more data than buffer 5 kIOReturnNotResponding Device Not responding 4 kIOUSBPipeStalled Endpoint returned a STALL PID
IOUSBFamily message codes |
#define iokit_usb_msg(message)
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.
kCallInterfaceOpenWithGate |
#define kCallInterfaceOpenWithGate "kCallInterfaceOpenWithGate"
If the USB Device has this property, drivers for any of its interfaces will have their handleOpen method called while holding the workloop gate.
Kernel Endian conversion definitions |
#define USBToHostWord OSSwapLittleToHostInt16
The USB APIs use a convention of specifying parameters in the host order. The USB spec specifies that multi-byte items should be 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 in-kernel use and for user space use.
kIOUSBLinkErr |
#define kIOUSBLinkErr
These errors are returned by the OHCI controller. The # in parenthesis (xx) corresponds to the OHCI Completion Code. For the following Completion codes, we return a generic IOKit error instead of a USB specific error.
Completion Code Error Returned Description 9 kIOReturnUnderrun (Data Underrun) EP returned less data than max packet size 8 kIOReturnOverrun (Data Overrun) Packet too large or more data than buffer 5 kIOReturnNotResponding Device Not responding 4 kIOUSBPipeStalled Endpoint returned a STALL PID
kUSBDevicePropertySpeed |
#define kUSBDevicePropertySpeed "Device Speed"
Useful property names in USB land.
Property Definitions |
#define kUSBDevicePropertySpeed "Device Speed"
Useful property names in USB land.
USBmakebmRequestType |
#define USBmakebmRequestType(direction, type, recipient) \ ((direction & kUSBRqDirnMask) << kUSBRqDirnShift) | \ ((type & kUSBRqTypeMask) << kUSBRqTypeShift) | \ (recipient & kUSBRqRecipientMask)
direction
Direction of data. Use either kUSBIn or kUSBOut.
type
Request type. Use kUSBStandard, kUSBClass, or kUSBVendor.
recipient
Recipient target of request. Use kUSBDevice, kUSBInterface, kUSBEndpoint, or kUSBOther.
Macro to encode the bRequest field of a Device Request. Use it to construct an IOUSBDevRequest.
USBToHostLong |
#define USBToHostLong NXSwapLittleLongToHost
The USB APIs use a convention of specifying parameters in the host order. The USB spec specifies that multi-byte items should be 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 in-kernel use and for user space use.
USBToHostWord |
#define USBToHostWord OSSwapLittleToHostInt16
The USB APIs use a convention of specifying parameters in the host order. The USB spec specifies that multi-byte items should be 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 in-kernel use and for user space use.
USBToHostWord |
#define USBToHostWord NXSwapLittleShortToHost
The USB APIs use a convention of specifying parameters in the host order. The USB spec specifies that multi-byte items should be 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 in-kernel use and for user space use.
User Space Endian conversion definitions |
#define USBToHostWord NXSwapLittleShortToHost #define HostToUSBWord NXSwapHostShortToLittle #define USBToHostLong NXSwapLittleLongToHost #define HostToUSBLong NXSwapHostLongToLittle #endif
The USB APIs use a convention of specifying parameters in the host order. The USB spec specifies that multi-byte items should be 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 in-kernel use and for user space use.
|
Last Updated: 2009-02-23