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

Implementing an Interrupt Handler

Example 8-1 is a contrived Newbus driver designed to demonstrate interrupt handlers. Example 8-1 sets up an interrupt handler on the parallel port; on read, it sleeps until it receives an interrupt.

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 8-1. pint.c

#include <sys/param.h> #include <sys/module.h> #include <sys/kernel.h> #include <sys/systm.h> #include <sys/conf.h> #include <sys/uio.h> #include <sys/bus.h> #include <sys/malloc.h> #include <machine/bus.h> #include <sys/rman.h> #include <machine/resource.h> #include <dev/ppbus/ppbconf.h> #include "ppbus_if.h" #include <dev/ppbus/ppbio.h> #define PINT_NAME ...

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