From 6d730a713cac352e97f868ac08b05169cffb2a82 Mon Sep 17 00:00:00 2001
From: gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>
Date: Sun, 16 Sep 2012 08:39:30 +0000
Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4669
 35acf78f-673a-0410-8e92-d51de3d6d3f4

---
 os/kernel/include/chevents.h |   8 ++--
 os/kernel/src/chevents.c     | 111 ++++++++++++++++++++++---------------------
 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();
 
@@ -157,6 +157,60 @@ eventmask_t chEvtAddFlags(eventmask_t mask) {
   return 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.
  *
@@ -222,59 +276,6 @@ void chEvtBroadcastFlags(EventSource *esp, flagsmask_t flags) {
   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 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
-- 
cgit v1.2.3