how to detect a pin change of a GPIO on Linux board

天涯浪子 提交于 2019-12-04 03:07:02

I have never seen this board before, however I guess PIC is fully implemented for this board (usually is like that) but you have to configure interrupt additionally in GPIO controller (usually is like that). Some part should be done as a kernel module, then you have to pass information about interrupt to you application.

Example way to do this is to implement following thing as a kernel module:

and a rest in your application:

  • a function that can coosomeoneperate with interrupt.

Simplest way of passing information about interrupt from kernel to app is by semaphore on kernel side. in module you can implement an ioctl that will sleep until interrupt happen. So application will call this ioctl and its thread will be blocked until interrupt happen.

Inside module, interrupt routine should check if application thread is now blocked, and if so up() semaphore.

EDIT*****

This CPU has SSP that has working mode for SPI. Why dont use it ??

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!