diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2014-08-07 13:13:47 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2014-08-07 13:13:47 +0200 |
commit | 038be0fbb5e983a498752b283319ba926f994a4b (patch) | |
tree | 5c22a5e6ad20114d7f59ad177c8f6bcafeba90c0 /include | |
parent | 9cce00617bf67a462eabd8c473c423f78414a8e8 (diff) | |
parent | be8ef22b5f403af78c7036502f6c15f643839edf (diff) | |
download | barebox-038be0fbb5e983a498752b283319ba926f994a4b.tar.gz barebox-038be0fbb5e983a498752b283319ba926f994a4b.tar.xz |
Merge branch 'for-next/usb'
Diffstat (limited to 'include')
-rw-r--r-- | include/usb/usb.h | 92 | ||||
-rw-r--r-- | include/usb/usb_defs.h | 6 |
2 files changed, 15 insertions, 83 deletions
diff --git a/include/usb/usb.h b/include/usb/usb.h index 4877e321bd..ff5242b8af 100644 --- a/include/usb/usb.h +++ b/include/usb/usb.h @@ -23,6 +23,7 @@ #define _USB_H_ #include <driver.h> +#include <usb/ch9.h> #include <usb/usb_defs.h> #include <asm/byteorder.h> @@ -39,13 +40,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; @@ -55,83 +49,29 @@ struct devrequest { unsigned short length; } __attribute__ ((packed)); -/* All standard descriptors have these 2 fields in common */ -struct usb_descriptor_header { - unsigned char bLength; - 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)); +enum { + /* Maximum packet size; encoded as 0,1,2,3 = 8,16,32,64 */ + PACKET_SIZE_8 = 0, + PACKET_SIZE_16 = 1, + PACKET_SIZE_32 = 2, + PACKET_SIZE_64 = 3, +}; -/* 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; +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]; -} __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; +struct usb_configuration { + struct usb_config_descriptor desc; unsigned char no_of_if; /* number of interfaces */ - struct usb_interface_descriptor if_desc[USB_MAXINTERFACES]; -} __attribute__ ((packed)); - -enum { - /* Maximum packet size; encoded as 0,1,2,3 = 8,16,32,64 */ - PACKET_SIZE_8 = 0, - PACKET_SIZE_16 = 1, - PACKET_SIZE_32 = 2, - PACKET_SIZE_64 = 3, + struct usb_interface interface[USB_MAXINTERFACES]; }; struct usb_device { @@ -154,7 +94,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 */ @@ -361,8 +301,6 @@ void usb_rescan(int force); #define usb_pipe_endpdev(pipe) (((pipe) >> 8) & 0x7ff) #define usb_pipeendpoint(pipe) (((pipe) >> 15) & 0xf) #define usb_pipedata(pipe) (((pipe) >> 19) & 1) -#define usb_pipespeed(pipe) (((pipe) >> 26) & 3) -#define usb_pipeslow(pipe) (usb_pipespeed(pipe) == USB_SPEED_LOW) #define usb_pipetype(pipe) (((pipe) >> 30) & 3) #define usb_pipeisoc(pipe) (usb_pipetype((pipe)) == PIPE_ISOCHRONOUS) #define usb_pipeint(pipe) (usb_pipetype((pipe)) == PIPE_INTERRUPT) diff --git a/include/usb/usb_defs.h b/include/usb/usb_defs.h index 13eb330ec5..ace20e430d 100644 --- a/include/usb/usb_defs.h +++ b/include/usb/usb_defs.h @@ -76,12 +76,6 @@ #define USB_DIR_OUT 0 #define USB_DIR_IN 0x80 -/* USB device speeds */ -#define USB_SPEED_FULL 0x0 /* 12Mbps */ -#define USB_SPEED_LOW 0x1 /* 1.5Mbps */ -#define USB_SPEED_HIGH 0x2 /* 480Mbps */ -#define USB_SPEED_RESERVED 0x3 - /* Descriptor types */ #define USB_DT_DEVICE 0x01 #define USB_DT_CONFIG 0x02 |