From 8982ef30282a12aac15a47e9e173f00943a8022c Mon Sep 17 00:00:00 2001 From: Giovanni Di Sirio Date: Mon, 7 Jun 2021 12:11:49 +0000 Subject: [PATCH] git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@14514 27425a3e-05d8-49a3-a47f-9c15f0e5edd8 --- os/rt/src/chevents.c | 112 +++++++++++++++++++++---------------------- 1 file changed, 56 insertions(+), 56 deletions(-) diff --git a/os/rt/src/chevents.c b/os/rt/src/chevents.c index 024a34716..08f1c160f 100644 --- a/os/rt/src/chevents.c +++ b/os/rt/src/chevents.c @@ -233,44 +233,6 @@ eventmask_t chEvtAddEvents(eventmask_t events) { return newevt; } -/** - * @brief Signals all the Event Listeners registered on the specified Event - * Source. - * @details This function variants ORs the specified event flags to all the - * threads registered on the @p event_source_t in addition to the - * event flags specified by the threads themselves in the - * @p event_listener_t objects. - * @post This function does not reschedule so a call to a rescheduling - * function must be performed before unlocking the kernel. Note that - * interrupt handlers always reschedule on exit so an explicit - * reschedule must not be performed in ISRs. - * - * @param[in] esp pointer to the @p event_source_t structure - * @param[in] flags the flags set to be added to the listener flags mask - * - * @iclass - */ -void chEvtBroadcastFlagsI(event_source_t *esp, eventflags_t flags) { - event_listener_t *elp; - - chDbgCheckClassI(); - chDbgCheck(esp != NULL); - - elp = esp->next; - /*lint -save -e9087 -e740 [11.3, 1.3] Cast required by list handling.*/ - while (elp != (event_listener_t *)esp) { - /*lint -restore*/ - elp->flags |= flags; - /* When flags == 0 the thread will always be signaled because the - source does not emit any flag.*/ - if ((flags == (eventflags_t)0) || - ((flags & elp->wflags) != (eventflags_t)0)) { - chEvtSignalI(elp->listener, elp->events); - } - elp = elp->next; - } -} - /** * @brief Returns the unmasked flags associated to an @p event_listener_t. * @details The flags are returned and the @p event_listener_t flags mask is @@ -318,24 +280,6 @@ eventflags_t chEvtGetAndClearFlags(event_listener_t *elp) { return flags & elp->wflags; } -/** - * @brief Adds a set of event flags directly to the specified @p thread_t. - * - * @param[in] tp the thread to be signaled - * @param[in] events the events set to be ORed - * - * @api - */ -void chEvtSignal(thread_t *tp, eventmask_t events) { - - chDbgCheck(tp != NULL); - - chSysLock(); - chEvtSignalI(tp, events); - chSchRescheduleS(); - chSysUnlock(); -} - /** * @brief Adds a set of event flags directly to the specified @p thread_t. * @post This function does not reschedule so a call to a rescheduling @@ -364,6 +308,62 @@ void chEvtSignalI(thread_t *tp, eventmask_t events) { } } +/** + * @brief Adds a set of event flags directly to the specified @p thread_t. + * + * @param[in] tp the thread to be signaled + * @param[in] events the events set to be ORed + * + * @api + */ +void chEvtSignal(thread_t *tp, eventmask_t events) { + + chDbgCheck(tp != NULL); + + chSysLock(); + chEvtSignalI(tp, events); + chSchRescheduleS(); + chSysUnlock(); +} + +/** + * @brief Signals all the Event Listeners registered on the specified Event + * Source. + * @details This function variants ORs the specified event flags to all the + * threads registered on the @p event_source_t in addition to the + * event flags specified by the threads themselves in the + * @p event_listener_t objects. + * @post This function does not reschedule so a call to a rescheduling + * function must be performed before unlocking the kernel. Note that + * interrupt handlers always reschedule on exit so an explicit + * reschedule must not be performed in ISRs. + * + * @param[in] esp pointer to the @p event_source_t structure + * @param[in] flags the flags set to be added to the listener flags mask + * + * @iclass + */ +void chEvtBroadcastFlagsI(event_source_t *esp, eventflags_t flags) { + event_listener_t *elp; + + chDbgCheckClassI(); + chDbgCheck(esp != NULL); + + elp = esp->next; + /*lint -save -e9087 -e740 [11.3, 1.3] Cast required by list handling.*/ + while (elp != (event_listener_t *)esp) { + /*lint -restore*/ + elp->flags |= flags; + /* When flags == 0 the thread will always be signaled because the + source does not emit any flag.*/ + if ((flags == (eventflags_t)0) || + ((flags & elp->wflags) != (eventflags_t)0)) { + chEvtSignalI(elp->listener, elp->events); + } + elp = elp->next; + } +} + /** * @brief Signals all the Event Listeners registered on the specified Event * Source.