diff options
| author | joerg <joerg@NetBSD.org> | 2008-01-20 18:09:03 +0000 |
|---|---|---|
| committer | joerg <joerg@NetBSD.org> | 2008-01-20 18:09:03 +0000 |
| commit | 3615cf77159918b7f0f329fe9bd331e3ebdced7d (patch) | |
| tree | 22973ad9165e64bd43f42f088fc6f91ebe013a06 /sys/dev/ppbus | |
| parent | eb444c6f8554c82b259e7c89caa6aa6b2f24aac7 (diff) | |
Now that __HAVE_TIMECOUNTER and __HAVE_GENERIC_TODR are invariants,
remove the conditionals and the code associated with the undef case.
Diffstat (limited to 'sys/dev/ppbus')
| -rw-r--r-- | sys/dev/ppbus/pps_ppbus.c | 91 |
1 files changed, 2 insertions, 89 deletions
diff --git a/sys/dev/ppbus/pps_ppbus.c b/sys/dev/ppbus/pps_ppbus.c index e19124d9ae0..f227e297e45 100644 --- a/sys/dev/ppbus/pps_ppbus.c +++ b/sys/dev/ppbus/pps_ppbus.c @@ -1,4 +1,4 @@ -/* $NetBSD: pps_ppbus.c,v 1.9 2007/03/04 06:02:28 christos Exp $ */ +/* $NetBSD: pps_ppbus.c,v 1.10 2008/01/20 18:09:11 joerg Exp $ */ /* * ported to timecounters by Frank Kardel 2006 @@ -29,7 +29,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: pps_ppbus.c,v 1.9 2007/03/04 06:02:28 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pps_ppbus.c,v 1.10 2008/01/20 18:09:11 joerg Exp $"); #include "opt_ntp.h" @@ -49,15 +49,7 @@ struct pps_softc { struct ppbus_device_softc pps_dev; struct device *ppbus; int busy; -#ifdef __HAVE_TIMECOUNTER struct pps_state pps_state; /* pps state */ -#else /* !__HAVE_TIMECOUNTER */ - pps_info_t ppsinfo; - pps_params_t ppsparam; -#ifdef PPS_SYNC - int hardpps; -#endif -#endif /* !__HAVE_TIMECOUNTER */ }; static int pps_probe(struct device *, struct cfdata *, void *); @@ -76,10 +68,6 @@ const struct cdevsw pps_cdevsw = { static void ppsintr(void *arg); -#ifndef __HAVE_TIMECOUNTER -static int ppscap = PPS_TSFMT_TSPEC | PPS_CAPTUREASSERT | PPS_OFFSETASSERT; -#endif - static int pps_probe(struct device *parent, struct cfdata *match, void *aux) { @@ -133,11 +121,9 @@ ppsopen(dev_t dev, int flags, int fmt, struct lwp *l) ppbus_set_mode(sc->ppbus, PPBUS_PS2, 0); ppbus_wctr(sc->ppbus, IRQENABLE | PCD | nINIT | SELECTIN); -#ifdef __HAVE_TIMECOUNTER memset((void *)&sc->pps_state, 0, sizeof(sc->pps_state)); sc->pps_state.ppscap = PPS_CAPTUREASSERT; pps_init(&sc->pps_state); -#endif /* __HAVE_TIMECOUNTER */ sc->busy = 1; return (0); @@ -150,14 +136,7 @@ ppsclose(dev_t dev, int flags, int fmt, struct lwp *l) struct device *ppbus = sc->ppbus; sc->busy = 0; -#ifdef __HAVE_TIMECOUNTER sc->pps_state.ppsparam.mode = 0; -#else /* !__HAVE_TIMECOUNTER */ - sc->ppsparam.mode = 0; -#ifdef PPS_SYNC - sc->hardpps = 0; -#endif -#endif /* __HAVE_TIMECOUNTER */ ppbus_wdtr(ppbus, 0); ppbus_wctr(ppbus, 0); @@ -173,17 +152,12 @@ ppsintr(void *arg) { struct pps_softc *sc = arg; struct device *ppbus = sc->ppbus; -#ifndef __HAVE_TIMECOUNTER - struct timeval tv; -#else /* __HAVE_TIMECOUNTER */ pps_capture(&sc->pps_state); -#endif /* __HAVE_TIMECOUNTER */ if (!(ppbus_rstr(ppbus) & nACK)) return; -#ifdef __HAVE_TIMECOUNTER if (sc->pps_state.ppsparam.mode & PPS_ECHOASSERT) ppbus_wctr(ppbus, IRQENABLE | AUTOFEED); @@ -191,21 +165,6 @@ ppsintr(void *arg) if (sc->pps_state.ppsparam.mode & PPS_ECHOASSERT) ppbus_wctr(ppbus, IRQENABLE); -#else /* !__HAVE_TIMECOUNTER */ - microtime(&tv); - TIMEVAL_TO_TIMESPEC(&tv, &sc->ppsinfo.assert_timestamp); - if (sc->ppsparam.mode & PPS_OFFSETASSERT) { - timespecadd(&sc->ppsinfo.assert_timestamp, - &sc->ppsparam.assert_offset, - &sc->ppsinfo.assert_timestamp); - } -#ifdef PPS_SYNC - if (sc->hardpps) - hardpps(&tv, tv.tv_usec); -#endif - sc->ppsinfo.assert_sequence++; - sc->ppsinfo.current_mode = sc->ppsparam.mode; -#endif /* !__HAVE_TIMECOUNTER */ } static int @@ -215,7 +174,6 @@ ppsioctl(dev_t dev, u_long cmd, void *data, int flags, struct lwp *l) int error = 0; switch (cmd) { -#ifdef __HAVE_TIMECOUNTER case PPS_IOC_CREATE: case PPS_IOC_DESTROY: case PPS_IOC_GETPARAMS: @@ -227,51 +185,6 @@ ppsioctl(dev_t dev, u_long cmd, void *data, int flags, struct lwp *l) #endif error = pps_ioctl(cmd, data, &sc->pps_state); break; -#else /* !__HAVE_TIMECOUNTER */ - case PPS_IOC_CREATE: - break; - - case PPS_IOC_DESTROY: - break; - - case PPS_IOC_GETPARAMS: { - pps_params_t *pp; - pp = (pps_params_t *)data; - *pp = sc->ppsparam; - break; - } - - case PPS_IOC_SETPARAMS: { - pps_params_t *pp; - pp = (pps_params_t *)data; - if (pp->mode & ~(ppscap)) { - error = EINVAL; - break; - } - sc->ppsparam = *pp; - break; - } - - case PPS_IOC_GETCAP: - *(int*)data = ppscap; - break; - - case PPS_IOC_FETCH: { - pps_info_t *pi; - pi = (pps_info_t *)data; - *pi = sc->ppsinfo; - break; - } - -#ifdef PPS_SYNC - case PPS_IOC_KCBIND: - if (*(int *)data & PPS_CAPTUREASSERT) - sc->hardpps = 1; - else - sc->hardpps = 0; - break; -#endif -#endif /* !__HAVE_TIMECOUNTER */ default: error = EPASSTHROUGH; |
