Skip to contentSkip to conversation

IRQ Level / Edge

DISCUSSION Sylvain Munaut 4 participants 6 messages Jul 2, 2004 – Jul 4, 2004

lore
Share & tools
lore
#0 lore raw

Hello

I don't really understand what setting an IRQ as Level or Edge really implies. ( I mean in irq_desc[i] )
And how to know what to put.

Can some one explain me or give me some pointers.

Sylvain Munaut

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#1 lore raw

Level sensitive Interrupts will continue to fire until the interrupt is cleared. Essentially, the hardware device causing the interrupt will bring the interrupt line up (or down, depending on the polarity), and keep it at that level until the condition disappears. By setting the IRQ controller to consider that interrupt level-sensitive, the controller knows that the interrupt is still firing, and if you unmask the interrupt while the signal is high, it will fire again.

Edge sensitive means that the interrupt only fires on a transition (low to high for positive, high to low for negative). Thus you don't have to worry about clearing the interrupt before unmasking it.

I'm not sure if that's clear, but to summarize: Level and edge are descriptions of how the interrupt is detected (by the "level" of the interrupt, or by a transition *to* that level). As for where to find out which it is, the manual for the device should specify whether the interrupt signal is level or edge sensitive.

Quoted 14 lines · Sylvain Munaut

Hello

I don't really understand what setting an IRQ as Level or Edge really implies. ( I mean in irq_desc[i] )
And how to know what to put.

Can some one explain me or give me some pointers.

Sylvain Munaut

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#2 lore raw
Quoted 13 lines · Andy Fleming

Level sensitive Interrupts will continue to fire until the interrupt is cleared. Essentially, the hardware device causing the interrupt will bring the interrupt line up (or down, depending on the polarity), and keep it at that level until the condition disappears. By setting the IRQ controller to consider that interrupt level-sensitive, the controller knows that the interrupt is still firing, and if you unmask the interrupt while the signal is high, it will fire again.

Edge sensitive means that the interrupt only fires on a transition (low to high for positive, high to low for negative). Thus you don't have to worry about clearing the interrupt before unmasking it.

Quoted 5 lines

I'm not sure if that's clear, but to summarize: Level and edge are descriptions of how the interrupt is detected (by the "level" of the interrupt, or by a transition *to* that level). As for where to find out which it is, the manual for the device should specify whether the interrupt signal is level or edge sensitive.

Err, i suppose the interesting bit is not how the board designer will know wheter the interrupt is edge or level, but how the kernel running on the board is able to detect it ?

Friendly,

Sven Luther

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#3 lore raw
Quoted 7 lines

Err, i suppose the interesting bit is not how the board designer will know wheter the interrupt is edge or level, but how the kernel running on the board is able to detect it ?

Friendly,

Well, the kernel doesn't detect it. You have to tell him ! That's why I asked, because in the interrupt controller code, you have to set it in the irq_desc[i] structure.

Sylvain

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#4 lore raw
Quoted 11 lines · Sylvain Munaut
Quoted 6 lines

Err, i suppose the interesting bit is not how the board designer will know wheter the interrupt is edge or level, but how the kernel running on the board is able to detect it ?

Friendly,

Well, the kernel doesn't detect it. You have to tell him ! That's why I asked, because in the interrupt controller code, you have to set it in the irq_desc[i] structure.

Indeed, the kernel *can't* detect this (at least not easily). You have to know how the device (chip, etc) works. If it generates edge interrupts, then typically it will only generate a small pulse and the interrupt controller has to be set up to recognize this. For edge interrupts, you normally only care about either a "falling" edge (the transition from logic high to logic low) or "rising" edge (low to high). It is then up to the device driver to tell the device to generate the next interrupt as part of the interrupt service. Most devices will not generate another edge until the current one has been "cleared" or "acknowledged."

If it is a level interrupt, then the device will assert its interrupt signal until told to remove it (by the device driver). In this case, it is important for the interrupt controller to be aware that this signal may persist (it's a level) and only tell the CPU about it once. In this case, the driver needs to tell the interrupt controller when it has serviced the interrupt so that it will recognize when the device re-asserts its interrupt signal.

n.b. this assumes that the interrupt controller is behaving like an edge itself, i.e. it only interrupts the CPU once per state change.

--
Gary Thomas <[email protected]>
MLB Associates

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#5 lore raw
In reply to Sylvain Munaut
Quoted 6 lines · Sylvain Munaut
Quoted 6 lines

Err, i suppose the interesting bit is not how the board designer will know wheter the interrupt is edge or level, but how the kernel running on the board is able to detect it ?

Quoted 6 lines
Quoted 1 line

Friendly,

Well, the kernel doesn't detect it. You have to tell him ! That's why I asked, because in the interrupt controller code, you have to set it in the irq_desc[i] structure.

Mmm, i suppose the firmware would know about it, and it should be possible to read it from there ?

Friendly,

Sven Luther

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/