FAS 2.05 async driver, patch 2

Uwe Doering gemini at geminix.UUCP
Thu Feb 8 00:50:32 AEST 1990


Hi netlanders!

Here is patch #2 for the FAS 2.05 async driver. Besides some Xenix
compatibility for SYSV 3.2 this patch fixes a bug that could cost you
a lot of time and nerves. So please apply it!

A short quote from the README file:

     Bug Fixes:

          Under some special conditions an ioctl call with a TCSETA?
          command could corrupt the last character in the transmitter
          shift register. This is fixed now.


     Uwe


#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create:
#	fas205.p02
# This archive created: Wed Feb  7 14:37:13 1990
export PATH; PATH=/bin:/usr/bin:$PATH
echo shar: "extracting 'fas205.p02'" '(9422 characters)'
if test -f 'fas205.p02'
then
	echo shar: "will not over-write existing file 'fas205.p02'"
else
sed 's/^X//' << \SHAR_EOF > 'fas205.p02'
Xdiff -c ../old/PATCHLEVEL ./PATCHLEVEL
X*** ../old/PATCHLEVEL	Thu Jan 25 14:00:00 1990
X--- ./PATCHLEVEL	Wed Feb  7 14:00:00 1990
X***************
X*** 1,1 ****
X! release 2.05 patchlevel 1
X--- 1,1 ----
X! release 2.05 patchlevel 2
Xdiff -c ../old/README ./README
X*** ../old/README	Thu Jan 25 14:00:00 1990
X--- ./README	Wed Feb  7 14:00:00 1990
X***************
X*** 470,480 ****
X--- 470,487 ----
X       (mentioned in earlier releases) should be gone if you use this
X       new mode.
X  
X+      If the XCLUDE-Flag is availabe (SYSV 3.2 because of Xenix
X+      compatibility) exclusive open of a device is possible.
X+ 
X       Bug Fixes:
X  
X            The task state busy flag wasn't reset in some rare cases.
X            This could cause processes to become immortal while waiting
X            for the busy flag.
X+ 
X+           Under some special conditions an ioctl call with a TCSETA?
X+           command could corrupt the last character in the transmitter
X+           shift register. This is fixed now.
X  
X  ---------------------------------------------------------------------
X  
Xdiff -c ../old/fas.c ./fas.c
X*** ../old/fas.c	Thu Jan 25 14:00:00 1990
X--- ./fas.c	Wed Feb  7 14:00:00 1990
X***************
X*** 196,209 ****
X  
X  /* time for one character to completely leave the transmitter shift register */
X  static uint	fas_ctimes [CBAUD + 1] =
X! {	1,		HZ*30/50+2,
X! 	HZ*30/75+2,	HZ*30/110+2,
X! 	HZ*60/269+2,	HZ*30/150+2,
X! 	HZ*30/200+2,	HZ*30/300+2,
X! 	HZ*30/600+2,	HZ*30/1200+2,
X! 	HZ*30/1800+2,	HZ*30/2400+2,
X! 	HZ*30/4800+2,	HZ*30/9600+2,
X! 	HZ*30/19200+2,	HZ*30/38400+2
X  };
X  
X  /* lookup table for minor device number -> open mode flags translation */
X--- 196,209 ----
X  
X  /* time for one character to completely leave the transmitter shift register */
X  static uint	fas_ctimes [CBAUD + 1] =
X! {	1,		HZ*15/50+2,
X! 	HZ*15/75+2,	HZ*15/110+2,
X! 	HZ*30/269+2,	HZ*15/150+2,
X! 	HZ*15/200+2,	HZ*15/300+2,
X! 	HZ*15/600+2,	HZ*15/1200+2,
X! 	HZ*15/1800+2,	HZ*15/2400+2,
X! 	HZ*15/4800+2,	HZ*15/9600+2,
X! 	HZ*15/19200+2,	HZ*15/38400+2
X  };
X  
X  /* lookup table for minor device number -> open mode flags translation */
X***************
X*** 842,848 ****
X  			fip->lcr.c |= LC_EVEN_PARITY;
X  	}
X  
X! 	/* change counter divisor only if baud rate has changed */
X  	if ((cflag ^ fip->cflag) & CBAUD)
X  	{
X  		/* get counter divisor for selected baud rate */
X--- 842,852 ----
X  			fip->lcr.c |= LC_EVEN_PARITY;
X  	}
X  
X! 	/* We write the counter divisor and the LCR register only
X! 	   if we need to (whenever the corresponding cflag bits
X! 	   have changed). This prevents character corruption under
X! 	   some special conditions.
X! 	*/
X  	if ((cflag ^ fip->cflag) & CBAUD)
X  	{
X  		/* get counter divisor for selected baud rate */
X***************
X*** 850,858 ****
X  		outb (LINE_CTL_PORT, fip->lcr.i | LC_ENABLE_DIVISOR);
X  		outb (DIVISOR_LSB_PORT, divisor);
X  		outb (DIVISOR_MSB_PORT, divisor >> 8);
X  	}
X! 
X! 	outb (LINE_CTL_PORT, fip->lcr.i);
X  
X  	/* disable modem control signals if required by open mode */
X  	if (fip->o_state & OS_CLOCAL)
X--- 854,863 ----
X  		outb (LINE_CTL_PORT, fip->lcr.i | LC_ENABLE_DIVISOR);
X  		outb (DIVISOR_LSB_PORT, divisor);
X  		outb (DIVISOR_MSB_PORT, divisor >> 8);
X+ 		outb (LINE_CTL_PORT, fip->lcr.i);
X  	}
X! 	else if ((cflag ^ fip->cflag) & (CSIZE | CSTOPB | PARENB | PARODD))
X! 		outb (LINE_CTL_PORT, fip->lcr.i);
X  
X  	/* disable modem control signals if required by open mode */
X  	if (fip->o_state & OS_CLOCAL)
X***************
X*** 868,873 ****
X--- 873,885 ----
X  	else
X  		fip->tty->t_state &= ~CARR_ON;
X  
X+ #if defined XCLUDE	/* SYSV 3.2 Xenix compatibility */
X+ 	if (cflag & XCLUDE)
X+ 		fip->o_state |= OS_EXCLUSIVE_OPEN;
X+ 	else
X+ 		fip->o_state &= ~OS_EXCLUSIVE_OPEN;
X+ #endif
X+ 
X  	fip->cflag = cflag;
X  	fip->iflag = fip->tty->t_iflag;
X  }
X***************
X*** 927,934 ****
X  					&& (fip->device_flags.i & DF_XMIT_BUSY))
X  				{
X  					fip->device_flags.s &= ~DF_XMIT_BUSY;
X- 					fip->tty->t_state &= ~BUSY;
X  					fas_cmd (fip, fip->tty, T_OUTPUT);
X  					sysinfo.xmtint++;
X  				}
X  
X--- 939,952 ----
X  					&& (fip->device_flags.i & DF_XMIT_BUSY))
X  				{
X  					fip->device_flags.s &= ~DF_XMIT_BUSY;
X  					fas_cmd (fip, fip->tty, T_OUTPUT);
X+ 					if (!(fip->device_flags.i & DF_XMIT_BUSY))
X+ 					{
X+ 						fip->tty->t_state |= TIMEOUT;
X+ 						timeout (ttrstrt, fip->tty,
X+ 							fas_ctimes [fip->cflag
X+ 								& CBAUD]);
X+ 					}
X  					sysinfo.xmtint++;
X  				}
X  
X***************
X*** 1152,1162 ****
X  						|| (fip->iflag & IXANY))
X  					{
X  						ttyp->t_state &= ~TTSTOP;
X! 						/* fake transmitter busy flag
X! 						   to restart output
X! 						*/
X! 						fip->device_flags.s |=
X! 							DF_XMIT_BUSY;
X  					}
X  				}
X  				else
X--- 1170,1177 ----
X  						|| (fip->iflag & IXANY))
X  					{
X  						ttyp->t_state &= ~TTSTOP;
X! 						/* restart output */
X! 						fas_cmd (fip, ttyp, T_OUTPUT);
X  					}
X  				}
X  				else
X***************
X*** 1263,1287 ****
X  	{
X  	case T_TIME:	/* process delayed events */
X  		/* handle break request */
X! 		if (fip->device_flags.i & DF_DO_BREAK)
X  		{
X! 			if (fip->lcr.i & LC_SET_BREAK_LEVEL)
X! 			{
X! 				fip->lcr.c &= ~LC_SET_BREAK_LEVEL;
X! 				outb (LINE_CTL_PORT, fip->lcr.i);
X! 				fip->device_flags.s &= ~DF_DO_BREAK;
X! 				timeout (ttrstrt, ttyp,
X! 					fas_ctimes [fip->cflag & CBAUD]);
X! 				break;
X! 			}
X! 			else
X! 			{
X! 				fip->lcr.c |= LC_SET_BREAK_LEVEL;
X! 				outb (LINE_CTL_PORT, fip->lcr.i);
X! 					/* 250 msec */
X! 				timeout (ttrstrt, ttyp, HZ / 4);
X! 				break;
X! 			}
X  		}
X  		/* handle hangup request */
X  		if (fip->device_flags.i & DF_DO_HANGUP)
X--- 1278,1290 ----
X  	{
X  	case T_TIME:	/* process delayed events */
X  		/* handle break request */
X! 		if (fip->lcr.i & LC_SET_BREAK_LEVEL)
X  		{
X! 			fip->lcr.c &= ~LC_SET_BREAK_LEVEL;
X! 			outb (LINE_CTL_PORT, fip->lcr.i);
X! 			timeout (ttrstrt, ttyp,
X! 				fas_ctimes [fip->cflag & CBAUD]);
X! 			break;
X  		}
X  		/* handle hangup request */
X  		if (fip->device_flags.i & DF_DO_HANGUP)
X***************
X*** 1311,1316 ****
X--- 1314,1321 ----
X  				break;
X  			}
X  		}
X+ 		if (!(fip->device_flags.i & DF_XMIT_DISABLED))
X+ 			ttyp->t_state &= ~BUSY;
X  		ttyp->t_state &= ~TIMEOUT;
X  		fip->device_flags.s &= ~DF_XMIT_DISABLED;
X  		/* FALL THRU */
X***************
X*** 1448,1456 ****
X  
X  	case T_BREAK:	/* do a break on the transmitter line */
X  		/* set up break request flags */
X! 		fip->device_flags.s |= DF_DO_BREAK | DF_XMIT_DISABLED;
X  		ttyp->t_state |= TIMEOUT;
X! 		timeout (ttrstrt, ttyp, fas_ctimes [fip->cflag & CBAUD]);
X  		break;
X  
X  	case T_PARM:	/* set up the port according to the termio structure */
X--- 1453,1463 ----
X  
X  	case T_BREAK:	/* do a break on the transmitter line */
X  		/* set up break request flags */
X! 		fip->lcr.c |= LC_SET_BREAK_LEVEL;
X! 		outb (LINE_CTL_PORT, fip->lcr.i);
X! 		fip->device_flags.s |= DF_XMIT_DISABLED;
X  		ttyp->t_state |= TIMEOUT;
X! 		timeout (ttrstrt, ttyp, HZ / 4);	/* 250 msec */
X  		break;
X  
X  	case T_PARM:	/* set up the port according to the termio structure */
X***************
X*** 1513,1521 ****
X  		/* request hangup */
X  		fip->device_flags.s |= DF_DO_HANGUP | DF_XMIT_DISABLED;
X  		fip->tty->t_state |= TIMEOUT;
X! 		timeout (ttrstrt, fip->tty,
X! 				max (fas_ctimes [fip->cflag & CBAUD],
X! 							HANGUP_DELAY));
X  	}
X  	if (fip->device_flags.i & DF_DEVICE_HAS_FIFO)
X  		outb (FIFO_CTL_PORT, STANDARD_FIFO_CLEAR);
X--- 1520,1526 ----
X  		/* request hangup */
X  		fip->device_flags.s |= DF_DO_HANGUP | DF_XMIT_DISABLED;
X  		fip->tty->t_state |= TIMEOUT;
X! 		timeout (ttrstrt, fip->tty, HANGUP_DELAY);
X  	}
X  	if (fip->device_flags.i & DF_DEVICE_HAS_FIFO)
X  		outb (FIFO_CTL_PORT, STANDARD_FIFO_CLEAR);
Xdiff -c ../old/fas.h ./fas.h
X*** ../old/fas.h	Thu Jan 25 14:00:00 1990
X--- ./fas.h	Wed Feb  7 14:00:00 1990
X***************
X*** 92,103 ****
X  #define OS_UNBLOCK_ON_RING	0x0040
X  #define OS_CLOCAL		0x0080
X  #define OS_HW_HANDSHAKE		0x0100
X  
X  #define OS_OPEN_STATES		(OS_OPEN_FOR_DIALOUT | OS_OPEN_FOR_GETTY)
X  #define OS_TEST_MASK		(OS_OPEN_FOR_DIALOUT | OS_NO_DIALOUT \
X  				| OS_CHECK_CARR_ON_OPEN | OS_FAKE_CARR_ON \
X  				| OS_UNBLOCK_ON_RING | OS_CLOCAL \
X! 				| OS_HW_HANDSHAKE)
X  
X  /* define the hardware handshake flags */
X  
X--- 92,104 ----
X  #define OS_UNBLOCK_ON_RING	0x0040
X  #define OS_CLOCAL		0x0080
X  #define OS_HW_HANDSHAKE		0x0100
X+ #define OS_EXCLUSIVE_OPEN	0x0200	/* SYSV 3.2 Xenix compatibility */
X  
X  #define OS_OPEN_STATES		(OS_OPEN_FOR_DIALOUT | OS_OPEN_FOR_GETTY)
X  #define OS_TEST_MASK		(OS_OPEN_FOR_DIALOUT | OS_NO_DIALOUT \
X  				| OS_CHECK_CARR_ON_OPEN | OS_FAKE_CARR_ON \
X  				| OS_UNBLOCK_ON_RING | OS_CLOCAL \
X! 				| OS_HW_HANDSHAKE | OS_EXCLUSIVE_OPEN)
X  
X  /* define the hardware handshake flags */
X  
X***************
X*** 122,129 ****
X  #define DF_HWISTOP		0x0080	/* input stopped by hw handshake */
X  #define DF_XMIT_DISABLED	0x0100	/* transmitter is disabled */
X  #define DF_XMIT_BUSY		0x0200	/* transmitter is busy */
X! #define DF_DO_BREAK		0x0400	/* delayed BREAK request */
X! #define DF_DO_HANGUP		0x0800	/* delayed hangup request */
X  
X  /* description of the NS16X50 Asychronous Communications Element */
X  
X--- 123,129 ----
X  #define DF_HWISTOP		0x0080	/* input stopped by hw handshake */
X  #define DF_XMIT_DISABLED	0x0100	/* transmitter is disabled */
X  #define DF_XMIT_BUSY		0x0200	/* transmitter is busy */
X! #define DF_DO_HANGUP		0x0400	/* delayed hangup request */
X  
X  /* description of the NS16X50 Asychronous Communications Element */
X  
SHAR_EOF
if test 9422 -ne "`wc -c < 'fas205.p02'`"
then
	echo shar: "error transmitting 'fas205.p02'" '(should have been 9422 characters)'
fi
fi
exit 0
#	End of shell archive
-- 
Uwe Doering   |  Domain   : gemini at netmbx.UUCP
Berlin        |---------------------------------------------------------------
West Germany  |  Bangpath : ...!uunet!unido!tmpmbx!netmbx!gemini



More information about the Alt.sources mailing list