Simple AT91SAM9260 Driver | |
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] | |
Hello All:
I am continuing to write my simple driver. I have been able to get the
basics down. I have a very simple driver right now that
initializes/exits with a message. I have also set it up so that it
defines the user buttons as gpio inputs and the user led as a gpio
output. I have fiddled with it to light the led when the module is
inserted, just to make sure I could.
I am now trying to set the two user buttons as interrupts and have
them turn the led on/off with the button presses. According to gpio.c,
I need to do the following:
/* Several AIC controller irqs are dispatched through this GPIO handler.
* To use any AT91_PIN_* as an externally triggered IRQ, first call
* at91_set_gpio_input() then maybe enable its glitch filter.
* Then just request_irq() with the pin ID; it works like any ARM IRQ
* handler, though it always triggers on rising and falling edges.
*
* Alternatively, certain pins may be used directly as IRQ0..IRQ6 after
* configuring them with at91_set_a_periph() or at91_set_b_periph().
* IRQ0..IRQ6 should be configurable, e.g. level vs edge triggering.
*/
I think I have to first couple of tasks done, but am unsure on the
third (i.e. request_irq() )
My code thus far looks like:
/--------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 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
return 0;
}
static void buttontest_exit(void)
{
printk(KERN_INFO "\n\n%s unloaded!\n\n\n", DRIVER_NAME);
}
module_init(buttontest_init);
module_exit(buttontest_exit);
/---------END OF CODE-----------------------------/
Does anyone have advice and or suggestions?
Thanks.
Paul
-------------------------------------------------------------------
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]