PxMcTakeBlk()
Take a block from memory class.
- APPLIES TO
-
8.2.0
- SYNOPSIS
-
PxMptr_t PxMcTakeBlk (PxMc_t mcid, PxSize_t size);
- ARGUMENTS
|
|
|
- RETURN VALUES
-
-
Start adress of block on success
-
Null pointer on failure
-
- ERROR CODES
-
PXERR_MC_ILLMC
mcid
is not a valid memory classPXERR_MC_NOMEM
Not enough memory in the memory class to satisfy the request
PXERR_ACCESS_RIGHT
The calling task has not the right to access the memory class
PXERR_MC_USE_BUDDY_FOR_MSG_ONLY
Buddy memory classes must only be used for messages
PXERR_GLOBAL_ILLEGAL_CORE
The requested memory class is not on the same core
PXERR_MC_ILLTYPE
Illegal MC type for PxMcTakeBlk
PXERR_INIT_ILLMCTYPE
The type for PXMcSystemdefault is different from PXMcVarsized and PXMcVarsizedAdjusted
PXERR_MC_DAMAGED_BLOCK
The block in the memory class has been damaged
PXERR_MC_INCONSISTENCY
Inconsistency in memory class: blk
PXERR_MC_ILLALIGN
Invalid memory block or size alignment in memory insert
PXERR_MC_ILLSIZE
Insufficient block size
PXERR_REQUEST_ABORTED
Request aborted
PXERR_MC_SIZETOOBIG
Fixed block size too small to satisfy the request
- DESCRIPTION
-
PxMcTakeBlk takes a block of a size no less than size (specified in byte units) from mcid and returns its address.
- IMPLEMENTATION GUIDELINES
-
- Before call
-
-
mcid
must be:-
a valid PXROS-HR memory class created with a
PxMcRequest
call (V). The validity ofmcid
may also be checked by thePxMcIsValid
macro (F). -
the symbolic value
PXMcSystemdefault
specfying the system memory class (V) -
the symbolic value
PXMcTaskdefault
specifying the task’s memory class (V)
-
-
The memory class must be created on the same core as the caller runs on. The creator core id can be read with the macro
PxMcCoreId
and the own core id withPxGetCoreId
(C). -
size
must be a plausible value given as a constant (V) or a variable (C).
-
- After call
-
-
PxMcTakeBlk
returns a null pointer on failure (C).
-
- Best Practice
-
-
PxMcTakeBlk
should only be called during initialization to ensure the availability of the memory block.
-
- SEE ALSO
- USAGE
-
#include "pxdef.h" PxMptr_t Buf = PxMcTakeBlk(mcid, 16) if (Buf == NULL) { // Report error }