Hi,
Currently include/linux/usb.h contains inline functions:
usb_fill_control_urb, usb_fill_bulk_urb and usb_fill_int_urb.
This patch supplies the missing inline function usb_fill_iso_urb
in include/linux/usb.h, to assist with URB fill-in in isochronous
device drivers.
It differs from the existing 3 functions by supporting a specification
of int start_frame. Omitting it, results in the default of -1, is
is the case in usb_fill_int_urb.
This patch applied cleanly to: 2.6.0, 2.6.0 w David's ehci patch
set, 2.6.1-rc1, 2.6.1-rc1-mm1 and 2.6.1-rc1-mm1 w David's ehci
patch set.
Enjoy,
johnh
-
-----------------------------------------------------------------
John Heil
South Coast Software
Custom systems software for UNIX and IBM MVS mainframes
1-714-774-6952
[EMAIL PROTECTED]
http://www.sc-software.com
-----------------------------------------------------------------
diff -rNuBb linux-a/include/linux/usb.h linux-b/include/linux/usb.h
--- linux-a/include/linux/usb.h 2003-12-30 20:47:12.000000000 -0800
+++ linux-b/include/linux/usb.h 2004-01-01 21:19:11.000000000 -0800
@@ -816,6 +816,51 @@
urb->start_frame = -1;
}
+/**
+ * usb_fill_iso_urb - macro to help initialize a isochronous urb
+ * @urb: pointer to the urb to initialize.
+ * @dev: pointer to the struct usb_device for this urb.
+ * @pipe: the endpoint pipe
+ * @transfer_buffer: pointer to the transfer buffer
+ * @buffer_length: length of the transfer buffer
+ * @complete: pointer to the usb_complete_t function
+ * @context: what to set the urb context to.
+ * @interval: what to set the urb interval to, encoded like
+ * the endpoint descriptor's bInterval value.
+ * @start_frame: what frame number to start in.
+ * Initializes an isochronous urb with proper information needed to submit
+ * it to a device.
+ * Note that high speed isochronous endpoints use a logarithmic encoding of
+ * the endpoint interval, and express polling intervals in microframes
+ * (eight per millisecond) rather than in frames (one per millisecond).
+ */
+static inline void usb_fill_iso_urb (struct urb *urb,
+ struct usb_device *dev,
+ unsigned int pipe,
+ void *transfer_buffer,
+ int buffer_length,
+ usb_complete_t complete,
+ void *context,
+ int interval,
+ int start_frame)
+{
+ spin_lock_init(&urb->lock);
+ urb->dev = dev;
+ urb->pipe = pipe;
+ urb->transfer_buffer = transfer_buffer;
+ urb->transfer_buffer_length = buffer_length;
+ urb->complete = complete;
+ urb->context = context;
+ if (dev->speed == USB_SPEED_HIGH)
+ urb->interval = 1 << (interval - 1);
+ else
+ urb->interval = interval;
+ if (!start_frame)
+ urb->start_frame = -1;
+ else
+ urb->start_frame = start_frame;
+}
+
extern void usb_init_urb(struct urb *urb);
extern struct urb *usb_alloc_urb(int iso_packets, int mem_flags);
extern void usb_free_urb(struct urb *urb);