Wednesday 21 June 2017

how do I find which interrupt handler to use for shared interrupt line ?

The kernel will sequentially invoke all the handlers for that particular shared line.

Exactly. Say Dev1 and Dev2 shares the IRQ10. When the interrupt is generated, ISRs registered with this line will be invoked one by one.

In our scnario, say Dev2 is generating interrupt. If Dev1's ISR is registered first, then that ISR only called first. In that ISR, interrupt status register will be verified for interrupt. If no interrupt bit is set then we can confirm that interrupt is not Dev2's. so next ISR(i.e Dev1's ISR) will be called.

see the return values IRQ_NONE/IRQ_HANDLED for more information.

How does the handler know that the corresponding device issued the interrupt or not ?

By reading the Interrupt status register only.

Is this information relayed through the interrupt controller that is between the devices and the processor interrupt line ??

Im not sure about this. But the OS will take care of calling ISRs based on the return values from ISR.

  1. Interrupt vectors can be shared between multiple devices. By returning IRQ_NONE/IRQ_HANDLED, an interrupt handler can indicate that the interrupt was/was not from the device it is specifically interested in. If IRQ_NONE is returned, the next handler in the list should be called.
  2. Even if the IRQ is not shared, an interrupt handler can indicate to the interrupt subsystem that there were problems handling the interrupt and that it should be disabled to prevent system hangs from an irq loop

No comments:

Post a Comment