7.3.8 Set Interface
This confusingly named USB command actually sets and reads back alternate settings for
a specified interface.
USB devices can have multiple concurrent interfaces. For example a device may have an
audio system that supports different sample rates, and a graphic control panel that supports
different languages. Each interface has a collection of endpoints. Except for endpoint 0,
which each interface uses for device control, endpoints may not be shared between inter-
faces.
Interfaces may report alternate settings in their descriptors. For example, the audio inter-
face may have setting 0, 1, and 2 for 8-KHz, 22-KHz, and 44-KHz sample rates, and the
panel interface may have settings 0 and 1 for English and Spanish. The Set/Get_Interface
requests select between the various alternate settings in an interface.
Table 7-18. Set Interface (Actually, Set Alternate Setting AS for Interface IF)
Byte
0
Field
bmRequestType
bRequest
wValueL
Value
Meaning
8051 Response
0x00 OUT, Device
Read and stash byte 2 (AS) for
Interface IF, change setting for
1
0x0B “Set_Interface”
2
AS Alt Setting Number Interface IF in firmware
3
wValueH
0x00
4
wIndexL
IF
For this interface
5
wIndexH
0x00
0x00
0x00
6
wLengthL
wLengthH
7
The 8051 should respond to a Set_Interface request by performing the following steps:
•
•
•
•
Perform the internal operation requested (such as adjusting a sampling rate).
Reset the data toggles for every endpoint in the interface.
For an IN endpoint, clear the busy bit for every endpoint in the interface.
For an OUT endpoint, load any value into the byte count register for every end-
point in the interface.
•
Clear the HSNAK bit (by writing “1” to it) to terminate the Set_Feature/Stall
CONTROL transfer.
Page 7-20
Chapter 7. EZ-USB CPU
EZ-USB TRM v1.9