- From: <rhk_at_newimage.com>
- Date: Fri, 30 Aug 2002 15:02:33 -0700
Message-Id: <20020830220224.D4492DA2D_at_newimage.com>
Date: Fri, 30 Aug 2002 18:02:24 -0400 (EDT)
From: rhk_at_newimage.com (Apache User)
Hopefully my web-browser based email program won't mangle this too badly.
This patch fixes analog output streaming for the NI MIO cards in comedi 0.7.65. The
first chunk is the same one I submitted earlier for handling buffer underrun, and the
second chunk fixes the fifo interrupt code so that the correct number of bytes are
written. This only manifests when the buffer is approaching empty, and there are less
than half a fifo worth of samples remaining.
This patch is obsoleted by the current code in CVS, but I am submitting it anyway in
case anyone might need analog output with the current release version.
-Ray
--SNIP--
diff -ru2 ni_mio_common.old.c ni_mio_common.c
--- ni_mio_common.old.c 2002-06-06 20:02:40.000000000 -0400
+++ ni_mio_common.c 2002-08-30 17:15:54.000000000 -0400
_at__at_ -575,4 +575,5 _at__at_
static void handle_b_interrupt(comedi_device *dev,unsigned short b_status)
{
+ int ret;
comedi_subdevice *s=dev->subdevices+1;
//unsigned short ack=0;
_at__at_ -590,6 +591,14 _at__at_
}
- if(b_status&AO_FIFO_Request_St)
- ni_ao_fifo_half_empty(dev,s);
+ if(b_status&AO_FIFO_Request_St){
+ ret = ni_ao_fifo_half_empty(dev,s);
+
+ if(!ret){
+ rt_printk("ni_mio_common: AO buffer underrun\n");
+ ni_set_bits(dev, Interrupt_B_Enable_Register,
+ AO_FIFO_Interrupt_Enable|AO_Error_Interrupt_Enable, 0);
+ s->async->events |= COMEDI_CB_ERROR | COMEDI_CB_EOA;
+ }
+ }
b_status=win_in(AO_Status_1_Register);
_at__at_ -1749,5 +1758,5 _at__at_
int n,m;
- n=(s->async->buf_int_count-s->async->buf_user_count)/sizeof(sampl_t);
+ n=(s->async->buf_user_count-s->async->buf_int_count)/sizeof(sampl_t);
if(n==0)return 0;
if(n>boardtype.ao_fifo_depth/2)
--SNIP--
Received on 2002-08-30Z21:02:33