From 7b941c2420b266dab562e010a60674e388d42c5f Mon Sep 17 00:00:00 2001 From: Giovanni Di Sirio Date: Wed, 4 Oct 2017 08:11:39 +0000 Subject: Added new function chEvtGetAndClearEventsI(). git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@10760 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/rt/include/chevents.h | 1 + os/rt/src/chevents.c | 20 ++++++++++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) (limited to 'os') diff --git a/os/rt/include/chevents.h b/os/rt/include/chevents.h index a01c6d71e..8b14ed112 100644 --- a/os/rt/include/chevents.h +++ b/os/rt/include/chevents.h @@ -125,6 +125,7 @@ extern "C" { eventmask_t events, eventflags_t wflags); void chEvtUnregister(event_source_t *esp, event_listener_t *elp); + eventmask_t chEvtGetAndClearEventsI(eventmask_t events); eventmask_t chEvtGetAndClearEvents(eventmask_t events); eventmask_t chEvtAddEvents(eventmask_t events); eventflags_t chEvtGetAndClearFlags(event_listener_t *elp); diff --git a/os/rt/src/chevents.c b/os/rt/src/chevents.c index 4f318960a..63740d50b 100644 --- a/os/rt/src/chevents.c +++ b/os/rt/src/chevents.c @@ -151,6 +151,23 @@ void chEvtUnregister(event_source_t *esp, event_listener_t *elp) { chSysUnlock(); } +/** + * @brief Clears the pending events specified in the events mask. + * + * @param[in] events the events to be cleared + * @return The mask of pending events that were cleared. + * + * @iclass + */ +eventmask_t chEvtGetAndClearEventsI(eventmask_t events) { + eventmask_t m; + + m = currp->epending & events; + currp->epending &= ~events; + + return m; +} + /** * @brief Clears the pending events specified in the events mask. * @@ -163,8 +180,7 @@ eventmask_t chEvtGetAndClearEvents(eventmask_t events) { eventmask_t m; chSysLock(); - m = currp->epending & events; - currp->epending &= ~events; + m = chEvtGetAndClearEventsI(events); chSysUnlock(); return m; -- cgit v1.2.3