Module: xenomai-forge
Branch: master
Commit: 55c12d9764ae9e73760915744b7c99f6ebe1581d
URL:    
http://git.xenomai.org/?p=xenomai-forge.git;a=commit;h=55c12d9764ae9e73760915744b7c99f6ebe1581d

Author: Philippe Gerum <r...@xenomai.org>
Date:   Mon Sep  2 15:34:24 2013 +0200

cobalt/timer: enable fired predicate for oneshot timers

---

 include/cobalt/kernel/timer.h |    5 +++++
 kernel/cobalt/clock.c         |    2 +-
 kernel/cobalt/timer.c         |    1 +
 3 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/include/cobalt/kernel/timer.h b/include/cobalt/kernel/timer.h
index fe83e74..f21ba93 100644
--- a/include/cobalt/kernel/timer.h
+++ b/include/cobalt/kernel/timer.h
@@ -287,6 +287,11 @@ static inline int xntimer_running_p(struct xntimer *timer)
        return (timer->status & XNTIMER_DEQUEUED) == 0;
 }
 
+static inline int xntimer_fired_p(struct xntimer *timer)
+{
+       return (timer->status & XNTIMER_FIRED) != 0;
+}
+
 static inline int xntimer_reload_p(struct xntimer *timer)
 {
        return (timer->status &
diff --git a/kernel/cobalt/clock.c b/kernel/cobalt/clock.c
index 3363a47..74f5aea 100644
--- a/kernel/cobalt/clock.c
+++ b/kernel/cobalt/clock.c
@@ -653,6 +653,7 @@ void xnclock_tick(struct xnclock *clock)
        fire:
                timer->handler(timer);
                now = xnclock_read_raw(clock);
+               timer->status |= XNTIMER_FIRED;
                /*
                 * If the elapsed timer has no reload value, or was
                 * re-queued or killed by the timeout handler: do not
@@ -660,7 +661,6 @@ void xnclock_tick(struct xnclock *clock)
                 */
                if (!xntimer_reload_p(timer))
                        continue;
-               timer->status |= XNTIMER_FIRED;
        advance:
                interval = timer->interval;
        requeue:
diff --git a/kernel/cobalt/timer.c b/kernel/cobalt/timer.c
index fb135a6..814ccf3 100644
--- a/kernel/cobalt/timer.c
+++ b/kernel/cobalt/timer.c
@@ -198,6 +198,7 @@ void __xntimer_stop(struct xntimer *timer)
 
        heading = xntimer_heading_p(timer);
        xntimer_dequeue(timer, q);
+       timer->status &= ~XNTIMER_FIRED;
        sched = xntimer_sched(timer);
 
        /*


_______________________________________________
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git

Reply via email to