摘要://led.c#include <stdio.h>#include <stdlib.h>#include <unistd.h>#include <sys/ioctl.h>int main(int argc, char **argv){int on;int led_no;int fd;/* 检查led控制的两个参数,如果没有参数输入则退出。*/if (...
阅读全文
随笔分类 - 驱动编程
摘要:这两个功能的实现都是通过设置启动脚本来实现的。启动脚本的一般存放路径是 /etc/init.d/rcS (rcS即脚本文件),自启动应用程序一般放置于 /etc/rc.d/init.d 目录下。 我们需要用vi命令对rcS进行编辑,当然也可以通过其他方式对其进行覆盖。 在脚本中自启动应用程序示例:#各种服务程序/etc/rc.d/init.d/netd start #telnet/ftp 服务/e...
阅读全文
摘要://4led.c#include <linux/config.h>#include <linux/module.h>#include <linux/kernel.h>#include <linux/init.h>#include <linux/miscdevice.h>#include <linux/sched.h>#incl...
阅读全文
摘要:结合阻塞与非阻塞访问、poll函数可以较好地解决设备的读写,但是如果有了异步通知就更方便了。异步通知的意思是:一旦设备就绪,则主动通知应用程序,这样应用程序根本就不需要查询设备状态,这一点非常类似于硬件上"中断"地概念,比较准确的称谓是"信号驱动(SIGIO)的异步I/O"。 我们先来看一个使用信号驱动的例子,它通过signal(SIGIO, input_handler)对STDIN_FILEN...
阅读全文


浙公网安备 33010602011771号