Specifications

11
6263A–ATARM–10-Oct-06
Application Note
Because the start-of-frame interrupt puts some stress on the processor (since it is called a lot), it
is only activated if the corresponding callback is defined.
3.5 Standard Request Handling
Chapter 9 of the USB specification 2.0 defines a set of standard requests which have to be
implemented by all devices. Since most class drivers treat those requests in the standard way,
the USB framework provides a way to easily do that.
3.5.1 STD_RequestHandler
This method identifies standard requests and handles them in an appropriate way. It can answer
the following commands:
GET_DESCRIPTOR
SET_ADDRESS
SET_CONFIGURATION
GET_CONFIGURATION
CLEAR_FEATURE
SET_FEATURE
•GET_STATUS
Simply using this standard request handler enables a device to be enumerated correctly.
3.5.1.1 Get Descriptor
The GET_DESCRIPTOR request is used by the host to retrieve information about the device by
means of several descriptors.
The standard request handler simply sends the corresponding descriptor to the host. How these
descriptors are provided to the function is discussed in Section 3.5.2.
3.5.1.2 Set Address
Whenever the host wants to change the device state from Default to Address, or vice-versa, it
sends a SET_ADDRESS request. The wValue field contains the new address of the device; if it
is null, then the device returns to the Default state.
The USB_SetAddress function is called to perform this operation. Note that a zero-length packet
must be sent prior to doing that, to acknowledge the SETUP transfer.
3.5.1.3 Set Configuration & Get Configuration
The SET_CONFIGURATION request makes it possible for the host to select between one or
more configurations for the device. GET_CONFIGURATION is used to retrieve the currently
selected one.
Those two requests are handled in a very basic way by STD_RequestHandler: it assumes that
the device has only one configuration. Therefore, the SET_CONFIGURATION request is simply
acknowledged with a zero-length packet, and GET_CONFIGURATION is answered with either 0
or 1. If the user application needs more than one configuration, it will be the duty of the class
driver handler to service those requests.
In addition, when the SET_CONFIGURATION request causes the device to enter the Config-
ured state, the standard request handler calls the USB_ConfigureEndpoint method for each
endpoint used by the device;