usb: Support for class specific endpoint descriptors.

Extends struct usb_endpoint_descriptor to make it possible to provide
the USB host with class-specific extensions to endpoint descriptors.

The approach taken, based on extra and extralen and removing the sizeof()
from USB_DT_ENDPOINT_SIZE, is identical to the approach used to add
class-specific extensions to interface descriptors. All libopencm3-examples
use the USB_DT_ENDPOINT_SIZE (rather than directly using sizeof) so there
should be no compatibility problems resulting from this change.
This commit is contained in:
Daniel Thompson
2014-12-03 08:18:21 +00:00
committed by Karl Palsson
parent 0b63408260
commit d3aa579e0a
2 changed files with 14 additions and 1 deletions

View File

@@ -205,8 +205,12 @@ struct usb_endpoint_descriptor {
uint8_t bmAttributes;
uint16_t wMaxPacketSize;
uint8_t bInterval;
/* Descriptor ends here. The following are used internally: */
const void *extra;
int extralen;
} __attribute__((packed));
#define USB_DT_ENDPOINT_SIZE sizeof(struct usb_endpoint_descriptor)
#define USB_DT_ENDPOINT_SIZE 7
/* USB Endpoint Descriptor bmAttributes bit definitions */
#define USB_ENDPOINT_ATTR_CONTROL 0x00