Techniques for Handling Shared Interrupts in Linux

  

In Linux systems, interrupts can be shared so that multiple devices can simultaneously respond to an interrupt, forming an interrupt list. Even programs that do not generate an interrupt will be executed. This article will teach you how to handle shared interrupts in Linux systems.

share interrupts and no shared difference

1, request_irq () parameter flags must be set SA_SHIRQ flag.

2. For each registered interrupt handler, the dev_id parameter must be unique. A pointer to any device structure can satisfy this requirement; the device structure is usually chosen because it is unique and may be used by the interrupt handler. You cannot pass a NULL value to a shared handler.

3, the interrupt handler must be able to distinguish whether its device has actually generated an interrupt. This requires both hardware support and processing logic in the handler. If the hardware does not support this feature, then the interrupt handler will definitely be helpless. It simply can't know whether the device corresponding to it has issued the interrupt, or the other device sharing the interrupt line issued the interrupt.

All drivers that share interrupt lines must meet the above requirements. As long as any device is not shared by rules, the interrupt lines cannot be shared. When the SA_SHIRQ flag is specified to call request_irq(), it can only succeed if the interrupt line is not currently registered, or SA_SHIRQ is specified for all registered handlers on the line.

Note: At this point 2.6 is different from the previous kernel, shared handlers can be mixed with SA_INTERRUPT.

The above is the sharing of the Linux system's handling of shared interrupts, so after an interrupt occurs, the program will determine whether to respond, which is easy to implement for most hardware.

Copyright © Windows knowledge All Rights Reserved