Eliminated the possibility of the ao dma channel getting allocated
authorFrank Mori Hess <fmhess@speakeasy.net>
Fri, 28 Sep 2007 18:40:55 +0000 (18:40 +0000)
committerFrank Mori Hess <fmhess@speakeasy.net>
Fri, 28 Sep 2007 18:40:55 +0000 (18:40 +0000)
more than once, when ni_ao_inttrig gets called a second time after
returning an error.

comedi/drivers/ni_mio_common.c

index fdac6580f184e764f493a41e0ae7a4f77ae9ae7c..552a4c6f9d57418d5a3068c23d171a4b4f07635d 100644 (file)
@@ -2813,6 +2813,11 @@ static int ni_ao_inttrig(comedi_device *dev,comedi_subdevice *s,
 
        if(trignum!=0) return -EINVAL;
 
+       /* Null trig at beginning prevent ao start trigger from executing more than
+       once per command (and doing things like trying to allocate the ao dma channel
+       multiple times) */
+       s->async->inttrig = NULL;
+
        ni_set_bits(dev, Interrupt_B_Enable_Register, AO_FIFO_Interrupt_Enable | AO_Error_Interrupt_Enable, 0);
        interrupt_b_bits = AO_Error_Interrupt_Enable;
 #ifdef PCIDMA
@@ -2823,7 +2828,6 @@ static int ni_ao_inttrig(comedi_device *dev,comedi_subdevice *s,
        if(ret) return ret;
        ret = ni_ao_wait_for_dma_load(dev);
        if(ret < 0) return ret;
-
 #else
        ret = ni_ao_prep_fifo(dev,s);
        if(ret==0)return -EPIPE;
@@ -2855,8 +2859,6 @@ static int ni_ao_inttrig(comedi_device *dev,comedi_subdevice *s,
 
        devpriv->stc_writew(dev, devpriv->ao_cmd2|AO_START1_Pulse,AO_Command_2_Register);
 
-       s->async->inttrig=NULL;
-
        return 0;
 }