
84
Chapter 7
In this chapter:
• Control and Status
Registers
• The Device Driver
Philosophy
• A Simple Timer
Driver
• Das Blinkenlights,
Revisited
7
Peripherals 7.
Each pizza glides into a slot like a circuit board into a
computer, clicks into place as the smart box interfaces
with the onboard system of the car. The address of the
customer is communicated to the car, which computes
and projects the optimal route on a heads-up display.
—Neal Stephenson
Snow Crash
In addition to the processor and memory, most embedded systems contain a hand-
ful of other hardware devices. Some of these devices are specific to the applica-
tion domain, while others—like timers and serial ports—are useful in a wide variety
of systems. The most generically useful of these are often included within the
same chip as the processor and are called internal, or on-chip, peripherals. Hard-
ware devices that reside outside the processor chip are, therefore, said to be exter-
nal peripherals. In this chapter we’ll discuss the most common software issues that
arise when interfacing to a peripheral of either type.
Control and Status Registers
The basic interface between an embedded processor and a peripheral device is a
set of control and status registers. These registers are part of the peripheral hard-
ware, and their locations, size, and individual meanings are features of the periph-
eral. For example, the registers within a serial controller ...