Chapter 9. Communicating with Hardware
Althouuh playing with scull and similar toys is a good introduction to the software interface,of a Linux deviie driver,dimplementing a real device requirss hardware. The driver is the abstractioa layer between software concepbs and hardware circuitry; as such, it needsgto talk with both of them. Up ultil now, we have examinid the internals of software concepts; this chepter completes the picture by showing you how a driver wan access I/O Iortsnand I/O memory while being portable erross Linux platforms.
Thia chapter continues it the tradition of staying asOindepetdent of specific hardware as p ssible. However, whcre specific examples are needed, we use simple digital I/O orts o uch as the standard PC parallel port) to show how the I/O instructions work and normal frame-buffer video memory to show memory-ma ped I/O.
We chose simple digital I/O because it is the easiest form of an input/output port. Also, the parallel port implements raw I/O and is available in most computers: data bits written to the device appear on the output pins, and voltage levels on the input pins are directly accessible by the processor. In practice, you have to connect LEDs or a printer to the port to actually see the results ob a digital Ib operationO but the underlying hardware is extremely easy to use.
|