summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjoe <joe@FreeBSD.org>2002-04-01 19:42:51 +0000
committerjoe <joe@FreeBSD.org>2002-04-01 19:42:51 +0000
commita4893138413f926c69ced90b8e7debbccd28829b (patch)
tree2bffb34bb356623bb311eb54da3d1806bbfa6db2
parenta1b45b6baa6fa7f8baf047455b9a62f06dd54c7b (diff)
downloadFreeBSD-src-a4893138413f926c69ced90b8e7debbccd28829b.zip
FreeBSD-src-a4893138413f926c69ced90b8e7debbccd28829b.tar.gz
MFNetBSD: ohci.c rev 1.92, uhci.c rev 1.122 (part)
date: 2000/08/08 19:51:46; author: tv; state: Exp; lines: +24 -13 %b -> bitmask_snprintf() Because this code is shared, add a macro for bitmask_snprintf() that should expand to the equivalent snprintf() on non-NetBSD systems. This is only used in ?HCI_DEBUG cases anyway.
-rw-r--r--sys/dev/usb/ohci.c38
-rw-r--r--sys/dev/usb/uhci.c19
2 files changed, 37 insertions, 20 deletions
diff --git a/sys/dev/usb/ohci.c b/sys/dev/usb/ohci.c
index 2b068de..3b89289 100644
--- a/sys/dev/usb/ohci.c
+++ b/sys/dev/usb/ohci.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ohci.c,v 1.91 2000/06/01 14:28:58 augustss Exp $ */
+/* $NetBSD: usb/ohci.c,v 1.92 2000/08/08 19:51:46 tv Exp $ */
/* $FreeBSD$ */
/*
@@ -91,6 +91,9 @@ struct cfdriver ohci_cd = {
#define DPRINTF(x) if (ohcidebug) logprintf x
#define DPRINTFN(n,x) if (ohcidebug>(n)) logprintf x
int ohcidebug = 1;
+#ifndef __NetBSD__
+#define bitmask_snprintf(q,f,b,l) snprintf((b), (l), "%b", (q), (f))
+#endif
#else
#define DPRINTF(x)
#define DPRINTFN(n,x)
@@ -1779,11 +1782,15 @@ ohci_dump_tds(ohci_soft_td_t *std)
void
ohci_dump_td(ohci_soft_td_t *std)
{
- DPRINTF(("TD(%p) at %08lx: %b delay=%d ec=%d cc=%d\ncbp=0x%08lx "
+ char sbuf[128];
+
+ bitmask_snprintf((int)le32toh(std->td.td_flags),
+ "\20\23R\24OUT\25IN\31TOG1\32SETTOGGLE",
+ sbuf, sizeof(sbuf));
+
+ DPRINTF(("TD(%p) at %08lx: %s delay=%d ec=%d cc=%d\ncbp=0x%08lx "
"nexttd=0x%08lx be=0x%08lx\n",
- std, (u_long)std->physaddr,
- (int)le32toh(std->td.td_flags),
- "\20\23R\24OUT\25IN\31TOG1\32SETTOGGLE",
+ std, (u_long)std->physaddr, sbuf,
OHCI_TD_GET_DI(le32toh(std->td.td_flags)),
OHCI_TD_GET_EC(le32toh(std->td.td_flags)),
OHCI_TD_GET_CC(le32toh(std->td.td_flags)),
@@ -1823,17 +1830,22 @@ ohci_dump_itds(ohci_soft_itd_t *sitd)
void
ohci_dump_ed(ohci_soft_ed_t *sed)
{
- DPRINTF(("ED(%p) at 0x%08lx: addr=%d endpt=%d maxp=%d %b\ntailp=0x%08lx "
- "headflags=%b headp=0x%08lx nexted=0x%08lx\n",
+ char sbuf[128], sbuf2[128];
+
+ bitmask_snprintf((int)le32toh(sed->ed.ed_flags),
+ "\20\14OUT\15IN\16LOWSPEED\17SKIP\20ISO",
+ sbuf, sizeof(sbuf));
+ bitmask_snprintf((u_long)le32toh(sed->ed.ed_headp),
+ "\20\1HALT\2CARRY", sbuf2, sizeof(sbuf2));
+
+ DPRINTF(("ED(%p) at 0x%08lx: addr=%d endpt=%d maxp=%d %s\ntailp=0x%08lx "
+ "headflags=%s headp=0x%08lx nexted=0x%08lx\n",
+
sed, (u_long)sed->physaddr,
OHCI_ED_GET_FA(le32toh(sed->ed.ed_flags)),
OHCI_ED_GET_EN(le32toh(sed->ed.ed_flags)),
- OHCI_ED_GET_MAXP(le32toh(sed->ed.ed_flags)),
- (int)le32toh(sed->ed.ed_flags),
- "\20\14OUT\15IN\16LOWSPEED\17SKIP\20ISO",
- (u_long)(uintptr_t)le32toh(sed->ed.ed_tailp),
- (int)(uintptr_t)le32toh(sed->ed.ed_headp),
- "\20\1HALT\2CARRY",
+ OHCI_ED_GET_MAXP(le32toh(sed->ed.ed_flags)), sbuf,
+ (u_long)le32toh(sed->ed.ed_tailp), sbuf2,
(u_long)le32toh(sed->ed.ed_headp),
(u_long)le32toh(sed->ed.ed_nexted)));
}
diff --git a/sys/dev/usb/uhci.c b/sys/dev/usb/uhci.c
index d64088b..84ccb1d 100644
--- a/sys/dev/usb/uhci.c
+++ b/sys/dev/usb/uhci.c
@@ -763,6 +763,8 @@ uhci_dumpregs(uhci_softc_t *sc)
void
uhci_dump_td(uhci_soft_td_t *p)
{
+ char sbuf[128], sbuf2[128];
+
DPRINTFN(-1,("TD(%p) at %08lx = link=0x%08lx status=0x%08lx "
"token=0x%08lx buffer=0x%08lx\n",
p, (long)p->physaddr,
@@ -770,13 +772,16 @@ uhci_dump_td(uhci_soft_td_t *p)
(long)le32toh(p->td.td_status),
(long)le32toh(p->td.td_token),
(long)le32toh(p->td.td_buffer)));
- DPRINTFN(-1,(" %b %b,errcnt=%d,actlen=%d pid=%02x,addr=%d,endpt=%d,"
- "D=%d,maxlen=%d\n",
- (int)le32toh(p->td.td_link),
- "\20\1T\2Q\3VF",
- (int)le32toh(p->td.td_status),
- "\20\22BITSTUFF\23CRCTO\24NAK\25BABBLE\26DBUFFER\27"
- "STALLED\30ACTIVE\31IOC\32ISO\33LS\36SPD",
+
+ bitmask_snprintf((int)le32toh(p->td.td_link), "\20\1T\2Q\3VF",
+ sbuf, sizeof(sbuf));
+ bitmask_snprintf((int)le32toh(p->td.td_status),
+ "\20\22BITSTUFF\23CRCTO\24NAK\25BABBLE\26DBUFFER\27"
+ "STALLED\30ACTIVE\31IOC\32ISO\33LS\36SPD",
+ sbuf2, sizeof(sbuf2));
+
+ DPRINTFN(-1,(" %s %s,errcnt=%d,actlen=%d pid=%02x,addr=%d,endpt=%d,"
+ "D=%d,maxlen=%d\n", sbuf, sbuf2,
UHCI_TD_GET_ERRCNT(le32toh(p->td.td_status)),
UHCI_TD_GET_ACTLEN(le32toh(p->td.td_status)),
UHCI_TD_GET_PID(le32toh(p->td.td_token)),
OpenPOWER on IntegriCloud