PxPeRequest_EvWait()
Request a periodic event object while waiting for events.
- APPLIES TO
-
1.0.0
- SYNOPSIS
-
PxPe_t PxPeRequest_EvWait (PxOpool_t OpoolId, PxTicks_t period, PxEvents_t events, PxEvents_t abortevents); - ARGUMENTS
|
|
|
|
|
|
|
- RETURN VALUES
-
-
Invalid periodic event object on failure
-
Periodic event object on success
-
Events, if request aborted by an event
-
- ERROR CODES
-
PXERR_ACCESS_RIGHTThe calling task has not the right to access the object pool
PXERR_OPOOL_ILLOPOOLThe passed object pool handle is not valid
PXERR_GLOBAL_ILLEGAL_COREThe requested object pool is not on the same core
PXERR_OBJ_ABORTEDThe request was aborted by an event
PXERR_OBJ_NOOBJNo free object is available
PXERR_OBJ_ILLOBJThe passed object handle is not valid
PXERR_EVENT_ZEROThe given event mask is zero
PXERR_PE_ILLPEThe given object is not a periodic event object
PXERR_INTERNAL_INCONSISTENCYInconsistency of internal structures
- DESCRIPTION
-
PxPeRequest_EvWaitcreates and initializes a periodic event object, which is returned. It is associated with period PXROS ticks and events which are signaled periodically. Signaling is active after the periodic event is started withPxPeStart. It is necessary to finish up withPxPeRelease, when the periodic event is no longer used. If there is no free object available, thePxPeRequest_EvWaitwaits until a free object is available or until an event from mask of events arrives.
- IMPLEMENTATION GUIDELINES
-
- Before call
-
-
OpoolIdmust be a valid PXROS-HR object pool and the calling task must have the access right to take objects from this object pool (V). The validity ofOpoolIdmay also be checked by thePxOpoolIsValidmacro (F). The object pool must be created on the same core as the caller runs on. The creator core id can be read with the macroPxOpoolCoreIdand the own core id withPxGetCoreId(C). Typically the task’s default object poolPXOpoolTaskdefaultis used for this purpose. -
The
periodparameter must have a plausible value. It should be a constant or the result of aPxTickGetTicksFromMilliSecondscall (V); -
The parameter
eventscontains an event bit and should not be zero. Typically the event is a constant (V). -
The parameter
aborteventscontains a bitmask of events awaited and should not be zero. Typically the event mask is a constant (V).
-
- After call
-
-
The returned value is a structure of type
PxPeEvent_t. The received events are stored in theeventspart, the delay id is given in thepepart of the structure. This id may be checked with one of the following macros:-
PxPeIdIsValid()must be true. -
PxPeIdGet()must not be_PXIllegalObjId. -
PxPeIdError()must bePXERR_NOERRORotherwise the returned error code has to be interpreted (C).
-
-
- Best Practice
-
-
PxPeRequest_EvWaitmay block, if no PXROS-HR object is available and no instance (task or handler) sends an event. If blocking calls are prohibited,PxPeRequest_NoWaitshould be used instead or the call should be monitored by the PXROS-HRPxTomechanism. -
PxPeRequest_EvWaitshould only be called during initialization to ensure the availability of the periodic event object.
-
- SEE ALSO
- USAGE
-
#include "pxdef.h" #define MY_EVENT 0x1l #define TICKS 0x1l PxPeEvent_t Pe = PxPeRequest_EvWait(OpoolId, TICKS, MY_EVENT, AbortEv); if (PxPeIdError(Pe) != PXERR_NOERROR) { // Report error }