Nios® V Processor Software Developer Handbook

ID 743810
Date 5/26/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.5.1. Writing a Software ISR

This example is based on a Nios V processor-based system. A software IRQ is generated when running the alt_niosv_trigger_msw_interrupt() function. The ISR code increments a global variable and clears the software IRQ using the alt_niosv_clear_msw_interrupt().

Writing a Software ISR

#include "system.h"

#include "sys/msw_interrupt.h"

#include "alt_types.h"

void sw_isr(alt_u32 cause, alt_u32 epc, alt_u32 tval) {
  /* Increments the global variable. */
  ++sw_isr_cnt;
  /* Clears the software IRQ */
  alt_niosv_clear_msw_interrupt();
}