AnsweredAssumed Answered

GPIO that enable Interrupt and write string on console

Question asked by Giuseppe Ventura on Jan 15, 2013
Latest reply on Apr 15, 2013 by Alejandro Sierra Guiza

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

Outcomes