diff options
author | Jason Wright <jason@cvs.openbsd.org> | 2003-04-02 23:45:30 +0000 |
---|---|---|
committer | Jason Wright <jason@cvs.openbsd.org> | 2003-04-02 23:45:30 +0000 |
commit | 9f460e24b686c92fed4fca1e0fb93274d0930222 (patch) | |
tree | 29b842f61d1319c137b0bc866cdea358229d8175 /sys/arch/vax | |
parent | 4d2e69a4def08a469de9a7d4508e47e6cca5a1b8 (diff) |
DZ-11 (or the DZ-11 alike in the VS4000/VLC anyway) only interrupts when
the RX fifo goes from 0 -> 1 characters. If the FIFO is filled (eg. during
autoconf where interrupts are cleared), the dz will never interrupt for
rx again. Solution: drain the fifo on first open. ok hugh
Diffstat (limited to 'sys/arch/vax')
-rw-r--r-- | sys/arch/vax/qbus/dz.c | 17 | ||||
-rw-r--r-- | sys/arch/vax/qbus/dzvar.h | 3 |
2 files changed, 18 insertions, 2 deletions
diff --git a/sys/arch/vax/qbus/dz.c b/sys/arch/vax/qbus/dz.c index d31dfe75d8f..e75b6b03e1c 100644 --- a/sys/arch/vax/qbus/dz.c +++ b/sys/arch/vax/qbus/dz.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dz.c,v 1.8 2002/02/15 20:45:30 nordin Exp $ */ +/* $OpenBSD: dz.c,v 1.9 2003/04/02 23:45:29 jason Exp $ */ /* $NetBSD: dz.c,v 1.23 2000/06/04 02:14:12 matt Exp $ */ /* * Copyright (c) 1996 Ken C. Wellsch. All rights reserved. @@ -113,6 +113,7 @@ static void dzstart(struct tty *); static int dzparam(struct tty *, struct termios *); static unsigned dzmctl(struct dz_softc *, int, int, int); static void dzscan(void *); +static void dzdrain(struct dz_softc *); struct cfdriver dz_cd = { NULL, "dz", DV_TTY @@ -140,6 +141,7 @@ dzattach(struct dz_softc *sc) sc->sc_dr.dr_tcrw = sc->sc_dr.dr_tcr; DZ_WRITE_WORD(dr_csr, DZ_CSR_MSE | DZ_CSR_RXIE | DZ_CSR_TXIE); + dzdrain(sc); DZ_WRITE_BYTE(dr_dtr, 0); DZ_WRITE_BYTE(dr_break, 0); @@ -296,6 +298,9 @@ dzopen(dev_t dev, int flag, int mode, struct proc *p) sc = dz_cd.cd_devs[unit]; + if (sc->sc_openings++ == 0) + dzdrain(sc); + if (line >= sc->sc_type) return ENXIO; @@ -359,6 +364,7 @@ dzclose(dev_t dev, int flag, int mode, struct proc *p) if ((tp->t_cflag & HUPCL) || !(tp->t_state & TS_ISOPEN)) (void) dzmctl(sc, line, 0, DMSET); + sc->sc_openings--; return (ttyclose(tp)); } @@ -721,3 +727,12 @@ dzreset(struct device *dev) dzstart(tp); /* Kick off transmitter again */ } } + +/* + * Drain RX fifo. + */ +static void +dzdrain(struct dz_softc *sc) { + while (DZ_READ_WORD(dr_rbuf) & DZ_RBUF_DATA_VALID) + /*EMPTY*/; +} diff --git a/sys/arch/vax/qbus/dzvar.h b/sys/arch/vax/qbus/dzvar.h index 2ece7a31ff3..1c0c490867e 100644 --- a/sys/arch/vax/qbus/dzvar.h +++ b/sys/arch/vax/qbus/dzvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: dzvar.h,v 1.3 2001/08/25 13:33:37 hugh Exp $ */ +/* $OpenBSD: dzvar.h,v 1.4 2003/04/02 23:45:29 jason Exp $ */ /* $NetBSD: dzvar.h,v 1.8 2000/06/04 02:14:12 matt Exp $ */ /* * Copyright (c) 1996 Ken C. Wellsch. All rights reserved. @@ -58,6 +58,7 @@ struct dz_softc { bus_space_handle_t sc_ioh; int sc_type; /* DZ11 or DZV11? */ int sc_rxint; /* Receive interrupt count XXX */ + int sc_openings; /* # of times we've been opened */ u_char sc_brk; /* Break asserted on some lines */ u_char sc_dsr; /* DSR set bits if no mdm ctrl */ struct dz_linestate { |