分类: LINUX
2009-12-07 10:47:31
#include
#include
#include
#include
#define INTRNO 7
static void tasklet_callback(unsigned long da
{
printk(KERN_ALERT "received a interrupt.\n");
}
DECLARE_TASKLET(tasklet, tasklet_callback, 0);
static irqreturn_t irq_handler(int irq, void *arg)
{
tasklet_schedule(&tasklet);
return IRQ_HANDLED;
}
static int __init test_init(void)
{
int ret;
ret = request_irq(INTRNO, irq_handler, 0, "hello", NULL);
if (ret < 0)
goto err;
outb(0x10, 0x37a); /* enable parallel port interrupt */
err:
return ret;
}
static void __exit test_exit(void)
{
free_irq(INTRNO, NULL);
}
MODULE_LICENSE("GPL");
module_init(test_init);
module_exit(test_exit);