comedi_test: attempt to change read and write subdevice during test

When testing streaming input (or streaming output) command functionality
for a subdevice, attempt to make it the current 'read' (or 'write')
subdevice by calling the new 'comedi_set_read_subdevice()' (or
'comedi_set_write_subdevice()') function.

That is currently only supported by the Linux "in-tree" version of
Comedi, since kernel version 3.19.  If the attempt fails, and the
subdevice is not the current 'read' (or 'write') subdevice, the test
will report "not applicable" as before.
This commit is contained in:
Ian Abbott 2016-05-13 11:48:31 +01:00
parent ae03f3932e
commit 67a364cf93
6 changed files with 16 additions and 1 deletions

View file

@ -112,6 +112,8 @@ int test_cmd_read_fast_1chan(void)
int ret;
unsigned int flags = comedi_get_subdevice_flags(device,subdevice);
/* attempt to make subdevice the current 'read' subdevice */
if(flags&SDF_CMD_READ) comedi_set_read_subdevice(device,subdevice);
if(!(flags&SDF_CMD) || (comedi_get_read_subdevice(device)!=subdevice)){
printf("not applicable\n");
return 0;
@ -172,6 +174,8 @@ int test_cmd_write_fast_1chan(void)
{
num_bytes = num_samples * sizeof(sampl_t);
}
/* attempt to make subdevice the current 'write' subdevice */
if(flags&SDF_CMD_WRITE) comedi_set_write_subdevice(device,subdevice);
if(!(flags&SDF_CMD) || (comedi_get_write_subdevice(device)!=subdevice)){
printf("not applicable\n");
return 0;

View file

@ -21,6 +21,8 @@ int test_cmd_fifo_depth_check(void)
int len;
unsigned int flags = comedi_get_subdevice_flags(device,subdevice);
/* attempt to make subdevice the current 'read' subdevice */
if(flags&SDF_CMD_READ) comedi_set_read_subdevice(device,subdevice);
if(!(flags&SDF_CMD) || (comedi_get_read_subdevice(device)!=subdevice)){
printf("not applicable\n");
return 0;

View file

@ -19,8 +19,11 @@ static int do_continuous(int multiplier);
int test_cmd_continuous(void)
{
int mult;
unsigned int flags = comedi_get_subdevice_flags(device,subdevice);
if(!(comedi_get_subdevice_flags(device,subdevice)&SDF_CMD)){
/* attempt to make subdevice the current 'read' subdevice */
if(flags&SDF_CMD_READ) comedi_set_read_subdevice(device,subdevice);
if(!(flags&SDF_CMD) || (comedi_get_read_subdevice(device)!=subdevice)){
printf("not applicable\n");
return 0;
}

View file

@ -25,6 +25,8 @@ int test_cmd_start_inttrig(void)
unsigned int flags;
flags = comedi_get_subdevice_flags(device,subdevice);
/* attempt to make subdevice the current 'read' subdevice */
if(flags&SDF_CMD_READ) comedi_set_read_subdevice(device,subdevice);
if(!(flags&SDF_CMD) || (comedi_get_read_subdevice(device)!=subdevice)){
printf("not applicable\n");
return 0;

View file

@ -68,6 +68,8 @@ int test_mmap(void)
flags = comedi_get_subdevice_flags(device,subdevice);
/* attempt to make subdevice the current 'read' subdevice */
if(flags&SDF_CMD_READ) comedi_set_read_subdevice(device,subdevice);
if(!(flags&SDF_CMD) || (comedi_get_read_subdevice(device)!=subdevice)){
printf("not applicable\n");
return 0;

View file

@ -30,6 +30,8 @@ int test_read_select(void)
unsigned int flags;
flags = comedi_get_subdevice_flags(device,subdevice);
/* attempt to make subdevice the current 'read' subdevice */
if(flags&SDF_CMD_READ) comedi_set_read_subdevice(device,subdevice);
if(!(flags&SDF_CMD) || (comedi_get_read_subdevice(device)!=subdevice)){
printf("not applicable\n");
return 0;