Subject: Re: new serial driver
To: Scott Reynolds <scottr@og.org>
From: Bill Studenmund <wrstuden@loki.stanford.edu>
List: port-mac68k
Date: 07/12/1997 14:32:48
>  - Bill S.'s zs changes are under review by someone else; and

On that note, I'd like to ask whomever else is interested in testing
the new driver to try it. It has now passed all of my tests, and I
feel confident it will work. But testing's good.

The driver lives as a set of patches in
ftp://ftp.macbsd.com/private/wrstuden/zstty/

The files are:
cpu.h.diff
files.mac68k.diff
machdep.c.diff
pmap_bootstrap.c.diff
pppd.diff
stty.diff
termios.h.diff
z8530tty.c.diff
z8530var.h
zs.c

All the .diff files are patches which should be aplicable by cd'ing
to the relevant directory, and then doing a patch < the.patch.file.

cpu.h.diff, termios.h.diff, and z8530var.h touch files in
arch/mac68k/include.  cpu.h.diff and termios.h.diff are patchs, and
z8530var.h replaces the existing file. The new termios.h will need to be
copied to /usr/include/sys/termios.h.

zs.c goes in arch/mac68k/dev. All the z8530* files in arch/mac68k/dev
should be deleted as we no longer use our own copies.

z8530tty.c.diff fixes a minor bug in dev/ic/z8530tty.c's handling
of "raw" default tty's.

files.mac68k.diff patches the main configuration file in arch/mac68k/conf.
You will need to re-run config on your kernel after this patch, and
a make depend would not be bad either.

machdep.c.diff and pmap_bootstrap.c.diff change files in arch/mac68k/mac68k.
Note: the machdep.c patch also has Hauke Fath's IWM lkm support changes
in it. They are fine as is, but aren't needed. If they bother you,
just delete all the IWM lines after patching.

The big changes with this driver are:

We use the Machine-Independant 8530 SCC driver. We thus share code with
the sun and sun3 (I think) ports.

The one drawback to the sharing is that we revert to the "proper"
procedure of resetting the serial port defaults on each open. So you
won't be able to do a "stty -f /dev/tty0X _some settings_" and have
them stick.

FOLKS USING MY GhostScript PACKAGE WILL NEED TO CHANGE THEIR PRINTCAP
ENTRIES. The trick of setting the tty in /etc/rc.local will no longer
work. That's ok as we can now set all the settings in /etc/printcap
now. :-)  I'll try to get a new printcap up soon.

The other change is that we now support a thing called DTRCTS
handshaking.  When this atribute is set, we can do full flow control;
we can ask the other side to stop sending for a while. When we do this,
we loose the ability to force a modem to hang up the phone.

To truly make use of this new feature, we need to change parts of the
userland source.

stty.diff contains a set of patches to the stty utility to let it
set and notice cdtrcts. You need to have src/bin/stty/* for this
part. Also src/bin/Makefile.inc is a good thing to have to make
the install script work right.

pppd.diff contains a set of patches to make pppd use the new flow
control mode. It even includes documentation (well, a start)!

I was able to ftp between my Mac IIsi and a 586 (w/ FIFO UART's)
at 57600 without a single overrun. I gto > 10kB/s transfer
rates (compression was on). However I DID bring the machine to its
knees. I was running dt, and it would take about 3 seconds for a
screen to change when I hit Command-#. Also, the clock lost a lot
of time (like minutes in tens of minutes of transfer).

Your milage may vary. You might get fifo overruns, especially if
you have other stuff going on. We can do nothing about them. These
patches, though, should cure ring overruns.

Note: make sure that your serial cable actually connects DTR to CTS
on the other side. If you're going mac-to-mac, a printer cable should
be fine. But if you're going mac to DB-25, be careful. None of the
three mac-to-modem cables I tried made this connection. I had to do
it manually with a breakout box. Also, make sure the other side won't
care about DTR (or DCD for a different computer) dropping. Lowering
DTR will make a modem hang up, and DCD not being there will make
pppd normally quit.

Here are the pppd lines I used:

i386 running NetBSD (do this one first):

pppd tty01 local passive crtscts 10.0.0.6:10.0.0.2

mac:

pppd tty01 57600 cdtrcts local

Make sure you don't have any options.tty0X files lying around
in /etc/ppp/ as they might get sourced and possably will give you 
weird results.

Take care,

Bill