Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch Fixed debug print.
details: https://anonhg.NetBSD.org/src/rev/90f138cef4ca
branches: trunk
changeset: 526420:90f138cef4ca
user: takemura <takemura%NetBSD.org@localhost>
date: Fri May 03 07:31:23 2002 +0000
description:
Fixed debug print.
diffstat:
sys/arch/hpc/hpc/debug_subr.c | 18 +++++++++++-------
sys/arch/hpc/include/debug.h | 11 ++++++++---
sys/arch/hpcmips/dev/it8368.c | 10 +++++-----
sys/arch/hpcmips/tx/tx39icu.c | 13 +++++++------
sys/arch/hpcmips/vr/vrgiu.c | 12 +++++++-----
sys/arch/hpcsh/dev/hd64461/hd64461video.c | 4 ++--
6 files changed, 40 insertions(+), 28 deletions(-)
diffs (207 lines):
diff -r d27b129b0b73 -r 90f138cef4ca sys/arch/hpc/hpc/debug_subr.c
--- a/sys/arch/hpc/hpc/debug_subr.c Fri May 03 06:56:20 2002 +0000
+++ b/sys/arch/hpc/hpc/debug_subr.c Fri May 03 07:31:23 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: debug_subr.c,v 1.3 2002/02/22 19:56:27 uch Exp $ */
+/* $NetBSD: debug_subr.c,v 1.4 2002/05/03 07:31:23 takemura Exp $ */
/*-
* Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@@ -50,7 +50,7 @@
void
__dbg_bit_print(u_int32_t a, int len, int start, int end, char *title,
- int count)
+ int flags)
{
u_int32_t j, j1;
int i, n;
@@ -60,7 +60,8 @@
j1 = 1 << n;
end = end ? end : n;
- printf(" ");
+ if (!(flags & DBG_BIT_PRINT_QUIET))
+ printf(" ");
if (title) {
printf("[%-16s] ", title);
}
@@ -73,10 +74,12 @@
}
}
- snprintf(buf, sizeof buf, " [0x%%0%dx %%12d]", len << 1);
- printf(buf, a, a);
+ if (!(flags & DBG_BIT_PRINT_QUIET)) {
+ snprintf(buf, sizeof buf, " [0x%%0%dx %%12d]", len << 1);
+ printf(buf, a, a);
+ }
- if (count) {
+ if (flags & DBG_BIT_PRINT_COUNT) {
for (j = j1, i = n; j > 0; j >>=1, i--) {
if (!(i > end || i < start) && (a & j)) {
printf(" %d", i);
@@ -84,7 +87,8 @@
}
}
- printf("\n");
+ if (!(flags & DBG_BIT_PRINT_QUIET))
+ printf("\n");
}
void
diff -r d27b129b0b73 -r 90f138cef4ca sys/arch/hpc/include/debug.h
--- a/sys/arch/hpc/include/debug.h Fri May 03 06:56:20 2002 +0000
+++ b/sys/arch/hpc/include/debug.h Fri May 03 07:31:23 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: debug.h,v 1.3 2002/02/13 16:25:33 uch Exp $ */
+/* $NetBSD: debug.h,v 1.4 2002/05/03 07:31:24 takemura Exp $ */
/*-
* Copyright (c) 1999-2002 The NetBSD Foundation, Inc.
@@ -103,9 +103,14 @@
/*
* debug print utility
*/
-#define dbg_bit_print(a) __dbg_bit_print((a), sizeof(typeof(a)), 0, 0, 0, 1)
+#define DBG_BIT_PRINT_COUNT (1 << 0)
+#define DBG_BIT_PRINT_QUIET (1 << 1)
+#define dbg_bit_print(a) \
+ __dbg_bit_print((a), sizeof(typeof(a)), 0, 0, 0, DBG_BIT_PRINT_COUNT)
#define dbg_bit_print_msg(a, m) \
- __dbg_bit_print((a), sizeof(typeof(a)), 0, 0, (m), 1)
+ __dbg_bit_print((a), sizeof(typeof(a)), 0, 0, (m), DBG_BIT_PRINT_COUNT)
+#define dbg_bit_display(a) \
+ __dbg_bit_print((a), sizeof(typeof(a)), 0, 0, 0, DBG_BIT_PRINT_QUIET)
void __dbg_bit_print(u_int32_t, int, int, int, char *, int);
void dbg_bitmask_print(u_int32_t, u_int32_t, const char *);
void dbg_draw_line(int);
diff -r d27b129b0b73 -r 90f138cef4ca sys/arch/hpcmips/dev/it8368.c
--- a/sys/arch/hpcmips/dev/it8368.c Fri May 03 06:56:20 2002 +0000
+++ b/sys/arch/hpcmips/dev/it8368.c Fri May 03 07:31:23 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: it8368.c,v 1.12 2002/01/29 18:53:09 uch Exp $ */
+/* $NetBSD: it8368.c,v 1.13 2002/05/03 07:31:24 takemura Exp $ */
/*-
* Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
@@ -745,9 +745,9 @@
#ifdef IT8368DEBUG
#define PRINTGPIO(m) __dbg_bit_print(it8368_reg_read(csregt, csregh, \
- IT8368_GPIO##m##_REG), 0, IT8368_GPIO_MAX, #m, 1)
+ IT8368_GPIO##m##_REG), 0, IT8368_GPIO_MAX, #m, DBG_BIT_PRINT_COUNT)
#define PRINTMFIO(m) __dbg_bit_print(it8368_reg_read(csregt, csregh, \
- IT8368_MFIO##m##_REG), 0, IT8368_MFIO_MAX, #m, 1)
+ IT8368_MFIO##m##_REG), 0, IT8368_MFIO_MAX, #m, DBG_BIT_PRINT_COUNT)
void
it8368_dump(struct it8368e_softc *sc)
{
@@ -772,8 +772,8 @@
PRINTMFIO(POSINTSTAT);
PRINTMFIO(NEGINTSTAT);
__dbg_bit_print(it8368_reg_read(csregt, csregh, IT8368_CTRL_REG), 0, 15,
- "CTRL", 1);
+ "CTRL", DBG_BIT_PRINT_COUNT);
__dbg_bit_print(it8368_reg_read(csregt, csregh, IT8368_GPIODATAIN_REG),
- 8, 11, "]CRDDET/SENSE[", 1);
+ 8, 11, "]CRDDET/SENSE[", DBG_BIT_PRINT_COUNT);
}
#endif /* IT8368DEBUG */
diff -r d27b129b0b73 -r 90f138cef4ca sys/arch/hpcmips/tx/tx39icu.c
--- a/sys/arch/hpcmips/tx/tx39icu.c Fri May 03 06:56:20 2002 +0000
+++ b/sys/arch/hpcmips/tx/tx39icu.c Fri May 03 07:31:23 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tx39icu.c,v 1.16 2002/01/29 18:53:15 uch Exp $ */
+/* $NetBSD: tx39icu.c,v 1.17 2002/05/03 07:31:25 takemura Exp $ */
/*-
* Copyright (c) 1999-2001 The NetBSD Foundation, Inc.
@@ -402,7 +402,7 @@
pend &= ~reg;
if (pend) {
printf("%d pending:", i);
- __dbg_bit_print(pend, 0, 31, 0, 1);
+ dbg_bit_print(pend);
}
#endif
@@ -761,13 +761,13 @@
}
}
sprintf(msg, "%d high", i);
- __dbg_bit_print(reg, sizeof(reg), 0, 0, msg, 1);
+ dbg_bit_print_msg(reg, msg);
sprintf(msg, "%d status", i);
- __dbg_bit_print(sc->sc_regs[i], sizeof(reg), 0, 0, msg, 1);
+ dbg_bit_print_msg(sc->sc_regs[i], msg);
ofs = TX39_INTRENABLE_REG(i);
reg = tx_conf_read(tc, ofs);
sprintf(msg, "%d enable", i);
- __dbg_bit_print(reg, sizeof(reg), 0, 0, msg, 1);
+ dbg_bit_print_msg(reg, msg);
}
reg = sc->sc_regs[0];
printf("<%s><%s> vector=%2d\t\t[6 status]\n",
@@ -775,6 +775,7 @@
reg & TX39_INTRSTATUS6_IRQLOW ? "LO" : "--",
TX39_INTRSTATUS6_INTVECT(reg));
reg = tx_conf_read(tc, TX39_INTRENABLE6_REG);
- __dbg_bit_print(reg, sizeof(reg), 0, 18, "6 enable", 1);
+ __dbg_bit_print(reg, sizeof(reg), 0, 18, "6 enable",
+ DBG_BIT_PRINT_COUNT);
}
diff -r d27b129b0b73 -r 90f138cef4ca sys/arch/hpcmips/vr/vrgiu.c
--- a/sys/arch/hpcmips/vr/vrgiu.c Fri May 03 06:56:20 2002 +0000
+++ b/sys/arch/hpcmips/vr/vrgiu.c Fri May 03 07:31:23 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vrgiu.c,v 1.34 2002/02/10 13:47:06 takemura Exp $ */
+/* $NetBSD: vrgiu.c,v 1.35 2002/05/03 07:31:25 takemura Exp $ */
/*-
* Copyright (c) 1999-2001
* Shin Takemura and PocketBSD Project. All rights reserved.
@@ -363,8 +363,9 @@
vrgiu_dump_io(struct vrgiu_softc *sc)
{
- dbg_bit_print(vrgiu_regread_4(sc, GIUPIOD_REG));
- dbg_bit_print(vrgiu_regread_4(sc, GIUPODAT_REG));
+ dbg_bit_display(vrgiu_regread_4(sc, GIUPODAT_REG));
+ dbg_bit_display(vrgiu_regread_4(sc, GIUPIOD_REG));
+ printf("\n");
}
void
@@ -379,8 +380,9 @@
if (opreg[0] != preg[0] || opreg[1] != preg[1]) {
printf("giu data: ");
- dbg_bit_print(preg[0]);
- dbg_bit_print(preg[1]);
+ dbg_bit_display(preg[1]);
+ dbg_bit_display(preg[0]);
+ printf("\n");
}
opreg[0] = preg[0];
opreg[1] = preg[1];
diff -r d27b129b0b73 -r 90f138cef4ca sys/arch/hpcsh/dev/hd64461/hd64461video.c
--- a/sys/arch/hpcsh/dev/hd64461/hd64461video.c Fri May 03 06:56:20 2002 +0000
+++ b/sys/arch/hpcsh/dev/hd64461/hd64461video.c Fri May 03 07:31:23 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: hd64461video.c,v 1.10 2002/04/13 09:29:54 takemura Exp $ */
+/* $NetBSD: hd64461video.c,v 1.11 2002/05/03 07:31:25 takemura Exp $ */
/*-
* Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@@ -1225,7 +1225,7 @@
printf("---[Display Mode Setting]---\n");
#define DUMPREG(x) \
r = hd64461_reg_read_2(HD64461_LCD ## x ## _REG16); \
- __dbg_bit_print(r, sizeof(u_int16_t), 0, 0, #x, 1)
+ __dbg_bit_print(r, sizeof(u_int16_t), 0, 0, #x, DBG_BIT_PRINT_COUNT)
DUMPREG(CBAR);
DUMPREG(CLOR);
DUMPREG(CCR);
Home |
Main Index |
Thread Index |
Old Index