Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/hpcsh/dev/hd64461 add primitive serial console debu...



details:   https://anonhg.NetBSD.org/src/rev/8061afd9e71d
branches:  trunk
changeset: 522115:8061afd9e71d
user:      uch <uch%NetBSD.org@localhost>
date:      Mon Feb 11 17:21:48 2002 +0000

description:
add primitive serial console debug routine.

diffstat:

 sys/arch/hpcsh/dev/hd64461/hd64461uart.c    |  21 +++++++++++++++++----
 sys/arch/hpcsh/dev/hd64461/hd64461uartreg.h |   3 ++-
 sys/arch/hpcsh/dev/hd64461/hd64461uartvar.h |  23 ++++++++++++++++++++++-
 3 files changed, 41 insertions(+), 6 deletions(-)

diffs (117 lines):

diff -r 88934996a42f -r 8061afd9e71d sys/arch/hpcsh/dev/hd64461/hd64461uart.c
--- a/sys/arch/hpcsh/dev/hd64461/hd64461uart.c  Mon Feb 11 17:20:18 2002 +0000
+++ b/sys/arch/hpcsh/dev/hd64461/hd64461uart.c  Mon Feb 11 17:21:48 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: hd64461uart.c,v 1.6 2002/01/29 18:53:24 uch Exp $      */
+/*     $NetBSD: hd64461uart.c,v 1.7 2002/02/11 17:21:48 uch Exp $      */
 
 /*-
  * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@@ -33,6 +33,8 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include "opt_kgdb.h"
+
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/reboot.h>
@@ -45,6 +47,7 @@
 
 #include <machine/bus.h>
 #include <machine/intr.h>
+#include <machine/console.h>
 
 #include <dev/ic/comvar.h>
 #include <dev/ic/comreg.h>
@@ -54,6 +57,8 @@
 #include <hpcsh/dev/hd64461/hd64461var.h>
 #include <hpcsh/dev/hd64461/hd64461reg.h>
 #include <hpcsh/dev/hd64461/hd64461intcvar.h>
+#include <hpcsh/dev/hd64461/hd64461uartvar.h>
+#include <hpcsh/dev/hd64461/hd64461uartreg.h>
 
 STATIC struct hd64461uart_chip {
        struct hpcsh_bus_space __tag_body;
@@ -112,7 +117,15 @@
 
        hd64461uart_init();
 
-       comcnattach(hd64461uart_chip.io_tag, 0x0, COMCN_SPEED, COM_FREQ, 
+#ifdef KGDB
+       if (strcmp(kgdb_devname, "hd64461uart") == 0) {
+               if (com_kgdb_attach(hd64461uart_chip.io_tag, 0x0, COMCN_SPEED,
+                   COM_FREQ, CONMODE) == 0) {
+                       return;
+               }
+       }
+#endif /* KGDB */
+       comcnattach(hd64461uart_chip.io_tag, 0x0, COMCN_SPEED, COM_FREQ,
            CONMODE);   
 
        hd64461uart_chip.console = 1;
@@ -188,7 +201,7 @@
 hd64461uart_read_1(void *t, bus_space_handle_t h, bus_size_t ofs)
 {
 
-       return *(volatile u_int8_t *)(h + (ofs << 1));
+       return *(__volatile__ u_int8_t *)(h + (ofs << 1));
 }
 
 void
@@ -196,5 +209,5 @@
     u_int8_t val)
 {
 
-       *(volatile u_int8_t *)(h + (ofs << 1)) = val;   
+       *(__volatile__ u_int8_t *)(h + (ofs << 1)) = val;       
 }
diff -r 88934996a42f -r 8061afd9e71d sys/arch/hpcsh/dev/hd64461/hd64461uartreg.h
--- a/sys/arch/hpcsh/dev/hd64461/hd64461uartreg.h       Mon Feb 11 17:20:18 2002 +0000
+++ b/sys/arch/hpcsh/dev/hd64461/hd64461uartreg.h       Mon Feb 11 17:21:48 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: hd64461uartreg.h,v 1.2 2001/04/19 18:22:34 uch Exp $   */
+/*     $NetBSD: hd64461uartreg.h,v 1.3 2002/02/11 17:21:48 uch Exp $   */
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -64,3 +64,4 @@
 /* Scratch Pad Register */
 #define HD64461_USCR_REG8                      0xb000800e
 
+#define        LSR_TXRDY       0x20    /* Transmitter buffer empty */
diff -r 88934996a42f -r 8061afd9e71d sys/arch/hpcsh/dev/hd64461/hd64461uartvar.h
--- a/sys/arch/hpcsh/dev/hd64461/hd64461uartvar.h       Mon Feb 11 17:20:18 2002 +0000
+++ b/sys/arch/hpcsh/dev/hd64461/hd64461uartvar.h       Mon Feb 11 17:21:48 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: hd64461uartvar.h,v 1.2 2001/04/19 18:24:16 uch Exp $   */
+/*     $NetBSD: hd64461uartvar.h,v 1.3 2002/02/11 17:21:48 uch Exp $   */
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -36,4 +36,25 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
+#define HD64461COM_TX_BUSY()                                           \
+       while ((*(volatile u_int8_t *)HD64461_ULSR_REG8 & LSR_TXRDY) == 0)
 
+#define HD64461COM_PUTC(c)                                             \
+do {                                                                   \
+       HD64461COM_TX_BUSY();                                           \
+       *(volatile u_int8_t *)HD64461_UTBR_REG8 =  c;                   \
+       HD64461COM_TX_BUSY();                                           \
+} while (/*CONSTCOND*/0)
+
+#define HD64461COM_PRINT(s)                                            \
+do {                                                                   \
+       char *__s =(char *)(s);                                         \
+       int __i;                                                        \
+       for (__i = 0; __s[__i] != '\0'; __i++) {                        \
+               char __c = __s[__i];                                    \
+               if (__c == '\n')                                        \
+                       HD64461COM_PUTC('\r');                          \
+               HD64461COM_PUTC(__c);                                   \
+       }                                                               \
+} while (/*CONSTCOND*/0)
+



Home | Main Index | Thread Index | Old Index