PxInterruptRequest()

Request an interrupt object.

APPLIES TO

1.0.0

SYNOPSIS
PxInterrupt_t PxInterruptRequest (PxOpool_t opoolid);
ARGUMENTS
opoolid

The object pool, where the interrupt object is requested from

RETURN VALUES
  • Invalid interrupt object handle on failure

  • Valied interrupt object handle on success

ERROR CODES

PXERR_OPOOL_ILLOPOOL

opoolid is not a valid object pool

PXERR_OBJ_ABORTED

Request aborted by an event

PXERR_ACCESS_RIGHT

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

PXERR_INTERRUPT_ILLINTERRUPT

The interrupt is not a valid interrupt object

PXERR_EVENT_ZERO

The given event mask is zero

PXERR_OBJ_NOOBJ

No free object is available

PXERR_GLOBAL_ILLEGAL_CORE

The requested object pool is not on the same core

PXERR_OBJ_ILLOBJ

The passed object handle is not valid

PXERR_INTERNAL_INCONSISTENCY

Inconsistency of internal structures

DESCRIPTION

The PxInterruptRequest function creates a interrupt object by converting a free object from object pool opool. The object handle is returned. If there is no free object available, the PxInterruptRequest 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.

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

    • PxInterruptIdIsValid() must be true.

    • PxInterruptIdGet() must not be _PXIllegalObjId.

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

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

  • PxInterruptRequest should only be called during initialization to ensure the availability of the interrupt object.

SEE ALSO
USAGE
#include "pxdef.h"

PxInterrupt_t Interrupt = PxInterruptRequest(opoolid);

if (PxInterruptIdError(Interrupt) != PXERR_NOERROR) {
    // Report error
}
else {
    // Handle interrupt object
}