From 17b944a6a722fef4abac16ea20f4aa75791e4b3e Mon Sep 17 00:00:00 2001 From: Peter Wemm Date: Fri, 21 Jun 1996 21:35:01 +0000 Subject: [PATCH] When writing the settings for stop bits and output hardware flow control, things tend to work better if you write the settings to the correct register.. (*blush*). This subtle bug has been haunting me for ages, and will solve a few problems that have been reported to me. Also, take a shot at fixing the serial BREAK processing, what was there before never really worked. (There is a PR on this I think) --- sys/dev/si/si.c | 42 ++++++++++++++++++++++++------------------ sys/i386/isa/si.c | 42 ++++++++++++++++++++++++------------------ 2 files changed, 48 insertions(+), 36 deletions(-) diff --git a/sys/dev/si/si.c b/sys/dev/si/si.c index c74612af53f..100329e8d33 100644 --- a/sys/dev/si/si.c +++ b/sys/dev/si/si.c @@ -30,7 +30,7 @@ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN * NO EVENT SHALL THE AUTHORS BE LIABLE. * - * $Id: si.c,v 1.44 1996/06/16 13:32:16 peter Exp $ + * $Id: si.c,v 1.45 1996/06/17 18:52:53 peter Exp $ */ #ifndef lint @@ -1208,10 +1208,10 @@ siioctl(dev, cmd, data, flag, p) switch (cmd) { case TIOCSBRK: - si_command(pp, SBREAK, SI_NOWAIT); + si_command(pp, SBREAK, SI_WAIT); break; case TIOCCBRK: - si_command(pp, EBREAK, SI_NOWAIT); + si_command(pp, EBREAK, SI_WAIT); break; case TIOCSDTR: (void) si_modem(pp, SET, TIOCM_DTR|TIOCM_RTS); @@ -1481,7 +1481,7 @@ siparam(tp, t) if (cflag & CCTS_OFLOW) val |= MR2_RTSCONT; - ccbp->hi_mr1 = val; + ccbp->hi_mr2 = val; /* ========== set hi_mr1 ========== */ val = 0; @@ -1831,6 +1831,8 @@ siintr(int unit) case MPEND: case MOPEN: case CONFIG: + case SBREAK: + case EBREAK: pp->sp_pend = ccbp->hi_stat; /* sleeping in si_command */ wakeup(&pp->sp_state); @@ -1863,7 +1865,7 @@ siintr(int unit) isopen = 0; /* - * Do break processing + * Do input break processing */ if (ccbp->hi_state & ST_BREAK) { if (isopen) { @@ -2244,8 +2246,11 @@ si_command(pp, cmd, waitflag) oldspl = spltty(); /* Keep others out */ /* wait until it's finished what it was doing.. */ + /* XXX: sits in IDLE_BREAK until something disturbs it or break + * is turned off. */ while((x = ccbp->hi_stat) != IDLE_OPEN && x != IDLE_CLOSE && + x != IDLE_BREAK && x != cmd) { if (in_intr) { /* Prevent sleep in intr */ DPRINT((pp, DBG_PARAM, @@ -2259,20 +2264,20 @@ si_command(pp, cmd, waitflag) return; } } - /* it should now be in IDLE_OPEN, IDLE_CLOSE, or "cmd" */ + /* it should now be in IDLE_{OPEN|CLOSE|BREAK}, or "cmd" */ /* if there was a pending command, cause a state-change wakeup */ - if (pp->sp_pend != IDLE_OPEN) { - switch(pp->sp_pend) { - case LOPEN: - case MPEND: - case MOPEN: - case CONFIG: - wakeup(&pp->sp_state); - break; - default: - break; - } + switch(pp->sp_pend) { + case LOPEN: + case MPEND: + case MOPEN: + case CONFIG: + case SBREAK: + case EBREAK: + wakeup(&pp->sp_state); + break; + default: + break; } pp->sp_pend = cmd; /* New command pending */ @@ -2285,7 +2290,8 @@ si_command(pp, cmd, waitflag) cmd)); splx(oldspl); return; - } else while(ccbp->hi_stat != IDLE_OPEN) { + } else while(ccbp->hi_stat != IDLE_OPEN && + ccbp->hi_stat != IDLE_BREAK) { if (ttysleep(pp->sp_tty, (caddr_t)&pp->sp_state, TTIPRI|PCATCH, "sicmd2", 0)) break; diff --git a/sys/i386/isa/si.c b/sys/i386/isa/si.c index c74612af53f..100329e8d33 100644 --- a/sys/i386/isa/si.c +++ b/sys/i386/isa/si.c @@ -30,7 +30,7 @@ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN * NO EVENT SHALL THE AUTHORS BE LIABLE. * - * $Id: si.c,v 1.44 1996/06/16 13:32:16 peter Exp $ + * $Id: si.c,v 1.45 1996/06/17 18:52:53 peter Exp $ */ #ifndef lint @@ -1208,10 +1208,10 @@ siioctl(dev, cmd, data, flag, p) switch (cmd) { case TIOCSBRK: - si_command(pp, SBREAK, SI_NOWAIT); + si_command(pp, SBREAK, SI_WAIT); break; case TIOCCBRK: - si_command(pp, EBREAK, SI_NOWAIT); + si_command(pp, EBREAK, SI_WAIT); break; case TIOCSDTR: (void) si_modem(pp, SET, TIOCM_DTR|TIOCM_RTS); @@ -1481,7 +1481,7 @@ siparam(tp, t) if (cflag & CCTS_OFLOW) val |= MR2_RTSCONT; - ccbp->hi_mr1 = val; + ccbp->hi_mr2 = val; /* ========== set hi_mr1 ========== */ val = 0; @@ -1831,6 +1831,8 @@ siintr(int unit) case MPEND: case MOPEN: case CONFIG: + case SBREAK: + case EBREAK: pp->sp_pend = ccbp->hi_stat; /* sleeping in si_command */ wakeup(&pp->sp_state); @@ -1863,7 +1865,7 @@ siintr(int unit) isopen = 0; /* - * Do break processing + * Do input break processing */ if (ccbp->hi_state & ST_BREAK) { if (isopen) { @@ -2244,8 +2246,11 @@ si_command(pp, cmd, waitflag) oldspl = spltty(); /* Keep others out */ /* wait until it's finished what it was doing.. */ + /* XXX: sits in IDLE_BREAK until something disturbs it or break + * is turned off. */ while((x = ccbp->hi_stat) != IDLE_OPEN && x != IDLE_CLOSE && + x != IDLE_BREAK && x != cmd) { if (in_intr) { /* Prevent sleep in intr */ DPRINT((pp, DBG_PARAM, @@ -2259,20 +2264,20 @@ si_command(pp, cmd, waitflag) return; } } - /* it should now be in IDLE_OPEN, IDLE_CLOSE, or "cmd" */ + /* it should now be in IDLE_{OPEN|CLOSE|BREAK}, or "cmd" */ /* if there was a pending command, cause a state-change wakeup */ - if (pp->sp_pend != IDLE_OPEN) { - switch(pp->sp_pend) { - case LOPEN: - case MPEND: - case MOPEN: - case CONFIG: - wakeup(&pp->sp_state); - break; - default: - break; - } + switch(pp->sp_pend) { + case LOPEN: + case MPEND: + case MOPEN: + case CONFIG: + case SBREAK: + case EBREAK: + wakeup(&pp->sp_state); + break; + default: + break; } pp->sp_pend = cmd; /* New command pending */ @@ -2285,7 +2290,8 @@ si_command(pp, cmd, waitflag) cmd)); splx(oldspl); return; - } else while(ccbp->hi_stat != IDLE_OPEN) { + } else while(ccbp->hi_stat != IDLE_OPEN && + ccbp->hi_stat != IDLE_BREAK) { if (ttysleep(pp->sp_tty, (caddr_t)&pp->sp_state, TTIPRI|PCATCH, "sicmd2", 0)) break;