All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai-core] [PATCH 1/2] i386: report timer frequency on tickdev take-over
@ 2007-11-12 23:03 Jan Kiszka
  0 siblings, 0 replies; only message in thread
From: Jan Kiszka @ 2007-11-12 23:03 UTC (permalink / raw)
  To: adeos-main; +Cc: Xenomai-core


[-- Attachment #1.1: Type: text/plain, Size: 469 bytes --]

Here comes my favourite approach to report the frequency of the timer
that an I-pipe user takes over: via the very same API. This patch
extends ipipe_request_tickdev by a pointer to a variable that shall
receive the timer frequency as the hijacked clock_event_device carries it.

This is the most generic, future-proof, and clean approach IMHO, because
it doesn't assume anything about the tickdev selection the user may make
when requesting the device.

Jan

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: report-tickdev-freq-i386.patch --]
[-- Type: text/x-patch; name="report-tickdev-freq-i386.patch", Size: 1720 bytes --]

---
 include/linux/ipipe_tickdev.h |    2 +-
 kernel/ipipe/core.c           |    5 ++++-
 2 files changed, 5 insertions(+), 2 deletions(-)

Index: linux-2.6.23-ipipe/include/linux/ipipe_tickdev.h
===================================================================
--- linux-2.6.23-ipipe.orig/include/linux/ipipe_tickdev.h
+++ linux-2.6.23-ipipe/include/linux/ipipe_tickdev.h
@@ -46,7 +46,7 @@ int ipipe_request_tickdev(const char *de
 					  struct ipipe_tick_device *tdev),
 			  int (*emutick)(unsigned long evt,
 					 struct ipipe_tick_device *tdev),
-			  int cpu);
+			  int cpu, unsigned long *tick_freq);
 
 void ipipe_release_tickdev(int cpu);
 
Index: linux-2.6.23-ipipe/kernel/ipipe/core.c
===================================================================
--- linux-2.6.23-ipipe.orig/kernel/ipipe/core.c
+++ linux-2.6.23-ipipe/kernel/ipipe/core.c
@@ -123,10 +123,11 @@ int ipipe_request_tickdev(const char *de
 					  struct ipipe_tick_device *tdev),
 			  int (*emutick)(unsigned long delta,
 					 struct ipipe_tick_device *tdev),
-			  int cpu)
+			  int cpu, unsigned long *tick_freq)
 {
 	struct ipipe_tick_device *itd;
 	struct tick_device *slave;
+	unsigned long long freq;
 	unsigned long flags;
 	int status;
 
@@ -170,6 +171,8 @@ int ipipe_request_tickdev(const char *de
 	itd->emul_set_tick = emutick;
 	itd->real_set_mode = slave->evtdev->set_mode;
 	itd->real_set_tick = slave->evtdev->set_next_event;
+	freq = (1000000000ULL * slave->evtdev->mult) >> slave->evtdev->shift;
+	*tick_freq = (unsigned long)freq;
 	slave->evtdev->set_mode = __ipipe_set_tick_mode;
 	slave->evtdev->set_next_event = __ipipe_set_next_tick;
 	status = slave->evtdev->mode;

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 252 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-11-12 23:03 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-12 23:03 [Xenomai-core] [PATCH 1/2] i386: report timer frequency on tickdev take-over Jan Kiszka

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.