aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorAndrey A. Chernov <ache@FreeBSD.org>1995-04-01 23:56:08 +0000
committerAndrey A. Chernov <ache@FreeBSD.org>1995-04-01 23:56:08 +0000
commit5daae55cdf9ad91c661045037c9930f9541bcc82 (patch)
treeb67489f921339702c8f195153c4fd145d27e9a75 /sys
parent6a5f6acc8d89ee42472990e7cd87e66e34f0d8a0 (diff)
downloadsrc-5daae55cdf9ad91c661045037c9930f9541bcc82.tar.gz
src-5daae55cdf9ad91c661045037c9930f9541bcc82.zip
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.
Notes
Notes: svn path=/head/; revision=7569
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/sio/sio.c34
-rw-r--r--sys/i386/isa/sio.c34
-rw-r--r--sys/isa/sio.c34
3 files changed, 54 insertions, 48 deletions
diff --git a/sys/dev/sio/sio.c b/sys/dev/sio/sio.c
index 75d70d8fd688..80d7e6a3ff62 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
diff --git a/sys/i386/isa/sio.c b/sys/i386/isa/sio.c
index 75d70d8fd688..80d7e6a3ff62 100644
--- a/sys/i386/isa/sio.c
+++ b/sys/i386/isa/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
diff --git a/sys/isa/sio.c b/sys/isa/sio.c
index 75d70d8fd688..80d7e6a3ff62 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.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