diff options
| author | Tom Rix <Tom.Rix@windriver.com> | 2009-10-31 12:37:38 -0500 | 
|---|---|---|
| committer | Remy Bohmer <linux@bohmer.net> | 2009-12-20 12:47:37 +0100 | 
| commit | 8f8bd565f35ff8a068727bfcf8975c50df082043 (patch) | |
| tree | 828a43f51646a2060916a3d8928c62c430607045 /include/usb.h | |
| parent | bb3bcfa2426cc6a0aecec7270e3ee67ca843a125 (diff) | |
| download | olio-uboot-2014.01-8f8bd565f35ff8a068727bfcf8975c50df082043.tar.xz olio-uboot-2014.01-8f8bd565f35ff8a068727bfcf8975c50df082043.zip | |
USB Consolidate descriptor definitions
The header files usb.h and usbdescriptors.h have the same nameed
structure definitions for
usb_config_descriptor
usb_interface_descriptor
usb_endpoint_descriptor
usb_device_descriptor
usb_string_descriptor
These are out right duplicates in usb.h
usb_device_descriptor
usb_string_descriptor
This one has extra unused elements
usb_endpoint_descriptor
	unsigned char	bRefresh
	unsigned char	bSynchAddress;
These in usb.h have extra elements at the end of the usb 2.0
specified descriptor and are used.
usb_config_descriptor
usb_interface_descriptor
The change is to consolidate the definition of the descriptors
to usbdescriptors.h.  The dublicates in usb.h are removed.
The extra element structure will have their name shorted by
removing the '_descriptor' suffix.
So
usb_config_descriptor -> usb_config
usb_interface_descriptor -> usb_interface
For these, the common descriptor elements are accessed now
by an element 'desc'.
As an example
-	if (iface->bInterfaceClass != USB_CLASS_HUB)
+	if (iface->desc.bInterfaceClass != USB_CLASS_HUB)
This has been compile tested on MAKEALL arm, ppc and mips.
Signed-off-by: Tom Rix <Tom.Rix@windriver.com>
Diffstat (limited to 'include/usb.h')
| -rw-r--r-- | include/usb.h | 70 | 
1 files changed, 9 insertions, 61 deletions
| diff --git a/include/usb.h b/include/usb.h index 7c47098d8..4148d67e1 100644 --- a/include/usb.h +++ b/include/usb.h @@ -27,6 +27,7 @@  #define _USB_H_  #include <usb_defs.h> +#include <usbdescriptors.h>  /* Everything is aribtrary */  #define USB_ALTSETTINGALLOC		4 @@ -41,13 +42,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; @@ -63,47 +57,9 @@ struct usb_descriptor_header {  	unsigned char	bDescriptorType;  } __attribute__ ((packed)); -/* Device descriptor */ -struct usb_device_descriptor { -	unsigned char	bLength; -	unsigned char	bDescriptorType; -	unsigned short	bcdUSB; -	unsigned char	bDeviceClass; -	unsigned char	bDeviceSubClass; -	unsigned char	bDeviceProtocol; -	unsigned char	bMaxPacketSize0; -	unsigned short	idVendor; -	unsigned short	idProduct; -	unsigned short	bcdDevice; -	unsigned char	iManufacturer; -	unsigned char	iProduct; -	unsigned char	iSerialNumber; -	unsigned char	bNumConfigurations; -} __attribute__ ((packed)); - -/* Endpoint descriptor */ -struct usb_endpoint_descriptor { -	unsigned char	bLength; -	unsigned char	bDescriptorType; -	unsigned char	bEndpointAddress; -	unsigned char	bmAttributes; -	unsigned short	wMaxPacketSize; -	unsigned char	bInterval; -	unsigned char	bRefresh; -	unsigned char	bSynchAddress; -} __attribute__ ((packed)) __attribute__ ((aligned(2))); - -/* Interface descriptor */ -struct usb_interface_descriptor { -	unsigned char	bLength; -	unsigned char	bDescriptorType; -	unsigned char	bInterfaceNumber; -	unsigned char	bAlternateSetting; -	unsigned char	bNumEndpoints; -	unsigned char	bInterfaceClass; -	unsigned char	bInterfaceSubClass; -	unsigned char	bInterfaceProtocol; -	unsigned char	iInterface; +/* Interface */ +struct usb_interface { +	struct usb_interface_descriptor desc;  	unsigned char	no_of_ep;  	unsigned char	num_altsetting; @@ -112,20 +68,12 @@ struct usb_interface_descriptor {  	struct usb_endpoint_descriptor ep_desc[USB_MAXENDPOINTS];  } __attribute__ ((packed)); - -/* Configuration descriptor information.. */ -struct usb_config_descriptor { -	unsigned char	bLength; -	unsigned char	bDescriptorType; -	unsigned short	wTotalLength; -	unsigned char	bNumInterfaces; -	unsigned char	bConfigurationValue; -	unsigned char	iConfiguration; -	unsigned char	bmAttributes; -	unsigned char	MaxPower; +/* Configuration information.. */ +struct usb_config { +	struct usb_configuration_descriptor desc;  	unsigned char	no_of_if;	/* number of interfaces */ -	struct usb_interface_descriptor if_desc[USB_MAXINTERFACES]; +	struct usb_interface if_desc[USB_MAXINTERFACES];  } __attribute__ ((packed));  enum { @@ -156,7 +104,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_config config; /* config descriptor */  	int have_langid;		/* whether string_langid is valid yet */  	int string_langid;		/* language ID for strings */ |