Nios II Classic Software Developer’s Handbook

ID 683282
Date 5/14/2015
Public
Document Table of Contents

8.2.5. Enabling and Disabling Interrupts

The HAL enhanced interrupt API provides the functions alt_ic_irq_disable(), alt_ic_irq_enable(), alt_ic_irq_enabled(), alt_irq_disable_all(), alt_irq_enable_all(), and alt_irq_enabled() to allow a program to disable hardware interrupts for certain sections of code, and reenable them later. alt_ic_irq_disable() and alt_ic_irq_enable() allow you to disable and enable individual interrupts. alt_irq_disable_all() disables all interrupts, and returns a context value. To reenable hardware interrupts, you call alt_irq_enable_all() and pass in the context parameter. In this way, interrupts are returned to their state prior to the call to alt_irq_disable_all(). alt_irq_enabled() returns nonzero if maskable exceptions are enabled. alt_ic_irq_enabled() determines whether a specified interrupt is enabled.

Note: Disable hardware interrupts for as short a time as possible. Maximum interrupt latency increases with the longest amount of time interrupts are disabled.

For more information about disabled interrupts, refer to the “Keep Interrupts Enabled” chapter.

For more information about these functions, refer to the "HAL API Reference" chapter.

Note: The HAL legacy interrupt API provides different functions for enabling and disabling individual interrupts. For all new and updated drivers, Intel FPGA recommends using the enhanced API described in this section.

For more information about the legacy API functions, alt_irq_disable() and alt_irq_enable(), refer to the "HAL API Reference" chapter.