Nios II Classic Software Developer’s Handbook

ID 683282
Date 5/14/2015
Public
Document Table of Contents

8.2.4. Registering an ISR with the Enhanced Interrupt API

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 daisy­chained EICs, ic_id identifies the EIC in the daisy chain. 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 IRQ31 is the lowest.
    • For an EIC, irq is the interrupt port ID.
  • isr_context points to a data structure associated with the device driver instance. isr_context is 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.
  • isr is a pointer to the ISR function that is called in response to IRQ number irq. The ISR function prototype is:

    void (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.
  • flags is reserved.