PxSysInfoGetMCInfo()

Function to get memory class info.

APPLIES TO

8.2.0

SYNOPSIS
PxError_t PxSysInfoGetMCInfo (PxInfoMC_t *MCInfo, PxMc_t McId);
ARGUMENTS
MCInfo

Pointer to data area to store memory class information to

McId

Id of memory class object

RETURN VALUES
  • PXROS error code

ERROR CODES

PXERR_MC_ILLMC

The given object is not a memory class object

PXERR_PROT_PERMISSION

The task has no write permission on the MCInfo object

PXERR_SERVICE_NOT_CONFIGURED

MONITOR_OBJECTS is not configured

PXERR_GLOBAL_ILLEGAL_CORE

The requested object pool is not on the same core

DESCRIPTION

PxSysInfoGetMCInfo stores the memory class type (fix/var), the free memory and the lowest capacity of the memory class McId into the info structure MCInfo. In fixsized memory classes PxInfoMC_FreeMem and PxInfoMC_MinCapacity represent the number of blocks, in varsized memory classes the number of bytes.

The structure MCInfo has the following format:

typedef struct
{
	PxInfoMCType_t PxInfoMC_Type; // memory class type
	PxUChar_t *PxInfoMC_FirstBlock; // first memory block in memory class
	PxULong_t PxInfoMC_FreeMem; // free memory in memory class
	PxULong_t PxInfoMC_MinCapacity; // minimal capacity of memory class
	PxTask_t PxInfoMC_RequestingTask; // task, which requested the memory class
} PxInfoMC_t;

The memory class McId may have one of the following types:

typedef enum
{
	MCType_FixSized,
	MCType_VarSized
} PxInfoMCType_t;

There is a union available containing all sysinfo types:

typedef union
{
	PxInfoMC_t  McInfo; // memory class information struct
	PxInfoOpool_t  OpoolInfo; // Opool information struct
	PxInfoMsg_t  MsgInfo; // message information struct
	PxInfoMbx_t  MbxInfo; // mailbox information struct
	PxInfoDelay_t  DelayInfo; // delay object information struct
	PxInfoPe_t  PeInfo; // periodic event information struct
	PxInfoTo_t  ToInfo; // timeout object information struct
	PxInfoInterrupt_t  InterruptInfo; // interrupt object information struct
} PxObjInfo_T;
IMPLEMENTATION GUIDELINES
Before call
  • MCInfo must be a pointer to a valid data area.

  • McId must be:

    • a valid PXROS-HR memory class object created with a PxMcRequest call (V).

    • the symbolic value PXMcSystemdefault specifying the system memory class (V)

    • the symbolic value PXMcTaskdefault specifying the task’s memory class (V)

  • The validity of McId may also be checked by the PxMcIsValid macro (F).

After call
  • The function returns PXERR_NOERROR if the system information could be delivered. Any other return value describes an error, which has to be interpreted (C).

Best Practice
  • No restrictions

SEE ALSO
USAGE
#include "pxdef.h"

PxError_t err = PxSysInfoGetMCInfo(&McInfo, mcId);

if (err == PXERR_NOERROR) {
    // Handle info
}
else {
    // Report error
}