CHAPTER 13

INTERRUPT AND ISR

An interrupt is an important external I/O event. When an interrupt occurs, the processor suspends normal program execution and temporarily transfers control to the designated ISR (interrupt service routine). The HAL framework utilizes a single top-level exception handling routine to oversee and coordinate all interrupt activities. In this chapter, we examine the basic concepts of interrupt-driven design and modify the flashing-LED program of Chapter 12 to illustrate the construction of an ISR.

13.1 INTERRUPT PROCESSING IN THE HAL FRAMEWORK

An exception is a special condition that requires a processor's immediate attention. An exception can be raised by an abnormal internal event, such as division by zero or an unimplemented instruction, or by an important external event that has priority over normal program execution. The latter is referred to as a hardware interrupt. Since the book focuses on the I/O interface, our discussion is primarily on the hardware interrupt.

Processing an interrupt involves three basic tasks:

  1. Suspend current program execution and save the current system state.
  2. Transfer control to a special routine to handle the exception.
  3. Restore the system state and resume the normal program execution.

In the HAL framework, these tasks are divided between hardware and software and are accomplished by a coordinated effort.

13.1.1 Overview

The interrupt processing in the HAL framework consists of three elements:

  • Nios II processor.
  • A collection ...

Get Embedded SoPC Design with Nios II Processor and Verilog Examples now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.