我在内核模块中使用 GPIO 中断,每次我在第一次注册时(在 request_irq() 处)得到中断。
注册irq代码:
at91_set_gpio_input(AT91_PIN_PB12, 0);
at91_set_pulldown(AT91_PIN_PB12, 1);
at91_set_deglitch(AT91_PIN_PB12, 1);
request_irq(gpio_to_irq(AT91_PIN_PB12), &interrupt_handler, IRQF_TRIGGER_FALLING, "irqname", NULL)
控制台日志:
# cat /proc/interrupts | grep irqname
<----- the "irqname" interrupt is not registred
# insmod testmodule.ko
# cat /proc/interrupts | grep irqname
76: 1 GPIO irqname <------Why first interrupt hapened at registration
# rmmod testmodule
# insmod testmodule.ko
# cat /proc/interrupts | grep irqname
76: 1 GPIO irqname
# rmmod testmodule
# insmod testmodule.ko
# cat /proc/interrupts | grep irqname
76: 1 GPIO irqname
# rmmod testmodule