+2000-09-13 Harlan Stenn <stenn@whimsy.udel.edu>
+
+ * 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 <stenn@whimsy.udel.edu>
* configure.in (ac_cv_var_atom_ok): Cleanup ATOM/PPSAPI stuff...
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 */
struct refclockproc *pp;
#ifdef HAVE_PPSAPI
register struct ppsunit *up;
- pps_params_t pps;
int mode, temp;
pps_handle_t handle;
#endif /* HAVE_PPSAPI */
/*
* 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");
"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);
"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);
&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);
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");
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");