Skip to contentSkip to conversation

Introduce xntbase_ns2ticks_ceil

PATCH Applied Jan Kiszka 2 participants 2 messages Aug 30, 2007 – Sep 7, 2007

lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

PATCH 1/2 Introduce xntbase_ns2ticks_ceil

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(+)
include/nucleus/timebase.h +7 -0
Index: 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;
ksrc/nucleus/timebase.c +7 -0
Index: 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 */
 
#1 lore raw
Quoted 6 lines · Jan Kiszka

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.

Merged, thanks.

Quoted 57 lines

Jan
plain text document attachment (xntbase_ns2ticks_ceil.patch)

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

Index: xenomai/include/nucleus/timebase.h
===================================================================

include/nucleus/timebase.h +7 -0
@@ -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
===================================================================

ksrc/nucleus/timebase.c +7 -0
@@ -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 */
 
Signature · 1 line
Philippe.