Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/hpcmips Change tx_poll_establish implementation and...



details:   https://anonhg.NetBSD.org/src/rev/a58869e38052
branches:  trunk
changeset: 480096:a58869e38052
user:      uch <uch%NetBSD.org@localhost>
date:      Mon Jan 03 18:24:03 2000 +0000

description:
Change tx_poll_establish implementation and interface.

diffstat:

 sys/arch/hpcmips/dev/m38813c.c     |   6 ++--
 sys/arch/hpcmips/dev/p7416buf.c    |   4 +-
 sys/arch/hpcmips/dev/tc5165buf.c   |   6 ++--
 sys/arch/hpcmips/tx/tx39.c         |  47 ++++++++++++++++++++++++++----
 sys/arch/hpcmips/tx/tx39clock.c    |  41 ++++++++++++++++++++++++---
 sys/arch/hpcmips/tx/tx39clockvar.h |  30 ++++++++++++++++++++
 sys/arch/hpcmips/tx/tx39icu.c      |  57 +++++++++++++++++++++++++++----------
 sys/arch/hpcmips/tx/tx39power.c    |   6 ++-
 sys/arch/hpcmips/tx/tx39timerreg.h |   5 ++-
 sys/arch/hpcmips/tx/tx39var.h      |  17 ++++++++---
 10 files changed, 174 insertions(+), 45 deletions(-)

diffs (truncated from 486 to 300 lines):

diff -r 27feca8a5bee -r a58869e38052 sys/arch/hpcmips/dev/m38813c.c
--- a/sys/arch/hpcmips/dev/m38813c.c    Mon Jan 03 11:56:05 2000 +0000
+++ b/sys/arch/hpcmips/dev/m38813c.c    Mon Jan 03 18:24:03 2000 +0000
@@ -1,7 +1,7 @@
-/*     $NetBSD: m38813c.c,v 1.1 1999/12/08 15:51:07 uch Exp $ */
+/*     $NetBSD: m38813c.c,v 1.2 2000/01/03 18:24:03 uch Exp $ */
 
 /*
- * Copyright (c) 1999, by UCHIYAMA Yasushi
+ * Copyright (c) 1999, 2000, by UCHIYAMA Yasushi
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -110,7 +110,7 @@
 #ifndef USE_POLL
 #error options USE_POLL requied.
 #endif
-       if (!(sc->sc_ih = tx39_poll_establish(sc->sc_tc, 5, IST_EDGE, 
+       if (!(sc->sc_ih = tx39_poll_establish(sc->sc_tc, 1,
                                              IPL_TTY, m38813c_intr,
                                              sc))) {
                printf(": can't establish interrupt\n");
diff -r 27feca8a5bee -r a58869e38052 sys/arch/hpcmips/dev/p7416buf.c
--- a/sys/arch/hpcmips/dev/p7416buf.c   Mon Jan 03 11:56:05 2000 +0000
+++ b/sys/arch/hpcmips/dev/p7416buf.c   Mon Jan 03 18:24:03 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: p7416buf.c,v 1.2 1999/12/08 16:22:10 uch Exp $ */
+/*     $NetBSD: p7416buf.c,v 1.3 2000/01/03 18:24:03 uch Exp $ */
 
 /*
  * Copyright (c) 1999, by UCHIYAMA Yasushi
@@ -120,7 +120,7 @@
 #ifndef USE_POLL
 #error options USE_POLL requied.
 #endif
-       if (!(sc->sc_ih = tx39_poll_establish(sc->sc_tc, 1, IST_EDGE, 
+       if (!(sc->sc_ih = tx39_poll_establish(sc->sc_tc, 1,
                                              IPL_TTY, p7416buf_intr, 
                                              sc))) {
                printf(": can't establish interrupt\n");
diff -r 27feca8a5bee -r a58869e38052 sys/arch/hpcmips/dev/tc5165buf.c
--- a/sys/arch/hpcmips/dev/tc5165buf.c  Mon Jan 03 11:56:05 2000 +0000
+++ b/sys/arch/hpcmips/dev/tc5165buf.c  Mon Jan 03 18:24:03 2000 +0000
@@ -1,7 +1,7 @@
-/*     $NetBSD: tc5165buf.c,v 1.1 1999/12/12 17:10:01 uch Exp $ */
+/*     $NetBSD: tc5165buf.c,v 1.2 2000/01/03 18:24:03 uch Exp $ */
 
 /*
- * Copyright (c) 1999, by UCHIYAMA Yasushi
+ * Copyright (c) 1999, 2000, by UCHIYAMA Yasushi
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -126,7 +126,7 @@
                return;
        }
 #endif
-       if (!(sc->sc_ih = tx39_poll_establish(sc->sc_tc, 1, IST_EDGE, 
+       if (!(sc->sc_ih = tx39_poll_establish(sc->sc_tc, 1,
                                              IPL_TTY, tc5165buf_poll, 
                                              sc->sc_chip))) {
                printf(": can't establish interrupt\n");
diff -r 27feca8a5bee -r a58869e38052 sys/arch/hpcmips/tx/tx39.c
--- a/sys/arch/hpcmips/tx/tx39.c        Mon Jan 03 11:56:05 2000 +0000
+++ b/sys/arch/hpcmips/tx/tx39.c        Mon Jan 03 18:24:03 2000 +0000
@@ -1,7 +1,7 @@
-/*     $NetBSD: tx39.c,v 1.8 1999/12/22 15:35:35 uch Exp $ */
+/*     $NetBSD: tx39.c,v 1.9 2000/01/03 18:24:04 uch Exp $ */
 
 /*
- * Copyright (c) 1999, by UCHIYAMA Yasushi
+ * Copyright (c) 1999, 2000, by UCHIYAMA Yasushi
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -337,6 +337,38 @@
        tx_chipset.tc_intrt = intrt;
 }
 
+void
+tx_conf_register_power(t, powert)
+       tx_chipset_tag_t t;
+       void *powert;
+{
+       if (tx_chipset.tc_powert) {
+               panic("duplicate powert");
+       }
+
+       if (t != &tx_chipset) {
+               panic("bogus tx_chipset_tag");
+       }
+
+       tx_chipset.tc_powert = powert;
+}
+
+void
+tx_conf_register_clock(t, clockt)
+       tx_chipset_tag_t t;
+       void *clockt;
+{
+       if (tx_chipset.tc_clockt) {
+               panic("duplicate clockt");
+       }
+
+       if (t != &tx_chipset) {
+               panic("bogus tx_chipset_tag");
+       }
+
+       tx_chipset.tc_clockt = clockt;
+}
+
 #ifdef TX39_PREFER_FUNCTION
 tx_chipset_tag_t
 tx_conf_get_tag()
@@ -368,9 +400,10 @@
        int mask;
        char *name;
 {
-       if (reg & mask) {
-               printf("%s ", name);
-               return 1;
-       }
-       return 0;
+       const char onoff[2] = "_x";
+       int ret = reg & mask ? 1 : 0;
+
+       printf("%s[%c] ", name, onoff[ret]);
+
+       return ret;
 }
diff -r 27feca8a5bee -r a58869e38052 sys/arch/hpcmips/tx/tx39clock.c
--- a/sys/arch/hpcmips/tx/tx39clock.c   Mon Jan 03 11:56:05 2000 +0000
+++ b/sys/arch/hpcmips/tx/tx39clock.c   Mon Jan 03 18:24:03 2000 +0000
@@ -1,7 +1,7 @@
-/*     $NetBSD: tx39clock.c,v 1.4 1999/12/23 16:58:48 uch Exp $ */
+/*     $NetBSD: tx39clock.c,v 1.5 2000/01/03 18:24:04 uch Exp $ */
 
 /*
- * Copyright (c) 1999, by UCHIYAMA Yasushi
+ * Copyright (c) 1999, 2000 by UCHIYAMA Yasushi
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -40,6 +40,7 @@
 
 #include <hpcmips/tx/tx39var.h>
 #include <hpcmips/tx/tx39icureg.h>
+#include <hpcmips/tx/tx39clockvar.h>
 #include <hpcmips/tx/tx39clockreg.h>
 #include <hpcmips/tx/tx39timerreg.h>
 
@@ -70,6 +71,8 @@
        struct  device sc_dev;
        tx_chipset_tag_t sc_tc;
 
+       int sc_alarm;
+
        int sc_enabled;
        int sc_year;
        struct clocktime sc_epoch;
@@ -111,6 +114,7 @@
        txreg_t reg;
 
        tc = sc->sc_tc = ta->ta_tc;
+       tx_conf_register_clock(tc, self);
 
        /* Reset timer module */
        tx_conf_write(tc, TX39_TIMERCONTROL_REG, 0);
@@ -243,16 +247,16 @@
        tx_conf_write(tc, TX39_TIMERCONTROL_REG, reg);
 }
 
+
 void
 tx39clock_init(dev)
        struct device *dev;
 {
-       tx_chipset_tag_t tc;
+       struct tx39clock_softc *sc = (void*)dev;
+       tx_chipset_tag_t tc = sc->sc_tc;
        txreg_t reg;
        int pcnt;
 
-       tc = tx_conf_get_tag();
-
        /* 
         * Setup periodic timer (interrupting hz times per second.) 
         */
@@ -333,6 +337,33 @@
        }
 }
 
+int
+tx39clock_alarm_set(tc, msec)
+       tx_chipset_tag_t tc;
+       int msec;
+{
+       struct tx39clock_softc *sc = tc->tc_clockt;
+
+       sc->sc_alarm = TX39_MSEC2RTC(msec);
+       tx39clock_alarm_refill(tc);
+
+       return 0;
+}
+
+void
+tx39clock_alarm_refill(tc)
+       tx_chipset_tag_t tc;
+{
+       struct tx39clock_softc *sc = tc->tc_clockt;
+       struct txtime t;        
+       
+       __tx39timer_rtcget(&t);
+
+       tx_conf_write(tc, TX39_TIMERALARMHI_REG, t.t_hi); /* XXX */
+       tx_conf_write(tc, TX39_TIMERALARMLO_REG, t.t_lo + sc->sc_alarm);
+
+}
+
 void
 tx39clock_dump(tc)
        tx_chipset_tag_t tc;
diff -r 27feca8a5bee -r a58869e38052 sys/arch/hpcmips/tx/tx39clockvar.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/hpcmips/tx/tx39clockvar.h        Mon Jan 03 18:24:03 2000 +0000
@@ -0,0 +1,30 @@
+/*     $NetBSD: tx39clockvar.h,v 1.1 2000/01/03 18:24:05 uch Exp $ */
+
+/*
+ * Copyright (c) 2000, by UCHIYAMA Yasushi
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. The name of the developer may NOT be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ */
+
+int    tx39clock_alarm_set __P((tx_chipset_tag_t, int));
+void   tx39clock_alarm_refill __P((tx_chipset_tag_t));
diff -r 27feca8a5bee -r a58869e38052 sys/arch/hpcmips/tx/tx39icu.c
--- a/sys/arch/hpcmips/tx/tx39icu.c     Mon Jan 03 11:56:05 2000 +0000
+++ b/sys/arch/hpcmips/tx/tx39icu.c     Mon Jan 03 18:24:03 2000 +0000
@@ -1,7 +1,7 @@
-/*     $NetBSD: tx39icu.c,v 1.4 1999/12/23 17:24:30 uch Exp $ */
+/*     $NetBSD: tx39icu.c,v 1.5 2000/01/03 18:24:04 uch Exp $ */
 
 /*
- * Copyright (c) 1999, by UCHIYAMA Yasushi
+ * Copyright (c) 1999, 2000 by UCHIYAMA Yasushi
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -44,6 +44,7 @@
 
 #include <hpcmips/tx/tx39var.h>
 #include <hpcmips/tx/tx39icureg.h>
+#include <hpcmips/tx/tx39clockvar.h>
 
 #include <machine/clock_machdep.h>
 #include <machine/cpu.h>
@@ -619,17 +620,19 @@
 
 #ifdef USE_POLL
 void*
-tx39_poll_establish(tc, interval, mode, level, ih_fun, ih_arg)
+tx39_poll_establish(tc, interval, level, ih_fun, ih_arg)
        tx_chipset_tag_t tc;
        int interval;
-       int mode;  /* Trigger setting. but TX39 handles edge only. */
        int level; /* XXX not yet */
        int (*ih_fun) __P((void*));
        void *ih_arg;
 {
        struct tx39icu_softc *sc;
        struct txpoll_entry *p;
-
+       int s;
+       void *ret;
+       
+       s = splhigh();
        sc = tc->tc_intrt;
 
        if (!(p = malloc(sizeof(struct txpoll_entry), 



Home | Main Index | Thread Index | Old Index