A look at interrupts What are interrupts and why are they needed.

Slides:



Advertisements
Similar presentations
Central Processing Unit
Advertisements

Chapter 10 And, Finally.... Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display A Final Collection of ISA-related.
Interrupts Chapter 8 – pp Chapter 10 – pp Appendix A – pp 537 &
68HC11 Polling and Interrupts
EET 2261 Unit 9 Interrupts  Read Almy, Chapters 17 – 19.  Homework #9 and Lab #9 due next week.  Quiz next week.
Daddy! -- Where do instructions come from? Program Sequencer controls program flow and provides the next instruction to be executed Straight line code,
The planned but unexpected Program Sequencer controls program flow and provides the next instruction to be executed Interrupt – causing and handling.
A look at interrupts What are interrupts and why are they needed in an embedded system? Equally as important – how are these ideas handled on the Blackfin.
Communication Lab - Interrupts 1/13 Sequential Programming  Our C++ programs are sequential ( סדרתיים), they start at the first instruction and end at.
1 Computer System Overview OS-1 Course AA
A look at interrupts What are interrupts and why are they needed.
Computer System Structures memory memory controller disk controller disk controller printer controller printer controller tape-drive controller tape-drive.
INPUT/OUTPUT ORGANIZATION INTERRUPTS CS147 Summer 2001 Professor: Sin-Min Lee Presented by: Jing Chen.
The 8051 Microcontroller and Embedded Systems
INTERRUPTS PROGRAMMING
What are Exception and Interrupts? MIPS terminology Exception: any unexpected change in the internal control flow – Invoking an operating system service.
COMP201 Computer Systems Exceptions and Interrupts.
Chapter 10 And, Finally... The Stack. Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display Stacks A LIFO.
Chapter 10 The Stack Stack: An Abstract Data Type An important abstraction that you will encounter in many applications. We will describe two uses:
Computer System Overview Chapter 1. Operating System Exploits the hardware resources of one or more processors Provides a set of services to system users.
DAT2343 Accessing Services Through Interrupts © Alan T. Pinck / Algonquin College; 2003.
1 CS/COE0447 Computer Organization & Assembly Language Chapter 5 part 4 Exceptions.
The Functions of Operating Systems Interrupts. Learning Objectives Explain how interrupts are used to obtain processor time. Explain how processing of.
Tami Meredith, Ph.D. CSCI  Devices need CPU access  E.g., NIC has a full buffer it needs to empty  These device needs are often asynchronous.
Interrupts and reset operations. Overview  Introduction to interrupts – What are they – How are they used  68HC11 interrupt mechanisms – Types of interrupts.
Microprocessors 1 MCS-51 Interrupts.
A Play Core Timer Interrupts Acted by the Human Microcontroller Ensemble from ENCM511.
Computer Architecture Lecture 2 System Buses. Program Concept Hardwired systems are inflexible General purpose hardware can do different tasks, given.
Lecture 14 Today’s topics MARIE Architecture Registers Buses
13-Nov-15 (1) CSC Computer Organization Lecture 7: Input/Output Organization.
Interrupt driven I/O. MIPS RISC Exception Mechanism The processor operates in The processor operates in user mode user mode kernel mode kernel mode Access.
1 Interrupts, Resets Today: First Hour: Interrupts –Section 5.2 of Huang’s Textbook –In-class Activity #1 Second Hour: More Interrupts Section 5.2 of Huang’s.
Chapter 6: Computer Components Dr Mohamed Menacer Taibah University
Embedded Systems Design 1 Lecture Set 8 MCS-51 Interrupts.
Interrupt driven I/O Computer Organization and Assembly Language: Module 12.
Chapter 3 : Top Level View of Computer Functions Basic CPU function, Interconnection, Instruction Format and Interrupt.
Interrupts and Exception Handling. Execution We are quite aware of the Fetch, Execute process of the control unit of the CPU –Fetch and instruction as.
Introduction to Exceptions 1 Introduction to Exceptions ARM Advanced RISC Machines.
Interrupts and exceptions
Chapter 13 The Function of Operating Systems
Interrupts and signals
68HC11 Interrupts & Resets.
Microprocessor Systems Design I
Mon. Oct 2 Announcements Quiz Postponed to Wednesday – still only on 2.a + 2.b Video lecture for 2.a posted Lab 6 experiment extension You must come to.
Timer and Interrupts.
Computer Architecture
Interrupts In 8085 and 8086.
BVM Engineering College Electrical Engineering Department : Microprocessor and Microcontroller Interfacing Interrupts of 8051 Prepared by:
Chapter 10 And, Finally... The Stack
Computer System Overview
Chapter 10 The Stack.
A Play Core Timer Interrupts
Subject Name: Microprocessors Subject Code:10EC46 Department: Electronics and Communication Date: /20/2018.
Computer System Overview
Processor Fundamentals
ENCM K Interrupts Theory and Practice
Moving Arrays -- 2 Completion of ideas needed for a general and complete program Final concepts needed for Final DMA.
Accessing Services Through Interrupts
Interrupts.
Chapter 10 And, Finally... The Stack
Interrupt.
Interrupts 1/18/2019.
Moving Arrays -- 2 Completion of ideas needed for a general and complete program Final concepts needed for Final DMA.
Computer System Overview
Polling vs. Interrupts CS2852 4/9/2019
Computer System Overview
Presentation transcript:

A look at interrupts What are interrupts and why are they needed

The “standard” instruction cycle RESET THE PROCESSOR RESET* INTERRUPT (ACTIVE low) FETCH AN INSTRUCTION FROM PROGRAM MEMORY DECODE THE INSTRUCTION AND FETCH ANY VALUES NEEDED FROM REGISTER OR MEMORY EXECUTE THE INSTRUCTION WRITE BACK THE ANSWER PROCESSOR RESET* +5V RC time constant 200 ms on 68K +5V GROUND

The “standard” instruction cycle RESET THE PROCESSOR RESET* (ACTIVE low) FETCH AN INSTRUCTION FROM PROGRAM MEMORY DECODE THE INSTRUCTION AND FETCH ANY VALUES NEEDED FROM REGISTER OR MEMORY EXECUTE THE INSTRUCTION WRITE BACK THE ANSWER EXECUTING ‘YOUR PROGRAM’ UNTIL POWER IS REMOVED

The “standard” instruction cycle RESET THE PROCESSOR RESET* (ACTIVE low) FETCH AN INSTRUCTION FROM PROGRAM MEMORY DECODE THE INSTRUCTION AND FETCH ANY VALUES NEEDED FROM REGISTER OR MEMORY EXECUTE THE INSTRUCTION WRITE BACK THE ANSWER EXTERNAL HARDWARE Control signal – I have data for you 16-bits This is the data Control signal – Thanks Data received

The “wait till ready approach In decode phase – read control register value In execute phase – check if 1 -- keep waiting (fetch-decode-execute-writeback) until the control value is 1 When 1 – go to a different part of your program code to read the data – then your program must send an acknowledge back to device that the data has been read. The device can then go and get more values for you. PROBLEM: You have no time to do anything else Not a problem if waiting for this device is the only thing you want to do with the processor

Wait till ready approach Very problematic if many devices RESET THE PROCESSOR RESET* (ACTIVE low) FETCH AN INSTRUCTION FROM PROGRAM MEMORY DECODE THE INSTRUCTION AND FETCH ANY VALUES NEEDED FROM REGISTER OR MEMORY EXECUTE THE INSTRUCTION WRITE BACK THE ANSWER EXTERNAL HARDWARE 16-bits EXTERNAL HARDWARE 16-bits EXTERNAL HARDWARE 16-bits

The “Poll approach” Not much waiting – but a lot of “doing” read control register value of device 1 -- if 1 go to a different part of the code to “read the data” – after reading the data send an acknowledge signal back to device 1 -- if 0 go and read the control value of device 2 – don’t worry about device 1 for some time read control register value of device 2 -- if 1 go to a different part of the code to “read the data” – after reading the data send an acknowledge signal back to device 2 -- if 0 go and read the control value of device 3 – don’t worry about device 2 and 3 for some time ETC PROBLEM: What happens if, while you are handling device 2, device 1 has “time sensitive information” that will disappear if device 1 is not serviced immediately

Interrupt Approach – basic idea RESET THE PROCESSOR RESET* (ACTIVE low) FETCH AN INSTRUCTION FROM “NORMAL” (NOT ISR) PROGRAM MEMORY DECODE THE INSTRUCTION AND FETCH ANY VALUES NEEDED FROM REGISTER OR MEMORY EXECUTE THE INSTRUCTION WRITE BACK THE ANSWER EXTERNAL HARDWARE 16-bits CHECK IF AN INTERRUPT REQUEST HAS OCCURRED CONTROL SIGNAL DATA READY SIGNAL NO yes DO ISR CONTINUE AS BEFORE Acknowledge done

Issues to solve What if hardware can only provide a “quick” I am ready signal? What if more than one hardware wants to send an interrupt? What if the programmer wants to “ignore” a “low priority” interrupt? What if certain interrupts are too important to ignore?

What if hardware can only provide a “quick” I am ready signal? EXTERNAL HARDWARE 16-bits CHECK IF AN INTERRUPT REQUEST HAS OCCURRED CONTROL SIGNAL DATA READY SIGNAL yes DO ISR CONTINUE AS BEFORE Acknowledge done Interrupt Buffer Interrupt Latch (Capture) Processor clock signal causes load of the latch to capture the transient interrupt

What if the programmer wants to “ignore” a “low priority” interrupt? EXTERNAL HARDWARE 16-bits CHECK IF AN INTERRUPT REQUEST HAS OCCURRED CONTROL SIGNAL DATA READY SIGNAL yes DO ISR CONTINUE AS BEFORE Acknowledge done Interrupt Buffer Interrupt Mask Ignore Processor clock signal causes load of the latch to capture the transient interrupt Interrupt Latch (Capture)

What if certain hardware interrupts are too important to ignore? EXTERNAL HARDWARE 16-bits CHECK IF AN INTERRUPT REQUEST HAS OCCURRED CONTROL SIGNAL DATA READY SIGNAL yes DO ISR CONTINUE AS BEFORE Acknowledge done Interrupt Buffer Interrupt Mask Ignore Processor clock signal causes load of the latch to capture the transient interrupt Interrupt Latch (Capture)

What if more than one hardware wants to send an interrupt? EXTERNAL HARDWARE 16-bits CHECK IF AN INTERRUPT REQUEST HAS OCCURRED CONTROL SIGNAL DATA READY SIGNAL yes DO ISR CONTINUE AS BEFORE Acknowledge done Interrupt Buffer Interrupt Mask Ignore Processor clock signal causes load of the latch to capture the transient interrupt Interrupt Latch (Capture) Pending interrupts (to be done

Blackfin MASKS and Latches

Normal “linear flow” PC increments to next instruction Use program counter PC as an Instruction Pointer register Fetch instruction at memory location PC then increment the PC to point at the next instruction PC = PC+2 PC = PC + 4;

Subroutine call flow PC = PC + 2 CALL MEANS RETS = PC + 4 (FFA03C78) PC = 0xFFA01E24 This instruction is NOT fetched (until end of subroutine) This instruction is now fetched HAVE JUMPED TO SUBROUTINE

Interrupt occurs HERE Must Jump to ISR NOW– but how? Use program counter PC as an Instruction Pointer register Fetch instruction at memory location PC then increment the PC to point at the next instruction PC = PC+2 PC = PC + 4;

Interrupt occurs HERE Must Jump to ISR NOW – but how? First step is obvious PC has 0xFFA01E44 in it – Just about to fetch P0.L = instruction Remember what instruction you were about to execute – so you can do that instruction after finishing the ISR RETI = PC (0xFFA01E44) PC = ?????

Interrupt occurs HERE Must Jump to ISR – but how First step is obvious Remember what instruction you were about to execute RETI = PC (0xFFA01E44) PC = ????? Some how – like magic must make PC = start of Timer ISR 0xFFA01EC0

Solution – Lookup table of what value to put into PC for what interrupt Same idea as for my answer for Q3 in Post Lab Quiz 1 – Except that the hardware is reading the value from the table and not the program Event (e.g interrupts) Table

Why are all these “event addresses” in the jump table the same? This is the address of the “ the processor does not know what to do if there is an interrupt of this sort” EXCEPTION

IDLE This is the assembly code While (wait till some happens) instruction VDSP Emulator puts in a “breakpoint” so for us the program stops. In real life – processor can’t “stop”, just goes into an infinite loop until “watchdog timer” resets the processor The unknown “exception” interrupt service routine

Solution – Lookup table of what value to put into PC for what interrupt Question – the start of the ISR is in the event table – How did it get there? Event (e.g interrupts) Table

The start address of the ISR got into the event table HOW? It got there because we told C++ to put it there for us Also we can understand what the raise( ) C++ function does

Blackfin MASKS and Latches Raise( ) use “software to put a 1 into the interrupt latch register – making the processor think that a hardware interrupt has happened

Event table information can be found in the Blackfin Hardware Manual

What happens if the device does take away its “I’m ready” signal during an interrupt? EXTERNAL HARDWARE 16-bits CHECK IF AN INTERRUPT REQUEST HAS OCCURRED CONTROL SIGNAL DATA READY SIGNAL yes DO ISR CONTINUE AS BEFORE Acknowledge done Interrupt Buffer Interrupt Latch (Capture) Processor clock signal causes load of the latch to capture the transient interrupt

Tackled today Three ways of handling hardware requests for service Wait till the device signals “ready” then process the data If device 1 ready – process its data If device 2 ready – process its data Interrupt – start processing the data from a “specific device NOW!