Nios® II Software Developer Handbook

ID 683525
Date 8/28/2023
Public
Document Table of Contents

15.1.35. alt_ic_isr_register()

Prototype

int alt_ic_isr_register (alt_u32 ic_id,


alt_u32 irq,


 alt_isr_func isr,

void* isr_context,


 
 void* flags)

Commonly Called By

C/C++ programs

Device drivers

Thread-safe

Yes.

Available from ISR

No.

Include

<sys/alt_irq.h>

Description

The alt_ic_isr_register() function registers an ISR. If the function is successful, the requested interrupt is enabled on return, and isr and isr_context are inserted in the vector table.

The function arguments are as follows:

  • ic_id is the interrupt controller ID as defined in system.h, identifying the external interrupt controller in the daisy chain. This argument is ignored if the external interrupt controller interface is not implemented.
  • irq is the IRQ number, as defined in system.h, identifying the interrupt to register.
  • isr is the function that is called when the interrupt is accepted.
  • isr_context is the input argument to isr. isr_context points to a data structure associated with the device driver instance.
  • flags is reserved.

    The ISR function prototype is defined as follows:

    typedef void (*alt_isr_func) (void* isr_context);

    Calls to alt_ic_isr_register() replace previously registered handlers for interrupt irq.

    If isr is set to null, the interrupt is disabled.

  • A driver for an EIC must implement this function.

Return

This function returns zero if successful, or nonzero otherwise. The function fails if the irq parameter is greater than the maximum interrupt port number supported by the external interrupt controller.