From: Frank Mori Hess Date: Wed, 6 Aug 2003 22:01:04 +0000 (+0000) Subject: speed up pio ai fifo transfer a little X-Git-Tag: r0_7_69~270 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=a7bd8d0c07833220bc1c294470b2dc080167374a;p=comedi.git speed up pio ai fifo transfer a little --- diff --git a/comedi/drivers/ni_mio_common.c b/comedi/drivers/ni_mio_common.c index 6411bd9b..c0b9c46a 100644 --- a/comedi/drivers/ni_mio_common.c +++ b/comedi/drivers/ni_mio_common.c @@ -59,6 +59,7 @@ #include "8255.h" #include "mite.h" +#include "comedi_fc.h" #ifndef MDPRINTK #define MDPRINTK(format,args...) @@ -851,7 +852,7 @@ static void ni_ai_fifo_read(comedi_device *dev,comedi_subdevice *s, u32 dl; sampl_t data; unsigned int mask; - int err = 1; + int no_err = 1; mask=(1<>16) & 0xffff; data += devpriv->ai_offset[ async->cur_chan++ ]; - err &= comedi_buf_put(s->async, data); + no_err &= comedi_buf_put(s->async, data); async->cur_chan %= async->cmd.chanlist_len; data = dl & 0xffff; data += devpriv->ai_offset[ async->cur_chan++ ]; - err &= comedi_buf_put(s->async, data); + no_err &= comedi_buf_put(s->async, data); async->cur_chan %= async->cmd.chanlist_len; } @@ -874,19 +875,26 @@ static void ni_ai_fifo_read(comedi_device *dev,comedi_subdevice *s, dl=ni_readl(ADC_FIFO_Data_611x); data = dl & 0xffff; data += devpriv->ai_offset[ async->cur_chan++ ]; - err &= comedi_buf_put(s->async, data); + no_err &= comedi_buf_put(s->async, data); async->cur_chan %= async->cmd.chanlist_len; } + if(no_err==0){ + async->events |= COMEDI_CB_OVERFLOW; + } }else{ + if( n > sizeof(devpriv->ai_fifo_buffer) / sizeof(devpriv->ai_fifo_buffer[0])) + { + comedi_error( dev, "bug! ai_fifo_buffer too small" ); + async->events |= COMEDI_CB_ERROR; + return; + } for(i=0;iai_offset[ async->cur_chan++ ]; + devpriv->ai_fifo_buffer[ n ] = ni_readw(ADC_FIFO_Data_Register); + devpriv->ai_fifo_buffer[ n ] += devpriv->ai_offset[ async->cur_chan++ ]; async->cur_chan %= async->cmd.chanlist_len; - err &= comedi_buf_put(async, data); } - } - if(err==0){ - async->events |= COMEDI_CB_OVERFLOW; + cfc_write_array_to_buffer( s, devpriv->ai_fifo_buffer, + n * sizeof(devpriv->ai_fifo_buffer[0]) ); } } diff --git a/comedi/drivers/ni_stc.h b/comedi/drivers/ni_stc.h index 7ad85e72..0f100c22 100644 --- a/comedi/drivers/ni_stc.h +++ b/comedi/drivers/ni_stc.h @@ -776,6 +776,8 @@ static ni_board ni_boards[]; unsigned short atrig_mode; \ unsigned short atrig_high; \ unsigned short atrig_low; \ + \ + sampl_t ai_fifo_buffer[0x2000]; \ #endif /* _COMEDI_NI_STC_H */