summaryrefslogtreecommitdiff
path: root/sys/compat
diff options
context:
space:
mode:
authorNiklas Hallqvist <niklas@cvs.openbsd.org>1998-02-10 15:01:44 +0000
committerNiklas Hallqvist <niklas@cvs.openbsd.org>1998-02-10 15:01:44 +0000
commite614bdc376e8a8d6968184d31bc712ca2aca314e (patch)
tree49842172cc50a11f9fcc455234cd417dcd65d51f /sys/compat
parentec7e8ea8918ce77ebf4140a5b7035f43479f5953 (diff)
Fix many bugs related to serial line control, like baudrate, bits etc
Diffstat (limited to 'sys/compat')
-rw-r--r--sys/compat/svr4/svr4_termios.c32
-rw-r--r--sys/compat/svr4/svr4_termios.h9
2 files changed, 24 insertions, 17 deletions
diff --git a/sys/compat/svr4/svr4_termios.c b/sys/compat/svr4/svr4_termios.c
index aa5ad177cb6..2f2652c7ff4 100644
--- a/sys/compat/svr4/svr4_termios.c
+++ b/sys/compat/svr4/svr4_termios.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: svr4_termios.c,v 1.9 1997/11/04 07:48:39 niklas Exp $ */
+/* $OpenBSD: svr4_termios.c,v 1.10 1998/02/10 15:01:42 niklas Exp $ */
/* $NetBSD: svr4_termios.c,v 1.9 1996/04/11 12:53:48 christos Exp $ */
/*
@@ -132,14 +132,14 @@ void print_bsd_termios __P((const struct termios *));
st->f &= ~__CONCAT3(SVR4_,a,b)
#define bsd_to_svr4_flag2(f,a,b,c1,t1,c2,t2) \
- st->f &= ~__CONCAT(a,b); \
+ st->f &= ~__CONCAT3(SVR4_,a,b); \
switch (bt->f & __CONCAT(a,b)) { \
case __CONCAT(c1,t1): st->f |= __CONCAT3(SVR4_,c1,t1); break; \
case __CONCAT(c2,t2): st->f |= __CONCAT3(SVR4_,c2,t2); break; \
}
#define bsd_to_svr4_flag4(f,a,b,c1,t1,c2,t2,c3,t3,c4,t4) \
- st->f &= ~__CONCAT(a,b); \
+ st->f &= ~__CONCAT3(SVR4_,a,b); \
switch (bt->f & __CONCAT(a,b)) { \
case __CONCAT(c1,t1): st->f |= __CONCAT3(SVR4_,c1,t1); break; \
case __CONCAT(c2,t2): st->f |= __CONCAT3(SVR4_,c2,t2); break; \
@@ -161,14 +161,15 @@ print_svr4_termios(st)
uprintf("\n");
}
-
void
print_bsd_termios(bt)
const struct termios *bt;
{
int i;
- uprintf("BSD\niflag=%o oflag=%o cflag=%o lflag=%o\n",
- bt->c_iflag, bt->c_oflag, bt->c_cflag, bt->c_lflag);
+ uprintf(
+ "BSD\niflag=%x oflag=%x cflag=%x lflag=%x ispeed=%d osped=%d\n",
+ bt->c_iflag, bt->c_oflag, bt->c_cflag, bt->c_lflag, bt->c_ispeed,
+ bt->c_ospeed);
uprintf("cc: ");
for (i = 0; i < NCCS; i++)
uprintf("%o ", bt->c_cc[i]);
@@ -183,7 +184,7 @@ bsd_to_svr4_speed(sp, mask)
{
switch (sp) {
#undef getval
-#define getval(a,b) case __CONCAT(a,b): sp = __CONCAT3(SVR4_,a,b)
+#define getval(a,b) case __CONCAT(a,b): sp = __CONCAT3(SVR4_,a,b); break
getval(B,0);
getval(B,50);
getval(B,75);
@@ -200,8 +201,11 @@ bsd_to_svr4_speed(sp, mask)
getval(B,9600);
getval(B,19200);
getval(B,38400);
+#if 0
+ /* XXX These don't fit in CBAUD */
getval(B,57600);
getval(B,115200);
+#endif
default: sp = SVR4_B9600; /* XXX */
}
@@ -213,7 +217,6 @@ bsd_to_svr4_speed(sp, mask)
return (sp);
}
-
u_long
svr4_to_bsd_speed(sp, mask)
u_long sp;
@@ -243,18 +246,20 @@ svr4_to_bsd_speed(sp, mask)
getval(B,9600);
getval(B,19200);
getval(B,38400);
+#if 0
+ /* XXX These don't fit in CBAUD */
getval(B,57600);
getval(B,115200);
+#endif
default: return (B9600); /* XXX */
}
}
-
void
svr4_to_bsd_termios(st, bt, new)
const struct svr4_termios *st;
struct termios *bt;
- int new;
+ int new;
{
/* control characters */
svr4_to_bsd_char(V,INTR);
@@ -365,7 +370,6 @@ svr4_to_bsd_termios(st, bt, new)
svr4_to_bsd_flag1(c_lflag,I,EXTEN);
}
-
void
bsd_to_svr4_termios(bt, st)
const struct termios *bt;
@@ -477,7 +481,6 @@ bsd_to_svr4_termios(bt, st)
bsd_to_svr4_flag1(c_lflag,I,EXTEN);
}
-
void
svr4_termio_to_termios(t, ts)
const struct svr4_termio *t;
@@ -487,14 +490,15 @@ svr4_termio_to_termios(t, ts)
ts->c_iflag = (svr4_tcflag_t)t->c_iflag;
ts->c_oflag = (svr4_tcflag_t)t->c_oflag;
- ts->c_cflag = (svr4_tcflag_t)t->c_cflag;
+ ts->c_cflag = (svr4_tcflag_t)t->c_cflag & ~SVR4_CIBAUD;
+ /* XXX because SVR4_CIBAUD == SVR4_CBAUD << 16 we can do: */
+ ts->c_cflag |= (ts->c_cflag & SVR4_CBAUD) << 16;
ts->c_lflag = (svr4_tcflag_t)t->c_lflag;
for (i = 0; i < SVR4_NCC; i++)
ts->c_cc[i] = (svr4_cc_t)t->c_cc[i];
}
-
void
svr4_termios_to_termio(ts, t)
const struct svr4_termios *ts;
diff --git a/sys/compat/svr4/svr4_termios.h b/sys/compat/svr4/svr4_termios.h
index d04b6fcd695..ca1e0c7318e 100644
--- a/sys/compat/svr4/svr4_termios.h
+++ b/sys/compat/svr4/svr4_termios.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: svr4_termios.h,v 1.3 1996/08/02 20:35:45 niklas Exp $ */
+/* $OpenBSD: svr4_termios.h,v 1.4 1998/02/10 15:01:43 niklas Exp $ */
/* $NetBSD: svr4_termios.h,v 1.2 1994/11/18 02:54:21 christos Exp $ */
/*
@@ -132,9 +132,9 @@ struct svr4_termio {
#define SVR4_CBAUD 00000017
#define SVR4_CSIZE 00000060
#define SVR4_CS5 00000000
-#define SVR4_CS6 00000200
+#define SVR4_CS6 00000020
#define SVR4_CS7 00000040
-#define SVR4_CS8 00000006
+#define SVR4_CS8 00000060
#define SVR4_CSTOPB 00000100
#define SVR4_CREAD 00000200
#define SVR4_PARENB 00000400
@@ -214,6 +214,8 @@ struct svr4_winsize {
#define SVR4_B9600 13
#define SVR4_B19200 14
#define SVR4_B38400 15
+#if 0
+/* XXX How do these fit in CBAUD? */
#define SVR4_B57600 16
#define SVR4_B76800 17
#define SVR4_B115200 18
@@ -221,5 +223,6 @@ struct svr4_winsize {
#define SVR4_B230400 20
#define SVR4_B307200 21
#define SVR4_B460800 22
+#endif
#endif /* !_SVR4_TERMIOS_H_ */