usb: improve c++ compatiblity

Extract the definition of the usb_interface internal data to allow
easier integration with c++ code.

Fixes: https://github.com/libopencm3/libopencm3/issues/762
This commit is contained in:
Karl Palsson 2017-04-24 22:09:33 +00:00
parent 0f4c032548
commit 9e36b8f29c
1 changed files with 11 additions and 6 deletions

View File

@ -153,6 +153,16 @@ struct usb_device_qualifier_descriptor {
uint8_t bReserved;
} __attribute__((packed));
/* This is only defined as a top level named struct to improve c++
* compatibility. You should never need to instance this struct
* in user code! */
struct usb_interface {
uint8_t *cur_altsetting;
uint8_t num_altsetting;
const struct usb_iface_assoc_descriptor *iface_assoc;
const struct usb_interface_descriptor *altsetting;
};
/* USB Standard Configuration Descriptor - Table 9-10 */
struct usb_config_descriptor {
uint8_t bLength;
@ -165,12 +175,7 @@ struct usb_config_descriptor {
uint8_t bMaxPower;
/* Descriptor ends here. The following are used internally: */
const struct usb_interface {
uint8_t *cur_altsetting;
uint8_t num_altsetting;
const struct usb_iface_assoc_descriptor *iface_assoc;
const struct usb_interface_descriptor *altsetting;
} *interface;
const struct usb_interface *interface;
} __attribute__((packed));
#define USB_DT_CONFIGURATION_SIZE 9