From 8b6c5dc9b114b18f2af6ec8865ed77b55b48269e Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Sun, 8 Mar 2015 07:32:37 -0400 Subject: Decouple (mostly) the PPS thread-monitor from the session structure. This is the big step towards ntplib. A couple of minor issues remain to be ironed out, the most significant of which is what to do about the timestamp_t type. This changes some field offsets of private fields in struct gps_device_t. Probably does not require a version bump as access to them is all through the libgpsd API. All regression tests pass. PPS observed live in gpsmon direct mode. --- ppsthread.h | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'ppsthread.h') diff --git a/ppsthread.h b/ppsthread.h index 2a37c052..ea83d04f 100644 --- a/ppsthread.h +++ b/ppsthread.h @@ -28,18 +28,30 @@ struct pps_thread_t { #if defined(HAVE_SYS_TIMEPPS_H) pps_handle_t kernelpps_handle; #endif /* defined(HAVE_SYS_TIMEPPS_H) */ + int devicefd; /* device file descriptor */ + char *devicename; int chronyfd; /* for talking to chrony */ - /*@null@*/ char *(*report_hook)(struct gps_device_t *, + /*@null@*/ char *(*report_hook)(volatile struct pps_thread_t *, struct timedelta_t *); - /*@null@*/ void (*wrap_hook)(struct gps_device_t *); + /*@null@*/ void (*wrap_hook)(volatile struct pps_thread_t *); struct timedelta_t ppsout_last; int ppsout_count; + /*@null@*/ void (*pps_hook)(volatile struct pps_thread_t *, struct timedelta_t *); + /*@null@*/ void (*log_hook)(volatile struct pps_thread_t *, int errlevel, const char *fmt, ...); + void *context; }; -extern void pps_thread_activate(struct gps_device_t *); -extern void pps_thread_deactivate(struct gps_device_t *); -extern void pps_thread_stash_fixtime(struct gps_device_t *, +#define THREAD_ERROR 0 +#define THREAD_WARN 1 +#define THREAD_INF 2 +#define THREAD_PROG 3 +#define THREAD_RAW 4 + +extern void pps_thread_activate(volatile struct pps_thread_t *); +extern void pps_thread_deactivate(volatile struct pps_thread_t *); +extern void pps_thread_stash_fixtime(volatile struct pps_thread_t *, timestamp_t, struct timespec); -extern int pps_thread_lastpps(struct gps_device_t *, struct timedelta_t *); +extern int pps_thread_lastpps(volatile struct pps_thread_t *, + struct timedelta_t *); #endif /* PPSTHREAD_H */ -- cgit v1.2.1