async->events = 0;
+ // check for fifo overrun
+ if(status & ADC_OVERRUN_BIT)
+ {
+ ai_cancel(dev, s);
+ async->events |= COMEDI_CB_EOA | COMEDI_CB_ERROR;
+ comedi_event(dev, s, async->events);
+ return;
+ }
+
// if interrupt was due to analog input data being available
if(status & ADC_INTR_PENDING_BIT)
{
async->events |= COMEDI_CB_BLOCK | COMEDI_CB_EOS;
}
- // check for fifo overrun
- if(status & ADC_OVERRUN_BIT)
- {
- ai_cancel(dev, s);
- async->events |= COMEDI_CB_EOA | COMEDI_CB_ERROR;
- }
-
- // if we are have all the data, then quit
- if(cmd->stop_src == TRIG_COUNT ||
- (cmd->stop_src == TRIG_EXT && (status & ADC_STOP_BIT)))
- {
- if(devpriv->ai_count <= 0)
- ai_cancel(dev, s);
- async->events |= COMEDI_CB_EOA;
- }
-
// clear possible plx9080 interrupt sources
if(plx_status & ICS_LDIA)
{ // clear local doorbell interrupt
{
// transfer data from dma buffer to comedi buffer
num_samples = DMA_TRANSFER_SIZE / sizeof(devpriv->ai_buffer[0][0]);
+ if(cmd->stop_src == TRIG_COUNT)
+ {
+ if(num_samples > devpriv->ai_count)
+ num_samples = devpriv->ai_count;
+ devpriv->ai_count -= num_samples;
+ }
for(i = 0; i < num_samples; i++)
{
comedi_buf_put(async, devpriv->ai_buffer[devpriv->dma_index][i]);
#endif
}
+ // if we are have all the data, then quit
+ if(cmd->stop_src == TRIG_COUNT ||
+ (cmd->stop_src == TRIG_EXT && (status & ADC_STOP_BIT)))
+ {
+ if(devpriv->ai_count <= 0)
+ ai_cancel(dev, s);
+ async->events |= COMEDI_CB_EOA;
+ }
+
comedi_event(dev, s, async->events);
return;
}