summaryrefslogtreecommitdiffstats
path: root/include/usb
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2014-07-10 11:36:12 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2014-07-18 14:42:35 +0200
commit245069bcef15ecc19db616a967501349b76c84d0 (patch)
tree9398374ea6f0b87d4658c343326aaceba90cbd4d /include/usb
parent4a872ae0ffe1380a28589f8f9e164d9d67471f1a (diff)
downloadbarebox-245069bcef15ecc19db616a967501349b76c84d0.tar.gz
barebox-245069bcef15ecc19db616a967501349b76c84d0.tar.xz
USB: introduce usb_interface/usb_configuration structs
Currently we have two conflicting definitions of struct usb_config_descriptor and struct usb_interface_descriptor in the tree. This is because the USB code uses additional fields in the structs for internal housekeeping. Add struct usb_interface and struct struct usb_configuration with the housekeeping data and embed the corresponding hardware structs into them. This frees the way to use the definitions from ch9.h in the next step. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include/usb')
-rw-r--r--include/usb/usb.h35
1 files changed, 18 insertions, 17 deletions
diff --git a/include/usb/usb.h b/include/usb/usb.h
index 4877e321bd..74b97a9db4 100644
--- a/include/usb/usb.h
+++ b/include/usb/usb.h
@@ -39,13 +39,6 @@
#define USB_CNTL_TIMEOUT 100 /* 100ms timeout */
-/* String descriptor */
-struct usb_string_descriptor {
- unsigned char bLength;
- unsigned char bDescriptorType;
- unsigned short wData[1];
-} __attribute__ ((packed));
-
/* device request (setup) */
struct devrequest {
unsigned char requesttype;
@@ -102,12 +95,6 @@ struct usb_interface_descriptor {
unsigned char bInterfaceSubClass;
unsigned char bInterfaceProtocol;
unsigned char iInterface;
-
- unsigned char no_of_ep;
- unsigned char num_altsetting;
- unsigned char act_altsetting;
-
- struct usb_endpoint_descriptor ep_desc[USB_MAXENDPOINTS];
} __attribute__ ((packed));
@@ -121,9 +108,6 @@ struct usb_config_descriptor {
unsigned char iConfiguration;
unsigned char bmAttributes;
unsigned char MaxPower;
-
- unsigned char no_of_if; /* number of interfaces */
- struct usb_interface_descriptor if_desc[USB_MAXINTERFACES];
} __attribute__ ((packed));
enum {
@@ -134,6 +118,23 @@ enum {
PACKET_SIZE_64 = 3,
};
+struct usb_interface {
+ struct usb_interface_descriptor desc;
+
+ unsigned char no_of_ep;
+ unsigned char num_altsetting;
+ unsigned char act_altsetting;
+
+ struct usb_endpoint_descriptor ep_desc[USB_MAXENDPOINTS];
+};
+
+struct usb_configuration {
+ struct usb_config_descriptor desc;
+
+ unsigned char no_of_if; /* number of interfaces */
+ struct usb_interface interface[USB_MAXINTERFACES];
+};
+
struct usb_device {
int devnum; /* Device number on USB bus */
int speed; /* full/low/high */
@@ -154,7 +155,7 @@ struct usb_device {
int configno; /* selected config number */
struct usb_device_descriptor *descriptor; /* Device Descriptor */
- struct usb_config_descriptor config; /* config descriptor */
+ struct usb_configuration config; /* config descriptor */
struct devrequest *setup_packet;
int have_langid; /* whether string_langid is valid yet */