staging: comedi: addi_apci_3120: move apci3120_ai_cmd() to driver
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Tue, 4 Nov 2014 17:55:23 +0000 (10:55 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 7 Nov 2014 17:34:05 +0000 (09:34 -0800)
Move this function from the included source file to the main driver
source file.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c
drivers/staging/comedi/drivers/addi_apci_3120.c

index 771ac87..396aa47 100644 (file)
@@ -26,62 +26,6 @@ static int apci3120_cancel(struct comedi_device *dev,
        return 0;
 }
 
-static int apci3120_ai_cmd(struct comedi_device *dev,
-                          struct comedi_subdevice *s)
-{
-       struct apci3120_private *devpriv = dev->private;
-       struct comedi_cmd *cmd = &s->async->cmd;
-       unsigned int divisor;
-
-       /* set default mode bits */
-       devpriv->mode = APCI3120_MODE_TIMER2_CLK_OSC |
-                       APCI3120_MODE_TIMER2_AS_TIMER;
-
-       /* AMCC- Clear write complete interrupt (DMA) */
-       outl(AINT_WT_COMPLETE, devpriv->amcc + AMCC_OP_REG_INTCSR);
-
-       devpriv->cur_dmabuf = 0;
-
-       /* load chanlist for command scan */
-       apci3120_set_chanlist(dev, s, cmd->chanlist_len, cmd->chanlist);
-
-       if (cmd->start_src == TRIG_EXT)
-               apci3120_exttrig_enable(dev, true);
-
-       if (cmd->scan_begin_src == TRIG_TIMER) {
-               /*
-                * Timer 1 is used in MODE2 (rate generator) to set the
-                * start time for each scan.
-                */
-               divisor = apci3120_ns_to_timer(dev, 1, cmd->scan_begin_arg,
-                                              cmd->flags);
-               apci3120_timer_set_mode(dev, 1, APCI3120_TIMER_MODE2);
-               apci3120_timer_write(dev, 1, divisor);
-       }
-
-       /*
-        * Timer 0 is used in MODE2 (rate generator) to set the conversion
-        * time for each acquisition.
-        */
-       divisor = apci3120_ns_to_timer(dev, 0, cmd->convert_arg, cmd->flags);
-       apci3120_timer_set_mode(dev, 0, APCI3120_TIMER_MODE2);
-       apci3120_timer_write(dev, 0, divisor);
-
-       if (devpriv->use_dma)
-               apci3120_setup_dma(dev, s);
-       else
-               devpriv->mode |= APCI3120_MODE_EOS_IRQ_ENA;
-
-       /* set mode to enable acquisition */
-       outb(devpriv->mode, dev->iobase + APCI3120_MODE_REG);
-
-       if (cmd->scan_begin_src == TRIG_TIMER)
-               apci3120_timer_enable(dev, 1, true);
-       apci3120_timer_enable(dev, 0, true);
-
-       return 0;
-}
-
 /*
  * This is a handler for the DMA interrupt.
  * This function copies the data to Comedi Buffer.
index b5ac5b8..8fd498d 100644 (file)
@@ -437,6 +437,62 @@ static void apci3120_set_chanlist(struct comedi_device *dev,
 
 #include "addi-data/hwdrv_apci3120.c"
 
+static int apci3120_ai_cmd(struct comedi_device *dev,
+                          struct comedi_subdevice *s)
+{
+       struct apci3120_private *devpriv = dev->private;
+       struct comedi_cmd *cmd = &s->async->cmd;
+       unsigned int divisor;
+
+       /* set default mode bits */
+       devpriv->mode = APCI3120_MODE_TIMER2_CLK_OSC |
+                       APCI3120_MODE_TIMER2_AS_TIMER;
+
+       /* AMCC- Clear write complete interrupt (DMA) */
+       outl(AINT_WT_COMPLETE, devpriv->amcc + AMCC_OP_REG_INTCSR);
+
+       devpriv->cur_dmabuf = 0;
+
+       /* load chanlist for command scan */
+       apci3120_set_chanlist(dev, s, cmd->chanlist_len, cmd->chanlist);
+
+       if (cmd->start_src == TRIG_EXT)
+               apci3120_exttrig_enable(dev, true);
+
+       if (cmd->scan_begin_src == TRIG_TIMER) {
+               /*
+                * Timer 1 is used in MODE2 (rate generator) to set the
+                * start time for each scan.
+                */
+               divisor = apci3120_ns_to_timer(dev, 1, cmd->scan_begin_arg,
+                                              cmd->flags);
+               apci3120_timer_set_mode(dev, 1, APCI3120_TIMER_MODE2);
+               apci3120_timer_write(dev, 1, divisor);
+       }
+
+       /*
+        * Timer 0 is used in MODE2 (rate generator) to set the conversion
+        * time for each acquisition.
+        */
+       divisor = apci3120_ns_to_timer(dev, 0, cmd->convert_arg, cmd->flags);
+       apci3120_timer_set_mode(dev, 0, APCI3120_TIMER_MODE2);
+       apci3120_timer_write(dev, 0, divisor);
+
+       if (devpriv->use_dma)
+               apci3120_setup_dma(dev, s);
+       else
+               devpriv->mode |= APCI3120_MODE_EOS_IRQ_ENA;
+
+       /* set mode to enable acquisition */
+       outb(devpriv->mode, dev->iobase + APCI3120_MODE_REG);
+
+       if (cmd->scan_begin_src == TRIG_TIMER)
+               apci3120_timer_enable(dev, 1, true);
+       apci3120_timer_enable(dev, 0, true);
+
+       return 0;
+}
+
 static int apci3120_ai_cmdtest(struct comedi_device *dev,
                               struct comedi_subdevice *s,
                               struct comedi_cmd *cmd)