154359SrobertoPARSE reference clock driver:
254359Sroberto
354359SrobertoThis directory contains the files making up the parser for
454359Srobertothe parse refclock driver. For reasonably sane clocks this refclock
554359Srobertodrivers allows a refclock implementation by just providing a
654359Srobertoconversion routine and the appropriate NTP parameters. Refclock
754359Srobertosupport can run as low a 3k code with the parse refclock driver.
854359Sroberto
954359SrobertoThe modules in here are designed to live in two worlds. In userlevel
1054359Srobertoas part of the xntp daemon and in kernel land as part of a STREAMS module
1154359Srobertoor, if someone gets to it, as part of a line discipline. Currently only
1254359SrobertoSunOS4.x/SunOS5.x STREAMS are supported (volunteers for other vendors like HP?).
1354359SrobertoThis structure means, that refclock_parse can work with or without kernel
1454359Srobertosupport. Kernelsupport increases accuracy tremendingly. The current restriction
1554359Srobertoof the parse driver is that it only supports SYSV type ttys and that kernel
1654359Srobertosupport is only available for Suns right now.
1754359Sroberto
1854359SrobertoThree kernel modules are part of this directory. These work only on
1954359SrobertoSunOS (SunOS4 and SunOS5).
2054359Sroberto
2154359Sroberto	SunOS4 (aka Solaris 1.x):
2254359Sroberto		parsestreams.loadable_module.o	- standard parse module for SunOS 4
2354359Sroberto
2454359Sroberto		Both modules can be loaded via modload <modulename>.
2554359Sroberto
2654359Sroberto	SunOS5 (aka Solaris 2.x):
2754359Sroberto		parse		- auto loadable streams module
2854359Sroberto
2954359Sroberto		To install just drop "parse" into /kernel/strmod and
3054359Sroberto		start the daemon (SunOS5 will do the rest).
3154359Sroberto
3254359SrobertoThe structure of the parse reference clock driver is as follows:
3354359Sroberto
34182007Sroberto	ntpd	- contains NTP implementation and calls a reference clock
3554359Sroberto		  127.127.8.x which is implemented by
36182007Sroberto	 	  refclock_parse.c
3754359Sroberto		  - which contains several refclock decriptions. These are
3854359Sroberto		    selected by the x part of the refclock address.
3954359Sroberto		    The lower two bits specify the device to use. Thus the
4054359Sroberto		    value (x % 4) determines the device to open
4154359Sroberto		    (/dev/refclock-0 - /dev/refclock-3).
4254359Sroberto
4354359Sroberto		    The kind of clock is selected by the mode parameter. This parameter
4454359Sroberto		    selects the clock type which deterimines how I/O is done,
4554359Sroberto		    the tty parameters and the NTP parameters.
4654359Sroberto
4754359Sroberto		    refclock_parse operates on an abstract reference clock
4854359Sroberto		    that delivers time stamps and stati. Offsets and sychron-
4954359Sroberto		    isation information is derived from this data and passed
5054359Sroberto		    on to refclock_receive of xntp which uses that data for
5154359Sroberto		    syncronisation.
5254359Sroberto
5354359Sroberto		    The abstract reference clock is generated by the parse*
5454359Sroberto		    routines. They parse the incoming data stream from the
5554359Sroberto		    clock and convert it to the appropriate time stamps.
5654359Sroberto		    The data is also mapped int the abstract clock states
5754359Sroberto		    	POWERUP - clock has no valid phase and time code
5854359Sroberto				  information
5954359Sroberto
6054359Sroberto			NOSYNC	- Time code is not confirmed, phase is probably
6154359Sroberto				  ok.
6254359Sroberto			SYNC	- Time code and phase are correct.
6354359Sroberto
6454359Sroberto		    A clock is trusted for a certain time (type parameter) when
6554359Sroberto		    it leaves the SYNC state. This is derived from the
6654359Sroberto		    observation that quite a few clocks can still generate good
6754359Sroberto		    time code information when losing contact to their
6854359Sroberto		    synchronisation source. When the clock does not reagain
6954359Sroberto		    synchronisation in that trust period it will be deemed
7054359Sroberto		    unsynchronised until it regains synchronisation. The same
7154359Sroberto		    will happen if xntp sees the clock unsynchronised at
7254359Sroberto		    startup.
7354359Sroberto
7454359Sroberto		    The upper bit of x specifies that all samples delivered
7554359Sroberto		    from the clock should be used to discipline the NTP
7654359Sroberto		    loopfilter. For clock with accurate once a second time
7754359Sroberto		    information this means big improvements for time keeping.
7854359Sroberto		    A prerequisite for passing on the time stamps to
7954359Sroberto		    the loopfilter is, that the clock is in synchronised state.
8054359Sroberto
8154359Sroberto	   parse.c  These are the general routines to parse the incoming data
8254359Sroberto		    stream. Usually these routines should not require
8354359Sroberto		    modification.
8454359Sroberto
8554359Sroberto	   clk_*.c  These files hole the conversion code for the time stamps
8654359Sroberto		    and the description how the time code can be parsed and
8754359Sroberto		    where the time stamps are to be taken.
8854359Sroberto		    If you want to add a new clock type this is the file
8954359Sroberto		    you need to write in addition to mention it in
9054359Sroberto		    parse_conf.c and setting up the NTP and TTY parameters
9154359Sroberto		    in refclock_parse.c.
9254359Sroberto
9354359SrobertoFurther information can be found in parse/README.parse and the various source
9454359Srobertofiles.
9554359Sroberto
9654359SrobertoFrank Kardel
97