patch-2.3.14 linux/drivers/usb/usb.h

Next file: linux/drivers/usb/usb_scsi.c
Previous file: linux/drivers/usb/usb.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.13/linux/drivers/usb/usb.h linux/drivers/usb/usb.h
@@ -61,6 +61,7 @@
 #define USB_DT_CONFIG_SIZE		9
 #define USB_DT_INTERFACE_SIZE		9
 #define USB_DT_ENDPOINT_SIZE		7
+#define USB_DT_AUCLSTEP_SIZE		9	/* Audio Classes are special */
 #define USB_DT_HUB_NONVAR_SIZE		7
 
 /*
@@ -167,10 +168,9 @@
  */
 
 #define USB_MAXCONFIG		8
-#define USB_MAXALTSETTING       5
+#define USB_MAXALTSETTING   6   
 #define USB_MAXINTERFACES	32
 #define USB_MAXENDPOINTS	32
-#define USB_MAXSTRINGS		32
 
 struct usb_device_descriptor {
 	__u8  bLength;
@@ -197,6 +197,8 @@
 	__u8  bmAttributes;
 	__u16 wMaxPacketSize;
 	__u8  bInterval;
+	__u8  bRefresh;
+	__u8  bSynchAddress;
 	void  *audio;
 };
 
@@ -216,9 +218,10 @@
 	void  *audio;
 };
 
-/* hack for alternate settings */
-struct usb_alternate_setting {
-        struct usb_interface_descriptor *interface;
+struct usb_interface {
+        struct usb_interface_descriptor *altsetting;
+        int act_altsetting;                /* active alternate setting */
+        int num_altsetting;                /* number of alternate settings */
 };
 
 /* Configuration descriptor information.. */
@@ -231,9 +234,7 @@
 	__u8  iConfiguration;
 	__u8  bmAttributes;
 	__u8  MaxPower;
-        int act_altsetting;                /* active alternate setting */
-        int num_altsetting;                /* number of alternate settings */
-	struct usb_alternate_setting *altsetting;
+	struct usb_interface *interface;
 };
 
 /* String descriptor */
@@ -289,7 +290,7 @@
 	int (*control_msg)(struct usb_device *, unsigned int, devrequest *, void *, int);
 	int (*bulk_msg)(struct usb_device *, unsigned int, void *, int,unsigned long *);
 	void* (*request_irq)(struct usb_device *, unsigned int, usb_device_irq, int, void *);
-	int (*release_irq)(void* handle);
+	int (*release_irq)(struct usb_device *, void* handle);
 	void *(*request_bulk)(struct usb_device *, unsigned int, usb_device_irq,
  void *, int, void *);
 	int (*terminate_bulk)(struct usb_device *, void *);
@@ -319,16 +320,18 @@
 	int slow;			/* Slow device? */
 	int maxpacketsize;		/* Maximum packet size; encoded as 0,1,2,3 = 8,16,32,64 */
 	unsigned int toggle[2];		/* one bit for each endpoint ([0] = IN, [1] = OUT) */
-	unsigned int halted;		/* endpoint halts */
+	unsigned int halted[2];		/* endpoint halts; one bit per endpoint # & direction; */
+					/* [0] = IN, [1] = OUT */
 	struct usb_config_descriptor *actconfig;/* the active configuration */
-	int epmaxpacket[16];		/* endpoint specific maximums */
+	int epmaxpacketin[16];		/* INput endpoint specific maximums */
+	int epmaxpacketout[16];		/* OUTput endpoint specific maximums */
 	int ifnum;			/* active interface number */
-	struct usb_bus *bus;		/* Bus we're apart of */
+	struct usb_bus *bus;		/* Bus we're part of */
 	struct usb_driver *driver;	/* Driver */
 	struct usb_device_descriptor descriptor;/* Descriptor */
 	struct usb_config_descriptor *config;	/* All of the configs */
 	struct usb_device *parent;
-	char *stringindex[USB_MAXSTRINGS];	/* pointers to strings */
+	char *string;			/* pointer to the last string read from the device */
 	int string_langid;		/* language ID for strings */
   
 	/*
@@ -397,7 +400,7 @@
  * unsigned int. The encoding is:
  *
  *  - max size:		bits 0-1	(00 = 8, 01 = 16, 10 = 32, 11 = 64)
- *  - direction:	bit 7		(0 = Host-to-Device, 1 = Device-to-Host)
+ *  - direction:	bit 7		(0 = Host-to-Device [Out], 1 = Device-to-Host [In])
  *  - device:		bits 8-14
  *  - endpoint:		bits 15-18
  *  - Data0/1:		bit 19
@@ -410,8 +413,10 @@
  * appropriately.
  */
 
-#define usb_maxpacket(dev,pipe)	((dev)->epmaxpacket[usb_pipeendpoint(pipe)])
-#define usb_packetid(pipe)	(((pipe) & 0x80) ? 0x69 : 0xE1)
+#define usb_maxpacket(dev, pipe, out)	(out \
+				? (dev)->epmaxpacketout[usb_pipeendpoint(pipe)] \
+				: (dev)->epmaxpacketin [usb_pipeendpoint(pipe)] )
+#define usb_packetid(pipe)	(((pipe) & USB_DIR_IN) ? USB_PID_IN : USB_PID_OUT)
 
 #define usb_pipeout(pipe)	((((pipe) >> 7) & 1) ^ 1)
 #define usb_pipein(pipe)	(((pipe) >> 7) & 1)
@@ -433,10 +438,11 @@
 #define	usb_dotoggle(dev, ep, out)  ((dev)->toggle[out] ^= (1 << ep))
 #define usb_settoggle(dev, ep, out, bit) ((dev)->toggle[out] = ((dev)->toggle[out] & ~(1 << ep)) | ((bit) << ep))
 
-/* Endpoint halt */
-#define usb_endpoint_halt(dev, ep) ((dev)->halted |= (1 << (ep)))
-#define usb_endpoint_running(dev, ep) ((dev)->halted &= ~(1 << (ep)))
-#define usb_endpoint_halted(dev, ep) ((dev)->halted & (1 << (ep)))
+/* Endpoint halt control/status */
+#define usb_endpoint_out(ep_dir)	(((ep_dir >> 7) & 1) ^ 1)
+#define usb_endpoint_halt(dev, ep, out) ((dev)->halted[out] |= (1 << (ep)))
+#define usb_endpoint_running(dev, ep, out) ((dev)->halted[out] &= ~(1 << (ep)))
+#define usb_endpoint_halted(dev, ep, out) ((dev)->halted[out] & (1 << (ep)))
 
 static inline unsigned int __create_pipe(struct usb_device *dev, unsigned int endpoint)
 {
@@ -450,13 +456,13 @@
 
 /* Create various pipes... */
 #define usb_sndctrlpipe(dev,endpoint)	((2 << 30) | __create_pipe(dev,endpoint))
-#define usb_rcvctrlpipe(dev,endpoint)	((2 << 30) | __create_pipe(dev,endpoint) | 0x80)
+#define usb_rcvctrlpipe(dev,endpoint)	((2 << 30) | __create_pipe(dev,endpoint) | USB_DIR_IN)
 #define usb_sndisocpipe(dev,endpoint)	((0 << 30) | __create_pipe(dev,endpoint))
-#define usb_rcvisocpipe(dev,endpoint)	((0 << 30) | __create_pipe(dev,endpoint) | 0x80)
+#define usb_rcvisocpipe(dev,endpoint)	((0 << 30) | __create_pipe(dev,endpoint) | USB_DIR_IN)
 #define usb_sndbulkpipe(dev,endpoint)	((3 << 30) | __create_pipe(dev,endpoint))
-#define usb_rcvbulkpipe(dev,endpoint)	((3 << 30) | __create_pipe(dev,endpoint) | 0x80)
+#define usb_rcvbulkpipe(dev,endpoint)	((3 << 30) | __create_pipe(dev,endpoint) | USB_DIR_IN)
 #define usb_snddefctrl(dev)		((2 << 30) | __default_pipe(dev))
-#define usb_rcvdefctrl(dev)		((2 << 30) | __default_pipe(dev) | 0x80)
+#define usb_rcvdefctrl(dev)		((2 << 30) | __default_pipe(dev) | USB_DIR_IN)
 
 /*
  * Send and receive control messages..

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)