- From: Ian Abbott <abbotti_at_mev.co.uk>
- Date: Mon, 24 Jan 2005 18:15:02 +0000
Hi David, Frank, et al., I'm working on a new driver that supports streaming aquisition on a digital I/O subdevice with 24 channels (physically, its a 8255, but I'm not using the generic 8255 driver for various reasons). There are two ways I could treat the buffered data and I'd like some opinions on which is the best approach. In both cases, cmd->convert_src will be forced to TRIG_NOW. The first way is store the scan as a single lsampl_t value with all channels' values stored at corresponding bit positions within the lsampl_t value. So the acquired value for channel 0 is always stored at bit position 0 in the lsampl_t and the acquired value for channel 23 is always stored at bit position 23. If I use this method, I'll set the SDF_LSAMPL flag in the subdevice. The second way is to pack the channel data into the minimum required number of bytes (rounding up to a whole number of bytes), storing the channels in the order they appear in the command's channel list. So if the channel list contains 9 channels, the scan will use two bytes; bit 0 of byte 0 will contain the data for the first channel in the list; bit 1 will contain the data for the second channel in the list, etc. If I use this method, I'll set the SDF_PACKED flag in the subdevice (nothing uses that yet!). I'm not sure which is best. The second way seems more generic as it can cope with >32 channels, but is slightly harder to implement (and maybe harder for the application to make sense of?). As far as I can tell, the ni_pcidio driver does it the first way. The second way is basically what the cfc_read_array_from_buffer and cfc_write_array_to_buffer functions in comedi_fc.c assume for DIO subdevices, but I don't think any driver uses those for streaming DIO acquisitions yet. The bytes_per_scan inline function in comedi_fc.c may be broken as it rounds down the number of bytes required to scan a DIO channel list. Ian. -- -=( 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 2005-01-24Z18:15:02