Implementing interrupt driven IO. Why use interrupt driven IO? Positive points –Allows asynchronous operation of IO events –Good use of resources –Leads.

Slides:



Advertisements
Similar presentations
INPUT-OUTPUT ORGANIZATION
Advertisements

More on Processes Chapter 3. Process image _the physical representation of a process in the OS _an address space consisting of code, data and stack segments.
11-1 ECE 424 Design of Microprocessor-Based Systems Haibo Wang ECE Department Southern Illinois University Carbondale, IL I/O System Design.
Interrupts Chapter 8 – pp Chapter 10 – pp Appendix A – pp 537 &
COMP3221: Microprocessors and Embedded Systems Lecture 15: Interrupts I Lecturer: Hui Wu Session 1, 2005.
OS2-1 Chapter 2 Computer System Structures. OS2-2 Outlines Computer System Operation I/O Structure Storage Structure Storage Hierarchy Hardware Protection.
6-1 I/O Methods I/O – Transfer of data between memory of the system and the I/O device Most devices operate asynchronously from the CPU Most methods involve.
I/O Hardware n Incredible variety of I/O devices n Common concepts: – Port – connection point to the computer – Bus (daisy chain or shared direct access)
04/16/2010CSCI 315 Operating Systems Design1 I/O Systems Notice: The slides for this lecture have been largely based on those accompanying an earlier edition.
OS Spring’03 Introduction Operating Systems Spring 2003.
Computer System Structures memory memory controller disk controller disk controller printer controller printer controller tape-drive controller tape-drive.
1 Interrupts INPUT/OUTPUT ORGANIZATION: Interrupts CS 147 JOKO SUTOMO.
ColdFire MCF5282 Universal Asynchronous Receiver/Transmitters (UARTs)
INPUT/OUTPUT ORGANIZATION INTERRUPTS CS147 Summer 2001 Professor: Sin-Min Lee Presented by: Jing Chen.
Chapter 13: I/O Systems I/O Hardware Application I/O Interface
INPUT-OUTPUT ORGANIZATION
General System Architecture and I/O.  I/O devices and the CPU can execute concurrently.  Each device controller is in charge of a particular device.
Interrupts. What Are Interrupts? Interrupts alter a program’s flow of control  Behavior is similar to a procedure call »Some significant differences.
Input and Output Computer Organization and Assembly Language: Module 9.
I/O Systems I/O Hardware Application I/O Interface
1 Lecture 20: I/O n I/O hardware n I/O structure n communication with controllers n device interrupts n device drivers n streams.
Silberschatz, Galvin, and Gagne  Applied Operating System Concepts Module 2: Computer-System Structures Computer System Operation I/O Structure.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 2: Computer-System Structures Computer System Operation I/O Structure Storage.
Chapter 2: Computer-System Structures
1 CSE Department MAITSandeep Tayal Computer-System Structures Computer System Operation I/O Structure Storage Structure Storage Hierarchy Hardware Protection.
2: Computer-System Structures
CHAPTER 3 TOP LEVEL VIEW OF COMPUTER FUNCTION AND INTERCONNECTION
1-1 Embedded Network Interface (ENI) API Concepts Shared RAM vs. FIFO modes ENI API’s.
Recall: Three I/O Methods Synchronous: Wait for I/O operation to complete. Asynchronous: Post I/O request and switch to other work. DMA (Direct Memory.
Chapter 2: Computer-System Structures 2.1 Computer System Operation 2.5 Hardware Protection 2.6 Network Structure.
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.
Lecture 3 Process Concepts. What is a Process? A process is the dynamic execution context of an executing program. Several processes may run concurrently,
 8251A is a USART (Universal Synchronous Asynchronous Receiver Transmitter) for serial data communication.  Programmable peripheral designed for synchronous.
Computer Architecture Lecture 2 System Buses. Program Concept Hardwired systems are inflexible General purpose hardware can do different tasks, given.
ATtiny23131 A SEMINAR ON AVR MICROCONTROLLER ATtiny2313.
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.
CE Operating Systems Lecture 2 Low level hardware support for operating systems.
Operating Systems 1 K. Salah Module 1.2: Fundamental Concepts Interrupts System Calls.
1 CS.217 Operating System By Ajarn..Sutapart Sappajak,METC,MSIT Chapter 2 Computer-System Structures Slide 1 Chapter 2 Computer-System Structures.
Silberschatz, Galvin and Gagne  Applied Operating System Concepts Chapter 2: Computer-System Structures Computer System Architecture and Operation.
CE Operating Systems Lecture 2 Low level hardware support for operating systems.
Interrupt driven I/O Computer Organization and Assembly Language: Module 12.
Embedded Computer - Definition When a microcomputer is part of a larger product, it is said to be an embedded computer. The embedded computer retrieves.
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.
8251 USART.
Transmitter Interrupts Review of Receiver Interrupts How to Handle Transmitter Interrupts? Critical Regions Text: Tanenbaum
Tiva C TM4C123GH6PM UART Embedded Systems ECE 4437 Fall 2015 Team 2:
Lecture 2 Interrupts.
Module 12: I/O Systems I/O hardware Application I/O Interface
CS501 Advanced Computer Architecture
Microprocessor Systems Design I
1 Input-Output Organization Computer Organization Computer Architectures Lab Peripheral Devices Input-Output Interface Asynchronous Data Transfer Modes.
CSCI 315 Operating Systems Design
Computer-System Architecture
Module 2: Computer-System Structures
I/O Systems I/O Hardware Application I/O Interface
Operating Systems Chapter 5: Input/Output Management
Operating System Concepts
13: I/O Systems I/O hardwared Application I/O Interface
Transmitter Interrupts
Module 2: Computer-System Structures
Chapter 13: I/O Systems I/O Hardware Application I/O Interface
CS 143A Principles of Operating Systems
Module 2: Computer-System Structures
Module 2: Computer-System Structures
Module 12: I/O Systems I/O hardwared Application I/O Interface
Presentation transcript:

Implementing interrupt driven IO

Why use interrupt driven IO? Positive points –Allows asynchronous operation of IO events –Good use of resources –Leads to modular structure of system –Leads to better response times for interactive tasks Negative points –It is harder to program –Leads to more complex code and system –Can be difficult to debug errors –Could have security implications

Hardware resources required We will need a processor which can accept interrupts A serial port module that can generate interrupts A priority scheme would be useful At least bi-modal processor – at least supervisor and user modes

The Serial module

UART Mode Register 1 RxIRQ—Receiver Interrupt Select –1 = FFULL is the source that generates IRQ. –0 = RxRDY is the source that generates IRQ.

UART Interrupt Status Register RxRDY—Receiver Ready or FIFO Full –The function of this bit is programmed by UMR1 bit 6. It is a duplicate of either the FFULL or RxRDY bit of USR. TxRDY—Transmitter Ready –This bit is the duplication of the TxRDY bit in USR. –1 = The transmitter holding register is empty and ready to be loaded with a character. –0 = The transmitter holding register was loaded by the CPU, or the transmitter is disabled. –Characters loaded into the transmitter holding register when TxRDY=0 are not transmitted.

UART Interrupt Mask Register FFULL—FIFO Full –1 = Enable interrupt –0 = Disable interrupt TxRDY—Transmitter Ready –1 = Enable interrupt –0 = Disable interrupt

UART Interrupt Vector Register IVR7–IVR0—Interrupt Vector Bits –This 8-bit number indicates the offset from the base of the vector table where the address of the exception handler for the specified interrupt is located. The UIVR is reset to $0F, which indicates an uninitialized interrupt condition.

(D)UART ISR CODE

Library and System IO calls Library and system IO calls do not write to the IO devices. They write to internal operating system buffers. These buffers are in –User space for library buffers – fprintf etc –In system space for system calls – write, read etc This allows processes to read and write data off-line from peripherals

IOCTL or IO control functions As there is a separation between the calls that handle the hardware and handle the data buffers, the operating system can process the data quite easily running a series of control functions on the data. In Unix/Linux these are called IOCTL calls. For example –stty -raw

Writing data from user space to a device User Space System/kernel space Printf “data” Printf DATADATA Write DATADATA Buffer IOCTL Functions DATADATA Sys_write DEVICE

Connecting Processes with their IO In multi-tasking and multi-user systems there are a number of users and processes waiting to send or receive data. The operating systems must make sure that they get their correct data or that it goes to the correct resource This is handled by the scheduler and IO manager modules.