Re: DIO cards with edge-triggered interrupts

On 10/01/06 16:55, Calin A. Culianu wrote:
> On Mon, 9 Jan 2006, Frank Mori Hess wrote:
> 
>> On Monday 09 January 2006 12:18 pm, Calin A. Culianu wrote:
>>
>>> Hi,
>>>
>>> I am developing a comedi driver for a winsystems PC-104 based DIO board.
>>> The neat thing about this DIO board is that it supports edge-triggered
>>> interrupts on 24 individual DIO lines.
>>>
>>> Since I am too lazy to research this myself, could someone just tell me
>>> how edge-triggered interrupts are modeled using the comedi driver
>>> framework?
>>>
>>> Basically how can I give this functionality to the user of the driver
>>> using the comedi API and framework?  It's not exactly a comedi command
>>> and it's not exactly a comedi_sv thingamajig.  Or is it?
>>
>>
>> The existing drivers implement a read command that generates a bogus 
>> sample
>> every time the interrupt is triggered.
>>
> 
> Hmm, ok I see there are some drivers that do this (grepped for 'edge' in 
> comedi/drivers).
> 
> Weird.  OK.. so the bogus sample doesn't contain packed bitfield data or 
> anything?  Instead people are supposed to just call comedi_dio_bitfield 
> in their callback?
> 
> I'll grep the sourced summore.

Have a look at my amplc_dio200 driver; it might be something like what 
you want to do.  It implements a 6-channel subdevice to handle its 
edge-triggered interrupts.  The read command's channel list indicates 
which edge-triggered interrupt sources you are interested in (the others 
are disabled).  The bogus dio value constructed in the interrupt routine 
indirectly indicates which channels have fired (the bit positions in the 
dio value correspond to indices in the read command's channel list, not 
to the actual channel numbers).

-- 
-=( 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 2006-01-10Z17:50:29