PxMcTakeBlk()
Take a block from memory class.
- APPLIES TO
-
1.0.0
- SYNOPSIS
-
PxMptr_t PxMcTakeBlk (PxMc_t mcid, PxSize_t size); - ARGUMENTS
|
|
|
- RETURN VALUES
-
-
Start address of block on success
-
Null pointer on failure
-
- ERROR CODES
-
PXERR_MC_ILLMCmcidis not a valid memory classPXERR_MC_NOMEMNot enough memory in the memory class to satisfy the request
PXERR_ACCESS_RIGHTThe calling task has not the right to access the memory class
PXERR_MC_USE_BUDDY_FOR_MSG_ONLYBuddy memory classes must only be used for messages
PXERR_GLOBAL_ILLEGAL_COREThe requested memory class is not on the same core
PXERR_MC_ILLTYPEIllegal MC type for
PxMcTakeBlkPXERR_INIT_ILLMCTYPEThe type for
PXMcSystemdefaultis different fromPXMcVarsized,PXMcVarsizedAdjustedandPXMcVarsizedAlignedPXERR_MC_DAMAGED_BLOCKThe block in the memory class has been damaged
PXERR_MC_INCONSISTENCYInconsistency in memory class:
blkPXERR_MC_ILLALIGNInvalid memory block or size alignment in memory insert
PXERR_MC_ILLSIZEInsufficient block size
PXERR_REQUEST_ABORTEDRequest aborted
PXERR_MC_SIZETOOBIGFixed block size too small to satisfy the request
PXERR_UNSUPPORTED_MCTYPEmc is not supported (If
mcidcorresponds toPXMcVarsized,PXMcVarsizedAligned,PXMcVarsizedAdjusted) - DESCRIPTION
-
PxMcTakeBlktakes a block of a size no less than size (specified in byte units) frommcidand returns its address.
- 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). -
sizemust be a plausible value given as a constant (V) or a variable (C).
-
- After call
-
-
PxMcTakeBlkreturns a null pointer on failure (C).
-
- Best Practice
-
-
PxMcTakeBlkshould 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 }