Subject: Chris Torek: Re: new TIODCDTIMESTAMP patch
To: None <tech-kern@NetBSD.ORG>
From: Chris G. Demetriou <cgd@pa.dec.com>
List: tech-kern
Date: 04/21/1998 15:28:03
------- Forwarded Message

	id AA24288; Tue, 21 Apr 1998 15:27:20 -0700
	by mail2.digital.com (8.8.8/8.8.8/WV1.0d) with ESMTP id PAA32588
	for <cgd@pa.dec.com>; Tue, 21 Apr 1998 15:27:20 -0700 (PDT)
	by services.BSDI.COM (8.8.7/8.8.8) with ESMTP id QAA29526;
	Tue, 21 Apr 1998 16:26:02 -0600 (MDT)
Date: Tue, 21 Apr 1998 16:26:02 -0600 (MDT)
From: Chris Torek <torek@BSDI.COM>
Message-Id: <199804212226.QAA18903@forge.BSDI.COM>
To: cgd@pa.dec.com, jonathan@DSG.Stanford.EDU
Subject: Re: new TIODCDTIMESTAMP patch

>But we still need the `bad' bits used by the existing code.
 [and]
>I think more general timestamping (and management) is a separate isssue.

I am not quite sure what you meant by "separate issue".  There is
a pretty clear migration path, I think, that shows they are entwined:

 1) ask the NTP folks to add:

	#ifdef TIOCSTSTAMP
	{
		/*
		 * Set the type of time-stamp to be used
		 * on a serial port:
		 *	none (turn it off)
		 *	DCD (leading or trailing edge)
		 *	PERCHAR
		 *	etc.
		 * At the moment we only handle DCD_LEADINGEDGE,
		 * but those folks with trailing-edge DCD and
		 * other methods are encouraged to add them and
		 * configuration code to set them.
		 */
		int how = TSTAMP_DCD_LEADINGEDGE;
		if (ioctl(fd, TIOCSTSTAMP, &how)) ... error ...
	}
	#endif

    The ifdef ensures that this code only applies to new systems that
    support the new "set time stamp mode" ioctl.  The ioctl will
    fail if that kind of time-stamping is not supported in that
    kernel (hence one is free to invent all kinds of crazy stamp
    modes without actually being forced to implement them in every
    system).

    There probably should be a TIOCGTSTAMP as well, to get the
    current time-stamping mode.  In a kernel with no tstamp modes,
    it would always be TSTAMP_NONE (== 0 most likely).  GTSTAMP
    might well be in common code (while STSTAMP gets examined by
    the driver -- maybe DCD is not available on particular serial
    ports).

 2) Write the appropriate kernel code, with a compat hack so that
    "get last stamp" has the side effect of going from "off" to
    DCD_LEADINGEDGE mode.  The compat hack can be removed when
    step 1 above has been in effect long enough.

You can forward this to tech-kern if you think there has not been
enough flamage about it already. :-)

Chris


------- End of Forwarded Message