Published by: Zaya
Published date: 22 Jun 2021
• Different people look at I/O hardware differently
• Electrical engineers look in terms of chips, wires, motors, power supplies, and other physical components that make up the hardware
• Programmers look at the interface presented to the software (the commands the hardware accepts, the function it carries out, and the errors that can be reported back)
• We are concerned with programming I/O devices, not designing, building, or maintaining them.
• Our interest is restricted to how the hardware is programmed not, how it works inside.
I/O devices are the pieces of hardware used by a human (or another system) to communicate with a computer. For instance, a keyboard or computer mouse is an input device for a computer, while monitors and printers are output devices. Devices for communication between computers, such as modems and network cards, typically perform both input and output operations.
I/O devices can be roughly divided into:
• A device controller is a piece of hardware that receives commands from the system bus, translates them into device actions, and reads/writes the data onto the system bus.
• I/O devices typically consist of two components: electrical and mechanical
• The electronic component is called the device controller or the adapter
• A device controller is a part of a computer system that makes sense of the signals going to, and coming from the CPU
• There are many device controllers in a computer system
• Any device connected to the computer is connected by a plug and socket, and the socket is connected to a device controller
• In a personal computer, device controller usually takes the form of a chip on the parent board
• Many controllers can handle two, four, or even eight identical devices
Direct Memory Access (DMA) is a method that allows an input/output (I/O) device to send or receive data directly to or from the main memory, bypassing the CPU to speed up memory operations. CPU is only involved at the beginning and end of the transfer and interrupted only after the entire block has been transferred. Slow devices like keyboards will generate an interrupt to the main CPU after each byte is
transferred. If a fast device such as a disk generated an interrupt for each byte, the operating system would spend most of its time handling these interrupts. So a typical computer uses direct memory access (DMA) hardware to reduce this overhead.
Direct Memory Access needs special hardware called DMA controller (DMAC) that manages the data transfers and arbitrates access to the system bus. The controllers are programmed with source and destination pointers (where to read/write the data), counters to track the number of transferred bytes, and settings, which include I/O and memory types, interrupts, and states for the CPU cycles.
Use CPU over DMA if