Section 18.5: Device Drivers and System Calls (Frame 2)                     [prev][home][next]

Peripheral devices are usually composed of two pieces: the actual device which does the input or output, and accompanying control circuitry called the controller. Controllers can be quite extensive and are oftentimes computers in their own right. As an example, the old Commodore 64 computer had a 6502 chip as its main processor. When a floppy disk drive was added later, the disk drive was encased in its own box and connected to the C-64 via a serial bus wire. But the controller to the disk drive was another 6502 computer!

A controller makes it much easier to write device drivers because it allow the commands coming from the OS to be somewhat high level. For each such command, the controller issues sequences of very minute and specific instructions to the device. For example, a controller for a floppy disk drive must turn the main motor off when a read or write is requested. It must also monitor that the motor is not left running too long because floppy disks are in constant contact with the read/write head so they will wear out quickly if they spin all the time. (Hard disks are usually spinning all the time so this is not an issue.) Then the stepper motor must be turned on and off in order to advance the read/write head to the next. Finally, the data must be gated to the bus at the right time and status information delivered back to the OS.