Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
USB System Architecture (USB 2.0).pdf
Скачиваний:
173
Добавлен:
03.05.2015
Размер:
7.03 Mб
Скачать

USB System Architecture

Interface Descriptors

Interfaces define a collection of endpoints that a given class driver typically manipulates based on the pertinent device class characteristics. Some devices may define a single interface while others may require several. Table 19-11 on page 366 lists the format and definition of the interface descriptor. The following sections further describe the interface descriptor fields that in the author’s opinion may require clarification.

Interface Number and Alternate Setting

The “interface number” and “alternate settings” fields within the interface descriptor are used to support the alternate setting feature supported by the USB specification. Devices may define alternate interfaces within the same configuration. The intent is to permit adjustments to a configuration during normal operation, after the initial configuration has been completed. A device that supports alternate settings will include one or more sets of additional interface and endpoint descriptors that describe the same interface, but that contain alternate settings.

As an example, consider the descriptor tree in Figure 19-2. Note that all three interface descriptors have an “interface number” of zero, specifying that each defines settings for interface zero. However, the “alternate settings” field of each interface descriptor is different. During configuration, alternate setting zero is used by default. The other settings (one and two) can be chosen after configuration to “fine tune” the configuration. Host software uses the alternate setting value to select the interface of choice via the Set Interface request (see Table A-2 on page 438).

When the “Get Configuration” request is made, a device returns each primary interface (alternate settings = 0) followed by its associated endpoints, followed by each alternate interface and its associated endpoints. In this way, during configuration host software can detect that alternate settings are present even though they are ignored during configuration.

364

Chapter 19: USB Device Configuration

Figure 19-2: Descriptor Tree Containing Alternate Interface Settings

Device

Descriptor

Config.

Descriptor

Interface

Interface

Interface

Descriptor

Descriptor

Descriptor

E.P.

E.P.

E.P.

E.P.

E.P.

E.P.

Descrip.

Descrip.

Descrip.

Descrip.

Descrip.

Descrip.

Interface Number = 0

Interface Number = 0

Interface Number = 0

Alternate Setting = 0

Alternate Setting = 1

Alternate Setting = 2

Number of Endpoints

The number of endpoints required to support the interface is specified at offset 4 within the interface descriptor. This value lists the number of endpoints excluding endpoint zero (the default endpoint). The number of endpoints also does not include endpoints associated with alternate settings.

365

USB System Architecture

Interface Class and Subclass

These fields contain values that specify a given device class and subclass that permit software to locate the relevant class driver that will manipulate the endpoints associated with this interface. These values are defined by the individual device class specifications. For example, the audio class code is 01h, and the subclass codes range from 01-06h and define information such as whether audio information is pulse code modulated, Dolby Surround, MPEG1, etc. Details can be found in the audio device class specification.

Protocol

This field is tied to the device class and subclass fields. Some device class specifications may define protocol codes that pertain to a given interface. For example, the audio device class specification defines protocol codes that define whether the audio interface is mono, stereo, quadro, etc. The device class specifications should be consulted to determine the protocol codes and definitions.

Table 19-11: Interface Descriptor Definition

Offset

Field

Size

Value

Description

 

 

(bytes)

 

 

 

 

 

 

 

 

 

 

 

 

0

Length

1

Number

Size of this descriptor in bytes.

 

 

 

 

 

1

Descriptor-

1

Constant

Interface descriptor type = 04h.

 

Type

 

 

 

 

 

 

 

 

2

Interface-

1

Number

Number of interface. Zero-based value identifying

 

Number

 

 

the index in the array of concurrent interfaces sup-

 

 

 

 

ported by this configuration.

 

 

 

 

 

3

Alternate-

1

Number

Value used to select alternate setting for the inter-

 

Setting

 

 

face identified in the prior field.

 

 

 

 

 

4

NumEnd-

1

Number

Number of endpoints used by this interface

 

points

 

 

(excluding endpoint zero). If this value is zero, this

 

 

 

 

interface only uses endpoint zero.

 

 

 

 

 

5

Interface-

1

Class

Class code (assigned by USB).

 

Class

 

 

 

 

 

 

 

If this field is reset to zero, the interface does not

 

 

 

 

belong to any USB specified device class.

 

 

 

 

If this field is set to 0xFF, the interface class is ven-

 

 

 

 

dor specific. All other values are reserved for

 

 

 

 

assignment by USB.

 

 

 

 

 

366

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]