From c6093128a1b690db7a945443222e9de6af76a873 Mon Sep 17 00:00:00 2001 From: David Schleef Date: Thu, 1 Mar 2001 21:59:01 +0000 Subject: [PATCH] added bufconfig test --- testing/Makefile | 2 +- testing/bufconfig.c | 75 +++++++++++++++++++++++++++++++++++++++++++++ testing/main.c | 2 ++ 3 files changed, 78 insertions(+), 1 deletion(-) create mode 100644 testing/bufconfig.c diff --git a/testing/Makefile b/testing/Makefile index bcd2d75..547b14e 100644 --- a/testing/Makefile +++ b/testing/Makefile @@ -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) diff --git a/testing/bufconfig.c b/testing/bufconfig.c new file mode 100644 index 0000000..853c3ba --- /dev/null +++ b/testing/bufconfig.c @@ -0,0 +1,75 @@ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#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; +} + diff --git a/testing/main.c b/testing/main.c index c095fe9..68d27ad 100644 --- a/testing/main.c +++ b/testing/main.c @@ -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]); -- 2.26.2