summaryrefslogtreecommitdiffstats
path: root/sys/kern/subr_rtc.c
diff options
context:
space:
mode:
authorlstewart <lstewart@FreeBSD.org>2011-11-19 14:10:16 +0000
committerlstewart <lstewart@FreeBSD.org>2011-11-19 14:10:16 +0000
commit751092ac03de2a27db50a384379d53f52133c479 (patch)
treebe0e08688aeafcd4b05ef1e0ffb023edf6699e34 /sys/kern/subr_rtc.c
parentc3d63592a0ff996956fd6dd88c7b06ba1d08bbca (diff)
downloadFreeBSD-src-751092ac03de2a27db50a384379d53f52133c479.zip
FreeBSD-src-751092ac03de2a27db50a384379d53f52133c479.tar.gz
Core structure and functions to support a feed-forward clock within the kernel.
Implement ffcounter, a monotonically increasing cumulative counter on top of the active timecounter. Provide low-level functions to read the ffcounter and convert it to absolute time or a time interval in seconds using the current ffclock estimates, which track the drift of the oscillator. Add a ring of fftimehands to track passing of time on each kernel tick and pick up updates of ffclock estimates. Committed on behalf of Julien Ridoux and Darryl Veitch from the University of Melbourne, Australia, as part of the FreeBSD Foundation funded "Feed-Forward Clock Synchronization Algorithms" project. For more information, see http://www.synclab.org/radclock/ Submitted by: Julien Ridoux (jridoux at unimelb edu au)
Diffstat (limited to 'sys/kern/subr_rtc.c')
-rw-r--r--sys/kern/subr_rtc.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/sys/kern/subr_rtc.c b/sys/kern/subr_rtc.c
index 120ad5f..ed2befc 100644
--- a/sys/kern/subr_rtc.c
+++ b/sys/kern/subr_rtc.c
@@ -1,12 +1,17 @@
/*-
* Copyright (c) 1988 University of Utah.
* Copyright (c) 1982, 1990, 1993
- * The Regents of the University of California. All rights reserved.
+ * The Regents of the University of California.
+ * Copyright (c) 2011 The FreeBSD Foundation
+ * All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* the Systems Programming Group of the University of Utah Computer
* Science Department.
*
+ * Portions of this software were developed by Julien Ridoux at the University
+ * of Melbourne under sponsorship from the FreeBSD Foundation.
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -50,12 +55,17 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
+#include "opt_ffclock.h"
+
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/bus.h>
#include <sys/clock.h>
#include <sys/sysctl.h>
+#ifdef FFCLOCK
+#include <sys/timeffc.h>
+#endif
#include <sys/timetc.h>
#include "clock_if.h"
@@ -133,6 +143,9 @@ inittodr(time_t base)
ts.tv_sec += utc_offset();
timespecadd(&ts, &clock_adj);
tc_setclock(&ts);
+#ifdef FFCLOCK
+ ffclock_reset_clock(&ts);
+#endif
return;
wrong_time:
OpenPOWER on IntegriCloud