LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Polling Device Drivers (https://www.linuxquestions.org/questions/programming-9/polling-device-drivers-426911/)

Jay-Whizzle 03-21-2006 08:23 AM

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.

asgeirss 04-04-2006 09:04 PM

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


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