使用sysfs的Linux用户空间GPIO中断 [英] Linux Userspace GPIO Interrupts using sysfs

查看:574
本文介绍了使用sysfs的Linux用户空间GPIO中断的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用sysfs在用户空间上使用GPIO中断. 我使用这些命令:

I would like to use interrupts with GPIO on userspace using sysfs. I use these commands :

[root@at91]:gpio109 > echo 109 > export
[root@at91]:gpio109 > cd gpio109/
[root@at91]:gpio109 > ll
-rw-r--r--    1 root     0            4096 Jan  1 00:17 direction
drwxr-xr-x    2 root     0               0 Jan  1 00:17 power
lrwxrwxrwx    1 root     0               0 Jan  1 00:17 subsystem -> ../../gpio
-rw-r--r--    1 root     0            4096 Jan  1 00:17 uevent
-rw-r--r--    1 root     0            4096 Jan  1 00:17 value

gpio运作良好,但我不能使用中断. 我到处都读到我必须有一个边缘文件才能轮询该文件.但是在我的系统上,该文件不存在. 我做了很多尝试来寻找解决方案,但仍然没有成功.

The gpio works well but I can't use interrupts. I read everywhere i must have an edge file to poll this file. But on my system this file doesn't exist. I made a lot of tries to find a solution but remain unsuccessfull.

我的目标是Linux内核2.6.30上的AT91SAM9263.

My target is an AT91SAM9263 on linux kernel 2.6.30.

在板子启动时,我在中断时收到了此消息:

At the boot of my board I got this message on interrupts :

AT91: 160 gpio irqs in 5 banks

表明函数at91_gpio_irq_setup()执行得很好.

你有什么主意吗?

推荐答案

仅当该GPIO引脚可以配置为中断产生引脚时,"edge"文件才存在.请参阅: http://www.mjmwired.net/kernel/Documentation/gpio.txt#634.

The "edge" file only exists if that GPIO pin can be configured as a an interrupt generting pin. See: http://www.mjmwired.net/kernel/Documentation/gpio.txt#634.

由于您没有看到它,这意味着驱动程序以及可能的硬件不支持使用该GPIO引脚作为中断源.

Since you don't see it, it means the driver and possibly the hardware do not support using that GPIO pin for interrupt source.

这篇关于使用sysfs的Linux用户空间GPIO中断的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆