Added chEvtRegisterMaskWithFlagsI().
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@14512 27425a3e-05d8-49a3-a47f-9c15f0e5edd8
This commit is contained in:
parent
5eb44d6c8e
commit
fb572f9842
|
@ -120,6 +120,10 @@ typedef void (*evhandler_t)(eventid_t id);
|
|||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
void chEvtRegisterMaskWithFlagsI(event_source_t *esp,
|
||||
event_listener_t *elp,
|
||||
eventmask_t events,
|
||||
eventflags_t wflags);
|
||||
void chEvtRegisterMaskWithFlags(event_source_t *esp,
|
||||
event_listener_t *elp,
|
||||
eventmask_t events,
|
||||
|
|
|
@ -98,23 +98,47 @@
|
|||
* the event source is broadcasted
|
||||
* @param[in] wflags mask of flags the listening thread is interested in
|
||||
*
|
||||
* @api
|
||||
* @iclass
|
||||
*/
|
||||
void chEvtRegisterMaskWithFlags(event_source_t *esp,
|
||||
event_listener_t *elp,
|
||||
eventmask_t events,
|
||||
eventflags_t wflags) {
|
||||
void chEvtRegisterMaskWithFlagsI(event_source_t *esp,
|
||||
event_listener_t *elp,
|
||||
eventmask_t events,
|
||||
eventflags_t wflags) {
|
||||
thread_t *currtp = chThdGetSelfX();
|
||||
|
||||
chDbgCheckClassI();
|
||||
chDbgCheck((esp != NULL) && (elp != NULL));
|
||||
|
||||
chSysLock();
|
||||
elp->next = esp->next;
|
||||
esp->next = elp;
|
||||
elp->listener = currtp;
|
||||
elp->events = events;
|
||||
elp->flags = (eventflags_t)0;
|
||||
elp->wflags = wflags;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Registers an Event Listener on an Event Source.
|
||||
* @details Once a thread has registered as listener on an event source it
|
||||
* will be notified of all events broadcasted there.
|
||||
* @note Multiple Event Listeners can specify the same bits to be ORed to
|
||||
* different threads.
|
||||
*
|
||||
* @param[in] esp pointer to the @p event_source_t structure
|
||||
* @param[in] elp pointer to the @p event_listener_t structure
|
||||
* @param[in] events events to be ORed to the thread when
|
||||
* the event source is broadcasted
|
||||
* @param[in] wflags mask of flags the listening thread is interested in
|
||||
*
|
||||
* @api
|
||||
*/
|
||||
void chEvtRegisterMaskWithFlags(event_source_t *esp,
|
||||
event_listener_t *elp,
|
||||
eventmask_t events,
|
||||
eventflags_t wflags) {
|
||||
|
||||
chSysLock();
|
||||
chEvtRegisterMaskWithFlagsI(esp, elp, events, wflags);
|
||||
chSysUnlock();
|
||||
}
|
||||
|
||||
|
@ -164,6 +188,8 @@ eventmask_t chEvtGetAndClearEventsI(eventmask_t events) {
|
|||
thread_t *currtp = chThdGetSelfX();
|
||||
eventmask_t m;
|
||||
|
||||
chDbgCheckClassI();
|
||||
|
||||
m = currtp->epending & events;
|
||||
currtp->epending &= ~events;
|
||||
|
||||
|
|
Loading…
Reference in New Issue