Module: xenomai-3
Branch: next
Commit: 6d8ab1b70f224255497ecb8e5dc3bc643d6b8a8c
URL:    
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=6d8ab1b70f224255497ecb8e5dc3bc643d6b8a8c

Author: Philippe Gerum <r...@xenomai.org>
Date:   Sat Oct 24 11:29:50 2015 +0200

cobalt/thread: allow for changing the clock of the periodic timer

---

 include/cobalt/kernel/thread.h |    9 +++++++--
 kernel/cobalt/thread.c         |   10 ++++++++++
 2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/include/cobalt/kernel/thread.h b/include/cobalt/kernel/thread.h
index 2a06fd2..df6297f 100644
--- a/include/cobalt/kernel/thread.h
+++ b/include/cobalt/kernel/thread.h
@@ -432,9 +432,14 @@ void xnthread_init_root_tcb(struct xnthread *thread);
 
 void xnthread_deregister(struct xnthread *thread);
 
-char *xnthread_format_status(unsigned long status, char *buf, int size);
+char *xnthread_format_status(unsigned long status,
+                            char *buf, int size);
 
-xnticks_t xnthread_get_timeout(struct xnthread *thread, xnticks_t ns);
+void xnthread_set_clock(struct xnthread *thread,
+                       struct xnclock *newclock);
+
+xnticks_t xnthread_get_timeout(struct xnthread *thread,
+                              xnticks_t ns);
 
 xnticks_t xnthread_get_period(struct xnthread *thread);
 
diff --git a/kernel/cobalt/thread.c b/kernel/cobalt/thread.c
index 508ed69..ab9867c 100644
--- a/kernel/cobalt/thread.c
+++ b/kernel/cobalt/thread.c
@@ -326,6 +326,16 @@ char *xnthread_format_status(unsigned long status, char 
*buf, int size)
        return buf;
 }
 
+void xnthread_set_clock(struct xnthread *thread, struct xnclock *newclock)
+{
+       spl_t s;
+
+       /* Change the clock the thread's periodic timer is paced by. */
+       xnlock_get_irqsave(&nklock, s);
+       xntimer_set_clock(&thread->ptimer, newclock);
+       xnlock_put_irqrestore(&nklock, s);
+}
+
 xnticks_t xnthread_get_timeout(struct xnthread *thread, xnticks_t ns)
 {
        struct xntimer *timer;


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

Reply via email to