本文将介绍edge触发中断和level触发中断的相关概念。

1. 基本概念

1.1 Level triggered

as long as the IRQ line is asserted, you get an interrupt request. When you serve the interrupt and return, if the IRQ line is still asserted, you get the interrupt again immediately.

1.2 Edge triggered

You get an interrupt when the line changes from inactive to active state, but only once. To get a new request, the line must go back to inactive and then to active again.

2. 区别

A key difference between the edge-triggered and level-triggered interrupts is interrupt sharing. Level-triggered interrupts can be shared. Edge-triggered interrupts cannot be shared.

Level 触发中断可以共享(引脚),且不会丢失中断。

edge触发的中断是在中断对应pin发生电平信号跳变的时候,会发出一个中断请求。因为跳变是一瞬间的,不会像level触发中断那样一直保持电平不变,这样就可能会漏掉某一个跳变的瞬间,表现就是丢失了一个中断。
edge触发方式的中断容易丢中断,因此在处理中断时候不能长时间的屏蔽IRQ。

3. relation with ISA and PCI

ISA是edge触发。PCI中,通过引脚的中断是level触发;通过MSI的中断是edge 触发。


参考资料:

  1. Edge Triggered Vs Level Triggered interrupts
  2. Interrupt Trigger
  3. Interrupt in Linux
  4. edge中断分析