O'Reilly logo

FreeBSD Device Drivers by Joseph Kong

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Tying Everything Together

Now that you’ve gained some familiarity with disk and bio structures, let’s dissect a real-world storage driver.

Example 13-1 is the storage driver for Atmel’s AT45D series of DataFlash chips. DataFlash is Atmel’s serial interface for flash memory, employed on the Serial Peripheral Interface (SPI) bus. In short, Example 13-1 is a storage driver for flash memory on the SPI bus.

Note

Take a quick look at this code and try to discern some of its structure. If you don’t understand all of it, don’t worry; an explanation follows.

Example 13-1. at45d.c

#include <sys/param.h> #include <sys/module.h> #include <sys/kernel.h> #include <sys/systm.h> #include <sys/bus.h> #include <sys/conf.h> #include <sys/bio.h> #include <sys/kthread.h> ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required