From fc62ecb25e236a898790860f1faf75b70b97fbc2 Mon Sep 17 00:00:00 2001 From: Frank Mori Hess Date: Fri, 6 Apr 2001 23:12:42 +0000 Subject: [PATCH] added buffer info ioctl support and some alpha buffer related functions --- include/comedi.h | 14 ++++++++++++++ include/comedilib.h | 6 +++++- lib/Makefile | 2 +- lib/ioctl.c | 8 ++++++++ lib/libinternal.h | 2 ++ 5 files changed, 30 insertions(+), 2 deletions(-) diff --git a/include/comedi.h b/include/comedi.h index a4e1915..81f51bf 100644 --- a/include/comedi.h +++ b/include/comedi.h @@ -171,6 +171,7 @@ typedef unsigned short sampl_t; #define COMEDI_INSNLIST _IOR(CIO,11,comedi_insnlist) #define COMEDI_INSN _IOR(CIO,12,comedi_insn) #define COMEDI_BUFCONFIG _IOR(CIO,13,comedi_bufconfig) +#define COMEDI_BUFINFO _IOWR(CIO,14,comedi_bufinfo) /* structures */ @@ -186,6 +187,7 @@ typedef struct comedi_devconfig_struct comedi_devconfig; typedef struct comedi_rangeinfo_struct comedi_rangeinfo; typedef struct comedi_krange_struct comedi_krange; typedef struct comedi_bufconfig_struct comedi_bufconfig; +typedef struct comedi_bufinfo_struct comedi_bufinfo; struct comedi_trig_struct{ unsigned int subdev; /* subdevice */ @@ -298,6 +300,18 @@ struct comedi_bufconfig_struct{ unsigned int unused[4]; }; +struct comedi_bufinfo_struct{ + unsigned int subdevice; + unsigned int bytes_read; + + unsigned int buf_int_ptr; + unsigned int buf_user_ptr; + unsigned int buf_int_count; + unsigned int buf_user_count; + + unsigned int unused[5]; +}; + /* range stuff */ #define __RANGE(a,b) ((((a)&0xffff)<<16)|((b)&0xffff)) diff --git a/include/comedilib.h b/include/comedilib.h index 26a3a06..2e93a66 100644 --- a/include/comedilib.h +++ b/include/comedilib.h @@ -150,7 +150,11 @@ enum comedi_oor_behavior { enum comedi_oor_behavior comedi_set_global_oor_behavior(enum comedi_oor_behavior behavior); - +int comedi_buf_resize(comedi_t *it, unsigned int subdev, unsigned int size); +int comedi_buf_resize_max(comedi_t *it, unsigned int subdev, unsigned int max_size); +int comedi_buf_size(comedi_t *it, unsigned int subdev); +int comedi_buf_contents(comedi_t *it, unsigned int subdev); +int comedi_buf_mark_read(comedi_t *it, unsigned int subdev, unsigned int bytes); #ifdef __cplusplus diff --git a/lib/Makefile b/lib/Makefile index 83a2406..ec52d5a 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -2,7 +2,7 @@ CFLAGS = -fPIC -Wall -Wstrict-prototypes -O2 -I../include -I. OBJS=comedi.o timer.o sv.o range.o ioctl.o filler.o timed.o error.o \ - dio.o data.o get.o + dio.o data.o get.o buffer.o libcomedi.a: $(OBJS) #gcc -shared -Wl,-soname,libcomedi.so,-T,version_script -o libcomedi.so.${VERSION_CODE} $(OBJS) -lm diff --git a/lib/ioctl.c b/lib/ioctl.c index 3bc58ee..7b5b91d 100644 --- a/lib/ioctl.c +++ b/lib/ioctl.c @@ -75,4 +75,12 @@ int ioctl_rangeinfo(int fd,int range_type,comedi_krange *range_ptr) return ioctl(fd,COMEDI_RANGEINFO,&it); } +int ioctl_bufconfig(int fd, comedi_bufconfig *bc) +{ + return ioctl(fd, COMEDI_BUFCONFIG, bc); +} +int ioctl_bufinfo(int fd, comedi_bufinfo *bi) +{ + return ioctl(fd, COMEDI_BUFINFO, bi); +} diff --git a/lib/libinternal.h b/lib/libinternal.h index 7aac704..2e4dd5f 100644 --- a/lib/libinternal.h +++ b/lib/libinternal.h @@ -100,6 +100,8 @@ int ioctl_chaninfo(int fd,unsigned int subdev,lsampl_t *maxdata_list, unsigned int *flaglist,unsigned int *rangelist); int ioctl_trigger(int fd,comedi_trig *it); int ioctl_rangeinfo(int fd,int range_type,comedi_krange *range_ptr); +int ioctl_bufconfig(int fd, comedi_bufconfig *bc); +int ioctl_bufinfo(int fd, comedi_bufinfo *bi); /* filler routines */ -- 2.26.2