Specifications

alt_irq_register()
alt_irq_disable()
alt_irq_enable()
alt_irq_disable_all()
alt_irq_enable_all()
alt_irq_interruptible()
alt_irq_non_interruptible()
alt_irq_enabled()
For more information about these functions, refer to the "HAL API Reference" chapter.
Legacy drivers do not define the supported_interrupt_apis property. The absence of this property
indicates to the SBT that they require the legacy interrupt API.
Using the Legacy HAL API to Implement ISRs
Using the legacy HAL API to implement ISRs requires that you perform the following steps:
1. Write your ISR that handles hardware interrupts for a specific device.
2. Ensure that your program registers the ISR with the HAL by calling the alt_irq_register()
function. alt_irq_register() enables hardware interrupts for you, by calling
alt_irq_enable_all().
Supporting Multiple Interrupt APIs
When you write or update a custom device driver, Altera recommends that you write it in one of two
ways:
Write it to support the enhanced HAL interrupt API—Write the driver this way if you intend to use it
only in combination with other drivers supporting the enhanced API.
Write it to support both the enhanced and the legacy API—Write the driver this way if you need to use
it in combination with legacy drivers supporting only the legacy API.
Note:
Altera recommends using the enhanced API even if your Nios II processor implements the IIC.
The enhanced API supports both types of interrupt controller, and the legacy API is deprecated.
When the SBT selects the interrupt API, it defines one of the following symbols in system.h, to identify
which interrupt API is available:
ALT_ENHANCED_INTERRUPT_API_PRESENT—Defined if the enhanced API is implemented
ALT_LEGACY_INTERRUPT_API_PRESENT—Defined if the legacy API is implemented
In your driver code, use these symbols to determine which API calls to make.
To support both APIs, your driver must publish its interrupt API support by way of a software property.
In your driver’s <driver name>_sw.tcl file, use the set_sw_property command to set
supported_interrupt_apis to both legacy_interrupt_api and enhanced_interrupt_api.
For more information about the set_sw_property command, refer to the “Software Build Tools Tcl
Commands” section of the "Nios II Software Build Tools Reference" chapter of the Nios II Software
Developer’s Handbook.
Related Information
Nios II Software Build Tools Reference on page 15-1
8-10
Using the Legacy HAL API to Implement ISRs
NII5V2
2015.05.14
Altera Corporation
Exception Handling
Send Feedback