Re: data[] for digital I/O

thanks for answering frank

Frank Mori Hess wrote:

> grepping the drivers for those that implement an "insn_bits" for a 
> subdevice will probably help.

that's the first thing I tried, as I also own a pcl711 and have its 
manual, but I can't figure out what this function is doing when checking 
if (data[0]) below

/* Digital port write - Untested on 8112 */
static int pcl711_do_insn_bits(comedi_device * dev, comedi_subdevice * s,
	comedi_insn *insn,lsampl_t *data)
{
	if(insn->n!=2)return -EINVAL;

	if(data[0]){
		s->state &= ~data[0];
		s->state |= data[0]&data[1];
	}
	if(data[0]&0x00ff)
		outb(s->state & 0xff, dev->iobase + PCL711_DO_LO);
	if(data[0]&0xff00)
		outb((s->state >> 8), dev->iobase + PCL711_DO_HI);

	data[1]=s->state;

	return 2;
}

even more, there is another difference between the 711 and the other 
card, so I can't just cut & paste this function. The 711 expects a bit 
mask abd writes all the digital outputs with only one outb(), while the 
other one expects a channel specification and the data (1 or 0) 
separately, so writing in the 8 channels requieres 8 outb(). That's why 
I want to understand the data[] array.

none of the tries I did where succesfull on writing on a binary output.

for example, if I want to put the 4th bit to 1, should I do

$ demo/outp 8

or

$ demo/outp -c 4 1

?

>> and, btw, would the official developers like this driver to be added to
>> comedi? If this is the case, what are the official steps in order for a
>> new driver to be accepted?
> Sure.  Put it in the bugzilla.  And probably post to the list that it's 
> there, as sometimes it takes a while for me to check for new items in the 
> bugzilla, since bugs are such a downer :)

good!


-- 
jeremy
http://ib.cnea.gov.ar/~thelerg

Received on 2007-10-26Z20:36:18