git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4669 35acf78f-673a-0410-8e92-d51de3d6d3f4
parent
1824750b9f
commit
6d730a713c
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue