added comedi_data_read_hint() and comedi_data_read_delayed to kcomedilib
authorFrank Mori Hess <fmhess@speakeasy.net>
Wed, 12 Mar 2003 22:04:21 +0000 (22:04 +0000)
committerFrank Mori Hess <fmhess@speakeasy.net>
Wed, 12 Mar 2003 22:04:21 +0000 (22:04 +0000)
comedi/kcomedilib/data.c
include/linux/comedilib.h

index 457af60141cca4ac45f7f564d2d6430a152ad117..24d8d808094a1dd0bf9fb40d74c262829e725a9d 100644 (file)
@@ -57,3 +57,31 @@ int comedi_data_read(comedi_t *dev,unsigned int subdev,unsigned int chan,
        return comedi_do_insn(dev,&insn);
 }
 
+int comedi_data_read_hint(comedi_t *dev,unsigned int subdev,unsigned int chan,
+       unsigned int range,unsigned int aref)
+{
+       comedi_insn insn;
+       lsampl_t dummy_data;
+       
+       memset(&insn,0,sizeof(insn));
+       insn.insn = INSN_READ;
+       insn.n = 0;
+       insn.data = &dummy_data;
+       insn.subdev = subdev;
+       insn.chanspec = CR_PACK(chan,range,aref);
+
+       return comedi_do_insn(dev,&insn);
+}
+
+int comedi_data_read_delayed(comedi_t *dev,unsigned int subdev,unsigned int chan,
+       unsigned int range,unsigned int aref,lsampl_t *data, unsigned int nano_sec)
+{
+       int retval;
+
+       retval = comedi_data_read_hint( dev, subdev, chan, range, aref );
+       if( retval < 0 ) return retval;
+
+       udelay( ( nano_sec + 999 ) / 1000 );
+
+       return comedi_data_read( dev, subdev, chan, range, aref, data );
+}
index c1754b301c4e8cabe3c61df19fe49e7ad58e66b9..462ce8ced8a0e36f1963e73a52c45ce3f7c02ac4 100644 (file)
@@ -71,6 +71,10 @@ int comedi_data_write(comedi_t *dev,unsigned int subdev,unsigned int chan,
        unsigned int range,unsigned int aref,lsampl_t data);
 int comedi_data_read(comedi_t *dev,unsigned int subdev,unsigned int chan,
        unsigned int range,unsigned int aref,lsampl_t *data);
+int comedi_data_read_hint(comedi_t *dev,unsigned int subdev,unsigned int chan,
+       unsigned int range,unsigned int aref);
+int comedi_data_read_delayed(comedi_t *dev,unsigned int subdev,unsigned int chan,
+       unsigned int range,unsigned int aref,lsampl_t *data,unsigned int nano_sec);
 int comedi_dio_config(comedi_t *dev,unsigned int subdev,unsigned int chan,
        unsigned int io);
 int comedi_dio_read(comedi_t *dev,unsigned int subdev,unsigned int chan,