PxIntInstallHandler()

Install an interrupt handler.

APPLIES TO

8.2.0

SYNOPSIS
PxError_t PxIntInstallHandler (PxUInt_t intno, PxInterrupt_t intObj, void(* inthandler)(PxArg_t), PxArg_t arg);
ARGUMENTS
intno

The number of the interrupt for which the handler is installed

inthandler

The interrupt handler to be installed

arg

Argument for interrupt handler

intObj

The interrupt object

RETURN VALUES
  • PXROS error code

ERROR CODES

PXERR_REQUEST_INVALID_PARAMETER

intno out of specification

PXERR_ACCESS_RIGHT

The calling task has not the right to install handlers

PXERR_INTR_ILL

The handler already installed from another task

PXERR_INTERRUPT_ILLINTERRUPT

intObj not valid interrupt object

PXERR_ILLEGAL_SERVICE_CALLED

Service invalid

DESCRIPTION

Installs the C-function handler as interrupt handler for interrupt number intno. Whenever this interrupt occurs, handler is queued into the PXROS sysjob list via the interrupt object intObj. When the interrupt level is left to system level, handler is executed with argument arg on the installing task’s interrupt stack.

Handler MUST FOLLOW the standard GNU C calling conventions!

The function is not protected against the abort mechanism!

The installation is NOT ATOMIC! The application MUST ENSURE that no intno interrupts occur during a call to PxIntInstallHandler (intno,…​)!

IMPLEMENTATION GUIDELINES
Before call
  • The parameter intno must be a valid interrupt id. (V)

  • intObj must be a valid PXROS-HR interrupt object created with a PxInterruptRequest call (V). The validity of intObj may also be checked by the PxInterruptIsValid macro (F).

  • inthandler must be a pointer to an interrupt handler function.(V)

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

Best Practice
  • The calling task must have the right to install interrupt handlers (PXACCESS_INSTALL_HANDLERS). (V)

SEE ALSO
USAGE
#include "pxdef.h"

PxError_t Err = PxIntInstallHandler(intno, intObj, interruptHandler, (PxArg_t) 0);

if (Err != PXERR_NOERROR) {
    // Report error
}