forgot to load up fifo in analog out inttrig, fixed typo in dt282x.c, accidentally
authorFrank Mori Hess <fmhess@speakeasy.net>
Thu, 23 Aug 2001 04:54:36 +0000 (04:54 +0000)
committerFrank Mori Hess <fmhess@speakeasy.net>
Thu, 23 Aug 2001 04:54:36 +0000 (04:54 +0000)
commited unknown changes to ni_at_a2150.c I'll have to look at that :)

comedi/drivers/cb_pcidas.c
comedi/drivers/dt282x.c
comedi/drivers/ni_at_a2150.c

index 5b2955ff361f6cd4292efc2c141e273e5f64019d..2107a165ec2950cd18db993cad7752f331ff5698 100644 (file)
@@ -69,6 +69,7 @@ analog triggering on 1602 series
 // PCI vendor number of ComputerBoards/MeasurementComputing
 #define PCI_VENDOR_CB  0x1307
 #define TIMER_BASE 100 // 10MHz master clock
+static const int max_fifo_size = 1024; // maximum fifo size of any supported board
 
 /* PCI-DAS base addresses */
 
@@ -1182,8 +1183,6 @@ static int cb_pcidas_ao_cmd(comedi_device *dev,comedi_subdevice *s)
                        break;
        }
 
-       // next time we send these bits, we want aquisiton to actually start
-       ao_control_bits |= DAC_START | DACEN | DAC_EMPTY;
        devpriv->ao_control_bits = ao_control_bits;
        async->inttrig = cb_pcidas_ao_inttrig;
 
@@ -1192,9 +1191,30 @@ static int cb_pcidas_ao_cmd(comedi_device *dev,comedi_subdevice *s)
 
 static int cb_pcidas_ao_inttrig(comedi_device *dev, comedi_subdevice *s, unsigned int trig_num)
 {
+       unsigned int i, num_points = thisboard->fifo_size;
+       sampl_t data[max_fifo_size];
+       comedi_async *async = s->async;
+       comedi_cmd *cmd = &s->async->cmd;
+
        if(trig_num != 0)
                return -EINVAL;
 
+       // load up fifo
+       if(cmd->stop_src == TRIG_COUNT &&
+               devpriv->ao_count < num_points)
+               num_points = devpriv->ao_count;
+       for(i = 0; i < num_points; i++)
+       {
+               if(comedi_buf_get(async, &data[i]))
+                       break;
+       }
+       if(cmd->stop_src == TRIG_COUNT)
+       {
+               devpriv->ao_count -= i;
+       }
+       // write data to board's fifo
+       outsw(devpriv->ao_registers + DACDATA, data, i);
+
        // enable dac half-full and empty interrupts
        devpriv->adc_fifo_bits |= DAEMIE | DAHFIE;
 #ifdef CB_PCIDAS_DEBUG
@@ -1206,12 +1226,13 @@ static int cb_pcidas_ao_inttrig(comedi_device *dev, comedi_subdevice *s, unsigne
        outl(devpriv->s5933_intcsr_bits, devpriv->s5933_config + INTCSR);
 
        // start dac
+       devpriv->ao_control_bits |= DAC_START | DACEN | DAC_EMPTY;
        outw(devpriv->ao_control_bits, devpriv->control_status + DAC_CSR);
 #ifdef CB_PCIDAS_DEBUG
        rt_printk("comedi: sent 0x%x to dac control\n", devpriv->ao_control_bits);
 #endif
 
-       s->async->inttrig = NULL;
+       async->inttrig = NULL;
 
        return 0;
 }
@@ -1322,13 +1343,14 @@ static void cb_pcidas_interrupt(int irq, void *d, struct pt_regs *regs)
 
        return;
 }
+
 static void handle_ao_interrupt(comedi_device *dev, unsigned int status)
 {
        comedi_subdevice *s = dev->write_subdev;
        comedi_async *async = s->async;
        comedi_cmd *cmd = &async->cmd;
        unsigned int half_fifo = thisboard->fifo_size / 2;
-       static const int max_half_fifo = 512;   // maximum possible half-fifo size
+       static const int max_half_fifo = max_fifo_size / 2;     // maximum possible half-fifo size
        sampl_t data[max_half_fifo];
        unsigned int num_points, i;
 
index 850f570cd779afebd39708425a3bbe6a0255fdb8..7cac9dd8993f1162ffb07e7513d5d4b8ab9da654 100644 (file)
@@ -1011,7 +1011,7 @@ static int dt282x_ao_inttrig(comedi_device *dev,comedi_subdevice *s,
 {
        int size;
 
-       if(x!=0)return -EVINAL;
+       if(x!=0)return -EINVAL;
 
        size=copy_from_buf(dev,s,devpriv->dma[0].buf,devpriv->dma_maxsize*2);
        prep_ao_dma(dev,0,size/2);
index 4009fd0108eedb44cc22fd2acac2cbadb46c58d3..44be8cb350f58b02fbc4dd8938f7d2936aed556b 100644 (file)
@@ -1,6 +1,6 @@
 /*
     ni_at_a2150.c driver for National Instruments AT-A2150 boards
-    Copyright (C) 2000 Frank Mori Hess <fmhess@uiuc.edu>
+    Copyright (C) 2001 Frank Mori Hess <fmhess@uiuc.edu>
 
     COMEDI - Linux Control and Measurement Device Interface
     Copyright (C) 2000 David A. Schleef <ds@schleef.org>