From 9737cf763ab7a6b13d2fdbcfc403249ca8bd71a7 Mon Sep 17 00:00:00 2001 From: scw Date: Sat, 3 Apr 1999 13:13:19 +0000 Subject: [PATCH] Fix a problem where no Tx Empty interrupt ever happened if CTS was deasserted and we wanted to change parameters to -crtscts This effectively stalled the transmitter since with TS_BUSY set we only change parameters during the Tx interrupt handler. --- sys/dev/ic/clmpcc.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/sys/dev/ic/clmpcc.c b/sys/dev/ic/clmpcc.c index 9622b45dbae8..14929ca92142 100644 --- a/sys/dev/ic/clmpcc.c +++ b/sys/dev/ic/clmpcc.c @@ -1,4 +1,4 @@ -/* $NetBSD: clmpcc.c,v 1.4 1999/02/21 14:01:50 scw Exp $ */ +/* $NetBSD: clmpcc.c,v 1.5 1999/04/03 13:13:19 scw Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -817,6 +817,7 @@ clmpcc_param(tp, t) struct clmpcc_softc *sc = clmpcc_cd.cd_devs[CLMPCCUNIT(tp->t_dev)]; struct clmpcc_chan *ch = &sc->sc_chans[CLMPCCCHAN(tp->t_dev)]; u_char cor; + u_char oldch; int oclk, obpr; int iclk, ibpr; int s; @@ -921,13 +922,22 @@ clmpcc_param(tp, t) ch->ch_cor5 = 0; s = splserial(); - if ( ISCLR(ch->ch_tty->t_state, TS_BUSY) ) { - u_char oldch; - oldch = clmpcc_select_channel(sc, ch->ch_car); + oldch = clmpcc_select_channel(sc, ch->ch_car); + + /* + * COR2 needs to be set immediately otherwise we might never get + * a Tx EMPTY interrupt to change the other parameters. + */ + if ( clmpcc_rdreg(sc, CLMPCC_REG_COR2) != ch->ch_cor2 ) + clmpcc_wrreg(sc, CLMPCC_REG_COR2, ch->ch_cor2); + + if ( ISCLR(ch->ch_tty->t_state, TS_BUSY) ) clmpcc_set_params(ch); - clmpcc_select_channel(sc, oldch); - } else + else SET(ch->ch_flags, CLMPCC_FLG_UPDATE_PARMS); + + clmpcc_select_channel(sc, oldch); + splx(s); return 0; @@ -967,9 +977,6 @@ clmpcc_set_params(ch) SET(ch->ch_flags, CLMPCC_FLG_NEED_INIT); } - if ( clmpcc_rdreg(sc, CLMPCC_REG_COR2) != ch->ch_cor2 ) - clmpcc_wrreg(sc, CLMPCC_REG_COR2, ch->ch_cor2); - if ( clmpcc_rdreg(sc, CLMPCC_REG_COR3) != ch->ch_cor3 ) clmpcc_wrreg(sc, CLMPCC_REG_COR3, ch->ch_cor3);