/iqr_test irq_traditional/
#include <linux/module.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/irq.h>
#include <linux/interrupt.h>
#include <linux/gpio.h>
#include <linux/delay.h>
#include <linux/fs.h>
#include <linux/uaccess.h>
#include <linux/io.h>
#include <mach/hardware.h>
#include <linux/device.h>
#include <linux/sched.h>
#include <mach/regs-gpio.h>
#include <plat/gpio-fns.h>
int irq_num;
irqreturn_t irq_handler(int irq, void *args){
printk(KERN_INFO "I am a irq_handler function\n");
return IRQ_RETVAL(IRQ_HANDLED);
}
static int __init hello_init(void){
int ret;
irq_num = gpio_to_irq(S3C2410_GPF(0));
printk(KERN_INFO "irq_num = %d\n", irq_num);
ret = request_irq(irq_num, irq_handler, IRQF_TRIGGER_RISING, "irq_test", NULL);
if(ret < 0){
printk(KERN_INFO "request_irq failed\n");
}
return 0;
}
static void __exit hello_exit(void){
free_irq(irq_num, NULL);
printk(KERN_INFO "irq_exit\n");
return;
}
module_init(hello_init);
module_exit(hello_exit);
MODULE_LICENSE("GPL");
标签:中断,irq,int,num,exit,内核,jz2400,printk,include
From: https://www.cnblogs.com/zxz-FINE/p/17911666.html