aboutsummaryrefslogtreecommitdiffstats
path: root/src/include/events.h
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2008-11-09 09:31:17 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2008-11-09 09:31:17 +0000
commit87d83b1b7e37925f3e32e79e6e6baedb5b13f192 (patch)
tree73d13319bf5c932567f1595fe3c45ab35a068b0e /src/include/events.h
parent5c923f28ba42e30761f622db2597b2710a7674a5 (diff)
downloadChibiOS-87d83b1b7e37925f3e32e79e6e6baedb5b13f192.tar.gz
ChibiOS-87d83b1b7e37925f3e32e79e6e6baedb5b13f192.tar.bz2
ChibiOS-87d83b1b7e37925f3e32e79e6e6baedb5b13f192.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@504 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'src/include/events.h')
-rw-r--r--src/include/events.h21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/include/events.h b/src/include/events.h
index 6a6b9e41e..ae5d8c740 100644
--- a/src/include/events.h
+++ b/src/include/events.h
@@ -40,8 +40,8 @@ struct EventListener {
EventListener *el_next;
/** Thread interested in the Event Source.*/
Thread *el_listener;
- /** Event identifier associated by the thread to the Event Source.*/
- eventid_t el_id;
+ /** Event flags mask associated by the thread to the Event Source.*/
+ eventmask_t el_mask;
};
/**
@@ -70,7 +70,7 @@ typedef struct EventSource {
* @note Can be called with interrupts disabled or enabled.
*/
#define chEvtIsListening(esp) \
- ((esp) != (EventListener *)(void *)(esp)->es_next)
+ ((void *)(esp) != (void *)(esp)->es_next)
/** Event Handler callback function.*/
@@ -79,7 +79,7 @@ typedef void (*evhandler_t)(eventid_t);
#ifdef __cplusplus
extern "C" {
#endif
- void chEvtRegister(EventSource *esp, EventListener *elp, eventid_t eid);
+ void chEvtRegisterMask(EventSource *esp, EventListener *elp, eventmask_t emask);
void chEvtUnregister(EventSource *esp, EventListener *elp);
eventmask_t chEvtClear(eventmask_t mask);
eventmask_t chEvtPend(eventmask_t mask);
@@ -104,6 +104,19 @@ extern "C" {
}
#endif
+/**
+ * Registers an Event Listener on an Event Source.
+ * @param esp pointer to the \p EventSource structure
+ * @param elp pointer to the \p EventListener structure
+ * @param eid numeric identifier assigned to the Event Listener. The identifier
+ * is used as index for the event callback function.
+ * The value must range between zero and the size, in bit, of the
+ * \p eventid_t type minus one.
+ * @note Multiple Event Listeners can use the same event identifier, the
+ * listener will share the callback function.
+ */
+#define chEvtRegister(esp, elp, eid) chEvtRegisterMask(esp, elp, EventMask(eid))
+
#if !defined(CH_OPTIMIZE_SPEED) && defined(CH_USE_EVENT_TIMEOUT)
#define chEvtWaitOne(ewmask) chEvtWaitOneTimeout(ewmask, TIME_INFINITE)
#define chEvtWaitAny(ewmask) chEvtWaitAnyTimeout(ewmask, TIME_INFINITE)