Chameleon

Chameleon Svn Source Tree

Root/tags/2.3/i386/include/IOKit/usb/USBSpec.h

Source at commit 2862 created 7 years 24 days ago.
By ifabio, Tag 2.3 release, bump svn to 2.4
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
25/*
26 * Constants that both OS9 and OSX want to define, and whose values are
27 * specified by the USB Standard.
28 * Put in a seperate file so they can be included if the OS9 include file isn't already
29 * included.
30 */
31#ifndef _USBSPEC_H
32#define _USBSPEC_H
33
34#ifdef __cplusplus
35extern "C" {
36#endif
37
38 /*!
39 @header USBSpec.h
40 @abstract Constants and definitions of parameters that are used in communcating with USB devices and interfaces.
41 @discussion
42 */
43
44 /*!
45 @enum Endpoint type
46 @discussion Used in IOUSBFindEndpointRequest's type field
47 */
48enum {
49 kUSBControl = 0,
50 kUSBIsoc = 1,
51 kUSBBulk = 2,
52 kUSBInterrupt = 3,
53 kUSBAnyType = 0xFF
54};
55
56 /*!
57 @enum Endpoint direction
58 @discussion Used in IOUSBFindEndpointRequest's direction field
59 */
60enum {
61 kUSBOut = 0,
62 kUSBIn = 1,
63 kUSBNone = 2,
64 kUSBAnyDirn = 3
65};
66
67 /*!
68 @enum Device Request Type
69 @discussion This type is encoded in the bmRequestType field of a Device Request. It specifies the type of request: standard, class or vendor specific.
70 */
71enum {
72 kUSBStandard = 0,
73 kUSBClass = 1,
74 kUSBVendor = 2
75};
76
77 /*!
78 @enum Device Request Recipient
79 @discussion This recipient is encoded in the bmRequestType field of a Device Request. It specifies the type of recipient for a request: the device, the interface, or an endpoint.
80 */
81enum {
82 kUSBDevice = 0,
83 kUSBInterface = 1,
84 kUSBEndpoint = 2,
85 kUSBOther = 3
86};
87
88 /*!
89 @enum Device Request
90 @discussion Specifies values for the bRequest field of a Device Request.
91 */
92enum {
93 kUSBRqGetStatus = 0,
94 kUSBRqClearFeature = 1,
95 kUSBRqGetState = 2,
96 kUSBRqSetFeature = 3,
97 kUSBRqReserved2 = 4,
98 kUSBRqSetAddress = 5,
99 kUSBRqGetDescriptor = 6,
100 kUSBRqSetDescriptor = 7,
101 kUSBRqGetConfig = 8,
102 kUSBRqSetConfig = 9,
103 kUSBRqGetInterface = 10,
104 kUSBRqSetInterface = 11,
105 kUSBRqSyncFrame = 12
106};
107
108 /*!
109 @enum USB Descriptors
110 @discussion Specifies values for diffent descriptor types.
111 */
112enum {
113 kUSBAnyDesc = 0, // Wildcard for searches
114 kUSBDeviceDesc = 1,
115 kUSBConfDesc = 2,
116 kUSBStringDesc = 3,
117 kUSBInterfaceDesc = 4,
118 kUSBEndpointDesc = 5,
119 kUSBDeviceQualifierDesc = 6,
120 kUSBOtherSpeedConfDesc = 7,
121 kUSBInterfacePowerDesc = 8,
122 kUSBOnTheGoDesc = 9,
123 kUSDebugDesc = 10,
124 kUSBInterfaceAssociationDesc = 11,
125 kUSBHIDDesc = 0x21,
126 kUSBReportDesc = 0x22,
127 kUSBPhysicalDesc = 0x23,
128 kUSBHUBDesc = 0x29
129};
130
131 /*!
132 @enum Feature Selectors
133 @discussion Used with SET/CLEAR_FEATURE requests.
134 */
135enum {
136 kUSBFeatureEndpointStall = 0,
137 kUSBFeatureDeviceRemoteWakeup = 1
138};
139
140 /*!
141 @enum USB Power constants
142 @discussion Constants relating to USB Power.
143 */
144enum {
145 kUSB100mAAvailable = 50,
146 kUSB500mAAvailable = 250,
147 kUSB100mA = 50,
148 kUSBAtrBusPowered = 0x80,
149 kUSBAtrSelfPowered = 0x40,
150 kUSBAtrRemoteWakeup = 0x20
151};
152
153 /*!
154 @enum USB Release constants
155 @discussion Constants relating to USB releases as found in the bcdUSB field of the Device Descriptor.
156 */
157enum {
158 kUSBRel10 = 0x0100,
159 kUSBRel11 = 0x0110,
160 kUSBRel20 = 0x0200
161};
162
163
164 /*!
165 @enum HID requests
166 @discussion Constants for HID requests.
167 */
168enum {
169 kHIDRqGetReport = 1,
170 kHIDRqGetIdle = 2,
171 kHIDRqGetProtocol = 3,
172 kHIDRqSetReport = 9,
173 kHIDRqSetIdle = 10,
174 kHIDRqSetProtocol = 11
175};
176
177 /*!
178 @enum HID report types
179 @discussion Constants for the three kinds of HID reports.
180 */
181enum {
182 kHIDRtInputReport = 1,
183 kHIDRtOutputReport = 2,
184 kHIDRtFeatureReport = 3
185};
186
187
188 /*!
189 @enum HID Protocol
190 @discussion Used in the SET_PROTOCOL device request
191 */
192enum {
193 kHIDBootProtocolValue = 0,
194 kHIDReportProtocolValue = 1
195};
196
197
198
199enum {
200 kUSBCapsLockKey = 0x39,
201 kUSBNumLockKey = 0x53,
202 kUSBScrollLockKey = 0x47
203};
204
205/*!
206@enum Device Class Codes
207 @discussion Constants for USB Device classes (bDeviceClass).
208 */
209enum {
210 kUSBCompositeClass = 0,
211 kUSBCommClass = 2,// Deprecated
212 kUSBCommunicationClass= 2,
213 kUSBHubClass = 9,
214 kUSBDataClass = 10,
215kUSBPersonalHealthcareClass= 15,
216 kUSBDiagnosticClass= 220,
217 kUSBWirelessControllerClass = 224,
218 kUSBMiscellaneousClass= 239,
219 kUSBApplicationSpecificClass = 254,
220 kUSBVendorSpecificClass = 255
221};
222
223/*!
224@enum Interface Class
225 @discussion Constants for Interface classes (bInterfaceClass).
226 */
227enum {
228 kUSBAudioClass= 1,// Deprecated
229 kUSBAudioInterfaceClass= 1,
230
231 kUSBCommunicationControlInterfaceClass= 2,
232 kUSBCommunicationDataInterfaceClass= 10,
233
234 kUSBHIDClass= 3,
235 kUSBHIDInterfaceClass= 3,
236
237 kUSBPhysicalInterfaceClass= 5,
238
239 kUSBImageInterfaceClass= 6,
240
241 kUSBPrintingClass= 7,// Deprecated
242 kUSBPrintingInterfaceClass= 7,
243
244 kUSBMassStorageClass= 8,// Deprecated
245 kUSBMassStorageInterfaceClass= 8,
246
247 kUSBChipSmartCardInterfaceClass= 11,
248
249 kUSBContentSecurityInterfaceClass = 13,
250
251 kUSBVideoInterfaceClass= 14,
252
253kUSBPersonalHealthcareInterfaceClass= 15,
254
255 kUSBDiagnosticDeviceInterfaceClass = 220,
256
257 kUSBWirelessControllerInterfaceClass= 224,
258
259 kUSBApplicationSpecificInterfaceClass= 254,
260
261 kUSBVendorSpecificInterfaceClass = 255
262};
263
264// Obsolete
265enum {
266
267 kUSBDisplayClass = 4,// Obsolete
268};
269
270/*!
271 @enum Interface SubClass
272 @discussion Constants for USB Interface SubClasses (bInterfaceSubClass).
273*/
274enum {
275 kUSBCompositeSubClass = 0,
276
277 kUSBHubSubClass = 0,
278
279 // For the kUSBAudioInterfaceClass
280 //
281 kUSBAudioControlSubClass= 0x01,
282 kUSBAudioStreamingSubClass= 0x02,
283 kUSBMIDIStreamingSubClass= 0x03,
284
285 // For the kUSBApplicationSpecificInterfaceClass
286 //
287 kUSBDFUSubClass = 0x01,
288 kUSBIrDABridgeSubClass = 0x02,
289 kUSBTestMeasurementSubClass= 0x03,
290
291 // For the kUSBMassStorageInterfaceClass
292 //
293 kUSBMassStorageRBCSubClass = 0x01,
294 kUSBMassStorageATAPISubClass = 0x02,
295 kUSBMassStorageQIC157SubClass = 0x03,
296 kUSBMassStorageUFISubClass = 0x04,
297 kUSBMassStorageSFF8070iSubClass = 0x05,
298 kUSBMassStorageSCSISubClass = 0x06,
299
300 // For the kUSBHIDInterfaceClass
301 //
302 kUSBHIDBootInterfaceSubClass = 0x01,
303
304 // For the kUSBCommunicationDataInterfaceClass
305 //
306 kUSBCommDirectLineSubClass = 0x01,
307 kUSBCommAbstractSubClass = 0x02,
308 kUSBCommTelephoneSubClass = 0x03,
309 kUSBCommMultiChannelSubClass = 0x04,
310 kUSBCommCAPISubClass = 0x05,
311 kUSBCommEthernetNetworkingSubClass = 0x06,
312 kUSBATMNetworkingSubClass = 0x07,
313
314 // For the kUSBDiagnosticDeviceInterfaceClass
315 //
316 kUSBReprogrammableDiagnosticSubClass= 0x01,
317
318 // For the kUSBWirelessControllerInterfaceClass
319 //
320 kUSBRFControllerSubClass= 0x01,
321
322 // For the kUSBMiscellaneousClass
323 //
324 kUSBCommonClassSubClass= 0x02,
325
326 // For the kUSBVideoInterfaceClass
327 //
328 kUSBVideoControlSubClass= 0x01,
329 kUSBVideoStreamingSubClass= 0x02,
330 kUSBVideoInterfaceCollectionSubClass = 0x03
331
332};
333
334/*!
335@enumInterface Protocol
336 @discussion Reported in the bInterfaceProtocol field of the Interface Descriptor.
337 */
338enum {
339
340 // For kUSBHIDInterfaceClass
341 //
342 kHIDNoInterfaceProtocol= 0,
343 kHIDKeyboardInterfaceProtocol= 1,
344 kHIDMouseInterfaceProtocol= 2,
345 kUSBVendorSpecificProtocol= 0xff,
346
347 // For kUSBDiagnosticDeviceInterfaceClass
348 //
349 kUSB2ComplianceDeviceProtocol= 0x01,
350
351 // For kUSBWirelessControllerInterfaceClass
352 //
353 kUSBBluetoothProgrammingInterfaceProtocol= 0x01,
354
355 // For kUSBMiscellaneousClass
356 //
357 KUSBInterfaceAssociationDescriptorProtocol= 0x01
358
359};
360
361
362/*!
363 @enum DFU Class Attributes
364 @discussion
365*/
366enum {
367 kUSBDFUAttributesMask = 0x07,
368 kUSBDFUCanDownloadBit = 0,
369 kUSBDFUCanUploadBit = 1,
370 kUSBDFUManifestationTolerantBit = 2
371};
372
373/*!
374 @enum Printer Class Requests
375 @discussion The bRequest parameter for Printing Class Sepcific Requests
376 */
377enum {
378kUSPrintingClassGetDeviceID= 0,
379kUSPrintingClassGePortStatus= 1,
380kUSPrintingClassSoftReset= 2
381};
382
383/*!
384@enum Endpoint Descriptor bits
385 @discussion Bit definitions for endpoint descriptor fields
386 */
387enum {
388 kUSBbEndpointAddressMask= 0x0f,
389 kUSBbEndpointDirectionBit= 7,
390 kUSBbEndpointDirectionMask= ( 1 << kUSBbEndpointDirectionBit ),
391 kUSBEndpointDirectionOut= 0x00,
392 kUSBEndpointDirectionIn= 0x80,
393 kUSBEndpointbmAttributesTransferTypeMask= 0x03,
394 kUSBEndpointbmAttributesSynchronizationTypeMask= 0x0c,
395 kUSBEndpointbmAttributesSynchronizationTypeShift= 2,
396 kUSBEndpointbmAttributesUsageTypeMask= 0x30,
397 kUSBEndpointbmAttributesUsageTypeShift= 4
398};
399
400/*!
401 @defineblock USB Descriptor and IORegistry constants
402 @discussion Various constants used to describe the fields in the various USB Device Descriptors and IORegistry names used for some of those fields
403
404 @definekUSBDeviceClassThe field in the USB Device Descriptor corresponding to the device class
405 @definekUSBDeviceSubClassThe field in the USB Device Descriptor corresponding to the device sub class
406 @definekUSBDeviceProtocolThe field in the USB Device Descriptor corresponding to the device protocol
407 @definekUSBDeviceMaxPacketSizeThe field in the USB Device Descriptor corresponding to the maximum packet size for endpoint 0
408 @definekUSBVendorIDThe field in the USB Device Descriptor corresponding to the device USB Vendor ID
409 @definekUSBVendorNameDeprecated. Use kUSBVendorID
410 @definekUSBProductIDThe field in the USB Device Descriptor corresponding to the device USB Product ID
411 @definekUSBProductNameDeprecated. Use kUSBProductID
412 @definekUSBDeviceReleaseNumberThe field in the USB Device Descriptor corresponding to the device release version
413 @definekUSBManufacturerStringIndexThe field in the USB Device Descriptor corresponding to the index for the manufacturer's string
414 @definekUSBProductStringIndexThe field in the USB Device Descriptor corresponding to the index for the product name's string
415 @definekUSBSerialNumberStringIndexThe field in the USB Device Descriptor corresponding to the index for the serial number's string
416 @definekUSBDeviceNumConfigsThe field in the USB Configuration Descriptor corresponding to the number of configurations
417 @definekUSBInterfaceNumberThe field in the USB Configuration Descriptor corresponding to the number of configurations
418 @definekUSBAlternateSettingThe field in the USB Configuration Descriptor corresponding to the number of configurations
419 @definekUSBNumEndpointsThe field in the USB Configuration Descriptor corresponding to the number of configurations
420 @definekUSBInterfaceClassThe field in the USB Interface Descriptor corresponding to the interface class
421 @definekUSBInterfaceSubClassThe field in the USB Interface Descriptor corresponding to the interface sub class
422 @definekUSBInterfaceProtocolThe field in the USB Interface Descriptor corresponding to the interface protocol
423 @definekUSBInterfaceStringIndexThe field in the USB Interface Descriptor corresponding to the index for the interface name's string
424 @definekUSBConfigurationValueThe field in the USB Interface Descriptor corresponding to the configuration
425 @definekUSBProductStringIORegistry key for the device's USB Product string
426 @definekUSBVendorStringIORegistry key for the device's USB manufacturer string
427 @definekUSBSerialNumberStringIORegistry key for the device's USB serial number string
428 @definekUSB1284DeviceIDIORegistry key for the 1284 Device ID of a printer
429
430 */
431#define kUSBDeviceClass "bDeviceClass"
432#define kUSBDeviceSubClass "bDeviceSubClass"
433#define kUSBDeviceProtocol "bDeviceProtocol"
434#define kUSBDeviceMaxPacketSize "bMaxPacketSize0"
435#define kUSBVendorID "idVendor" // good name
436#define kUSBVendorName kUSBVendorID // bad name - keep for backward compatibility
437#define kUSBProductID "idProduct" // good name
438#define kUSBProductName kUSBProductID // bad name - keep for backward compatibility
439#define kUSBDeviceReleaseNumber "bcdDevice"
440#define kUSBManufacturerStringIndex "iManufacturer"
441#define kUSBProductStringIndex "iProduct"
442#define kUSBSerialNumberStringIndex "iSerialNumber"
443#define kUSBDeviceNumConfigs "bNumConfigurations"
444#define kUSBInterfaceNumber "bInterfaceNumber"
445#define kUSBAlternateSetting "bAlternateSetting"
446#define kUSBNumEndpoints "bNumEndpoints"
447#define kUSBInterfaceClass "bInterfaceClass"
448#define kUSBInterfaceSubClass "bInterfaceSubClass"
449#define kUSBInterfaceProtocol "bInterfaceProtocol"
450#define kUSBInterfaceStringIndex "iInterface"
451#define kUSBConfigurationValue "bConfigurationValue"
452#define kUSBProductString"USB Product Name"
453#define kUSBVendorString"USB Vendor Name"
454#define kUSBSerialNumberString"USB Serial Number"
455#define kUSB1284DeviceID"1284 Device ID"
456 /*! @/defineblock */
457
458/*!
459 @enum Apple USB Vendor ID
460 @discussion Apple's vendor ID, assigned by the USB-IF
461*/
462enum {
463kAppleVendorID = 0x05AC
464};
465
466#ifdef __cplusplus
467}
468#endif
469
470#endif /* _USBSPEC_H */
471

Archive Download this file

Revision: 2862