All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai-help] PIOX irq problems with at91sam9260
@ 2007-12-19 15:06 Juan Antonio Garcia Redondo
  2007-12-19 16:38 ` Gilles Chanteperdrix
  0 siblings, 1 reply; 8+ messages in thread
From: Juan Antonio Garcia Redondo @ 2007-12-19 15:06 UTC (permalink / raw)
  To: xenomai; +Cc: jagarcia

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

Hello list,

I'm testing xenomai 2.4.0 (kernel 2.6.20, adeos-ipipe-2.6.20-arm-1.8-02) 
over a at91sam9260 based board. The initial tests runs OK but I've problems 
with the PIOX interrupts. It seems that, to work properly with the
interrupt, I need to install first the interrupt on the linux side.

Environment:
	o A sligtly modified user_irq.c from the xenomai
	documentation.
	o A normal linux kernel module which does nothing except 
	catching the irq received as parameter.
	o PIB_11 y PIOB_10 in short circuit.
 

Test 1:
	o External gpio programming as input(PIOB_11)
	# test_irq 75
		Waiting for irq 75 ...
	
	o Nothing occurs although I've set and reset the PIOB_10. The
	first thing I see is that the PIOB_IMR is 0x000000 when I'll expect
	0x00000800.

Test 2:
	o External gpio programming as input(PIOB_11)
	# insmod irqena.ko gpio_in=75
	0 Now the PIOB_IMR is 0x00000800
	# rmmod irqena
	# test_irq 75
	    Waiting for irq 75
	o External gpio PIOB_10 set and reset.
	#  ..........
	   Waiting for irq 75
           Arrives irq -> 1
	   Arrives irq -> 1
	   ..................

I've attached the tests programs.

Any hints ?

Regards,
	Juan Antonio
	
	


[-- Attachment #2: test_irq.c --]
[-- Type: text/x-csrc, Size: 1304 bytes --]

#include <sys/mman.h>
#include <native/task.h>
#include <native/intr.h>

#define IRQ_NUMBER 89  /* Intercept interrupt #7 */
#define TASK_PRIO  99  /* Highest RT priority */
#define TASK_MODE  0   /* No flags */
#define TASK_STKSZ 0   /* Stack size (use default one) */

RT_INTR intr_desc;

RT_TASK server_desc;

static int irq_number = IRQ_NUMBER;

void irq_server (void *cookie)

{
    int ret;
    printf("Waiting for irq %d\n", irq_number);

    for (;;) {

       /* Wait for the next interrupt. */
       ret = rt_intr_wait(&intr_desc,TM_INFINITE);

       if (ret > 0) {
           /* Process interrupt. */
           printf("Arrives irq ->%d\n", ret);
       } else {
           printf("Error %d\n", ret);
       }
    }
}

int main (int argc, char *argv[])

{
    int err;

    if (argc > 1)
        irq_number = atoi(argv[1]);

    mlockall(MCL_CURRENT|MCL_FUTURE);

    err = rt_intr_create(&intr_desc,"MyIrq",irq_number,0);

    err = rt_task_create(&server_desc,
                         "MyIrqServer",
                         TASK_STKSZ,
                         TASK_PRIO,
                         TASK_MODE);
    if (!err)
        rt_task_start(&server_desc,&irq_server,NULL);

    pause();

}

void cleanup (void)

{
    rt_intr_delete(&intr_desc);
    rt_task_delete(&server_desc);
}


[-- Attachment #3: irqena.c --]
[-- Type: text/x-csrc, Size: 884 bytes --]

#include <linux/module.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/interrupt.h>
#include <asm/arch/gpio.h>

#define MODULE_NAME "irqena"

static uint gpio_in = 0;
static uint irq;

irqreturn_t
irqtest_irq_handler(int irq, void *dev_id)
{
        return IRQ_HANDLED;
}


static int __init irqtest_init(void)
{
        irq = irq_canonicalize(gpio_in);

        if (request_irq(irq,
                        irqtest_irq_handler, IRQF_DISABLED, MODULE_NAME, NULL))
        {
                printk(KERN_ERR "I can't use irq %d\n", irq);
                return -EINVAL;
        }
        return 0;
}

module_init(irqtest_init);

static void __exit irqtest_exit(void)
{
        free_irq(irq, NULL);
}
module_exit(irqtest_exit);

module_param(gpio_in, uint, 0444);
MODULE_PARM_DESC(gpio_in, "Input pin");


MODULE_DESCRIPTION("Irq Enable");
MODULE_LICENSE("GPL");

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

end of thread, other threads:[~2007-12-28 21:29 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-19 15:06 [Xenomai-help] PIOX irq problems with at91sam9260 Juan Antonio Garcia Redondo
2007-12-19 16:38 ` Gilles Chanteperdrix
2007-12-21  8:27   ` Juan Antonio Garcia Redondo
2007-12-26 21:51     ` Gilles Chanteperdrix
2007-12-28  8:29       ` Juan Antonio Garcia Redondo
2007-12-28 10:02         ` Gilles Chanteperdrix
2007-12-28 11:34           ` Juan Antonio Garcia Redondo
2007-12-28 21:29         ` 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.