Module: xenomai-jki
Branch: for-upstream
Commit: 97b78d45bf4c5571fccd9675fae8bb008a341769
URL:    
http://git.xenomai.org/?p=xenomai-jki.git;a=commit;h=97b78d45bf4c5571fccd9675fae8bb008a341769

Author: Jan Kiszka <jan.kis...@siemens.com>
Date:   Wed Feb 10 13:24:29 2010 +0100

Mark all time conversion symbols weak

Otherwise the wrong set of variables might get initialized when using
> 1 skin libraries.

Signed-off-by: Jan Kiszka <jan.kis...@siemens.com>

---

 include/asm-generic/bits/timeconv.h |   42 ++++++++++++++++++++---------------
 1 files changed, 24 insertions(+), 18 deletions(-)

diff --git a/include/asm-generic/bits/timeconv.h 
b/include/asm-generic/bits/timeconv.h
index fde8e5d..af11acc 100644
--- a/include/asm-generic/bits/timeconv.h
+++ b/include/asm-generic/bits/timeconv.h
@@ -21,13 +21,14 @@
 
 #include <asm/xenomai/arith.h>
 
-static unsigned long long clockfreq;
+unsigned long long xnarch_clockfreq __attribute__ ((weak));
 
 #ifdef XNARCH_HAVE_LLMULSHFT
-static unsigned int tsc_scale, tsc_shift;
+unsigned int xnarch_tsc_scale __attribute__ ((weak));
+unsigned int xnarch_tsc_shift __attribute__ ((weak));
 #ifdef XNARCH_HAVE_NODIV_LLIMD
-static rthal_u32frac_t tsc_frac;
-static rthal_u32frac_t bln_frac;
+rthal_u32frac_t xnarch_tsc_frac __attribute__ ((weak));
+rthal_u32frac_t xnarch_bln_frac __attribute__ ((weak));
 #endif
 #endif
 
@@ -35,19 +36,20 @@ static rthal_u32frac_t bln_frac;
 __attribute__ ((weak))
 long long xnarch_tsc_to_ns(long long ticks)
 {
-       return xnarch_llmulshft(ticks, tsc_scale, tsc_shift);
+       return xnarch_llmulshft(ticks, xnarch_tsc_scale, xnarch_tsc_shift);
 }
 __attribute__ ((weak))
 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;
+       unsigned int shift = xnarch_tsc_shift - 1;
+       return (xnarch_llmulshft(ticks, xnarch_tsc_scale, shift) + 1) / 2;
 }
 #ifdef XNARCH_HAVE_NODIV_LLIMD
 __attribute__ ((weak))
 long long xnarch_ns_to_tsc(long long ns)
 {
-       return xnarch_nodiv_llimd(ns, tsc_frac.frac, tsc_frac.integ);
+       return xnarch_nodiv_llimd(ns, xnarch_tsc_frac.frac,
+                                 xnarch_tsc_frac.integ);
 }
 __attribute__ ((weak))
 unsigned long long xnarch_divrem_billion(unsigned long long value,
@@ -56,7 +58,8 @@ unsigned long long xnarch_divrem_billion(unsigned long long 
value,
        unsigned long long q;
        unsigned r;
 
-       q = xnarch_nodiv_ullimd(value, bln_frac.frac, bln_frac.integ);
+       q = xnarch_nodiv_ullimd(value, xnarch_bln_frac.frac,
+                               xnarch_bln_frac.integ);
        r = value - q * 1000000000;
        if (r >= 1000000000) {
                ++q;
@@ -69,24 +72,24 @@ unsigned long long xnarch_divrem_billion(unsigned long long 
value,
 __attribute__ ((weak))
 long long xnarch_ns_to_tsc(long long ns)
 {
-       return xnarch_llimd(ns, 1 << tsc_shift, tsc_scale);
+       return xnarch_llimd(ns, 1 << xnarch_tsc_shift, xnarch_tsc_scale);
 }
 #endif /* !XNARCH_HAVE_NODIV_LLIMD */
 #else  /* !XNARCH_HAVE_LLMULSHFT */
 __attribute__ ((weak))
 long long xnarch_tsc_to_ns(long long ticks)
 {
-       return xnarch_llimd(ticks, 1000000000, clockfreq);
+       return xnarch_llimd(ticks, 1000000000, xnarch_clockfreq);
 }
 __attribute__ ((weak))
 long long xnarch_tsc_to_ns_rounded(long long ticks)
 {
-       return (xnarch_llimd(ticks, 1000000000, clockfreq/2) + 1) / 2;
+       return (xnarch_llimd(ticks, 1000000000, xnarch_clockfreq/2) + 1) / 2;
 }
 __attribute__ ((weak))
 long long xnarch_ns_to_tsc(long long ns)
 {
-       return xnarch_llimd(ns, clockfreq, 1000000000);
+       return xnarch_llimd(ns, xnarch_clockfreq, 1000000000);
 }
 #endif /* !XNARCH_HAVE_LLMULSHFT */
 
@@ -100,14 +103,17 @@ unsigned long long xnarch_divrem_billion(unsigned long 
long value,
 }
 #endif /* !XNARCH_HAVE_NODIV_LLIMD */
 
-static inline void xnarch_init_timeconv(unsigned long long freq)
+__attribute__ ((weak))
+void xnarch_init_timeconv(unsigned long long freq)
 {
-       clockfreq = freq;
+       xnarch_clockfreq = freq;
 #ifdef XNARCH_HAVE_LLMULSHFT
-       xnarch_init_llmulshft(1000000000, freq, &tsc_scale, &tsc_shift);
+       xnarch_init_llmulshft(1000000000, freq, &xnarch_tsc_scale,
+                             &xnarch_tsc_shift);
 #ifdef XNARCH_HAVE_NODIV_LLIMD
-       xnarch_init_u32frac(&tsc_frac, 1 << tsc_shift, tsc_scale);
-       xnarch_init_u32frac(&bln_frac, 1, 1000000000);
+       xnarch_init_u32frac(&xnarch_tsc_frac, 1 << xnarch_tsc_shift,
+                           xnarch_tsc_scale);
+       xnarch_init_u32frac(&xnarch_bln_frac, 1, 1000000000);
 #endif
 #endif
 }


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

Reply via email to