writing and using a device driver

writing and using a device driver

Post by Derek Hammon » Sat, 20 Apr 1996 04:00:00



Hello all,
  I'm a student at UCA working on a vision system for a robotics class.  The os
we're using is linux-1.2.12.  We have a digital camera that connects via serial
cable to a card in the machine.  Asm source code was supplied to us that
compiles under dos, but none was available for linux.  I have the code
converted to C, and am wanting to find the most simple way to use it.  So far
I've had no luck.  I followed an example from the Linux Kernel Hacker's Guide
that contained C Kernel convenience routines for character device drivers.  The
one's I've determined I need are cli(), sti(), inb(), outb(), request_region(),
and release_region().  I've included the specified header files, and I compile
the code with "gcc -O -DMODULE -D__KERNEL__ -c camera.c" as instructed by
another document: "Writing Linux Device Drivers".  Some of the above
convenience routines remain unresolved, and neither manual addresses how to
include them with the kernel or how to use them by an additional program.  If
anyone can lead me in the right direction with some info, the name of a manual,
or FAQ I need I would be so very appreciative and will fax you some $20 bills.
 
 
 

writing and using a device driver

Post by Marius Serita » Sat, 20 Apr 1996 04:00:00



> Hello all,
>   I'm a student at UCA working on a vision system for a robotics class.  The os
> we're using is linux-1.2.12.  We have a digital camera that connects via serial
> cable to a card in the machine.  Asm source code was supplied to us that
> compiles under dos, but none was available for linux.  I have the code
> converted to C, and am wanting to find the most simple way to use it.  So far
> I've had no luck.  I followed an example from the Linux Kernel Hacker's Guide
> that contained C Kernel convenience routines for character device drivers.  The
> one's I've determined I need are cli(), sti(), inb(), outb(), request_region(),
> and release_region().  I've included the specified header files, and I compile

You've got to compile with -O2 in order to get read of the inb, outb
problems. Those two functions are really macros. Making device drivers
is a little bit more complicated, if you want I can send you some
skeleton of a device driver I got on the net. Some of the low level
stuff can be done in an user level process, but I remember that you are
not allowed to play with interrupts. You can either try not to
enable/disable interrupts if possible --- however I think this is very
unlikely --- or move parts of the code in a loadable module that will
execute in kernel space.  

Hope this helps,