1 1.1 kardel PARSE reference clock driver: 2 1.1 kardel 3 1.1 kardel This directory contains the files making up the parser for 4 1.1 kardel the parse refclock driver. For reasonably sane clocks this refclock 5 1.1 kardel drivers allows a refclock implementation by just providing a 6 1.1 kardel conversion routine and the appropriate NTP parameters. Refclock 7 1.1 kardel support can run as low a 3k code with the parse refclock driver. 8 1.1 kardel 9 1.1 kardel The modules in here are designed to live in two worlds. In userlevel 10 1.1 kardel as part of the xntp daemon and in kernel land as part of a STREAMS module 11 1.1 kardel or, if someone gets to it, as part of a line discipline. Currently only 12 1.1 kardel SunOS4.x/SunOS5.x STREAMS are supported (volunteers for other vendors like HP?). 13 1.1 kardel This structure means, that refclock_parse can work with or without kernel 14 1.1 kardel support. Kernelsupport increases accuracy tremendingly. The current restriction 15 1.1 kardel of the parse driver is that it only supports SYSV type ttys and that kernel 16 1.1 kardel support is only available for Suns right now. 17 1.1 kardel 18 1.1 kardel Three kernel modules are part of this directory. These work only on 19 1.1 kardel SunOS (SunOS4 and SunOS5). 20 1.1 kardel 21 1.1 kardel SunOS4 (aka Solaris 1.x): 22 1.1 kardel parsestreams.loadable_module.o - standard parse module for SunOS 4 23 1.1 kardel 24 1.1 kardel Both modules can be loaded via modload <modulename>. 25 1.1 kardel 26 1.1 kardel SunOS5 (aka Solaris 2.x): 27 1.1 kardel parse - auto loadable streams module 28 1.1 kardel 29 1.1 kardel To install just drop "parse" into /kernel/strmod and 30 1.1 kardel start the daemon (SunOS5 will do the rest). 31 1.1 kardel 32 1.1 kardel The structure of the parse reference clock driver is as follows: 33 1.1 kardel 34 1.1 kardel ntpd - contains NTP implementation and calls a reference clock 35 1.1 kardel 127.127.8.x which is implemented by 36 1.1 kardel refclock_parse.c 37 1.1 kardel - which contains several refclock decriptions. These are 38 1.1 kardel selected by the x part of the refclock address. 39 1.1 kardel The lower two bits specify the device to use. Thus the 40 1.1 kardel value (x % 4) determines the device to open 41 1.1 kardel (/dev/refclock-0 - /dev/refclock-3). 42 1.1 kardel 43 1.1 kardel The kind of clock is selected by the mode parameter. This parameter 44 1.1 kardel selects the clock type which deterimines how I/O is done, 45 1.1 kardel the tty parameters and the NTP parameters. 46 1.1 kardel 47 1.1 kardel refclock_parse operates on an abstract reference clock 48 1.1 kardel that delivers time stamps and stati. Offsets and sychron- 49 1.1 kardel isation information is derived from this data and passed 50 1.1 kardel on to refclock_receive of xntp which uses that data for 51 1.1 kardel syncronisation. 52 1.1 kardel 53 1.1 kardel The abstract reference clock is generated by the parse* 54 1.1 kardel routines. They parse the incoming data stream from the 55 1.1 kardel clock and convert it to the appropriate time stamps. 56 1.1 kardel The data is also mapped int the abstract clock states 57 1.1 kardel POWERUP - clock has no valid phase and time code 58 1.1 kardel information 59 1.1 kardel 60 1.1 kardel NOSYNC - Time code is not confirmed, phase is probably 61 1.1 kardel ok. 62 1.1 kardel SYNC - Time code and phase are correct. 63 1.1 kardel 64 1.1 kardel A clock is trusted for a certain time (type parameter) when 65 1.1 kardel it leaves the SYNC state. This is derived from the 66 1.1 kardel observation that quite a few clocks can still generate good 67 1.1 kardel time code information when losing contact to their 68 1.1 kardel synchronisation source. When the clock does not reagain 69 1.1 kardel synchronisation in that trust period it will be deemed 70 1.1 kardel unsynchronised until it regains synchronisation. The same 71 1.1 kardel will happen if xntp sees the clock unsynchronised at 72 1.1 kardel startup. 73 1.1 kardel 74 1.1 kardel The upper bit of x specifies that all samples delivered 75 1.1 kardel from the clock should be used to discipline the NTP 76 1.1 kardel loopfilter. For clock with accurate once a second time 77 1.1 kardel information this means big improvements for time keeping. 78 1.1 kardel A prerequisite for passing on the time stamps to 79 1.1 kardel the loopfilter is, that the clock is in synchronised state. 80 1.1 kardel 81 1.1 kardel parse.c These are the general routines to parse the incoming data 82 1.1 kardel stream. Usually these routines should not require 83 1.1 kardel modification. 84 1.1 kardel 85 1.1 kardel clk_*.c These files hole the conversion code for the time stamps 86 1.1 kardel and the description how the time code can be parsed and 87 1.1 kardel where the time stamps are to be taken. 88 1.1 kardel If you want to add a new clock type this is the file 89 1.1 kardel you need to write in addition to mention it in 90 1.1 kardel parse_conf.c and setting up the NTP and TTY parameters 91 1.1 kardel in refclock_parse.c. 92 1.1 kardel 93 1.1 kardel Further information can be found in parse/README.parse and the various source 94 1.1 kardel files. 95 1.1 kardel 96 1.1 kardel Frank Kardel 97