PxMbxRequest()
Request a mailbox handle.
- APPLIES TO
-
1.0.0
- SYNOPSIS
-
PxMbx_t PxMbxRequest (PxOpool_t opoolid); - ARGUMENTS
|
- RETURN VALUES
-
-
Valid mailbox object handle on success
-
Invalid mailbox object handle on failure
-
- ERROR CODES
-
PXERR_ACCESS_RIGHTThe calling task has not the right to access the object pool
PXERR_OPOOL_ILLOPOOLopoolidis not a valid object poolPXERR_OBJ_ABORTEDRequest aborted by an event
PXERR_MBX_ILLMBXInvalid mailbox in mailbox command
PXERR_EVENT_ZEROThe given event mask is zero
PXERR_GLOBAL_ILLEGAL_COREThe requested object pool is not on the same core
PXERR_OBJ_NOOBJNo free object is available
PXERR_OBJ_ILLOBJThe passed object handle is not valid
PXERR_INTERNAL_INCONSISTENCYInconsistency of internal structures
- DESCRIPTION
-
The
PxMbxRequestfunction creates a mailbox object by converting a free object from object poolopool. The object handle is returned. If there is no free object available, thePxMbxRequestwaits until a free object is available.
- 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 of
opoolidmay 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.
-
- After call
-
-
The returned value is the id of type
PxMbx_t. This id may be checked with one of the following macros:-
PxMbxIdIsValid()must be true. -
PxMbxIdGet()must not be_PXIllegalObjId. -
PxMbxIdError()must bePXERR_NOERRORotherwise the returned error code has to be interpreted (C).
-
-
- Best Practice
-
-
PxMbxRequestmay block, if no PXROS-HR object is available. If blocking calls are prohibited,PxMbxRequest_NoWaitshould be used instead. -
PxMbxRequestshould only be called during initialization to ensure the availability of the mailbox object.
-
- SEE ALSO
- USAGE
-
#include "pxdef.h" PxMbx_t Mbx = PxMbxRequest(opoolid); if (PxMbxIdError(Mbx) != PXERR_NOERROR) { // Report error }