test reading 0 samples
This commit is contained in:
parent
6a3e5a4ca5
commit
1303b4758c
2 changed files with 38 additions and 0 deletions
|
@ -58,3 +58,39 @@ int test_insn_read(void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* This function tests reading with n=0.
|
||||
*/
|
||||
int test_insn_read_0(void)
|
||||
{
|
||||
comedi_insn it;
|
||||
lsampl_t data = 0xffffffff;
|
||||
int ret;
|
||||
int type;
|
||||
|
||||
type = comedi_get_subdevice_type(device,subdevice);
|
||||
if(type==COMEDI_SUBD_UNUSED){
|
||||
printf("not applicable\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
memset(&it,0,sizeof(it));
|
||||
it.subdev = subdevice;
|
||||
it.insn = INSN_READ;
|
||||
it.n = 0;
|
||||
it.chanspec = CR_PACK(0,0,0);
|
||||
it.data = &data;
|
||||
|
||||
ret = comedi_do_insn(device,&it);
|
||||
|
||||
if(ret<0){
|
||||
printf("E: comedi_do_insn: %s\n",strerror(errno));
|
||||
}else if(ret==0){
|
||||
printf("comedi_do_insn returned 0, good\n");
|
||||
}else{
|
||||
printf("E: comedi_do_insn returned %d\n",ret);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@ int range;
|
|||
int test_info(void);
|
||||
int test_mode0_read(void);
|
||||
int test_insn_read(void);
|
||||
int test_insn_read_0(void);
|
||||
int test_insn_read_time(void);
|
||||
int test_cmd_no_cmd(void);
|
||||
int test_cmd_probe_src_mask(void);
|
||||
|
@ -52,6 +53,7 @@ struct test_struct tests[]={
|
|||
{ "info", test_info, TEST_STD },
|
||||
{ "mode0_read", test_mode0_read, TEST_NEVER },
|
||||
{ "insn_read", test_insn_read, TEST_STD },
|
||||
{ "insn_read_0", test_insn_read_0, TEST_STD },
|
||||
{ "insn_read_time", test_insn_read_time, TEST_STD },
|
||||
{ "cmd_no_cmd", test_cmd_no_cmd, TEST_STD },
|
||||
{ "cmd_probe_src_mask", test_cmd_probe_src_mask, TEST_STD },
|
||||
|
|
Loading…
Add table
Reference in a new issue