linux_device_driver
所属分类:Linux/Unix编程
开发工具:Unix_Linux
文件大小:2KB
下载次数:4
上传日期:2010-11-24 13:14:17
上 传 者:
polariscui
说明: 对于linux设备驱动简单的读写操作。这个程序只是展示了驱动程序的一点特性。没有涉及到具体硬件和设备文件管理系统
(Simple linux device driver for reading and writing. This program only shows drivers that feature. Not related to the specific hardware and device file management system
)
文件列表:
linux设备驱动\test.c (2419, 2010-05-06)
linux设备驱动\test__read.c (719, 2010-04-16)
linux设备驱动\test__write.c (564, 2010-04-16)
linux设备驱动 (0, 2010-11-24)
test.c为驱动程序
test__read.c为读测试
test__write.c为写测试
test.c中头文件有些估计不需要,但是没有详细去修改过
gcc -O2 -DMODULE -D __KERNEL__ -I /usr/src/linux-2.4.20.8/include -c test.c --> test.o
可以通过arm-linux-gcc编译后再目标板上面运行
insmod -f test.o -f表示强制挂载,可以不用
rmmod test 卸载驱动
mknod /dev/test c major minor //创建文件节点 major:为主设备号,minor为次设备号 c表示字符设备
cat /proc/devices 可以查看到主设备号。如果不知道主设备号,无法创建文件节点
这个程序只是展示了驱动程序的一点特性。没有涉及到具体硬件和设备文件管理系统
proc虚拟文件系统。
写入内核的方式没有测试过!
没有编辑过MAKEFILE文件
近期下载者:
相关文件:
收藏者: