Chameleon

Chameleon Svn Source Tree

Root/branches/ErmaC/Trunk/i386/include/IOKit/usb/USBSpec.h

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

Archive Download this file

Revision: 2045