14#define USB_DT_INTERFACE_SIZE 0x09
15#define USB_DT_ENDPOINT_SIZE 0x07
16#define USB_DT_INTERFACE_ASSOCIATION_SIZE 0x08
17#define USB_DT_DEVICE_SIZE 0x12
18#define USB_DT_HID_SIZE 0x09
19#define USB_DT_SS_ENDPOINT_COMPANION_SIZE 0x06
21#define USB_ENDPOINT_ADDRESS_MASK 0x0f
22#define USB_ENDPOINT_DIR_MASK 0x80
24#define USB_TRANSFER_TYPE_MASK 0x03
28 uint8_t bmRequestType;
41 uint16_t wMaxPacketSize;
51 uint8_t bNumEndpoints;
52 uint8_t bInterfaceClass;
53 uint8_t bInterfaceSubClass;
54 uint8_t bInterfaceProtocol;
64 uint8_t bDeviceSubClass;
65 uint8_t bDeviceProtocol;
66 uint8_t bMaxPacketSize0;
70 uint8_t iManufacturer;
72 uint8_t iSerialNumber;
73 uint8_t bNumConfigurations;
79 uint8_t bDescriptorType;
80 uint16_t wTotalLength;
81 uint8_t bNumInterfaces;
82 uint8_t bConfigurationValue;
83 uint8_t iConfiguration;
94 uint16_t wBytesPerInterval;
101 uint16_t wData[0x40];
108 uint8_t bFirstInterface;
109 uint8_t bInterfaceCount;
110 uint8_t bFunctionClass;
111 uint8_t bFunctionSubClass;
112 uint8_t bFunctionProtocol;
121 uint8_t bCountryCode;
122 uint8_t bNumDescriptors;
123 uint8_t bClassDescriptorType;
124 uint16_t wClassDescriptorLength;
129 USB_CLASS_PER_INTERFACE = 0,
133 USB_CLASS_PHYSICAL = 5,
134 USB_CLASS_PRINTER = 7,
137 USB_CLASS_MASS_STORAGE = 8,
140 USB_CLASS_SMART_CARD = 0x0b,
141 USB_CLASS_CONTENT_SECURITY = 0x0d,
142 USB_CLASS_VIDEO = 0x0e,
143 USB_CLASS_PERSONAL_HEALTHCARE = 0x0f,
144 USB_CLASS_DIAGNOSTIC_DEVICE = 0xdc,
145 USB_CLASS_WIRELESS = 0xe0,
146 USB_CLASS_APPLICATION = 0xfe,
147 USB_CLASS_VENDOR_SPEC = 0xff
152 USB_DT_DEVICE = 0x01,
153 USB_DT_CONFIG = 0x02,
154 USB_DT_STRING = 0x03,
155 USB_DT_INTERFACE = 0x04,
156 USB_DT_ENDPOINT = 0x05,
157 USB_DT_INTERFACE_ASSOCIATION = 0x0b,
159 USB_DT_DEVICE_CAPABILITY = 0x10,
161 USB_DT_REPORT = 0x22,
162 USB_DT_PHYSICAL = 0x23,
164 USB_DT_SUPERSPEED_HUB = 0x2a,
165 USB_DT_SS_ENDPOINT_COMPANION = 0x30
170 USB_ENDPOINT_IN = 0x80,
171 USB_ENDPOINT_OUT = 0x00
176 USB_TRANSFER_TYPE_CONTROL = 0,
177 USB_TRANSFER_TYPE_ISOCHRONOUS = 1,
178 USB_TRANSFER_TYPE_BULK = 2,
179 USB_TRANSFER_TYPE_INTERRUPT = 3,
180 USB_TRANSFER_TYPE_BULK_STREAM = 4,
232 USB_REQUEST_TYPE_STANDARD = (0x00 << 5),
233 USB_REQUEST_TYPE_CLASS = (0x01 << 5),
234 USB_REQUEST_TYPE_VENDOR = (0x02 << 5),
235 USB_REQUEST_TYPE_RESERVED = (0x03 << 5)
240 USB_RECIPIENT_DEVICE = 0x00,
241 USB_RECIPIENT_INTERFACE = 0x01,
242 USB_RECIPIENT_ENDPOINT = 0x02,
243 USB_RECIPIENT_OTHER = 0x03
248 USB_ISO_SYNC_TYPE_NONE = 0,
249 USB_ISO_SYNC_TYPE_ASYNC = 1,
250 USB_ISO_SYNC_TYPE_ADAPTIVE = 2,
251 USB_ISO_SYNC_TYPE_SYNC = 3
256 USB_ISO_USAGE_TYPE_DATA = 0,
257 USB_ISO_USAGE_TYPE_FEEDBACK = 1,
258 USB_ISO_USAGE_TYPE_IMPLICIT = 2,
Imported from libusb, with some adjustments.
Definition usb.h:77
Imported from libusb, with some adjustments.
Definition usb.h:27
Imported from libusb, with some adjustments.
Definition usb.h:59
uint8_t bDescriptorType
Must match USB_DT_Device.
Definition usb.h:61
Imported from libusb, with some adjustments.
Definition usb.h:36
uint8_t bEndpointAddress
Should be one of the usb_endpoint_direction values, the endpoint-number is automatically allocated.
Definition usb.h:39
uint8_t bDescriptorType
Must match USB_DT_ENDPOINT.
Definition usb.h:38
Imported from libusb, with some adjustments.
Definition usb.h:117
uint8_t bDescriptorType
Must match USB_DT_HID.
Definition usb.h:119
Imported from libusb, with some adjustments.
Definition usb.h:105
uint8_t bDescriptorType
Must match USB_DT_INTERFACE_ASSOCIATION.
Definition usb.h:107
Imported from libusb, with some adjustments.
Definition usb.h:46
uint8_t iInterface
Ignored.
Definition usb.h:55
uint8_t bDescriptorType
Must match USB_DT_INTERFACE.
Definition usb.h:48
uint8_t bAlternateSetting
Must match 0.
Definition usb.h:50
uint8_t bInterfaceNumber
See also USBDS_DEFAULT_InterfaceNumber.
Definition usb.h:49
Imported from libusb, with some adjustments.
Definition usb.h:89
uint8_t bDescriptorType
Must match USB_DT_SS_ENDPOINT_COMPANION.
Definition usb.h:91
Imported from libusb, with some adjustments.
Definition usb.h:98
uint8_t bDescriptorType
Must match USB_DT_STRING.
Definition usb.h:100
#define NX_PACKED
Packs a struct so that it won't include padding bytes.
Definition types.h:63
usb_request_type
Imported from libusb, with changed names.
Definition usb.h:231
usb_class_code
Imported from libusb, with changed names.
Definition usb.h:128
usb_standard_request
Imported from libusb, with changed names.
Definition usb.h:184
@ USB_REQUEST_SET_CONFIGURATION
Set device configuration.
Definition usb.h:211
@ USB_REQUEST_SET_ADDRESS
Set device address for all future accesses.
Definition usb.h:199
@ USB_REQUEST_SYNCH_FRAME
Set then report an endpoint's synchronization frame.
Definition usb.h:220
@ USB_REQUEST_CLEAR_FEATURE
Clear or disable a specific feature.
Definition usb.h:189
@ USB_SET_ISOCH_DELAY
Delay from the time a host transmits a packet to the time it is received by the device.
Definition usb.h:227
@ USB_REQUEST_GET_INTERFACE
Return the selected alternate setting for the specified interface.
Definition usb.h:214
@ USB_REQUEST_SET_DESCRIPTOR
Used to update existing descriptors or add new descriptors.
Definition usb.h:205
@ USB_REQUEST_SET_SEL
Sets both the U1 and U2 Exit Latency.
Definition usb.h:223
@ USB_REQUEST_GET_STATUS
Request status of the specific recipient.
Definition usb.h:186
@ USB_REQUEST_SET_FEATURE
Set or enable a specific feature.
Definition usb.h:194
@ USB_REQUEST_SET_INTERFACE
Select an alternate interface for the specified interface.
Definition usb.h:217
@ USB_REQUEST_GET_DESCRIPTOR
Get the specified descriptor.
Definition usb.h:202
@ USB_REQUEST_GET_CONFIGURATION
Get the current device configuration value.
Definition usb.h:208
UsbState
USB Device States, per USB 2.0 spec.
Definition usb.h:262
@ UsbState_Default
Device is attached, powered, and has been reset, but does not have an address.
Definition usb.h:266
@ UsbState_Detached
Device is not attached to USB.
Definition usb.h:263
@ UsbState_Address
Device is attached, powered, has been reset, has an address, but is not configured.
Definition usb.h:267
@ UsbState_Powered
Device is attached and powered, but has not been reset.
Definition usb.h:265
@ UsbState_Suspended
Device is attached and powered, but has not seen bus activity for 3ms. Device is suspended and cannot...
Definition usb.h:269
@ UsbState_Configured
Device is attached, powered, has been reset, has an address, configured, and may be used.
Definition usb.h:268
@ UsbState_Attached
Device is attached, but is not powered.
Definition usb.h:264
usb_descriptor_type
Imported from libusb, with changed names.
Definition usb.h:151
usb_request_recipient
Imported from libusb, with changed names.
Definition usb.h:239
usb_endpoint_direction
Imported from libusb, with changed names.
Definition usb.h:169
usb_iso_usage_type
Imported from libusb, with changed names.
Definition usb.h:255
usb_iso_sync_type
Imported from libusb, with changed names.
Definition usb.h:247
usb_transfer_type
Imported from libusb, with changed names.
Definition usb.h:175