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 some dump routines for debugging.



details:   https://anonhg.NetBSD.org/src/rev/fa9b80da28c7
branches:  trunk
changeset: 517317:fa9b80da28c7
user:      augustss <augustss%NetBSD.org@localhost>
date:      Sat Nov 10 16:54:56 2001 +0000

description:
Add some dump routines for debugging.

diffstat:

 sys/dev/usb/usbdi.c    |  53 ++++++++++++++++++++++++++++++++++++++++++++++++-
 sys/dev/usb/usbdivar.h |   8 ++++++-
 2 files changed, 58 insertions(+), 3 deletions(-)

diffs (96 lines):

diff -r 1c1b83d4f101 -r fa9b80da28c7 sys/dev/usb/usbdi.c
--- a/sys/dev/usb/usbdi.c       Sat Nov 10 16:53:32 2001 +0000
+++ b/sys/dev/usb/usbdi.c       Sat Nov 10 16:54:56 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: usbdi.c,v 1.81 2001/04/17 00:05:33 augustss Exp $      */
+/*     $NetBSD: usbdi.c,v 1.82 2001/11/10 16:54:56 augustss Exp $      */
 /*     $FreeBSD: src/sys/dev/usb/usbdi.c,v 1.28 1999/11/17 22:33:49 n_hibma Exp $      */
 
 /*
@@ -108,7 +108,41 @@
 }
 
 #ifdef USB_DEBUG
-void usbd_dump_queue(usbd_pipe_handle pipe);
+void
+usbd_dump_iface(struct usbd_interface *iface)
+{
+       printf("usbd_dump_iface: iface=%p\n", iface);
+       if (iface == NULL)
+               return;
+       printf(" device=%p idesc=%p index=%d altindex=%d priv=%p\n",
+              iface->device, iface->idesc, iface->index, iface->altindex,
+              iface->priv);
+}
+
+void
+usbd_dump_device(struct usbd_device *dev)
+{
+       printf("usbd_dump_device: dev=%p\n", dev);
+       if (dev == NULL)
+               return;
+       printf(" bus=%p default_pipe=%p\n", dev->bus, dev->default_pipe);
+       printf(" address=%d config=%d depth=%d lowspeed=%d self_powered=%d power=%d langid=%d\n",
+              dev->address, dev->config, dev->depth, dev->lowspeed,
+              dev->self_powered, dev->power, dev->langid);
+}
+
+void
+usbd_dump_endpoint(struct usbd_endpoint *endp)
+{
+       printf("usbd_dump_endpoint: endp=%p\n", endp);
+       if (endp == NULL)
+               return;
+       printf(" edesc=%p refcnt=%d\n", endp->edesc, endp->refcnt);
+       if (endp->edesc)
+               printf(" bEndpointAddress=0x%02x\n",
+                      endp->edesc->bEndpointAddress);
+}
+
 void
 usbd_dump_queue(usbd_pipe_handle pipe)
 {
@@ -121,6 +155,21 @@
                printf("  xfer=%p\n", xfer);
        }
 }
+
+void
+usbd_dump_pipe(usbd_pipe_handle pipe)
+{
+       printf("usbd_dump_pipe: pipe=%p\n", pipe);
+       if (pipe == NULL)
+               return;
+       usbd_dump_iface(pipe->iface);
+       usbd_dump_device(pipe->device);
+       usbd_dump_endpoint(pipe->endpoint);
+       printf(" (usbd_dump_pipe:)\n refcnt=%d running=%d aborting=%d\n",
+              pipe->refcnt, pipe->running, pipe->aborting);
+       printf("intrxfer=%p, repeat=%d, interval=%d\n",
+              pipe->intrxfer, pipe->repeat, pipe->interval);
+}
 #endif
 
 usbd_status 
diff -r 1c1b83d4f101 -r fa9b80da28c7 sys/dev/usb/usbdivar.h
--- a/sys/dev/usb/usbdivar.h    Sat Nov 10 16:53:32 2001 +0000
+++ b/sys/dev/usb/usbdivar.h    Sat Nov 10 16:54:56 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: usbdivar.h,v 1.63 2001/01/21 19:00:06 augustss Exp $   */
+/*     $NetBSD: usbdivar.h,v 1.64 2001/11/10 16:54:56 augustss Exp $   */
 /*     $FreeBSD: src/sys/dev/usb/usbdivar.h,v 1.11 1999/11/17 22:33:51 n_hibma Exp $   */
 
 /*
@@ -225,6 +225,12 @@
 void usbd_init(void);
 void usbd_finish(void);
 
+void usbd_dump_iface(struct usbd_interface *iface);
+void usbd_dump_device(struct usbd_device *dev);
+void usbd_dump_endpoint(struct usbd_endpoint *endp);
+void usbd_dump_queue(usbd_pipe_handle pipe);
+void usbd_dump_pipe(usbd_pipe_handle pipe);
+
 /* Routines from usb_subr.c */
 int            usbctlprint(void *, const char *);
 void           usb_delay_ms(usbd_bus_handle, u_int);



Home | Main Index | Thread Index | Old Index