40 #ifndef _USBDESCRIPTORS_H_ 41 #define _USBDESCRIPTORS_H_ 79 #define USBGenericDescriptor_DEVICE 1 81 #define USBGenericDescriptor_CONFIGURATION 2 83 #define USBGenericDescriptor_STRING 3 85 #define USBGenericDescriptor_INTERFACE 4 87 #define USBGenericDescriptor_ENDPOINT 5 89 #define USBGenericDescriptor_DEVICEQUALIFIER 6 91 #define USBGenericDescriptor_OTHERSPEEDCONFIGURATION 7 93 #define USBGenericDescriptor_INTERFACEPOWER 8 95 #define USBGenericDescriptor_OTG 9 97 #define USBGenericDescriptor_DEBUG 10 99 #define USBGenericDescriptor_INTERFACEASSOCIATION 11 101 #define USB_DT_BOS 0x0F 103 #define USBGenericDescriptor_DEVICE_CAPABILITY 0x10 108 #define USB_EP_TYPE_MASK 0x03 109 #define USB_EP_ADDR_MASK 0x0f 113 #define USB_EP_DIR_IN 0x80 118 #define USB_EP_DIR_OUT 0x00 123 #define USB_REQ_DIR_OUT (0<<7) 124 #define USB_REQ_DIR_IN (1<<7) 125 #define USB_REQ_DIR_MASK (1<<7) 130 #define USB_REQ_TYPE_STANDARD (0<<5) 131 #define USB_REQ_TYPE_CLASS (1<<5) 132 #define USB_REQ_TYPE_VENDOR (2<<5) 133 #define USB_REQ_TYPE_MASK (3<<5) 138 #define USB_REQ_RECIP_DEVICE (0<<0) 139 #define USB_REQ_RECIP_INTERFACE (1<<0) 140 #define USB_REQ_RECIP_ENDPOINT (2<<0) 141 #define USB_REQ_RECIP_OTHER (3<<0) 142 #define USB_REQ_RECIP_MASK (0x1F) 178 #define USB_DC_EXT_BESL_DEEP_OFFSET 8 179 #define USB_DC_EXT_BESL_DEEP(besl) ((besl & 0xF) << USB_DC_EXT_BESL_DEEP_OFFSET) 180 #define USB_DC_EXT_BESL_BASELINE_OFFSET 12 181 #define USB_DC_EXT_BESL_BASELINE(besl) ((besl & 0xF) << USB_DC_EXT_BESL_BASELINE_OFFSET) 183 #define BESL_125_US 0 184 #define BESL_150_US 1 185 #define BESL_200_US 2 186 #define BESL_300_US 3 187 #define BESL_400_US 4 188 #define BESL_500_US 5 189 #define BESL_1000_US 6 190 #define BESL_2000_US 7 191 #define BESL_3000_US 8 192 #define BESL_4000_US 9 193 #define BESL_5000_US 10 194 #define BESL_6000_US 11 195 #define BESL_7000_US 12 196 #define BESL_8000_US 13 197 #define BESL_9000_US 14 198 #define BESL_10000_US 15 201 #define USB_LPM_ATTRIBUT_BLINKSTATE_MASK (0xF << 0) 202 #define USB_LPM_ATTRIBUT_BESL_MASK (0xF << 4) 203 #define USB_LPM_ATTRIBUT_REMOTEWAKE_MASK (1 << 8) 204 #define USB_LPM_ATTRIBUT_BLINKSTATE(value) ((value & 0xF) << 0) 205 #define USB_LPM_ATTRIBUT_BESL(value) ((value & 0xF) << 4) 206 #define USB_LPM_ATTRIBUT_REMOTEWAKE(value) ((value & 1) << 8) 207 #define USB_LPM_ATTRIBUT_BLINKSTATE_L1 USB_LPM_ATTRIBUT_BLINKSTATE(1) 220 #define USBDeviceDescriptor_USB2_00 0x0200 223 #define USBDeviceDescriptor_USB2_01 0x0201 239 #define USBConfigurationDescriptor_BUSPOWERED_NORWAKEUP 0x80 241 #define USBConfigurationDescriptor_SELFPOWERED_NORWAKEUP 0xC0 243 #define USBConfigurationDescriptor_BUSPOWERED_RWAKEUP 0xA0 245 #define USBConfigurationDescriptor_SELFPOWERED_RWAKEUP 0xE0 247 #define USBConfigurationDescriptor_REMOTE_WAKEUP 0x20 253 #define USBConfigurationDescriptor_POWER(power) (power / 2) 255 #define USB_HOST_POWER_MAX 500 330 #define USBEndpointDescriptor_OUT 0 332 #define USBEndpointDescriptor_IN 1 337 #define USB_EP_DIR_IN 0x80 342 #define USB_EP_DIR_OUT 0x00 354 #define USBEndpointDescriptor_CONTROL 0 356 #define USBEndpointDescriptor_ISOCHRONOUS 1 358 #define USBEndpointDescriptor_BULK 2 360 #define USBEndpointDescriptor_INTERRUPT 3 364 #define USBEndpointDescriptor_Asynchronous_ISOCHRONOUS (1<<2) 365 #define USBEndpointDescriptor_Adaptive_ISOCHRONOUS (2<<2) 366 #define USBEndpointDescriptor_Synchronous_ISOCHRONOUS (3<<2) 369 #define USBEndpointDescriptor_Feedback_ISOCHRONOUS (1<<2) 370 #define USBEndpointDescriptor_Explicit_Feedback_ISOCHRONOUS (2<<2) 386 #define USBEndpointDescriptor_MAXCTRLSIZE_FS 64 388 #define USBEndpointDescriptor_MAXCTRLSIZE_HS 64 390 #define USBEndpointDescriptor_MAXBULKSIZE_FS 64 392 #define USBEndpointDescriptor_MAXBULKSIZE_HS 512 394 #define USBEndpointDescriptor_MAXINTERRUPTSIZE_FS 64 396 #define USBEndpointDescriptor_MAXINTERRUPTSIZE_HS 1024 398 #define USBEndpointDescriptor_MAXISOCHRONOUSSIZE_FS 1023 400 #define USBEndpointDescriptor_MAXISOCHRONOUSSIZE_HS 1024 415 #define USBEndpointDescriptor_ADDRESS(direction, number) \ 416 (((direction & 0x01) << 7) | (number & 0xF)) 437 #define USBStringDescriptor_ENGLISH_US 0x09, 0x04 444 #define USBStringDescriptor_LENGTH(length) ((length) * 2 + 2) 450 #define USBStringDescriptor_UNICODE(ascii) (ascii), 0 469 #if defined ( __CC_ARM ) 470 #elif defined ( __ICCARM__ ) 471 #define __attribute__(...) 472 #define __packed__ packed 473 #elif defined ( __GNUC__ ) 474 #define __packed__ aligned(1) 638 USBDeviceBOSDescriptor
bos;
664 }
__attribute__ ((__packed__)) USBInterfaceAssociationDescriptor;
737 const USBGenericDescriptor *descriptor);
740 const USBGenericDescriptor *descriptor);
743 const USBGenericDescriptor *descriptor);
746 const USBGenericDescriptor * descriptor,
747 uint32_t totalLength,
763 USBInterfaceDescriptor **interfaces,
765 USBGenericDescriptor **others);
768 const USBEndpointDescriptor *endpoint);
771 const USBEndpointDescriptor *endpoint);
774 const USBEndpointDescriptor *endpoint);
777 const USBEndpointDescriptor *endpoint);
780 const USBEndpointDescriptor *endpoint);
usb_interface_status
Standard USB Interface status flags.
usb_endpoint_feature
Standard USB endpoint feature/status flags.
uint8_t USBGenericDescriptor_GetType(const USBGenericDescriptor *descriptor)
uint8_t bAlternateSetting
uint8_t bFunctionSubClass
usb_device_feature
Standard USB device feature flags.
void USBConfigurationDescriptor_Parse(const USBConfigurationDescriptor *configuration, USBInterfaceDescriptor **interfaces, USBEndpointDescriptor **endpoints, USBGenericDescriptor **others)
usb_capability_extension_attr
USB Device Capability - USB 2.0 Extension To fill bmAttributes field of usb_capa_ext_desc_t structure...
static Endpoint endpoints[CHIP_USB_NUMENDPOINTS]
unsigned char USBConfigurationDescriptor_GetNumInterfaces(const USBConfigurationDescriptor *configuration)
usb_reqid
Standard USB requests (bRequest)
uint32_t USBGenericDescriptor_GetLength(const USBGenericDescriptor *descriptor)
uint8_t bInterfaceSubClass
uint8_t USBEndpointDescriptor_GetNumber(const USBEndpointDescriptor *endpoint)
uint16_t USBEndpointDescriptor_GetMaxPacketSize(const USBEndpointDescriptor *endpoint)
uint8_t USBEndpointDescriptor_GetType(const USBEndpointDescriptor *endpoint)
uint32_t(* USBDescriptorParseFunction)(void *descriptor, void *parseArg)
typedef __attribute__
USB Device LPM Descriptor structure.
USBConfigurationDescriptor configuration
unsigned char USBConfigurationDescriptor_IsSelfPowered(const USBConfigurationDescriptor *configuration)
uint8_t bInterfaceProtocol
uint8_t bNumConfigurations
USBGenericDescriptor * USBGenericDescriptor_GetNextDescriptor(const USBGenericDescriptor *descriptor)
USB Device LPM Descriptor structure.
uint8_t bDevCapabilityType
usb_endpoint_status
Standard USB endpoint status flags.
USBDeviceCapabilities capa_ext
USBDeviceBOSDescriptor bos
uint8_t USBEndpointDescriptor_GetDirection(const USBEndpointDescriptor *endpoint)
uint8_t bFunctionProtocol
uint8_t bNumConfigurations
uint32_t USBConfigurationDescriptor_GetTotalLength(const USBConfigurationDescriptor *configuration)
usb_capability_type
USB Device Capability types.
uint8_t bConfigurationValue
USBGenericDescriptor * USBGenericDescriptor_Parse(const USBGenericDescriptor *descriptor, uint32_t totalLength, USBDescriptorParseFunction parseFunction, void *parseArg)
uint8_t USBEndpointDescriptor_GetInterval(const USBEndpointDescriptor *endpoint)