53#define MAXIMUM_USB_STRING_LENGTH 255
58#define USB_GETSTATUS_SELF_POWERED 0x01
59#define USB_GETSTATUS_REMOTE_WAKEUP_ENABLED 0x02
62#define USB_DEVICE_DESCRIPTOR_TYPE 0x01
63#define USB_CONFIGURATION_DESCRIPTOR_TYPE 0x02
64#define USB_STRING_DESCRIPTOR_TYPE 0x03
65#define USB_INTERFACE_DESCRIPTOR_TYPE 0x04
66#define USB_ENDPOINT_DESCRIPTOR_TYPE 0x05
67#define USB_POWER_DESCRIPTOR_TYPE 0x06
68#define USB_HID_DESCRIPTOR_TYPE 0x21
69#define USB_HUB_DESCRIPTOR_TYPE 0x29
71#define USB_DESCRIPTOR_TYPEINDEX(d, i) ((uint16_t)((uint16_t)(d)<<8 | (i)))
78#define USB_ENDPOINT_TYPE_MASK 0x03
80#define USB_ENDPOINT_TYPE_CONTROL 0x00
81#define USB_ENDPOINT_TYPE_ISOCHRONOUS 0x01
82#define USB_ENDPOINT_TYPE_BULK 0x02
83#define USB_ENDPOINT_TYPE_INTERRUPT 0x03
90#define USB_CONFIG_POWERED_MASK 0xc0
92#define USB_CONFIG_BUS_POWERED 0x80
93#define USB_CONFIG_SELF_POWERED 0x40
94#define USB_CONFIG_REMOTE_WAKEUP 0x20
100#define USB_ENDPOINT_DIRECTION_MASK 0x80
101#define USB_ENDPOINT_DIRECTION_IN 0x80
107#define USB_ENDPOINT_DIR_OUT(addr) (!((addr) & USB_ENDPOINT_DIRECTION_MASK))
108#define USB_ENDPOINT_DIR_IN(addr) ((addr) & USB_ENDPOINT_DIRECTION_MASK)
110#define USB_ENDPOINT_ADDRESS(addr) ((addr) & 0x0F)
123#define USB_REQUEST_GET_STATUS 0x00
124#define USB_REQUEST_CLEAR_FEATURE 0x01
126#define USB_REQUEST_SET_FEATURE 0x03
128#define USB_REQUEST_SET_ADDRESS 0x05
129#define USB_REQUEST_GET_DESCRIPTOR 0x06
130#define USB_REQUEST_SET_DESCRIPTOR 0x07
131#define USB_REQUEST_GET_CONFIGURATION 0x08
132#define USB_REQUEST_SET_CONFIGURATION 0x09
133#define USB_REQUEST_GET_INTERFACE 0x0A
134#define USB_REQUEST_SET_INTERFACE 0x0B
135#define USB_REQUEST_SYNC_FRAME 0x0C
143#define USB_DEVICE_CLASS_RESERVED 0x00
144#define USB_DEVICE_CLASS_AUDIO 0x01
145#define USB_DEVICE_CLASS_COMMUNICATIONS 0x02
146#define USB_DEVICE_CLASS_HUMAN_INTERFACE 0x03
147#define USB_DEVICE_CLASS_MONITOR 0x04
148#define USB_DEVICE_CLASS_PHYSICAL_INTERFACE 0x05
149#define USB_DEVICE_CLASS_POWER 0x06
150#define USB_DEVICE_CLASS_PRINTER 0x07
151#define USB_DEVICE_CLASS_STORAGE 0x08
152#define USB_DEVICE_CLASS_HUB 0x09
153#define USB_DEVICE_CLASS_VENDOR_SPECIFIC 0xFF
159#define USB_FEATURE_ENDPOINT_STALL 0x0000
160#define USB_FEATURE_REMOTE_WAKEUP 0x0001
161#define USB_FEATURE_POWER_D0 0x0002
162#define USB_FEATURE_POWER_D1 0x0003
163#define USB_FEATURE_POWER_D2 0x0004
164#define USB_FEATURE_POWER_D3 0x0005
172#define USBWORD(x) ((x) & 0xFF),(((x) >> 8) & 0xFF)
174#define USB_CONTROL_ENDPOINT_MIN_SIZE 8
207#define CONFIG_BUS_POWERED 0x80
208#define CONFIG_SELF_POWERED 0x40
209#define CONFIG_REMOTE_WAKEUP 0x20
222#define USB_INTERFACE_CLASS_HUB 0x09
247#define USB_SUPPORT_D0_COMMAND 0x01
248#define USB_SUPPORT_D1_COMMAND 0x02
249#define USB_SUPPORT_D2_COMMAND 0x04
250#define USB_SUPPORT_D3_COMMAND 0x08
252#define USB_SUPPORT_D1_WAKEUP 0x10
253#define USB_SUPPORT_D2_WAKEUP 0x20
287#define USB_HUB_DESCR_SIZE 8
300#define USB_HUBCHAR_PWR_GANGED 0
301#define USB_HUBCHAR_PWR_IND 1
302#define USB_HUBCHAR_PWR_NONE 2
309#define USB_PORT_STATUS_CONNECT 0x0001
310#define USB_PORT_STATUS_ENABLED 0x0002
311#define USB_PORT_STATUS_SUSPEND 0x0004
312#define USB_PORT_STATUS_OVERCUR 0x0008
313#define USB_PORT_STATUS_RESET 0x0010
314#define USB_PORT_STATUS_POWER 0x0100
315#define USB_PORT_STATUS_LOWSPD 0x0200
323#define USB_HUBREQ_GET_STATUS 0
324#define USB_HUBREQ_CLEAR_FEATURE 1
325#define USB_HUBREQ_GET_STATE 2
326#define USB_HUBREQ_SET_FEATURE 3
327#define USB_HUBREQ_GET_DESCRIPTOR 6
328#define USB_HUBREQ_SET_DESCRIPTOR 7
330#define USB_HUB_FEATURE_C_LOCAL_POWER 0
331#define USB_HUB_FEATURE_C_OVER_CURRENT 1
333#define USB_PORT_FEATURE_CONNECTION 0
334#define USB_PORT_FEATURE_ENABLE 1
335#define USB_PORT_FEATURE_SUSPEND 2
336#define USB_PORT_FEATURE_OVER_CURRENT 3
337#define USB_PORT_FEATURE_RESET 4
338#define USB_PORT_FEATURE_POWER 8
339#define USB_PORT_FEATURE_LOW_SPEED 9
340#define USB_PORT_FEATURE_C_PORT_CONNECTION 16
341#define USB_PORT_FEATURE_C_PORT_ENABLE 17
342#define USB_PORT_FEATURE_C_PORT_SUSPEND 18
343#define USB_PORT_FEATURE_C_PORT_OVER_CURRENT 19
344#define USB_PORT_FEATURE_C_PORT_RESET 20
347#define GETUSBFIELD(s,f) (((s)->f##Low) | ((s)->f##High << 8))
348#define PUTUSBFIELD(s,f,v) (s)->f##Low = (v & 0xFF); \
349 (s)->f##High = ((v)>>8 & 0xFF)
362#define USBREQ_DIR_IN 0x80
363#define USBREQ_DIR_OUT 0x00
364#define USBREQ_TYPE_STD 0x00
365#define USBREQ_TYPE_CLASS 0x20
366#define USBREQ_TYPE_VENDOR 0x40
367#define USBREQ_TYPE_RSVD 0x60
368#define USBREQ_REC_DEVICE 0x00
369#define USBREQ_REC_INTERFACE 0x01
370#define USBREQ_REC_ENDPOINT 0x02
371#define USBREQ_REC_OTHER 0x03
373#define REQCODE(req,dir,type,rec) (((req) << 8) | (dir) | (type) | (rec))
374#define REQSW(req,attr) (((req) << 8) | (attr))
uint8_t bConfigurationValue
uint8_t bNumConfigurations
uint8_t wDeviceStatusHigh
uint8_t wMaxPacketSizeHigh
uint8_t wMaxPacketSizeLow
uint8_t wClassDescrLengthHigh
uint8_t wClassDescrLengthLow
uint8_t bHubControlCurrent
uint8_t bDescriptorLength
uint8_t wHubCharacteristicsLow
uint8_t bRemoveAndPowerMask[64]
uint8_t wHubCharacteristicsHigh
uint8_t bPowerOnToPowerGood
uint8_t bAlternateSetting
uint8_t bInterfaceSubClass
uint8_t bInterfaceProtocol
uint16_t EventNotification
uint16_t D1PowerConsumption
uint16_t D0PowerConsumption
uint16_t D2PowerConsumption
uint8_t bCapabilitiesFlags
struct usb_config_descr_s usb_config_descr_t
struct usb_device_status_s usb_device_status_t
struct usb_string_descr_s usb_string_descr_t
struct usb_device_descr_s usb_device_descr_t
struct usb_device_request_s usb_device_request_t
struct usb_endpoint_descr_s usb_endpoint_descr_t
struct usb_hid_descr_s usb_hid_descr_t
struct usb_interface_descr_s usb_interface_descr_t
struct usb_port_status_s usb_port_status_t
struct usb_power_descr_s usb_power_descr_t
struct usb_hub_descr_s usb_hub_descr_t
struct usb_common_descr_s usb_common_descr_t
struct usb_hub_status_s usb_hub_status_t