From 5f0f7957569e4b46783a2b4ded34da19b2221cf1 Mon Sep 17 00:00:00 2001 From: David Schleef Date: Tue, 24 Jul 2001 10:33:09 +0000 Subject: [PATCH] Cleanups, add check_timed() --- comedi/drivers/check_cmdtest | 59 ++++++++++++++++++++++++++++-------- 1 file changed, 47 insertions(+), 12 deletions(-) diff --git a/comedi/drivers/check_cmdtest b/comedi/drivers/check_cmdtest index c167384a..f5b43c11 100755 --- a/comedi/drivers/check_cmdtest +++ b/comedi/drivers/check_cmdtest @@ -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