diff options
author | ache <ache@FreeBSD.org> | 1995-03-28 10:51:59 +0000 |
---|---|---|
committer | ache <ache@FreeBSD.org> | 1995-03-28 10:51:59 +0000 |
commit | a5e56310857b99b4ea8cd04eb841c19defe0173e (patch) | |
tree | 85262b1df3d22def3f8802059f36d2e3e35e01ad /sys/isa | |
parent | 837a13ef49870fa05d73202221429506a98f974e (diff) | |
download | FreeBSD-src-a5e56310857b99b4ea8cd04eb841c19defe0173e.zip FreeBSD-src-a5e56310857b99b4ea8cd04eb841c19defe0173e.tar.gz |
Several fixes to help "raw" tty mode work correctly with
BREAK/parity/framing errors.
Term "correctly" assumes POSIX spec. and 4.4 ttyinput() behaviour.
1) Discard BREAK/parity at interrupt level when apropriate IGN*
is set in iflag. It helps "raw" mode works even IGN* is set.
2) Zero parity (if INPCK) and framing directly in buffer
before passing it to b_to_q() in "raw" mode.
Efficency:
interrupt level: if no error occurse, only two "test" commands added
"raw" mode: buf scan incc times for parity/framing added
Reviewed by:
Submitted by:
Obtained from:
CVS:
Diffstat (limited to 'sys/isa')
-rw-r--r-- | sys/isa/sio.c | 37 |
1 files changed, 32 insertions, 5 deletions
diff --git a/sys/isa/sio.c b/sys/isa/sio.c index 418a006..0c8883e 100644 --- a/sys/isa/sio.c +++ b/sys/isa/sio.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)com.c 7.5 (Berkeley) 5/16/91 - * $Id: sio.c,v 1.72 1995/03/28 05:39:53 ache Exp $ + * $Id: sio.c,v 1.73 1995/03/28 06:15:44 ache Exp $ */ #include "sio.h" @@ -1121,9 +1121,20 @@ siointr1(com) if (com->iptr - com->ibuf == 8) setsofttty(); #endif - ioptr[0] = recv_data; - ioptr[CE_INPUT_OFFSET] = line_status; - com->iptr = ++ioptr; + /* + Don't store PE if IGNPAR and BI if IGNBRK, + this hack allows "raw" tty optimization + works even if IGN* is set. + Assume TTY_OE mapped to TTY_PE + */ + if ( (!(line_status & (LSR_PE|LSR_OE)) + || !(com->tp->t_iflag & IGNPAR)) + && (!(line_status & LSR_BI) + || !(com->tp->t_iflag & IGNBRK))) { + ioptr[0] = recv_data; + ioptr[CE_INPUT_OFFSET] = line_status; + com->iptr = ++ioptr; + } if (ioptr == com->ihighwater && com->state & CS_RTS_IFLOW) outb(com->modem_ctl_port, @@ -1550,11 +1561,27 @@ repeat: * call overhead). */ if (!(tp->t_iflag & (ICRNL | IGNCR | IMAXBEL | INLCR | ISTRIP - | IXOFF | IXON | IGNBRK | BRKINT | PARMRK)) + | IXOFF | IXON)) + && (!(tp->t_iflag & BRKINT) || (tp->t_iflag & IGNBRK)) + && (!(tp->t_iflag & PARMRK) || + (tp->t_iflag & (IGNPAR|IGNBRK)) == (IGNPAR|IGNBRK)) && !(tp->t_lflag & (ECHO | ECHONL | ICANON | IEXTEN | ISIG | PENDIN)) && !(tp->t_state & (TS_CNTTB | TS_LNCH)) && linesw[tp->t_line].l_rint == ttyinput) { + u_char *scan = buf; + int cnt = incc; + + /* Zero PE & FE chars per POSIX spec. and 4.4 ttyinput() */ + while (cnt--) { + if ( (scan[CE_INPUT_OFFSET] & LSR_FE) + /* Assume TTY_OE mapped to TTY_PE */ + || (scan[CE_INPUT_OFFSET] & (LSR_PE|LSR_OE)) + && (tp->t_iflag & INPCK)) + scan[0] = 0; + scan++; + } + tk_nin += incc; tk_rawcc += incc; tp->t_rawcc += incc; |