Add function for reading from counter subdevice.

Signed-off-by: Luca Ellero <luca.ell...@brickedbrain.com>
---
 drivers/staging/comedi/drivers/ni_usb6501.c |   17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/drivers/staging/comedi/drivers/ni_usb6501.c 
b/drivers/staging/comedi/drivers/ni_usb6501.c
index 31a798e..ba2058b 100644
--- a/drivers/staging/comedi/drivers/ni_usb6501.c
+++ b/drivers/staging/comedi/drivers/ni_usb6501.c
@@ -467,6 +467,23 @@ static int ni6501_cnt_insn_config(struct comedi_device 
*dev,
        return ret;
 }
 
+static int ni6501_cnt_insn_read(struct comedi_device *dev,
+                               struct comedi_subdevice *s,
+                               struct comedi_insn *insn,
+                               unsigned int *data)
+{
+       int ret;
+       u32 counter;
+
+       ret = ni6501_counter_command(dev, READ_COUNTER, &counter);
+       if (ret)
+               return ret;
+
+       data[0] = counter;
+
+       return insn->n;
+}
+
 static int ni6501_alloc_usb_buffers(struct comedi_device *dev)
 {
        struct ni6501_private *devpriv = dev->private;
-- 
1.7.10.4

_______________________________________________
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

Reply via email to