aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--os/kernel/include/chevents.h8
-rw-r--r--os/kernel/src/chevents.c111
2 files changed, 60 insertions, 59 deletions
diff --git a/os/kernel/include/chevents.h b/os/kernel/include/chevents.h
index fd52b8de9..04f435f1a 100644
--- a/os/kernel/include/chevents.h
+++ b/os/kernel/include/chevents.h
@@ -169,14 +169,14 @@ extern "C" {
EventListener *elp,
eventmask_t mask);
void chEvtUnregister(EventSource *esp, EventListener *elp);
- eventmask_t chEvtClearFlags(eventmask_t mask);
- eventmask_t chEvtAddFlags(eventmask_t mask);
+ eventmask_t chEvtGetAndClearEvents(eventmask_t mask);
+ eventmask_t chEvtAddEvents(eventmask_t mask);
+ flagsmask_t chEvtGetAndClearFlags(EventListener *elp);
+ flagsmask_t chEvtGetAndClearFlagsI(EventListener *elp);
void chEvtSignal(Thread *tp, eventmask_t mask);
void chEvtSignalI(Thread *tp, eventmask_t mask);
void chEvtBroadcastFlags(EventSource *esp, flagsmask_t flags);
void chEvtBroadcastFlagsI(EventSource *esp, flagsmask_t flags);
- flagsmask_t chEvtGetAndClearFlags(EventListener *elp);
- flagsmask_t chEvtGetAndClearFlagsI(EventListener *elp);
void chEvtDispatch(const evhandler_t *handlers, eventmask_t mask);
#if CH_OPTIMIZE_SPEED || !CH_USE_EVENTS_TIMEOUT
eventmask_t chEvtWaitOne(eventmask_t mask);
diff --git a/os/kernel/src/chevents.c b/os/kernel/src/chevents.c
index bb948ab52..2d0e1ab93 100644
--- a/os/kernel/src/chevents.c
+++ b/os/kernel/src/chevents.c
@@ -126,7 +126,7 @@ void chEvtUnregister(EventSource *esp, EventListener *elp) {
*
* @api
*/
-eventmask_t chEvtClearFlags(eventmask_t mask) {
+eventmask_t chEvtGetAndClearEvents(eventmask_t mask) {
eventmask_t m;
chSysLock();
@@ -147,7 +147,7 @@ eventmask_t chEvtClearFlags(eventmask_t mask) {
*
* @api
*/
-eventmask_t chEvtAddFlags(eventmask_t mask) {
+eventmask_t chEvtAddEvents(eventmask_t mask) {
chSysLock();
@@ -158,6 +158,60 @@ eventmask_t chEvtAddFlags(eventmask_t mask) {
}
/**
+ * @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 EventSource in addition to the event
+ * flags specified by the threads themselves in the
+ * @p EventListener 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 EventSource structure
+ * @param[in] flags the flags set to be added to the listener flags mask
+ *
+ * @iclass
+ */
+void chEvtBroadcastFlagsI(EventSource *esp, flagsmask_t flags) {
+ EventListener *elp;
+
+ chDbgCheckClassI();
+ chDbgCheck(esp != NULL, "chEvtBroadcastMaskI");
+
+ elp = esp->es_next;
+ while (elp != (EventListener *)esp) {
+ elp->el_flags |= flags;
+ chEvtSignalI(elp->el_listener, elp->el_mask);
+ elp = elp->el_next;
+ }
+}
+
+/**
+ * @brief Returns the flags associated to an @p EventListener.
+ * @details The flags are returned and the @p EventListener flags mask is
+ * cleared.
+ *
+ * @param[in] elp pointer to the @p EventListener structure
+ * @return The flags added to the listener by the associated
+ * event source.
+ *
+ * @iclass
+ */
+flagsmask_t chEvtGetAndClearFlags(EventListener *elp) {
+ flagsmask_t flags;
+
+ chSysLock();
+
+ flags = elp->el_flags;
+ elp->el_flags = 0;
+
+ chSysUnlock();
+ return flags;
+}
+
+/**
* @brief Adds a set of event flags directly to specified @p Thread.
*
* @param[in] tp the thread to be signaled
@@ -223,59 +277,6 @@ void chEvtBroadcastFlags(EventSource *esp, flagsmask_t flags) {
}
/**
- * @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 EventSource in addition to the event
- * flags specified by the threads themselves in the
- * @p EventListener 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 EventSource structure
- * @param[in] flags the flags set to be added to the listener flags mask
- *
- * @iclass
- */
-void chEvtBroadcastFlagsI(EventSource *esp, flagsmask_t flags) {
- EventListener *elp;
-
- chDbgCheckClassI();
- chDbgCheck(esp != NULL, "chEvtBroadcastMaskI");
-
- elp = esp->es_next;
- while (elp != (EventListener *)esp) {
- elp->el_flags |= flags;
- chEvtSignalI(elp->el_listener, elp->el_mask);
- elp = elp->el_next;
- }
-}
-
-/**
- * @brief Returns the flags associated to an @p EventListener.
- * @details The flags are returned and the @p EventListener flags mask is
- * cleared.
- *
- * @param[in] elp pointer to the @p EventListener structure
- * @return The flags added to the listener by the associated
- * event source.
- *
- * @iclass
- */
-flagsmask_t chEvtGetAndClearFlags(EventListener *elp) {
- flagsmask_t flags;
-
- chSysLock();
- flags = elp->el_flags;
- elp->el_flags = 0;
- chSysUnlock();
-
- return flags;
-}
-
-/**
* @brief Returns the flags associated to an @p EventListener.
* @details The flags are returned and the @p EventListener flags mask is
* cleared.