Subject: Yet more on PPS support
To: None <tech-kern@NetBSD.ORG>
From: Jonathan Stone <jonathan@DSG.Stanford.EDU>
List: tech-kern
Date: 04/28/1998 23:39:00
I've discussed the recent patches for PPS support with people from
FreeBSD, and the xntpd maintainers. Their preferred interface is
rather like ours, only different:
typedef u_int pps_seq_t; /* at least 32 bits */
typedef struct ppsinfo {
pps_seq_t sequence; /* event sequence # */
struct timespec timestamp; /* time of event */
int flags; /* flag bits */
} ppsinfo_t;
#define PPSGETTIME _IOR('t', 75, struct ppsinfo)
#define PPSSETMODE _IOW('t', 76, int)
#define PPSGETMODE _IOR('t', 77, int)
with PPS mode bits as follows:
#define PPSMODE_NONE 0x00
#define PPSMODE_ONASSERT 0x01
#define PPSMODE_ONCLEAR 0x02
#define PPSMODE_ONBOTH (PPSMODE_ONASSERT|PPSMODE_ONCLEAR)
#define PPSMODE_HARDPPS 0x04
This API is an Internet Draft (draft-mogul-pps-api-01.txt), and may be
widely deployed; I propose we adopt it, since its semantically very
extremely close to the one that was settled on here.
Poul Henning-Kamp pointed out that this API has problems with DCF77
receivers, where one needs both the timestamp of the PPS pulse and
also its width. (since higher-epoch times than the minute or second
epochs are encoded in the width of each of the PPS pulses in any given
minute, more or less.)
Also, PPSMODE_HARDPPS is used to explicitly enable hardpps() for
multi-clock configurations, something phk and I had noted as missing
in the earlier `NetBSD API'. It's not clear how PPSMODE_ONBOTH is
supposed to interact with PPSMODE_HARDPPS: it may change
Assuuming we go with this API, where should the struct and constants
be defined They're in the 't' group, which suggests <ttycom.h>, but
theyre' outside the TIOC namespace. I think struct ppsinfo doesn't
belong in ttycom.h: <sys/timex.h> seems more sensible.
(The draft API is silent on this point).
Or should I post the reworked code?
NB: version 4 of ntpd should support this API eventually, but for the
stable codebase (xntpd), TIOCDCDTIMESTAMP is still it.