Nios® V Processor Software Developer Handbook

ID 743810
Date 7/20/2023
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

8.2.3. Registering a Hardware ISR

Before the software can use an ISR, you must register it by calling alt_ic_isr_register(). The prototype for alt_ic_isr_register() is:
int alt_ic_isr_register(alt_u32 ic_id, alt_u32 irq, alt_isr_func isr, void *isr_context, void* flags)

The function has the following parameters:

  • ic_id is the interrupt controller identifier (ID) as defined in system.h.
    • With the IIC, ic_id is not significant.
  • irq is the hardware interrupt number for the device, as defined in system.h.
    • For the IIC, irq is the IRQ number. Interrupt priority corresponds inversely to the IRQ number. Therefore, IRQ0 represents the highest priority interrupt and IRQ16 is the lowest.
  • isr is a pointer to the ISR function that is called in response to IRQ number irq.
    • The ISR function prototype is:
      void (*alt_isr_func) (void* isr_context);

      The input argument provided to this function is the isr_context.

      Note: Registering a null pointer for isr results in the interrupt being disabled.
  • isr_context:
    • Points to a data structure associated with the device driver instance.
    • Passed as the input argument to the ISR function. It is used to pass context-specific information to the ISR, and can point to any ISR-specific information. The context value is opaque to the HAL; it is provided entirely for the benefit of the user-defined ISR.
  • flags is reserved.