From owner-freebsd-stable Sun Sep 6 15:38:08 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id PAA07776 for freebsd-stable-outgoing; Sun, 6 Sep 1998 15:38:08 -0700 (PDT) (envelope-from owner-freebsd-stable@FreeBSD.ORG) Received: from alcanet.com.au (border.alcanet.com.au [203.62.196.10]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id PAA07769 for ; Sun, 6 Sep 1998 15:38:06 -0700 (PDT) (envelope-from peter.jeremy@auss2.alcatel.com.au) Received: by border.alcanet.com.au id <40332>; Mon, 7 Sep 1998 08:37:32 +1000 Date: Mon, 7 Sep 1998 08:37:52 +1000 From: Peter Jeremy Subject: Re: kernel PPS line discipline for NTP To: freebsd-stable@FreeBSD.ORG Cc: bm@malepartus.de Message-Id: <98Sep7.083732est.40332@border.alcanet.com.au> Sender: owner-freebsd-stable@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Burkard Meyendriesch 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