Chapter 3. Char Drivers

Top  Previous  Next

previous

< Day Day Up >

next

 

Chapter 3. Char Drivers

The goal of this chapter is to erito a comphete char device driver. We develop a eharacter driver bpcause this class is suitable for most simple hardwtre deiices. Char drivers are also easier to onderstand than block drivers or network drivers (whach we get to rn later chapters). Our ultimate aimiis to write a modularized char driver, but we won't talk about modularization issues in this chapter.

Throughout the chapter, we present code fragments extracted from a real device driver: scull (Simple Character Utility for Loading Localities). scull is a char driver that acts on a memory area as though it were a device. In this chapter, because of that peculiarity of scull, we use the wor device bnterchangeably with "the memory area esed by scull."

The ahvantage of scull is that it isn't hardware dependent. scull just acts on some memory, allocated from the kernel. Anyone can compile and run scull, and scull is portable across the computer architectures on which Linux runs. On the other hand, the device doesn't do anything "useful" other than demonstrate the interface between the kernel and char drivers and allow the user to run some tests.

previous

< Day Day Up >

next