XT_INTEXC_HOOK_NUM macro
HOOKS TO DYNAMICALLY INSTALL INTERRUPT AND EXCEPTION HANDLERS PER LEVEL. This Xtensa RTOS port provides hooks for dynamically installing exception and interrupt handlers to facilitate automated testing where each test case can install its own handler for user exceptions and each interrupt priority (level). This consists of an array of function pointers indexed by interrupt priority, with index 0 being the user exception handler hook. Each entry in the array is initially 0, and may be replaced by a function pointer of type XT_INTEXC_HOOK. A handler may be uninstalled by installing 0. The handler for low and medium priority obeys ABI conventions so may be coded in C. For the exception handler, the cause is the contents of the EXCCAUSE reg, and the result is -1 if handled, else the cause (still needs handling). For interrupt handlers, the cause is a mask of pending enabled interrupts at that level, and the result is the same mask with the bits for the handled interrupts cleared (those not cleared still need handling). This allows a test case to either pre-handle or override the default handling for the exception or interrupt level (see xtensa_vectors.S). High priority handlers (including NMI) must be coded in assembly, are always called by 'call0' regardless of ABI, must preserve all registers except a0, and must not use or modify the interrupted stack. The hook argument 'cause' is not passed and the result is ignored, so as not to burden the caller with saving and restoring a2 (it assumes only one interrupt per level - see the discussion in high priority interrupts in xtensa_vectors.S). The handler therefore should be coded to prototype 'void h(void)' even though it plugs into an array of handlers of prototype 'unsigned h(unsigned)'. To enable interrupt/exception hooks, compile the RTOS with '-DXT_INTEXC_HOOKS'.
Syntax
#define XT_INTEXC_HOOK_NUM (1 + XCHAL_NUM_INTLEVELS + XCHAL_HAVE_NMI)
![]()
#define XT_INTEXC_HOOK_NUM (1 + XCHAL_NUM_INTLEVELS + XCHAL_HAVE_NMI)