GPIO that enable Interrupt and write string on console

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

GPIO that enable Interrupt and write string on console

ソリューションへジャンプ
1,161件の閲覧回数
enaud
Contributor III

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

ラベル(1)
0 件の賞賛
返信
1 解決策
762件の閲覧回数
AlejandroSierra
NXP Employee
NXP Employee

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.

元の投稿で解決策を見る

0 件の賞賛
返信
1 返信
763件の閲覧回数
AlejandroSierra
NXP Employee
NXP Employee

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.

0 件の賞賛
返信