Nios® V Processor Software Developer Handbook

ID 743810
Date 7/08/2024
Public
Document Table of Contents

9.3.2. Writing a Software ISR

The ISR create must match the function prototype that alt_niosv_register_msw_interrupt handler() expected.

void (*sw_isr_func) (alt_u32 cause, alt_u32 epc, alt_u32 tval)
{
    /* You may declare the ISR code here. */
    alt_niosv_clear_msw_interrupt();
}

After the software interrupt is handled, you are required to clear the software interrupt by using the alt_niosv_clear_msw_interrupt() function.

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