PxMsgRequest_NoWait()
Create a message object together with data area with immediate return.
- APPLIES TO
-
8.2.0
- SYNOPSIS
-
PxMsg_t PxMsgRequest_NoWait (PxSize_t msgsize, PxMc_t McId, PxOpool_t OpoolId);
- ARGUMENTS
|
|
|
|
|
- RETURN VALUES
-
-
Valid message handle on success
-
Invalid message handle on failure
-
- ERROR CODES
-
PXERR_OPOOL_ILLOPOOL
The passed object pool handle is invalid
PXERR_MC_ILLMC
The passed memory class handle is invalid
PXERR_MC_NOMEM
Not enough memory
PXERR_ACCESS_RIGHT
The calling task has not the right to access the object pool or the memory class
PXERR_GLOBAL_ILLEGAL_CORE
The passed memory class is not on the same core
PXERR_OBJ_NOOBJ
No free object is available
PXERR_EVENT_ZERO
The given event mask is zero
PXERR_OBJ_ABORTED
Request aborted by an event
PXERR_OBJ_ILLOBJ
The passed object handle is not valid
PXERR_MC_ILLTYPE
Illegal MC type
PXERR_MC_SIZETOOBIG
Fixed block size too small to satisfy the request
PXERR_INIT_ILLMCTYPE
The type for PXMcSystemdefault is different from PXMcVarsized, PXMcVarsizedAdjusted and PXMcVarsizedAligned
PXERR_REQUEST_ABORTED
Request aborted
PXERR_MC_DAMAGED_BLOCK
The block in the memory class has been damaged
PXERR_MC_INCONSISTENCY
Inconsistency in memory class: blk
PXERR_MC_ILLSIZE
Insufficient block size
PXERR_MC_ILLALIGN
Invalid memory block or size alignment in memory insert
PXERR_INTERNAL_INCONSISTENCY
Inconsistency of internal structures
- DESCRIPTION
-
PxMsgRequest_NoWait function creates a messages with a data area of size msgsize specified in byte units. The data area is taken from memory class mc, and the message structure is taken from object pool opool. The message object handle is returned. If there is no free object available, the PxMsgRequest_NoWait immediately returns with error code PXERR_OBJ_NOOBJ.
The calling task becomes the (permanent) owner and the (temporary) user of the message created. The call also fails, if the memory class does not contain sufficient memory to meet the request. A fatal PXROS error occurs, if mc is fixsized and its block size is smaller than msgsize. If msgsize is zero, no data buffer is requested. Only the metadata of the message can be used.
- IMPLEMENTATION GUIDELINES
-
- Before call
-
-
msgsize
must be a plausible value given as a constant (V) or a variable (C). -
McId
must be a valid PXROS-HR memory class and the calling task must have the access right to take memory from this memory class (V). The validity ofMcId
may also be checked by thePxMcIsValid
macro (F). The memory class must be created on the same core as the caller runs on. The creator core id can be read with the macroPxMcCoreId
and the own core id withPxGetCoreId
(C). Typically the task’s default memory classPXMcTaskdefault
is used for this purpose. -
OpoolId
must 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 ofOpoolId
may also be checked by thePxOpoolIsValid
macro (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 macroPxOpoolCoreId
and the own core id withPxGetCoreId
(C). Typically the task’s default object poolPXOpoolTaskdefault
is used for this purpose.
-
- After call
-
-
The returned value is the id of type
PxMsg_t
. This id may be checked with one of the following macros:-
PxMsgIdIsValid()
must be true. -
PxMsgIdGet()
must not be_PXIllegalObjId
. -
PxMsgIdError()
must bePXERR_NOERROR
otherwise the returned error code has to be interpreted (C).
-
-
- Best Practice
-
-
No restrictions.
-
- SEE ALSO
- USAGE
-
#include "pxdef.h" PxMsg_t msgHnd = PxMsgRequest_NoWait(64, McId, OpoolId) if (PxMsgIdIsValid (msgHnd)) { // Handle message } else { // Report error }