static int das16_cancel(comedi_device *dev, comedi_subdevice *s)
{
+ unsigned long flags;
+
+ comedi_spin_lock_irqsave( &dev->spinlock, flags );
/* disable interrupts, dma and pacer clocked conversions */
devpriv->control_state &= ~DAS16_INTE & ~PACING_MASK & ~DMA_ENABLE;
outb(devpriv->control_state, dev->iobase + DAS16_CONTROL);
outb(0, dev->iobase + DAS1600_BURST);
}
+ comedi_spin_unlock_irqrestore( &dev->spinlock, flags );
+
return 0;
}
if((status & DAS16_INT ) == 0)
{
- comedi_error(dev, "spurious interrupt");
+ DEBUG_PRINT( "spurious interrupt\n" );
return;
}
static void das16_interrupt( comedi_device *dev )
{
- unsigned long flags;
+ unsigned long dma_flags, spin_flags;
comedi_subdevice *s = dev->read_subdev;
comedi_async *async;
comedi_cmd *cmd;
return;
}
- flags = claim_dma_lock();
+ comedi_spin_lock_irqsave( &dev->spinlock, spin_flags );
+ if( ( devpriv->control_state & DMA_ENABLE ) == 0 )
+ {
+ comedi_spin_unlock_irqrestore( &dev->spinlock, spin_flags );
+ DEBUG_PRINT( "interrupt while dma disabled?\n" );
+ return;
+ }
+
+ dma_flags = claim_dma_lock();
disable_dma(devpriv->dma_chan);
/* clear flip-flop to make sure 2-byte registers for
* count and address get set correctly */
set_dma_count( devpriv->dma_chan, devpriv->dma_transfer_size );
enable_dma(devpriv->dma_chan);
}
- release_dma_lock(flags);
+ release_dma_lock(dma_flags);
+
+ comedi_spin_unlock_irqrestore( &dev->spinlock, spin_flags );
das16_write_array_to_buffer( dev,
devpriv->dma_buffer[ buffer_index ], num_bytes );