How to make driver:
in driver directory ~uClinux-eisc\uClinux-2.4.6( 或20)\drivers\mydriver
write a driver file
in ~uClinux-eisc\uClinux-2.4.6\drivers\mydriver\Makefile
append the line
###################
obj-y += mydriver.o
###################
and execute the
~uClinux-eisc\uClinux-2.4.6\Makefile
参考程序:
网口驱动程序:
E:\Jupiter\uclinux\补丁prog\eth1driver\目录
和E:\cygwin\home\administrator\uClinux-eisc\uClinux-2.4.20\drivers\net\jupiter_eth.c 以及jupiter_eth1.c, space.c, makefile
eth1的驱动
将jupiter_eth1.c, jupiter_eth1.h, Space.c, Makefile拷贝到/drivers/net/,重新编译内核
uclinux 启动后执行
ifconfig eth1 up
ifconfig eth1 192.168.0.4
ifconfig lo 127.0.0.1
然后看ifconfig列出所有的网络
===============================================
/bin> ifconfig
eth0 Link encap:Ethernet HWaddr 00:01:23:45:67:00
inet addr:192.168.10.1 Bcast:192.168.10.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:274 errors:0 dropped:0 overruns:0 frame:0
TX packets:29 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
Interrupt:26 Base address:0x3400
eth1 Link encap:Ethernet HWaddr 00:01:23:45:67:11
inet addr:192.168.0.4 Bcast:192.168.0.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:9 errors:0 dropped:0 overruns:0 frame:0
TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
Interrupt:27 Base address:0x3600
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:17 errors:0 dropped:0 overruns:0 frame:0
TX packets:17 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
键盘驱动程序
E:\Jupiter\uclinux\keypad目录
和E:\cygwin\home\administrator\uClinux-eisc\uClinux-2.4.20\drivers\char\ jupiter_keypad.c Makefile
在uclinux启动后
执行:cat /proc/devices
列出驱动设备表
另外几个参考程序:
/drivers/char/serial_se3208.c ==> UART
/drivers/char/dmc9512_ts.c ==> touch pad
/drivers/net/jupiter_eth.c ==> ethernet
最后都要重新便宜kernel