ioctl 是用来设置硬件控制寄存器,或者读取硬件状态寄存器的数值之类的。而read,write 是把数据丢入缓冲区,硬件的驱动从缓冲区读取数据一个个发送或者把接收的数据送入缓冲区。ioctl(keyFd, FIONREAD, &b)得到缓冲区里有多少字节要被读取,然后将字节数放入b里面。接下来就能...
分类:
其他好文 时间:
2014-06-23 07:39:29
阅读次数:
384
参考:http://www.kerneltravel.net/?p=334衔铁两段代码:/*chardev.c*/#include #include /*for file-f_op*/#include #include /*for copy_to_user()*/#include /*for cde...
分类:
其他好文 时间:
2014-06-23 07:03:05
阅读次数:
350
这两天做了打印机的上位机驱动,要生成DLL,了解了这方面的东东,记录下简单。因为要在wince平台上使用,接口不能用MFC类,所以费劲的转换成了非MFC,也就使用Non-MFC DllsDLL的生成:*.h#ifndef __PRINTERCONTROL_H__#define __PRINTERCO...
分类:
其他好文 时间:
2014-06-23 06:33:37
阅读次数:
184
看了一篇文章《debug by printing》,文中提到了多种通过printk来调试驱动的方法,其中最有用的就是"Dynamic debugging"。“Dynamic debugging"的官方文档:http://git.kernel.org/cgit/linux/kernel/git/tor...
分类:
其他好文 时间:
2014-06-23 00:58:42
阅读次数:
443
一、platform总线、设备和驱动 platform是一种虚拟总线,对应的设备称为platform_device,对应的驱动称为platform_driver。platform_device定义在中: 1 struct platform_device { 2 const char ...
分类:
系统相关 时间:
2014-06-23 00:17:01
阅读次数:
385
转自:http://blog.chinaunix.net/uid-15724196-id-128141.html第3章+---------------------------------------------------+| 写一个块设备驱动 |+----------------...
分类:
系统相关 时间:
2014-06-22 23:20:40
阅读次数:
412
转自:http://blog.chinaunix.net/uid-15724196-id-128139.html第1章+---------------------------------------------------+| 写一个块设备驱动 |+----------------...
分类:
系统相关 时间:
2014-06-22 23:16:44
阅读次数:
377
转自:http://blog.chinaunix.net/uid-15724196-id-128140.html第2章+---------------------------------------------------+| 写一个块设备驱动 |+----------------...
分类:
系统相关 时间:
2014-06-22 23:14:48
阅读次数:
299
转自:http://blog.chinaunix.net/uid-15724196-id-128143.html第5章+---------------------------------------------------+| 写一个块设备驱动 |+----------------...
分类:
系统相关 时间:
2014-06-22 23:14:21
阅读次数:
332
转自:http://blog.chinaunix.net/uid-15724196-id-128146.html第7章+---------------------------------------------------+| 写一个块设备驱动 |+----------------...
分类:
系统相关 时间:
2014-06-22 23:12:25
阅读次数:
369