Outline  Examine some of the H/W supplied with a typical PC and consider the software required to control it.  Introduce Commkit, a software tool that.

Slides:



Advertisements
Similar presentations
DMA Controller (8237 Programming Examples)
Advertisements

Input and Output CS 215 Lecture #20.
Programmable Interval Timer
I/O Unit.
Khaled A. Al-Utaibi  Computers are Every Where  What is Computer Engineering?  Design Levels  Computer Engineering Fields  What.
Loops, and sub-routines Interrupts Can be very useful in control applications particularly when the microprocessor must perform two tasks apparently.
CS-334: Computer Architecture
Avishai Wool lecture Introduction to Systems Programming Lecture 8 Input-Output.
Set 20 Interrupts. INTERRUPTS The Pentium has a mechanism whereby external devices can interrupt it. Devices such as the keyboard, the monitor, hard disks.
Interfacing. This Week In DIG II  Basic communications terminology  Communications protocols  Microprocessor interfacing: I/O addressing  Port and.
© 2006 Pearson Education, Upper Saddle River, NJ All Rights Reserved.Brey: The Intel Microprocessors, 7e Chapter 13 Direct Memory Access (DMA)
Asynchronous Communication Hardware  Data within a DTE is usually stored and moved in a parallel fashion.  Data sent across the channel is generally.
DMA Direct memory access  Problems with programmed I/O  Processor wastes time polling  In our example I.Waiting for a key to be pressed, II.Waiting.
Communication Lab - Interrupts 1/13 Sequential Programming  Our C++ programs are sequential ( סדרתיים), they start at the first instruction and end at.
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.
Chapter 7 Interupts DMA Channels Context Switching.
Exceptions, Interrupts & Traps
Practical Session No. 10 Input &Output (I/O). I/O Devices Input/output (I/O) devices provide the means to interact with the “outside world”. An I/O device.
Unit-5 CO-MPI autonomous
Group 7 Jhonathan Briceño Reginal Etienne Christian Kruger Felix Martinez Dane Minott Immer S Rivera Ander Sahonero.
1 Computer System Overview Chapter 1 Review of basic hardware concepts.
INPUT/OUTPUT ARCHITECTURE By Truc Truong. Input Devices Keyboard Keyboard Mouse Mouse Scanner Scanner CD-Rom CD-Rom Game Controller Game Controller.
Chapter 7 Input/Output Luisa Botero Santiago Del Portillo Ivan Vega.
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. 2 Definition: An electrical signal sent to the CPU (at any time) to alert it to the occurrence of some event that needs its attention Purpose:
Chapter 8 Input/Output. Busses l Group of electrical conductors suitable for carrying computer signals from one location to another l Each conductor in.
CHAPTER 5 I/O PRINCIPLE Understand the principles of System Bus
Chapter 10: Input / Output Devices Dr Mohamed Menacer Taibah University
Lecture 9. - Synchronous Devices require a timing signal. Clock generated Interval Timer Microprocessor Interval Timer Clk PCLK = MHz PCLK (for.
Input/Output mechanisms
1 Computer System Overview Chapter 1. 2 n An Operating System makes the computing power available to users by controlling the hardware n Let us review.
MICROPROCESSOR INPUT/OUTPUT
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.
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.
2007 Oct 18SYSC2001* - Dept. Systems and Computer Engineering, Carleton University Fall SYSC2001-Ch7.ppt 1 Chapter 7 Input/Output 7.1 External Devices.
1 Chapter 2: Computer-System Structures  Computer System Operation  I/O Structure  Storage Structure  Storage Hierarchy  Hardware Protection  General.
Interrupts By Ryan Morris. Overview ● I/O Paradigm ● Synchronization ● Polling ● Control and Status Registers ● Interrupt Driven I/O ● Importance of Interrupts.
2009 Sep 10SYSC Dept. Systems and Computer Engineering, Carleton University F09. SYSC2001-Ch7.ppt 1 Chapter 7 Input/Output 7.1 External Devices 7.2.
Interrupts, Buses Chapter 6.2.5, Introduction to Interrupts Interrupts are a mechanism by which other modules (e.g. I/O) may interrupt normal.
Practical Session 11 Computer Architecture and Assembly Language Input &Output (I/O)
Computer Architecture Lecture 2 System Buses. Program Concept Hardwired systems are inflexible General purpose hardware can do different tasks, given.
Accessing I/O Devices Processor Memory BUS I/O Device 1 I/O Device 2.
13-Nov-15 (1) CSC Computer Organization Lecture 7: Input/Output Organization.
The computer system’s I/O architecture is its interface to the outside world. This architecture provides a systematic means of controlling interaction.
CE Operating Systems Lecture 2 Low level hardware support for operating systems.
Concurrency, Processes, and System calls Benefits and issues of concurrency The basic concept of process System calls.
CE Operating Systems Lecture 2 Low level hardware support for operating systems.
1 Lecture 1: Computer System Structures We go over the aspects of computer architecture relevant to OS design  overview  input and output (I/O) organization.
Input/Output Problems Wide variety of peripherals —Delivering different amounts of data —At different speeds —In different formats All slower than CPU.
IT3002 Computer Architecture
بسم الله الرحمن الرحيم MEMORY AND I/O.
Chapter 3 System Buses.  Hardwired systems are inflexible  General purpose hardware can do different tasks, given correct control signals  Instead.
Part IVI/O Systems Chapter 13: I/O Systems. I/O Hardware a typical PCI bus structure 2.
Practical Session 11 Computer Architecture and Assembly Language Input &Output (I/O)
CS 286 Computer Organization and Architecture
CS703 - Advanced Operating Systems
8253 Timer In software programming of 8085, it has been shown that a delay subroutine can be programmed to introduce a predefined time delay. The delay.
The slides must be understood in Lecture 5
CSCI 315 Operating Systems Design
Operating Systems Chapter 5: Input/Output Management
8259 Programmable Interrupt Controller
Computer Architecture and Assembly Language
Interrupt handling Explain how interrupts are used to obtain processor time and how processing of interrupted jobs may later be resumed, (typical.
Presentation transcript:

Outline  Examine some of the H/W supplied with a typical PC and consider the software required to control it.  Introduce Commkit, a software tool that supports the development of practical data communication software  An example of an application that uses some of the PC’s hardware and Commkit.

The 8086 Family and its Hardware  The 8086 is the generic name given to a family of microprocessors developed by Intel 8086 : : : segmented memory management, multitasking : memory management, 32-bit arithmetic : built-in floating-point hardware Pentium : pipelining

8086 Devices  Standard PC configuration generally allows only eight device (clock, keyboard, screen, hard disk, floppy disk, printer, and two serial comm. interfaces).  AT configurations allow a total of 15 devices.  Devices are not accessed directly; instead, processor accesses a device through one or more ports.  All devices are assigned one or more unique port numbers.

Ports  Ports can be accessed through software using two “low-level” instructions. - in : allows a port to be read - out : allows a port to be written.  The “high-level” Turbo C counter parts of these instructions are unsigned char inportb (int portid) void outportb (int portid, unsigned char value) void outport (int portid, int value)  Key board buffer (port 0x60) : read  Clock command register (port 0x43) : write  Keyboard status register (port 0x61) : read, write

Keyboard  Though 8086 processor uses ASCII character code, PC keyboard does not generate ASCII characters.  Each character on the keyboard is associated with a one-byte scan code.  IBM has defined a scan code for each key. e.g. ESC : scan code 0x01 DEL : scan code 0x53  Scan code must be translated into the character code required by the application. Scan code Scan Code ASC11 0x01. 0x53.. ESC. DEL ASC11APP equivalent Keyboard

 The processor is signaled twice whenever a key is touched : once when the key is pressed (generating the make scan code), and once when the key is released (generating the break scan code). Make Break  The keyboard can generate 127 different scan codes (1-127)  Scan code 0x00 is reserved to allow the keyboard to expand to more than 127 characters bit x xD3 DEL

 The keyboard software obtains the scan code by reading port 0x60.  It must then signal the keyboard that the character has been read. 1. Read port 0x61 to obtain the keyboard status. 2. Write port 0x61 with the keyboard status OR’ed with 0x Write port 0x61 with the original keyboard status.

 If multiple keys are pressed, the keyboard software must maintain state information about these keys, since the scan codes are supplied to the processor one at a time.  The keyboard software should be able to “remember” whether the CTRL, ALT mode, Left Shift, Right Shift keys have been pressed.  The state of any of these keys can be maintained as a Boolean condition.  Whenever one of these keys is pressed (make), the state becomes TRUE, and when the key is released (break), the state becomes FALSE.  Two mapping tables are required, one for unshifted character and the other for shifted characters.

Clock  The clock (or the 8253 timer chip) is used to supply the PC with a regular, periodic clock pulse that can be used to control various actions.  The independent timing channels in 8253 Channel Function 0 System timing and counting 1 Memory Refresh (via DMA controller) 2 PC speaker (for sound effects)  Channel 0 can be used by programs.  Channel 1 must not be changed.

 Internally, the 8253 has a MHz clock.  Most applications do not require this accuracy of timing.  Each channel is associated with a programmable 16-bit counter that can be decremented by the timer chip on each clock pulse.  When the counter reaches 0, the application can be informed.  For example, initialize the counter to 1193, resulting in the counter reaching 0 after approx. one millisecond.

 The 8253 clock is associated with four ports:  Port 0x40, 0x41, 0x42 are clock counter registers and are used to supply the initial clock values to channels 0, 1 and 2, respectively.  Port 0x43 (the clock command register) allows the programmer to specify how a clock is to be used as well as how it is to be initialized.  0x40 0x41 0x42 clock counter registerclock latch

Accessing Devices  Accessing a device before it is ready can result in the duplication of information (e.g. read) or the loss of information (e.g. consecutive write).  To avoid the above problem, most devices are able to signal their status to the processor.  The status of the device can be obtained either by the processor polling the device or by having the device interrupt the processor.

Device Polling  The state of a device can be obtained by reading one or more ports associated with the device.  Software for device polling is typically written as a loop for ( ; ; ) { if (device 1_ready ( ) ) service_device_1 ( ); if (device 2_ready ( ) ) service_device_2 ( ); }  Two drawbacks 1. Processor performs no useful function other than polling. 2. If a device generates data faster than it takes the processor to execute the polling loop, data can be lost.

Interrupts  Interrupt is a mechanism to signal the processor when a device needs to be serviced or has information to supply to the processor.  When a device interrupts the processor: 1. The task currently being run is suspended while the processor handles the interrupt. 2. An interrupt handler (or interrupt service routine) is activated. 3. The suspended task is resumed once the interrupt handler is finished.

 Each device is associated with a unique interrupt number.  This number is used as an index into the list of interrupt vectors stored in segment 0. Interrupt Number Interrupt Device Vector location 0x08 0x20---0x23 Clock 0x09 0x24—0x27 Keyboard 0x0A 0x28—0x2B From slave x0B 0x2C—0x2F Serial Port 0x0C 0x30—0x33 Serial Port 0x0D 0x34—0x37 Hard disk 0x0E 0x38—0x38 Floppy disk 0x0F 0x3C---0x3F Printer

 Only a single interrupt line connects the processor to the outside world.  Intel 8259 Interrupt Controller has been designed to share the single interrupt line between eight devices.  A device first signals the 8259, which then interrupts the 8086 processor.  The processor determines which device is interrupting by obtaining the device’s number from the  The device number is used to access the list of interrupt vectors that indicates which interrupt handler should be activated. Device 0 Device 1 Device Master 8086 Processor 8259 (Slave)

 Programmer can select the devices that are to interrupt the 8086 processor by writing a 1-byte interrupt mask to the Clock Keyboard Slave 8259 Serial port Hard disk Floppy disk Printer

 8259 Interrupt mask is accessed through port 0x21, the interrupt mask register. # define INT_MASK 0x21 # define CLKENA 0xFE # define KEYENA 0xFD # define PRTENA 0x7F outportb (INT_MASK, CLKENA & KEYENA & PRATNA)

 If several devices interrupt simultaneously, the 8259 signals the processor with the highest-priority interrupt. All other devices with lower-priority interrupts are kept waiting.  Once the interrupt has been serviced, the 8259 must be informed so that any pending (or subsequent) interrupts can be signaled.  This is done by writing EOI (End of Interrupt 0x20) to the 8259 operation command word register (port number 0x20).