我知道了 gpio 口 ,怎么计算这个 io 口对应的中断号 ,例如 gpio(55) 他的中断号是多少??有计算公式吗?
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
我知道了 gpio 口 ,怎么计算这个 io 口对应的中断号 ,例如 gpio(55) 他的中断号是多少??有计算公式吗?
这个您可以查看下technical reference manual中的interrupt和GPI那两章,对于每一个gpiobank来说,中断号是一个,而且是固定的,不是可编程的
linux/arch/arm/mach-omap2/board-am335xevm.c 文件中有计算公式:
先获得GPIO的pin number:
/* Convert GPIO signal to GPIO pin number */
#define GPIO_TO_PIN(bank, gpio) (32 * (bank) + (gpio))
然后获得irq中断号:
irq = OMAP_GPIO_IRQ(pin_num)
其中pin_num=GPIO_TO_PIN(bank,gpio),比如GPIO1_7,pin_num=32*1+7=39, irq=160+39=199
我想在中断中 给我的应用程序发送数据,让我的应用程序立即响应中断,不知道有没有什么好的建议?