Remove the ancient tty.h DMSET etc. modem control commands. They're confusing
to someone without the historical background. No documentation doesn't help
either.
TIOCM* serve the same purpose, are documented in tty(4) and the various *ctl()
functions use the TTYCM_ register definitions, making this mix particularly odd
looking.
I've modified the *ctl() functions to use the same type and name as ioctl for
clarity and correctness. Not strictly necessary, but makes me sleep better :)
Tested lightly on sparc64. sab still works. No luna88k, sorry.
## Background blah blah, skip if you just don't care :)
I've noticed these odd DM{SET,GET,BIC,BIS} constants in serial drivers all
over the place and got curious. What do they mean?
Turns out, "DM" is a bolt-in add-on modem by DEC you would connect to
your DH-11, apparently a 16 port serial port multiplexer for your VAX or
PDP-11. As far as I can tell, the drivers were last included in 4.3BSD.
You grey beards correct me on this.
The DM constants and the dmctl() function to manipulate the modem
control register were added to dh in 1980 in order to support this fancy
new modem.
Since then, just about every BSD serial driver has copied the basic structure,
spreading DM* absolutely everywhere.
In 1982, Bill Shannon wanted to play with this control register in userspace
(tip) and the ioctl interface was expanded by TIOCM{SET,GET,BIS,BIC}, hard
coding the interface and register layout of that modem family for decades to
come.
dh gains dm support:
https://github.com/weiss/original-bsd/commit/b47c3865305da4a404343aeedf0e3561071aae10
TIOCM modem control register bits show up:
https://github.com/weiss/original-bsd/commit/d9d9928137170ec2f49e62509b12d012cac154de
https://github.com/weiss/original-bsd/commit/c849aa74bd3aaa1d644d74d9628ba0e1be028e1a
http://gunkies.org/wiki/DH11_asynchronous_serial_line_interface
http://bitsavers.trailing-edge.com/pdf/dec/unibus/ datasheets..
Who needs TV when you can dig up amusing trivia about early BSD development!
Index: sys/tty.h
===================================================================
RCS file: /home/vcs/cvs/openbsd/src/sys/sys/tty.h,v
retrieving revision 1.37
diff -u -p -r1.37 tty.h
--- sys/tty.h 24 May 2016 16:09:07 -0000 1.37
+++ sys/tty.h 13 Feb 2018 20:39:54 -0000
@@ -215,12 +215,6 @@ struct speedtab {
int sp_code; /* Code. */
};
-/* Modem control commands (driver). */
-#define DMSET 0
-#define DMBIS 1
-#define DMBIC 2
-#define DMGET 3
-
/* Flags on a character passed to ttyinput. */
#define TTY_CHARMASK 0x000000ff /* Character mask */
#define TTY_QUOTE 0x00000100 /* Character quoted */
Index: arch/armv7/exynos/exuart.c
===================================================================
RCS file: /home/vcs/cvs/openbsd/src/sys/arch/armv7/exynos/exuart.c,v
retrieving revision 1.13
diff -u -p -r1.13 exuart.c
--- arch/armv7/exynos/exuart.c 27 Oct 2017 11:23:28 -0000 1.13
+++ arch/armv7/exynos/exuart.c 13 Feb 2018 20:38:56 -0000
@@ -784,37 +784,37 @@ exuartioctl( dev_t dev, u_long cmd, cadd
case TIOCSDTR:
#if 0
- (void) clmctl(dev, TIOCM_DTR | TIOCM_RTS, DMBIS);
+ (void) clmctl(dev, TIOCM_DTR | TIOCM_RTS, TIOCMBIS);
#endif
break;
case TIOCCDTR:
#if 0
- (void) clmctl(dev, TIOCM_DTR | TIOCM_RTS, DMBIC);
+ (void) clmctl(dev, TIOCM_DTR | TIOCM_RTS, TIOCMBIC);
#endif
break;
case TIOCMSET:
#if 0
- (void) clmctl(dev, *(int *) data, DMSET);
+ (void) clmctl(dev, *(int *) data, TIOCMSET);
#endif
break;
case TIOCMBIS:
#if 0
- (void) clmctl(dev, *(int *) data, DMBIS);
+ (void) clmctl(dev, *(int *) data, TIOCMBIS);
#endif
break;
case TIOCMBIC:
#if 0
- (void) clmctl(dev, *(int *) data, DMBIC);
+ (void) clmctl(dev, *(int *) data, TIOCMBIC);
#endif
break;
case TIOCMGET:
#if 0
- *(int *)data = clmctl(dev, 0, DMGET);
+ *(int *)data = clmctl(dev, 0, TIOCMGET);
#endif
break;
Index: arch/armv7/imx/imxuart.c
===================================================================
RCS file: /home/vcs/cvs/openbsd/src/sys/arch/armv7/imx/imxuart.c,v
retrieving revision 1.17
diff -u -p -r1.17 imxuart.c
--- arch/armv7/imx/imxuart.c 30 Dec 2017 13:34:56 -0000 1.17
+++ arch/armv7/imx/imxuart.c 13 Feb 2018 20:38:56 -0000
@@ -701,37 +701,37 @@ imxuartioctl( dev_t dev, u_long cmd, cad
case TIOCSDTR:
#if 0
- (void) clmctl(dev, TIOCM_DTR | TIOCM_RTS, DMBIS);
+ (void) clmctl(dev, TIOCM_DTR | TIOCM_RTS, TIOCMBIS);
#endif
break;
case TIOCCDTR:
#if 0
- (void) clmctl(dev, TIOCM_DTR | TIOCM_RTS, DMBIC);
+ (void) clmctl(dev, TIOCM_DTR | TIOCM_RTS, TIOCMBIC);
#endif
break;
case TIOCMSET:
#if 0
- (void) clmctl(dev, *(int *) data, DMSET);
+ (void) clmctl(dev, *(int *) data, TIOCMSET);
#endif
break;
case TIOCMBIS:
#if 0
- (void) clmctl(dev, *(int *) data, DMBIS);
+ (void) clmctl(dev, *(int *) data, TIOCMBIS);
#endif
break;
case TIOCMBIC:
#if 0
- (void) clmctl(dev, *(int *) data, DMBIC);
+ (void) clmctl(dev, *(int *) data, TIOCMBIC);
#endif
break;
case TIOCMGET:
#if 0
- *(int *)data = clmctl(dev, 0, DMGET);
+ *(int *)data = clmctl(dev, 0, TIOCMGET);
#endif
break;
Index: arch/luna88k/dev/siotty.c
===================================================================
RCS file: /home/vcs/cvs/openbsd/src/sys/arch/luna88k/dev/siotty.c,v
retrieving revision 1.21
diff -u -p -r1.21 siotty.c
--- arch/luna88k/dev/siotty.c 3 Nov 2017 06:54:06 -0000 1.21
+++ arch/luna88k/dev/siotty.c 13 Feb 2018 20:39:04 -0000
@@ -100,7 +100,7 @@ void siottyintr(void *);
void siottysoft(void *);
void siotty_rxsoft(struct siotty_softc *, struct tty *);
void siotty_txsoft(struct siotty_softc *, struct tty *);
-int siomctl(struct siotty_softc *, int, int);
+int siomctl(struct siotty_softc *, int, u_long);
int siotty_match(struct device *, void *, void *);
void siotty_attach(struct device *, struct device *, void *);
@@ -409,7 +409,7 @@ sioparam(struct tty *tp, struct termios
}
int
-siomctl(struct siotty_softc *sc, int control, int op)
+siomctl(struct siotty_softc *sc, int control, u_long cmd)
{
int val, s, wr5, rr;
@@ -422,17 +422,17 @@ siomctl(struct siotty_softc *sc, int con
val |= WR5_RTS;
s = spltty();
wr5 = sc->sc_wr[WR5];
- switch (op) {
- case DMSET:
+ switch (cmd) {
+ case TIOCMSET:
wr5 &= ~(WR5_BREAK|WR5_DTR|WR5_RTS);
/* FALLTHROUGH */
- case DMBIS:
+ case TIOCMBIS:
wr5 |= val;
break;
- case DMBIC:
+ case TIOCMBIC:
wr5 &= ~val;
break;
- case DMGET:
+ case TIOCMGET:
val = 0;
rr = getsiocsr(sc->sc_ctl);
if (wr5 & WR5_DTR)
@@ -519,13 +519,13 @@ sioclose(dev_t dev, int flag, int mode,
(*linesw[tp->t_line].l_close)(tp, flag, p);
s = spltty();
- siomctl(sc, TIOCM_BREAK, DMBIC);
+ siomctl(sc, TIOCM_BREAK, TIOCMBIC);
#if 0 /* because unable to feed DTR signal */
if ((tp->t_cflag & HUPCL)
|| tp->t_wopen || (tp->t_state & TS_ISOPEN) == 0) {
- siomctl(sc, TIOCM_DTR, DMBIC);
+ siomctl(sc, TIOCM_DTR, TIOCMBIC);
/* Yield CPU time to others for 1 second, then ... */
- siomctl(sc, TIOCM_DTR, DMBIS);
+ siomctl(sc, TIOCM_DTR, TIOCMBIS);
}
#endif
splx(s);
@@ -568,28 +568,28 @@ sioioctl(dev_t dev, u_long cmd, caddr_t
/* the last resort for TIOC ioctl tranversing */
switch (cmd) {
case TIOCSBRK: /* Set the hardware into BREAK condition */
- siomctl(sc, TIOCM_BREAK, DMBIS);
+ siomctl(sc, TIOCM_BREAK, TIOCMBIS);
break;
case TIOCCBRK: /* Clear the hardware BREAK condition */
- siomctl(sc, TIOCM_BREAK, DMBIC);
+ siomctl(sc, TIOCM_BREAK, TIOCMBIC);
break;
case TIOCSDTR: /* Assert DTR signal */
- siomctl(sc, TIOCM_DTR|TIOCM_RTS, DMBIS);
+ siomctl(sc, TIOCM_DTR|TIOCM_RTS, TIOCMBIS);
break;
case TIOCCDTR: /* Clear DTR signal */
- siomctl(sc, TIOCM_DTR|TIOCM_RTS, DMBIC);
+ siomctl(sc, TIOCM_DTR|TIOCM_RTS, TIOCMBIC);
break;
case TIOCMSET: /* Set modem state replacing current one */
- siomctl(sc, *(int *)data, DMSET);
+ siomctl(sc, *(int *)data, TIOCMSET);
break;
case TIOCMGET: /* Return current modem state */
- *(int *)data = siomctl(sc, 0, DMGET);
+ *(int *)data = siomctl(sc, 0, TIOCMGET);
break;
case TIOCMBIS: /* Set individual bits of modem state */
- siomctl(sc, *(int *)data, DMBIS);
+ siomctl(sc, *(int *)data, TIOCMBIS);
break;
case TIOCMBIC: /* Clear individual bits of modem state */
- siomctl(sc, *(int *)data, DMBIC);
+ siomctl(sc, *(int *)data, TIOCMBIC);
break;
case TIOCSFLAGS: /* Instruct how serial port behaves */
error = suser(p, 0);
Index: arch/sparc64/dev/sab.c
===================================================================
RCS file: /home/vcs/cvs/openbsd/src/sys/arch/sparc64/dev/sab.c,v
retrieving revision 1.34
diff -u -p -r1.34 sab.c
--- arch/sparc64/dev/sab.c 30 Dec 2017 23:08:29 -0000 1.34
+++ arch/sparc64/dev/sab.c 13 Feb 2018 20:39:12 -0000
@@ -136,7 +136,7 @@ void sabtty_start(struct tty *);
int sabtty_param(struct tty *, struct termios *);
int sabtty_intr(struct sabtty_softc *, int *);
void sabtty_softintr(struct sabtty_softc *);
-int sabtty_mdmctrl(struct sabtty_softc *, int, int);
+int sabtty_mdmctrl(struct sabtty_softc *, int, u_long);
int sabtty_cec_wait(struct sabtty_softc *);
int sabtty_tec_wait(struct sabtty_softc *);
void sabtty_reset(struct sabtty_softc *);
@@ -749,7 +749,7 @@ sabttyopen(dev, flags, mode, p)
return (s);
if (tp->t_cflag & HUPCL) {
- sabtty_mdmctrl(sc, 0, DMSET);
+ sabtty_mdmctrl(sc, 0, TIOCMSET);
(void)tsleep(sc, TTIPRI, ttclos, hz);
}
@@ -788,7 +788,7 @@ sabttyclose(dev, flags, mode, p)
sc->sc_flags &= ~SABTTYF_TXDRAIN;
if (tp->t_cflag & HUPCL) {
- sabtty_mdmctrl(sc, 0, DMSET);
+ sabtty_mdmctrl(sc, 0, TIOCMSET);
(void)tsleep(bc, TTIPRI, ttclos, hz);
}
@@ -864,22 +864,22 @@ sabttyioctl(dev, cmd, data, flags, p)
SAB_READ(sc, SAB_DAFO) & ~SAB_DAFO_XBRK);
break;
case TIOCSDTR:
- sabtty_mdmctrl(sc, TIOCM_DTR, DMBIS);
+ sabtty_mdmctrl(sc, TIOCM_DTR, TIOCMBIS);
break;
case TIOCCDTR:
- sabtty_mdmctrl(sc, TIOCM_DTR, DMBIC);
+ sabtty_mdmctrl(sc, TIOCM_DTR, TIOCMBIC);
break;
case TIOCMBIS:
- sabtty_mdmctrl(sc, *((int *)data), DMBIS);
+ sabtty_mdmctrl(sc, *((int *)data), TIOCMBIS);
break;
case TIOCMBIC:
- sabtty_mdmctrl(sc, *((int *)data), DMBIC);
+ sabtty_mdmctrl(sc, *((int *)data), TIOCMBIC);
break;
case TIOCMGET:
- *((int *)data) = sabtty_mdmctrl(sc, 0, DMGET);
+ *((int *)data) = sabtty_mdmctrl(sc, 0, TIOCMGET);
break;
case TIOCMSET:
- sabtty_mdmctrl(sc, *((int *)data), DMSET);
+ sabtty_mdmctrl(sc, *((int *)data), TIOCMSET);
break;
case TIOCGFLAGS:
*((int *)data) = sc->sc_openflags;
@@ -931,16 +931,17 @@ sabttystop(tp, flags)
}
int
-sabtty_mdmctrl(sc, bits, how)
+sabtty_mdmctrl(sc, bits, cmd)
struct sabtty_softc *sc;
- int bits, how;
+ int bits;
+ u_long cmd;
{
u_int8_t r;
int s;
s = spltty();
- switch (how) {
- case DMGET:
+ switch (cmd) {
+ case TIOCMGET:
bits = 0;
if (SAB_READ(sc, SAB_STAR) & SAB_STAR_CTS)
bits |= TIOCM_CTS;
@@ -957,7 +958,7 @@ sabtty_mdmctrl(sc, bits, how)
if ((r & (SAB_MODE_RTS|SAB_MODE_FRTS)) == SAB_MODE_RTS)
bits |= TIOCM_RTS;
break;
- case DMSET:
+ case TIOCMSET:
r = SAB_READ(sc, SAB_MODE);
if (bits & TIOCM_RTS) {
r &= ~SAB_MODE_FRTS;
@@ -973,7 +974,7 @@ sabtty_mdmctrl(sc, bits, how)
r |= sc->sc_pvr_dtr;
SAB_WRITE(sc, SAB_PVR, r);
break;
- case DMBIS:
+ case TIOCMBIS:
if (bits & TIOCM_RTS) {
r = SAB_READ(sc, SAB_MODE);
r &= ~SAB_MODE_FRTS;
@@ -986,7 +987,7 @@ sabtty_mdmctrl(sc, bits, how)
SAB_WRITE(sc, SAB_PVR, r);
}
break;
- case DMBIC:
+ case TIOCMBIC:
if (bits & TIOCM_RTS) {
r = SAB_READ(sc, SAB_MODE);
r |= SAB_MODE_FRTS | SAB_MODE_RTS;
@@ -1021,7 +1022,7 @@ sabttyparam(sc, tp, t)
/* hang up line if ospeed is zero, otherwise raise dtr */
sabtty_mdmctrl(sc, TIOCM_DTR,
- (t->c_ospeed == 0) ? DMBIC : DMBIS);
+ (t->c_ospeed == 0) ? TIOCMBIC : TIOCMBIS);
dafo = SAB_READ(sc, SAB_DAFO);
Index: dev/ic/cy.c
===================================================================
RCS file: /home/vcs/cvs/openbsd/src/sys/dev/ic/cy.c,v
retrieving revision 1.37
diff -u -p -r1.37 cy.c
--- dev/ic/cy.c 8 Sep 2017 05:36:52 -0000 1.37
+++ dev/ic/cy.c 13 Feb 2018 20:39:20 -0000
@@ -72,7 +72,7 @@ int cy_intr(void *);
int cyparam(struct tty *, struct termios *);
void cystart(struct tty *);
void cy_poll(void *);
-int cy_modem_control(struct cy_port *, int, int);
+int cy_modem_control(struct cy_port *, int, u_long);
void cy_enable_transmitter(struct cy_port *);
void cd1400_channel_cmd(struct cy_port *, int);
int cy_speed(speed_t, int *, int *, int);
@@ -345,7 +345,7 @@ cyopen(dev, flag, mode, p)
ttsetwater(tp);
/* raise RTS too */
- cy_modem_control(cy, TIOCM_RTS, DMBIS);
+ cy_modem_control(cy, TIOCM_RTS, TIOCMBIS);
cy->cy_carrier_stat = cd_read_reg(cy, CD1400_MSVR2);
@@ -414,7 +414,7 @@ cyclose(dev, flag, mode, p)
!ISSET(cy->cy_openflags, TIOCFLAG_SOFTCAR)) {
/* drop DTR and RTS
(should we wait for output buffer to become empty first?) */
- cy_modem_control(cy, 0, DMSET);
+ cy_modem_control(cy, 0, TIOCMSET);
}
/*
@@ -536,27 +536,27 @@ cyioctl(dev, cmd, data, flag, p)
break;
case TIOCSDTR: /* DTR on */
- cy_modem_control(cy, TIOCM_DTR, DMBIS);
+ cy_modem_control(cy, TIOCM_DTR, TIOCMBIS);
break;
case TIOCCDTR: /* DTR off */
- cy_modem_control(cy, TIOCM_DTR, DMBIC);
+ cy_modem_control(cy, TIOCM_DTR, TIOCMBIC);
break;
case TIOCMSET: /* set new modem control line values */
- cy_modem_control(cy, *((int *)data), DMSET);
+ cy_modem_control(cy, *((int *)data), TIOCMSET);
break;
case TIOCMBIS: /* turn modem control bits on */
- cy_modem_control(cy, *((int *)data), DMBIS);
+ cy_modem_control(cy, *((int *)data), TIOCMBIS);
break;
case TIOCMBIC: /* turn modem control bits off */
- cy_modem_control(cy, *((int *)data), DMBIC);
+ cy_modem_control(cy, *((int *)data), TIOCMBIC);
break;
case TIOCMGET: /* get modem control/status line state */
- *((int *)data) = cy_modem_control(cy, 0, DMGET);
+ *((int *)data) = cy_modem_control(cy, 0, TIOCMGET);
break;
case TIOCGFLAGS:
@@ -684,8 +684,9 @@ cyparam(tp, t)
s = spltty();
- /* hang up the line is ospeed is zero, else turn DTR on */
- cy_modem_control(cy, TIOCM_DTR, (t->c_ospeed == 0 ? DMBIC : DMBIS));
+ /* hang up the line if ospeed is zero, else turn DTR on */
+ cy_modem_control(cy, TIOCM_DTR,
+ (t->c_ospeed == 0 ? TIOCMBIC : TIOCMBIS));
/* channel was selected by the above call to cy_modem_control() */
/* cd_write_reg(cy, CD1400_CAR, port & CD1400_CAR_CHAN); */
@@ -807,10 +808,10 @@ cyparam(tp, t)
*
*/
int
-cy_modem_control(cy, bits, howto)
+cy_modem_control(cy, bits, cmd)
struct cy_port *cy;
int bits;
- int howto;
+ u_long cmd;
{
int s, msvr;
@@ -820,8 +821,8 @@ cy_modem_control(cy, bits, howto)
cd_write_reg(cy, CD1400_CAR, cy->cy_port_num & CD1400_CAR_CHAN);
/* does not manipulate RTS if it is used for flow control */
- switch (howto) {
- case DMGET:
+ switch (cmd) {
+ case TIOCMGET:
bits = 0;
if (cy->cy_channel_control & CD1400_CCR_RCVEN)
bits |= TIOCM_LE;
@@ -850,7 +851,7 @@ cy_modem_control(cy, bits, howto)
splx(s);
return (bits);
- case DMSET: /* replace old values with new ones */
+ case TIOCMSET: /* replace old values with new ones */
#ifdef CY_HW_RTS
if (!ISSET(cy->cy_tty->t_cflag, CRTSCTS))
cd_write_reg(cy, CD1400_MSVR2,
@@ -866,7 +867,7 @@ cy_modem_control(cy, bits, howto)
#endif /* CY_HW_RTS */
break;
- case DMBIS: /* set bits */
+ case TIOCMBIS: /* set bits */
#ifdef CY_HW_RTS
if (!ISSET(cy->cy_tty->t_cflag, CRTSCTS) &&
(bits & TIOCM_RTS) != 0)
@@ -882,7 +883,7 @@ cy_modem_control(cy, bits, howto)
#endif /* CY_HW_RTS */
break;
- case DMBIC: /* clear bits */
+ case TIOCMBIC: /* clear bits */
#ifdef CY_HW_RTS
if (!ISSET(cy->cy_tty->t_cflag, CRTSCTS) &&
(bits & TIOCM_RTS))
@@ -1023,7 +1024,7 @@ cy_poll(void *arg)
#endif
if (CY_DIALIN(tp->t_dev) &&
!(*linesw[tp->t_line].l_modem)(tp, carrier))
- cy_modem_control(cy, TIOCM_DTR, DMBIC);
+ cy_modem_control(cy, TIOCM_DTR, TIOCMBIC);
#ifdef CY_DEBUG1
did_something = 1;
Index: dev/sbus/magma.c
===================================================================
RCS file: /home/vcs/cvs/openbsd/src/sys/dev/sbus/magma.c,v
retrieving revision 1.27
diff -u -p -r1.27 magma.c
--- dev/sbus/magma.c 30 Dec 2017 23:08:29 -0000 1.27
+++ dev/sbus/magma.c 13 Feb 2018 20:39:45 -0000
@@ -941,7 +941,7 @@ mttyclose(dev_t dev, int flag, int mode,
*/
/* drop DTR and RTS */
- (void)mtty_modem_control(mp, 0, DMSET);
+ (void)mtty_modem_control(mp, 0, TIOCMSET);
/* turn off the channel
CD1400_WRITE_REG(cd, CD1400_CAR, mp->mp_channel);
@@ -1026,27 +1026,27 @@ mttyioctl(dev_t dev, u_long cmd, caddr_t
break;
case TIOCSDTR: /* set DTR */
- mtty_modem_control(mp, TIOCM_DTR, DMBIS);
+ mtty_modem_control(mp, TIOCM_DTR, TIOCMBIS);
break;
case TIOCCDTR: /* clear DTR */
- mtty_modem_control(mp, TIOCM_DTR, DMBIC);
+ mtty_modem_control(mp, TIOCM_DTR, TIOCMBIC);
break;
case TIOCMSET: /* set modem lines */
- mtty_modem_control(mp, *((int *)data), DMSET);
+ mtty_modem_control(mp, *((int *)data), TIOCMSET);
break;
case TIOCMBIS: /* bit set modem lines */
- mtty_modem_control(mp, *((int *)data), DMBIS);
+ mtty_modem_control(mp, *((int *)data), TIOCMBIS);
break;
case TIOCMBIC: /* bit clear modem lines */
- mtty_modem_control(mp, *((int *)data), DMBIC);
+ mtty_modem_control(mp, *((int *)data), TIOCMBIC);
break;
case TIOCMGET: /* get modem lines */
- *((int *)data) = mtty_modem_control(mp, 0, DMGET);
+ *((int *)data) = mtty_modem_control(mp, 0, TIOCMGET);
break;
case TIOCGFLAGS:
@@ -1142,7 +1142,7 @@ mtty_start(struct tty *tp)
* only let them fiddle with RTS if CRTSCTS is not enabled
*/
int
-mtty_modem_control(struct mtty_port *mp, int bits, int howto)
+mtty_modem_control(struct mtty_port *mp, int bits, u_long cmd)
{
struct cd1400 *cd = mp->mp_cd1400;
struct tty *tp = mp->mp_tty;
@@ -1152,8 +1152,8 @@ mtty_modem_control(struct mtty_port *mp,
CD1400_WRITE_REG(cd, CD1400_CAR, mp->mp_channel);
- switch(howto) {
- case DMGET: /* get bits */
+ switch(cmd) {
+ case TIOCMGET: /* get bits */
bits = 0;
bits |= TIOCM_LE;
@@ -1176,7 +1176,7 @@ mtty_modem_control(struct mtty_port *mp,
break;
- case DMSET: /* reset bits */
+ case TIOCMSET: /* reset bits */
if (!ISSET(tp->t_cflag, CRTSCTS))
CD1400_WRITE_REG(cd, CD1400_MSVR2,
((bits & TIOCM_RTS) ? CD1400_MSVR2_DTR : 0));
@@ -1186,7 +1186,7 @@ mtty_modem_control(struct mtty_port *mp,
break;
- case DMBIS: /* set bits */
+ case TIOCMBIS: /* set bits */
if ((bits & TIOCM_RTS) && !ISSET(tp->t_cflag, CRTSCTS))
CD1400_WRITE_REG(cd, CD1400_MSVR2, CD1400_MSVR2_DTR);
@@ -1195,7 +1195,7 @@ mtty_modem_control(struct mtty_port *mp,
break;
- case DMBIC: /* clear bits */
+ case TIOCMBIC: /* clear bits */
if ((bits & TIOCM_RTS) && !ISSET(tp->t_cflag, CRTSCTS))
CD1400_WRITE_REG(cd, CD1400_MSVR2, 0);
@@ -1234,7 +1234,7 @@ mtty_param(struct tty *tp, struct termio
/* hang up the line if ospeed is zero, else raise DTR */
(void)mtty_modem_control(mp, TIOCM_DTR,
- (t->c_ospeed == 0 ? DMBIC : DMBIS));
+ (t->c_ospeed == 0 ? TIOCMBIC : TIOCMBIS));
/* select channel, done in mtty_modem_control() */
/* CD1400_WRITE_REG(cd, CD1400_CAR, mp->mp_channel); */
Index: dev/sbus/magmareg.h
===================================================================
RCS file: /home/vcs/cvs/openbsd/src/sys/dev/sbus/magmareg.h,v
retrieving revision 1.9
diff -u -p -r1.9 magmareg.h
--- dev/sbus/magmareg.h 29 Nov 2008 01:55:06 -0000 1.9
+++ dev/sbus/magmareg.h 13 Feb 2018 20:39:45 -0000
@@ -209,7 +209,7 @@ void magma_soft(void *);
int mtty_match(struct device *, void *, void *);
void mtty_attach(struct device *, struct device *, void *);
-int mtty_modem_control(struct mtty_port *, int, int);
+int mtty_modem_control(struct mtty_port *, int, u_long);
int mtty_param(struct tty *, struct termios *);
void mtty_start(struct tty *);
Index: dev/sbus/spif.c
===================================================================
RCS file: /home/vcs/cvs/openbsd/src/sys/dev/sbus/spif.c,v
retrieving revision 1.20
diff -u -p -r1.20 spif.c
--- dev/sbus/spif.c 30 Dec 2017 23:08:29 -0000 1.20
+++ dev/sbus/spif.c 13 Feb 2018 20:39:45 -0000
@@ -77,7 +77,7 @@ void spifsoftintr(void *);
int stty_param(struct tty *, struct termios *);
struct tty *sttytty(dev_t);
-int stty_modem_control(struct stty_port *, int, int);
+int stty_modem_control(struct stty_port *, int, u_long);
void stty_write_ccr(struct spif_softc *, u_int8_t);
int stty_compute_baud(speed_t, int, u_int8_t *, u_int8_t *);
void stty_start(struct tty *);
@@ -435,7 +435,7 @@ sttyclose(dev, flags, mode, p)
s = spltty();
if (ISSET(tp->t_cflag, HUPCL) || !ISSET(tp->t_state, TS_ISOPEN)) {
- stty_modem_control(sp, 0, DMSET);
+ stty_modem_control(sp, 0, TIOCMSET);
STC_WRITE(csc, STC_CAR, port);
STC_WRITE(csc, STC_CCR,
CD180_CCR_CMD_RESET|CD180_CCR_RESETCHAN);
@@ -484,22 +484,22 @@ sttyioctl(dev, cmd, data, flags, p)
STC_READ(sc, STC_SRER) | CD180_SRER_TXD);
break;
case TIOCSDTR:
- stty_modem_control(sp, TIOCM_DTR, DMBIS);
+ stty_modem_control(sp, TIOCM_DTR, TIOCMBIS);
break;
case TIOCCDTR:
- stty_modem_control(sp, TIOCM_DTR, DMBIC);
+ stty_modem_control(sp, TIOCM_DTR, TIOCMBIC);
break;
case TIOCMBIS:
- stty_modem_control(sp, *((int *)data), DMBIS);
+ stty_modem_control(sp, *((int *)data), TIOCMBIS);
break;
case TIOCMBIC:
- stty_modem_control(sp, *((int *)data), DMBIC);
+ stty_modem_control(sp, *((int *)data), TIOCMBIC);
break;
case TIOCMGET:
- *((int *)data) = stty_modem_control(sp, 0, DMGET);
+ *((int *)data) = stty_modem_control(sp, 0, TIOCMGET);
break;
case TIOCMSET:
- stty_modem_control(sp, *((int *)data), DMSET);
+ stty_modem_control(sp, *((int *)data), TIOCMSET);
break;
case TIOCGFLAGS:
*((int *)data) = sp->sp_openflags;
@@ -520,9 +520,10 @@ sttyioctl(dev, cmd, data, flags, p)
}
int
-stty_modem_control(sp, bits, how)
+stty_modem_control(sp, bits, cmd)
struct stty_port *sp;
- int bits, how;
+ int bits;
+ u_long cmd;
{
struct spif_softc *csc = sp->sp_sc;
struct tty *tp = sp->sp_tty;
@@ -531,8 +532,8 @@ stty_modem_control(sp, bits, how)
s = spltty();
STC_WRITE(csc, STC_CAR, sp->sp_channel);
- switch (how) {
- case DMGET:
+ switch (cmd) {
+ case TIOCMGET:
bits = TIOCM_LE;
if (DTR_READ(csc, sp->sp_channel))
bits |= TIOCM_DTR;
@@ -546,7 +547,7 @@ stty_modem_control(sp, bits, how)
if (ISSET(msvr, CD180_MSVR_RTS))
bits |= TIOCM_RTS;
break;
- case DMSET:
+ case TIOCMSET:
DTR_WRITE(csc, sp->sp_channel, ISSET(bits, TIOCM_DTR) ? 1 : 0);
if (ISSET(bits, TIOCM_RTS))
STC_WRITE(csc, STC_MSVR,
@@ -555,14 +556,14 @@ stty_modem_control(sp, bits, how)
STC_WRITE(csc, STC_MSVR,
STC_READ(csc, STC_MSVR) | CD180_MSVR_RTS);
break;
- case DMBIS:
+ case TIOCMBIS:
if (ISSET(bits, TIOCM_DTR))
DTR_WRITE(csc, sp->sp_channel, 1);
if (ISSET(bits, TIOCM_RTS) && !ISSET(tp->t_cflag, CRTSCTS))
STC_WRITE(csc, STC_MSVR,
STC_READ(csc, STC_MSVR) & (~CD180_MSVR_RTS));
break;
- case DMBIC:
+ case TIOCMBIC:
if (ISSET(bits, TIOCM_DTR))
DTR_WRITE(csc, sp->sp_channel, 0);
if (ISSET(bits, TIOCM_RTS))
@@ -598,7 +599,7 @@ stty_param(tp, t)
/* hang up line if ospeed is zero, otherwise raise DTR */
stty_modem_control(sp, TIOCM_DTR,
- (t->c_ospeed == 0 ? DMBIC : DMBIS));
+ (t->c_ospeed == 0 ? TIOCMBIC : TIOCMBIS));
STC_WRITE(sc, STC_CAR, sp->sp_channel);
Index: sys/tty.h
===================================================================
RCS file: /home/vcs/cvs/openbsd/src/sys/sys/tty.h,v
retrieving revision 1.37
diff -u -p -r1.37 tty.h
--- sys/tty.h 24 May 2016 16:09:07 -0000 1.37
+++ sys/tty.h 13 Feb 2018 20:39:54 -0000
@@ -215,12 +215,6 @@ struct speedtab {
int sp_code; /* Code. */
};
-/* Modem control commands (driver). */
-#define DMSET 0
-#define DMBIS 1
-#define DMBIC 2
-#define DMGET 3
-
/* Flags on a character passed to ttyinput. */
#define TTY_CHARMASK 0x000000ff /* Character mask */
#define TTY_QUOTE 0x00000100 /* Character quoted */