Specifications
17
6263A–ATARM–10-Oct-06
Application Note
5.2.2.2 Configuration & Interface Descriptors
When the configuration descriptor is requested by the host, via the GET_DESCRIPTOR com-
mand, the device must not only transmit this descriptor but also all the necessary interface and
endpoint descriptors.
In order to do that easily, a structure must be defined for holding all the information. This way,
the data to send is contiguous, making the request much simpler to fulfill. In the current example,
the configuration descriptor must be followed by the first interface descriptor. The following
structure is declared for that:
// Device configuration structure
typedef struct {
S_usb_configuration_descriptor sConfiguration;
S_usb_interface_descriptor sInterface;
} S_core_configuration_descriptor;
Now, the actual descriptors can be declared:
// Configuration & interface descriptors
static const S_core_configuration_descriptor sConfigurationDescriptor = {
// Configuration descriptor
{
sizeof(S_usb_configuration_descriptor), // Size of this descriptor
USB_CONFIGURATION_DESCRIPTOR, // CONFIGURATION descriptor
sizeof(S_core_configuration_descriptor), // Total length
0x01, // Number of interfaces
0x01, // Value to select this configuration
0x00, // Index for describing this configuration
USB_CONFIG_SELF_NOWAKEUP, // Device attributes
USB_POWER_MA(100) // Maximum power consumption
},
// Interface Descriptor
{
sizeof(S_usb_interface_descriptor), // Size of this descriptor
USB_INTERFACE_DESCRIPTOR, // INTERFACE Descriptor Type
0x00, // Number of this interface
0x00, // Value used to select this setting
0x00, // Number of endpoints used (excluding endpoint 0)
USB_CLASS_DEVICE, // Interface class
0x00, // Interface subclass
0x00, // Interface protocol
0x00 // Index of string descriptor
},
};