Chapter 10: Input / Output Devices

  • Published on
    16-Jan-2016

  • View
    38

  • Download
    0

DESCRIPTION

Chapter 10: Input / Output Devices. Dr Mohamed Menacer Taibah University 2007-2008. Input/Output Problems. Wide variety of peripherals Delivering different amounts of data At different speeds In different formats All slower than CPU and RAM Need I/O modules. Input/Output Module. - PowerPoint PPT Presentation

Transcript

<ul><li><p>Chapter 10:Input / Output DevicesDr Mohamed MenacerTaibah University2007-2008</p></li><li><p>Input/Output ProblemsWide variety of peripheralsDelivering different amounts of dataAt different speedsIn different formatsAll slower than CPU and RAMNeed I/O modules</p></li><li><p>Input/Output ModuleInterface to CPU and MemoryInterface to one or more peripherals</p></li><li><p>Generic Model of I/O Module</p></li><li><p>External DevicesHuman readableScreen, printer, keyboardMachine readableMonitoring and controlCommunicationModemNetwork Interface Card (NIC)</p></li><li><p>External Device Block Diagram</p></li><li><p>I/O Module FunctionControl &amp; TimingCPU CommunicationDevice CommunicationData BufferingError Detection</p></li><li><p>I/O StepsCPU checks I/O module device statusI/O module returns statusIf ready, CPU requests data transferI/O module gets data from deviceI/O module transfers data to CPUVariations for output, DMA, etc.</p></li><li><p>I/O Module Diagram</p></li><li><p>I/O Module DecisionsHide or reveal device properties to CPUSupport multiple or single deviceControl device functions or leave for CPUAlso O/S decisionse.g. Unix treats everything it can as a file</p></li><li><p>Intel 82C55A Programmable Peripheral Interface</p></li><li><p>Keyboard/Display Interfaces to 82C55A</p></li><li><p>Input Output TechniquesProgrammedInterrupt drivenDirect Memory Access (DMA)</p></li><li><p>Three Techniques for Input of a Block of Data</p></li><li><p>Programmed I/OCPU has direct control over I/OSensing statusRead/write commandsTransferring dataCPU waits for I/O module to complete operationWastes CPU time</p></li><li><p>Programmed I/O - detailCPU requests I/O operationI/O module performs operationI/O module sets status bitsCPU checks status bits periodicallyI/O module does not inform CPU directlyI/O module does not interrupt CPUCPU may wait or come back later</p></li><li><p>I/O CommandsCPU issues addressIdentifies module (&amp; device if &gt;1 per module)CPU issues commandControl - telling module what to doe.g. spin up diskTest - check statuse.g. power? Error?Read/WriteModule transfers data via buffer from/to device</p></li><li><p>Addressing I/O DevicesUnder programmed I/O data transfer is very like memory access (CPU viewpoint)Each device given unique identifierCPU commands contain identifier (address)</p></li><li><p>I/O MappingMemory mapped I/ODevices and memory share an address spaceI/O looks just like memory read/writeNo special commands for I/OLarge selection of memory access commands availableIsolated I/OSeparate address spacesNeed I/O or memory select linesSpecial commands for I/OLimited set</p></li><li><p>Memory Mapped and Isolated I/O</p></li><li><p>Interrupt Driven I/OOvercomes CPU waitingNo repeated CPU checking of deviceI/O module interrupts when ready</p></li><li><p>Interrupt Driven I/OBasic OperationCPU issues read commandI/O module gets data from peripheral whilst CPU does other workI/O module interrupts CPUCPU requests dataI/O module transfers data</p></li><li><p>Simple InterruptProcessing</p></li><li><p>CPU ViewpointIssue read commandDo other workCheck for interrupt at end of each instruction cycleIf interrupted:-Save context (registers)Process interruptFetch data &amp; store</p></li><li><p>Changes in Memory and Registers for an Interrupt</p></li><li><p>Example - PC Bus80x86 has one interrupt line8086 based systems use one 8259A interrupt controller8259A has 8 interrupt lines</p></li><li><p>82C59A InterruptController</p></li><li><p>Sequence of Events8259A accepts interrupts8259A determines priority8259A signals 8086 (raises INTR line)CPU Acknowledges8259A puts correct vector on data busCPU processes interrupt</p></li><li><p>Multiple InterruptsEach interrupt line has a priorityHigher priority lines can interrupt lower priority linesIf bus mastering only current master can interrupt</p></li><li><p>ISA Bus Interrupt SystemISA bus chains two 8259As togetherLink is via interrupt 2Gives 15 lines16 lines less one for linkIRQ 9 is used to re-route anything trying to use IRQ 2Backwards compatibilityIncorporated in chip set</p></li><li><p>Multiple Interrupts using 82C59A InterruptController</p></li><li><p>Direct Memory Access (DMA)Interrupt driven and programmed I/O require active CPU interventionTransfer rate is limitedCPU is tied upDMA is the answer</p></li><li><p>DMA FunctionAdditional Module (hardware) on busDMA controller takes over from CPU for I/O</p></li><li><p>Typical DMA Module Diagram</p></li><li><p>DMA OperationCPU tells DMA controller:-Read/WriteDevice addressStarting address of memory block for dataAmount of data to be transferredCPU carries on with other work (not an interrupt)DMA controller deals with transfer (DMA controller takes over bus for a cycle)DMA controller sends interrupt when finishedSlows down CPU but not as much as CPU doing transfer</p></li><li><p>DMA and Interrupt Breakpoints During an Instruction Cycle</p></li><li><p>DMA Configurations (1)Single Bus, Detached DMA controllerEach transfer uses bus twiceI/O to DMA then DMA to memoryCPU is suspended twice</p></li><li><p>DMA Configurations (2)Single Bus, Integrated DMA controllerController may support &gt;1 deviceEach transfer uses bus onceDMA to memoryCPU is suspended once</p></li><li><p>DMA Configurations (3)Separate I/O BusBus supports all DMA enabled devicesEach transfer uses bus onceDMA to memoryCPU is suspended once</p></li><li><p>Intel 8237A DMA ControllerInterfaces to 80x86 family and DRAMWhen DMA module needs buses it sends HOLD signal to processorCPU responds HLDA (hold acknowledge) DMA module can use busesE.g. transfer data from memory to diskDevice requests service of DMA by pulling DREQ (DMA request) highDMA puts high on HRQ (hold request), CPU finishes present bus cycle (not necessarily present instruction) and puts high on HDLA (hold acknowledge). HOLD remains active for duration of DMADMA activates DACK (DMA acknowledge), telling device to start transferDMA starts transfer by putting address of first byte on address bus and activating MEMR; it then activates IOW to write to peripheral. DMA decrements counter and increments address pointer. Repeat until count reaches zeroDMA deactivates HRQ, giving bus back to CPU</p></li><li><p>8237 DMA Usage of Systems Bus</p></li><li><p>Conclusion: I/O ChannelsI/O devices getting more sophisticatede.g. 3D graphics cardsCPU instructs I/O controller to do transferI/O controller does entire transferImproves speedTakes load off CPUDedicated processor is faster</p></li></ul>

Recommended

View more >