Nios® V Processor Software Developer Handbook

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

9.2.1.1. Enhanced HAL Hardware Interrupt API

The BSP implements the Enhanced HAL Hardware Interrupt API, and each driver that supports the hardware interrupt API publishes this capability to the BSP Editor through its <driver name>_sw.tcl file.

A driver can publish its interrupt API support by way of a software property. The driver’s <driver name>_sw.tcl file uses the set_sw_property command to set supported_interrupt_apis to enhanced_interrupt_api.

Using the Enhanced HAL Hardware Interrupt API to Implement ISRs

You need to perform the following steps to implement hardware ISR with HAL hardware interrupt API:

  1. Create your ISR functions prototype that handles hardware interrupts.
  2. Ensure your program registers the ISR with the HAL driver by calling alt_ic_isr_register().
  3. alt_ic_isr_register() enables hardware interrupts for you.
Table 38.  Enhanced HAL Hardware Interrupt API Functions
Function Name Description
alt_ic_isr_register() Register an interrupt handler to handle the hardware interrupts.
alt_ic_irq_enable() Enables a single interrupt.
alt_ic_irq_disable() Disables a single interrupt.
alt_ic_irq_enabled() Determine if corresponding interrupt is enabled.
alt_irq_disable_all() Disable all interrupts and return context value correspond to the previous state.
alt_irq_enable_all() Enable all interrupts to the previous state based on the returned context value from prior alt_irq_disable_all().
alt_irq_enabled() Determine if the processor's global interrupt enable is asserted.
Note: In the IIC, the functions are implemented by the HAL. For more information about each function, refer to the HAL API Reference section.