From: gsm@mendelson.com (Geoffrey S. Mendelson)
Subject: Patch to HS driver for 16550AF Uarts
Organization: Mendelson Computer Consulting
Date: Sun, 12 Apr 92 19:42:32 GMT

Enclosed is a patch to the hs driver for 16550AF or 16550AFN uarts. 
The diff was done with UNIX system 5 diff (the diff on my coherent
system is broken (HELP!!!)).

Testing Coherent uucp receiving with a direct connection from a Unix
system 5 system running Taylor uucp to a 8mhz 286 Coherent 3.1 system
with the latest uucp:

Using an interupt driven port with a 16450 uart:

     At 2400 baud no errors.  (approx 210 bytes per second).

     At 4800 baud 50% retry rate. 

     At 9600 baud 200% retry rate. (3 tries for each packet!)

            The highest transfer rate was with 2400 baud!!

Using the new driver with a polled port with a 16550AFN uart:

9600 baud NO ERRORS!!!! effective transfer rate aprroximately 360 bps.

Due to copyright restrictions, I may not post the entire driver. The 
patch requires the Driver Kit 1.0. 

Geoff

---------------------------  diff follows  --------------------------------
8a9,22
>  *
>  *	Patched to support a 16650AF (buffered Uart).
>  *	4/92  Geoffrey S. Mendelson
>  *
>  *	Notes: 
>  * 
>  *		I changed the defaults for the number of ports and their addresses.
>  *
>  *  	I check the UART type by turning on buffering. If I determine that
>  *		the UART is not a 16550AF or 16550AFN, I turn buffering off. This 
>  *		is to prevent buffering with 16550 uarts. 16550 uarts will buffer, but
>  *		not correctly.
>  *
>  *
54c68,77
< int	HSNUM = 4;
---
> /*	
> *	int	HSNUM = 4;
> *	struct port_config HS_PORTS[MAX_HSNUM] = {
> *	{ 0x2F8, B9600 },
> *	{ 0x3E8, B9600 },
> *	{ 0x2E8, B9600 },
> *	{ 0x2F0, B9600 }
> *	};
> */
> int	HSNUM = 5;
56d78
< 	{ 0x2F8, B9600 },
59c81,83
< 	{ 0x2F0, B9600 }
---
> 	{ 0x2F0, B9600 },
> 	{ 0x3E0, B9600 },
> 	{ 0x2E0, B9600 }
61a86,87
> int	buffer_ok[MAX_HSNUM];
> 
193a220,255
> /*
> *		Determine type of UART:
> *			16540, 8250 don't buffer.
> *			16550 buffers, but it does not work right.
> *			16550AF, 16550AFN buffer and it does work.
> */
> 		buffer_ok[i] = 0;			
> 		outb(port+IIR, 7);
> 		b = inb(port+IIR);
> 		b = b & 0xc0;
> 		switch(b)
> 			{
> 			case(0):
> 				printf("hs2: port %d (base address %x) has an 8250/16450 uart.\n",
> 					i,HS_PORTS[i].addr);
> 				outb(port+IIR, 0);  /* Turn off buffering (NOP) */
> 				break;
> 			case(0x80):
> 				printf(
> 			"hs2: port %d (base address %x) has an 16550 uart  (bad buffer).\n",
> 					i,HS_PORTS[i].addr);
> 				outb(port+IIR, 0);  /* Turn off buffering */
> 				break;
> 			case(0xc0):
> 				printf(
> 			"hs2: port %d (base address %x) has an 16550AF(N) uart. (good buffer)\n",
> 					i,HS_PORTS[i].addr);
> 				buffer_ok[i] = 1;
> 				outb(port+IIR, 0xc7);  /* Interupt only if buffer is full */
> 				break;
> 			default:
> 		printf("hs2: port %d (base address %x) has an unknown uart rc %2x.\n",
> 					i,HS_PORTS[i].addr,b);
> 				outb(port+IIR, 0);  /* Turn off buffering  */
> 				break;
> 			}			
450,451c512,513
< 		if ( b & LS_RxRDY ) {
< 
---
> 		while  ( (b = inb ( PORT+LSR)) & LS_RxRDY ) 
> 			{
454,455c516,517
< 			if ( tp->t_flags & T_CARR ) {
< 
---
> 			if ( tp->t_flags & T_CARR ) 
> 				{
458a521
> 				}
460d522
< 		}
-------------------------------End of diff --------------------------------
-- 
Copyright (C) 1992, Geoffrey S. Mendelson.              All Rights Reserved.
Except for usenet followups, may not be reproduced without permsission. 
----------------------------------------------------------------------------
|                   |  Computer Software Consulting    |                   |
----------------------------------------------------------------------------
Geoffrey S. Mendelson                    Israel
geoffrey@mendelson.com                          or
mwcbbs!mailgsm!geoffrey                            Bust!
(215) 242-8712                          Looks like August now :-(