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
reference program:
ethernet driver:
E:\Jupiter\uclinux\Patch prog\eth1driver\
and E:\cygwin\home\administrator\uClinux-eisc\uClinux-2.4.20\drivers\net\jupiter_eth.c , jupiter_eth1.c, space.c, makefile
Driver of eth1
Put jupiter_eth1.c, jupiter_eth1.h, Space.c, Makefile to /drivers/net/, re-compile the kernel.
Boot uclinux, then do:
ifconfig eth1 up
ifconfig eth1 192.168.0.4
ifconfig lo 127.0.0.1
Use ifconfig to take a look:
===============================================
/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
Keypad driver
E:\Jupiter\uclinux\keypad
and E:\cygwin\home\administrator\uClinux-eisc\uClinux-2.4.20\drivers\char\ jupiter_keypad.c Makefile
Boot uclinux
Execute:cat /proc/devices
to list the device table.
Other driver
program:
/drivers/char/serial_se3208.c ==> UART
/drivers/char/dmc9512_ts.c ==> touch pad
/drivers/net/jupiter_eth.c ==> ethernet
Note do re-compile the kernel every time you add driver.