PxInterruptRequest_EvWait()
Request an interrupt object while waiting for events.
- APPLIES TO
-
1.0.0
- SYNOPSIS
-
PxInterrupt_t PxInterruptRequest_EvWait (PxOpool_t opoolid, PxEvents_t events); - ARGUMENTS
|
|
|
- RETURN VALUES
-
-
Valid interrupt object handle on success
-
Invalid interrupt object handle on failure
-
Events that aborted the request
-
- ERROR CODES
-
PXERR_OPOOL_ILLOPOOLopoolidis not a valid object poolPXERR_OBJ_ABORTEDRequest aborted by an event
PXERR_ACCESS_RIGHTThe calling task has not the right to access the object pool
PXERR_INTERRUPT_ILLINTERRUPTThe interrupt is not a valid interrupt object
PXERR_EVENT_ZEROThe given event mask is zero
PXERR_OBJ_NOOBJNo free object is available
PXERR_GLOBAL_ILLEGAL_COREThe requested object pool is not on the same core
PXERR_OBJ_ILLOBJThe passed object handle is not valid
PXERR_INTERNAL_INCONSISTENCYInconsistency of internal structures
- DESCRIPTION
-
The
PxInterruptRequest_EvWaitfunction creates an interrupt object by converting a free object from object poolopool. The object handle is returned. If there is no free object available,PxInterruptRequest_EvWaitwaits until either there is a free object or an event specified in the set events occurs.
- 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 parameter
eventscontains 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
PxInterruptEvent_t. The received events are stored in theeventspart, the interrupt object id is given in theinterruptpart of the structure. This id may be checked with one of the following macros:-
PxInterruptIdIsValid()must be true. -
PxInterruptIdGet()must not be_PXIllegalObjId. -
PxInterruptIdError()must bePXERR_NOERRORotherwise the returned error code has to be interpreted (C).
-
-
- Best Practice
-
-
PxInterruptRequest_EvWaitmay block, if no PXROS-HR object is available and no instance (task or handler) sends an event. If blocking calls are prohibited,PxInterruptRequest_NoWait()should be used instead or the call should be monitored by the PXROS-HRPxTomechanism. -
PxInterruptRequest_EvWaitshould only be called during initialization to ensure the availability of the interrupt object.
-
- SEE ALSO
- USAGE
-
#include "pxdef.h" #define MY_EVENT_MASK 0x1l PxInterrupt_t Interrupt = PxInterruptRequest_EvWait(opoolid, MY_EVENT_MASK); if (Interrupt & MY_EVENT_MASK) { // Handle interrupt object } else if (PxInterruptIdError(Interrupt) != PXERR_NOERROR){ // Report error }