2007-11-30 11:45:26 Interrupt test program
Peterson Deck (ARGENTINA)
Message: 47914 Hi,
I am trying to do an interrupt test program, but i'm getting problems.
I need execute a function when PF5 is set to 'high level'
my program:
#include <linux/module.h>
#include <linux/errno.h>
#include <linux/interrupt.h>
#include <asm/io.h>
#include <asm/irq.h>
#define CONFIG_YOURDRIVERS_IRQ_PFX IRQ_PF5
static irqreturn_t your_irq_handler (int irq, void *dev_id)
{
printk(KERN_INFO"your_irq_handler \n");
return IRQ_HANDLED;
}
static int __init your_drivers_init_function(void)
{
if (request_irq(CONFIG_YOURDRIVERS_IRQ_PFX, your_irq_handler, IRQT_RISING, "TWIKeypad",NULL))
{
printk(KERN_WARNING "IRQ %d is not free.\n", CONFIG_YOURDRIVERS_IRQ_PFX);
return -EBUSY;
}
disable_irq(CONFIG_YOURDRIVERS_IRQ_PFX);
// ... some code ...
enable_irq(CONFIG_YOURDRIVERS_IRQ_PFX);
}
void __exit your_drivers_exit_function(void)
{
free_irq (CONFIG_YOURDRIVERS_IRQ_PFX, NULL);
}
module_init(your_drivers_init_function);
module_exit(your_drivers_exit_function);
MODULE_AUTHOR("Test");
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("Test Interrupt");
When i try to load:
root:~> insmod interrupcao.ko
Using iIRQrr 5ca5 kois not free.
insmod: cannot insert `interrupcao.ko': Device or resource busy (-1): Device or resource busy
root:~>
Thanks
QuoteReplyEditDelete
2007-11-30 13:19:31 Re: Interrupt test program
Mike Frysinger (UNITED STATES)
Message: 47915 you should run `dmesg` to get ungarbled output
but most likely, something is already using PF5
review /proc/interrupts