]> git.karo-electronics.de Git - karo-tx-linux.git/commit
staging: comedi: pcl711: handle cmd->stop_src and stop_arg
authorIan Abbott <abbotti@mev.co.uk>
Thu, 26 Sep 2013 09:16:38 +0000 (10:16 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 26 Sep 2013 16:34:45 +0000 (09:34 -0700)
commit2ce4e57b9afea13711606839acd382256d201306
tree7bc0d7ee019446927b384f9dc87592e255acea13
parentb7ea391cc4edf5ebb62d6341285ac5da342213f4
staging: comedi: pcl711: handle cmd->stop_src and stop_arg

The interrupt handler used to support asynchronous commands on the AI
subdevice currently marks the command as finished (setting the "end of
acquisition" event flag and returning to software-triggered acquisition
mode) once it has decremented `devpriv->ntrig` to 0.  However, nothing
sets `devpriv->ntrig`, as noted in the "FIXME" comment.

If the `stop_src` setting of the asynchronous command is `TRIG_COUNT`,
then the `stop_arg` setting indicates the number of scans to be
performed in the overall acquisition.  (Otherwise, `stop_src` will be
`TRIG_NONE`, meaning the acquisition should run indefinitely until
cancelled.)  When starting the acquisition in `pcl711_ai_cmd()`, set
`devpriv->ntrig` to the number of scans to be performed (`stop_arg`) if
`stop_src` is `TRIG_COUNT`.  In the interrupt handler, don't decrement
`devpriv->ntrig` or handle end of acquision unless `stop_src` is
`TRIG_COUNT`.

Also check for an empty acquisition in `pcl711_ai_cmd()`, i.e. one where
`stop_src` is `TRIG_COUNT` and `stop_arg` is zero and just mark end of
acquisition without actually setting up the interrupts in this case.

Also change the type of the `ntrig` member of the private data structure
to `unsigned int` as it should be (same type as `stop_arg`).

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/drivers/pcl711.c