Re: Simple AT91SAM9260 Driver | |
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] | |
Paul Kavan a écrit :
> /--------BEGINNING OF CODE------------/
> #include <linux/module.h>
> #include <linux/kernel.h>
> #include <linux/init.h>
> #include <linux/interrupt.h>
> #include <asm/arch/gpio.h>
>
> MODULE_LICENSE("Dual BSD/GPL");
>
> #define DRIVER_NAME "Buttontest_module"
>
static irqreturn_t btn1_int(int irq, void *dev_id)
{
if (at91_get_gpio_value(AT91_PIN_PA30) == 0) {
/* printk("Button 1!\n"); */
/* handle button 1 action */
}
return IRQ_HANDLED;
}
> static int buttontest_init(void)
> {
> printk(KERN_INFO "\n\n%s loaded!\n\n\n", DRIVER_NAME);
>
> //Define User Buttons as inputs and User LED as output
> at91_set_gpio_input(AT91_PIN_PA30,0);
> at91_set_gpio_input(AT91_PIN_PA31,0);
> at91_set_gpio_output(AT91_PIN_PA6,1);
>
> //Set glitch filter on buttons
> at91_set_deglitch(AT91_PIN_PA30,1);
> at91_set_deglitch(AT91_PIN_PA31,1);
>
> //Request IRQ's for the buttons
> //This is where I am stuck
>
if (request_irq(AT91_PIN_PA30, btn1_int, 0, "btn1", NULL))
return -EBUSY;
>
> return 0;
> }
>
> static void buttontest_exit(void)
> {
> printk(KERN_INFO "\n\n%s unloaded!\n\n\n", DRIVER_NAME);
free_irq(AT91_PIN_PA30);
> }
>
> module_init(buttontest_init);
> module_exit(buttontest_exit);
>
> /---------END OF CODE-----------------------------/
>
> Does anyone have advice and or suggestions?
>
if you want to interface your buttons with userland applications, you
may be interested in interfacing your driver with input layer to send
input events (keypress for example) to your application.
Eric
-------------------------------------------------------------------
List admin: http://lists.arm.linux.org.uk/mailman/listinfo/linux-arm
FAQ: http://www.arm.linux.org.uk/mailinglists/faq.php
Etiquette: http://www.arm.linux.org.uk/mailinglists/etiquette.php
[Site Home] [IETF Annouce] [Security] [Bugtraq] [Linux] [Linux ARM Kernel] [Linux MIPS] [ECOS] [Tools] [DDR & Rambus] [Monitors]