From: Frank Mori Hess Date: Wed, 12 Mar 2003 22:04:21 +0000 (+0000) Subject: added comedi_data_read_hint() and comedi_data_read_delayed to kcomedilib X-Git-Tag: r0_7_67x~64 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=193c6d047a29f69715611fea6ca653e3675293f6;p=comedi.git added comedi_data_read_hint() and comedi_data_read_delayed to kcomedilib --- diff --git a/comedi/kcomedilib/data.c b/comedi/kcomedilib/data.c index 457af601..24d8d808 100644 --- a/comedi/kcomedilib/data.c +++ b/comedi/kcomedilib/data.c @@ -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 ); +} diff --git a/include/linux/comedilib.h b/include/linux/comedilib.h index c1754b30..462ce8ce 100644 --- a/include/linux/comedilib.h +++ b/include/linux/comedilib.h @@ -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,