Module: xenomai-head
Branch: master
Commit: 4542be14f8dee3102c76a09081fbfb632b59f06b
URL:    
http://git.xenomai.org/?p=xenomai-head.git;a=commit;h=4542be14f8dee3102c76a09081fbfb632b59f06b

Author: Gilles Chanteperdrix <gilles.chanteperd...@xenomai.org>
Date:   Thu Aug 27 15:08:26 2009 +0200

timeconv: Fix xnarch_ns_to_tsc in the mulshft && !nodiv case

---

 include/asm-generic/bits/timeconv.h |   27 +++++++++++++++++----------
 1 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/include/asm-generic/bits/timeconv.h 
b/include/asm-generic/bits/timeconv.h
index aa595fe..8162369 100644
--- a/include/asm-generic/bits/timeconv.h
+++ b/include/asm-generic/bits/timeconv.h
@@ -41,16 +41,6 @@ long long xnarch_tsc_to_ns_rounded(long long ticks)
        unsigned int shift = tsc_shift - 1;
        return (xnarch_llmulshft(ticks, tsc_scale, shift) + 1) / 2;
 }
-#else  /* !XNARCH_HAVE_LLMULSHFT */
-long long xnarch_tsc_to_ns(long long ticks)
-{
-       return xnarch_llimd(ticks, 1000000000, cpufreq);
-}
-long long xnarch_tsc_to_ns_rounded(long long ticks)
-{
-       return (xnarch_llimd(ticks, 1000000000, cpufreq/2) + 1) / 2;
-}
-#endif /* !XNARCH_HAVE_LLMULSHFT */
 
 #ifdef XNARCH_HAVE_NODIV_LLIMD
 long long xnarch_ns_to_tsc(long long ns)
@@ -75,8 +65,25 @@ unsigned long long xnarch_divrem_billion(unsigned long long 
value,
 #else /* !XNARCH_HAVE_NODIV_LLIMD */
 long long xnarch_ns_to_tsc(long long ns)
 {
+       return xnarch_llimd(ns, 1 << tsc_shift, tsc_scale);
+}
+#endif /* !XNARCH_HAVE_NODIV_LLIMD */
+#else  /* !XNARCH_HAVE_LLMULSHFT */
+long long xnarch_tsc_to_ns(long long ticks)
+{
+       return xnarch_llimd(ticks, 1000000000, cpufreq);
+}
+long long xnarch_tsc_to_ns_rounded(long long ticks)
+{
+       return (xnarch_llimd(ticks, 1000000000, cpufreq/2) + 1) / 2;
+}
+long long xnarch_ns_to_tsc(long long ns)
+{
        return xnarch_llimd(ns, cpufreq, 1000000000);
 }
+#endif /* !XNARCH_HAVE_LLMULSHFT */
+
+#ifndef XNARCH_HAVE_NODIV_LLIMD
 unsigned long long xnarch_divrem_billion(unsigned long long value,
                                         unsigned long *rem)
 {


_______________________________________________
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git

Reply via email to