summaryrefslogtreecommitdiffstats
path: root/sys/dev/ppbus/pps.c
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>1998-06-12 23:15:53 +0000
committerphk <phk@FreeBSD.org>1998-06-12 23:15:53 +0000
commit90b89a118c811a2a88c48b9f5da4b481c65425ec (patch)
tree4c3ed48257566fff1e49a18060045b7da10dd035 /sys/dev/ppbus/pps.c
parente30abc2a08346cbe0b1ae0b43667d1efc7544966 (diff)
downloadFreeBSD-src-90b89a118c811a2a88c48b9f5da4b481c65425ec.zip
FreeBSD-src-90b89a118c811a2a88c48b9f5da4b481c65425ec.tar.gz
Update to draft-mogul-pps-api-02.txt as submitted to IETF
Diffstat (limited to 'sys/dev/ppbus/pps.c')
-rw-r--r--sys/dev/ppbus/pps.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/sys/dev/ppbus/pps.c b/sys/dev/ppbus/pps.c
index 70274b3..74bcf0c 100644
--- a/sys/dev/ppbus/pps.c
+++ b/sys/dev/ppbus/pps.c
@@ -6,7 +6,12 @@
* this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
* ----------------------------------------------------------------------------
*
- * $Id: pps.c,v 1.5 1998/06/07 19:44:22 phk Exp $
+ * $Id: pps.c,v 1.6 1998/06/08 02:43:12 bde Exp $
+ *
+ * This driver implements a draft-mogul-pps-api-02.txt PPS source.
+ *
+ * The input pin is pin#10
+ * The echo output pin is pin#14
*
*/
@@ -39,7 +44,8 @@ static int ppscap =
PPS_CAPTUREASSERT |
PPS_HARDPPSONASSERT |
PPS_OFFSETASSERT |
- PPS_ECHOASSERT;
+ PPS_ECHOASSERT |
+ PPS_TSFMT_TSPEC;
static int npps;
@@ -152,10 +158,12 @@ ppsintr(int unit)
return;
if (sc->ppsparam.mode & PPS_ECHOASSERT)
ppb_wctr(&sc->pps_dev, IRQENABLE | AUTOFEED);
- timespecadd(&tc, &sc->ppsparam.assert_offset);
- if (tc.tv_nsec < 0) {
- tc.tv_sec--;
- tc.tv_nsec += 1000000000;
+ if (sc->ppsparam.mode & PPS_OFFSETASSERT) {
+ timespecadd(&tc, &sc->ppsparam.assert_offset);
+ if (tc.tv_nsec < 0) {
+ tc.tv_sec--;
+ tc.tv_nsec += 1000000000;
+ }
}
sc->ppsinfo.assert_timestamp = tc;
sc->ppsinfo.assert_sequence++;
@@ -196,6 +204,7 @@ ppsioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct proc *p)
case PPS_IOC_FETCH:
pi = (pps_info_t *)data;
*pi = sc->ppsinfo;
+ pi->current_mode = sc->ppsparam.mode;
return (0);
case PPS_IOC_WAIT:
return (EOPNOTSUPP);
OpenPOWER on IntegriCloud