LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-09-2003, 12:20 PM   #1
sbayeta
LQ Newbie
 
Registered: May 2003
Posts: 5

Rep: Reputation: 0
PCI card project. How to write a driver ?


Hi,

This is my first quiestion to this forum, so please tell me if I should post anywhere else.

I need to develop a data adquisition board to perform digital image processing. The project will use a CCD camera, taking pictures at very precise intervals, so I was thinking in making a PCI card and connect it to the PCI bus of a dedicated PC.

I'm pretty experienced working with microcontrollers (using assembler and C), and I'm also comfortable programming C/C++ and JAVA. Although I'm not very good with LINUX.

Can anyone tell me if this is even posible ? How can I program a PCI driver and use interrupts ? Is there a better way given the characteristics I need ?

I'm thinking in developing this project under LINUX because I'm guessing it may be easier to find information and examples on how to write PCI drivers than in Windows. Also, the project will be used continuosly in an industrie, so I guess Windows is not the best choice.

Thanks in advance
 
Old 12-09-2003, 03:06 PM   #2
LogicG8
Member
 
Registered: Jun 2003
Location: Long Island, NY
Distribution: Gentoo Unstable (what a misnomer)
Posts: 380

Rep: Reputation: 30
It's possible, depending on your definition of "very precise"
The current stable kernel isn't what you would call realtime,
so you can experience significant latencies. There are
various patches that you can use to solve these problems,
but if you are doing your own hardware this may not be an
issue b/c you can abstract problems like that away from the
kernel.

If I were doing a project of this sort (from the brief description
of it) I would try and use drivers already in existence if possible.
An example of this is my company couldn't use the default bttv
stuff in the kernel b/c we had unacceptable delays getting a
camera up and running (It was looking for a tuner chip when there
wasn't one). Rather than re-write the driver we just took out some
hardware detection code and saved 20 seconds.

What kind of interface is the CCD camera use?
If the it is still a choice see if you can use an interface or chipset
that is already supported. Writing a driver from scratch may be
more trouble than it is worth unless you need the code to be
closed source.

If you have really evaluated your choices and you want to hack
the kernel this site will get you off on the right foot.
http://www.kernelhacking.org/

Edit:
<hits head>
And of course if you take a look at a kernel tarball
there is a directory inside called "Documentation"
Many many answers are contained within...

Last edited by LogicG8; 12-09-2003 at 03:08 PM.
 
Old 12-13-2003, 06:26 AM   #3
jimveta
Member
 
Registered: Oct 2003
Location: los angeles
Posts: 32

Rep: Reputation: 15
i recommend the following books:
- Linux Device Drivers, by O'Reilly
- Understanding the Linux Kernel, by O'Reilly
- Linux Programming Bible, by John Goerzen (published by Wiley)
or
- Programming with GNU Software, by O'Reilly
and pci documentation from pci sig.

i don't have any driver experience specifically in linux--yet (nor have i read
those books)--so take this with a grain of salt, but i'm guessing if you're card will
have timed interupts, then in a PIO fashion, in your driver you can register a
high level interrupt to do a quick copy of the device memory to kernel memory,
defer the processing later (i.e. trigger soft/lower level interrupt) to have that
lower priority thread write out to the user process doing the read (entry point).
or you can (and should) use the much more effecient memory map method
whereby you write directly into user space in those timed events.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Driver for Belkin 54g PCI card jenko Linux - Newbie 1 12-29-2004 12:29 PM
Xterasys 2523G pci card driver mach03 Linux - Wireless Networking 1 08-31-2004 08:21 PM
PCI Card Driver Slackware 9.0 Olmec Linux - Laptop and Netbook 3 02-09-2004 11:34 AM
Installing a PCI card driver cmack Slackware 2 07-30-2003 05:23 PM
Correct FA311 PCI card driver GabeF Linux - Networking 1 09-10-2002 09:00 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:31 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration