Module: xenomai-gch
Branch: for-forge
Commit: ee703d9785f7e242057ef689bc500b965cd75294
URL:    
http://git.xenomai.org/?p=xenomai-gch.git;a=commit;h=ee703d9785f7e242057ef689bc500b965cd75294

Author: Gilles Chanteperdrix <gilles.chanteperd...@xenomai.org>
Date:   Sun Nov 16 00:17:54 2014 +0100

cobalt/rtdm: add rtdm_schedule_nrt_work service

to allow triggering a call to schedule_work() from primary domain

---

 include/cobalt/kernel/rtdm/driver.h |    1 +
 kernel/cobalt/rtdm/drvlib.c         |   32 ++++++++++++++++++++++++++++++++
 2 files changed, 33 insertions(+)

diff --git a/include/cobalt/kernel/rtdm/driver.h 
b/include/cobalt/kernel/rtdm/driver.h
index 703b6ec..2d4af92 100644
--- a/include/cobalt/kernel/rtdm/driver.h
+++ b/include/cobalt/kernel/rtdm/driver.h
@@ -847,6 +847,7 @@ struct rtdm_nrtsig {
        void *arg;
 };
 
+void rtdm_schedule_nrt_work(struct work_struct *lostage_work);
 /** @} rtdm_nrtsignal */
 
 #ifndef DOXYGEN_CPP /* Avoid static inline tags for RTDM in doxygen */
diff --git a/kernel/cobalt/rtdm/drvlib.c b/kernel/cobalt/rtdm/drvlib.c
index 165768a..b6a988a 100644
--- a/kernel/cobalt/rtdm/drvlib.c
+++ b/kernel/cobalt/rtdm/drvlib.c
@@ -1484,6 +1484,38 @@ void rtdm_nrtsig_pend(rtdm_nrtsig_t *nrt_sig)
        ipipe_post_work_root(&nrtsig_work, work);
 }
 EXPORT_SYMBOL_GPL(rtdm_nrtsig_pend);
+
+struct lostage_schedule_work {
+       struct ipipe_work_header work;
+       struct work_struct *lostage_work;
+};
+
+static void lostage_schedule_work(struct ipipe_work_header *work)
+{
+       struct lostage_schedule_work *w;
+
+       w = container_of(work, typeof(*w), work);
+       schedule_work(w->lostage_work);
+}
+
+/**
+ * Put a work task in Linux non real-time global workqueue from primary mode.
+ *
+ * @param lostage_work
+ */
+void rtdm_schedule_nrt_work(struct work_struct *lostage_work)
+{
+       struct lostage_schedule_work macb_work = {
+               .work = {
+                       .size = sizeof(macb_work),
+                       .handler = lostage_schedule_work,
+               },
+               .lostage_work = lostage_work,
+       };
+       ipipe_post_work_root(&macb_work, work);
+}
+EXPORT_SYMBOL_GPL(rtdm_schedule_nrt_work);
+
 /** @} Non-Real-Time Signalling Services */
 
 


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

Reply via email to