staging: comedi: usbdux: use comedi_async 'scans_done' to detect AO EOA
Remove the private data member 'ao_sample_count' and use the comedi_async 'scans_done' member to detect the analog output end-of-acquisition. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
aee15aea0d
commit
7c5fc7dd47
1 changed files with 4 additions and 25 deletions
|
@ -204,7 +204,6 @@ struct usbdux_private {
|
||||||
|
|
||||||
/* number of samples to acquire */
|
/* number of samples to acquire */
|
||||||
int ai_sample_count;
|
int ai_sample_count;
|
||||||
int ao_sample_count;
|
|
||||||
/* time between samples in units of the timer */
|
/* time between samples in units of the timer */
|
||||||
unsigned int ai_timer;
|
unsigned int ai_timer;
|
||||||
unsigned int ao_timer;
|
unsigned int ao_timer;
|
||||||
|
@ -397,13 +396,11 @@ static void usbduxsub_ao_handle_urb(struct comedi_device *dev,
|
||||||
if (devpriv->ao_counter == 0) {
|
if (devpriv->ao_counter == 0) {
|
||||||
devpriv->ao_counter = devpriv->ao_timer;
|
devpriv->ao_counter = devpriv->ao_timer;
|
||||||
|
|
||||||
if (cmd->stop_src == TRIG_COUNT) {
|
if (cmd->stop_src == TRIG_COUNT &&
|
||||||
devpriv->ao_sample_count--;
|
async->scans_done >= cmd->stop_arg) {
|
||||||
if (devpriv->ao_sample_count < 0) {
|
|
||||||
async->events |= COMEDI_CB_EOA;
|
async->events |= COMEDI_CB_EOA;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/* transmit data to the USB bus */
|
/* transmit data to the USB bus */
|
||||||
datap = urb->transfer_buffer;
|
datap = urb->transfer_buffer;
|
||||||
|
@ -1011,24 +1008,6 @@ static int usbdux_ao_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
|
||||||
|
|
||||||
devpriv->ao_counter = devpriv->ao_timer;
|
devpriv->ao_counter = devpriv->ao_timer;
|
||||||
|
|
||||||
if (cmd->stop_src == TRIG_COUNT) {
|
|
||||||
/* not continuous */
|
|
||||||
/* counter */
|
|
||||||
/* high speed also scans everything at once */
|
|
||||||
if (0) { /* (devpriv->high_speed) */
|
|
||||||
devpriv->ao_sample_count = cmd->stop_arg *
|
|
||||||
cmd->scan_end_arg;
|
|
||||||
} else {
|
|
||||||
/* there's no scan as the scan has been */
|
|
||||||
/* perf inside the FX2 */
|
|
||||||
/* data arrives as one packet */
|
|
||||||
devpriv->ao_sample_count = cmd->stop_arg;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
/* continous acquisition */
|
|
||||||
devpriv->ao_sample_count = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cmd->start_src == TRIG_NOW) {
|
if (cmd->start_src == TRIG_NOW) {
|
||||||
/* enable this acquisition operation */
|
/* enable this acquisition operation */
|
||||||
devpriv->ao_cmd_running = 1;
|
devpriv->ao_cmd_running = 1;
|
||||||
|
|
Loading…
Add table
Reference in a new issue