All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai-help] Registering Interrupt Handler [Scanned]
@ 2006-12-14 12:35 Niklaus Burren
  2006-12-14 13:32 ` Gilles Chanteperdrix
  0 siblings, 1 reply; 4+ messages in thread
From: Niklaus Burren @ 2006-12-14 12:35 UTC (permalink / raw)
  To: xenomai

Hello

I try to register an interrupt handler for an externel interrupt(GPIO 
105) in a xenomai (2.2.2) kernel module on a ARM processor (PXA 270).
I create a interrupt object with the rt_intr_create() function without 
an error. After that I enable the interrupt with rt_intr_enable(). When 
I run the kernel module on the PXA270 board and put a square signal to 
the GPIO 105 pin the interrupt handler is never called.

// Interrupt Handler
int int_handler(struct xnintr *intr)
{
    printk("Interrupt detected\n");
    return RT_INTR_HANDLED;
}

----

// Enalbe Interrupt in init_module()
err = rt_intr_create(&intr_desc, "GPIO_INT", 10, &int_handler, NULL, NULL);

rt_intr_enable(&intr_desc);

On PXA270 all externel interrupts on GPIO's have the same interrupt 
number (10). Is that a problem? When I get the pin status from the pin 
level register GPLR3 I can detect the square signal at the pin. But the 
interrupt handler function int_handler() is never called.

Is there any other initialization that I had to do?

Kind Regards

Niklaus Burren



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Xenomai-help] Registering Interrupt Handler [Scanned]
  2006-12-14 12:35 [Xenomai-help] Registering Interrupt Handler [Scanned] Niklaus Burren
@ 2006-12-14 13:32 ` Gilles Chanteperdrix
       [not found]   ` <45825668.3030703@domain.hid>
  0 siblings, 1 reply; 4+ messages in thread
From: Gilles Chanteperdrix @ 2006-12-14 13:32 UTC (permalink / raw)
  To: Niklaus Burren; +Cc: xenomai

Niklaus Burren wrote:
> Hello
> 
> I try to register an interrupt handler for an externel interrupt(GPIO 
> 105) in a xenomai (2.2.2) kernel module on a ARM processor (PXA 270).
> I create a interrupt object with the rt_intr_create() function without 
> an error. After that I enable the interrupt with rt_intr_enable(). When 
> I run the kernel module on the PXA270 board and put a square signal to 
> the GPIO 105 pin the interrupt handler is never called.
> 
> // Interrupt Handler
> int int_handler(struct xnintr *intr)
> {
>     printk("Interrupt detected\n");
>     return RT_INTR_HANDLED;
> }
> 
> ----
> 
> // Enalbe Interrupt in init_module()
> err = rt_intr_create(&intr_desc, "GPIO_INT", 10, &int_handler, NULL, NULL);
> 
> rt_intr_enable(&intr_desc);
> 
> On PXA270 all externel interrupts on GPIO's have the same interrupt 
> number (10). Is that a problem? When I get the pin status from the pin 
> level register GPLR3 I can detect the square signal at the pin. But the 
> interrupt handler function int_handler() is never called.

The I-pipe code demultiplexes the IRQ 10 and triggers handlers for irq
numbers after 34. The macro IRQ_GPIO, defined in
include/asm-arm/arch-pxa/irqs.h allow you to get the irq number
associated with a particular GPIO.

So, if you want to be notified of an interrupt on GPIO105, you should
register an handler for irq IRQ_GPIO(105).

-- 
                                                 Gilles Chanteperdrix


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Xenomai-help] Registering Interrupt Handler [Scanned]
       [not found]   ` <45825668.3030703@domain.hid>
@ 2006-12-15 10:09     ` Gilles Chanteperdrix
       [not found]       ` <45828192.4020105@domain.hid>
  0 siblings, 1 reply; 4+ messages in thread
From: Gilles Chanteperdrix @ 2006-12-15 10:09 UTC (permalink / raw)
  To: Niklaus Burren; +Cc: xenomai

[-- Attachment #1: Type: text/plain, Size: 493 bytes --]

Niklaus Burren wrote:
> Hello Gilles
> 
> Thank you for your tip. I use now this makro in the rt_intr_create() 
> function. Unfortunately it has no effect. The function int_handler() is 
> never called when I put a square signal to the correct GPIO pin.
> 
> Is there anything else I had to do?

Could you try applying the following patch and tell me what gets printed
when you put the square signal on the GPIO pin ?

-- 
                                                 Gilles Chanteperdrix

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: ipipe-trace-pxa-irq-demux.diff --]
[-- Type: text/x-patch; name="ipipe-trace-pxa-irq-demux.diff", Size: 666 bytes --]

Index: arch/arm/mach-pxa/irq.c
===================================================================
--- arch/arm/mach-pxa/irq.c	(révision 2407)
+++ arch/arm/mach-pxa/irq.c	(copie de travail)
@@ -236,10 +236,14 @@
 		i = 4;
 #endif /* PXA_LAST_GPIO >= 96 */
 		for (; i; i--) {
+			printk("mask[%d] = 0x%08x\n", i - 1, mask[i - 1]);
 			loop |= mask[i - 1];
 			while (mask[i - 1]) {
 				irq = fls(mask[i - 1]) - 1;
 				mask[i - 1] &= ~(1 << irq);
+				printk("demux irq IRQ_GPIO(%d): %d\n",
+				       (i - 1) * 32 + irq,
+				       IRQ_GPIO((i - 1) * 32 + irq));
 				irq = IRQ_GPIO((i - 1) * 32 + irq);
 
 				__ipipe_handle_irq(irq, regs);

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Xenomai-help] Registering Interrupt Handler [Scanned]
       [not found]       ` <45828192.4020105@domain.hid>
@ 2006-12-15 17:07         ` Gilles Chanteperdrix
  0 siblings, 0 replies; 4+ messages in thread
From: Gilles Chanteperdrix @ 2006-12-15 17:07 UTC (permalink / raw)
  To: Niklaus Burren; +Cc: Xenomai help

Niklaus Burren wrote:
> When I apply the patch the kernel hangs while startup with a dot (see 
> line 3):
> 
> 01 eth0: link down
> 02 Sending BOOTP requests .<6>eth0: link up, full-duplex, lpa 0x45E1
> 03 .

Are you sure it is related with the patch ? Does the ethernet driver use
a GPIO ?

-- 
                                                 Gilles Chanteperdrix


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-12-15 17:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-12-14 12:35 [Xenomai-help] Registering Interrupt Handler [Scanned] Niklaus Burren
2006-12-14 13:32 ` Gilles Chanteperdrix
     [not found]   ` <45825668.3030703@domain.hid>
2006-12-15 10:09     ` Gilles Chanteperdrix
     [not found]       ` <45828192.4020105@domain.hid>
2006-12-15 17:07         ` Gilles Chanteperdrix

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.