Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/hpcmips/tx Detect overrun interrupt. and add spl.



details:   https://anonhg.NetBSD.org/src/rev/9721ba7ae68b
branches:  trunk
changeset: 479862:9721ba7ae68b
user:      uch <uch%NetBSD.org@localhost>
date:      Thu Dec 23 16:57:14 1999 +0000

description:
Detect overrun interrupt. and add spl.

diffstat:

 sys/arch/hpcmips/tx/txcom.c |  54 +++++++++++++++++++++++++++++++++++----------
 1 files changed, 42 insertions(+), 12 deletions(-)

diffs (119 lines):

diff -r fdc1e2c48c0c -r 9721ba7ae68b sys/arch/hpcmips/tx/txcom.c
--- a/sys/arch/hpcmips/tx/txcom.c       Thu Dec 23 16:56:16 1999 +0000
+++ b/sys/arch/hpcmips/tx/txcom.c       Thu Dec 23 16:57:14 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: txcom.c,v 1.1 1999/11/20 19:56:39 uch Exp $ */
+/*     $NetBSD: txcom.c,v 1.2 1999/12/23 16:57:14 uch Exp $ */
 
 /*
  * Copyright (c) 1999, by UCHIYAMA Yasushi
@@ -95,6 +95,7 @@
 int    txcom_txintr    __P((void*));
 int    txcom_a_rxintr  __P((void*));
 int    txcom_b_rxintr  __P((void*));
+int    txcom_overrun_intr      __P((void*));
 void   txcom_rxsoft    __P((void*));
 
 int    txcom_cngetc            __P((dev_t));
@@ -180,14 +181,22 @@
         */
        switch (sc->sc_slot) {
        case TX39_UARTA:
-               tx_intr_establish(tc, MAKEINTR(2, TX39_INTRSTATUS2_UARTARXINT),
-                                   IST_EDGE, IPL_TTY,
-                                   txcom_a_rxintr, sc);
+               tx_intr_establish(tc, MAKEINTR(2, 
+                                              TX39_INTRSTATUS2_UARTARXINT),
+                                 IST_EDGE, IPL_TTY,
+                                 txcom_a_rxintr, sc);
+               tx_intr_establish(
+                       tc, MAKEINTR(2, TX39_INTRSTATUS2_UARTARXOVERRUNINT),
+                       IST_EDGE, IPL_TTY, txcom_overrun_intr, sc);
                break;
        case TX39_UARTB:
-               tx_intr_establish(tc, MAKEINTR(2, TX39_INTRSTATUS2_UARTBRXINT),
-                                   IST_EDGE, IPL_TTY,
-                                   txcom_b_rxintr, sc);
+               tx_intr_establish(tc, MAKEINTR(2, 
+                                              TX39_INTRSTATUS2_UARTBRXINT),
+                                 IST_EDGE, IPL_TTY,
+                                 txcom_b_rxintr, sc);
+               tx_intr_establish(
+                       tc, MAKEINTR(2, TX39_INTRSTATUS2_UARTBRXOVERRUNINT),
+                       IST_EDGE, IPL_TTY, txcom_overrun_intr, sc);
                break;
        }
 }
@@ -273,19 +282,25 @@
        dev_t dev;
 {
        tx_chipset_tag_t tc;
-       int ofs, c;
+       int ofs, c, s;
+
+       s = splhigh();
+       
        tc = cn_sc.sc_tc;
-
        ofs = TX39_UARTCTRL1_REG(cn_sc.sc_slot);
 
        while(!(TX39_UARTCTRL1_RXHOLDFULL & tx_conf_read(tc, ofs)))
                ;
+       
        ofs = TX39_UARTRXHOLD_REG(cn_sc.sc_slot);
        c = TX39_UARTRXHOLD_RXDATA(tx_conf_read(tc, ofs));
+
        if (c == '\r') {
                c = '\n';
        }
 
+       splx(s);
+
        return c;
 }
 
@@ -295,19 +310,23 @@
        int c;
 {
        tx_chipset_tag_t tc;
-       int ofs;
+       int ofs, s;
+
+       s = splhigh();
 
        tc = cn_sc.sc_tc;
        ofs = TX39_UARTCTRL1_REG(cn_sc.sc_slot);
 
        while (!(tx_conf_read(tc, ofs) & TX39_UARTCTRL1_EMPTY))
-               delay(20);
+               ;
 
        tx_conf_write(tc, TX39_UARTTXHOLD_REG(cn_sc.sc_slot), 
                      (c & TX39_UARTTXHOLD_TXDATA_MASK));
 
        while (!(tx_conf_read(tc, ofs) & TX39_UARTCTRL1_EMPTY))
-               delay(20);
+               ;
+
+       splx(s);
 
 }
 
@@ -387,6 +406,17 @@
 }
 
 int
+txcom_overrun_intr(arg)
+       void *arg;
+{
+       struct txcom_softc *sc = arg;
+       
+       printf("UART%c overrun\n", sc->sc_slot ? 'B' : 'A');
+
+       return 0;
+}
+
+int
 txcom_a_rxintr(arg)
        void *arg;
 {



Home | Main Index | Thread Index | Old Index