1 #ifndef USB_DESCRIPTOR_H 2 #define USB_DESCRIPTOR_H 50 } __attribute__((packed));
111 uint8_t bDeviceClass;
112 uint8_t bDeviceSubClass;
113 uint8_t bDeviceProtocol;
114 uint8_t bMaxPacketSize;
118 uint8_t iManufacturer;
120 uint8_t iSerialNumber;
121 uint8_t bNumConfigurations;
122 } __attribute__((packed));
126 uint16_t wTotalLength;
127 uint8_t bNumInterfaces;
128 uint8_t bConfigurationValue;
129 uint8_t iConfiguration;
130 uint8_t bmAttributes;
132 } __attribute__((packed));
134 #define USB_CONFIG_ATTRIBUTES(self_powered, remote_wakeup) \ 135 ((1<<7)|((self_powered)<<6)|((remote_wakeup)<<5)) 136 #define USB_MAX_POWER(milli_amps) (milli_amps/2) 140 uint8_t bInterfaceNumber;
141 uint8_t bAlternateSetting;
142 uint8_t bNumEndPoints;
143 uint8_t bInterfaceClass;
144 uint8_t bInterfaceSubClass;
145 uint8_t bInterfaceProtocol;
147 } __attribute__((packed));
151 uint8_t bEndpointAddress;
152 uint8_t bmAttributes;
153 uint16_t wMaxPacketSize;
155 } __attribute__((packed));
Interface descriptor.
Definition: descriptor.h:42
Configuration descriptor body.
Definition: descriptor.h:125
const void * body
Pointer to the descriptor body.
Definition: descriptor.h:88
struct descriptor_list_t * next
Pointer to the next item or NULL if this is the last one.
Definition: descriptor.h:89
Endpoint descriptor.
Definition: descriptor.h:43
Single item of a linked list of descriptors.
Definition: descriptor.h:85
Endpoint descriptor body.
Definition: descriptor.h:150
usb_descriptor_type_t
Definition: descriptor.h:38
uint8_t usb_descriptor_size(const enum usb_descriptor_type_t type, const void *body, const enum memspace_t memspace)
Calculate the total size of a USB descriptor.
Interface descriptor body.
Definition: descriptor.h:139
Definitions of constants as described by the USB 2.0 standard.
uint16_t get_list_total_length(const struct descriptor_list_t *head)
Calculate the sum of all descriptor sizes in a linked list.
Device descriptor body.
Definition: descriptor.h:109
uint8_t usb_descriptor_body_size(const enum usb_descriptor_type_t type, const void *body, const enum memspace_t memspace)
Calculate the size of a USB descriptor's body.
String descriptor.
Definition: descriptor.h:41
Non-uniform memory access.
memspace_t
Define which memory space the body of a data block is in.
Definition: memspace.h:15
Device descriptor.
Definition: descriptor.h:39
Configuration descriptor.
Definition: descriptor.h:40
struct descriptor_list_t * generate_descriptor_list(const struct usb_setup_packet_t *req)