13 #include "comedi_test.h"
15 static int do_continuous(int multiplier);
19 int test_cmd_continuous(void)
23 if(!(comedi_get_subdevice_flags(device,subdevice)&SDF_CMD)){
24 printf("not applicable\n");
28 /* as if doing _one_ infinite loop wasn't slow enough,
29 * we loop through with higher and higher multipliers,
30 * in case the test fails because of latency problems */
32 for(mult=1;mult<1024;mult*=2){
39 static int do_continuous(int multiplier)
43 unsigned int chanlist[1];
48 unsigned long total_secs = 0;
49 struct timeval tv,start_tv;
51 if(comedi_get_cmd_generic_timed(device,subdevice, &cmd, 1, 1)<0){
52 printf(" not supported\n");
56 if(realtime)cmd.flags |= TRIG_RT;
58 cmd.chanlist = chanlist;
60 cmd.stop_src = TRIG_NONE;
63 chanlist[0] = CR_PACK(0,0,0);
66 cmd.scan_begin_arg *= multiplier;
67 printf("multiplier=%d, scan_begin_arg=%d\n",
71 ret=comedi_command(device,&cmd);
73 perror("comedi_command");
75 printf("ret==%d\n",ret);
78 gettimeofday(&start_tv,NULL);
82 ret = read(comedi_fileno(device),buf,BUFSZ);
96 gettimeofday(&tv,NULL);
97 tv.tv_sec-=start_tv.tv_sec;
98 tv.tv_usec-=start_tv.tv_usec;
103 if(tv.tv_sec>total_secs){
106 t=tv.tv_sec+1e-6*tv.tv_usec;
107 printf("%0.3f %d (%g) %d (%g)\n",
118 t=tv.tv_sec+1e-6*tv.tv_usec;
119 printf("end: %0.3f %d (%g) %d (%g)\n",