Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
The following functions, declared in <sys/bus.h>, register or tear down an interrupt handler:
#include <sys/param.h>
#include <sys/bus.h>
int
bus_setup_intr(device_t dev, struct resource *r, int flags,
driver_filter_t filter, driver_intr_t ithread, void *arg,
void **cookiep);
int
bus_teardown_intr(device_t dev, struct resource *r, void *cookiep);
The bus_setup_intr function registers an interrupt handler with an IRQ. This IRQ must be allocated beforehand with bus_alloc_resource, as described in Hardware Resource Management in Don’t Panic.
The bus_setup_intr function is normally called during device_attach. The arguments for this function are described in the next few paragraphs.
The dev argument is the device whose interrupts are to be handled. This device must have an IRQ.