From d0956ca8b5e829e0fb7d379b18a2ba400a3bb913 Mon Sep 17 00:00:00 2001 From: Frank Mori Hess Date: Fri, 28 Mar 2008 15:56:35 +0000 Subject: [PATCH] Added comedi_get_hardware_buffer_size() wrapper function, and made comedi_strerror return a const char*. --- include/comedilib.h | 3 ++- lib/error.c | 2 +- lib/insn_config_wrappers.c | 19 +++++++++++++++++++ lib/version_script | 1 + 4 files changed, 23 insertions(+), 2 deletions(-) diff --git a/include/comedilib.h b/include/comedilib.h index db2eb95..3e24428 100644 --- a/include/comedilib.h +++ b/include/comedilib.h @@ -71,7 +71,7 @@ int comedi_close(comedi_t *it); /* logging */ int comedi_loglevel(int loglevel); void comedi_perror(const char *s); -char *comedi_strerror(int errnum); +const char *comedi_strerror(int errnum); int comedi_errno(void); int comedi_fileno(comedi_t *it); @@ -286,6 +286,7 @@ int comedi_set_gate_source(comedi_t *device, unsigned subdevice, unsigned channe int comedi_set_other_source(comedi_t *device, unsigned subdevice, unsigned channel, unsigned other, unsigned source); int comedi_set_routing(comedi_t *device, unsigned subdevice, unsigned channel, unsigned routing); +int comedi_get_hardware_buffer_size(comedi_t *device, unsigned subdevice, enum comedi_io_direction direction); #endif diff --git a/lib/error.c b/lib/error.c index 2f55e1f..d88c78c 100644 --- a/lib/error.c +++ b/lib/error.c @@ -59,7 +59,7 @@ int _comedi_errno(void) } EXPORT_ALIAS_DEFAULT(_comedi_strerror,comedi_strerror,0.7.18); -char* _comedi_strerror(int errnum) +const char* _comedi_strerror(int errnum) { if(errnum=COMEDI_NOERROR+n_errors) return strerror(errnum); diff --git a/lib/insn_config_wrappers.c b/lib/insn_config_wrappers.c index 3d86afd..8361425 100644 --- a/lib/insn_config_wrappers.c +++ b/lib/insn_config_wrappers.c @@ -276,3 +276,22 @@ int _comedi_set_routing(comedi_t *device, unsigned subdevice, unsigned channel, if(comedi_do_insn(device, &insn) >= 0) return 0; else return -1; } + +EXPORT_ALIAS_DEFAULT(_comedi_get_hardware_buffer_size,comedi_get_hardware_buffer_size,0.9.0); +int _comedi_get_hardware_buffer_size(comedi_t *device, unsigned subdevice, enum comedi_io_direction direction) +{ + comedi_insn insn; + lsampl_t data[3]; + + memset(&insn, 0, sizeof(comedi_insn)); + insn.insn = INSN_CONFIG; + insn.subdev = subdevice; + insn.data = data; + insn.n = sizeof(data) / sizeof(data[0]); + memset(insn.data, 0, insn.n * sizeof(insn.data[0])); + data[0] = INSN_CONFIG_GET_HARDWARE_BUFFER_SIZE; + data[1] = direction; + + if(comedi_do_insn(device, &insn) >= 0) return data[2]; + else return -1; +} diff --git a/lib/version_script b/lib/version_script index 2b608ab..6721f23 100644 --- a/lib/version_script +++ b/lib/version_script @@ -108,4 +108,5 @@ v0.9.0 { comedi_internal_trigger; comedi_set_other_source; comedi_set_routing; + comedi_get_hardware_buffer_size; } v0.8.0; -- 2.26.2