[PATCH 46/66] staging: comedi: pcl816: introduce pcl816_ai_soft_trig()
H Hartley Sweeten
hsweeten at visionengravers.com
Fri Feb 28 23:24:35 UTC 2014
Introduce a helper function to start a software triggered analog input
conversion.
Signed-off-by: H Hartley Sweeten <hsweeten at visionengravers.com>
Cc: Ian Abbott <abbotti at mev.co.uk>
Cc: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
---
drivers/staging/comedi/drivers/pcl816.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/drivers/staging/comedi/drivers/pcl816.c b/drivers/staging/comedi/drivers/pcl816.c
index 7b8ad6d..9076186 100644
--- a/drivers/staging/comedi/drivers/pcl816.c
+++ b/drivers/staging/comedi/drivers/pcl816.c
@@ -214,6 +214,12 @@ static void pcl816_ai_clear_eoc(struct comedi_device *dev)
outb(0, dev->iobase + PCL816_CLRINT);
}
+static void pcl816_ai_soft_trig(struct comedi_device *dev)
+{
+ /* writing any value triggers a software conversion */
+ outb(0, dev->iobase + PCL816_AD_LO);
+}
+
static unsigned int pcl816_ai_get_sample(struct comedi_device *dev,
struct comedi_subdevice *s)
{
@@ -537,7 +543,7 @@ static int pcl816_ai_cancel(struct comedi_device *dev,
i8254_set_mode(dev->iobase + PCL816_TIMER_BASE, 0,
1, I8254_MODE0 | I8254_BINARY);
- outb(0, dev->iobase + PCL816_AD_LO);
+ pcl816_ai_soft_trig(dev);
pcl816_ai_get_sample(dev, s);
/* Stop A/D */
@@ -648,8 +654,7 @@ static int pcl816_ai_insn_read(struct comedi_device *dev,
for (i = 0; i < insn->n; i++) {
pcl816_ai_clear_eoc(dev);
- /* start conversion */
- outb(0, dev->iobase + PCL816_AD_LO);
+ pcl816_ai_soft_trig(dev);
ret = comedi_timeout(dev, s, insn, pcl816_ai_eoc, 0);
if (ret)
--
1.8.5.2
More information about the devel
mailing list