Loading...
Searching...
No Matches
USB_spec.h File Reference

General definitions as defined by the USB standard. More...

Macros

Request Types: targets and direction

These request types can be used in the usb_module_info::send_request() and usb_module_info::queue_request() methods. They specifiy both the type of interface and the direction of the transfer.

These are usually combined with a category (found on this page).

#define USB_REQTYPE_DEVICE_IN   0x80
 Device. In.
 
#define USB_REQTYPE_DEVICE_OUT   0x00
 Device. Out.
 
#define USB_REQTYPE_ENDPOINT_IN   0x82
 Endpoint. In.
 
#define USB_REQTYPE_ENDPOINT_OUT   0x02
 Endpoint. Out.
 
#define USB_REQTYPE_INTERFACE_IN   0x81
 Interface. In.
 
#define USB_REQTYPE_INTERFACE_OUT   0x01
 Interface. Out.
 
#define USB_REQTYPE_OTHER_IN   0x83
 Other. In.
 
#define USB_REQTYPE_OTHER_OUT   0x03
 Other. Out.
 
Request Types: categories

These request types can be used in the usb_module_info::send_request() and usb_module_info::queue_request() methods. They specifiy the category of the transfer.

These are usually combined with a target and direction (found on this page).

#define USB_REQTYPE_CLASS   0x20
 Request that adheres to the specifications of the class.
 
#define USB_REQTYPE_MASK   0x9f
 Constant that can be used as mask over the requesttype field.
 
#define USB_REQTYPE_RESERVED   0x60
 Reserved for special implementations.
 
#define USB_REQTYPE_STANDARD   0x00
 Request that adheres to the USB specifications.
 
#define USB_REQTYPE_VENDOR   0x40
 Request that is defined by the specifications of the vendor.
 
Standard Request Values

These request values are defined by the USB standard. You can use these constants in both the usb_module_info::send_request() and usb_module_info::queue_request() methods.

Warning
The stack handles most of these standard requests for you. Use the supplied convenience functions the the usb_module_info interface rather than doing the requests yourself. Some of these request may actually interfere with the inner workings of the USB stack!
#define USB_REQUEST_CLEAR_FEATURE   1
 Clear a feature.
 
#define USB_REQUEST_GET_CONFIGURATION   8
 Get a configuration.
 
#define USB_REQUEST_GET_DESCRIPTOR   6
 Get a descriptor.
 
#define USB_REQUEST_GET_INTERFACE   10
 Request an interface descriptor.
 
#define USB_REQUEST_GET_STATUS   0
 Get the status of a device.
 
#define USB_REQUEST_SET_ADDRESS   5
 Set the device address.
 
#define USB_REQUEST_SET_CONFIGURATION   9
 Set the configuration.
 
#define USB_REQUEST_SET_DESCRIPTOR   7
 Update a descriptor to a supplied one.
 
#define USB_REQUEST_SET_FEATURE   3
 Set a feature.
 
#define USB_REQUEST_SET_INTERFACE   11
 Set a specific interface.
 
#define USB_REQUEST_SYNCH_FRAME   12
 Synchronize a frame.
 
Descriptor Constants

These constants refer to a specific descriptor. They can be used when building a standard USB request for a descriptor, or in the usb_module_info::get_descriptor() method.

#define USB_DESCRIPTOR_CONFIGURATION   0x02
 Constant for a configuration descriptor.
 
#define USB_DESCRIPTOR_DEVICE   0x01
 Constant for the device descriptor.
 
#define USB_DESCRIPTOR_ENDPOINT   0x05
 Constant for an endpoint descriptor.
 
#define USB_DESCRIPTOR_INTERFACE   0x04
 Constant for an interface descriptor.
 
#define USB_DESCRIPTOR_STRING   0x03
 Constant for a string descriptor.
 
Feature Requests

These constants refer to standard feature requests. You can use these using the convenient usb_module_info::set_feature() and usb_module_info::clear_feature() methods.

#define USB_FEATURE_DEVICE_REMOTE_WAKEUP   1
 Request a device to wakeup from remote calls.
 
#define USB_FEATURE_ENDPOINT_HALT   0
 Request for a specific endpoint to halt.
 
Endpoint Attributes

These constants refer to values in the usb_endpoint_descriptor::attributes field.

#define USB_ENDPOINT_ATTR_BULK   0x02
 Endpoint facilitates bulk transfers.
 
#define USB_ENDPOINT_ATTR_CONTROL   0x00
 Endpoint facilitates control transfers.
 
#define USB_ENDPOINT_ATTR_INTERRUPT   0x03
 Endpoint facilitates interrupt transfers.
 
#define USB_ENDPOINT_ATTR_ISOCHRONOUS   0x01
 Endpoint facilitates isochronous transfers.
 
#define USB_ENDPOINT_ATTR_MASK   0x03
 Constant to mask out transfer types.
 
Endpoint Address

These constants refer to the direction that is embedded in the usb_endpoint_descriptor::address field.

#define USB_ENDPOINT_ADDR_DIR_IN   0x80
 The endpoint provides data for the driver.
 
#define USB_ENDPOINT_ADDR_DIR_OUT   0x00
 The endpoint accepts data from the host.
 

Detailed Description

General definitions as defined by the USB standard.