Nios® II Software Developer Handbook

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

9.2.3. Writing an ISR

The ISR you write must match the prototype that alt_ic_isr_register() expects. The prototype for your ISR function must match the following prototype:

void (*alt_isr_func) (void* isr_context)

The parameter definition of context is the same as for the alt_ic_isr_register() function.

From the point of view of the HAL exception handling system, the most important function of an ISR is to clear the associated peripheral’s interrupt condition. The procedure for clearing an hardware interrupt condition is specific to the peripheral.

For more information, refer to the relevant chapter in the "Embedded Peripherals IP User Guide".

When the ISR has finished servicing the hardware interrupt, it must return to the HAL interrupt funnel that called it.

Note: If you write your ISR in assembly language, use ret to return. The HAL interrupt funnel issues an eret after restoring the application context.