User trap handler definition

It is necessary to implement a handler function fulfilling this prototype:

Code 1. Handler prototype definition
PxBool_t(* traphandler)(PxTrapTin_t trapTin, PxUInt_t hnd_arg, PxUInt_t runtaskId,
                        PxUInt_t dstr, PxUInt_t *deadd, TC_CSA_t *csa);

Parameters:

  • trapTin — trap class number & TIN — to identify which error occurred according to the Trap descriptions tables

  • hnd_arg — user-defined argument — argument is passed during handler installation

  • runtaskId — task ID of the task that caused the trap

  • dstr — contents of DSTR — content of this register is implementation-specific, additional information is provided in section 5.3.6.4 of [2]

  • deadd — contents of DEADD — content of this register is implementation-specific, additional information is provided in section 5.3.6.4 of [2]

  • csa — pointer to the saved CSA — only the lower part of architectural registers in the state they were right before entering trap handling (upper part can be accessed via the link of PCXI value as shown in Decision whether the PCXI points to lower or upper CSA)

Description:

A trap handler is a function where decisions about the next steps are made according to the error. Traps are divided into classes that describe similar types of errors, and each specific error has an assigned TIN.

A trap handler should return true if the handler can successfully handle the error, otherwise false, which means PxTrapAbort() is called as the default trap handling routine.

Code 2. Example of a trap handler prototype
PxBool_t Trap_Hnd_04(PxTrapTin_t trapTin, PxUInt_t hnd_arg, PxUInt_t runtaskId,
                     PxUInt_t dstr, PxUInt_t *deadd, TC_CSA_t *csa);