summaryrefslogtreecommitdiff
path: root/ppsthread.h
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2015-03-08 07:32:37 -0400
committerEric S. Raymond <esr@thyrsus.com>2015-03-08 07:32:37 -0400
commit8b6c5dc9b114b18f2af6ec8865ed77b55b48269e (patch)
tree244ad8d3b0c8f8333f912098ddb8d0883843f33f /ppsthread.h
parent4157fc2c007f962d0e898e88b0fd3a89cea348ee (diff)
downloadgpsd-8b6c5dc9b114b18f2af6ec8865ed77b55b48269e.tar.gz
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.
Diffstat (limited to 'ppsthread.h')
-rw-r--r--ppsthread.h24
1 files changed, 18 insertions, 6 deletions
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 */