PxMcInsertBlk()
Insert a new block into a memory class.
- APPLIES TO
-
8.2.0
- SYNOPSIS
-
PxError_t PxMcInsertBlk (PxMc_t McId, PxMptr_t blk, PxSize_t size); - ARGUMENTS
|
|
|
|
|
- RETURN VALUES
-
-
PXROS error code
-
- ERROR CODES
-
PXERR_ACCESS_RIGHTThe calling task has not the right to access the memory class
PXERR_MC_ILLMCmc is not a valid memory class object
PXERR_GLOBAL_ILLEGAL_COREThe requested memory class is not on the same core
PXERR_MC_ILLSIZEsizeis less than the required minimum size or not a power of 2 (for Buddy memory class)PXERR_MC_ILLALIGNblkaddress is not properly alignedPXERR_INIT_ILLMCTYPEThe type for
PXMcSystemdefaultis different fromPXMcVarsized,PXMcVarsizedAdjustedandPXMcVarsizedAlignedPXERR_MC_DAMAGED_BLOCKThe block in memory class has been damaged
PXERR_MC_INCONSISTENCYInconsistency in memory class:
blk - DESCRIPTION
-
PxMcInsertBlkinserts a new block of the size size into the memory class mc.
- IMPLEMENTATION GUIDELINES
-
- Before call
-
-
McIdmust be:-
a valid PXROS-HR memory class created with a
PxMcRequestcall (V). The validity ofMcIdmay also be checked by thePxMcIsValidmacro (F). -
the symbolic value
PXMcSystemdefaultspecifying the system memory class (V) -
the symbolic value
PXMcTaskdefaultspecifying 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
PxMcCoreIdand the own core id withPxGetCoreId(C). -
blkmust be a valid memory pointer. The memory must be an area, which has never been part of a memory class or it has to be removed from a memory class withPxMcRemoveBlk. -
sizemust be a plausible value given as a constant (V) or as a result of aPxMcRemoveBlkcall (parameter*Size(V).
-
- After call
-
-
The function returns
PXERR_NOERRORif the memory block has been inserted into the memory class. Any other return value describes an error, which has to be interpreted. (C)
-
- Best Practice
-
-
PxMcInsertBlkshould only be called during initialization to ensure the availability of the memory in a memory class.
-
- SEE ALSO
- USAGE
-
#include "pxdef.h" PxError_t Err = PxMcInsertBlk(mcId, (PxMptr_t)memoryTask, MEMORY_SIZE_TASK);; if (Err != PXERR_NOERROR) { // Report error }