Re: extra board specific functions

Thanks for the advice, they are very useful....

Nevertheless, I keep running into problems, probably because I need to
know more about the whole working of Comedi.

For example: if I write my s->do_cmd, if it returns 0, than my program
can call it only once, after that whenever I call it, Comedi just
bounces back with -1, not even calling the cmdtest, or anything else.
If I define return 1; (or anything >0), than it can run it multiple
times....
What am I missing? Is the driver supposed to have anything special in
the do_cmd, and maybe comedi is waiting for it?

I use these command sources (and made the cmdtest to allow these)
  cmd.start_src      = TRIG_NOW;
  cmd.scan_begin_src = TRIG_INT;
  cmd.convert_src    = TRIG_NOW;
  cmd.scan_end_src   = TRIG_COUNT;
  cmd.stop_src       = TRIG_NONE;



Also even if I set s->async->inttrig, inside the driver I can call it,
and the trigger works, but the program itself cannot call it
somehow... The trigger used to work, and I'm not sure what did I
change to stop it from working....

I use this function to trigger in my program

int trigchn(comedi_t *it, int subdev)
{
  comedi_insn insn;

  insn.insn = INSN_INTTRIG;
  insn.n = 1;
  insn.data = 0;
  insn.subdev = subdev;
  insn.chanspec = 0;
  return comedi_do_insn(it,&insn);
}


Do you have any suggestions? These two things, the behavior of the
do_cmd and the inttrig really puzzles me.... Thanks very much!

   Greg


> There is enough protection in parse_insn() in comedi/comedi_fops.c to
> stop an INSN_INTTRIG running non-existant code.
>
> You can set s->async->inttrig in your s->do_cmd function.  It can be
> made fairly dynamic, according on the phase of the command.  For
> example, if INT_TRIG is used as a start_src and s->async->inttrig starts
> off pointing to a "start_acquisition" function, the "start_acquisition"
> function could set s->async->inttrig to something else, usually a null
> pointer, but it could point it to a "begin_scan" function for example
> (if scan_begin_src is also INT_TRIG). (This example is fairly pointless,
> as you'd have to send an INSN_INTTRIG twice to start the first scan,
> once to start the acquisition and once to start the scan.)
>
> --
> -=( 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-08-24Z09:14:13