From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <50FBF628.1000709@xenomai.org> Date: Sun, 20 Jan 2013 14:50:32 +0100 From: Gilles Chanteperdrix MIME-Version: 1.0 References: <201301191235.11402.paul_c@tuxcnc.org> <201301200013.09110.paul_c@tuxcnc.org> In-Reply-To: <201301200013.09110.paul_c@tuxcnc.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [Xenomai] GPIO Interrupts problem with RTDM List-Id: Discussions about the Xenomai project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paul Cc: Pierre LE COZ , xenomai@xenomai.org On 01/20/2013 01:13 AM, Paul wrote: > On Saturday 19 January 2013, Pierre LE COZ wrote: >>> Add some debug messages in the areas you request resources and then >>> use dmesg - The most likely source of error is either attempting to >>> use a resource that has been claimed or not releasing when you have >>> finished with it. >> >> Here's my entire init : >> >> static int __init exemple_init (void) >> { >> int err; >> >> printk(KERN_INFO "Requesting GPIO %d\n",GPIO_IN); >> if((err = gpio_request_one(GPIO_IN, GPIOF_DIR_IN, >> THIS_MODULE->name)) !=0) { >> printk(KERN_INFO "error %d: could not request gpio: >> %d\n", err, GPIO_IN); >> return err; >> } >> >> printk(KERN_INFO "Setting the irq type to trigger rising\n"); >> irq_set_irq_type(BUTTON_IRQ, IRQF_TRIGGER_RISING); >> >> >> printk(KERN_INFO "Requesting irq %d\n", BUTTON_IRQ); >> if((err = rtdm_irq_request(& irq_exemple, BUTTON_IRQ, >> exemple_handler, 0, THIS_MODULE->name, NULL)) !=0) { >> printk(KERN_INFO "error %d: could not request irq: >> %d\n", err, GPIO_IN); >> gpio_free(GPIO_IN); >> return err; >> } >> >> printk(KERN_INFO "Enabling irq %d\n", BUTTON_IRQ); >> >> // enable_irq(BUTTON_IRQ); >> rtdm_irq_enable(& irq_exemple); >> return 0; >> } > > static int irq_func(rtdm_irq_t *arg) { /* Do stuff */ } > static rtdm_irq_t gpio_reset; > > static int __init module_init(void) > { > irq_number = gpio_to_irq(gpio_pin); > if (gpio > 31 || irq_number < 0 || !gpio_is_valid(gpio)) > return -EINVAL; > > if (gpio_request_one(gpio_pin, GPIOF_DIR_IN, > THIS_MODULE->name) != 0) > return -EIO; > > if (rtdm_irq_request(&gpio_reset,irq_number, irq_func, > RTDM_IRQTYPE_EDGE, "MODULE", NULL) ) { > gpio_free(gpio_pin); > return -EIO; > } > rtdm_irq_enable(&gpio_reset); // Should check return code. > return 0; > } > > Tested & works on my 3.2.27 kernel - Looks like I might have been > getting mixed up with a similar module using the xeno-native API. > >> The module is running well, but still no interrupt detected : >> # insmod rpi-rtdm.ko >> About the fact that interrupts are not detected : >> >> This may be a generic issue, which I thought was fixed, but may not >> be. >> >>> Could you try the following patch? >> >> http://git.xenomai.org/?p=ipipe-gch.git;a=commit;h=c14c79d29fed822675 >> 60c7bf26d628ef4d39f5b7 > > Gilles: Looked at the patch and got as far as the changes in > kernel/ipipe/timer.c:ipipe_timer_stop() - Correct me if I'm wrong, but > this patch is based on a 3.5.7 parent without GENERIC_CLOCKEVENTS ? Yes, this patch is based on 3.5.7 and is used with and without GENERIC_CLOCKEVENTS. -- Gilles.