Summary


This chapter covered device drivers, modules, and system calls. We described the variety of ways that Linux uses device drivers.

More specifically, we covered the following topics:

  • We described the /dev TRee in the Linux filesystem and explained how to determine what device is controlled by what device driver.

  • We explained how device drivers use file structures and file operations structures to handle filesystem I/O.

  • We discussed the difference between user-level memory and kernel space memory and how device drivers need to copy data structures between the two.

  • We examined the wait queue construct of the Linux kernel and demonstrated how it is used when a device driver needs to wait for a particular resource to become available.

  • We explored the theory behind wait queues and interrupts, which are the methods that the Linux kernel uses to cleanly interrupt the processing of device drivers when the CPU needs to be yielded to another process.

  • We introduced Linux system calls and outlined their basic functions.

  • We covered the differences between block and character device drivers and the new device model that was introduced in Linux 2.6. This involved a quick tour of sysfs.

In the first part of Chapter 10, these topics were talked about from an abstract level, and we traced a specific device driver, /dev/random, tHRough the topics described. The second part of Chapter 10 provided more concrete examples and sample code for how to actually construct a device driver.

More specifically, we detailed the following concepts:

  • We showed how to construct nodes in /dev that could be attached to a device driver and how to construct dynamic modules.

  • We described the new methods in Linux 2.6 to export symbols from device driver modules.

  • We demonstrated how a device driver provides IOCTL functions that allows the device to interact with Linux via the filesystem.

  • We explained how interrupts and polling occur and the difference between spinlocks in the x86 and PPC architecture.

  • We explained how to add a simple system call to the Linux kernel.

Chapter 10 provides a solid basis for developing device drivers in Linux 2.6 and combines, in a practical fashion, the ideas and concepts we introduced previously in this book.




The Linux Kernel Primer. A Top-Down Approach for x86 and PowerPC Architectures
The Linux Kernel Primer. A Top-Down Approach for x86 and PowerPC Architectures
ISBN: 131181637
EAN: N/A
Year: 2005
Pages: 134

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net