This is a small documentation for writing a char device-driver:
A good book for understanding, how device drivers work, is the following.
But be aware that uClinux differs a little bit:
http://www.oreilly.com "Linux Device Drivers" by Alessandro Rubini, ISBN:
I will start to work out, how you can implement the driver to the kernel.
First of all, you have to change the file
(uClinuxdir)/linux/arch/m68knommu/config.in as followed:
comment 'Character devices'
you have to insert:
#Definition for FPGA by Martin Kirsch
if [ "$CONFIG_UCSIMM" = "y" ]; then
bool 'FPGA-Driver' CONFIG_UCFPGA
#Definition for FPGA END
This will show the device in make menuconfig.
The driver has to be put in the (uClinuxdir)/linux/drivers/char/FPGA.c
(listed at the end)
And to have the driver to be included correctly change the Makefile in the
same directory as followed:
CFLAGS += -DCONSOLE_BAUD_RATE=$(CONSOLE_BAUD_RATE)
you have to insert:
# Definition by Martin Kirsch for Communication with FPGA
L_OBJS += FPGA.o
# Definition by Martin Kirsch END
To have the driver to be included to the kernel, you must register it to the
starting routine in mem.c
in the following routine you have to insert after:
printk("unable to get major %d for memory devs\n",
the following include file is needed in
(uClinuxdir)/linux/include/linux/fpga.h with the code listed below:
extern int fpga_init(void);
After these steps the driver will be compiled and linked to the kernel and
be started at the boot-startup.
To user the device you must register it to the system and therefor you'll
need the mknod command:
Then you can start making the kernel and the bins and flash them to the rom.
After a reboot you can create the device by the following command or type
it in the /etc/rc -batch:
/sbin/mknod /var/fpga c 50 0
The driver will be visible in /proc/modules /proc/devices and the interrupt
handler in /proc/interrupts.
I hope I helped you.
the driver itself, i hope you will understand it (my mailaddress is listed
Virus checked by Siemens AG I&S IS GFA Mannheim
This archive was generated by hypermail 2b30 : Sun Apr 07 2002 - 00:01:43 EST