Specifications
12
6263A–ATARM–10-Oct-06
Application Note
3.5.1.4 Clear Feature, Set Feature & Get Status
Several features of a device can either be activated or deactivated by the USB host:
• Remote wakeup
• Endpoint Halt state
Three requests can be used to either set, clear or get the status of these two features:
SET_FEATURE, CLEAR_FEATURE and GET_STATUS.
The STD_RequestHandler method answers a Halt state operation by calling the USB_Halt
method on the endpoint with the request.
3.5.2 Structures
Several pieces of information must be known to the STD_RequestHandler to be able to process
some SETUP commands. For example, all the descriptors (configuration, etc.) used by the
device are needed since they must be sent to the host when a GET_DESCRIPTOR is received.
The S_std_class structure is a “standard USB class driver” object used to hold the required infor-
mation. It must be passed as an argument to the STD_RequestHandler method. Another
structure, S_std_descriptors, is used to store the descriptors list.
When defining a custom class driver, its first component should be S_std_class object. This
way, it will be possible to cast the custom driver as a S_std_class instance, which will be directly
usable by the STD_RequestHandler method.
3.5.3 Usage
The NewRequest callback is used to notify the user application that a new SETUP request has
been received. SETUP request can either be class-specific or standard.
The correct way to handle incoming requests is to first process class-specific requests using a
class handler. For example, a Mass Storage implementation will define the NewRequest call-
back to call MSD_RequestHandler. This function will handle the necessary requests, and
forward the rest to STD_RequestHandler.
If a request cannot be processed, STD_RequestHandler will STALL control endpoint 0.
4. Framework Usage
4.1 File Architecture
The USB framework is made up of the following files:
core_at91stdio.c: input/output methods for <stdio.h>, to use the DBGU port for debug
core_board.c, core_board.h: board-related definitions and methods
core_common.h: common definitions and methods
core_device.c, core_device.h: chip-related definitions and methods
core_main.c: basic enumeration program
core_standard.c, core_standard.h: standard request handler and structures
core_startup.s: device startup code in assembly language
core_trace.h: debug methods and definitions