PxSysInfoGetMbxInfo()

Function to get mailbox info.

APPLIES TO

1.0.0

SYNOPSIS
PxError_t PxSysInfoGetMbxInfo (PxInfoMbx_t *MbxInfo, PxMbx_t mbxId);
ARGUMENTS
MbxInfo

Pointer to data area to store mailbox information to

mbxId

Id of mailbox object

RETURN VALUES
  • PXROS error code

ERROR CODES

PXERR_MBX_ILLMBX

The given object is not a mailbox object

PXERR_PROT_PERMISSION

The task has no write permission on the MbxInfo object

DESCRIPTION

PxSysInfoGetMbxInfo stores the number of prio/normal messages in the mailbox mbxId and the number of tasks waiting at this mailbox into the info structure MbxInfo.

The structure of the MbxInfo has the following format:

typedef struct
{
	PxULong_t PxInfoMbx_NormalMsgs; // number of normal messages in mailbox
	PxMsg_t   PxInfoMbx_FirstNormalMsg; // first normal message in mailbox
	PxULong_t PxInfoMbx_PrioMsgs; // number of prioritized messages in mailbox
	PxMsg_t   PxInfoMbx_FirstPrioMsg; // first prioritized message in mailbox
	PxULong_t PxInfoMbx_WaitingTasks; // number of tasks waiting at this mailbox
	PxTask_t  PxInfoMbx_FirstWaitingTask; // first waiting task
	PxTask_t  PxInfoMbx_RequestingTask; // task, which requested the mailbox
} PxInfoMbx_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
  • MbxInfo must be a pointer to a valid data area.

  • mbxId must be a valid PXROS-HR mailbox object created with a PxMbxRequest call or the task’s private mailbox (V). The validity of mbxId may also be checked by the PxMbxIsValid 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 = PxSysInfoGetMbxInfo(&MbxInfo, mbxId);

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