<p><br>
在 2012-12-21 PM6:53,"anish kumar" <<a href="mailto:anish198519851985@gmail.com">anish198519851985@gmail.com</a>>写道:<br>
><br>
> On Fri, 2012-12-21 at 17:34 +0800, Woody Wu wrote:<br>
> ><br>
> > 在 2012-12-21 AM2:05,"anish singh" <<a href="mailto:anish198519851985@gmail.com">anish198519851985@gmail.com</a>>写<br>
> > 道:<br>
> > ><br>
> > ><br>
> > > On Dec 20, 2012 6:30 AM, "Woody Wu" <<a href="mailto:narkewoody@gmail.com">narkewoody@gmail.com</a>> wrote:<br>
> > > ><br>
> > > > Hi, List<br>
> > > ><br>
> > > > Where is the Kernel code that handles external interrupts? I want<br>
> > to<br>
> > > > have a look at it but haven't found out where it is.<br>
> > > ><br>
> > > > Actually, I have some basic questions about interrupt handling in<br>
> > Linux.<br>
> > > > 1. After Kernel's ISR received an interrupt, I believe it will<br>
> > invoke a<br>
> > > > handler defined in a device driver if any. But it should be the<br>
> > > > device driver's responsibility or kernel ISR's responsibility<br>
> > to<br>
> > > > clear (or acknowledge) the interrupt?<br>
> > > If the interrupt in question is currently being handled then in<br>
> > > the case of edge triggered interrupt we just mask the interrupt,set<br>
> > it pending and bail out.Once the interrupt handler completes then we<br>
> > check for pending interrupt and handle it.In level triggered we don't<br>
> > do that.<br>
> > > Kerenel ISR -this is mixture of core kernel interrupt handling code<br>
> > + your device driver interrupt handler(if this is chip driver which is<br>
> > supposed to get one interrupt and is reponsible for calling other<br>
> > interrupt handlers based on the chip register status then you do<br>
> > explicit masking unmasking yourself).<br>
> > > If you device driver is a interrupt controller driver then you<br>
> > register your driver with kernel interrupt handling code and need to<br>
> > write some callbacks such as .mask,.unmask and so on.This callbacks<br>
> > are called at appropiate places whenever the interrupt is raised.This<br>
> > interrupt is then passed to drivers who has requested for this<br>
> > interrupt by calling request_irq.<br>
> ><br>
> > Sorry not fully understand . My device is an interrupt line is back to<br>
> > inactive.Ethernet controller. It needs to response TX and RX<br>
> > interrupts triggered by the device itself. In this case , my driver is<br>
> > a chip driver or interrupt controller driver in your terms?<br>
> Your device is neither of these.<br>
> ><br>
> > If my driver needs to do the mask and unmask job, what's the kernel<br>
> > API I should call?<br>
> You don't need to worry about mask and unmask job AFAIK.<br>
> ><br>
> > And , I don't understand why there exists differences between level<br>
> > and edge triggered interrupts in terms of kernel handling.<br>
> Level type interrupts are active as long as the hardware line has the<br>
> active level. This may require to mask the interrupt and unmask it after<br>
> the associated handler has acknowledged the device, so the interrupt<br>
> line is back to inactive.</p>
<p>This is a little confusing. You just said I don't need to worry mask and unmask things. But now you say I need to for the level triggered interrupts... And, what's the mask and unmask APIs that I can call?</p>
<p>> Edge interrupt occurs on the falling and/or rising edge of a hardware<br>
> signal.The occurrence is latched into the irq controller hardware<br>
> and must be acked in order to be re-enabled.<br>
> Read the code /kerel/irq/chip.c(handle_edge_irq & handle_level_irq)</p>
<p>Thanks for pointing me there.</p>
<p>> ><br>
> > I know my questions might be basic , so would please tell me what's<br>
> If it was not basic then this question wouldn't be in kernelnewbies<br>
> right :)?<br>
> > the kernel code for ARM architecture doing these complex jobs as you<br>
> > explained?<br>
> You don't need to worry about it but if you want to know further then I<br>
> suggest tracing the call flow from asm interrupt handler(I believe<br>
> do_irq but not sure) in arm to handle_edge_irq call flow by adding some<br>
> logs or just browsing the code.</p>
<p>Okay I will be reading the code. If you have time please also be kind to help answer my previous questions in this message. Thanks a lot!</p>
<p>> ><br>
> > Thanks in advance !<br>
> ><br>
> > ><br>
> > > ><br>
> > > > 2. My device, an AX88796B network controller, asserting the<br>
> > interrupt<br>
> > > > line in a level-triggered manner. Now I met problem with the<br>
> > device that<br>
> > > > might caused by the CPU interrupt mode is not set as<br>
> > level-triggered by<br>
> > > > edge trigger. My CPU is Samsung S3C2410, an ARM920T powered<br>
> > one. Does<br>
> > > > anyone know usually where and how should I do this kind of<br>
> > setting?<br>
> > > Just pass the parameter "level triggered" in request_irq in your<br>
> > device driver.<br>
> > ><br>
> > > ><br>
> > > ><br>
> > > > Thanks in advance.<br>
> > > ><br>
> > > > --<br>
> > > > woody<br>
> > > > I can't go back to yesterday - because I was a different person<br>
> > then.<br>
> > > ><br>
> > > > _______________________________________________<br>
> > > > Kernelnewbies mailing list<br>
> > > > <a href="mailto:Kernelnewbies@kernelnewbies.org">Kernelnewbies@kernelnewbies.org</a><br>
> > > > <a href="http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies">http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies</a><br>
> ><br>
> ><br>
><br>
><br>
</p>