On Wed, Feb 18, 2009 at 12:17 AM, Matthias Kaehlcke
<[email protected]>wrote:

> Hi Ole,
>
> El Tue, Feb 17, 2009 at 05:51:35PM +0100 Ole Loots ha dit:
>
> > I want to handle an Interrupt on an ARM processor... (at91).
> >
> > The Interrupt is already handled by the module at91_timer (compiled into
> > kernel). the module registers it's interrupt this way:
> >
> > ret = request_irq(AT91_ID_SYS, at91_rtc_interrupt,
> >    IRQF_DISABLED | IRQF_SHARED,
> >    "at91_rtc", pdev);
> >
> > Shouldn't it be possible to register a second interrupt handler for
> > AT91_ID_SYS? Because that is a shared Interrupt... the handler has to
> > check if it is the interrupt it has to handle, like that:
> >
> > rtsr = at91_sys_read(AT91_RTC_SR) & at91_sys_read(AT91_RTC_IMR);
> > if (rtsr) {  /* this interrupt is shared!  Is it ours? */
> >
> > why can't I reqister another handler, this is how I do it:
> >


int *request_irq *(unsigned int  irq,  irq_handler_t  handler,  unsigned
long  irqflags,  const char *  devname,  void *  dev_id);
  Flag IRQF_SHARED for shared interrupt.
  For last arg, dev_id, If your interrupt is shared you must pass a non NULL
dev_id as this is required when freeing the interrupt.


> > ret = request_irq(AT91_ID_SYS, timer_interrupt, SA_SHIRQ,
> > AD_IRQ_DEVICE_NAME, NULL);
> > if( ret )
> > {
> >  printk(KERN_ERR "IRQ %d already claimed :(\n", AT91_ID_SYS);
> >  return ret;
> > }
> >
> > that gives me just the message that the IRQ is already claimed.
> > Can somebody tell me that this is the right way to use shared IRQ's, or
> > am I totally wrong?
>
> i guess your problem is the missing (NULL) dev_id parameter. when
> using shared IRQs a unique device id must be passed, usually a pointer
> to the device data structure
>
> btw: you should use IRQF_SHARED instead of SA_SHIRQ, recent kernels
> don't define this symbol anymore
>
> --
> Matthias Kaehlcke
> Embedded Linux Engineer
> Barcelona
>
>      El trabajo es el refugio de los que no tienen nada que hacer
>                            (Oscar Wilde)
>                                                                 .''`.
>    using free software / Debian GNU/Linux | http://debian.org  : :'  :
>                                                                `. `'`
> gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4                  `-
>
> --
> To unsubscribe from this list: send an email with
> "unsubscribe kernelnewbies" to [email protected]
> Please read the FAQ at http://kernelnewbies.org/FAQ
>
>


-- 
Thanks
Rizavan

Reply via email to