Module: xenomai-3 Branch: master Commit: 91010aab23e6ae8993a136b1a64c20daf0a89b4b URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=91010aab23e6ae8993a136b1a64c20daf0a89b4b
Author: Philippe Gerum <r...@xenomai.org> Date: Wed Dec 14 15:06:34 2016 +0100 cobalt/rtdm: allow polling events from secondary/IRQ context Invoking timed services for receiving events in polled mode (timeout == RTDM_TIMEOUT_NONE) is always valid regardless of the calling context. Do not trigger assertions when doing so. --- kernel/cobalt/init.c | 3 ++- kernel/cobalt/rtdm/drvlib.c | 8 ++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/kernel/cobalt/init.c b/kernel/cobalt/init.c index 5a6fdbf..1f7ce49 100644 --- a/kernel/cobalt/init.c +++ b/kernel/cobalt/init.c @@ -445,10 +445,11 @@ device_initcall(xenomai_init); * <TABLE> * <TR><TH>Tag</TH> <TH>Context on entry</TH></TR> * <TR><TD>primary-only</TD> <TD>Must be called from a Cobalt task in primary mode</TD></TR> + * <TR><TD>primary-timed</TD> <TD>Requires a Cobalt task in primary mode if timed</TD></TR> * <TR><TD>coreirq-only</TD> <TD>Must be called from a Cobalt IRQ handler</TD></TR> * <TR><TD>secondary-only</TD> <TD>Must be called from a Cobalt task in secondary mode or regular Linux task</TD></TR> * <TR><TD>rtdm-task</TD> <TD>Must be called from a RTDM driver task</TD></TR> - * <TR><TD>mode-unrestricted</TD> <TD>Must be called from a Cobalt task in either primary or secondary mode</TD></TR> + * <TR><TD>mode-unrestricted</TD> <TD>May be called from a Cobalt task in either primary or secondary mode</TD></TR> * <TR><TD>task-unrestricted</TD> <TD>May be called from a Cobalt or regular Linux task indifferently</TD></TR> * <TR><TD>unrestricted</TD> <TD>May be called from any context previously described</TD></TR> * <TR><TD>atomic-entry</TD> <TD>Caller must currently hold the big Cobalt kernel lock (nklock)</TD></TR> diff --git a/kernel/cobalt/rtdm/drvlib.c b/kernel/cobalt/rtdm/drvlib.c index 629c555..1a79121 100644 --- a/kernel/cobalt/rtdm/drvlib.c +++ b/kernel/cobalt/rtdm/drvlib.c @@ -858,7 +858,7 @@ EXPORT_SYMBOL_GPL(rtdm_event_wait); * - -EWOULDBLOCK is returned if a negative @a timeout (i.e., non-blocking * operation) has been specified. * - * @coretags{primary-only, might-switch} + * @coretags{primary-timed, might-switch} */ int rtdm_event_timedwait(rtdm_event_t *event, nanosecs_rel_t timeout, rtdm_toseq_t *timeout_seq) @@ -867,7 +867,7 @@ int rtdm_event_timedwait(rtdm_event_t *event, nanosecs_rel_t timeout, int err = 0, ret; spl_t s; - if (!XENO_ASSERT(COBALT, !xnsched_unblockable_p())) + if (!XENO_ASSERT(COBALT, timeout < 0 || !xnsched_unblockable_p())) return -EPERM; trace_cobalt_driver_event_wait(event, xnthread_current()); @@ -1091,7 +1091,7 @@ EXPORT_SYMBOL_GPL(rtdm_sem_down); * - -EPERM @e may be returned if an illegal invocation environment is * detected. * - * @coretags{primary-only, might-switch} + * @coretags{primary-timed, might-switch} */ int rtdm_sem_timeddown(rtdm_sem_t *sem, nanosecs_rel_t timeout, rtdm_toseq_t *timeout_seq) @@ -1100,7 +1100,7 @@ int rtdm_sem_timeddown(rtdm_sem_t *sem, nanosecs_rel_t timeout, int err = 0, ret; spl_t s; - if (!XENO_ASSERT(COBALT, !xnsched_unblockable_p())) + if (!XENO_ASSERT(COBALT, timeout < 0 || !xnsched_unblockable_p())) return -EPERM; trace_cobalt_driver_sem_wait(sem, xnthread_current()); _______________________________________________ Xenomai-git mailing list Xenomai-git@xenomai.org https://xenomai.org/mailman/listinfo/xenomai-git