Module: xenomai-head
Branch: master
Commit: 3ce2508ef184ead2fedd74068a9b9dd9ef33a9e1
URL:    
http://git.xenomai.org/?p=xenomai-head.git;a=commit;h=3ce2508ef184ead2fedd74068a9b9dd9ef33a9e1

Author: Jan Kiszka <jan.kis...@siemens.com>
Date:   Wed Jun  3 15:53:03 2009 +0200

hal: Add rthal_local_irq_disabled wrapper

Add a more handy wrapper to test for the (virtual) IRQ mask of the
real-time domain and convert RTDM users to it.

Signed-off-by: Jan Kiszka <jan.kis...@siemens.com>

---

 include/asm-generic/hal.h |    1 +
 ksrc/skins/rtdm/core.c    |   15 ++++++++++-----
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/include/asm-generic/hal.h b/include/asm-generic/hal.h
index e4fdea9..244ca02 100644
--- a/include/asm-generic/hal.h
+++ b/include/asm-generic/hal.h
@@ -116,6 +116,7 @@ typedef spinlock_t rthal_spinlock_t;
 #endif /* !CONFIG_XENO_OPT_PIPELINE_HEAD */
 #define rthal_local_irq_flags(x)       ((x) = 
ipipe_test_pipeline_from(&rthal_domain) & 1)
 #define rthal_local_irq_test()         ipipe_test_pipeline_from(&rthal_domain)
+#define rthal_local_irq_disabled()     ipipe_test_pipeline_from(&rthal_domain)
 #define rthal_stage_irq_enable(dom)    ipipe_unstall_pipeline_from(dom)
 #define rthal_local_irq_save_hw(x)     local_irq_save_hw(x)
 #define rthal_local_irq_restore_hw(x)  local_irq_restore_hw(x)
diff --git a/ksrc/skins/rtdm/core.c b/ksrc/skins/rtdm/core.c
index 853b8af..5843842 100644
--- a/ksrc/skins/rtdm/core.c
+++ b/ksrc/skins/rtdm/core.c
@@ -222,7 +222,8 @@ int __rt_dev_open(rtdm_user_info_t *user_info, const char 
*path, int oflag)
                ret = device->open_rt(context, user_info, oflag);
        }
 
-       XENO_ASSERT(RTDM, !rthal_local_irq_test(), rthal_local_irq_enable(););
+       XENO_ASSERT(RTDM, !rthal_local_irq_disabled(),
+                   rthal_local_irq_enable(););
 
        if (unlikely(ret < 0))
                goto cleanup_out;
@@ -274,7 +275,8 @@ int __rt_dev_socket(rtdm_user_info_t *user_info, int 
protocol_family,
                ret = device->socket_rt(context, user_info, protocol);
        }
 
-       XENO_ASSERT(RTDM, !rthal_local_irq_test(), rthal_local_irq_enable(););
+       XENO_ASSERT(RTDM, !rthal_local_irq_disabled(),
+                   rthal_local_irq_enable(););
 
        if (unlikely(ret < 0))
                goto cleanup_out;
@@ -336,7 +338,8 @@ again:
                ret = context->ops->close_rt(context, user_info);
        }
 
-       XENO_ASSERT(RTDM, !rthal_local_irq_test(), rthal_local_irq_enable(););
+       XENO_ASSERT(RTDM, !rthal_local_irq_disabled(),
+                   rthal_local_irq_enable(););
 
        if (unlikely(ret == -EAGAIN) && nrt_mode) {
                rtdm_context_unlock(context);
@@ -422,7 +425,8 @@ do {                                                        
                \
        else                                                            \
                ret = ops->operation##_nrt(context, user_info, args);   \
                                                                        \
-       XENO_ASSERT(RTDM, !rthal_local_irq_test(), rthal_local_irq_enable();)
+       XENO_ASSERT(RTDM, !rthal_local_irq_disabled(),                  \
+                   rthal_local_irq_enable();)
 
 #define MAJOR_FUNCTION_WRAPPER_BH()                                    \
        rtdm_context_unlock(context);                                   \
@@ -564,7 +568,8 @@ int rtdm_select_bind(int fd, rtdm_selector_t *selector,
 
        ret = ops->select_bind(context, selector, type, fd_index);
 
-       XENO_ASSERT(RTDM, !rthal_local_irq_test(), rthal_local_irq_enable(););
+       XENO_ASSERT(RTDM, !rthal_local_irq_disabled(),
+                   rthal_local_irq_enable(););
 
        rtdm_context_unlock(context);
 


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

Reply via email to