diff options
author | ache <ache@FreeBSD.org> | 1995-08-02 10:17:35 +0000 |
---|---|---|
committer | ache <ache@FreeBSD.org> | 1995-08-02 10:17:35 +0000 |
commit | 46c8945e4166bb45c4bad858f32625b082d586e6 (patch) | |
tree | 3cba057e87455d4d4bb5fd28c2dc6f40fe59f8f0 /sys/i386 | |
parent | 3005a2c5a8183ac588dab70a3deadb1d2a6fb068 (diff) | |
download | FreeBSD-src-46c8945e4166bb45c4bad858f32625b082d586e6.zip FreeBSD-src-46c8945e4166bb45c4bad858f32625b082d586e6.tar.gz |
Allow any speed from 0..76800
Reviewed by:
Submitted by:
Obtained from:
Diffstat (limited to 'sys/i386')
-rw-r--r-- | sys/i386/isa/rc.c | 32 | ||||
-rw-r--r-- | sys/i386/isa/rcreg.h | 4 |
2 files changed, 8 insertions, 28 deletions
diff --git a/sys/i386/isa/rc.c b/sys/i386/isa/rc.c index 1e9f666..370a59e 100644 --- a/sys/i386/isa/rc.c +++ b/sys/i386/isa/rc.c @@ -148,28 +148,6 @@ int nrc_tty = NRC * CD180_NCHAN; #define RC_WAS_SILOVFL 0x0400 /* silo buffer overflow */ #define RC_SEND_RDY 0x0800 /* ready to send */ -static struct speedtab rc_speedtab[] = { - 0, 0, - 50, RC_BRD(50), - 75, RC_BRD(75), - 110, RC_BRD(110), - 134, RC_BRD(134), - 150, RC_BRD(150), - 200, RC_BRD(200), - 300, RC_BRD(300), - 600, RC_BRD(600), - 1200, RC_BRD(1200), - 1800, RC_BRD(1800), - 2400, RC_BRD(2400), - 4800, RC_BRD(4800), - 9600, RC_BRD(9600), - 19200, RC_BRD(19200), - 38400, RC_BRD(38400), - 57600, RC_BRD(57600), - /* real max value is 76800 with 9.8304 MHz clock */ - -1, -1 -}; - /* Table for translation of RCSR status bits to internal form */ static int rc_rcsrt[16] = { 0, TTY_OE, TTY_FE, @@ -944,12 +922,14 @@ static int rc_param(tp, ts) register int nec = rc->rc_rcb->rcb_addr; int idivs, odivs, s, val, cflag, iflag, lflag, inpflow; - odivs = ttspeedtab(ts->c_ospeed, rc_speedtab); + if ( ts->c_ospeed < 0 || ts->c_ospeed > 76800 + || ts->c_ispeed < 0 || ts->c_ispeed > 76800 + ) + return (EINVAL); if (ts->c_ispeed == 0) ts->c_ispeed = ts->c_ospeed; - idivs = ttspeedtab(ts->c_ispeed, rc_speedtab); - if (idivs < 0 || odivs < 0) - return (EINVAL); + odivs = RC_BRD(ts->c_ospeed); + idivs = RC_BRD(ts->c_ispeed); s = spltty(); diff --git a/sys/i386/isa/rcreg.h b/sys/i386/isa/rcreg.h index bd92540..75015f2 100644 --- a/sys/i386/isa/rcreg.h +++ b/sys/i386/isa/rcreg.h @@ -32,8 +32,8 @@ /* Oscillator frequency - 19660.08Mhz / 2 */ #define RC_OSCFREQ 9830400 -#define RC_BRD(s) \ - ((((RC_OSCFREQ + (s) / 2) / (s)) + CD180_CTICKS/2) / CD180_CTICKS) +#define RC_BRD(s) ((s) == 0 ? 0 : \ + (((RC_OSCFREQ + (s) / 2) / (s)) + CD180_CTICKS/2) / CD180_CTICKS) #define RC_VALIDADDR(a) ( (a) == 0x220 || (a) == 0x240 || (a) == 0x250 \ || (a) == 0x260 || (a) == 0x2A0 || (a) == 0x2B0 \ |