Nios® V Processor Software Developer Handbook

ID 743810
Date 2/14/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.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.