diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2001-08-20 19:35:19 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2001-08-20 19:35:19 +0000 |
commit | 600584d723f2a9f1bb74bd3e73c06ac616c9d662 (patch) | |
tree | f0f8b48c4abd62c6dcdbfb2ff6ccf3999fcc891a /sys/arch/amiga/dev | |
parent | 3531acac1b9d17c154fc7f86da00912c64602a5d (diff) |
Convert to new timeouts; ite tested by jj@
Diffstat (limited to 'sys/arch/amiga/dev')
-rw-r--r-- | sys/arch/amiga/dev/if_bah.c | 9 | ||||
-rw-r--r-- | sys/arch/amiga/dev/ite.c | 14 | ||||
-rw-r--r-- | sys/arch/amiga/dev/ite_blank.c | 10 | ||||
-rw-r--r-- | sys/arch/amiga/dev/itevar.h | 6 | ||||
-rw-r--r-- | sys/arch/amiga/dev/par.c | 28 |
5 files changed, 45 insertions, 22 deletions
diff --git a/sys/arch/amiga/dev/if_bah.c b/sys/arch/amiga/dev/if_bah.c index 213a10ac44c..736c6677c9e 100644 --- a/sys/arch/amiga/dev/if_bah.c +++ b/sys/arch/amiga/dev/if_bah.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_bah.c,v 1.8 1997/09/18 13:39:55 niklas Exp $ */ +/* $OpenBSD: if_bah.c,v 1.9 2001/08/20 19:35:18 miod Exp $ */ /* $NetBSD: if_bah.c,v 1.30 1997/04/04 06:27:32 is Exp $ */ /* @@ -60,6 +60,7 @@ #include <sys/syslog.h> #include <sys/ioctl.h> #include <sys/errno.h> +#include <sys/timeout.h> #include <net/if.h> #include <net/if_dl.h> @@ -159,6 +160,7 @@ struct bah_softc { struct arccom sc_arccom; /* Common arcnet structures */ struct isr sc_isr; struct a2060 *sc_base; + struct timeout sc_tmo; u_long sc_recontime; /* seconds only, I'm lazy */ u_long sc_reconcount; /* for the above */ u_long sc_reconcount_excessive; /* for the above */ @@ -296,6 +298,7 @@ bah_zbus_attach(parent, self, aux) alloc_sicallback(); alloc_sicallback(); + timeout_set(&sc->sc_tmo, bah_reconwatch, sc); sc->sc_isr.isr_intr = bahintr; sc->sc_isr.isr_arg = sc; sc->sc_isr.isr_ipl = 2; @@ -1065,7 +1068,7 @@ bahintr(arg) * time if necessary. */ - untimeout(bah_reconwatch, (void *)sc); + timeout_del(&sc->sc_tmo); newsec = time.tv_sec; if ((newsec - sc->sc_recontime <= 2) && (++sc->sc_reconcount == ARC_EXCESSIVE_RECONS)) { @@ -1074,7 +1077,7 @@ bahintr(arg) sc->sc_dev.dv_xname); } sc->sc_recontime = newsec; - timeout(bah_reconwatch, (void *)sc, 15*hz); + timeout_add(&sc->sc_tmo, 15 * hz); } if (maskedisr & ARC_RI) { diff --git a/sys/arch/amiga/dev/ite.c b/sys/arch/amiga/dev/ite.c index 019fc81b039..99fb5472151 100644 --- a/sys/arch/amiga/dev/ite.c +++ b/sys/arch/amiga/dev/ite.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ite.c,v 1.13 2000/07/22 00:35:50 espie Exp $ */ +/* $OpenBSD: ite.c,v 1.14 2001/08/20 19:35:18 miod Exp $ */ /* $NetBSD: ite.c,v 1.47 1996/12/23 09:10:20 veego Exp $ */ /* @@ -916,6 +916,8 @@ ite_filter(c, caller) ite_restart_blanker(kbd_ite); kbd_tty = kbd_ite->tp; + if (!timeout_initialized(&kbd_ite->repeat_timeout)) + timeout_set(&kbd_ite->repeat_timeout, repeat_handler, NULL); /* have to make sure we're at spltty in here */ s = spltty(); @@ -945,7 +947,7 @@ ite_filter(c, caller) /* stop repeating on up event */ if (up) { if (tout_pending) { - untimeout(repeat_handler, 0); + timeout_del(&kbd_ite->repeat_timeout); tout_pending = 0; last_char = 0; } @@ -953,7 +955,7 @@ ite_filter(c, caller) return; } else if (tout_pending && last_char != c) { /* different character, stop also */ - untimeout(repeat_handler, 0); + timeout_del(&kbd_ite->repeat_timeout); tout_pending = 0; last_char = 0; } @@ -996,12 +998,14 @@ ite_filter(c, caller) if (!tout_pending && caller == ITEFILT_TTY && kbd_ite->key_repeat) { tout_pending = 1; last_char = c; - timeout(repeat_handler, 0, start_repeat_timeo * hz / 100); + timeout_add(&kbd_ite->repeat_timeout, + start_repeat_timeo * hz / 100); } else if (!tout_pending && caller == ITEFILT_REPEATER && kbd_ite->key_repeat) { tout_pending = 1; last_char = c; - timeout(repeat_handler, 0, next_repeat_timeo * hz / 100); + timeout_add(&kbd_ite->repeat_timeout, + next_repeat_timeo * hz / 100); } /* handle dead keys */ if (key.mode & KBD_MODE_DEAD) { diff --git a/sys/arch/amiga/dev/ite_blank.c b/sys/arch/amiga/dev/ite_blank.c index b1e1a64012b..14606e4b1e2 100644 --- a/sys/arch/amiga/dev/ite_blank.c +++ b/sys/arch/amiga/dev/ite_blank.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ite_blank.c,v 1.1 1999/11/05 17:15:34 espie Exp $ */ +/* $OpenBSD: ite_blank.c,v 1.2 2001/08/20 19:35:18 miod Exp $ */ /*- * Copyright (c) 1999 Marc Espie. * @@ -79,10 +79,12 @@ ite_restart_blanker(kbd) /* steal timing trick from pcvt */ if (last_schedule != time.tv_sec) { + if (!timeout_initialized(&kbd->blank_timeout)) + timeout_set(&kbd->blank_timeout, ite_blank, kbd); if (blank_enabled && !blanked_screen) - untimeout(ite_blank, kbd); + timeout_del(&kbd->blank_timeout); if (blank_enabled && blank_time) - timeout(ite_blank, kbd, blank_time * hz); + timeout_add(&kbd->blank_timeout, blank_time * hz); last_schedule = time.tv_sec; } ite_unblank(kbd); @@ -104,7 +106,7 @@ ite_disable_blanker(kbd) { int x = spltty(); - untimeout(ite_blank, kbd); + timeout_del(&kbd->blank_timeout); blank_enabled = 0; ite_unblank(kbd); diff --git a/sys/arch/amiga/dev/itevar.h b/sys/arch/amiga/dev/itevar.h index 6cf75a023a9..529ab8c4269 100644 --- a/sys/arch/amiga/dev/itevar.h +++ b/sys/arch/amiga/dev/itevar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: itevar.h,v 1.3 1996/05/02 06:44:14 niklas Exp $ */ +/* $OpenBSD: itevar.h,v 1.4 2001/08/20 19:35:18 miod Exp $ */ /* $NetBSD: itevar.h,v 1.14 1996/04/21 21:12:03 veego Exp $ */ /* @@ -33,6 +33,8 @@ #if ! defined (_ITEVAR_H) #define _ITEVAR_H +#include <sys/timeout.h> + enum ite_arraymaxs { MAX_ARGSIZE = 256, MAX_TABS = 256, @@ -52,6 +54,8 @@ enum ite_attr { struct ite_softc { struct device device; struct tty *tp; + struct timeout blank_timeout; + struct timeout repeat_timeout; char argbuf[MAX_ARGSIZE]; struct grf_softc *grf; /* XXX */ void *priv; diff --git a/sys/arch/amiga/dev/par.c b/sys/arch/amiga/dev/par.c index 77d75b8ab41..94b9d4aa6ee 100644 --- a/sys/arch/amiga/dev/par.c +++ b/sys/arch/amiga/dev/par.c @@ -1,4 +1,4 @@ -/* $OpenBSD: par.c,v 1.7 2001/02/07 07:46:50 art Exp $ */ +/* $OpenBSD: par.c,v 1.8 2001/08/20 19:35:18 miod Exp $ */ /* $NetBSD: par.c,v 1.16 1996/12/23 09:10:28 veego Exp $ */ /* @@ -51,6 +51,7 @@ #include <sys/file.h> #include <sys/systm.h> #include <sys/proc.h> +#include <sys/timeout.h> #include <amiga/amiga/device.h> #include <amiga/amiga/cia.h> @@ -65,6 +66,8 @@ struct par_softc { #define sc_burst sc_param.burst #define sc_timo sc_param.timo #define sc_delay sc_param.delay + struct timeout sc_partimo; + struct timeout sc_parstart; } *par_softcp; #define getparsp(x) (x > 0 ? NULL : par_softcp) @@ -110,6 +113,8 @@ struct cfdriver par_cd = { NULL, "par", DV_DULL, NULL, 0 }; +struct timeout tmo_parintr; + /*ARGSUSED*/ int parmatch(pdp, match, auxp) @@ -134,6 +139,7 @@ parattach(pdp, dp, auxp) if ((pardebug & PDB_NOCHECK) == 0) #endif par_softcp->sc_flags = PARF_ALIVE; + timeout_set(&tmo_parintr, parintr, par_softcp); printf("\n"); } @@ -296,7 +302,9 @@ parrw(dev, uio) if (sc->sc_timo > 0) { sc->sc_flags |= PARF_TIMO; - timeout(partimo, (void *)unit, sc->sc_timo); + if (!timeout_initialized(&sc->sc_partimo)) + timeout_set(&sc->sc_partimo, partimo, (caddr_t)unit); + timeout_add(&sc->sc_partimo, sc->sc_timo); } while (uio->uio_resid > 0) { @@ -329,7 +337,7 @@ again: #endif if (sc->sc_flags & PARF_TIMO) { - untimeout(partimo, (void *)unit); + timeout_del(&sc->sc_partimo); sc->sc_flags &= ~PARF_TIMO; } splx(s); @@ -395,7 +403,9 @@ again: if (sc->sc_delay > 0) { sc->sc_flags |= PARF_DELAY; - timeout(parstart, (void *)unit, sc->sc_delay); + if (!timeout_initialized(&sc->sc_parstart)) + timeout_set(&sc->sc_parstart, parstart, (caddr_t)unit); + timeout_add(&sc->sc_parstart, sc->sc_delay); error = tsleep(sc, PCATCH | (PZERO - 1), "par-cdelay", 0); if (error) { @@ -419,12 +429,12 @@ again: s = splsoftclock(); if (sc->sc_flags & PARF_TIMO) { - untimeout(partimo, (void *)unit); + timeout_del(&sc->sc_partimo); sc->sc_flags &= ~PARF_TIMO; } if (sc->sc_flags & PARF_DELAY) { - untimeout(parstart, (void *)unit); + timeout_del(&sc->sc_parstart); sc->sc_flags &= ~PARF_DELAY; } splx(s); @@ -540,7 +550,7 @@ parintr(arg) */ if (mask) { if (partimeout_pending) - untimeout(parintr, 0); + timeout_del(&tmo_parintr); if (parsend_pending) parsend_pending = 0; } @@ -576,7 +586,7 @@ parsendch (ch) & (CIAB_PRA_SEL|CIAB_PRA_BUSY|CIAB_PRA_POUT))); #endif /* wait a second, and try again */ - timeout(parintr, 0, hz); + timeout_add(&tmo_parintr, hz); partimeout_pending = 1; /* this is essentially a flipflop to have us wait for the first character being transmitted when trying to transmit @@ -592,7 +602,7 @@ parsendch (ch) printf ("parsendch interrupted, error = %d\n", error); #endif if (partimeout_pending) - untimeout(parintr, 0); + timeout_del(&tmo_parintr); partimeout_pending = 0; } |