Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <linux/module.h> /* Needed by all modules */
- #include <linux/kernel.h> /* Needed for KERN_INFO */
- #include <linux/interrupt.h>
- unsigned int irq = 20;
- //exported by linux/arch/arm/mach-imx/tzic.c
- unsigned long tzic_domain_irq(unsigned long const hwirq);
- void tzic_end_sw_irq(unsigned long const irq);
- static irqreturn_t handler(int irq, void *dev_id)
- {
- printk(KERN_INFO "handler!\n");
- /* end software interrupt */
- tzic_end_sw_irq(irq);
- return IRQ_HANDLED;
- }
- int init_module(void)
- {
- int err;
- irq = tzic_domain_irq(irq);
- printk(KERN_INFO "irq: %d",irq);
- if( ( err = request_irq(irq, handler, 0, "trapps", NULL) ) )
- {
- printk(KERN_ERR "error: %d!",err);
- } else {
- printk(KERN_INFO "successfully requested irq %d\n",irq);
- }
- return err;
- }
- void cleanup_module(void)
- {
- printk(KERN_INFO "Goodbye world 1.\n");
- free_irq(irq, NULL);
- }
- MODULE_LICENSE("GPL");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement