This introduces a round-up-variant of xntbase_ns2ticks. It is uninlined
for the non-trivial case due to its text size. Its only user will be
RTDM for now, but maybe the POSIX skin can use it as well.

Philippe, if you accept this one, I'll handle the RTDM side myself.

Jan
---
 include/nucleus/timebase.h |    7 +++++++
 ksrc/nucleus/timebase.c    |    7 +++++++
 2 files changed, 14 insertions(+)

Index: xenomai/include/nucleus/timebase.h
===================================================================
--- xenomai.orig/include/nucleus/timebase.h
+++ xenomai/include/nucleus/timebase.h
@@ -148,6 +148,8 @@ static inline xnticks_t xntbase_ns2ticks
        return xnarch_ulldiv(t, xntbase_get_tickval(base), NULL);
 }
 
+xnticks_t xntbase_ns2ticks_ceil(xntbase_t *base, xntime_t t);
+
 static inline int xntbase_master_p(xntbase_t *base)
 {
        return base == &nktbase;
@@ -247,6 +249,11 @@ static inline xnticks_t xntbase_ns2ticks
        return t;
 }
 
+static inline xnticks_t xntbase_ns2ticks_ceil(xntbase_t *base, xntime_t t)
+{
+       return t;
+}
+
 static inline int xntbase_master_p(xntbase_t *base)
 {
        return 1;
Index: xenomai/ksrc/nucleus/timebase.c
===================================================================
--- xenomai.orig/ksrc/nucleus/timebase.c
+++ xenomai/ksrc/nucleus/timebase.c
@@ -483,6 +483,12 @@ void xntbase_tick(xntbase_t *base)
        xnlock_put_irqrestore(&nklock, s);
 }
 
+xnticks_t xntbase_ns2ticks_ceil(xntbase_t *base, xntime_t t)
+{
+       return xnarch_ulldiv(t + xntbase_get_tickval(base) - 1,
+                            xntbase_get_tickval(base), NULL);
+}
+
 EXPORT_SYMBOL(xntbase_alloc);
 EXPORT_SYMBOL(xntbase_free);
 EXPORT_SYMBOL(xntbase_update);
@@ -490,6 +496,7 @@ EXPORT_SYMBOL(xntbase_switch);
 EXPORT_SYMBOL(xntbase_start);
 EXPORT_SYMBOL(xntbase_stop);
 EXPORT_SYMBOL(xntbase_tick);
+EXPORT_SYMBOL(xntbase_ns2ticks_ceil);
 
 #endif /* CONFIG_XENO_OPT_TIMING_PERIODIC */
 

Attachment: signature.asc
Description: OpenPGP digital signature

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

Reply via email to