USB Protocol Definitions
[USB Stack]

Collaboration diagram for USB Protocol Definitions:

Data Structures

struct  usb_setup_req
 A USB Device SETUP request. More...
struct  usb_device_descriptor
 Standard USB device descriptor. More...
struct  usb_device_qualifier_descriptor
 Standard USB device qualifier descriptor. More...
struct  usb_configuration_descriptor
 Standard USB configuration descriptor. More...
struct  usb_interface_descriptor
 Standard USB interface descriptor. More...
struct  usb_endpoint_descriptor
 Standard USB endpoint descriptor. More...
struct  usb_string_descriptor
 A standard USB string descriptor. More...

Modules

 USB Vendor, Product and Class Identifiers
 Mass Storage Class Definitions

Defines

#define USB_EP_ADDR_MASK   0x0f
 Mask selecting the index part of an endpoint address.
#define USB_DIR_IN   0x80
 Endpoint transfer direction is IN.
#define USB_DIR_OUT   0x00
 Endpoint transfer direction is OUT.
#define USB_MAX_DESC_LEN   255
 Maximum length in bytes of a USB descriptor.
#define usb_setup_is_in(req)   (!!((req)->bmRequestType & USB_DIR_IN))
 Return true if the setup request req indicates IN data transfer.
#define usb_setup_is_out(req)   (!((req)->bmRequestType & USB_DIR_IN))
 Return true if the setup request req indicates OUT data transfer.
#define usb_setup_type(req)   (((req)->bmRequestType >> 5) & 3)
 Return the type of the SETUP request req.
#define usb_setup_recipient(req)   ((req)->bmRequestType & 0x1f)
 Return the recipient of the SETUP request req.
#define USB_CONFIG_ATTR_MUST_SET   (1U << 7)
 Must always be set.
#define USB_CONFIG_ATTR_SELF_POWERED   (1U << 6)
 Self-powered.
#define USB_CONFIG_ATTR_REMOTE_WAKEUP   (1U << 5)
 Supports remote wakeup.
#define USB_CONFIG_MAX_POWER(ma)   (((ma) + 1) / 2)
 Max power in mA.
#define usb_ep_index(desc)   ((desc)->bEndpointAddress & USB_EP_ADDR_MASK)
 Return the index of the endpoint represented by desc.
#define usb_ep_is_in(desc)   (!!((desc)->bEndpointAddress & USB_DIR_IN))
 Return true if desc represents an IN endpoint.
#define usb_ep_is_out(desc)   (!((desc)->bEndpointAddress & USB_DIR_IN))
 Return true if desc represents an OUT endpoint.
#define usb_ep_xfer(desc)   ((desc)->bmAttributes & 0x03)
 Return the transfer type of the endpoint represented by desc.

Enumerations

enum  usb_device_state {
  USB_STATE_ATTACHED = 0, USB_STATE_POWERED, USB_STATE_DEFAULT, USB_STATE_ADDRESS,
  USB_STATE_CONFIGURED, USB_STATE_SUSPENDED = 0x80
}
 

USB device state.

More...
enum  usb_device_speed { USB_SPEED_UNKNOWN = 0, USB_SPEED_LOW, USB_SPEED_FULL, USB_SPEED_HIGH }
 

USB device speed.

More...
enum  usb_reqtype { USB_REQTYPE_STANDARD = 0, USB_REQTYPE_CLASS = 1, USB_REQTYPE_VENDOR = 2 }
 

USB request types (bmRequestType).

More...
enum  usb_recipient
 

USB recipient codes (bmRequestType).

More...
enum  usb_reqid
 

Standard USB requests (bRequest).

More...
enum  usb_device_feature { USB_DEV_STATUS_SELF_POWERED = 0, USB_DEV_FEATURE_REMOTE_WAKEUP = 1, USB_DEV_FEATURE_TEST_MODE = 2 }
 

Standard USB device feature/status flags.

More...
enum  usb_endpoint_feature
 

Standard USB endpoint feature/status flags.

More...
enum  usb_test_mode_selector
 

Standard USB Test Mode Selectors.

More...
enum  usb_descriptor_type
 

Standard USB descriptor types.

More...
enum  usb_ep_xfer_type
 

Standard USB endpoint transfer types.

More...
enum  usb_langid { USB_LANGID_EN_US = 0x0406 }
 

Standard USB language IDs for string descriptors.

More...

Detailed Description

This module defines constants and data structures taken from the USB 2.0 specification.


Define Documentation

#define USB_CONFIG_ATTR_MUST_SET   (1U << 7)

Must always be set.

Definition at line 315 of file usb_protocol.h.

#define USB_CONFIG_ATTR_REMOTE_WAKEUP   (1U << 5)

Supports remote wakeup.

Definition at line 317 of file usb_protocol.h.

#define USB_CONFIG_ATTR_SELF_POWERED   (1U << 6)

Self-powered.

Definition at line 316 of file usb_protocol.h.

#define USB_CONFIG_MAX_POWER ( ma   )     (((ma) + 1) / 2)

Max power in mA.

Definition at line 318 of file usb_protocol.h.

#define USB_DIR_IN   0x80

Endpoint transfer direction is IN.

Definition at line 216 of file usb_protocol.h.

Referenced by at90usb_ep_alloc(), and at90usb_ep_enable().

#define USB_DIR_OUT   0x00

Endpoint transfer direction is OUT.

Definition at line 220 of file usb_protocol.h.

#define USB_EP_ADDR_MASK   0x0f

Mask selecting the index part of an endpoint address.

Definition at line 212 of file usb_protocol.h.

Referenced by at90usb_ep_alloc(), at90usb_ep_enable(), and udc_lib_standard_request().

#define usb_ep_index ( desc   )     ((desc)->bEndpointAddress & USB_EP_ADDR_MASK)

Return the index of the endpoint represented by desc.

Definition at line 348 of file usb_protocol.h.

#define usb_ep_is_in ( desc   )     (!!((desc)->bEndpointAddress & USB_DIR_IN))

Return true if desc represents an IN endpoint.

Definition at line 350 of file usb_protocol.h.

#define usb_ep_is_out ( desc   )     (!((desc)->bEndpointAddress & USB_DIR_IN))

Return true if desc represents an OUT endpoint.

Definition at line 352 of file usb_protocol.h.

#define usb_ep_xfer ( desc   )     ((desc)->bmAttributes & 0x03)

Return the transfer type of the endpoint represented by desc.

Definition at line 354 of file usb_protocol.h.

#define USB_MAX_DESC_LEN   255

Maximum length in bytes of a USB descriptor.

The maximum length of a USB descriptor is limited by the 8-bit bLength field.

Definition at line 228 of file usb_protocol.h.

#define usb_setup_is_in ( req   )     (!!((req)->bmRequestType & USB_DIR_IN))

Return true if the setup request req indicates IN data transfer.

Definition at line 250 of file usb_protocol.h.

Referenced by udc_lib_standard_request().

#define usb_setup_is_out ( req   )     (!((req)->bmRequestType & USB_DIR_IN))

Return true if the setup request req indicates OUT data transfer.

Definition at line 252 of file usb_protocol.h.

Referenced by udc_lib_standard_request().

#define usb_setup_recipient ( req   )     ((req)->bmRequestType & 0x1f)

Return the recipient of the SETUP request req.

See also:
usb_recipient

Definition at line 256 of file usb_protocol.h.

Referenced by udc_lib_standard_request().

#define usb_setup_type ( req   )     (((req)->bmRequestType >> 5) & 3)

Return the type of the SETUP request req.

See also:
usb_reqtype.

Definition at line 254 of file usb_protocol.h.


Enumeration Type Documentation

Standard USB descriptor types.

Definition at line 181 of file usb_protocol.h.

Standard USB device feature/status flags.

Note:
USB_DEV_STATUS_SELF_POWERED is only valid for GetStatus, not SetFeature and ClearFeature.
USB_DEV_FEATURE_TEST_MODE is only valid for SetFeature. After this feature has been set, the device will not respond to any further requests.
Enumerator:
USB_DEV_STATUS_SELF_POWERED 

Does not draw power from bus.

USB_DEV_FEATURE_REMOTE_WAKEUP 

Remote wakeup enabled.

USB_DEV_FEATURE_TEST_MODE 

USB test mode.

Definition at line 154 of file usb_protocol.h.

USB device speed.

USB_SPEED_UNKNOWN indicates that the device has not yet seen a reset (i.e. it is in the POWERED or the ATTACHED state, possibly suspended.)

Enumerator:
USB_SPEED_UNKNOWN 

Speed not known yet.

USB_SPEED_LOW 

Low speed (1.5 Mb/s).

USB_SPEED_FULL 

Full speed (12 Mb/s).

USB_SPEED_HIGH 

High speed (480 Mb/s).

Definition at line 92 of file usb_protocol.h.

USB device state.

See the device state diagram in the USB 2.0 specification for more information.

Enumerator:
USB_STATE_ATTACHED 

Device is attached to host, but Vbus is not present.

USB_STATE_POWERED 

Vbus is present, but the device has not been reset yet.

USB_STATE_DEFAULT 

The device has been reset, and is using the default address.

USB_STATE_ADDRESS 

The device has received its own address, but no configuration has been selected.

USB_STATE_CONFIGURED 

A valid configuration has been selected.

USB_STATE_SUSPENDED 

The device is suspended.

Definition at line 62 of file usb_protocol.h.

Standard USB endpoint feature/status flags.

Definition at line 163 of file usb_protocol.h.

Standard USB endpoint transfer types.

Definition at line 195 of file usb_protocol.h.

enum usb_langid

Standard USB language IDs for string descriptors.

Enumerator:
USB_LANGID_EN_US 

English (United States).

Definition at line 205 of file usb_protocol.h.

USB recipient codes (bmRequestType).

Definition at line 115 of file usb_protocol.h.

enum usb_reqid

Standard USB requests (bRequest).

Definition at line 130 of file usb_protocol.h.

USB request types (bmRequestType).

Enumerator:
USB_REQTYPE_STANDARD 

Request defined by USB specification.

USB_REQTYPE_CLASS 

Class-specific request.

USB_REQTYPE_VENDOR 

Vendor-specific request.

Definition at line 102 of file usb_protocol.h.

Standard USB Test Mode Selectors.

Definition at line 170 of file usb_protocol.h.

Generated on Thu Apr 29 14:10:35 2010 for xplain-bc by  doxygen 1.6.3