linux zynq 中断控制器

一、zynq中断说明
uart@e0001000 {
 compatible = "xlnx,ps7-uart-1.00.a";
 reg = <0xe0001000 0x1000>;
 interrupts = <0x0 0x32 0x0>;
 interrupt-parent = <&gic>;
 clock = <50000000>;
};

第二个参数是中断号。传递的过程中会区分是否为spi中断,如果是spi中断则加16,非spi则加32 ,

所以在devicetree中的生成的中断号是实际中断号减去32 ;

二、实际使用过程

PL端配置中断控制IN9


这样我们在配置设备树需

pl-int{
       compatible = "zynq,pl-int";
       interrupt-parent = <&intc>;
       interrupts = <0 53 1>;
       status = "disabled";

    };

这里中断号为53,因为中断号和实际的中断号之间相差32,那么实际的中断号就是85。



三、驱动实现

static int Int_probe(struct platform_device *pdev)
{
    int ret;
    struct resource *r_irq;
    r_irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);

    if (!r_irq) {
      printk(KERN_INFO"no IRQ found\n");
      return 0;
    }
    ret = request_irq(r_irq->start, input_handler, IRQ_TYPE_EDGE_RISING, "input_handle", NULL);
    if (ret) {
      printk(KERN_INFO"testmodule: Could not allocate interrupt %d\n",
         r_irq->start);
    }
    misc_register(&int_miscdev);   
    return ret;
}


发布了64 篇原创文章 · 获赞 63 · 访问量 10万+

猜你喜欢

转载自blog.csdn.net/qq84395064/article/details/79208538
今日推荐