PxPeRequest()

Request a periodic event object.

APPLIES TO

1.0.0

SYNOPSIS
PxPe_t PxPeRequest (PxOpool_t OpoolId, PxTicks_t period, PxEvents_t events);
ARGUMENTS
OpoolId

The object pool to request the periodic event object from

period

Number of ticks after which the event is signalled

events

Events to be signaled

RETURN VALUES
  • Periodic event handler object id

ERROR CODES

PXERR_ACCESS_RIGHT

The calling task has not the right to access the object pool

PXERR_OPOOL_ILLOPOOL

The passed object pool handle is not valid

PXERR_GLOBAL_ILLEGAL_CORE

The requested object pool is not on the same core

PXERR_OBJ_ABORTED

The request was aborted by an event

PXERR_OBJ_NOOBJ

No free object is available

PXERR_OBJ_ILLOBJ

The passed object handle is not valid

PXERR_EVENT_ZERO

The given event mask is zero

PXERR_PE_ILLPE

The given object is not a periodic event object

PXERR_INTERNAL_INCONSISTENCY

Inconsistency of internal structures

DESCRIPTION

PxPeRequest creates and initializes a periodic event object, which is returned. It is associated with period PXROS ticks and events which are signalled periodically. Signalling is active after the periodic event is started with PxPeStart. It is necessary to finish up with PxPeRelease, when the periodic event is no longer used. If there is no free object available, the PxPeRequest waits until a free object is available.

IMPLEMENTATION GUIDELINES
Before call
  • OpoolId must be a valid PXROS-HR object pool and the calling task must have the access right to take objects from this object pool (V). The validity of OpoolId may also be checked by the PxOpoolIsValid macro (F). The object pool must be created on the same core as the caller runs on. The creator core id can be read with the macro PxOpoolCoreId and the own core id with PxGetCoreId (C). Typically the task’s default object pool PXOpoolTaskdefault is used for this purpose.

  • The period parameter must have a plausible value. It should be a constant or the result of a PxTickGetTicksFromMilliSeconds call (V);

  • The parameter events contains an event bit and should not be zero. Typically the event is a constant (V).

After call
  • The returned value is the id of type PxPe_t. This id may be checked with one of the following macros:

    • PxPeIdIsValid() must be true.

    • PxPeIdGet() must not be _PXIllegalObjId.

    • PxPeIdError() must be PXERR_NOERROR otherwise the returned error code has to be interpreted (C).

Best Practice
  • PxPeRequest may block, if no PXROS-HR object is available. If blocking calls are prohibited, PxPeRequest_NoWait should be used instead.

  • PxPeRequest should only be called during initialization to ensure the availability of the periodic event object.

SEE ALSO
USAGE
#include "pxdef.h"

#define MY_EVENT 0x1l
#define TICKS 0x1l

PxPe_t Pe = PxPeRequest(OpoolId, TICKS, MY_EVENT);

if (PxPeIdError(Pe) != PXERR_NOERROR) {
  // Report error
}