summaryrefslogtreecommitdiff
path: root/sys/arch/sparc
diff options
context:
space:
mode:
authorJason Wright <jason@cvs.openbsd.org>1998-03-04 14:21:30 +0000
committerJason Wright <jason@cvs.openbsd.org>1998-03-04 14:21:30 +0000
commitbde0ae6b25765a6dc970ab21d820f785f1fb1db7 (patch)
treef5cf08c66d275eb339c35005004ef31dca44d735 /sys/arch/sparc
parentf91d55fe6493da6263721fa71b1d20d549c4b42f (diff)
added support for the TIOCM* ioctl's
Diffstat (limited to 'sys/arch/sparc')
-rw-r--r--sys/arch/sparc/dev/zs.c66
1 files changed, 64 insertions, 2 deletions
diff --git a/sys/arch/sparc/dev/zs.c b/sys/arch/sparc/dev/zs.c
index 6f16a96be9a..531357ffed2 100644
--- a/sys/arch/sparc/dev/zs.c
+++ b/sys/arch/sparc/dev/zs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: zs.c,v 1.19 1998/02/05 16:57:49 deraadt Exp $ */
+/* $OpenBSD: zs.c,v 1.20 1998/03/04 14:21:29 jason Exp $ */
/* $NetBSD: zs.c,v 1.49 1997/08/31 21:26:37 pk Exp $ */
/*
@@ -151,6 +151,7 @@ static void zs_reset __P((volatile struct zschan *, int, int));
#endif
static void zs_modem __P((struct zs_chanstate *, int));
static void zs_loadchannelregs __P((volatile struct zschan *, u_char *));
+static void tiocm_to_zs __P((struct zs_chanstate *, int how, int data));
/* Console stuff. */
static struct tty *zs_ctty; /* console `struct tty *' */
@@ -1299,9 +1300,30 @@ zsioctl(dev, cmd, data, flag, p)
zs_modem(cs, 0);
break;
case TIOCMSET:
- case TIOCMGET:
+ tiocm_to_zs(cs, TIOCMSET, *(int *)data);
+ break;
case TIOCMBIS:
+ tiocm_to_zs(cs, TIOCMBIS, *(int *)data);
+ break;
case TIOCMBIC:
+ tiocm_to_zs(cs, TIOCMBIC, *(int *)data);
+ break;
+ case TIOCMGET: {
+ int bits = 0;
+ u_char m;
+
+ if (cs->cs_preg[5] & ZSWR5_DTR)
+ bits |= TIOCM_DTR;
+ if (cs->cs_preg[5] & ZSWR5_RTS)
+ bits |= TIOCM_RTS;
+ m = cs->cs_zc->zc_csr;
+ if (m & ZSRR0_DCD)
+ bits |= TIOCM_CD;
+ if (m & ZSRR0_CTS)
+ bits |= TIOCM_CTS;
+ *(int *)data = bits;
+ break;
+ }
default:
return (ENOTTY);
}
@@ -1577,6 +1599,46 @@ zs_loadchannelregs(zc, reg)
ZS_WRITE(zc, 5, reg[5]);
}
+static void
+tiocm_to_zs(cs, how, val)
+ struct zs_chanstate *cs;
+ int how, val;
+{
+ int bits = 0, s;
+
+ if (val & TIOCM_DTR);
+ bits |= ZSWR5_DTR;
+ if (val & TIOCM_RTS)
+ bits |= ZSWR5_RTS;
+
+ s = splzs();
+ switch (how) {
+ case TIOCMBIC:
+ cs->cs_preg[5] &= ~bits;
+ break;
+ case TIOCMBIS:
+ cs->cs_preg[5] |= bits;
+ break;
+ case TIOCMSET:
+ cs->cs_preg[5] &= ~(ZSWR5_RTS | ZSWR5_DTR);
+ cs->cs_preg[5] |= bits;
+ break;
+ }
+
+ if (cs->cs_heldchange == 0) {
+ if (cs->cs_ttyp->t_state & TS_BUSY) {
+ cs->cs_heldtbc = cs->cs_tbc;
+ cs->cs_tbc = 0;
+ cs->cs_heldchange = 1;
+ } else {
+ cs->cs_creg[5] = cs->cs_preg[5];
+ ZS_WRITE(cs->cs_zc, 5, cs->cs_creg[5]);
+ }
+ }
+ splx(s);
+
+}
+
#ifdef KGDB
/*
* Get a character from the given kgdb channel. Called at splhigh().