Subject: scn.c and ncr.c enhancements.
To: Matthias Pfaller <leo@dachau.marco.de>
From: Ian Dall <Ian.Dall@dsto.defence.gov.au>
List: port-pc532
Date: 04/14/1997 08:45:55
I started using Phil's scn driver at 115.2 kBaud (with sc26c92
duarts) on my modem and began getting overruns again.

I did some more work on ncr.c. I reduced the read chunk size even
more, but I unrolled the loops so that the relatively expensive
ncr_ready() check is only done at the end of each block.  This didn't
solve my problem completely. I then had another look at scn.c. I
realized that I misunderstood the device. You don't need to turn off
the automatic control of RTS to be able to manually de-assert RTS. So,
now we have hardware control of RTS as well as flow control on the
ring buffer --- the best of bosth worlds. This actually simplifies the
code, since I got rid of the scn_soft_rts flag --- there is no longer
a trade off involved. I also enabled a bit of code Phil had put in
(but not tested?) to only interrupt when the fifo is 3/4 full (for the
sc26c92 only) and added some code of my own to completely fill the
transmit buffer. This leads to a dramatic reduction in interrupt
overhead. When receiving at 38.4kB sustained, the CPU spends about 90%
of its time in "system" with the 2681 duarts. With the 26c92 duarts,
and this new code, it drops to under 20%. (It could go even lower I am
sure if we could transfer more than 1 byte at a time up to the line
discipline layers.) On transmit the levels are lower, but the trend is
the same, dropping from about 15% CPU to 2% CPU in system state.

I can now talk at 115.2kBaud to my modem and haven't seen a single
fifo overrun yet in several days of use. (Of course, that is not
115.2kBaud sustained, but with compression I do get little bursts of
115.2kBaud).

BTW I have been using uuencode, as the lowest common denominator for
sending in stuff like this. An obvious alternative is to use a MIME
base64 attachment. Can everyone read mime these days, or is it beter
to stick with uuencode?

Here are the patches:

begin 644 pc532.diffs.gz
M'XL(`````````^U8;7/:2!+^+'Y%;U+G$@892;R;LS<.V`EU?MD"7'$NE5()
M:4"J"$D[(XQ]B>^W7\^,),#@D-T]ZNY#^"!&H^EGNGOZ;=KU)Q/0Z!R.CBJ,
M.A7VR"HV=;Q*[-2K9L4E]Y70H4<.O/2AH&G:+F)EY,WARJ9@ZF":QT;[6#?`
M:+>;A5*I]"*R<A6%<!93,&J@&\>U9D[UY@UHIMD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