diff options
author | wollman <wollman@FreeBSD.org> | 1994-04-03 19:50:51 +0000 |
---|---|---|
committer | wollman <wollman@FreeBSD.org> | 1994-04-03 19:50:51 +0000 |
commit | d9768fd9dbb9ffb082896c373f5e78f968079f68 (patch) | |
tree | 0d7894f93da990a4f019d7653a8b2ed558ab9850 /usr.sbin/xntpd/parse | |
parent | 394ee3bae890775188c4812249fc996cb7cc0abe (diff) | |
download | FreeBSD-src-d9768fd9dbb9ffb082896c373f5e78f968079f68.zip FreeBSD-src-d9768fd9dbb9ffb082896c373f5e78f968079f68.tar.gz |
xntp 3.3p from Delaware
Diffstat (limited to 'usr.sbin/xntpd/parse')
-rw-r--r-- | usr.sbin/xntpd/parse/Makefile.kernel | 2 | ||||
-rw-r--r-- | usr.sbin/xntpd/parse/README.new_clocks | 212 | ||||
-rw-r--r-- | usr.sbin/xntpd/parse/README.parse_clocks | 263 | ||||
-rw-r--r-- | usr.sbin/xntpd/parse/clk_dcf7000.c | 7 | ||||
-rw-r--r-- | usr.sbin/xntpd/parse/clk_meinberg.c | 22 | ||||
-rw-r--r-- | usr.sbin/xntpd/parse/clk_rawdcf.c | 16 | ||||
-rw-r--r-- | usr.sbin/xntpd/parse/clk_schmid.c | 12 | ||||
-rw-r--r-- | usr.sbin/xntpd/parse/clk_trimble.c | 5 | ||||
-rw-r--r-- | usr.sbin/xntpd/parse/parse.c | 20 | ||||
-rw-r--r-- | usr.sbin/xntpd/parse/parse_conf.c | 7 | ||||
-rw-r--r-- | usr.sbin/xntpd/parse/parsesolaris.c | 35 | ||||
-rw-r--r-- | usr.sbin/xntpd/parse/parsestreams.c | 78 | ||||
-rw-r--r-- | usr.sbin/xntpd/parse/util/parsetest.c | 18 | ||||
-rw-r--r-- | usr.sbin/xntpd/parse/util/testdcf.c | 4 |
14 files changed, 648 insertions, 53 deletions
diff --git a/usr.sbin/xntpd/parse/Makefile.kernel b/usr.sbin/xntpd/parse/Makefile.kernel index 95de494..aceb0a5 100644 --- a/usr.sbin/xntpd/parse/Makefile.kernel +++ b/usr.sbin/xntpd/parse/Makefile.kernel @@ -40,7 +40,7 @@ mparsestreams.o.$(KARCH): parsestreams.c microtime.o ../lib/libntp.a libparse_ke rm -f parsestreams.o parsestreams.o: parsestreams.o.$(KARCH) - @echo "--- You may load parsestreams.o.$(KARCH) via 'modload parsestreams.o.$(KARCH)' into the kernel" + @echo "--- You may load parsestreams.o.$(KARCH) via 'modload parsestreams.o' (put in e.g. /sys/<karch>/OBJ) into the kernel" parsestreams.o.$(KARCH): parsestreams.c ../lib/libntp.a libparse_kernel.a ../include/parse.h ../include/sys/parsestreams.h cc -c $(DEFS) -I../include parsestreams.c diff --git a/usr.sbin/xntpd/parse/README.new_clocks b/usr.sbin/xntpd/parse/README.new_clocks new file mode 100644 index 0000000..8fdd7cb --- /dev/null +++ b/usr.sbin/xntpd/parse/README.new_clocks @@ -0,0 +1,212 @@ +Here is an attempt to sketch out what you need to do in order to +add another clock to the parse driver: + +Prerequisites: +- Does the system you want the clock connect to have + termio.h or termios.h ? (You need that for the parse driver) + +What to do: + +Make a conversion module (parse/clk_*.c) + +- What ist the time code format ? + - find year, month, day, hour, minute, second, status (synchronised or + not), possibly time zone information (you need to give the offset to UTC) + You will have to convert the data from a string into a struct clocktime: + struct clocktime /* clock time broken up from time code */ + { + LONG day; + LONG month; + LONG year; + LONG hour; + LONG minute; + LONG second; + LONG usecond; + LONG utcoffset; /* in seconds */ + time_t utcoffset; /* true utc time instead of date/time */ + LONG flags; /* current clock status */ + }; + + Conversion is usually simple and straight forward. For the flags following + values can be OR'ed together: + + PARSEB_ANNOUNCE switch time zone warning (informational only) + PARSEB_POWERUP no synchronisation - clock confused (must set then) + PARSEB_NOSYNC timecode currently not confirmed (must set then) + usually on reception error when there is still a + chance the the generated time is still ok. + + PARSEB_DST DST in effect (informational only) + PARSEB_UTC timecode contains UTC time (informational only) + PARSEB_LEAPADD LEAP addition warning (prior to leap happening - must set when imminent) + also used for time code that do not encode the + direction (as this is currently the default). + PARSEB_LEAPDEL LEAP deletion warning (prior to leap happening - must set when imminent) + PARSEB_ALTERNATE backup transmitter (informational only) + PARSEB_POSITION geographic position available (informational only) + PARSEB_LEAPSECOND actual leap second (this time code is the leap + second - informational only) + + These are feature flags denoting items that are supported by the clock: + PARSEB_S_LEAP supports LEAP - might set PARSEB_LEAP + PARSEB_S_ANTENNA supports ANTENNA - might set PARSEB_ALTERNATE + PARSEB_S_PPS supports PPS time stamping + PARSEB_S_POSITION supports position information (GPS) + + If the utctime field is non zero this value will be take as + time code value. This allows for conversion routines that + already have the utc time value. The utctime field gives the seconds + since Jan 1st 1970, 0:00:00. The useconds field gives the respective + usec value. The fields for date and time (down to second resolution) + will be ignored. + + Conversion is done in the cvt_* routine in parse/clk_*.c files. look in + them for examples. The basic structure is: + + struct clockformat <yourclock>_format = { + lots of fields for you to fill out (see below) + }; + + static cvt_<yourclock>() + ... + { + if (<I do not recognize my time code>) { + return CVT_NONE; + } else { + if (<conversion into clockformat is ok>) { + <set all necessary flags>; + return CVT_OK; + } else { + return CVT_FAIL|CVT_BADFMT; + } + } + + The struct clockformat is the interface to the rest of the parse + driver - it holds all information necessary for finding the + clock message and doing the appropriate time stamping. + +struct clockformat +{ + unsigned LONG (*convert)(); + /* conversion routine - your routine - cvt_<yourclock> */ + void (*syncevt)(); + /* routine for handling RS232 sync events (time stamps) - usually sync_simple */ + unsigned LONG (*syncpps)(); + /* PPS input routine - usually pps_simple */ + unsigned LONG (*synth)(); + /* time code synthesizer - usually not used - (LONG (*)())0 */ + void *data; + /* local parameters - any parameters/data/configuration info your conversion + routine might need */ + char *name; + /* clock format name - Name of the time code */ + unsigned short length; + /* maximum length of data packet for your clock format */ + unsigned LONG flags; + /* information for the parser what to look for */ + struct timeval timeout; + /* buffer restart after timeout (us) - some clocks preceede new data by + a longer period of silence - unsually not used */ + unsigned char startsym; + /* start symbol - character at the beginning of the clock data */ + unsigned char endsym; + /* end symbol - character at the end of the clock data */ + unsigned char syncsym; + /* sync symbol - character that is "on time" - where the time stamp should be taken */ +}; + + The flags: + F_START use startsym to find the beginning of the clock data + F_END use endsym to find the end of the clock data + SYNC_TIMEOUT packet restart after timeout in timeout field + SYNC_START packet start is sync event (time stamp at paket start) + SYNC_END packet end is sync event (time stamp at paket end) + SYNC_CHAR special character (syncsym) is sync event + SYNC_ONE PPS synchronize on 'ONE' transition + SYNC_ZERO PPS synchronize on 'ZERO' transition + SYNC_SYNTHESIZE generate intermediate time stamps (very special case!) + CVT_FIXEDONLY convert only in fixed configuration - (data format not + suitable for auto-configuration) + + + The above should have given you some hints on how to build a clk_*.c + file with the time code conversion. See the examples and pick a clock + closest to yours and tweak the code to match your clock. + + In order to make your clk_*.c file usable a reference to the clockformat + structure must be put into parse_conf.c. + +TTY setup and initialisation/configuration will be done in +xntpd/refclock_parse.c + +- Find out the exact tty settings for your clock (baud rate, parity, + stop bits, character size, ...) and note them in terms of + termio*.h c_cflag macros. + +- in xntpd/refclock_parse.c fill out a new the struct clockinfo element + (that allocates a new "IP" address - see comments) + (see all the other clocks for example) + struct clockinfo + { + U_LONG cl_flags; /* operation flags (io modes) */ + PARSE_F_NOPOLLONLY always do async io - read whenever input comes + PARSE_F_POLLONLY never do async io - only read when expecting data + PARSE_F_PPSPPS use loopfilter PPS code (CIOGETEV) + PARSE_F_PPSONSECOND PPS pulses are on second + usually flags stay 0 as they are used only for special setups + + void (*cl_poll)(); /* active poll routine */ + The routine to call when the clock needs data sent to it in order to + get a time code from the clock (e.g. Trimble clock) + int (*cl_init)(); /* active poll init routine */ + The routine to call for very special initializations. + void (*cl_end)(); /* active poll end routine */ + The routine to call to undo any special initialisation (free memory/timers) + void *cl_data; /* local data area for "poll" mechanism */ + local data for polling routines + u_fp cl_rootdelay; /* rootdelay */ + NTP rottdelay estimate (usually 0) + U_LONG cl_basedelay; /* current offset - unsigned l_fp fractional par + time (fraction) by which the RS232 time code is delayed from the actual time. + t */ + U_LONG cl_ppsdelay; /* current PPS offset - unsigned l_fp fractional + time (fraction) by which the PPS time stamp is delayed (usually 0) + part */ + char *cl_id; /* ID code (usually "DCF") */ + Refclock id - (max 4 chars) + char *cl_description; /* device name */ + Name of this device. + char *cl_format; /* fixed format */ + If the data format cann not ne detected automatically this is the name + as in clk_*.c clockformat. + u_char cl_type; /* clock type (ntp control) */ + Type if clock as in clock status word (ntp control messages) - usually 0 + U_LONG cl_maxunsync; /* time to trust oscillator after loosing synch + */ + seconds a clock can be trusted after loosing synchronisation. + + U_LONG cl_cflag; /* terminal io flags */ + U_LONG cl_iflag; /* terminal io flags */ + U_LONG cl_oflag; /* terminal io flags */ + U_LONG cl_lflag; /* terminal io flags */ + termio*.h tty modes. + } clockinfo[] = { + ...,<other clocks>,... + { < your parameters> }, + }; + + +Well, this is very sketchy, i know. But I hope it helps a little bit. +The best way is to look which clock comes closest to your and tweak that +code. +Two sorts of clocks are used with parse. Clocks that automatically send +their time code (once a second) do not need entries in the poll routines because +they send the data all the time. The second sort are the clocks that need a +command sent to them in order to reply with a time code (like the Trimble +clock). + +For questions: kardel@informatik.uni-erlangen.de. Please include +an exact description on how your clock works. (initialisation, +TTY modes, strings to be sent to it, responses received from the clock). + +Frank Kardel diff --git a/usr.sbin/xntpd/parse/README.parse_clocks b/usr.sbin/xntpd/parse/README.parse_clocks new file mode 100644 index 0000000..cf8d77e --- /dev/null +++ b/usr.sbin/xntpd/parse/README.parse_clocks @@ -0,0 +1,263 @@ +The parse driver currently supports several clocks with different +query mechanisms. In order for you to find a sample that might be +similar to a clock you might want to integrate into parse i'll sum +up the major features of the clocks (this information is distributed +in the parse/clk_*.c and xntpd/refclock_parse.c files). + +--- + Meinberg: 127.127.8. 0- 3 (PZF535TCXO) + 127.127.8. 4- 7 (PZF535OCXO) + 127.127.8. 8-11 (DCFUA31) + 127.127.8.28-31 (GPS166) + Meinberg: start=<STX>, end=<ETX>, sync on start + pattern="\2D: . . ;T: ;U: . . ; \3" + pattern="\2 . . ; ; : : ; \3" + pattern="\2 . . ; ; : : ; : ; ; . . " + + Meinberg is a german manufacturer of time code receivers. Those clocks + have a pretty common output format in the stock version. In order to + support NTP Meinberg was so kind to produce some special versions of + the firmware for the use with NTP. So, if you are going to use a + Meinberg clock please ask whether there is a special Uni Erlangen + version. + + General characteristics: + Meinberg clocks primarily output pulse per second and a describing + ASCII string. This string can be produced in two modes. either upon + the reception of a question mark or every second. NTP uses the latter + mechanism. The DCF77 variants have a pretty good relationship between + RS232 time code and the PPS signal while the GPS receiver has no fixed + timeing between the datagram and the pulse (you need to use PPS with + GPS!) on DCF77 you might get away without the PPS signal. + + The preferred tty setting for Meinberg is: + CFLAG (B9600|CS7|PARENB|CREAD|HUPCL) + IFLAG (IGNBRK|IGNPAR|ISTRIP) + OFLAG 0 + LFLAG 0 + + The clock is run at datagram once per second. + Stock dataformat is: + + <STX>D:<dd>.<mm>.<yy>;T:<w>;U:<hh>:<mm>:<ss>;<S><F><D><A><ETX> + pos: 0 00 00 0 00 0 11 111 1 111 12 2 22 2 22 2 2 2 3 3 3 + 1 23 45 6 78 9 01 234 5 678 90 1 23 4 56 7 8 9 0 1 2 + + <STX> = '\002' ASCII start of text + <ETX> = '\003' ASCII end of text + <dd>,<mm>,<yy> = day, month, year(2 digits!!) + <w> = day of week (sunday= 0) + <hh>,<mm>,<ss> = hour, minute, second + <S> = '#' if never synced since powerup else ' ' for DCF U/A 31 + '#' if not PZF sychronisation available else ' ' for PZF 535 + <F> = '*' if time comes from internal quartz else ' ' + <D> = 'S' if daylight saving time is active else ' ' + <A> = '!' during the hour preceeding an daylight saving time + start/end change + + For the university of Erlangen a special format was implemented to support + LEAP announcement and anouncement of alternate antenna. + + Version for UNI-ERLANGEN Software is: PZFUERL V4.6 (Meinberg) + + The use of this software release (or higher) is *ABSOLUTELY* + recommended (ask for PZFUERL version as some minor HW fixes have + been introduced) due to the LEAP second support and UTC indication. + The standard timecode does not indicate when the timecode is in + UTC (by front panel configuration) thus we have no chance to find + the correct utc offset. For the standard format do not ever use + UTC display as this is not detectable in the time code !!! + + <STX><dd>.<mm>.<yy>; <w>; <hh>:<mm>:<ss>; <U><S><F><D><A><L><R><ETX> + pos: 0 00 0 00 0 00 11 1 11 11 1 11 2 22 22 2 2 2 2 2 3 3 3 + 1 23 4 56 7 89 01 2 34 56 7 89 0 12 34 5 6 7 8 9 0 1 2 + <STX> = '\002' ASCII start of text + <ETX> = '\003' ASCII end of text + <dd>,<mm>,<yy> = day, month, year(2 digits!!) + <w> = day of week (sunday= 0) + <hh>,<mm>,<ss> = hour, minute, second + <U> = 'U' UTC time display + <S> = '#' if never synced since powerup else ' ' for DCF U/A 31 + '#' if not PZF sychronisation available else ' ' for PZF 535 + <F> = '*' if time comes from internal quartz else ' ' + <D> = 'S' if daylight saving time is active else ' ' + <A> = '!' during the hour preceeding an daylight saving time + start/end change + <L> = 'A' LEAP second announcement + <R> = 'R' alternate antenna + + Meinberg GPS166 receiver + + You must get the Uni-Erlangen firmware for the GPS receiver support + to work to full satisfaction ! + + <STX><dd>.<mm>.<yy>; <w>; <hh>:<mm>:<ss>; <+/-><00:00>; <U><S><F><D><A><L><R><L>; <position...><ETX> + * + 000000000111111111122222222223333333333444444444455555555556666666 + 123456789012345678901234567890123456789012345678901234567890123456 + \x0209.07.93; 5; 08:48:26; +00:00; ; 49.5736N 11.0280E 373m\x03 + * + + <STX> = '\002' ASCII start of text + <ETX> = '\003' ASCII end of text + <dd>,<mm>,<yy> = day, month, year(2 digits!!) + <w> = day of week (sunday= 0) + <hh>,<mm>,<ss> = hour, minute, second + <+/->,<00:00> = offset to UTC + <S> = '#' if never synced since powerup else ' ' for DCF U/A 31 + '#' if not PZF sychronisation available else ' ' for PZF 535 + <U> = 'U' UTC time display + <F> = '*' if time comes from internal quartz else ' ' + <D> = 'S' if daylight saving time is active else ' ' + <A> = '!' during the hour preceeding an daylight saving time + start/end change + <L> = 'A' LEAP second announcement + <R> = 'R' alternate antenna (reminiscent of PZF535) usually ' ' + <L> = 'L' on 23:59:60 + + + For the Meinberg parse look into clock_meinberg.c + +--- + RAWDCF: 127.127.8.20-23 (Conrad receiver module - delay 210ms) + 127.127.8.24-27 (FAU receiver - delay 258ms) + RAWDCF: end=TIMEOUT>1.5s, sync each char (any char),generate psuedo time + codes, fixed format + + direct DCF77 code input + In Europe it is relatively easy/cheap the receive the german time code + transmitter DCF77. The simplest version to process its signal is to + feed the 100/200ms pulse of the demodulated AM signal via a level + converter to an RS232 port at 50Baud. parse/clk_rawdcf.c holds all + necessary decoding logic for the time code which is transmitted each + minute for one minute. A bit of the time code is sent once a second. + + The preferred tty setting is: + CFLAG (B50|CS8|CREAD|CLOCAL) + IFLAG 0 + OFLAG 0 + LFLAG 0 + + DCF77 raw time code + + From "Zur Zeit", Physikalisch-Technische Bundesanstalt (PTB), Braunschweig + und Berlin, Maerz 1989 + + Timecode transmission: + AM: + time marks are send every second except for the second before the + next minute mark + time marks consist of a reduction of transmitter power to 25% + of the nominal level + the falling edge is the time indication (on time) + time marks of a 100ms duration constitute a logical 0 + time marks of a 200ms duration constitute a logical 1 + FM: + see the spec. (basically a (non-)inverted psuedo random phase shift) + + Encoding: + Second Contents + 0 - 10 AM: free, FM: 0 + 11 - 14 free + 15 R - alternate antenna + 16 A1 - expect zone change (1 hour before) + 17 - 18 Z1,Z2 - time zone + 0 0 illegal + 0 1 MEZ (MET) + 1 0 MESZ (MED, MET DST) + 1 1 illegal + 19 A2 - expect leap insertion/deletion (1 hour before) + 20 S - start of time code (1) + 21 - 24 M1 - BCD (lsb first) Minutes + 25 - 27 M10 - BCD (lsb first) 10 Minutes + 28 P1 - Minute Parity (even) + 29 - 32 H1 - BCD (lsb first) Hours + 33 - 34 H10 - BCD (lsb first) 10 Hours + 35 P2 - Hour Parity (even) + 36 - 39 D1 - BCD (lsb first) Days + 40 - 41 D10 - BCD (lsb first) 10 Days + 42 - 44 DW - BCD (lsb first) day of week (1: Monday -> 7: Sunday) + 45 - 49 MO - BCD (lsb first) Month + 50 MO0 - 10 Months + 51 - 53 Y1 - BCD (lsb first) Years + 54 - 57 Y10 - BCD (lsb first) 10 Years + 58 P3 - Date Parity (even) + 59 - usually missing (minute indication), except for leap insertion + +--- + Schmid clock: 127.127.8.16-19 + Schmid clock: needs poll, binary input, end='\xFC', sync start + + The Schmid clock is a DCF77 receiver that sends a binary + time code at the reception of a flag byte. The contents + if the flag byte determined the time code format. The + binary time code is delimited by the byte 0xFC. + + TTY setup is: + CFLAG (B1200|CS8|CREAD|CLOCAL) + IFLAG 0 + OFLAG 0 + LFLAG 0 + + The command to Schmid's DCF77 clock is a single byte; each bit + allows the user to select some part of the time string, as follows (the + output for the lsb is sent first). + + Bit 0: time in MEZ, 4 bytes *binary, not BCD*; hh.mm.ss.tenths + Bit 1: date 3 bytes *binary, not BCD: dd.mm.yy + Bit 2: week day, 1 byte (unused here) + Bit 3: time zone, 1 byte, 0=MET, 1=MEST. (unused here) + Bit 4: clock status, 1 byte, 0=time invalid, + 1=time from crystal backup, + 3=time from DCF77 + Bit 5: transmitter status, 1 byte, + bit 0: backup antenna + bit 1: time zone change within 1h + bit 3,2: TZ 01=MEST, 10=MET + bit 4: leap second will be + added within one hour + bits 5-7: Zero + Bit 6: time in backup mode, units of 5 minutes (unused here) + + +--- + Trimble SV6: 127.127.8.32-35 + Trimble SV6: needs poll, ascii timecode, start='>', end='<', + query='>QTM<', eol='<' + + Trimble SV6 is a GPS receiver with PPS output. It needs to be polled. + It also need a special tty mode setup (EOL='<'). + + TTY setup is: + CFLAG (B4800|CS8|CREAD) + IFLAG (BRKINT|IGNPAR|ISTRIP|ICRNL|IXON) + OFLAG (OPOST|ONLCR) + LFLAG (ICANON|ECHOK) + + Special flags are: + PARSE_F_PPSPPS - use CIOGETEV for PPS time stamping + PARSE_F_PPSONSECOND - the time code is not related to + the PPS pulse (so use the time code + only for the second epoch) + + Timecode + 0000000000111111111122222222223333333 / char + 0123456789012345678901234567890123456 \ posn + >RTMhhmmssdddDDMMYYYYoodnnvrrrrr;*xx< Actual + ----33445566600112222BB7__-_____--99- Parse + >RTM 1 ;* <", Check + +--- + ELV DCF7000: 127.127.8.12-15 + ELV DCF7000: end='\r', pattern=" - - - - - - - \r" + + The ELV DCF7000 is a cheap DCF77 receiver sending each second + a time code (though not very precise!) delimited by '`r' + + Timecode + YY-MM-DD-HH-MM-SS-FF\r + + FF&0x1 - DST + FF&0x2 - DST switch warning + FF&0x4 - unsynchronised + diff --git a/usr.sbin/xntpd/parse/clk_dcf7000.c b/usr.sbin/xntpd/parse/clk_dcf7000.c index 5655d0a..8b55e2f 100644 --- a/usr.sbin/xntpd/parse/clk_dcf7000.c +++ b/usr.sbin/xntpd/parse/clk_dcf7000.c @@ -1,8 +1,8 @@ #if defined(REFCLOCK) && (defined(PARSE) || defined(PARSEPPS)) && defined(CLOCK_DCF7000) /* - * /src/NTP/REPOSITORY/v3/parse/clk_dcf7000.c,v 3.10 1994/01/25 19:05:07 kardel Exp + * /src/NTP/REPOSITORY/v3/parse/clk_dcf7000.c,v 3.11 1994/02/02 17:45:14 kardel Exp * - * clk_dcf7000.c,v 3.10 1994/01/25 19:05:07 kardel Exp + * clk_dcf7000.c,v 3.11 1994/02/02 17:45:14 kardel Exp * * ELV DCF7000 module * @@ -121,6 +121,9 @@ cvt_dcf7000(buffer, size, format, clock) * History: * * clk_dcf7000.c,v + * Revision 3.11 1994/02/02 17:45:14 kardel + * rcs ids fixed + * * Revision 3.6 1993/10/09 15:01:27 kardel * file structure unified * diff --git a/usr.sbin/xntpd/parse/clk_meinberg.c b/usr.sbin/xntpd/parse/clk_meinberg.c index b08dfec..69f88b9 100644 --- a/usr.sbin/xntpd/parse/clk_meinberg.c +++ b/usr.sbin/xntpd/parse/clk_meinberg.c @@ -1,8 +1,8 @@ #if defined(REFCLOCK) && (defined(PARSE) || defined(PARSEPPS)) && defined(CLOCK_MEINBERG) /* - * /src/NTP/REPOSITORY/v3/parse/clk_meinberg.c,v 3.11 1994/01/25 19:05:10 kardel Exp + * /src/NTP/REPOSITORY/v3/parse/clk_meinberg.c,v 3.14 1994/02/20 13:04:37 kardel Exp * - * clk_meinberg.c,v 3.11 1994/01/25 19:05:10 kardel Exp + * clk_meinberg.c,v 3.14 1994/02/20 13:04:37 kardel Exp * * Meinberg clock support * @@ -284,8 +284,13 @@ cvt_meinberg(buffer, size, format, clock) clock->flags |= PARSEB_S_LEAP; clock->flags |= PARSEB_S_ANTENNA; + /* + * DCF77 does not encode the direction - + * so we take the current default - + * earth slowing down + */ if (f[4] == 'A') - clock->flags |= PARSEB_LEAP; + clock->flags |= PARSEB_LEAPADD; if (f[5] == 'R') clock->flags |= PARSEB_ALTERNATE; @@ -394,9 +399,12 @@ cvt_mgps(buffer, size, format, clock) /* * oncoming leap second + * data format does not (yet) specify whether + * to add or to delete a second - thus we + * pick the current default */ if (f[5] == 'A') - clock->flags |= PARSEB_LEAP; + clock->flags |= PARSEB_LEAPADD; /* * this is the leap second @@ -414,6 +422,12 @@ cvt_mgps(buffer, size, format, clock) * History: * * clk_meinberg.c,v + * Revision 3.14 1994/02/20 13:04:37 kardel + * parse add/delete second support + * + * Revision 3.13 1994/02/02 17:45:21 kardel + * rcs ids fixed + * * Revision 3.11 1994/01/25 19:05:10 kardel * 94/01/23 reconcilation * diff --git a/usr.sbin/xntpd/parse/clk_rawdcf.c b/usr.sbin/xntpd/parse/clk_rawdcf.c index 2fd3cae..6b02031 100644 --- a/usr.sbin/xntpd/parse/clk_rawdcf.c +++ b/usr.sbin/xntpd/parse/clk_rawdcf.c @@ -1,8 +1,8 @@ #if defined(REFCLOCK) && (defined(PARSE) || defined(PARSEPPS)) && defined(CLOCK_RAWDCF) /* - * /src/NTP/REPOSITORY/v3/parse/clk_rawdcf.c,v 3.9 1994/01/25 19:05:12 kardel Exp + * /src/NTP/REPOSITORY/v3/parse/clk_rawdcf.c,v 3.13 1994/03/10 19:00:43 kardel Exp * - * clk_rawdcf.c,v 3.9 1994/01/25 19:05:12 kardel Exp + * clk_rawdcf.c,v 3.13 1994/03/10 19:00:43 kardel Exp * * Raw DCF77 pulse clock support * @@ -245,6 +245,7 @@ static unsigned LONG convert_rawdcf(buffer, size, dcfparam, clock) parseprintf(DD_RAWDCF,("parse: convert_rawdcf: parity check passed\n")); clock->flags = PARSEB_S_ANTENNA|PARSEB_S_LEAP; + clock->utctime= 0; clock->usecond= 0; clock->second = 0; clock->minute = ext_bf(buffer, DCF_M10, dcfparam->zerobits); @@ -278,7 +279,7 @@ static unsigned LONG convert_rawdcf(buffer, size, dcfparam, clock) clock->flags |= PARSEB_ANNOUNCE; if (ext_bf(buffer, DCF_A2, dcfparam->zerobits)) - clock->flags |= PARSEB_LEAP; + clock->flags |= PARSEB_LEAPADD; /* default: DCF77 data format deficiency */ if (ext_bf(buffer, DCF_R, dcfparam->zerobits)) clock->flags |= PARSEB_ALTERNATE; @@ -529,6 +530,15 @@ static unsigned LONG snt_rawdcf(parseio, ptime) * History: * * clk_rawdcf.c,v + * Revision 3.13 1994/03/10 19:00:43 kardel + * clear utctime field to avoid confusion on synthesize time stamps + * + * Revision 3.12 1994/02/20 13:04:39 kardel + * parse add/delete second support + * + * Revision 3.11 1994/02/02 17:45:23 kardel + * rcs ids fixed + * * Revision 3.9 1994/01/25 19:05:12 kardel * 94/01/23 reconcilation * diff --git a/usr.sbin/xntpd/parse/clk_schmid.c b/usr.sbin/xntpd/parse/clk_schmid.c index a8ec8a6..8129474 100644 --- a/usr.sbin/xntpd/parse/clk_schmid.c +++ b/usr.sbin/xntpd/parse/clk_schmid.c @@ -1,8 +1,8 @@ #if defined(REFCLOCK) && (defined(PARSE) || defined(PARSEPPS)) && defined(CLOCK_SCHMID) /* - * /src/NTP/REPOSITORY/v3/parse/clk_schmid.c,v 3.10 1994/01/25 19:05:15 kardel Exp + * /src/NTP/REPOSITORY/v3/parse/clk_schmid.c,v 3.13 1994/02/20 13:04:41 kardel Exp * - * clk_schmid.c,v 3.10 1994/01/25 19:05:15 kardel Exp + * clk_schmid.c,v 3.13 1994/02/20 13:04:41 kardel Exp * * Schmid clock support * @@ -152,7 +152,7 @@ cvt_schmid(buffer, size, format, clock) if (buffer[8] & WS_LEAP) { - clock->flags |= PARSEB_LEAP; + clock->flags |= PARSEB_LEAPADD; /* default: DCF77 data format deficiency */ } } @@ -168,6 +168,12 @@ cvt_schmid(buffer, size, format, clock) * History: * * clk_schmid.c,v + * Revision 3.13 1994/02/20 13:04:41 kardel + * parse add/delete second support + * + * Revision 3.12 1994/02/02 17:45:25 kardel + * rcs ids fixed + * * Revision 3.10 1994/01/25 19:05:15 kardel * 94/01/23 reconcilation * diff --git a/usr.sbin/xntpd/parse/clk_trimble.c b/usr.sbin/xntpd/parse/clk_trimble.c index bfbf1e6..187aed5 100644 --- a/usr.sbin/xntpd/parse/clk_trimble.c +++ b/usr.sbin/xntpd/parse/clk_trimble.c @@ -1,6 +1,6 @@ #if defined(REFCLOCK) && (defined(PARSE) || defined(PARSEPPS)) && defined(CLOCK_TRIMSV6) /* - * /src/NTP/REPOSITORY/v3/parse/clk_trimble.c,v 3.7 1994/01/25 19:05:17 kardel Exp + * /src/NTP/REPOSITORY/v3/parse/clk_trimble.c,v 3.9 1994/02/02 17:45:27 kardel Exp * * Trimble SV6 clock support */ @@ -106,6 +106,9 @@ cvt_trimsv6(buffer, size, format, clock) * History: * * clk_trimble.c,v + * Revision 3.9 1994/02/02 17:45:27 kardel + * rcs ids fixed + * * Revision 3.7 1994/01/25 19:05:17 kardel * 94/01/23 reconcilation * diff --git a/usr.sbin/xntpd/parse/parse.c b/usr.sbin/xntpd/parse/parse.c index ed5fd9a..dd70f1d 100644 --- a/usr.sbin/xntpd/parse/parse.c +++ b/usr.sbin/xntpd/parse/parse.c @@ -1,8 +1,8 @@ #if defined(REFCLOCK) && (defined(PARSE) || defined(PARSEPPS)) /* - * /src/NTP/REPOSITORY/v3/parse/parse.c,v 3.19 1994/01/25 19:05:20 kardel Exp + * /src/NTP/REPOSITORY/v3/parse/parse.c,v 3.22 1994/02/25 12:34:49 kardel Exp * - * parse.c,v 3.19 1994/01/25 19:05:20 kardel Exp + * parse.c,v 3.22 1994/02/25 12:34:49 kardel Exp * * Parser module for reference clock * @@ -556,6 +556,9 @@ parse_to_unixtime(clock, cvtrtc) register int i; time_t t; + if (clock->utctime) + return clock->utctime; /* if the conversion routine gets it right away - why not */ + if (clock->year < 100) clock->year += 1900; @@ -628,6 +631,9 @@ parse_to_unixtime(clock, cvtrtc) t += clock->utcoffset; /* warp to UTC */ /* done */ + + clock->utctime = t; /* documentray only */ + return t; } @@ -890,6 +896,8 @@ timepacket(parseio) if (parseio->parse_flags & PARSE_FIXED_FMT) { + clock.utctime = 0; + switch ((cvtrtc = clockformats[format]->convert ? clockformats[format]->convert(parseio->parse_data, parseio->parse_index, clockformats[format]->data, &clock) : CVT_NONE) & CVT_MASK) { case CVT_FAIL: @@ -941,6 +949,8 @@ timepacket(parseio) { do { + clock.utctime = 0; + switch ((cvtrtc = (clockformats[format]->convert && !(clockformats[format]->flags & CVT_FIXEDONLY)) ? clockformats[format]->convert(parseio->parse_data, parseio->parse_index, clockformats[format]->data, &clock) : CVT_NONE) & CVT_MASK) @@ -1148,6 +1158,12 @@ parse_setcs(dct, parse) * History: * * parse.c,v + * Revision 3.22 1994/02/25 12:34:49 kardel + * allow for converter generated utc times + * + * Revision 3.21 1994/02/02 17:45:30 kardel + * rcs ids fixed + * * Revision 3.19 1994/01/25 19:05:20 kardel * 94/01/23 reconcilation * diff --git a/usr.sbin/xntpd/parse/parse_conf.c b/usr.sbin/xntpd/parse/parse_conf.c index 0281c9d..238dd12 100644 --- a/usr.sbin/xntpd/parse/parse_conf.c +++ b/usr.sbin/xntpd/parse/parse_conf.c @@ -1,8 +1,8 @@ #if defined(REFCLOCK) && (defined(PARSE) || defined(PARSEPPS)) /* - * /src/NTP/REPOSITORY/v3/parse/parse_conf.c,v 3.13 1994/01/25 19:05:23 kardel Exp + * /src/NTP/REPOSITORY/v3/parse/parse_conf.c,v 3.15 1994/02/02 17:45:32 kardel Exp * - * parse_conf.c,v 3.13 1994/01/25 19:05:23 kardel Exp + * parse_conf.c,v 3.15 1994/02/02 17:45:32 kardel Exp * * Parser configuration module for reference clocks * @@ -81,6 +81,9 @@ unsigned short nformats = sizeof(clockformats) / sizeof(clockformats[0]) - 1; * History: * * parse_conf.c,v + * Revision 3.15 1994/02/02 17:45:32 kardel + * rcs ids fixed + * * Revision 3.13 1994/01/25 19:05:23 kardel * 94/01/23 reconcilation * diff --git a/usr.sbin/xntpd/parse/parsesolaris.c b/usr.sbin/xntpd/parse/parsesolaris.c index 09fac28..23bc252 100644 --- a/usr.sbin/xntpd/parse/parsesolaris.c +++ b/usr.sbin/xntpd/parse/parsesolaris.c @@ -1,7 +1,7 @@ /* - * /src/NTP/REPOSITORY/v3/parse/parsesolaris.c,v 3.9 1994/01/25 19:05:26 kardel Exp + * /src/NTP/REPOSITORY/v3/parse/parsesolaris.c,v 3.15 1994/02/15 22:20:51 kardel Exp * - * parsesolaris.c,v 3.9 1994/01/25 19:05:26 kardel Exp + * parsesolaris.c,v 3.15 1994/02/15 22:20:51 kardel Exp * * STREAMS module for reference clocks * (SunOS5.x - not fully tested - buyer beware ! - OS KILLERS may still be @@ -19,7 +19,7 @@ */ #ifndef lint -static char rcsid[] = "parsesolaris.c,v 3.9 1994/01/25 19:05:26 kardel Exp"; +static char rcsid[] = "parsesolaris.c,v 3.15 1994/02/15 22:20:51 kardel Exp"; #endif /* @@ -65,7 +65,7 @@ static struct fmodsw fmod_templ = { "parse", /* module name */ &parseinfo, /* module information */ - 0, /* not clean yet */ + D_NEW|D_MP|D_MTQPAIR, /* exclusive for q pair */ /* lock ptr */ }; @@ -139,7 +139,7 @@ int Strcmp(s, t) /*ARGSUSED*/ int _init(void) { - static char revision[] = "3.9"; + static char revision[] = "3.15"; char *s, *S, *t; /* @@ -413,6 +413,8 @@ static int parseopen(queue_t *q, dev_t *dev, int flag, int sflag, cred_t *credp) parse->parse_ppsclockev.tv.tv_usec = 0; parse->parse_ppsclockev.serial = 0; + qprocson(q); + parseprintf(DD_OPEN,("parse: OPEN - initializing io subsystem q=%x\n", q)); if (!parse_ioinit(&parse->parse_io)) @@ -420,6 +422,8 @@ static int parseopen(queue_t *q, dev_t *dev, int flag, int sflag, cred_t *credp) /* * ok guys - beat it */ + qprocsoff(q); + kmem_free((caddr_t)parse, sizeof(parsestream_t)); parsebusy--; @@ -441,7 +445,7 @@ static int parseopen(queue_t *q, dev_t *dev, int flag, int sflag, cred_t *credp) */ if (!notice) { - printf("%s: Copyright (c) 1991-1993, Frank Kardel\n", modlstrmod.strmod_linkinfo); + printf("%s: Copyright (c) 1991-1994, Frank Kardel\n", modlstrmod.strmod_linkinfo); notice = 1; } @@ -449,7 +453,12 @@ static int parseopen(queue_t *q, dev_t *dev, int flag, int sflag, cred_t *credp) } else { + qprocsoff(q); + + kmem_free((caddr_t)parse, sizeof(parsestream_t)); + parsebusy--; + return EIO; } } @@ -462,6 +471,8 @@ static int parseclose(queue_t *q, int flags) parseprintf(DD_CLOSE,("parse: CLOSE\n")); + qprocsoff(q); + s = splhigh(); if (parse->parse_dqueue) @@ -1179,6 +1190,18 @@ static void zs_xsisr(struct zscom *zs) * History: * * parsesolaris.c,v + * Revision 3.15 1994/02/15 22:20:51 kardel + * rcsid fixed + * + * Revision 3.14 1994/02/15 22:06:04 kardel + * added qprocsx & flags for MT capability + * + * Revision 3.13 1994/02/13 19:16:47 kardel + * updated verbose Copyright message + * + * Revision 3.12 1994/02/02 17:45:35 kardel + * rcs ids fixed + * * Revision 3.9 1994/01/25 19:05:26 kardel * 94/01/23 reconcilation * diff --git a/usr.sbin/xntpd/parse/parsestreams.c b/usr.sbin/xntpd/parse/parsestreams.c index b371aed..45d2963 100644 --- a/usr.sbin/xntpd/parse/parsestreams.c +++ b/usr.sbin/xntpd/parse/parsestreams.c @@ -1,7 +1,7 @@ /* - * /src/NTP/REPOSITORY/v3/parse/parsestreams.c,v 3.12 1994/01/25 19:05:30 kardel Exp + * /src/NTP/REPOSITORY/v3/parse/parsestreams.c,v 3.19 1994/02/24 16:33:54 kardel Exp * - * parsestreams.c,v 3.12 1994/01/25 19:05:30 kardel Exp + * parsestreams.c,v 3.19 1994/02/24 16:33:54 kardel Exp * * STREAMS module for reference clocks * (SunOS4.x) @@ -16,7 +16,7 @@ */ #ifndef lint -static char rcsid[] = "parsestreams.c,v 3.12 1994/01/25 19:05:30 kardel Exp"; +static char rcsid[] = "parsestreams.c,v 3.19 1994/02/24 16:33:54 kardel Exp"; #endif #include "sys/types.h" @@ -195,7 +195,7 @@ int xxxinit(fc, vdp, vdi, vds) } else { - static char revision[] = "3.12"; + static char revision[] = "3.19"; char *s, *S, *t; strncpy(ifm->f_name, mname, FMNAMESZ); @@ -527,7 +527,7 @@ static int parseopen(q, dev, flag, sflag) */ if (!notice) { - printf("%s: Copyright (c) 1991-1993, Frank Kardel\n", parsesync_vd.Drv_name); + printf("%s: Copyright (c) 1991-1994, Frank Kardel\n", parsesync_vd.Drv_name); notice = 1; } @@ -535,6 +535,8 @@ static int parseopen(q, dev, flag, sflag) } else { + kmem_free((caddr_t)parse, sizeof(parsestream_t)); + #ifdef VDDRV parsebusy--; #endif @@ -1074,6 +1076,11 @@ static void close_zs_linemon(q, my_q) #define MAXDEPTH 50 /* maximum allowed stream crawl */ +#ifdef PPS_SYNC +extern hardpps(); +extern struct timeval time; +#endif + /* * take external status interrupt (only CD interests us) */ @@ -1085,15 +1092,18 @@ static void zs_xsisr(zs) register queue_t *q; register unsigned char zsstatus; register int loopcheck; - register unsigned char cdstate; register char *dname; +#ifdef PPS_SYNC + register int s; + register long usec; +#endif /* * pick up current state */ zsstatus = zsaddr->zscc_control; - if (za->za_rr0 ^ (cdstate = zsstatus & ZSRR0_CD)) + if ((za->za_rr0 ^ zsstatus) & (ZSRR0_CD|ZSRR0_SYNC)) { timestamp_t cdevent; register int status; @@ -1101,26 +1111,44 @@ static void zs_xsisr(zs) /* * CONDITIONAL external measurement support */ - SET_LED(cdstate); /* + SET_LED(zsstatus & (ZSRR0_CD|ZSRR0_SYNC)); /* * inconsistent with upper SET_LED, but this * is for oscilloscope business anyway and we * are just interested in edge delays in the * lower us range */ - +#ifdef PPS_SYNC + s = splclock(); + usec = time.tv_usec; +#endif /* * time stamp */ uniqtime(&cdevent.tv); - - TIMEVAL_USADD(&cdevent.tv, xsdelay); - - q = za->za_ttycommon.t_readq; + +#ifdef PPS_SYNC + splx(s); +#endif /* * logical state */ - status = cd_invert ? cdstate == 0 : cdstate != 0; + status = cd_invert ? (zsstatus & (ZSRR0_CD|ZSRR0_SYNC)) == 0 : (zsstatus & (ZSRR0_CD|ZSRR0_SYNC)) != 0; + +#ifdef PPS_SYNC + if (status) + { + usec = cdevent.tv.tv_usec - usec; + if (usec < 0) + usec += 1000000; + + hardpps(&cdevent.tv, usec); + } +#endif + + TIMEVAL_USADD(&cdevent.tv, xsdelay); + + q = za->za_ttycommon.t_readq; /* * ok - now the hard part - find ourself @@ -1177,10 +1205,10 @@ static void zs_xsisr(zs) /* * only pretend that CD has been handled */ - za->za_rr0 = za->za_rr0 & ~ZSRR0_CD | zsstatus & ZSRR0_CD; + za->za_rr0 = za->za_rr0 & ~(ZSRR0_CD|ZSRR0_SYNC) | zsstatus & (ZSRR0_CD|ZSRR0_SYNC); ZSDELAY(2); - if (!((za->za_rr0 ^ zsstatus) & ~ZSRR0_CD)) + if (!((za->za_rr0 ^ zsstatus) & ~(ZSRR0_CD|ZSRR0_SYNC))) { /* * all done - kill status indication and return @@ -1258,6 +1286,24 @@ static void zs_xsisr(zs) * History: * * parsestreams.c,v + * Revision 3.19 1994/02/24 16:33:54 kardel + * CD events can also be posted on sync flag + * + * Revision 3.18 1994/02/24 14:12:58 kardel + * initial PPS_SYNC support version + * + * Revision 3.17 1994/02/20 15:18:02 kardel + * rcs id cleanup + * + * Revision 3.16 1994/02/15 22:39:50 kardel + * memory leak on open failure closed + * + * Revision 3.15 1994/02/13 19:16:50 kardel + * updated verbose Copyright message + * + * Revision 3.14 1994/02/02 17:45:38 kardel + * rcs ids fixed + * * Revision 3.12 1994/01/25 19:05:30 kardel * 94/01/23 reconcilation * diff --git a/usr.sbin/xntpd/parse/util/parsetest.c b/usr.sbin/xntpd/parse/util/parsetest.c index 9028b4c..21e4128 100644 --- a/usr.sbin/xntpd/parse/util/parsetest.c +++ b/usr.sbin/xntpd/parse/util/parsetest.c @@ -1,7 +1,7 @@ /* - * /src/NTP/REPOSITORY/v3/kernel/parsetest.c,v 3.4 1993/03/17 17:16:57 kardel Exp + * /src/NTP/REPOSITORY/v3/parse/util/parsetest.c,v 3.13 1994/02/20 13:04:46 kardel Exp * - * parsetest.c,v 3.10 1994/01/23 17:22:18 kardel Exp + * parsetest.c,v 3.13 1994/02/20 13:04:46 kardel Exp * * Copyright (c) 1989,1990,1991,1992,1993,1994 * Frank Kardel Friedrich-Alexander Universitaet Erlangen-Nuernberg @@ -11,15 +11,11 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * * parsetest.c,v - * Revision 3.4 1993/03/17 17:16:57 kardel - * DEC OSF/1 ALPHA Integration - 930314 + * Revision 3.13 1994/02/20 13:04:46 kardel + * parse add/delete second support * - * Revision 3.3 1993/01/18 09:24:33 kardel - * updated copyright conditions in conjunction with - * conditions set up in the COPYRIGHT file - * - * Revision 3.2 1993/01/17 13:43:00 kardel - * 1993 initial update + * Revision 3.12 1994/02/02 17:45:51 kardel + * rcs ids fixed * */ @@ -198,7 +194,7 @@ main(argc, argv) parsetime_t parsetime; struct strioctl strioc; - printf("parsetest.c,v 3.10 1994/01/23 17:22:18 kardel Exp\n"); + printf("parsetest.c,v 3.13 1994/02/20 13:04:46 kardel Exp\n"); while (ioctl(fd, I_POP, 0) == 0) ; diff --git a/usr.sbin/xntpd/parse/util/testdcf.c b/usr.sbin/xntpd/parse/util/testdcf.c index ebdfd2f..560ab27 100644 --- a/usr.sbin/xntpd/parse/util/testdcf.c +++ b/usr.sbin/xntpd/parse/util/testdcf.c @@ -1,7 +1,7 @@ /* - * /src/NTP/REPOSITORY/v3/parse/util/testdcf.c,v 3.9 1994/01/25 19:05:45 kardel Exp + * /src/NTP/REPOSITORY/v3/parse/util/testdcf.c,v 3.11 1994/02/02 17:45:55 kardel Exp * - * testdcf.c,v 3.9 1994/01/25 19:05:45 kardel Exp + * testdcf.c,v 3.11 1994/02/02 17:45:55 kardel Exp * * simple DCF77 100/200ms pulse test program (via 50Baud serial line) * |