Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 7 Sep 1998 08:37:52 +1000
From:      Peter Jeremy <peter.jeremy@auss2.alcatel.com.au>
To:        freebsd-stable@FreeBSD.ORG
Cc:        bm@malepartus.de
Subject:   Re: kernel PPS line discipline for NTP
Message-ID:  <98Sep7.083732est.40332@border.alcanet.com.au>

next in thread | raw e-mail | index | archive | help
Burkard Meyendriesch <bm@malepartus.de> writes:
>I'm trying to install a NTP pulse per second suport on my FreeBSD-2.2.7

>Can anybody of you give me a hint for installing a timestamp line
>discipline on FreeBSD?
There is an undocumented ioctl that will do almost what you want
(assuming your PPS signal is tied to DCD on a serial port):

	struct timeval tv;

	ioctl(fd, TIOCDCDTIMESTAMP, &tv);

This will enable the capture of, and report the time of the last
inactive -> active DCD edge on the serial port.  (There's also
TIOCTIMESTAMP, which timestamps received characters).

Note that the ppbus parallel port driver in -current includes similar
functionality.

The reason I say `almost' is that:
1) Since both the 16[45]50 and the code treat DCD transitions as a low
   priority, there will be a substantial amount of jitter on the
   timestamps.  On a 486DX2/50, interrupt latencies are typically
   ~12usec (peaking to ~50usec) for the clock interrupt.  The SIO
   interrupts are likely to be somewhat worse (because they are
   masked more frequently).  Once the interrupt is recognized, the
   DCD transition isn't noted until after any received characters
   are processed.   
2) The code does not include the hooks to call hardpps(), so the PPS
   signal can't be used to directly discipline the kernel PLL.

This may or may not be an issue for you.

I have patched sio.c on 2.2.6 to support a PPS signal,whilst
minimising the jitter within the sio interrupt handler and including a
call to hardpps().  The changed in 2.2.7 are fairly minor, so the
patch should apply fairly cleanly.  Let me know if you're interested.

I'm also looking at a solution to compensate for interrupt latencies,
but that will require additional hardware and a bi-directional
parallel port.

Peter
--
Peter Jeremy (VK2PJ)                    peter.jeremy@alcatel.com.au
Alcatel Australia Limited
41 Mandible St                          Phone: +61 2 9690 5019
ALEXANDRIA  NSW  2015                   Fax:   +61 2 9690 5247

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-stable" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?98Sep7.083732est.40332>