From: Harlan Stenn Date: Thu, 14 Sep 2000 02:14:52 +0000 (-0000) Subject: ChangeLog, refclock_atom.c, refclock_oncore.c: X-Git-Tag: NTP_4_0_99_M~163 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=57e86074315dace68fbdabb5e259cfcef44974f8;p=thirdparty%2Fntp.git ChangeLog, refclock_atom.c, refclock_oncore.c: * ntpd/refclock_oncore.c (oncore_get_timestamp): Prind debug messages being aware of HAVE_STRUCT_TIMESPEC. * ntpd/refclock_atom.c: Have pps_params tag along in the ppsunit structure, where it really belongs. (atom_pps): Use PPS_CAPTURE{ASSERT,CLEAR} From: Dave Mills. bk: 39c0349chaZ7k0i9-7IAbNjjrsF47g --- diff --git a/ChangeLog b/ChangeLog index eb44a16295..e15c060f1b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2000-09-13 Harlan Stenn + + * ntpd/refclock_oncore.c (oncore_get_timestamp): Prind debug + messages being aware of HAVE_STRUCT_TIMESPEC. + + * ntpd/refclock_atom.c: Have pps_params tag along in the ppsunit + structure, where it really belongs. + (atom_pps): Use PPS_CAPTURE{ASSERT,CLEAR} + From: Dave Mills. + 2000-09-12 Harlan Stenn * configure.in (ac_cv_var_atom_ok): Cleanup ATOM/PPSAPI stuff... diff --git a/ntpd/refclock_atom.c b/ntpd/refclock_atom.c index eccc657206..e185416518 100644 --- a/ntpd/refclock_atom.c +++ b/ntpd/refclock_atom.c @@ -76,8 +76,9 @@ static struct peer *pps_peer; /* atom driver for PPS sources */ struct ppsunit { struct timespec ts; /* last timestamp */ int fddev; /* pps device descriptor */ - pps_info_t pps_info; /* pps_info control */ - pps_handle_t handle; /* PPSAPI handlebars */ + pps_params_t pps_params; /* pps parameters */ + pps_info_t pps_info; /* last pps data */ + pps_handle_t handle; /* pps handlebars */ }; #endif /* HAVE_PPSAPI */ @@ -117,7 +118,6 @@ atom_start( struct refclockproc *pp; #ifdef HAVE_PPSAPI register struct ppsunit *up; - pps_params_t pps; int mode, temp; pps_handle_t handle; #endif /* HAVE_PPSAPI */ @@ -159,7 +159,6 @@ atom_start( /* * Light up the PPSAPI interface, select edge, enable kernel. */ - memset(&pps, 0, sizeof(pps)); if (time_pps_create(up->fddev, &handle) < 0) { msyslog(LOG_ERR, "refclock_atom: time_pps_create failed: %m"); @@ -170,8 +169,8 @@ atom_start( "refclock_atom: time_pps_getcap failed: %m"); return (0); } - pps.mode = mode & PPS_CAPTUREBOTH; - if (time_pps_setparams(handle, &pps) < 0) { + up->pps_params.mode = mode & PPS_CAPTUREBOTH; + if (time_pps_setparams(handle, &up->pps_params) < 0) { msyslog(LOG_ERR, "refclock_atom: time_pps_setparams failed: %m"); return (0); @@ -188,14 +187,14 @@ atom_start( "refclock_atom: time_pps_kcbind failed: %m"); return (0); } - (void)time_pps_getparams(handle, &pps); + (void)time_pps_getparams(handle, &up->pps_params); up->handle = handle; #if DEBUG if (debug) printf( "refclock_atom: %s handle %d ppsapi vers %d mode 0x%x cap 0x%x\n", - pps_device, up->handle, pps.api_version, pps.mode, - mode); + pps_device, up->handle, up->pps_params.api_version, + up->pps_params.mode, mode); #endif #endif /* HAVE_PPSAPI */ return (1); @@ -266,10 +265,12 @@ atom_pps( &up->pps_info, &timeout); if (rval < 0 || i == up->pps_info.assert_sequence) return (1); - if (pps_assert) + if (up->pps_info.current_mode & PPS_CAPTUREASSERT) ts = up->pps_info.assert_timestamp; - else + else if (up->pps_info.current_mode & PPS_CAPTURECLEAR) ts = up->pps_info.clear_timestamp; + else + return (1); if (ts.tv_sec == up->ts.tv_sec && ts.tv_nsec < up->ts.tv_nsec + RANGEGATE) return (1); diff --git a/ntpd/refclock_oncore.c b/ntpd/refclock_oncore.c index 000346663f..331d138258 100644 --- a/ntpd/refclock_oncore.c +++ b/ntpd/refclock_oncore.c @@ -2301,10 +2301,17 @@ oncore_get_timestamp( tsp = &pps_i.assert_timestamp; if (debug > 2) +#ifdef HAVE_STRUCT_TIMESPEC printf("ONCORE[%d]: serial/j (%lu, %d) %ld.%09ld\n", instance->unit, (long)pps_i.assert_sequence, j, (long)tsp->tv_sec, (long)tsp->tv_nsec); +#else + printf("ONCORE[%d]: serial/j (%lu, %d) %ld.%06ld\n", + instance->unit, + (long)pps_i.assert_sequence, j, + (long)tsp->tv_sec, (long)tsp->tv_usec); +#endif if (pps_i.assert_sequence == j) { printf("ONCORE: oncore_get_timestamp, error serial pps\n"); @@ -2315,9 +2322,15 @@ oncore_get_timestamp( tsp = &pps_i.clear_timestamp; if (debug > 2) +#ifdef HAVE_STRUCT_TIMESPEC printf("ONCORE[%d]: serial/j (%lu, %d) %ld.%09ld\n", instance->unit, pps_i.clear_sequence, j, tsp->tv_sec, tsp->tv_nsec); +#else + printf("ONCORE[%d]: serial/j (%lu, %d) %ld.%06ld\n", + instance->unit, + pps_i.clear_sequence, j, tsp->tv_sec, tsp->tv_usec); +#endif if (pps_i.clear_sequence == j) { printf("ONCORE: oncore_get_timestamp, error serial pps\n");