LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
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 03-21-2006, 09:23 AM   #1
Jay-Whizzle
LQ Newbie
 
Registered: Mar 2006
Posts: 2

Rep: Reputation: 0
Polling Device Drivers


Hi all,

I am in the process of writing a polling device driver for a WinTV-Pro 150 TV card for Linux. I have source code for an interrupt driver for this code but am trying to implement a polling driver as part of an analysis between these two types of drivers (interrupt and polling).
I have been searching forums and sites looking for information regarding the polling aspect but have found nothing except small paragraphs discussing the the theory behind polling (no sample source code or polling driver functions).
Can anyone point me in the direction of a good site for learning more about how to write polling drivers or have any opinions themselves?

Thanks,
John.
 
Old 04-04-2006, 10:04 PM   #2
asgeirss
Member
 
Registered: Aug 2003
Location: Vancouver, Canada
Distribution: RH, SL
Posts: 37

Rep: Reputation: 15
Hi,
In my opinion, and many others, polling is only used as a last resort. To get decent performance you will have to use most of the CPU cycles idly watching and waiting for something to happen. In certain "extreme" situations, with high throughput when you want to lower overhead, polling might be a better choice, but I don't think a TV video card would qualify.

I really suggest you continue on with learning how to use an interrupt-based driver.

Basically a polling driver would look crudely like the following,

int returncode;
returncode = getinfofromcard(&data);
while (returncode==0)
{
localvar = data.var;
etc... /* process the io here */
returncode = getinfofromcard(&data);
}

case returncode

1: /* do something for error code 1 */

Good luck,
Dave Asgeirsson
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Proper way of polling a device george_mercury Programming 4 12-13-2008 02:13 PM
Code for a Polling Linux Device Driver Jay-Whizzle Linux - Hardware 1 03-22-2006 01:52 AM
Is there a way of detecting directory changes without polling? naf Programming 2 03-01-2006 12:16 PM
NAPI in linux with kernel 2.6 for device polling wangjinyi Linux - Networking 0 09-22-2005 03:36 AM
about device polling wangjinyi Fedora 0 04-27-2005 03:22 AM


All times are GMT -5. The time now is 10:12 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration