added bufconfig test
This commit is contained in:
parent
93c44d29a1
commit
c6093128a1
3 changed files with 78 additions and 1 deletions
|
@ -7,7 +7,7 @@ LDFLAGS=-L../lib/ -lcomedi
|
|||
|
||||
TARG=comedi_test
|
||||
OBJS=main.o mode0_read.o insn_read.o info.o cmd_1.o insn_read_time.o \
|
||||
cmd_2.o mmap.o select.o cmd_3.o
|
||||
cmd_2.o mmap.o select.o cmd_3.o bufconfig.o
|
||||
|
||||
all: $(TARG)
|
||||
|
||||
|
|
75
testing/bufconfig.c
Normal file
75
testing/bufconfig.c
Normal file
|
@ -0,0 +1,75 @@
|
|||
|
||||
#include <stdio.h>
|
||||
#include <comedilib.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <errno.h>
|
||||
#include <getopt.h>
|
||||
#include <ctype.h>
|
||||
#include <math.h>
|
||||
#include <sys/time.h>
|
||||
#include <string.h>
|
||||
#include "comedi_test.h"
|
||||
|
||||
|
||||
int test_bufconfig(void)
|
||||
{
|
||||
int ret;
|
||||
int len;
|
||||
int maxlen;
|
||||
|
||||
printf("joe\n");
|
||||
|
||||
ret = comedi_get_buffer_size(device,subdevice);
|
||||
if(ret<0){
|
||||
perror("comedi_get_buffer_size");
|
||||
}else{
|
||||
printf("buffer size %d\n",ret);
|
||||
}
|
||||
|
||||
maxlen = comedi_get_max_buffer_size(device,subdevice);
|
||||
if(maxlen<0){
|
||||
perror("comedi_get_max_buffer_size");
|
||||
}else{
|
||||
printf("max buffer size %d\n",maxlen);
|
||||
}
|
||||
|
||||
len=4096;
|
||||
printf("setting buffer size to %d\n",len);
|
||||
ret = comedi_set_buffer_size(device,subdevice,len);
|
||||
if(ret<0){
|
||||
perror("comedi_set_buffer_size");
|
||||
}else{
|
||||
printf("buffer size set to %d\n",ret);
|
||||
}
|
||||
|
||||
ret = comedi_get_buffer_size(device,subdevice);
|
||||
if(ret<0){
|
||||
perror("comedi_get_buffer_size");
|
||||
}else{
|
||||
printf("buffer size now at %d\n",ret);
|
||||
}
|
||||
|
||||
len=maxlen+4096;
|
||||
printf("setting buffer size past limit, %d\n",len);
|
||||
ret = comedi_set_buffer_size(device,subdevice,len);
|
||||
if(ret<0){
|
||||
perror("comedi_set_buffer_size");
|
||||
}else{
|
||||
printf("buffer size now at %d\n",ret);
|
||||
}
|
||||
|
||||
len=maxlen;
|
||||
printf("setting buffer size to max, %d\n",len);
|
||||
ret = comedi_set_buffer_size(device,subdevice,len);
|
||||
if(ret<0){
|
||||
perror("comedi_set_buffer_size");
|
||||
}else{
|
||||
printf("buffer size now at %d\n",ret);
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -34,6 +34,7 @@ int test_cmd_fifo_depth_check(void);
|
|||
int test_mmap(void);
|
||||
int test_read_select(void);
|
||||
int test_cmd_continuous(void);
|
||||
int test_bufconfig(void);
|
||||
|
||||
#define TEST_NEVER 0
|
||||
#define TEST_STD 1
|
||||
|
@ -55,6 +56,7 @@ struct test_struct tests[]={
|
|||
{ "mmap", test_mmap, TEST_STD },
|
||||
{ "read_select", test_read_select, TEST_STD },
|
||||
{ "cmd_continuous", test_cmd_continuous, TEST_NEVER },
|
||||
{ "bufconfig", test_bufconfig, TEST_STD },
|
||||
};
|
||||
static int n_tests = sizeof(tests)/sizeof(tests[0]);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue