Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/usb Add an argument to usbd_open_pipe_intr() to spec...
details: https://anonhg.NetBSD.org/src/rev/e37068c4f885
branches: trunk
changeset: 480737:e37068c4f885
user: augustss <augustss%NetBSD.org@localhost>
date: Wed Jan 19 00:23:58 2000 +0000
description:
Add an argument to usbd_open_pipe_intr() to specify the polling interval
for an interrupt pipe in case we don't what what the descriptor suggests.
diffstat:
sys/dev/usb/ohci.c | 8 ++++++--
sys/dev/usb/ugen.c | 5 +++--
sys/dev/usb/uhid.c | 4 ++--
sys/dev/usb/uhub.c | 4 ++--
sys/dev/usb/ukbd.c | 5 +++--
sys/dev/usb/ums.c | 4 ++--
sys/dev/usb/usb_subr.c | 9 ++++++---
sys/dev/usb/usbdi.c | 39 +++++++++++++++++++++++++++------------
sys/dev/usb/usbdi.h | 7 +++++--
sys/dev/usb/usbdivar.h | 8 ++++----
10 files changed, 60 insertions(+), 33 deletions(-)
diffs (truncated from 322 to 300 lines):
diff -r 5504bcdc5557 -r e37068c4f885 sys/dev/usb/ohci.c
--- a/sys/dev/usb/ohci.c Wed Jan 19 00:20:55 2000 +0000
+++ b/sys/dev/usb/ohci.c Wed Jan 19 00:23:58 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ohci.c,v 1.63 2000/01/18 20:23:42 augustss Exp $ */
+/* $NetBSD: ohci.c,v 1.64 2000/01/19 00:23:58 augustss Exp $ */
/* $FreeBSD: src/sys/dev/usb/ohci.c,v 1.22 1999/11/17 22:33:40 n_hibma Exp $ */
/*
@@ -1610,6 +1610,7 @@
u_int32_t fmt;
usbd_status err;
int s;
+ int ival;
DPRINTFN(1, ("ohci_open: pipe=%p, addr=%d, endpt=%d (%d)\n",
pipe, addr, ed->bEndpointAddress, sc->sc_addr));
@@ -1670,7 +1671,10 @@
break;
case UE_INTERRUPT:
pipe->methods = &ohci_device_intr_methods;
- return (ohci_device_setintr(sc, opipe, ed->bInterval));
+ ival = pipe->interval;
+ if (ival == USBD_DEFAULT_INTERVAL)
+ ival = ed->bInterval;
+ return (ohci_device_setintr(sc, opipe, ival));
case UE_ISOCHRONOUS:
pipe->methods = &ohci_device_isoc_methods;
return (ohci_setup_isoc(pipe));
diff -r 5504bcdc5557 -r e37068c4f885 sys/dev/usb/ugen.c
--- a/sys/dev/usb/ugen.c Wed Jan 19 00:20:55 2000 +0000
+++ b/sys/dev/usb/ugen.c Wed Jan 19 00:23:58 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ugen.c,v 1.31 1999/12/18 23:22:54 augustss Exp $ */
+/* $NetBSD: ugen.c,v 1.32 2000/01/19 00:23:58 augustss Exp $ */
/* $FreeBSD: src/sys/dev/usb/ugen.c,v 1.26 1999/11/17 22:33:41 n_hibma Exp $ */
/*
@@ -326,7 +326,8 @@
err = usbd_open_pipe_intr(sce->iface,
edesc->bEndpointAddress,
USBD_SHORT_XFER_OK, &sce->pipeh, sce,
- sce->ibuf, isize, ugenintr);
+ sce->ibuf, isize, ugenintr,
+ USBD_DEFAULT_INTERVAL);
if (err) {
free(sce->ibuf, M_USBDEV);
clfree(&sce->q);
diff -r 5504bcdc5557 -r e37068c4f885 sys/dev/usb/uhid.c
--- a/sys/dev/usb/uhid.c Wed Jan 19 00:20:55 2000 +0000
+++ b/sys/dev/usb/uhid.c Wed Jan 19 00:23:58 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uhid.c,v 1.30 2000/01/16 13:05:48 augustss Exp $ */
+/* $NetBSD: uhid.c,v 1.31 2000/01/19 00:23:58 augustss Exp $ */
/* $FreeBSD: src/sys/dev/usb/uhid.c,v 1.22 1999/11/17 22:33:43 n_hibma Exp $ */
/*
@@ -373,7 +373,7 @@
/* Set up interrupt pipe. */
err = usbd_open_pipe_intr(sc->sc_iface, sc->sc_ep_addr,
USBD_SHORT_XFER_OK, &sc->sc_intrpipe, sc, sc->sc_ibuf,
- sc->sc_isize, uhid_intr);
+ sc->sc_isize, uhid_intr, USBD_DEFAULT_INTERVAL);
if (err) {
DPRINTF(("uhidopen: usbd_open_pipe_intr failed, "
"error=%d\n",err));
diff -r 5504bcdc5557 -r e37068c4f885 sys/dev/usb/uhub.c
--- a/sys/dev/usb/uhub.c Wed Jan 19 00:20:55 2000 +0000
+++ b/sys/dev/usb/uhub.c Wed Jan 19 00:23:58 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uhub.c,v 1.35 1999/11/24 23:13:19 augustss Exp $ */
+/* $NetBSD: uhub.c,v 1.36 2000/01/19 00:23:58 augustss Exp $ */
/* $FreeBSD: src/sys/dev/usb/uhub.c,v 1.18 1999/11/17 22:33:43 n_hibma Exp $ */
/*
@@ -237,7 +237,7 @@
err = usbd_open_pipe_intr(iface, ed->bEndpointAddress,
USBD_SHORT_XFER_OK, &sc->sc_ipipe, sc, sc->sc_status,
- sizeof(sc->sc_status), uhub_intr);
+ sizeof(sc->sc_status), uhub_intr, USBD_DEFAULT_INTERVAL);
if (err) {
printf("%s: cannot open interrupt pipe\n",
USBDEVNAME(sc->sc_dev));
diff -r 5504bcdc5557 -r e37068c4f885 sys/dev/usb/ukbd.c
--- a/sys/dev/usb/ukbd.c Wed Jan 19 00:20:55 2000 +0000
+++ b/sys/dev/usb/ukbd.c Wed Jan 19 00:23:58 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ukbd.c,v 1.53 2000/01/16 09:41:22 augustss Exp $ */
+/* $NetBSD: ukbd.c,v 1.54 2000/01/19 00:23:58 augustss Exp $ */
/*
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -377,7 +377,8 @@
/* Set up interrupt pipe. */
err = usbd_open_pipe_intr(sc->sc_iface, sc->sc_ep_addr,
USBD_SHORT_XFER_OK, &sc->sc_intrpipe, sc,
- &sc->sc_ndata, sizeof(sc->sc_ndata), ukbd_intr);
+ &sc->sc_ndata, sizeof(sc->sc_ndata), ukbd_intr,
+ USBD_DEFAULT_INTERVAL);
if (err)
return (EIO);
} else {
diff -r 5504bcdc5557 -r e37068c4f885 sys/dev/usb/ums.c
--- a/sys/dev/usb/ums.c Wed Jan 19 00:20:55 2000 +0000
+++ b/sys/dev/usb/ums.c Wed Jan 19 00:23:58 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ums.c,v 1.38 2000/01/08 02:57:24 takemura Exp $ */
+/* $NetBSD: ums.c,v 1.39 2000/01/19 00:23:58 augustss Exp $ */
/*
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -422,7 +422,7 @@
/* Set up interrupt pipe. */
err = usbd_open_pipe_intr(sc->sc_iface, sc->sc_ep_addr,
USBD_SHORT_XFER_OK, &sc->sc_intrpipe, sc,
- sc->sc_ibuf, sc->sc_isize, ums_intr);
+ sc->sc_ibuf, sc->sc_isize, ums_intr, USBD_DEFAULT_INTERVAL);
if (err) {
DPRINTF(("ums_enable: usbd_open_pipe_intr failed, error=%d\n",
err));
diff -r 5504bcdc5557 -r e37068c4f885 sys/dev/usb/usb_subr.c
--- a/sys/dev/usb/usb_subr.c Wed Jan 19 00:20:55 2000 +0000
+++ b/sys/dev/usb/usb_subr.c Wed Jan 19 00:23:58 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: usb_subr.c,v 1.62 2000/01/16 23:11:43 augustss Exp $ */
+/* $NetBSD: usb_subr.c,v 1.63 2000/01/19 00:23:58 augustss Exp $ */
/* $FreeBSD: src/sys/dev/usb/usb_subr.c,v 1.18 1999/11/17 22:33:47 n_hibma Exp $ */
/*
@@ -671,10 +671,11 @@
/* XXX add function for alternate settings */
usbd_status
-usbd_setup_pipe(dev, iface, ep, pipe)
+usbd_setup_pipe(dev, iface, ep, ival, pipe)
usbd_device_handle dev;
usbd_interface_handle iface;
struct usbd_endpoint *ep;
+ int ival;
usbd_pipe_handle *pipe;
{
usbd_pipe_handle p;
@@ -693,6 +694,7 @@
p->intrxfer = 0;
p->running = 0;
p->repeat = 0;
+ p->interval = ival;
SIMPLEQ_INIT(&p->queue);
err = dev->bus->methods->open_pipe(p);
if (err) {
@@ -953,7 +955,8 @@
dev->cookie.cookie = ++usb_cookie_no;
/* Establish the the default pipe. */
- err = usbd_setup_pipe(dev, 0, &dev->def_ep, &dev->default_pipe);
+ err = usbd_setup_pipe(dev, 0, &dev->def_ep, USBD_DEFAULT_INTERVAL,
+ &dev->default_pipe);
if (err) {
usbd_remove_device(dev, up);
return (err);
diff -r 5504bcdc5557 -r e37068c4f885 sys/dev/usb/usbdi.c
--- a/sys/dev/usb/usbdi.c Wed Jan 19 00:20:55 2000 +0000
+++ b/sys/dev/usb/usbdi.c Wed Jan 19 00:23:58 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: usbdi.c,v 1.59 2000/01/18 20:23:42 augustss Exp $ */
+/* $NetBSD: usbdi.c,v 1.60 2000/01/19 00:23:58 augustss Exp $ */
/* $FreeBSD: src/sys/dev/usb/usbdi.c,v 1.28 1999/11/17 22:33:49 n_hibma Exp $ */
/*
@@ -78,8 +78,10 @@
static usbd_status usbd_ar_pipe __P((usbd_pipe_handle pipe));
static void usbd_do_request_async_cb
- __P((usbd_xfer_handle, usbd_private_handle, usbd_status));
+ __P((usbd_xfer_handle, usbd_private_handle, usbd_status));
static void usbd_start_next __P((usbd_pipe_handle pipe));
+static usbd_status usbd_open_pipe_ival
+ __P((usbd_interface_handle, u_int8_t, u_int8_t, usbd_pipe_handle *, int));
static int usbd_nbuses = 0;
@@ -132,6 +134,18 @@
u_int8_t flags;
usbd_pipe_handle *pipe;
{
+ return (usbd_open_pipe_ival(iface, address, flags, pipe,
+ USBD_DEFAULT_INTERVAL));
+}
+
+usbd_status
+usbd_open_pipe_ival(iface, address, flags, pipe, ival)
+ usbd_interface_handle iface;
+ u_int8_t address;
+ u_int8_t flags;
+ usbd_pipe_handle *pipe;
+ int ival;
+{
usbd_pipe_handle p;
struct usbd_endpoint *ep;
usbd_status err;
@@ -149,10 +163,9 @@
}
return (USBD_BAD_ADDRESS);
found:
- if ((flags & USBD_EXCLUSIVE_USE) &&
- ep->refcnt != 0)
+ if ((flags & USBD_EXCLUSIVE_USE) && ep->refcnt != 0)
return (USBD_IN_USE);
- err = usbd_setup_pipe(iface->device, iface, ep, &p);
+ err = usbd_setup_pipe(iface->device, iface, ep, ival, &p);
if (err)
return (err);
LIST_INSERT_HEAD(&iface->pipes, p, next);
@@ -161,24 +174,26 @@
}
usbd_status
-usbd_open_pipe_intr(iface, address, flags, pipe, priv, buffer, length, cb)
+usbd_open_pipe_intr(iface, address, flags, pipe, priv, buffer, len, cb, ival)
usbd_interface_handle iface;
u_int8_t address;
u_int8_t flags;
usbd_pipe_handle *pipe;
usbd_private_handle priv;
void *buffer;
- u_int32_t length;
+ u_int32_t len;
usbd_callback cb;
+ int ival;
{
usbd_status err;
usbd_xfer_handle xfer;
usbd_pipe_handle ipipe;
- DPRINTFN(3,("usbd_open_pipe_intr: address=0x%x flags=0x%x length=%d\n",
- address, flags, length));
+ DPRINTFN(3,("usbd_open_pipe_intr: address=0x%x flags=0x%x len=%d\n",
+ address, flags, len));
- err = usbd_open_pipe(iface, address, USBD_EXCLUSIVE_USE, &ipipe);
+ err = usbd_open_pipe_ival(iface, address, USBD_EXCLUSIVE_USE,
+ &ipipe, ival);
if (err)
return (err);
xfer = usbd_alloc_xfer(iface->device);
@@ -186,8 +201,8 @@
err = USBD_NOMEM;
goto bad1;
}
- usbd_setup_xfer(xfer, ipipe, priv, buffer, length, flags,
- USBD_NO_TIMEOUT, cb);
+ usbd_setup_xfer(xfer, ipipe, priv, buffer, len, flags,
+ USBD_NO_TIMEOUT, cb);
ipipe->intrxfer = xfer;
ipipe->repeat = 1;
err = usbd_transfer(xfer);
diff -r 5504bcdc5557 -r e37068c4f885 sys/dev/usb/usbdi.h
--- a/sys/dev/usb/usbdi.h Wed Jan 19 00:20:55 2000 +0000
+++ b/sys/dev/usb/usbdi.h Wed Jan 19 00:23:58 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: usbdi.h,v 1.38 2000/01/16 23:11:43 augustss Exp $ */
+/* $NetBSD: usbdi.h,v 1.39 2000/01/19 00:23:59 augustss Exp $ */
/* $FreeBSD: src/sys/dev/usb/usbdi.h,v 1.18 1999/11/17 22:33:49 n_hibma Exp $ */
/*
@@ -76,6 +76,9 @@
/* Open flags */
#define USBD_EXCLUSIVE_USE 0x01
+/* Use default (specified by ep. desc.) interval on interrupt pipe */
+#define USBD_DEFAULT_INTERVAL (-1)
+
/* Request flags */
#define USBD_NO_COPY 0x01 /* do not copy data to DMA buffer */
#define USBD_SYNCHRONOUS 0x02 /* wait for completion */
@@ -139,7 +142,7 @@
__P((usbd_interface_handle iface, u_int8_t address,
u_int8_t flags, usbd_pipe_handle *pipe,
usbd_private_handle priv, void *buffer,
- u_int32_t length, usbd_callback));
+ u_int32_t length, usbd_callback, int));
usbd_status usbd_do_request
__P((usbd_device_handle pipe, usb_device_request_t *req, void *data));
usbd_status usbd_do_request_async
diff -r 5504bcdc5557 -r e37068c4f885 sys/dev/usb/usbdivar.h
--- a/sys/dev/usb/usbdivar.h Wed Jan 19 00:20:55 2000 +0000
+++ b/sys/dev/usb/usbdivar.h Wed Jan 19 00:23:58 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: usbdivar.h,v 1.44 2000/01/18 20:11:01 augustss Exp $ */
+/* $NetBSD: usbdivar.h,v 1.45 2000/01/19 00:23:59 augustss Exp $ */
/* $FreeBSD: src/sys/dev/usb/usbdivar.h,v 1.11 1999/11/17 22:33:51 n_hibma Exp $ */
/*
@@ -158,8 +158,9 @@
SIMPLEQ_HEAD(, usbd_xfer) queue;
LIST_ENTRY(usbd_pipe) next;
- usbd_xfer_handle intrxfer; /* used for repeating requests */
+ usbd_xfer_handle intrxfer; /* used for repeating requests */
Home |
Main Index |
Thread Index |
Old Index