From 5fa087574122cf93ce8d89d84e792a3fe49aeaae Mon Sep 17 00:00:00 2001 From: Frank Mori Hess Date: Tue, 3 Jun 2003 21:12:39 +0000 Subject: [PATCH] try and make sure we get the scan across dma during end-of-scan interrupts --- comedi/drivers/ni_mio_common.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/comedi/drivers/ni_mio_common.c b/comedi/drivers/ni_mio_common.c index 748eb6fc..8c3a20a5 100644 --- a/comedi/drivers/ni_mio_common.c +++ b/comedi/drivers/ni_mio_common.c @@ -4,6 +4,7 @@ COMEDI - Linux Control and Measurement Device Interface Copyright (C) 1997-2001 David A. Schleef + Copyright (C) 2002, 2003 Frank Mori Hess subdevices + 0; @@ -495,7 +496,7 @@ static void handle_a_interrupt(comedi_device *dev,unsigned short status, #ifdef PCIDMA /* Currently, mite.c requires us to handle LINKC and DONE */ if(m_status & CHSR_LINKC){ - mite_handle_a_linkc(devpriv->mite, dev); + ni_sync_ai_dma(devpriv->mite, dev); } if(m_status & CHSR_DONE){ @@ -586,9 +587,15 @@ static void handle_a_interrupt(comedi_device *dev,unsigned short status, } #endif // !PCIDMA - if(devpriv->aimode==AIMODE_SCAN && status&AI_STOP_St){ + if(devpriv->aimode==AIMODE_SCAN && (status & AI_STOP_St)){ #ifdef PCIDMA - mite_handle_a_linkc(devpriv->mite, dev); + int bytes_in_transit; + + do{ + bytes_in_transit = mite_bytes_in_transit( devpriv->mite, AI_DMA_CHAN ); + ni_sync_ai_dma(devpriv->mite, dev); + }while( ( s->async->events & COMEDI_CB_EOS ) == 0 && + bytes_in_transit ); #else ni_handle_fifo_dregs(dev); s->async->events |= COMEDI_CB_EOS; @@ -922,7 +929,7 @@ static int ni_ai_drain_dma(comedi_device *dev ) return -1; } - mite_handle_a_linkc( mite, dev ); + ni_sync_ai_dma( mite, dev ); return 0; } -- 2.26.2