By liran bh | 5/16/2016 | Linux Kernel & Internals

Simple Interrupt Handling

#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/kdev_t.h>
#include <linux/fs.h>
#include <linux/cdev.h>
#include <asm/uaccess.h>
#include <linux/vmalloc.h>
#include <asm/io.h>
#include <linux/proc_fs.h>
#include <linux/interrupt.h>
#include <linux/wait.h>
 
MODULE_LICENSE("Dual BSD/GPL");
 
static irq = 12;
module_param(irq,int,0);
 
int * dev_id;
int flag = 0;
 
static irqreturn_t *irq_handle(void * dev_id)
{
    printk(KERN_DEBUG "Interrupt\n");
    return 0;
}
 
static int acme_init (void)
{
    int req_irq = request_irq(irq, &irq_handle, IRQF_SHARED, "mydev", &dev_id);
    printk(KERN_WARNING "%s init\n", current->comm);
    return 0;
}
 
static void hello_cleanup (void)
{
    printk (KERN_DEBUG "Module unloaded succefully.\n");
    free_irq(irq, &dev_id);
 
}
 
module_init (acme_init);
module_exit (hello_cleanup);

{{CommentsModel.TotalCount}} Comments

Your Comment

{{CommentsModel.Message}}

Recent Stories

Top DiscoverSDK Experts

User photo
3355
Ashton Torrence
Web and Windows developer
GUI | Web and 11 more
View Profile
User photo
3220
Mendy Bennett
Experienced with Ad network & Ad servers.
Mobile | Ad Networks and 1 more
View Profile
User photo
3060
Karen Fitzgerald
7 years in Cross-Platform development.
Mobile | Cross Platform Frameworks
View Profile
Show All
X

Compare Products

Select up to three two products to compare by clicking on the compare icon () of each product.

{{compareToolModel.Error}}

Now comparing:

{{product.ProductName | createSubstring:25}} X
Compare Now