comedi_get_clock_source(). Bumped library version to 0.10.0.
}
return retval;
}
- void get_clock_source(unsigned *clock, unsigned *period_ns) const
+ void get_clock_source(unsigned channel, unsigned *clock, unsigned *period_ns) const
{
- int retval = comedi_get_clock_source(comedi_handle(), index(), clock, period_ns);
+ int retval = comedi_get_clock_source(comedi_handle(), index(), channel, clock, period_ns);
if(retval < 0)
{
std::ostringstream message;
throw std::runtime_error(message.str());
}
}
+ void get_gate_source(unsigned channel, unsigned gate_index, unsigned *gate_source)
+ {
+ int retval = comedi_get_gate_source(comedi_handle(), index(), channel, gate_index, gate_source);
+ if (retval < 0)
+ {
+ std::ostringstream message;
+ message << __PRETTY_FUNCTION__ << ": comedi_get_gate_source() failed.";
+ std::cerr << message.str() << std::endl;
+ comedi_perror("comedi_get_gate_source");
+ throw std::runtime_error(message.str());
+ }
+ }
unsigned get_routing(unsigned channel) const
{
unsigned routing = 0;
throw std::runtime_error(message.str());
}
}
- void set_clock_source(unsigned clock, unsigned period_ns)
+ void set_clock_source(unsigned channel, unsigned clock, unsigned period_ns)
{
- int retval = comedi_set_clock_source(comedi_handle(), index(), clock, period_ns);
+ int retval = comedi_set_clock_source(comedi_handle(), index(), channel, clock, period_ns);
if(retval < 0)
{
std::ostringstream message;
-AC_INIT([comedilib], [0.9.0])
+AC_INIT([comedilib], [0.10.0])
AC_CANONICAL_TARGET([])
AC_CONFIG_MACRO_DIR([m4])
# age to 0.
#
# AS_LIBTOOL arguments are (prefix, current, revision, age)
-AS_LIBTOOL(COMEDILIB, 9, 0, 9)
+AS_LIBTOOL(COMEDILIB, 10, 0, 10)
#libscxi c:r:a
SCXI_SO_VERSION=9:0:9
AC_SUBST(SCXI_SO_VERSION)
else
period_ns = 0;
clock_selection = options.value;
- printf("Selecting master clock %d on subdevice %d.\n", clock_selection, options.subdevice);
+ printf("Selecting master clock %d for channel %d on subdevice.\n", clock_selection, options.channel, options.subdevice);
if(period_ns)
{
printf("Clock period = %d nanoseconds.\n", period_ns);
printf("Clock period unspecified.\n");
}
- retval = comedi_set_clock_source(device, options.subdevice, clock_selection, period_ns);
+ retval = comedi_set_clock_source(device, options.subdevice, options.channel, clock_selection, period_ns);
if(retval < 0) comedi_perror("comedi_set_clock_source");
comedi_close(device);
if(retval < 0) return retval;
/* 20MHz clock */
- retval = comedi_set_clock_source(device, subdevice, NI_GPCT_TIMEBASE_1_CLOCK_SRC_BITS, clock_period_ns);
+ retval = comedi_set_clock_source(device, subdevice, 0, NI_GPCT_TIMEBASE_1_CLOCK_SRC_BITS, clock_period_ns);
if(retval < 0) return retval;
up_ticks = (up_time_ns + clock_period_ns / 2) / clock_period_ns;
Retval: int
Param: comedi_t * device
Param: unsigned int subdevice
+Param: unsigned int channel
Param: unsigned int *clock
Param: unsigned int *period_ns
Status: alpha
The frequency of the clock in nanoseconds (or zero if it is unknown)
will be written to
*<parameter>period_ns</parameter>.
+ If the subdevice does not support configuring its master clocks
+ on a per-channel basis, then the <parameter>channel</parameter>
+ parameter will be ignored.
It is safe to pass NULL pointers as the <parameter>clock</parameter> or
<parameter>period_ns</parameter>
Retval: int
Param: comedi_t * device
Param: unsigned int subdevice
+Param: unsigned int channel
Param: unsigned int clock
Param: unsigned int period_ns
Status: alpha
Description:
This function selects a master clock for a subdevice. The <parameter>clock</parameter>
- parameter selects the master clock, and is driver-dependant. The <parameter>period_ns</parameter>
+ parameter selects the master clock, and is driver-dependant.
+ If the subdevice does not support configuring its master clocks on a
+ per-channel basis, then the <parameter>channel</parameter> parameter
+ will be ignored.
+ The <parameter>period_ns</parameter>
parameter specifies the clock's period in nanoseconds. It may left unspecified by using
a value of zero. Drivers will ignore the clock period if they already
know what the clock period should be for the specified clock (i.e. for an
/* INSN_CONFIG wrappers */
int comedi_arm(comedi_t *device, unsigned subdevice, unsigned source);
int comedi_reset(comedi_t *device, unsigned subdevice);
-int comedi_get_clock_source(comedi_t *device, unsigned subdevice, unsigned *SWIG_OUTPUT(clock), unsigned *SWIG_OUTPUT(period_ns));
+int comedi_get_clock_source(comedi_t *device, unsigned subdevice, unsigned channel, unsigned *SWIG_OUTPUT(clock), unsigned *SWIG_OUTPUT(period_ns));
int comedi_get_gate_source(comedi_t *device, unsigned subdevice, unsigned channel,
unsigned gate, unsigned *SWIG_OUTPUT(source));
int comedi_get_routing(comedi_t *device, unsigned subdevice, unsigned channel, unsigned *SWIG_OUTPUT(routing));
int comedi_set_counter_mode(comedi_t *device, unsigned subdevice, unsigned channel, unsigned mode_bits);
-int comedi_set_clock_source(comedi_t *device, unsigned subdevice, unsigned clock, unsigned period_ns);
+int comedi_set_clock_source(comedi_t *device, unsigned subdevice, unsigned channel, unsigned clock, unsigned period_ns);
int comedi_set_filter(comedi_t *device, unsigned subdevice, unsigned channel, unsigned filter);
int comedi_set_gate_source(comedi_t *device, unsigned subdevice, unsigned channel, unsigned gate_index, unsigned gate_source);
int comedi_set_other_source(comedi_t *device, unsigned subdevice, unsigned channel,
else return -1;
}
-EXPORT_ALIAS_DEFAULT(_comedi_get_clock_source,comedi_get_clock_source,0.9.0);
-int _comedi_get_clock_source(comedi_t *device, unsigned subdevice, unsigned *clock, unsigned *period_ns)
+EXPORT_ALIAS_DEFAULT(_comedi_get_clock_source,comedi_get_clock_source,0.10.0);
+int _comedi_get_clock_source(comedi_t *device, unsigned subdevice, unsigned channel, unsigned *clock, unsigned *period_ns)
{
comedi_insn insn;
lsampl_t data[3];
memset(&insn, 0, sizeof(comedi_insn));
insn.insn = INSN_CONFIG;
insn.subdev = subdevice;
- insn.chanspec = 0;
+ insn.chanspec = channel;
insn.data = data;
insn.n = sizeof(data) / sizeof(data[0]);
memset(data, 0, insn.n * sizeof(data[0]));
return 0;
}
+EXPORT_ALIAS_VER(_comedi_get_clock_source_chan0,comedi_get_clock_source,0.9.0);
+int _comedi_get_clock_source_chan0(comedi_t *device, unsigned subdevice, unsigned *clock, unsigned *period_ns)
+{
+ return _comedi_get_clock_source(device, subdevice, 0, clock, period_ns);
+}
+
EXPORT_ALIAS_DEFAULT(_comedi_get_gate_source,comedi_get_gate_source,0.9.0);
int _comedi_get_gate_source(comedi_t *device, unsigned subdevice, unsigned channel,
unsigned gate, unsigned *source)
else return -1;
}
-EXPORT_ALIAS_DEFAULT(_comedi_set_clock_source,comedi_set_clock_source,0.9.0);
-int _comedi_set_clock_source(comedi_t *device, unsigned subdevice, unsigned clock, unsigned period_ns)
+EXPORT_ALIAS_DEFAULT(_comedi_set_clock_source,comedi_set_clock_source,0.10.0);
+int _comedi_set_clock_source(comedi_t *device, unsigned subdevice, unsigned channel, unsigned clock, unsigned period_ns)
{
comedi_insn insn;
lsampl_t data[3];
else return -1;
}
+EXPORT_ALIAS_VER(_comedi_set_clock_source_chan0,comedi_set_clock_source,0.9.0);
+int _comedi_set_clock_source_chan0(comedi_t *device, unsigned subdevice, unsigned clock, unsigned period_ns)
+{
+ return _comedi_set_clock_source(device, subdevice, 0, clock, period_ns);
+}
+
EXPORT_ALIAS_DEFAULT(_comedi_set_filter,comedi_set_filter,0.9.0);
int _comedi_set_filter(comedi_t *device, unsigned subdevice, unsigned channel, unsigned filter)
{
comedi_set_routing;
comedi_get_hardware_buffer_size;
} v0.8.0;
+
+v0.10.0 {
+ global:
+ comedi_get_clock_source;
+ comedi_set_clock_source;
+} v0.9.0;