Cleanups, add check_timed()
authorDavid Schleef <ds@schleef.org>
Tue, 24 Jul 2001 10:33:09 +0000 (10:33 +0000)
committerDavid Schleef <ds@schleef.org>
Tue, 24 Jul 2001 10:33:09 +0000 (10:33 +0000)
comedi/drivers/check_cmdtest

index c167384a14776480ee6a41e29bf0b55fcc3affe2..f5b43c11064d19b473112362575ecd02597b832d 100755 (executable)
@@ -193,11 +193,6 @@ struct comedi_subdevice_struct{
 
        unsigned int *chanlist;         /* driver-owned chanlist (not used) */
 
-#ifdef CONFIG_COMEDI_TRIG
-       comedi_trig     cur_trig;       /* current trig structure */
-       int (*trig[5])(comedi_device *,comedi_subdevice *,comedi_trig *);
-#endif
-
        int (*insn_read)(comedi_device *,comedi_subdevice *,comedi_insn *,lsampl_t *);
        int (*insn_write)(comedi_device *,comedi_subdevice *,comedi_insn *,lsampl_t *);
        int (*insn_bits)(comedi_device *,comedi_subdevice *,comedi_insn *,lsampl_t *);
@@ -207,8 +202,6 @@ struct comedi_subdevice_struct{
        int (*do_cmdtest)(comedi_device *,comedi_subdevice *,comedi_cmd *);
        int (*poll)(comedi_device *,comedi_subdevice *);
        int (*cancel)(comedi_device *,comedi_subdevice *);
-       int (*do_lock)(comedi_device *,comedi_subdevice *);
-       int (*do_unlock)(comedi_device *,comedi_subdevice *);
 
        int (*buf_change)(comedi_device *,comedi_subdevice *s);
 
@@ -283,6 +276,7 @@ comedi_subdevice subdevice,*s;
 void check_null(void);
 void check_mask(void);
 void check_mask_2(void);
+void check_timed(void);
 
 comedi_cmd cmd_mask;
 
@@ -294,10 +288,20 @@ int main(int argc,char *argv[])
        check_null();
        check_mask();
        check_mask_2();
+       check_timed();
 
        return 0;
 }
 
+void dump_cmd(comedi_cmd *cmd)
+{
+       printf("start_src:       %08x\n",cmd->start_src       );
+       printf("scan_begin_src:  %08x\n",cmd->scan_begin_src  );
+       printf("convert_src:     %08x\n",cmd->convert_src     );
+       printf("scan_end_src:    %08x\n",cmd->scan_end_src    );
+       printf("stop_src:        %08x\n",cmd->stop_src        );
+}
+
 void check_null(void)
 {
        comedi_cmd cmd;
@@ -324,11 +328,7 @@ void check_mask(void)
        ret = cmd_test(dev,s,&cmd);
        if(ret!=1)printf("E: mask returned %d\n",ret);
 
-       printf("start_src:       %08x\n",cmd.start_src       );
-       printf("scan_begin_src:  %08x\n",cmd.scan_begin_src  );
-       printf("convert_src:     %08x\n",cmd.convert_src     );
-       printf("scan_end_src:    %08x\n",cmd.scan_end_src    );
-       printf("stop_src:        %08x\n",cmd.stop_src        );
+       dump_cmd(&cmd);
 
        cmd_mask=cmd;
 }
@@ -342,6 +342,41 @@ void check_mask_2(void)
        if(ret<2)printf("E: mask_2 returned %d\n",ret);
 }
 
+void check_timed(void)
+{
+       int ret;
+       int i;
+       unsigned int freq = 10000;
+       unsigned int n_scan = 10000;
+       unsigned int n_chan = 4;
+       unsigned int chanlist[4];
+       comedi_cmd c = {
+               start_src: TRIG_NOW,
+               start_arg: 0,
+               scan_begin_src: TRIG_TIMER,
+               scan_begin_arg: 1e9/freq,
+               convert_src: TRIG_TIMER,
+               convert_arg: 1,
+               scan_end_src: TRIG_COUNT,
+               scan_end_arg: n_chan,
+               stop_src: TRIG_COUNT,
+               stop_arg: n_scan,
+               chanlist: chanlist,
+               chanlist_len: n_chan,
+       };
+       comedi_cmd *cmd = &c;
+
+       for(i=0;i<n_chan;i++){
+               chanlist[i]=CR_PACK(i,0,AREF_GROUND);
+       }
+
+       ret = cmd_test(dev,s,cmd);
+       if(ret<3)printf("W: timed returned %d\n",ret);
+       printf("timed returned %d\n",ret);
+
+       dump_cmd(cmd);
+
+}
 
 
 /* begin autogenerated */