lkml.org 
[lkml]   [2002]   [Oct]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] i386 timer changes for 2.5.41
# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
# ChangeSet 1.748 -> 1.749
# (new) -> 1.1 include/asm-i386/timer.h
# (new) -> 1.1 arch/i386/kernel/timers/timer.c
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/10/09 johnstul@us.ibm.com 1.749
# i386 timer core: introduce struct timer_ops
#
# provides the infrastructure needed via the timer_ops structure,
# as well as the select_timer() function for choosing the best
# available timer
# --------------------------------------------
#
diff -Nru a/arch/i386/kernel/timers/timer.c b/arch/i386/kernel/timers/timer.c
--- /dev/null Wed Dec 31 16:00:00 1969
+++ b/arch/i386/kernel/timers/timer.c Thu Oct 10 11:21:16 2002
@@ -0,0 +1,31 @@
+#include <linux/kernel.h>
+#include <asm/timer.h>
+
+/* list of externed timers */
+/* eg: extern struct timer_opts timer_XXX*/;
+
+/* list of timers, ordered by preference, NULL terminated */
+static struct timer_opts* timers[] = {
+ /* eg: &timer_XXX */
+ NULL,
+};
+
+
+/* iterates through the list of timers, returning the first
+ * one that initializes successfully.
+ */
+struct timer_opts* select_timer(void)
+{
+ int i = 0;
+
+ /* find most preferred working timer */
+ while (timers[i]) {
+ if (timers[i]->init)
+ if (timers[i]->init() == 0)
+ return timers[i];
+ ++i;
+ }
+
+ panic("select_timer: Cannot find a suitable timer\n");
+ return NULL;
+}
diff -Nru a/include/asm-i386/timer.h b/include/asm-i386/timer.h
--- /dev/null Wed Dec 31 16:00:00 1969
+++ b/include/asm-i386/timer.h Thu Oct 10 11:21:16 2002
@@ -0,0 +1,20 @@
+#ifndef _ASMi386_TIMER_H
+#define _ASMi386_TIMER_H
+
+/**
+ * struct timer_ops - used to define a timer source
+ *
+ * @init: Probes and initializes the timer. Returns 0 on success, anything
+ * else on failure.
+ * @mark_offset: called by the timer interrupt
+ * @get_offset: called by gettimeofday(). Returns the number of ms since the
+ * last timer intruupt.
+ */
+struct timer_opts{
+ int (*init)(void);
+ void (*mark_offset)(void);
+ unsigned long (*get_offset)(void);
+};
+
+extern struct timer_opts* select_timer(void);
+#endif
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2005-03-22 13:29    [from the cache]
©2003-2014 Jasper Spaans. hosted at Digital Ocean