[uCsimm] Docu for an Interrupthandler

From: Kirsch Martin (Martin.Kirsch@mhm6.siemens.de)
Date: Mon Apr 23 2001 - 03:52:09 EDT

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:

mainmenu_option next_comment
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:
you have to insert:
# Definition by Martin Kirsch for Communication with FPGA
ifeq ($(CONFIG_UCFPGA),y)
        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:
int chr_dev_init(void)


        if (register_chrdev(MEM_MAJOR,"mem",&memory_fops))

                printk("unable to get major %d for memory devs\n",


the following:



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:
cp (uClinuxdir)/testenv/src/bin/mknod

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.

Martin Kirsch

the driver itself, i hope you will understand it (my mailaddress is listed


Virus checked by Siemens AG I&S IS GFA Mannheim

This message resent by the ucsimm@uclinux.com list server http://www.uClinux.com/

This archive was generated by hypermail 2b30 : Sun Apr 07 2002 - 00:01:43 EST