Devices and Device Drivers

Learning Objectives

  • By the end of this module, you should be able to:

    • Describe how OSs communicate with various categories of I/O devices

    • Explain the need for device drivers

    • Install device drivers

    • Install printers

I/O Device Communication and Categories

  • This moduel focuses on the input and output I/O tasks, which include:

    • Handling input from the keyboard, mouse, and other input devices

    • Handling output to the screen, printer, and other output devices

    • Controlling information storage and retrieval using storage devices like disk drives

    • Communicating with remote computers through a network

I/O Device Communication Strategies

  • A register is a storage location associated with the I/O device that data can be read from and written to

  • The I/O controller reads commands written ti the control register and performs the requested action

  • The control register is where the device driver writes commands such as read or write for the I/O controller to act upon

  • The data register is where the device driver writes data that the device outputs and reads data that the device inputs

  • A status register might indicate to the device driver whether the device is ready to accept a command, that the device is busy, or that an interrupt has occurred

  • Most control and data registers are a byte or a word in length

    • A word might be two or four bytes

  • In some cases, the data registers might be supplemented by a first-in first-out (FIFO) chip, in which multiple bytes or words of input or output data are stored in the order they were received

  • Port-Mapped Versus Memory-Mapped I/O

    • Port-mapped I/O uses dedicated memory addresses, referred to as ports, and special CPU instructions to communicate with I/O devices

    • With memory-mapped I/O, the control and data registers are mapped into the computer’s main memory space and the CPU uses the same instructions for reading and writing I/O registers as it does for reading and writing RAM

  • Programmed I/O Versus Direct Memory Access

    • I/O devices that require the CPU to read and write each byte or word of data from and to the device registers are called programmed I/O (PIO) devices

    • Modern computers use a process called direct memory access (DMA) to transfer large blocks of memory to and from I/O devices with little involvement by the CPU

      • A DMA controller transfers data between the I/O device and a block of memory, allowing the CPU to attend to other tasks