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_RIGHT
The calling task has not the right to access the memory class
PXERR_MC_ILLMC
mc is not a valid memory class object
PXERR_GLOBAL_ILLEGAL_CORE
The requested memory class is not on the same core
PXERR_MC_ILLSIZE
size
is less than the required minimum size or not a power of 2 (for Buddy memory class)PXERR_MC_ILLALIGN
blk
address is not properly alignedPXERR_INIT_ILLMCTYPE
The type for PXMcSystemdefault is different from PXMcVarsized, PXMcVarsizedAdjusted and PXMcVarsizedAligned
PXERR_MC_DAMAGED_BLOCK
The block in memory class has been damaged
PXERR_MC_INCONSISTENCY
Inconsistency in memory class:
blk
- DESCRIPTION
-
PxMcInsertBlk inserts a new block of the size size into the memory class mc.
- 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
specifying 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). -
blk
must 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
. -
size
must be a plausible value given as a constant (V) or as a result of aPxMcRemoveBlk
call (parameter*Size
(V).
-
- After call
-
-
The function returns
PXERR_NOERROR
if 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
-
-
PxMcInsertBlk
should 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 }