From: Frank Mori Hess Date: Thu, 2 Nov 2006 19:34:23 +0000 (+0000) Subject: Added some commented-out code for measuring speed of dma transfers X-Git-Tag: r0_7_74~164 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=4cf63740b701e7a2e19b04c9bc3f43362ede1eae;p=comedi.git Added some commented-out code for measuring speed of dma transfers for ao. --- diff --git a/comedi/drivers/ni_mio_common.c b/comedi/drivers/ni_mio_common.c index 44b664db..08e16860 100644 --- a/comedi/drivers/ni_mio_common.c +++ b/comedi/drivers/ni_mio_common.c @@ -533,23 +533,43 @@ static void mite_handle_b_linkc(struct mite_struct *mite, comedi_device *dev) async->events |= COMEDI_CB_BLOCK; } - +// #define DEBUG_DMA_TIMING static int ni_ao_wait_for_dma_load( comedi_device *dev ) { static const int timeout = 10000; int i; - +#ifdef DEBUG_DMA_TIMING + struct timeval start; + do_gettimeofday(&start); +#endif for(i = 0; i < timeout; i++) { unsigned short b_status; - b_status = devpriv->stc_readw(dev, AO_Status_1_Register ); + b_status = devpriv->stc_readw(dev, AO_Status_1_Register); if( b_status & AO_FIFO_Half_Full_St ) break; /* if we poll too often, the pci bus activity seems to slow the dma transfer down */ comedi_udelay(10); } +#ifdef DEBUG_DMA_TIMING + rt_printk("looped %i times waiting for ao fifo load.\n", i); + struct timeval now; + do_gettimeofday(&now); + unsigned elapsed_usec = 1000000 * (now.tv_sec - start.tv_sec) + now.tv_usec - start.tv_usec; + rt_printk("total elapsed usec=%i\n", elapsed_usec); + do_gettimeofday(&start); + unsigned b_status; + for(i = 0; i < 100; ++i) + { +// devpriv->stc_writew(dev, devpriv->ao_mode3, AO_Mode_3_Register); + b_status = devpriv->stc_readw(dev, AO_Status_1_Register); + } + do_gettimeofday(&now); + elapsed_usec = 1000000 * (now.tv_sec - start.tv_sec) + now.tv_usec - start.tv_usec; + rt_printk("usec to do 100 word xfers=%i\n", elapsed_usec); +#endif if( i == timeout ) { comedi_error(dev, "timed out waiting for dma load"); @@ -2620,7 +2640,7 @@ static int ni_ao_cmd(comedi_device *dev,comedi_subdevice *s) else bits |= AO_DMA_PIO_Control; if(boardtype.reg_type == ni_reg_m_series) - bits |= AO_Number_Of_DAC_Packages; + bits |= AO_Number_Of_DAC_Packages/* | AO_Multiple_DACS_Per_Package*/; devpriv->stc_writew(dev, bits, AO_Personal_Register); // enable sending of ao dma requests devpriv->stc_writew(dev, AO_AOFREQ_Enable, AO_Start_Select_Register);