diff options
author | ache <ache@FreeBSD.org> | 1995-04-01 23:56:08 +0000 |
---|---|---|
committer | ache <ache@FreeBSD.org> | 1995-04-01 23:56:08 +0000 |
commit | f8689ba88f6fa8fe0b87e2ddd36c35389150e96c (patch) | |
tree | b67489f921339702c8f195153c4fd145d27e9a75 /sys/dev/sio | |
parent | 141a7c0b20aa0462a3b19c2c31b57d86635b9118 (diff) | |
download | FreeBSD-src-f8689ba88f6fa8fe0b87e2ddd36c35389150e96c.zip FreeBSD-src-f8689ba88f6fa8fe0b87e2ddd36c35389150e96c.tar.gz |
Move setting BYPASS state to macro, use it in several times,
after ttioctl too, because it can change t_line.
Remove (TS_CNTTB | TS_LNCH) test, it is always inherits from
old tty mode and can't be reach in currently setted mode.
Diffstat (limited to 'sys/dev/sio')
-rw-r--r-- | sys/dev/sio/sio.c | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/sys/dev/sio/sio.c b/sys/dev/sio/sio.c index 75d70d8..80d7e6a 100644 --- a/sys/dev/sio/sio.c +++ b/sys/dev/sio/sio.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)com.c 7.5 (Berkeley) 5/16/91 - * $Id: sio.c,v 1.81 1995/04/01 12:01:13 ache Exp $ + * $Id: sio.c,v 1.82 1995/04/01 22:57:43 ache Exp $ */ #include "sio.h" @@ -86,6 +86,19 @@ termioschars(t) #define RB_I_HIGH_WATER (TTYHOG - 2 * RS_IBUFSIZE) #define RS_IBUFSIZE 256 +#define SET_BYPASS(tp, t) \ + if (!((t)->c_iflag & (ICRNL | IGNCR | IMAXBEL | INLCR | ISTRIP \ + | IXOFF | IXON)) \ + && (!((t)->c_iflag & BRKINT) || ((t)->c_iflag & IGNBRK)) \ + && (!((t)->c_iflag & PARMRK) || \ + ((t)->c_iflag & (IGNPAR|IGNBRK)) == (IGNPAR|IGNBRK)) \ + && !((t)->c_lflag & (ECHO | ECHONL | ICANON | IEXTEN | ISIG \ + | PENDIN)) \ + && linesw[(tp)->t_line].l_rint == ttyinput) \ + (tp)->t_state |= TS_CAN_BYPASS_L_RINT; \ + else \ + (tp)->t_state &= ~TS_CAN_BYPASS_L_RINT + #define CALLOUT_MASK 0x80 #define CONTROL_MASK 0x60 #define CONTROL_INIT_STATE 0x20 @@ -885,8 +898,7 @@ open_top: goto open_top; } error = (*linesw[tp->t_line].l_open)(dev, tp); - if (linesw[tp->t_line].l_rint != ttyinput) - tp->t_state &= ~TS_CAN_BYPASS_L_RINT; + SET_BYPASS(tp, &(tp->t_termios)); if (tp->t_state & TS_ISOPEN && mynor & CALLOUT_MASK) com->active_out = TRUE; out: @@ -1343,6 +1355,7 @@ sioioctl(dev, cmd, data, flag, p) if (error >= 0) return (error); error = ttioctl(tp, cmd, data, flag); + SET_BYPASS(tp, &(tp->t_termios)); if (error >= 0) return (error); s = spltty(); @@ -1565,8 +1578,7 @@ repeat: * slinput is reasonably fast (usually 40 instructions plus * call overhead). */ - if ( (tp->t_state & TS_CAN_BYPASS_L_RINT) - && !(tp->t_state & TS_LOCAL)) { + if (tp->t_state & TS_CAN_BYPASS_L_RINT) { tk_nin += incc; tk_rawcc += incc; tp->t_rawcc += incc; @@ -1718,8 +1730,6 @@ retry: != (LSR_TSRE | LSR_TXRDY)) goto retry; - tp->t_state &= ~TS_CAN_BYPASS_L_RINT; - if (divisor != 0) { outb(iobase + com_cfcr, cfcr | CFCR_DLAB); outb(iobase + com_dlbl, divisor & 0xFF); @@ -1746,15 +1756,7 @@ retry: com->state &= ~CS_ODEVREADY; } - if (!(iflag & (ICRNL | IGNCR | IMAXBEL | INLCR | ISTRIP - | IXOFF | IXON)) - && (!(iflag & BRKINT) || (iflag & IGNBRK)) - && (!(iflag & PARMRK) || - (iflag & (IGNPAR|IGNBRK)) == (IGNPAR|IGNBRK)) - && !(lflag & (ECHO | ECHONL | ICANON | IEXTEN | ISIG - | PENDIN)) - && linesw[tp->t_line].l_rint == ttyinput) - tp->t_state |= TS_CAN_BYPASS_L_RINT; + SET_BYPASS(tp, t); /* * Recover from fiddling with CS_TTGO. We used to call siointr1() * unconditionally, but that defeated the careful discarding of |