- From: Nils Juergens <ju_at_isf.rwth-aachen.de>
- Date: Mon, 28 Jun 2004 17:18:33 +0200
On Mon, 28.06.04, Bob Apodaca <comedi_at_phxlab.honeywell.com> wrote:
> I've been working on my driver. The comedi documentation suggests that
> a driver should work both with and without interrupt support. It is not
> clear to me how the data gets back to user space without interrupts, can
> someone point me to an example?
The thing to keep in mind here is that with most drivers you loose command
support without interrupts. So you don't have to implement command support to
work without interrupts. But the insn-stuff should work without interrupts.
As an (isa-bases and thus easy to understand) example take a look at pcl818.c
pcl818_ai_insn_read()
[snip]
1 /* clear INT (conversion end) flag */
2 outb(0, dev->iobase+PCL818_CLRINT);
3
4 /* start conversion */
5 outb(0, dev->iobase+PCL818_AD_LO);
6
7 timeout=100;
8 while (timeout--) {
9 if (inb(dev->iobase + PCL818_STATUS) & 0x10)
10 goto conv_finish;
11 comedi_udelay(1);
12 }
13 comedi_error(dev,"A/D insn timeout");
14 /* clear INT (conversion end) flag */
15 outb(0, dev->iobase+PCL818_CLRINT);
16 return -EIO;
[snip]
So basically the driver tells the DAC to start a conversion (line 5)
And then it does an idle loop (lines 7-12) (with timeout) checking the INT
flag (line 9) (which indicates an converstion event has completed). The flag
is cleared before and after usage (lines 2 and 15).
hth,
Nils
Received on 2004-06-28Z14:18:33