1. Trang chủ
  2. » Công Nghệ Thông Tin

USB Complete fourth- P14 pptx

10 283 0

Đang tải... (xem toàn văn)

THÔNG TIN TÀI LIỆU

Nội dung

Chapter 4 106 Most device classes specify the class at the interface level rather than at the device level. Assigning functions to interfaces enables a single configuration to support multiple functions. When two or more interfaces in a configuration are associated with the same function, the interface association descriptor tells the host which interfaces are associated. For example, a video-camera function may use one interface to control the camera and another to carry video data. The Interface Association Descriptor ECN says that the descriptor must be sup- ported by future implementations of devices that use multiple interfaces to manage a single device function. Devices that comply with the video-class and audio 2.0 specifications must use interface association descriptors. Class specifi- cations that predate the IAD don’t require it. For example, the audio 1.0 class specification defines a class-specific descriptor to associate audio interfaces in a function. Hosts that don’t support the IAD ignore it. Windows began support- ing the descriptor with Windows XP SP2. In USB 3.0 devices, every function with multiple interfaces must use an IAD. To enable hosts to identify devices that use the Interface Association descriptor, the device descriptor should contain the following values: bDeviceClass = EFh (miscellaneous device class) bDeviceSubClass = 02h (common class) bDeviceProtocol = 01h (interface association descriptor) These codes together form the Multi-interface Function Device Class Codes. Table 4-7: The interface association descriptor can link multiple interfaces to a single function. 1HHUGV FGEKOCN (KGNF 5K\G D[VGU &GUETKRVKQP 0 bLength 1 Descriptor size in bytes (08h) 1 bDescriptorType 1 The constant Interface Association (0Bh) 2 bFirstInterface 1 Number identifying the first interface associated with the function 3 bInterfaceCount 1 The number of contiguous interfaces associated with the function 4 bFunctionClass 1 Class code 5 bFunctionSubClass 1 Subclass code 6 bFunctionProtocol 1 Protocol code 8 iFunction 1 Index of string descriptor for the function Enumeration: How the Host Learns about Devices 107 A host retrieves an interface association descriptor as one of the subordinate descriptors sent in response to a request for a configuration descriptor. The IAD precedes the interface descriptors that the IAD specifies. bFirstInterface identifies the interface number of the first of multiple interfaces associated with a function. The interface number is the value of bInterface- Number in the interface descriptor. The interface numbers of associated inter- faces must be contiguous. bInterfaceCount equals the number of contiguous interfaces associated with the function. bFunctionClass is a class code for the function shared by the associated inter- faces. For classes that don’t specify a value to use, the preferred value is the bInterfaceClass value from the descriptor of the first associated interface. Values from 01h–FEh are reserved for USB-defined classes. FFh indicates a ven- dor-defined class. Zero is not allowed. bFunctionSubClass is a subclass code for the function shared by the associated interfaces. For classes that don’t specify a value to use, the preferred value is the bInterfaceSubClass value from the descriptor of the first associated interface. bInterfaceProtocol is a protocol code for the function shared by the associated interfaces. For classes that don’t specify a value to use, the preferred value is the bInterfaceProtocol value from the descriptor of the first associated interface. iInterface is an index to a string that describes the function. This value is zero if there is no string descriptor. +PVGTHCEG The interface descriptor provides information about a function or feature that a device implements. The descriptor contains class, subclass, and protocol infor- mation and the number of endpoints the interface uses (Table 4-8). A configuration can have multiple interfaces that are active at the same time. The interfaces may be associated with a single function or they may be unre- lated. Each interface has its own interface descriptor and subordinate descrip- tors. Each of these interfaces can also have one or more alternate interface settings. The settings are mutually exclusive; only one is active at a time. Each setting has an interface descriptor and subordinate descriptors as needed. Devices that use isochronous transfers have alternate interface settings because the default interface can request no isochronous bandwidth. Chapter 4 108 A host retrieves interface descriptors as subordinate descriptors sent in response to a request for a configuration descriptor. bInterfaceNumber identifies the interface. In a composite device, a configura- tion has multiple interfaces that are active at the same time. Each interface must have a descriptor with a unique value in this field. The default interface is 00h. bAlternateSetting identifies the default interface setting or an alternate setting. For each bInterfaceNumber, the device provides an interface descriptor with bAlternateSetting = 00h. This is the default setting. A descriptor for an alter- nate setting has the same value in bInterfaceNumber, a unique value in bAlter- nateSetting, and different values as needed in the descriptor’s final five bytes. For each bInterfaceNumber, only one bAlternateSetting is active at a time. The alternate settings enable the host to request an interface with different band- width or other requirements and capabilities. The Get Interface request retrieves the currently active bAlternateSetting. The Set Interface request selects the bAlternateSetting that a specific bInterfaceNumber should use. bNumEndpoints equals the number of endpoints the interface supports in addition to endpoint zero. For a device that supports only endpoint zero, this field is zero. bInterfaceClass is similar to bDeviceClass in the device descriptor, but for devices with a class specified by the interface. Table 4-9 shows defined codes. Table 4-8: The interface descriptor specifies the number of subordinate endpoints and may specify a USB class. 1HHUGV FGEKOCN (KGNF 5K\G D[VGU &GUETKRVKQP 0 bLength 1 Descriptor size in bytes (09h) 1 bDescriptorType 1 The constant Interface (04h) 2 bInterfaceNumber 1 Number identifying this interface 3 bAlternateSetting 1 A number that identifies a descriptor with alternate settings for this bInterfaceNumber. 4 bNumEndpoints 1 Number of endpoints supported not counting endpoint zero 5 bInterfaceClass 1 Class code 6 bInterfaceSubclass 1 Subclass code 7 bInterfaceProtocol 1 Protocol code 8 iInterface 1 Index of string descriptor for the interface Enumeration: How the Host Learns about Devices 109 Table 4-9: The bInterfaceClass field in the interface descriptor can name a class the interface belongs to. %NCUU%QFG JGZCFGEKOCN &GUETKRVKQP 00 Reserved 01 Audio 02 Communications device class: communication interface 03 Human interface device 05 Physical 06 Image 07 Printer 08 Mass storage 09 Hub 0A Communications device class: data interface 0B Smart Card 0D Content Security 0E Video 0F Personal healthcare device (can instead be declared at the device level) DC Diagnostic device (can instead be declared at the device level) bInterfaceSubclass= 01h, bInterfaceProtocol = 01h. USB2 compliance device E0 Wireless controller bInterfaceSubclass = 01h bInterfaceProtocol = 01h: Bluetooth programming interface (can also be declared at the device level) bInterfaceProtocol = 02h: UWB Radio control interface (Wireless USB) bInterface bInterfaceProtocol = 03h: remote NDIS bInterfaceSubclass = 02h. Host and device wire adapters (Wireless USB) EF Miscellaneous bInterfaceSubclass = 01h bInterfaceProtocol = 01h: active sync bInterfaceProtocol = 02h: Palm sync bInterfaceSubclass = 03h. Cable based association framework (Wireless USB) FE Application specific bInterfaceSubclass = 01h. Device firmware upgrade bInterfaceSubclass = 02h. IrDA bridge bInterfaceSubclass = 03h. Test and measurement FF Vendor specific (can instead be declared at the device level) Chapter 4 110 Values 01h–FEh are reserved for USB-defined classes. FFh indicates a ven- dor-defined class. Zero is reserved. bInterfaceSubClass is similar to bDeviceSubClass in the device descriptor, but for devices with a class defined by the interface. If bInterfaceClass equals 00h, bInterfaceSubclass must equal 00h. If bInterfaceClass is in the range 01h–FEh, bInterfaceSubclass equals 00h or a code defined for the interface’s class. FFh indicates a vendor-defined subclass. bInterfaceProtocol is similar to bDeviceProtocol in the device descriptor, but for devices whose class is defined by the interface. The field can specify a proto- col for the selected bInterfaceClass and bInterfaceSubClass. If bInterfaceClass is in the range 01h–FEh, bInterfaceProtocol must equal 00h or a code defined for the interface’s class. FFh indicates a vendor-defined protocol. iInterface is an index to a string that describes the interface. This value is zero if there is no string descriptor. 'PFRQKPV Each endpoint specified in an interface descriptor has an endpoint descriptor (Table 4-10). Endpoint zero never has a descriptor because every device must support endpoint zero, the device descriptor contains the maximum packet size, and the USB specification defines everything else about the endpoint. A host retrieves endpoint descriptors as subordinate descriptors sent in response to a request for a configuration descriptor. Devices in the audio 1.0 class extend the endpoint descriptor with two addi- tional bytes of audio-specific information. This is the only allowed extension that changes the length of a standard descriptor type. Where needed elsewhere, class and other specifications should define separate, subordinate descriptors that return extended information. For example, USB 3.0 defines the endpoint companion descriptor to return SuperSpeed-specific endpoint information. bEndpointAddress specifies the endpoint number and direction. Bits 3 0 are the endpoint number. Low-speed devices can have a maximum of 3 endpoint numbers (usually in the range 0–2), while full- and high-speed devices can have 16 (0–15). Bit 7 is the direction, with OUT = 0 and IN = 1. Bits 6 4 are unused and must be zero. bmAttributes sets bits 1 0 to specify the type of transfer the endpoint sup- ports: 00=control, 01=isochronous, 10=bulk, 11=interrupt. Bits 7 6 are reserved and must be zero. The functions of the remaining bits vary with the endpoint type and speed. Enumeration: How the Host Learns about Devices 111 For isochronous endpoints, bits 5 2 can indicate a synchronization type and usage type of data or feedback. For SuperSpeed interrupt endpoints, bits 5 4 indicate a usage type of Notifica- tion or Periodic. Interrupt endpoints have two primary uses with differing needs from the host. Some endpoints require quick response or frequent data transfers in consecutive intervals. For example, users don’t want a noticeable delay before seeing the effect of pressing a key or moving a mouse. These end- points should specify the Periodic usage. Other endpoints provide infrequent notifications or data where timing is less critical. An example is hub notifica- tions that inform the host of device attachment, removal, or other events. The endpoints should specify the Notification usage. The host can use the Usage type in deciding whether to place a port in a low-power state that requires more time to exit. Any undefined bits are reserved. wMaxPacketSize specifies the maximum number of data bytes the endpoint can transfer in a transaction. The allowed values vary with the device speed and type of transfer. For USB 2.0, bits 10 0 are the maximum packet size with a range of 0–1024. For USB 1.x, the range is 0–1023. In USB 2.0, bits 12 11 indicate how many additional transactions per microframe a high-speed interrupt or isochronous endpoint supports: 00 = no additional transactions (total of 1 / microframe), 01 = one additional (total of 2 / microframe), 10 = 2 additional (total of 3 / microframe), 11 = reserved. In USB 1.x, these bits were reserved and zero. Bits 15 13 are reserved and zero. For SuperSpeed bulk endpoints, the value is 1024. For SuperSpeed interrupt and isochronous endpoints, the allowed values depend on the value of bMax- Burst in the SuperSpeed endpoint companion descriptor. If bMaxBurst = 0, Table 4-10: The endpoint descriptor provides information about an endpoint address. 1HHUGV FGEKOCN (KGNF 5K\G D[VGU &GUETKRVKQP 0 bLength 1 Descriptor size in bytes (07h) 1 bDescriptorType 1 The constant Endpoint (05h) 2 bEndpointAddress 1 Endpoint number and direction 3 bmAttributes 1 Transfer type and supplementary information 4 wMaxPacketSize 2 Maximum packet size supported 6 bInterval 1 Service interval or NAK rate Chapter 4 112 wMaxPacketSize can be in the range 0–1024 for isochronous endpoints and 1– 1024 for interrupt endpoints. If bMaxBurst > 0, wMaxPacketSize = 1024. bInterval specifies the service interval for interrupt and isochronous endpoints. The service interval is a period within which the host must reserve time for an endpoint’s transactions. The period is an integral number of frames (low and full speed), microframes (high speed), or bus intervals (SuperSpeed). The allowed range and usage of bInterval varies with the device’s speed, the transfer type, and the USB version. For low-speed interrupt endpoints, bInterval is the maximum latency in ms in the range 10–255. For all full-speed interrupt endpoints and for full-speed iso- chronous endpoints on 1.x devices, the interval equals bInterval in ms. For interrupt endpoints, the value may range from 1–255. For isochronous end- points in USB 1.x devices, the value must be 1. For isochronous endpoints in full-speed USB 2.0 devices, values 1–16 are allowed, and the interval is 2 bInterval-1 in ms, allowing a range from 1 ms to 32.768 seconds. For high-speed and SuperSpeed endpoints, the value is in units of 125 µs. The value for interrupt and isochronous endpoints may range from 1–16, and the interval is calculated as 2 bInterval-1 , allowing a range from 125 µs to 4.096 sec- onds. For high-speed bulk and control OUT endpoints, the field can contain a maxi- mum NAK rate used for compliance purposes only. Devices typically set the field to zero. For other bulk transfers and control transfers, the value is reserved. 5WRGT5RGGF'PFRQKPV%QORCPKQP Every SuperSpeed endpoint has a companion descriptor to support SuperSpeed capabilities. A host retrieves endpoint companion descriptors as subordinate descriptors sent in response to a request for a configuration descriptor when the configuration has one or more endpoints. bMaxBurst specifies the maximum number of packets the endpoint can send or receive in a burst minus one. A value of zero means one packet per burst. The maximum value is 15, indicating 16 packets per burst. A Data Packet in a burst can transmit without waiting for an acknowledgement of the previous Data Packet in the burst. bmAttributes provides information specific to bulk and isochronous end- points. For bulk endpoints, bits 4 0 are a MaxStreams value that indicates the maximum number of streams the endpoint supports. Zero means the endpoint Enumeration: How the Host Learns about Devices 113 doesn’t define streams. For values 1–16, the number of streams equals 2 MaxStreams for a maximum value of 65,536. For isochronous endpoints, bits 1 0 are a Mult value that indicates, along with bMaxBurst, the maximum number of packets in a service interval. The maxi- mum number of packets equals (bMaxBurst + 1) × (Mult + 1). Valid values for Mult are 0–2. The maximum allowed number of packets thus equals (15 + 1) × (2 + 1), or 48. wBytesPerInterval is the maximum number of bytes a periodic interrupt or isochronous endpoint expects to transfer per service interval. 5VTKPI A string descriptor (Table 4-12) contains descriptive text. Other descriptors can contain indexes to strings that describe the manufacturer, product, serial num- ber, configuration, and interface. Class- and vendor-specific descriptors can contain indexes to additional string descriptors. Support for string descriptors is optional, though a class may require them. A host retrieves a string descriptor by sending a Get Descriptor request with the high byte of the Setup transac- tion’s wValue field equal to 03h. When the host requests a string descriptor, the low byte of the wValue field is an index value. An index value of zero has the special function of requesting language IDs, while other index values request strings. Table 4-11: A SuperSpeed endpoint has a companion descriptor to provide a maximum burst value. 1HHUGV FGEKOCN (KGNF 5K\G D[VGU &GUETKRVKQP 0 bLength 1 Descriptor size in bytes (06h) 1bDescriptorType1The constant SUPERSPEED_USB_ENDPOINT_COMPANION (30h) 2 bMaxBurst 1 The maximum number of packets the endpoint can send or receive as part of a burst - 1. 3 bmAttributes 1 For bulk endpoints, the maximum number of streams. For isochronous endpoints, the maximum number of packets in a service interval. 4 wBytesPerInterval 2 For periodic interrupt and isochronous endpoints, the maximum number of bytes the endpoint expects to transfer per service interval. Chapter 4 114 wLANGID[0 n] is valid for string descriptor zero only. This field contains one or more 16-bit language ID codes that indicate the languages the strings are available in. U.S. English (0409h) is likely to be the only code supported by an operating system. The wLANGID value must be valid for any string to be valid. Devices that return no string descriptors must not return an array of lan- guage IDs. The USB-IF’s website has a list of defined USB language IDs. bString is valid for string descriptors one and higher and contains a string in Unicode UTF-16LE format. In this format, most characters are encoded as 16-bit code units with the low byte of the code unit transmitted first. For U.S. English, the low byte of the code unit is the character’s ASCII code. For exam- ple, the character A transmits as the byte 41h followed by 00h. Some rarely used characters are encoded as surrogate pairs consisting of two 16-bit code units. The strings are not null-terminated. $KPCT[1DLGEV5VQTGCPF&GXKEG%CRCDKNKV[ Some devices use additional descriptors to store information that is specific to a technology or a device function. To provide a standard way to provide this information, the Wireless USB specification introduced two new descriptor types. The USB 2.0 Link Power Management Addendum and USB 3.0 specifi- cation also incorporate these types. The binary device object store (BOS) descriptor (Table 4-13) functions as a base descriptor for one or more related device capability descriptors. A device capability descriptor (Table 4-14) provides information about a specific capabil- ity or technology. These are the defined device capability descriptors: • Wireless USB provides information about wireless features. • USB 2.0 Extension indicates that a device supports the Link Power Man- agement protocol when operating at low, full, or high speed. All Super- Table 4-12: A string descriptor identifies a supported language or stores a string of text. 1HHUGV FGEKOCN (KGNF 5K\G D[VGU &GUETKRVKQP 0 bLength 1 Descriptor size in bytes (variable) 1 bDescriptorType 1 The constant String (03h) 2bSTRING or wLANGID varies For string descriptor zero, an array of one or more Language Identifier codes. For other string descriptors, a Unicode UTF-16LE string. Enumeration: How the Host Learns about Devices 115 Speed devices must provide this descriptor and must support Link Power Management when operating at high speed. USB 2.0 devices that support Link Power Management also provide this descriptor. • SuperSpeed USB specifies which speeds the device supports, the lowest speed that provides full functionality, and power-management capabilities. All SuperSpeed devices must provide this descriptor. • Container ID provides a 128-bit universally unique identifier (UUID) that identifies the device instance. The descriptor is mandatory for USB 3.0 hubs and optional for other SuperSpeed devices. A host retrieves a BOS descriptor and all of its subordinate device capability descriptors by sending a Get Descriptor request with the high byte of the Setup transaction’s wValue field set to 0Fh and the wLength field equal to the descrip- tor’s wTotalLength value. There is no request for reading only a device capabil- ity descriptor. 1VJGT5VCPFCTF&GUETKRVQTU Other standard descriptor types are OTG and debug. Devices that support On-The-Go’s Host Negotiation Protocol (HNP) or Ses- sion Request Protocol (SRP) have an OTG descriptor that indicates the sup- ported protocols. Chapter 20 has more about this descriptor. Intel’s proposed specification USB2 Debug Device: A Functional Device Specifi- cation defines a debug descriptor. A debug device connects to the optional debug port defined in the EHCI specification for high-speed host controllers. The debug port and device are intended to replace the RS-232 port that PCs have long used for debugging purposes. Table 4-13: A binary device object store (BOS) descriptor provides a way to support descriptors that store additional information about a device. 1HHUGV FGEKOCN (KGNF 5K\G D[VGU &GUETKRVKQP 0 bLength 1 Descriptor size in bytes (05h). 1bDescriptorType1BOS (0Fh) 2 wTotalLength 2 The number of bytes in this descriptor and all of its subordinate descriptors 4 bNumDeviceCaps 1 The number of device capability descriptors subordinate to this BOS descriptor. . the device speed and type of transfer. For USB 2.0, bits 10 0 are the maximum packet size with a range of 0–1024. For USB 1.x, the range is 0–1023. In USB 2.0, bits 12 11 indicate how many additional. way to provide this information, the Wireless USB specification introduced two new descriptor types. The USB 2.0 Link Power Management Addendum and USB 3.0 specifi- cation also incorporate these. value may range from 1–255. For isochronous end- points in USB 1.x devices, the value must be 1. For isochronous endpoints in full-speed USB 2.0 devices, values 1–16 are allowed, and the interval

Ngày đăng: 04/07/2014, 07:20

TỪ KHÓA LIÊN QUAN