1
我在內核模塊中使用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