staging: comedi: addi_apci_3120: move apci3120_ai_insn_read() to driver source
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Tue, 4 Nov 2014 17:54:43 +0000 (10:54 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 7 Nov 2014 17:34:02 +0000 (09:34 -0800)
Move this function, and its helper function, from the included hwdrv_apci31210.c
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 929ef0b4620c67540b8cdbe8fbd2dc2c460451a6..28c5792f0e90915ea98f72f71739ce6dea9a3f3d 100644 (file)
@@ -131,66 +131,6 @@ static int apci3120_setup_chan_list(struct comedi_device *dev,
        return 1;               /*  we can serve this with scan logic */
 }
 
-static int apci3120_ai_eoc(struct comedi_device *dev,
-                          struct comedi_subdevice *s,
-                          struct comedi_insn *insn,
-                          unsigned long context)
-{
-       unsigned int status;
-
-       status = inw(dev->iobase + APCI3120_STATUS_REG);
-       if ((status & APCI3120_STATUS_EOC_INT) == 0)
-               return 0;
-       return -EBUSY;
-}
-
-static int apci3120_ai_insn_read(struct comedi_device *dev,
-                                struct comedi_subdevice *s,
-                                struct comedi_insn *insn,
-                                unsigned int *data)
-{
-       struct apci3120_private *devpriv = dev->private;
-       unsigned int divisor;
-       int ret;
-       int i;
-
-       /* set mode for A/D conversions by software trigger with timer 0 */
-       devpriv->mode = APCI3120_MODE_TIMER2_CLK_OSC |
-                       APCI3120_MODE_TIMER2_AS_TIMER;
-       outb(devpriv->mode, dev->iobase + APCI3120_MODE_REG);
-
-       /* load chanlist for single channel scan */
-       if (!apci3120_setup_chan_list(dev, s, 1, &insn->chanspec))
-               return -EINVAL;
-
-       /*
-        * Timer 0 is used in MODE4 (software triggered strobe) to set the
-        * conversion time for each acquisition. Each conversion is triggered
-        * when the divisor is written to the timer, The conversion is done
-        * when the EOC bit in the status register is '0'.
-        */
-       apci3120_timer_set_mode(dev, 0, APCI3120_TIMER_MODE4);
-       apci3120_timer_enable(dev, 0, true);
-
-       /* fixed conversion time of 10 us */
-       divisor = apci3120_ns_to_timer(dev, 0, 10000, CMDF_ROUND_NEAREST);
-
-       apci3120_ai_reset_fifo(dev);
-
-       for (i = 0; i < insn->n; i++) {
-               /* trigger conversion */
-               apci3120_timer_write(dev, 0, divisor);
-
-               ret = comedi_timeout(dev, s, insn, apci3120_ai_eoc, 0);
-               if (ret)
-                       return ret;
-
-               data[i] = inw(dev->iobase + 0);
-       }
-
-       return insn->n;
-}
-
 static int apci3120_reset(struct comedi_device *dev)
 {
        struct apci3120_private *devpriv = dev->private;
index c17a8408749fa31108abfc446769d837100b311b..70363faa99d6dde956815274ec26d59b13f61ac6 100644 (file)
@@ -281,6 +281,66 @@ static void apci3120_ai_reset_fifo(struct comedi_device *dev)
 
 #include "addi-data/hwdrv_apci3120.c"
 
+static int apci3120_ai_eoc(struct comedi_device *dev,
+                          struct comedi_subdevice *s,
+                          struct comedi_insn *insn,
+                          unsigned long context)
+{
+       unsigned int status;
+
+       status = inw(dev->iobase + APCI3120_STATUS_REG);
+       if ((status & APCI3120_STATUS_EOC_INT) == 0)
+               return 0;
+       return -EBUSY;
+}
+
+static int apci3120_ai_insn_read(struct comedi_device *dev,
+                                struct comedi_subdevice *s,
+                                struct comedi_insn *insn,
+                                unsigned int *data)
+{
+       struct apci3120_private *devpriv = dev->private;
+       unsigned int divisor;
+       int ret;
+       int i;
+
+       /* set mode for A/D conversions by software trigger with timer 0 */
+       devpriv->mode = APCI3120_MODE_TIMER2_CLK_OSC |
+                       APCI3120_MODE_TIMER2_AS_TIMER;
+       outb(devpriv->mode, dev->iobase + APCI3120_MODE_REG);
+
+       /* load chanlist for single channel scan */
+       if (!apci3120_setup_chan_list(dev, s, 1, &insn->chanspec))
+               return -EINVAL;
+
+       /*
+        * Timer 0 is used in MODE4 (software triggered strobe) to set the
+        * conversion time for each acquisition. Each conversion is triggered
+        * when the divisor is written to the timer, The conversion is done
+        * when the EOC bit in the status register is '0'.
+        */
+       apci3120_timer_set_mode(dev, 0, APCI3120_TIMER_MODE4);
+       apci3120_timer_enable(dev, 0, true);
+
+       /* fixed conversion time of 10 us */
+       divisor = apci3120_ns_to_timer(dev, 0, 10000, CMDF_ROUND_NEAREST);
+
+       apci3120_ai_reset_fifo(dev);
+
+       for (i = 0; i < insn->n; i++) {
+               /* trigger conversion */
+               apci3120_timer_write(dev, 0, divisor);
+
+               ret = comedi_timeout(dev, s, insn, apci3120_ai_eoc, 0);
+               if (ret)
+                       return ret;
+
+               data[i] = inw(dev->iobase + 0);
+       }
+
+       return insn->n;
+}
+
 static int apci3120_ao_ready(struct comedi_device *dev,
                             struct comedi_subdevice *s,
                             struct comedi_insn *insn,
This page took 0.0277 seconds and 5 git commands to generate.