diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2001-03-15 17:52:21 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2001-03-15 17:52:21 +0000 |
commit | 4391c970ad9c9be165eeeaffd800233e9ecaed35 (patch) | |
tree | aa9c5f244f5b3fd9e6ea4eb71d9d104765897f32 /sys/dev/ic | |
parent | 2801c508532c77a03e474ee2f6e3e4d2f93a49a3 (diff) |
support puc devices with higher speeds (not tested yet)
Diffstat (limited to 'sys/dev/ic')
-rw-r--r-- | sys/dev/ic/com.c | 14 | ||||
-rw-r--r-- | sys/dev/ic/comvar.h | 4 |
2 files changed, 10 insertions, 8 deletions
diff --git a/sys/dev/ic/com.c b/sys/dev/ic/com.c index 007568dd1e5..7ea9661638d 100644 --- a/sys/dev/ic/com.c +++ b/sys/dev/ic/com.c @@ -1,4 +1,4 @@ -/* $OpenBSD: com.c,v 1.58 2001/03/13 02:53:51 mickey Exp $ */ +/* $OpenBSD: com.c,v 1.59 2001/03/15 17:52:20 deraadt Exp $ */ /* $NetBSD: com.c,v 1.82.4.1 1996/06/02 09:08:00 mrg Exp $ */ /* @@ -201,7 +201,8 @@ void com_kgdb_putc __P((void *, int)); #endif int -comspeed(speed) +comspeedcomspeed(freq, speed) + long freq; long speed; { #define divrnd(n, q) (((n)*2/(q)+1)/2) /* divide and round off */ @@ -212,10 +213,10 @@ comspeed(speed) return 0; if (speed < 0) return -1; - x = divrnd((COM_FREQ / 16), speed); + x = divrnd((freq / 16), speed); if (x <= 0) return -1; - err = divrnd((COM_FREQ / 16) * 1000, speed * x) - 1000; + err = divrnd((freq / 16) * 1000, speed * x) - 1000; if (err < 0) err = -err; if (err > COM_TOLERANCE) @@ -467,6 +468,7 @@ comattach(parent, self, aux) sc->sc_iot = iot; sc->sc_ioh = ioh; sc->sc_iobase = iobase; + sc->sc_frequency = COM_FREQ; if (iobase == comconsaddr) { comconsattached = 1; @@ -1270,7 +1272,7 @@ comparam(tp, t) struct com_softc *sc = com_cd.cd_devs[DEVUNIT(tp->t_dev)]; bus_space_tag_t iot = sc->sc_iot; bus_space_handle_t ioh = sc->sc_ioh; - int ospeed = comspeed(t->c_ospeed); + int ospeed = comspeed(sc->sc_frequency, t->c_ospeed); u_char lcr; tcflag_t oldcflag; int s; @@ -1935,7 +1937,7 @@ cominit(iot, ioh, rate) u_char stat; bus_space_write_1(iot, ioh, com_lcr, LCR_DLAB); - rate = comspeed(rate); /* XXX not comdefaultrate? */ + rate = comspeed(COM_FREQ, rate); /* XXX not comdefaultrate? */ bus_space_write_1(iot, ioh, com_dlbl, rate); bus_space_write_1(iot, ioh, com_dlbh, rate >> 8); bus_space_write_1(iot, ioh, com_lcr, LCR_8BITS); diff --git a/sys/dev/ic/comvar.h b/sys/dev/ic/comvar.h index 693b4e6f277..d750efa76bf 100644 --- a/sys/dev/ic/comvar.h +++ b/sys/dev/ic/comvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: comvar.h,v 1.19 2001/03/13 02:53:52 mickey Exp $ */ +/* $OpenBSD: comvar.h,v 1.20 2001/03/15 17:52:20 deraadt Exp $ */ /* $NetBSD: comvar.h,v 1.5 1996/05/05 19:50:47 christos Exp $ */ /* @@ -151,7 +151,7 @@ int com_activate __P((struct device *, enum devact)); int comprobeHAYESP __P((bus_space_handle_t hayespioh, struct com_softc *sc)); #endif void comdiag __P((void *)); -int comspeed __P((long)); +int comspeed __P((long, long)); u_char com_cflag2lcr __P((tcflag_t)); int comparam __P((struct tty *, struct termios *)); void comstart __P((struct tty *)); |