[fpc-pascal] Linux Kernel and FPC
Michael Van Canneyt
michael at freepascal.org
Tue Jul 10 12:17:04 CEST 2007
On Tue, 10 Jul 2007, ik wrote:
> On 7/9/07, Alain Michaud <Alain.Michaud at nrc-cnrc.gc.ca> wrote:
> > Hi,
> > last year I have written a very small driver using the "char" model,
> > ie. that is put in src/linux/drivers/char something very simple to
> > read/write a few bytes on an output port. I would have been glad to
> > write it in pascal, but I do not think it would be possible at all. I
> > finally did it this way:
> > -- The "kernel" part is written in C/asm but the code is as simple as
> > possible
> > -- The "user" part is written in FPC
> > -- The interface to the kernel is done using a few functions thru
> > IOCTL interface.
> > Now, why not doing the kernel part in FPC?
> > Well, The .h files that you need to translate to the interface
> > section of your unit are very long and difficult to understand. Plus
> > they contain some macro definitions which are platform specfic.
> > For example if you use the ASM instruction "outb" to write one byte
> > on a port in your driver source code you would use "_outb" which in
> > fact is a macro specially tuned for your platform !! The same is true
> > for most procedure or instructions that you use when when programming in
> > kernel space. Even a simple "move" instruction has to be "spinlocked"
> > In conclusion, I gave up ! It is so simple to adapt an example from a
> > C textbook and although I do not know any C at all I could write to my
> > I/O port whitin a fey days.
> > Good luck
> > Alain
> > On Fri, 2007-07-06 at 23:05 +0300, ik wrote:
> > > Hi,
> > >
> > > I have found the following guide:
> > > http://www.linuxdevcenter.com/pub/a/linux/2007/07/05/devhelloworld-a-simple-introduction-to-device-drivers-under-linux.html
> > >
> > > And I was thinking in implementing it using FPC.
> > > My question is, how hard can it be ?
> > > Are there any kernel modules that already been binded into FPC ? such
> > > as th ones that will give me printk ?
> > >
> > > Are there any known examples of someone that already made a Linux
> > > kernel module using FPC ?
> > >
> > > Thanks,
> > > Ido
> The more I read about it, the more I believe that I need more time to
> implement my freePOS FPC based kernel rather then to use Linux one...
> The problem is that I do not have time, and only papers for memory
> management system that I wish to implement as the first part...
Try the delphineos kernel. it's written using FPC.
More information about the fpc-pascal