diff --git a/os/rt/include/chevents.h b/os/rt/include/chevents.h index 1ff0871c7..fa8e4d7a5 100644 --- a/os/rt/include/chevents.h +++ b/os/rt/include/chevents.h @@ -37,6 +37,14 @@ /* Module constants. */ /*===========================================================================*/ +/** + * @brief Event bit reserved for thread termination request. + * @note The most significant bit of the events mask is conventionally + * used for thread termination but it can eventually be used for + * other events. + */ +#define CH_EVENT_TERMINATE ~(((eventmask_t)-1) >> 1U) + /*===========================================================================*/ /* Module pre-compile time settings. */ /*===========================================================================*/ @@ -256,6 +264,19 @@ static inline void chEvtBroadcastI(event_source_t *esp) { chEvtBroadcastFlagsI(esp, (eventflags_t)0); } +/** + * @brief Returns the events mask. + * @details The pending events mask is returned but not altered in any way. + * + * @return The pending events mask. + * + * @api + */ +static inline eventmask_t chEvtGetEventsX(void) { + + return currp->epending; +} + #endif /* CH_CFG_USE_EVENTS == TRUE */ #endif /* _CHEVENTS_H_ */ diff --git a/os/rt/src/chevents.c b/os/rt/src/chevents.c index 87e9ba90e..ef2bd1739 100644 --- a/os/rt/src/chevents.c +++ b/os/rt/src/chevents.c @@ -155,7 +155,7 @@ void chEvtUnregister(event_source_t *esp, event_listener_t *elp) { * @brief Clears the pending events specified in the events mask. * * @param[in] events the events to be cleared - * @return The pending events that were cleared. + * @return The mask of pending events that were cleared. * * @api */ @@ -175,7 +175,7 @@ eventmask_t chEvtGetAndClearEvents(eventmask_t events) { * @b much faster than using @p chEvtBroadcast() or @p chEvtSignal(). * * @param[in] events the events to be added - * @return The current pending events. + * @return The mask of currently pending events. * * @api */