55 const USBGenericDescriptor *descriptor)
57 return descriptor->bLength;
66 const USBGenericDescriptor *descriptor)
68 return descriptor->bDescriptorType;
78 const USBGenericDescriptor *descriptor)
80 return (USBGenericDescriptor *)
93 const USBGenericDescriptor *descriptor,
98 int32_t size = totalLength;
105 uint32_t parseRC = 0;
109 parseRC = parseFunction((
void *)descriptor, parseArg);
118 return (USBGenericDescriptor *)descriptor;
134 const USBEndpointDescriptor *endpoint)
136 return endpoint->bEndpointAddress & 0xF;
145 const USBEndpointDescriptor *endpoint)
147 if ((endpoint->bEndpointAddress & 0x80) != 0)
161 const USBEndpointDescriptor *endpoint)
163 return endpoint->bmAttributes & 0x3;
173 const USBEndpointDescriptor *endpoint)
175 return endpoint->wMaxPacketSize;
184 const USBEndpointDescriptor *endpoint)
186 return endpoint->bInterval;
199 return configuration->wTotalLength;
209 return configuration->bNumInterfaces;
220 if ((configuration->bmAttributes & (1 << 6)) != 0)
244 USBInterfaceDescriptor **interfaces,
246 USBGenericDescriptor **others)
250 size -=
sizeof(USBConfigurationDescriptor);
253 USBGenericDescriptor *descriptor = (USBGenericDescriptor *) configuration;
265 *interfaces = (USBInterfaceDescriptor *) descriptor;
272 *endpoints = (USBEndpointDescriptor *) descriptor;
276 *others = descriptor;
#define USBGenericDescriptor_ENDPOINT
uint8_t USBGenericDescriptor_GetType(const USBGenericDescriptor *descriptor)
#define USBEndpointDescriptor_OUT
void USBConfigurationDescriptor_Parse(const USBConfigurationDescriptor *configuration, USBInterfaceDescriptor **interfaces, USBEndpointDescriptor **endpoints, USBGenericDescriptor **others)
static Endpoint endpoints[CHIP_USB_NUMENDPOINTS]
unsigned char USBConfigurationDescriptor_GetNumInterfaces(const USBConfigurationDescriptor *configuration)
uint32_t USBGenericDescriptor_GetLength(const USBGenericDescriptor *descriptor)
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)
USBConfigurationDescriptor configuration
unsigned char USBConfigurationDescriptor_IsSelfPowered(const USBConfigurationDescriptor *configuration)
USBGenericDescriptor * USBGenericDescriptor_GetNextDescriptor(const USBGenericDescriptor *descriptor)
#define USBGenericDescriptor_INTERFACE
uint8_t USBEndpointDescriptor_GetDirection(const USBEndpointDescriptor *endpoint)
#define USBEndpointDescriptor_IN
uint32_t USBConfigurationDescriptor_GetTotalLength(const USBConfigurationDescriptor *configuration)
USBGenericDescriptor * USBGenericDescriptor_Parse(const USBGenericDescriptor *descriptor, uint32_t totalLength, USBDescriptorParseFunction parseFunction, void *parseArg)
uint8_t USBEndpointDescriptor_GetInterval(const USBEndpointDescriptor *endpoint)