Docsity

Interrupt Concepts - Introduction to Microprocessor Systems - Lecture Sli, Lecture notes of Computer Science

Partial preview of the text

Download Interrupt Concepts - Introduction to Microprocessor Systems - Lecture Sli and more Lecture notes Computer Science in PDF only on Docsity!

Topics

• Interrupt Concepts

• ARM7TDMI Interrupt Handling

• ADuC7026 Interrupt Implementation

  • Interrupt Sources

• Interrupt Service Routines (ISRs)

• Interrupt Driven Systems

• Software Interrupts and Exceptions

• Interrupt Priority and Latency

• Debugging Interrupt Hardware and Software

Why Use Interrupts?

• Maximize processor utilization and

efficiency

• Allow use of sleep/idle states to save power

• Minimize latency in responding to complex

input/output structures

• Facilitate event-driven applications and

preemptive multitasking

Interrupt Concepts

• Supporting multiple interrupt sources

  • Polled interrupts
  • Vectored interrupts
    • Fixed ISR locations
    • Vector table implementations
  • Generic implementation

• Prioritization Schemes

  • Fixed
  • Rotating
  • Hierarchical

• Software interrupts and exceptions Docsity.com

ARM7TDMI Interrupt Handling

• Interrupt modes

  • IRQ
    • Banks R13, R14, SPSR
  • FIQ
    • Banks R8-R12, R13, R14, SPSR
  • SWI (software interrupt) discussed later

• Interrupt control

  • CPSR I/F flags

• Interrupt processing sequence

• Interrupt nesting Docsity.com

ADuC7026 Interrupt MMRs

  • These MMRs are used to control the interrupt

handling

– IRQSIG, FIQSIG

  • Ones indicate that the source has an interrupt pending
  • IRQEN, FIQEN
  • Ones indicate that the interrupt request from the source is unmasked (i.e. the interrupt source is enabled)
  • IRQSTA, FIQSTA
  • Ones indicate that the sources have an interrupt enabled and pending
  • Used in ISR to determine which device(s) need(s) service
  • IRQCLR, FIQCLR
  • Write ones to clear the corresponding bit in IRQEN, FIQEN (i.e. to mask an interrupt source)
  • This is NOT how you clear an interrupt request in the ISR! Docsity.com

ADuC7026 Programmed Interrupts

  • The programmed interrupt feature allows us to

programmatically force an entry into FIQ mode or

IRQ mode

  • Write to SWICFG register, do not need to have programmed interrupt enabled in IRQEN/FIQEN
  • Note that the use of “SWI” has absolutely nothing to do with the ARM7 SWI instruction and supervisor mode

Interrupt Driven Systems

  • Foreground vs. background tasks.
  • Events determine the actual order of execution.

Initialization

Main Program Loop

ISRa ISRb ISRc

Software Interrupts & Exceptions

• SWI instruction

• Exceptions

  • ARM7TDMI exceptions
    • Prefetch abort
    • Data abort
    • Undefined instruction
    • Reset
  • Other common exceptions
    • Divide error
    • Single-step
    • Breakpoint Docsity.com

Interrupt Issues

• Using periodic interrupts to perform

iterative tasks

• What to do when good interrupts go bad…

  • Software debugging
  • Hardware debugging
  • Real-time issues
  • Inter-process communication (IPC) issues

In-Class Assessment Quiz

• What sort of safeguards might you need to

design into NMI hardware?

• For the ARM7TDMI, describe what happens

between an IRQ being asserted and the actual

execution of the ISR.

• What are the differences between vectored

interrupts and polled interrupts?

Wrapping Up

• Homework #6 due Wednesday, 4/25.

• Reading for next week

  • Textbook 15
  • Supplement #5 (Learn@UW)

ARM7 CPSR

  • Current Process Status Register (CPSR)
    • Condition code flags (N, Z, C, V)
    • Interrupt disable bits (I, F)
    • Thumb mode enable (T)
      • Never change directly!
    • Mode select
      • These bits cannot be changed in User mode

31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0

N Z C V reserved I F T mode

ARM7 Register Banking

User Mode Privileged Modes Exception Modes User System Supervisor Abort Undefined IRQ FIQ

R0-R7 R0-R7 R0-R7 R0-R7 R0-R7 R0-R7 R0-R

R8-R12 R8-R12 R8-R12 R8-R12 R8-R12 R8-R12 R8-R

R13-R14 R13-R14 R13-R14 R13-R14 R13-R14 R13-R14 R13-R

PC PC PC PC PC PC PC

CPSR CPSR CPSR CPSR CPSR CPSR CPSR

SPSR SPSR SPSR SPSR SPSR

Interrupt Example - Hardware