Re: how the interrupt handler(ISR) knows the source of interrupt ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 3/29/07, Rajat Jain <rajat.noida.india@xxxxxxxxx> wrote:
On 3/29/07, Mansha Linux <mansha.linux@xxxxxxxxx> wrote:
>
>
> On 3/29/07, Rajat Jain <rajat.noida.india@xxxxxxxxx> wrote:
> > On 3/29/07, Mansha Linux <mansha.linux@xxxxxxxxx> wrote:
> > > hi all,
> > >
> > > When the external hardware device  raise the interrupt the corresponding
> ISR
> > > will be executed.
> > > but how this ISR will come to know about the source of interrupt. i mean
> the
> > > ISR will identify with respect to device id ..but when this device id is
> > > passed to the ISR  and as well as IRQ number?
> >
> > Hi Mansha,
> >
> > The ISR itself has the responsibility of detecting whether the device
> > it serves, has raised the interrupt or not. Now how it confirms this
> > from the device is quite device specific and may vary. But most of the
> > devices have a status register kind of thing that you can test to see
> > if it generated the interrupt.
> >
> > Also, getting the device ID of the device is also the resposibility of
> > the ISR. But the most common approach is that when registering the
> > ISR, you also pass the device ID to request_irq(). So the ISR will
> > also get the device ID as parameter when it is called.
> >
> > Thanks,
> >
> > Rajat
> >
>
>
> Thanks for ur reply..
>
> >
> > >
> > > > The ISR itself has the responsibility of detecting whether the device
> > > > it serves, has raised the interrupt or not. Now how it confirms this
> > > > from the device is quite device specific and may vary. But most of the
> > > > devices have a status register kind of thing that you can test to see
> > > > if it generated the interrupt.
> > > >
> > >
> > > Also, getting the device ID of the device is also the resposibility of
> > > the ISR. But the most common approach is that when registering the
> > > ISR, you also pass the device ID to request_irq(). So the ISR will
> > > also get the device ID as parameter when it is called.
> > >
> >
> >
>
>
> -> ya, while registering the IRQ we will specify the divice id. but i wanted
> to know how the ISR will confirms the device id because we are not passing
> any divice id while interrupt is issued.

Here is how it works:

1) The driver registers ISR for each device it services, also telling
the kernel the corresponding device ID. This is done by calling
request_irq().

2) When the IRQ occurs, the kernel invokes EACH and every ISR hooked
onto that IRQ (Not just the ISR that actually services the device).

3) Each ISR receives its original device ID as parameter, it
determines whether the corresponding device is the one that generated
the IRQ.

HTH,

Rajat

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ



Just to add further details:


1) The driver registers ISR for each device it services, also telling
the kernel the corresponding device ID. This is done by calling
request_irq().

Passing dev_id is kind of mandatory when the IRQ line is shared,
usually we pass the dev struct here.

2) When the IRQ occurs, the kernel invokes EACH and every ISR hooked
onto that IRQ (Not just the ISR that actually services the device).
I think this is one of the reasons why Linux is not a real time OS,
please CMIIW.


--

Regards,
Sandeep.

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux