34 #define USB_SETUP_REQ_GET_STATUS            0x00     
   35 #define USB_SETUP_REQ_CLEAR_FEATURE         0x01     
   36 #define USB_SETUP_REQ_SET_FEATURE           0x03     
   37 #define USB_SETUP_REQ_SET_ADDRESS           0x05     
   38 #define USB_SETUP_REQ_GET_DESCRIPTOR        0x06     
   39 #define USB_SETUP_REQ_SET_DESCRIPTOR        0x07     
   40 #define USB_SETUP_REQ_GET_CONFIGURATION     0x08     
   41 #define USB_SETUP_REQ_SET_CONFIGURATION     0x09     
   42 #define USB_SETUP_REQ_GET_INTERFACE         0x0a     
   43 #define USB_SETUP_REQ_SET_INTERFACE         0x0b     
   44 #define USB_SETUP_REQ_SYNCH_FRAME           0x0c     
   51 #define USB_TYPE_DESCRIPTOR_DEVICE          0x01     
   52 #define USB_TYPE_DESCRIPTOR_CONFIGURATION   0x02     
   53 #define USB_TYPE_DESCRIPTOR_STRING          0x03     
   54 #define USB_TYPE_DESCRIPTOR_INTERFACE       0x04     
   55 #define USB_TYPE_DESCRIPTOR_ENDPOINT        0x05     
   56 #define USB_TYPE_DESCRIPTOR_DEV_QUALIFIER   0x06     
   57 #define USB_TYPE_DESCRIPTOR_SPEED_CONFIG    0x07     
   58 #define USB_TYPE_DESCRIPTOR_IFACE_POWER     0x08     
   59 #define USB_TYPE_DESCRIPTOR_INTERFACE_ASSOC 0x0b     
   66 #define USB_FEATURE_ENDPOINT_HALT           0x00     
   67 #define USB_FEATURE_DEVICE_REMOTE_WAKEUP    0x01     
   68 #define USB_FEATURE_TEST_MODE               0x02     
   76 #define USB_CONF_ATTR_RESERVED              0x80     
   77 #define USB_CONF_ATTR_SELF_POWERED          0x40     
   78 #define USB_CONF_ATTR_REM_WAKEUP            0x20     
   85 #define USB_SETUP_REQUEST_DEVICE2HOST           0x80     
   89 #define USB_SETUP_REQUEST_RECIPIENT_MASK        0x1f     
   90 #define USB_SETUP_REQUEST_RECIPIENT_DEVICE      0x00     
   91 #define USB_SETUP_REQUEST_RECIPIENT_INTERFACE   0x01     
   92 #define USB_SETUP_REQUEST_RECIPIENT_ENDPOINT    0x02     
   93 #define USB_SETUP_REQUEST_RECIPIENT_OTHER       0x03     
   95 #define USB_SETUP_REQUEST_TYPE_MASK             0x60     
   96 #define USB_SETUP_REQUEST_TYPE_STANDARD         0x00     
   97 #define USB_SETUP_REQUEST_TYPE_CLASS            0x20     
   98 #define USB_SETUP_REQUEST_TYPE_VENDOR           0x40     
  104 #define USB_ENDPOINT_DESCRIPTOR_INTERVAL_ISOCHRONOUS    1 
  110 #define USB_CLASS_AUDIO             0x01     
  111 #define USB_CLASS_CDC_CONTROL       0x02     
  112 #define USB_CLASS_HID               0x03     
  113 #define USB_CLASS_PHYSICAL          0x05     
  114 #define USB_CLASS_IMAGE             0x06     
  115 #define USB_CLASS_PRINTER           0x07     
  116 #define USB_CLASS_MASS_STORAGE      0x08     
  117 #define USB_CLASS_CDC_DATA          0x0a     
  118 #define USB_CLASS_VENDOR            0xff     
  124 typedef struct __attribute__((packed)) {
 
  144 typedef struct __attribute__((packed)) {
 
  158 typedef struct __attribute__((packed)) {
 
  173 typedef struct __attribute__((packed)) {
 
  185 typedef struct __attribute__((packed)) {
 
  194 typedef struct __attribute__((packed)) {
 
  208 typedef struct __attribute__((packed)) {
 
#define USB_SETUP_REQUEST_DEVICE2HOST
Request direction From device to host if the bit is set
 
static bool usb_setup_is_read(usb_setup_t *pkt)
getter for setup packet direction
 
USB configuration descriptor (USB 2.0 spec table 9-10)
 
uint16_t total_length
Total length of the configuration
 
uint8_t idx
Configuration descriptor string index
 
uint8_t attributes
Configuration attributes (USB_CONF_ATTR)
 
uint8_t max_power
Maximum power consumption in 2mA steps
 
uint8_t num_interfaces
Number of interfaces supported by this configuration
 
uint8_t length
Size of this descriptor
 
uint8_t type
Descriptor type (USB_TYPE_DESCRIPTOR_CONFIGURATION)
 
uint8_t val
Value to select this configuration by
 
USB device descriptor (USB 2.0 spec table 9-8)
 
uint8_t subclass
Device subclass code
 
uint8_t num_configurations
Number of possible configurations
 
uint8_t length
Size of this descriptor.
 
uint8_t max_packet_size
EP0 max packet size (8, 16, 32 or 64 bytes)
 
uint16_t vendor_id
Vendor ID (as assigned by the USB-IF)
 
uint8_t serial_idx
Device serial number string index number
 
uint16_t product_id
Product ID
 
uint8_t manufacturer_idx
Manufacturer string index number
 
uint8_t product_idx
Product string index number
 
uint16_t bcd_usb
Binary-coded decimal USB release specification
 
uint16_t bcd_device
Binary-coded decimal device release
 
uint8_t protocol
Device protocol code
 
uint8_t type
Descriptor type (USB_TYPE_DESCRIPTOR_DEVICE)
 
USB endpoint descriptor (USB 2.0 spec table 9-13)
 
uint8_t interval
Polling interval for the endpoint
 
uint8_t address
Address of the endpoint
 
uint8_t type
Descriptor type (USB_TYPE_DESCRIPTOR_ENDPOINT)
 
uint16_t max_packet_size
Maximum packet size of the endpoint
 
uint8_t length
Size of this descriptor
 
uint8_t attributes
Attributes of the endpoint
 
USB interface association descriptor (Interface Association Descriptors table 9-Z)
 
uint8_t first_interface
Index of the first associated interface.
 
uint8_t length
Size of this descriptor.
 
uint8_t subclass
Subclass code.
 
uint8_t type
Descriptor type (USB_TYPE_DESCRIPTOR_INTERFACE_ASSOC)
 
uint8_t protocol
Protocol code.
 
uint8_t idx
Descriptor string index.
 
uint8_t interface_count
Number of associated interfaces.
 
USB interface descriptor (USB 2.0 spec table 9-12)
 
uint8_t length
Size of this descriptor
 
uint8_t interface_num
Interface number
 
uint8_t type
Descriptor type (USB_TYPE_DESCRIPTOR_INTERFACE)
 
uint8_t num_endpoints
Number of endpoints used by this interface
 
uint8_t alternate_setting
Alternate setting index
 
uint8_t protocol
Protocol code
 
uint8_t idx
Interface descriptor string index
 
uint8_t subclass
Subclass code as assigned by the USB-IF
 
USB string descriptor (USB 2.0 spec table 9-16)
 
uint8_t length
Size of this descriptor.
 
uint8_t type
String descriptor type
 
USB setup packet (USB 2.0 spec table 9-2)
 
uint16_t index
Index/offset word
 
uint16_t length
Length of the data stage.
 
uint8_t request
Specific request