|
本帖最后由 tc317891209 于 2016-9-27 15:08 编辑
以上是Qsys连线和设备树,中断号为3,对应手册GIC :75
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
MODULE_LICENSE("Dual BSD/GPL");
struct resource *pio_res = NULL;
irqreturn_t pio_interrupt(int irqno, void *devid)
{
printk("irqno = %d\n", irqno);
return IRQ_HANDLED;
}
int fpga_pio_init(struct platform_device *p)
{
printk("Probe....\n");
int ret = 0;
int irqflags;
pio_res = platform_get_resource(p,IORESOURCE_IRQ,0);
if (pio_res == NULL) {
printk("No resource !\n");
}
irqflags = IRQF_DISABLED | (pio_res->flags & IRQF_TRIGGER_MASK);
ret = request_irq(pio_res->start, pio_interrupt, irqflags, "fpga_irq", NULL);
if (ret < 0) {
printk("failed request irq: irqno = irq_res->start");
}
printk("register irq success!\n");
return 0;
}
static int fpga_pio_exit(struct platform_device *p)
{
printk("Remove...\n");
free_irq(pio_res->start, NULL);
printk("unregister irq exit\n");
return 0;
}
static const struct of_device_id fpga_pio_of_matches[] = {
{.compatible = "DE1-SoC,FPGA_IRQ0",},
{ }
};
MODULE_DEVICE_TABLE(of, fpga_pio_of_matches);
static struct platform_driver fpga_pio_driver = {
.driver = {
.name = "fpga_irq",
.owner = THIS_MODULE,
.of_match_table = of_match_ptr(fpga_pio_of_matches),
},
.probe = fpga_pio_init,
.remove = fpga_pio_exit,
};
module_platform_driver(fpga_pio_driver);请大家帮忙看下,我的button pio是接到一个按键上,按理说按一下按键应该会进入中断处理函数,但是按了按键没反应,帮忙看看是不是程序存在问题。谢谢大家。有关于ARM想要交流的私信我。
|
|