Similar changes to com driver:

Arrange to call com_break() and com_modem() at splserial().
It's simpler this way.  Really.
This commit is contained in:
mycroft 1998-02-19 21:26:10 +00:00
parent a7a3b90218
commit 6ad2876b5a
2 changed files with 30 additions and 20 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: z8530sc.c,v 1.6 1997/10/04 22:30:30 gwr Exp $ */
/* $NetBSD: z8530sc.c,v 1.7 1998/02/19 21:26:10 mycroft Exp $ */
/*
* Copyright (c) 1994 Gordon W. Ross
@ -72,9 +72,7 @@ zs_break(cs, set)
struct zs_chanstate *cs;
int set;
{
int s;
s = splzs();
if (set) {
cs->cs_preg[5] |= ZSWR5_BREAK;
cs->cs_creg[5] |= ZSWR5_BREAK;
@ -83,7 +81,6 @@ zs_break(cs, set)
cs->cs_creg[5] &= ~ZSWR5_BREAK;
}
zs_write_reg(cs, 5, cs->cs_creg[5]);
splx(s);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: z8530tty.c,v 1.42 1998/01/12 09:23:38 thorpej Exp $ */
/* $NetBSD: z8530tty.c,v 1.43 1998/02/19 21:26:10 mycroft Exp $ */
/*-
* Copyright (c) 1993, 1994, 1995, 1996, 1997
@ -341,19 +341,26 @@ zstty_attach(parent, self, aux)
tp->t_ospeed = 0;
(void) zsparam(tp, &t);
s = splzs();
/* Make sure DTR is on now. */
zs_modem(zst, 1);
splx(s);
} else {
/* Not the console; may need reset. */
int reset;
reset = (channel == 0) ?
ZSWR9_A_RESET : ZSWR9_B_RESET;
reset = (channel == 0) ? ZSWR9_A_RESET : ZSWR9_B_RESET;
s = splzs();
zs_write_reg(cs, 9, reset);
splx(s);
/* Will raise DTR in open. */
zs_modem(zst, 0);
splx(s);
}
}
@ -469,6 +476,8 @@ zsopen(dev, flags, mode, p)
ttychars(tp);
ttsetwater(tp);
s2 = splzs();
/*
* Turn on DTR. We must always do this, even if carrier is not
* present, because otherwise we'd have to use TIOCSDTR
@ -478,8 +487,6 @@ zsopen(dev, flags, mode, p)
*/
zs_modem(zst, 1);
s2 = splzs();
/* Clear the input ring, and unblock. */
zst->zst_rbget = zst->zst_rbput = zst->zst_rbuf;
zst->zst_rbavail = zstty_rbuf_size;
@ -504,9 +511,15 @@ zsopen(dev, flags, mode, p)
* else has the device open, then hang up.
*/
if (!ISSET(tp->t_state, TS_ISOPEN)) {
s2 = splzs();
/* Hang up. */
zs_modem(zst, 0);
CLR(tp->t_state, TS_WOPEN);
ttwakeup(tp);
splx(s2);
}
break;
}
@ -547,8 +560,6 @@ zsclose(dev, flags, mode, p)
SET(zst->zst_rx_flags, RX_IBUF_BLOCKED);
zs_hwiflow(zst);
splx(s);
/* Clear any break condition set with TIOCSBRK. */
zs_break(cs, 0);
@ -561,8 +572,6 @@ zsclose(dev, flags, mode, p)
(void) tsleep(cs, TTIPRI, ttclos, hz);
}
s = splzs();
/* Turn off interrupts if not the console. */
if (ISSET(zst->zst_hwflags, ZS_HWFLAG_CONSOLE))
cs->cs_creg[1] = cs->cs_preg[1] = ZSWR1_RIE | ZSWR1_SIE;
@ -614,6 +623,7 @@ zsioctl(dev, cmd, data, flag, p)
struct zs_chanstate *cs = zst->zst_cs;
struct tty *tp = zst->zst_tty;
int error;
int s;
error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, p);
if (error >= 0)
@ -629,6 +639,8 @@ zsioctl(dev, cmd, data, flag, p)
return (error);
#endif /* ZS_MD_IOCTL */
s = splzs();
switch (cmd) {
case TIOCSBRK:
zs_break(cs, 1);
@ -645,7 +657,7 @@ zsioctl(dev, cmd, data, flag, p)
case TIOCSFLAGS:
error = suser(p->p_ucred, &p->p_acflag);
if (error)
return (error);
break;
zst->zst_swflags = *(int *)data;
break;
@ -662,9 +674,13 @@ zsioctl(dev, cmd, data, flag, p)
case TIOCMBIC:
case TIOCMGET:
default:
return (ENOTTY);
error = ENOTTY;
break;
}
return (0);
splx(s);
return (error);
}
/*
@ -942,12 +958,10 @@ zs_modem(zst, onoff)
int onoff;
{
struct zs_chanstate *cs = zst->zst_cs;
int s;
if (cs->cs_wr5_dtr == 0)
return;
s = splzs();
if (onoff)
SET(cs->cs_preg[5], cs->cs_wr5_dtr);
else
@ -961,7 +975,6 @@ zs_modem(zst, onoff)
} else
zs_loadchannelregs(cs);
}
splx(s);
}
/*