Return to BSD News archive
Path: sserve!newshost.anu.edu.au!munnari.oz.au!news.Hawaii.Edu!ames!elroy.jpl.nasa.gov!usc!howland.reston.ans.net!xlink.net!math.fu-berlin.de!fub!max.IN-Berlin.DE!not-for-mail From: berry@max.IN-Berlin.DE (Stefan Behrens) Newsgroups: comp.os.386bsd.questions Subject: Re: Slcompress -- enforce HW flow-control, patch Date: 7 Jul 1993 20:59:25 +0200 Organization: Private Site in Berlin/Germany Lines: 68 Message-ID: <21f6er$2v7@max.in-berlin.de> References: <Felipe.28.740578609@utopia.hacktic.nl> <C9I9Hs.ABv@news.cso.uiuc.edu> <hastyC9IFM3.F9u@netcom.com> <BLYMN.93Jul6170320@mallee.awadi.com.au> NNTP-Posting-Host: max.in-berlin.de Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Summary: patch for /sys/i386/isa/sio.c to enforce hardware flow-control In article <BLYMN.93Jul6170320@mallee.awadi.com.au> blymn@awadi.com.au (Brett Lymn) writes: >If you use a v.42bis modem I would *strongly* recommend that you >ensure that the flow control is enabled on the serial port (use stty >crtscts to do this). I did modify slattach to add a flag to enable >the hardware flow control on the port. I also recommend the usage of hardware flow-control on the serial port. But why change every application to support it. I simply hacked the kernel to force usage of hardware flow-control configurable with the minor device nuber. The following patch against 386BSD0.1 pk0.2.4 will enable hw-flow-control if the bit 6 of the minor number is set. The minor numbers should look like this: crw-rw---- 1 uucp dialer 28, 193 Jul 7 20:07 /dev/cua01 crw------- 1 root wheel 28, 65 Jul 6 18:12 /dev/ttyd1 *** /sys/i368/isa/sio.c.pk0.2.4 Wed Jun 30 21:12:06 1993 --- /sys/i368/isa/sio.c Wed Jun 30 23:09:38 1993 *************** *** 79,87 **** #define UNIT(x) (minor(x)) /* XXX */ #else /* COM_BIDIR */ ! #define COM_UNITMASK 0x7f #define COM_CALLOUTMASK 0x80 #define UNIT(x) (minor(x) & COM_UNITMASK) #define CALLOUT(x) (minor(x) & COM_CALLOUTMASK) #endif /* COM_BIDIR */ --- 79,90 ---- #define UNIT(x) (minor(x)) /* XXX */ #else /* COM_BIDIR */ ! #define COM_UNITMASK 0x3f #define COM_CALLOUTMASK 0x80 + /* force hardware flow control with bit 6 of minor number */ + #define COM_HWFLOWMASK 0x40 #define UNIT(x) (minor(x) & COM_UNITMASK) #define CALLOUT(x) (minor(x) & COM_CALLOUTMASK) + #define HWFLOW(x) (minor(x) & COM_HWFLOWMASK) #endif /* COM_BIDIR */ *************** *** 1297,1300 **** --- 1300,1319 ---- iobase = com->iobase; s = spltty(); + if (HWFLOW(tp->t_dev)) { + /* + * Force usage of hardware flow control. + * Do it twice (for tp and for t) although + * comparam() is called from sioopen() with + * comparam(tp, &tp->t_termios). + * But maybe it will be called from somewhere + * else via the t_param switch member of + * struct tty? + */ + tp->t_cflag |= CRTS_IFLOW|CCTS_OFLOW|CRTSCTS; + t->c_cflag |= CRTS_IFLOW|CCTS_OFLOW|CRTSCTS; /* once again */ + /* do not use software flow control */ + tp->t_iflag &= ~(IXON|IXOFF|IXANY); + t->c_iflag &= ~(IXON|IXOFF|IXANY); /* once again */ + } if (divisor == 0) { (void) commctl(com, 0, DMSET); /* hang up line */ -- Stefan (berry@max.IN-Berlin.DE)