[svn-commits] tzafrir: branch 1.2 r3098 - /branches/1.2/ztdummy.c
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Sun Sep 30 23:47:27 CDT 2007
Author: tzafrir
Date: Sun Sep 30 23:47:25 2007
New Revision: 3098
URL: http://svn.digium.com/view/zaptel?view=rev&rev=3098
Log:
A slightly more complete merge of the hires times code to 1.2 .
Modified:
branches/1.2/ztdummy.c
Modified: branches/1.2/ztdummy.c
URL: http://svn.digium.com/view/zaptel/branches/1.2/ztdummy.c?view=diff&rev=3098&r1=3097&r2=3098
==============================================================================
--- branches/1.2/ztdummy.c (original)
+++ branches/1.2/ztdummy.c Sun Sep 30 23:47:25 2007
@@ -180,6 +180,38 @@
zt_receive(&ztd->span);
zt_transmit(&ztd->span);
}
+}
+#elif defined(USE_HIGHRESTIMER)
+static enum hrtimer_restart ztdummy_hr_int(struct hrtimer *htmr)
+{
+ unsigned long overrun;
+
+ /* Trigger Zaptel */
+ zt_receive(&ztd->span);
+ zt_transmit(&ztd->span);
+
+ /* Overrun should always return 1, since we are in the timer that
+ * expired.
+ * We should worry if overrun is 2 or more; then we really missed
+ * a tick */
+ overrun = hrtimer_forward(&zaptimer, htmr->expires,
+ ktime_set(0, ZAPTEL_TIME_NS));
+ if(overrun > 1) {
+ if(printk_ratelimit())
+ printk(KERN_NOTICE "ztdummy: HRTimer missed %lu ticks\n",
+ overrun - 1);
+ }
+
+ if(debug && DEBUG_TICKS) {
+ static int count = 0;
+ /* Printk every 5 seconds, good test to see if timer is
+ * running properly */
+ if (count++ % 5000 == 0)
+ printk(KERN_DEBUG "ztdummy: 5000 ticks from hrtimer\n");
+ }
+
+ /* Always restart the timer */
+ return HRTIMER_RESTART;
}
#else
/* use kernel system tick timer if PC architecture RTC is not available */
@@ -289,6 +321,17 @@
}
rtc_control(&ztd->rtc_task, RTC_IRQP_SET, 1024); /* 1024 Hz */
rtc_control(&ztd->rtc_task, RTC_PIE_ON, 0);
+#elif defined(USE_HIGHRESTIMER)
+ printk(KERN_DEBUG "ztdummy: Trying to load High Resolution Timer\n");
+ hrtimer_init(&zaptimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
+ printk(KERN_DEBUG "ztdummy: Initialized High Resolution Timer\n");
+
+ /* Set timer callback function */
+ zaptimer.function = ztdummy_hr_int;
+
+ printk(KERN_DEBUG "ztdummy: Starting High Resolution Timer\n");
+ hrtimer_start(&zaptimer, ktime_set(0, ZAPTEL_TIME_NS), HRTIMER_MODE_REL);
+ printk(KERN_INFO "ztdummy: High Resolution Timer started, good to go\n");
#else
init_timer(&timer);
timer.function = ztdummy_timer;
More information about the svn-commits
mailing list