This directory contains code for two line disciplines which may
work with BSD-style terminal drivers.  While I'll try to cover
installation details for the more useful one here as best I can,
you really should know what you are doing before attempting to
put one of these in your kernel since the details seem to vary
from BSD variant to BSD variant.

Tty_clk.c contains a generic clock support line discipline.
The terminal driver is actually run in raw mode, giving you an
eight bit data path.  Instead of delivering the data
character-by-character, however, the line discipline collects
characters until one of two magic characters (your current erase
and kill characters.  Don't throw up) is received.  A timestamp
is then taken (by calling microtime()), inserted in the input
buffer after the magic character, and the whole mess made available
for input by the application.  Both select() and SIGIO are supported
by the discipline.

Tty_chu.c is a special purpose line discipline for receiving
the CHU time code.  It understands enough about the format of the
code CHU transmits to filter out errors, and delivers an entire
ten character code group to the application all at once, including
a timestamp for each character.  The structure the code group is
delivered in is defined in chudefs.h.  Note that this line discipline
is old and could use some rewriting for better portability.  Please
drop me a line if you are interested in using this.

To install the clock line discipline, do something like the following:

(1) Copy tty_clk.c into /sys/sys

(2) Edit /sys/sys/tty_conf.c.  You will want to include some facsimile
    of the following lines:

#include "clk.h"
#if NCLK > 0
int	clkopen(), clkclose(), clkwrite(), clkinput(), clkioctl();
#endif

#if NCLK > 0
	{ clkopen, clkclose, ttread, clkwrite, clkioctl,
	  clkinput, nodev, nulldev, ttstart, nullmodem,	/* 10- CLKLDISC */
	  ttselect },
#else
	{ nodev, nodev, nodev, nodev, nodev,
	  nodev, nodev, nodev, nodev, nodev,
	  nodev					    },
#endif

    In Ultrix 4.2a and 4.3 the file to edit is /sys/data/tty_conf_data.c.
    The lines should be

#if NCLK > 0
	clkopen, clkclose, ttread, clkwrite, clkioctl,          /* 10 */
	clkinput, nodev, nulldev, ttstart, nulldev,
#else
	nodev, nodev, nodev, nodev, nodev,
	nodev, nodev, nodev, nodev, nodev,
#endif

    Note that if your kernel doesn't include the ??select() entry in
    the structure (i.e. there are only 10 entry points in the structure)
    just leave it out.  Also note that the number you give the line
    discipline (10 in my kernel) will be specific to your kernel and
    will depend on what is in there already. The entries sould be in
    order with no missing space; that is, if there are only seven
    disciplines already defined and you want to use 10 for good reason,
    you should define a dummy 9th entry like this

	nodev, nodev, nodev, nodev, nodev,                      /* 9 */
	nodev, nodev, nodev, nodev, nodev,

(3) Edit /sys/h/ioctl.h and include a line (somewhere near where other
    line disciplines are defined) like:

#define	CLKLDISC	10		/* clock line discipline */

    The `10' should match what you used in /sys/sys/tty_conf.c.

(4) Edit /sys/conf/files and add a line which looks like:

sys/tty_clk.c		optional clk

(5) Edit the configuration file for the machine you want to use
    the clock line discipline on to include the following:

pseudo-device	clk 4

(6) Run config, then make clean, then make depend, then make vmunix.
    Then reboot the new kernel.
