From 747c608e8d180d523f312051c6bd9ecb85a2c6fe Mon Sep 17 00:00:00 2001 From: Bruce Evans Date: Thu, 17 Dec 1998 19:23:09 +0000 Subject: [PATCH] Flush the tx fifo in cystop(). Now ttyflush() (and thus tcflush(3)) almost works properly. Unfortunately, there is no way to flush the rx fifo without resetting the channel, which also flushes the tx fifo. We avoid resetting even when both fifos need to be flushed, since resetting seems to cause the rx to lose sync if it is done while data is arriving. Reminded by: NIST-PCTS --- sys/dev/cy/cy.c | 7 ++++--- sys/dev/cy/cy_isa.c | 7 ++++--- sys/i386/isa/cy.c | 7 ++++--- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/sys/dev/cy/cy.c b/sys/dev/cy/cy.c index df09722e512..b23cf66a3e5 100644 --- a/sys/dev/cy/cy.c +++ b/sys/dev/cy/cy.c @@ -27,7 +27,7 @@ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: cy.c,v 1.78 1998/12/17 18:18:06 bde Exp $ + * $Id: cy.c,v 1.79 1998/12/17 18:43:08 bde Exp $ */ #include "opt_compat.h" @@ -2387,15 +2387,16 @@ siostop(tp, rw) com->state &= ~(CS_ODONE | CS_BUSY); } if (rw & FREAD) { + /* XXX no way to reset only input fifo. */ com_events -= (com->iptr - com->ibuf); com->iptr = com->ibuf; } enable_intr(); if (wakeup_etc) wakeup(&com->etc); + if (rw & FWRITE && com->etc == ETC_NONE) + cd1400_channel_cmd(com, CD1400_CCR_CMDRESET | CD1400_CCR_FTF); comstart(tp); - - /* XXX should clear h/w fifos too. */ } static struct tty * diff --git a/sys/dev/cy/cy_isa.c b/sys/dev/cy/cy_isa.c index df09722e512..b23cf66a3e5 100644 --- a/sys/dev/cy/cy_isa.c +++ b/sys/dev/cy/cy_isa.c @@ -27,7 +27,7 @@ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: cy.c,v 1.78 1998/12/17 18:18:06 bde Exp $ + * $Id: cy.c,v 1.79 1998/12/17 18:43:08 bde Exp $ */ #include "opt_compat.h" @@ -2387,15 +2387,16 @@ siostop(tp, rw) com->state &= ~(CS_ODONE | CS_BUSY); } if (rw & FREAD) { + /* XXX no way to reset only input fifo. */ com_events -= (com->iptr - com->ibuf); com->iptr = com->ibuf; } enable_intr(); if (wakeup_etc) wakeup(&com->etc); + if (rw & FWRITE && com->etc == ETC_NONE) + cd1400_channel_cmd(com, CD1400_CCR_CMDRESET | CD1400_CCR_FTF); comstart(tp); - - /* XXX should clear h/w fifos too. */ } static struct tty * diff --git a/sys/i386/isa/cy.c b/sys/i386/isa/cy.c index df09722e512..b23cf66a3e5 100644 --- a/sys/i386/isa/cy.c +++ b/sys/i386/isa/cy.c @@ -27,7 +27,7 @@ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: cy.c,v 1.78 1998/12/17 18:18:06 bde Exp $ + * $Id: cy.c,v 1.79 1998/12/17 18:43:08 bde Exp $ */ #include "opt_compat.h" @@ -2387,15 +2387,16 @@ siostop(tp, rw) com->state &= ~(CS_ODONE | CS_BUSY); } if (rw & FREAD) { + /* XXX no way to reset only input fifo. */ com_events -= (com->iptr - com->ibuf); com->iptr = com->ibuf; } enable_intr(); if (wakeup_etc) wakeup(&com->etc); + if (rw & FWRITE && com->etc == ETC_NONE) + cd1400_channel_cmd(com, CD1400_CCR_CMDRESET | CD1400_CCR_FTF); comstart(tp); - - /* XXX should clear h/w fifos too. */ } static struct tty *