summaryrefslogtreecommitdiffstats
path: root/sys/dev/usb/usb_transfer.c
diff options
context:
space:
mode:
authorhselasky <hselasky@FreeBSD.org>2011-04-03 20:03:45 +0000
committerhselasky <hselasky@FreeBSD.org>2011-04-03 20:03:45 +0000
commit13be006e1bb536e29069e6e03768185ab1003c1c (patch)
treed88f5b3979243ce915a1916907dffb3f7911eb11 /sys/dev/usb/usb_transfer.c
parente95ea389566188409a5acd3a88207d354b098ec5 (diff)
downloadFreeBSD-src-13be006e1bb536e29069e6e03768185ab1003c1c.zip
FreeBSD-src-13be006e1bb536e29069e6e03768185ab1003c1c.tar.gz
- Improvements to USB PF solution
- Add more fields for USB device and host mode - Add more information to USB PF header so that decoding can easily be done by software analyzer tools like Wireshark. - Optimise usbdump to display USB streams in text format more efficiently. - Software using USB PF must be recompiled after this commit, due to structure changes. MFC after: 7 days Approved by: thompsa (mentor)
Diffstat (limited to 'sys/dev/usb/usb_transfer.c')
-rw-r--r--sys/dev/usb/usb_transfer.c29
1 files changed, 26 insertions, 3 deletions
diff --git a/sys/dev/usb/usb_transfer.c b/sys/dev/usb/usb_transfer.c
index 8dd9d1d..5fd4f5a 100644
--- a/sys/dev/usb/usb_transfer.c
+++ b/sys/dev/usb/usb_transfer.c
@@ -664,9 +664,13 @@ usbd_transfer_setup_sub(struct usb_setup_params *parm)
}
xfer->max_data_length -= REQ_SIZE;
}
- /* setup "frlengths" */
+ /*
+ * Setup "frlengths" and shadow "frlengths" for keeping the
+ * initial frame lengths when a USB transfer is complete. This
+ * information is useful when computing isochronous offsets.
+ */
xfer->frlengths = parm->xfer_length_ptr;
- parm->xfer_length_ptr += n_frlengths;
+ parm->xfer_length_ptr += 2 * n_frlengths;
/* setup "frbuffers" */
xfer->frbuffers = parm->xfer_page_cache_ptr;
@@ -1579,9 +1583,12 @@ usbd_transfer_submit(struct usb_xfer *xfer)
USB_BUS_UNLOCK(bus);
return;
}
- /* compute total transfer length */
+ /* compute some variables */
for (x = 0; x != xfer->nframes; x++) {
+ /* make a copy of the frlenghts[] */
+ xfer->frlengths[x + xfer->max_frame_count] = xfer->frlengths[x];
+ /* compute total transfer length */
xfer->sumlen += xfer->frlengths[x];
if (xfer->sumlen < xfer->frlengths[x]) {
/* length wrapped around */
@@ -1970,6 +1977,22 @@ usbd_xfer_frame_data(struct usb_xfer *xfer, usb_frcount_t frindex,
*len = xfer->frlengths[frindex];
}
+/*------------------------------------------------------------------------*
+ * usbd_xfer_old_frame_length
+ *
+ * This function returns the framelength of the given frame at the
+ * time the transfer was submitted. This function can be used to
+ * compute the starting data pointer of the next isochronous frame
+ * when an isochronous transfer has completed.
+ *------------------------------------------------------------------------*/
+usb_frlength_t
+usbd_xfer_old_frame_length(struct usb_xfer *xfer, usb_frcount_t frindex)
+{
+ KASSERT(frindex < xfer->max_frame_count, ("frame index overflow"));
+
+ return (xfer->frlengths[frindex + xfer->max_frame_count]);
+}
+
void
usbd_xfer_status(struct usb_xfer *xfer, int *actlen, int *sumlen, int *aframes,
int *nframes)
OpenPOWER on IntegriCloud