hi,
how modified mx53_loco.c for to obtain an interrupt from a GPIO(is a button) and when is enabled write a string on Console?
i have found this from the web:
static irqreturn_t button_interrupt(int irq, unsigned long data)
{
printk(KERN_INFO "Hello World\n");
tasklet_schedule(&my_tasklet);
return IRQ_HANDLED;
}
static int __init hello_start(void)
{
int ret;
printk(KERN_INFO "Loaded hello module....\n");
ret = request_irq(gpio_to_irq(163), button_interrupt,
IRQF_DISABLED | IRQF_TRIGGER_FALLING,
"hello", NULL);
if(ret){
printk(KERN_ERR "Failed to request IRQ\n");
return ret;
}
return 0;
}
I dont undstand this code: tasklet_schedule(&my_tasklet);
GPIO is 6_3 with interrupt 105.
cat value -----> 0 when is pressed; 1 when isnt pressed.
Where i must put this code in my mx53_loco.c?
Thanks
已解决! 转到解答。
Where are you defining the GPIO pin in you code? you should use DEFINE function called IMX_GPIO_NR(6, 3)
tasklet_schedule function means that you are starting a tasklet or "small thread" on the kernel to attend the ISR without blocking the whole system.
Where are you defining the GPIO pin in you code? you should use DEFINE function called IMX_GPIO_NR(6, 3)
tasklet_schedule function means that you are starting a tasklet or "small thread" on the kernel to attend the ISR without blocking the whole system.