IRQ中断未被触发

时间:2018-06-06 12:12:52

标签: linux linux-kernel pwm irq

我的驱动程序代码:

static irqreturn_t pwm_cnt_interrupt(int irq, void *data)
{

    printk("==> %s\r\n", __func__);

    return IRQ_HANDLED;

}

static int ecap_cnt_probe(struct platform_device *pdev)
{

    pc = devm_kzalloc(&pdev->dev, sizeof(*pc), GFP_KERNEL);
    if (!pc)
            return -ENOMEM;

    clk = devm_clk_get(&pdev->dev, "fck");
    if (IS_ERR(clk)) {
            if (of_device_is_compatible(np, "ti,counter-ecap")) {
                    dev_warn(&pdev->dev, "Binding is obsolete.\n");
                    clk = devm_clk_get(pdev->dev.parent, "fck");
            }
    }

    if (IS_ERR(clk)) {
            dev_err(&pdev->dev, "failed to get clock\n");
            return PTR_ERR(clk);
    }

    pc->clk_rate = clk_get_rate(clk);
    if (!pc->clk_rate) {
            dev_err(&pdev->dev, "failed to get clock rate\n");
            return -EINVAL;
    }

    /* Get PWM IRQ number */
    ecapirq = platform_get_irq(pdev, 0);
    if (ecapirq < 0) {
        printk(KERN_ERR "Could not get IRQ");
        return -EINVAL;
    }
    printk(KERN_DEBUG "irq =  %d\n", ecapirq);

    oreore_dentry = debugfs_create_file("counter", 0666, NULL, &value, &fops);

    if(request_irq(ecapirq, pwm_cnt_interrupt, IRQF_SHARED,
                    "counter", (void *)&counter)) {
            printk(KERN_ERR "pwm counter: Can't allocate irq %d\n",
                            ecapirq);
            return -EBUSY;
    }
    enable_irq(ecapirq);
    return 0;
}

我的中断在/ proc / interrupts中被注册 但是,它不会被触发。

我已将UART与我的pwm中断引脚相连。我使用uart端口发送数据。我的irq处理程序当时没有被调用。

需要帮助。

0 个答案:

没有答案