5 COMEDILIB - Linux Control and Measurement Device Interface Library
6 Copyright (C) 1997-2001 David A. Schleef <ds@schleef.org>
8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Lesser General Public
10 License as published by the Free Software Foundation, version 2.1
13 This library is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Lesser General Public License for more details.
18 You should have received a copy of the GNU Lesser General Public
19 License along with this library; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
24 #include "libinternal.h"
29 #include <sys/types.h>
33 #include <sys/ioctl.h>
40 EXPORT_ALIAS_DEFAULT(_comedi_timed_1chan,comedi_timed_1chan,0.7.18);
41 int _comedi_timed_1chan(comedi_t *dev,unsigned int subd,unsigned int chan,unsigned int range,
42 unsigned int aref,double freq,unsigned int n_samples,double *data)
47 comedi_range *the_range;
51 if(!valid_chan(dev,subd,chan))return -1;
54 memset(&t,0,sizeof(t));
58 the_range=comedi_get_range(dev,subd,chan,range);
59 maxdata=comedi_get_maxdata(dev,subd,chan);
61 chan=CR_PACK(chan,range,aref);
68 comedi_get_timer(dev,subd,freq,&t.trigvar,&act_freq);
71 buffer=malloc(sizeof(sampl_t)*BUFSZ);
74 comedi_trigger(dev,&t);
79 if((m=read(dev->fd,buffer,m*sizeof(sampl_t)))<0){
85 data[n+i]=comedi_to_phys(buffer[i],the_range,maxdata);