Re: AW: [uCsimm] Example Code

From: Daniel Haensse (daniel.haensse@freesurf.ch)
Date: Thu Mar 22 2001 - 11:41:07 EST


Hi Martin,

I'm working with the Rubini book (see below). I'm working on a device driver as
well that copies data at a external interrupt to a fifo. It's all written in C
and that is not a problem (except to get it stable). The only thing I'm missing
is to load modules in uclinux (maybe somebody can help?). Rubini's book is
documenting modules. I had a look at the different drivers of the kernel as a
reference.
If you search the web, Rubini has his drivers somewhere for download.
Then you have to add the code to the kernel tree. You may do this the same
way as for example the ethernet controller is added to the tree. The concept
is easy, just some kind of if then in the script. Finally you can compile
with make clean linux.bin
After this you have to rebuild the romdisk with make
Download image

The driver itself consist of
init: Register interrupt and initialize vars, may some registers of the uP
Think about other drivers that may share resources, so toggle on the bits
you need. Have a look at the kernel tree howto register the interrupt. The
number given to the kernel is slightly different than in the book.
Instead of inp and outp you can write the memory location directly.
open and close:
Open and closes a device. You have to keep an eye on how may
devices are open. In my case I have only one at a time
read and write: Read and write data from you device
select: Called by the select function, if work is to be done from you driver,
tell it. E.g. new data has arrived.
interrupt: processing the fast interrupt.
maybe some other functions
You have to decide if your driver is a block or character driver. It is also
possible to communicate with the ioctl function of the driver. This way for
example the baudrate may be changed.
If you need realtime (the kernel answers to irq6 on my board in a view
microseconds, so this is maybe not a concern. Maybe sometimes it takes a little
bit longer ;-) ) their are some realtimes extension. Tom wrote something about
it some days ago. Anyway the ez328 is not that slow I thought first. I worked
with the dallas 80c320 a lot and this is only an 8 bit uP (8051), but runs with
20MHz without linux and I thought that using linux and a 16MHz 16bit uP
will be almost the same performance. This is not true, linux realy does not
need any processor time at all (almost).

Dani

Am Don, 22 Mär 2001 schrieben Sie:
> Hi Dani,
>
> in the meanwhile I'm closer to uClinux. But can you help me where to find
> some docu about the interrupthandling on the uCsimm. Interruptprogramming
> in assembler is no problem for me. I've experience on 68000(Amiga)/8051/
> 8031/6510. But how can I realize that on the uCsimm. Is the best way to
> do that in low level assembler or in C under uClinux. Are there any
> functions that are made available through uClinux?
>
> Thx Martin
>
> -----Ursprüngliche Nachricht-----
> Von: daniel haensse [mailto:daniel.haensse@fhk.usz.ch]
> Gesendet am: Donnerstag, 7. Dezember 2000 16:52
> An: ucsimm@uClinux.com
> Betreff: Re: [uCsimm] Example Code
>
> Hi Martin,
>
> I'm not sure if you're also new to linux?
> A pratical guide to linux, Sobell (ISBN 0-201-89549-8)
> Linux programming, Matthew (ISBN 1-874416-68-0)
> Linux Application Develpment, Johnson (ISBN 0-201-30821-5)
> Linux Device Drivers, Rubini (ISBN 1-56592-292-1)
>
> There is not a (big) different in programming for your PC and for the
> uCsimm.
> If you have installed the distribution CD, you can find a lot of code in
> /opt/uClinux.
> Maybe one of the Gurus can tell us what (big) means.
>
> Dani
>
>
> > Hi everyone out there,
> >
> > I am new on uClinux and uCsimm and I need some help. Can anyone tell me
> > where I can get example Code from? Especially TCP/IP and Multitasking
> > concerning.
> >
> > Thx a lot
> >
> > Martin Kirsch
> >
> >
> > Virus checked by Siemens AG ATD TD GFA Mannheim
> > This message resent by the ucsimm@uclinux.com list server
> http://www.uClinux.com/
> --
> **********************************************************
>
>
>
>
>
> Daniel Haensse
>
> Klinik fuer Neonatologie
>
> UniversitaetsSpital Zuerich
>
> Frauenklinikstr. 10
>
> 8091 Zuerich
>
> Switzerland
>
> Tel: ++41 / 1 / 255 5342
>
> Fax: ++41 / 1 / 255 4442
>
> email: daniel.haensse@fhk.usz.ch
> This message resent by the ucsimm@uclinux.com list server
> http://www.uClinux.com/
> This message resent by the ucsimm@uclinux.com list server http://www.uClinux.com/
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:42 EST