Re: Change of state interrupts

On 11/10/2007 02:31, Frank Mori Hess wrote:
> On Wednesday 10 October 2007 04:23, Robin Cornelius wrote:
>> Hi everyone,
>>
>> I've just started using comedi and I am using a adlink pci7348 card
>> (which is not supported) so i hacked up the PCI-7296 driver go get it
>> working, which it does :-) (Infact no modification for basic DIO, just
>> swap all "adl_pci7296" for "adl_pci7348" and its a go (infact this
>> should also work perfectly with the adl_pci7396).
> 
> If the boards are essentially the same programming-wise, they should both 
> be supported by the same driver, as opposed to adding a second nearly 
> identical one.

The register layout differences between PCI-72xx and PCI-73xx look 
substantial enough to make a separate driver, and the PCI-73xx doesn't 
even pretend to behave like a bunch of 8255 chips.

However, it should be straightforward to add support for PCI-7248 and 
PCI-7224 to the adl_pci7296 driver (and possibly rename it?).  These 
cards also have an 8254 counter/timer chip with one channel clocked from 
an external input and two cascaded channels clocked from a 2 MHz clock. 
  The first channel with an external clock input would be useful to 
support, the other two are not that useful for Comedi, except for 
generating interrupts at a regular rate.  They also have a strange 
interrupt multiplexer arrangement, with six interrupt sources, 
partitioned into two groups of three, with up to one interrupt source 
selectable from each group.

>> Anyway the 7348 supports a change of state (COS) interrupt. I have
>> implemented the IQR handler but I am unsure what to do next. I have read
>> the documentation other examples but I do not fully understand the
>> (comedi) driver level concepts still. How should i handle the COS event.
>> Ideally when this happens the event needs to trigger a call back ASAP to
>> minimise latency. I see mention of callbacks but can't see exactly what
>> I want. Can someone give me some pointers on the correct way to handle
>> this and pass the event back through comedi. Should i be using the
>> s->events->async stuff?
> 
> The way it's been done before is to add support for an input command, that 
> generates a bogus sample every time the event occurs.

E.g. the comedi_parport driver, the amplc_pc236 driver, or for a 
slightly more complicated version, the amplc_dio200 driver.

>> One final problem is that I seem to be getting continuous interrupts
>> from the card, I believe I am setting the interrupt masks correctly and
>> I am ACKing the interrupt correctly but it fires of at a enormous rate.
> 
> PCI interrupts can be shared, could it be another device generating the 
> interrupts?  You might also check if there is a second bit in a register 
> somewhere you need to use to clear the interrupt, like in the pci chip.

The cards have a "clear interrupt" register that needs to be written to.

(I don't have any of these cards, btw. I was just curious and downloaded 
the manuals!)

-- 
-=( Ian Abbott _at_ MEV Ltd.    E-mail: <abbotti_at_mev.co.uk>        )=-
-=( Tel: +44 (0)161 477 1898   FAX: +44 (0)161 718 3587         )=-

Received on 2007-10-11Z08:49:05