Usb enumeration data, Name, Synopsis – Comtrol eCos User Manual

Page 683: Enumeration data

Advertising
background image

USB Enumeration Data

Name

Enumeration Data

— The USB enumeration data structures

Synopsis

#include

<

cyg/io/usb/usb.h

>

#include

<

cyg/io/usb/usbs.h

>

typedef struct usb_device_descriptor {

...

} usb_device_descriptor __attribute__((packed));

typedef struct usb_configuration_descriptor {

...

} usb_configuration_descriptor __attribute__((packed));

typedef struct usb_interface_descriptor {

...

} usb_interface_descriptor __attribute__((packed));

typedef struct usb_endpoint_descriptor {

...

} usb_endpoint_descriptor;

typedef struct usbs_enumeration_data {

usb_device_descriptor

device;

int

total_number_interfaces;

int

total_number_endpoints;

int

total_number_strings;

const usb_configuration_descriptor* configurations;

const usb_interface_descriptor*

interfaces;

const usb_endpoint_descriptor*

endpoints;

const unsigned char**

strings;

} usbs_enumeration_data;

USB Enumeration Data

When a USB host detects that a peripheral has been plugged in or powered up, one of the first steps is to ask the
peripheral to describe itself by supplying enumeration data. Some of this data depends on the class of peripheral.
Other fields are vendor-specific. There is also a dependency on the hardware, specifically which endpoints are
available should be used. In general it is not possible for generic code to provide this information, so it is the
responsibility of application code to provide a suitable usbs_enumeration_data data structure and install it in the
endpoint 0 data structure during initialization. This must happen before the USB device is enabled by a call to

usbs_start

, for example:

const usbs_enumeration_data usb_enum_data = {

...

579

Advertising