S3C6410中断方式查询按键值驱动(二)

2014-11-24 03:19:56 · 作者: · 浏览: 8
_drv_init);
module_exit(third_drv_exit);


MODULE_LICENSE("GPL");


测试程序 irq_botton_test.c


#include
#include
#include
#include

/* irq_botton test
*
*/
int main(int argc, char **argv)
{
int fd;
unsigned char key_val;
fd = open("/dev/bottons", O_RDWR);
if (fd < 0)
{
printf("can't open!\n");
}

while (1)
{
read(fd, &key_val, 1);
printf("key_val = 0x%x\n", key_val);
}

return 0;
}


测试


图片

该测试程序 只占了0.0%的CPU 相比查询方式节省下了极大的系统资源


图片