Extensions
Function: comedi_arm -- arm a subdevice
Retval: int
Param: comedi_t * device
Param: unsigned int subdevice
Param: unsigned int source
Status: alpha
Description:
This function arms a subdevice. It may, for example, arm a counter to
begin counting. The source
parameter specifies what source should trigger the subdevice to begin.
The possible sources are driver-dependant. This function is only
useable on subdevices that provide support for the
INSN_CONFIG_ARM configuration instruction.
Some subdevices treat this as an instruction to arm a specific channel.
For those subdevices, this function will arm channel
0 and comedi_arm_channel
should be called instead of this one to specify the channel.
Returns:
0 on success, -1 on error.
Function: comedi_arm_channel -- arm a subdevice channel
Retval: int
Param: comedi_t * device
Param: unsigned int subdevice
Param: unsigned int channel
Param: unsigned int source
Status: alpha
Description:
This function arms a specified channel of a subdevice. It may, for
example, arm a counter to begin counting. The source parameter specifies what source
should trigger the subdevice to begin. The possible sources are
driver-dependant. This function is only useable on subdevices that
provide support for the INSN_CONFIG_ARM
configuration instruction. Some subdevices treat this as an
instruction to arm the whole subdevice and ignore the specified
channel. For such subdevices, comedi_arm is normally
called instead.
Returns:
0 on success, -1 on error.
Function: comedi_connect_route -- connect device-global route
Retval: int
Param: comedi_t * device
Param: unsigned int source
Param: unsigned int destination
Status: alpha
Description:
This function connects a globally-named route if such is connectible.
This operation is effectively the same as calling comedi_set_routing and
comedi_dio_config on the
appropriate subdevice.
There are several routes that are not globally connectable via comedi_connect_route,
such as (NI_PFI(i) -->
NI_AO_SampleClock) as they must be connected via a trigger
argument, such as comedi_cmd->start_arg for
NI_AO_StartTrigger.
The source parameter specifies the
source of the signal route, whereas the destination parameter specifies the destination.
Possible values for source and destination are driver dependent but are
generally required to be values that are recognizable globally for a particular
device, independent of sub-device.
Returns:
0 on success, -1 on error (and errno is
set appropriately--EALREADY: route is already connected; EINVAL: route invalid
for this device; EBUSY: destination selector used for another route).
Function: comedi_digital_trigger_disable -- disable a digital trigger
Retval: int
Param: comedi_t * device
Param: unsigned int subdevice
Param: unsigned int trigger_id
Status: alpha
Description:
This function disables a digital trigger on a subdevice, returning it
to its default, inactive, unconfigured state. If the subdevice
supports several digital triggers, the trigger_id selects one.
This function is only useable on subdevices that provide support for
the INSN_CONFIG_DIGITAL_TRIG configuration
instruction.
Returns:
0 on success, -1 on error.
Function: comedi_digital_trigger_enable_edges -- set digital trigger edge detection
Retval: int
Param: comedi_t * device
Param: unsigned int subdevice
Param: unsigned int trigger_id
Param: unsigned int base_input
Param: unsigned int rising_edge_inputs
Param: unsigned int falling_edge_inputs
Status: alpha
Description:
This function enables edge detection for a digital trigger on a
subdevice. If the subdevice supports several digital triggers, the
trigger_id selects one. The rising_edge_inputs and falling_edge_inputs parameters are
bit fields that enable (1) or disable (0) rising and falling edge
detection on a set of (up to) 32 inputs. The least-significant bit
corresponds to the input specified by the base_input parameter, with
subsequent bits corresponding to subsequent inputs.
Successive calls to this function have an cumulative effect, which
allows digital triggers to be set up for more than 32 inputs. There
may also be a cumulative effect with calls to comedi_digital_trigger_enable_levels
if the digital trigger supports a combination of edge and level
triggering. Due to the cumulative effect, it may be necessary to call
comedi_digital_trigger_disable
to clear the old settings before reconfiguring the digital trigger
inputs.
A digital trigger may support edge detection, level detection, both at
different times, or both at the same time. If it supports both but not
at the same time, configuring edge triggers will disable any previous
level triggers, or vice versa.
This function is only useable on subdevices that provide support for
the INSN_CONFIG_DIGITAL_TRIG configuration
instruction, and only if the digital trigger supports edge detection.
Returns:
0 on success, -1 on error.
Function: comedi_digital_trigger_enable_levels -- set digital trigger level detection
Retval: int
Param: comedi_t * device
Param: unsigned int subdevice
Param: unsigned int trigger_id
Param: unsigned int base_input
Param: unsigned int high_level_inputs
Param: unsigned int low_level_inputs
Status: alpha
Description:
This function enables level detection for a digital trigger on a
subdevice. If the subdevice supports several digital triggers, the
trigger_id selects one. The high_level_inputs and low_level_inputs parameters are
bit fields that enable (1) or disable (0) high and low level
detection on a set of (up to) 32 inputs. The least-significant bit
corresponds to the input specified by the base_input parameter, with
subsequent bits corresponding to subsequent inputs.
Successive calls to this function have an cumulative effect, which
allows digital triggers to be set up for more than 32 inputs. There
may also be a cumulative effect with calls to comedi_digital_trigger_enable_edges
if the digital trigger supports a combination of edge and level
triggering. Due to the cumulative effect, it may be necessary to call
comedi_digital_trigger_disable
to clear the old settings before reconfiguring the digital trigger
inputs.
A digital trigger may support edge detection, level detection, both at
different times, or both at the same time. If it supports both but not
at the same time, configuring level triggers will disable any previous
edge triggers, or vice versa.
This function is only useable on subdevices that provide support for
the INSN_CONFIG_DIGITAL_TRIG configuration
instruction, and only if the digital trigger supports level detection.
Returns:
0 on success, -1 on error.
Function: comedi_disarm -- disarm a subdevice
Retval: int
Param: comedi_t * device
Param: unsigned int subdevice
Status: alpha
Description:
This function disarms a subdevice. It may, for example, stop a counter
counting. This function is only useable on subdevices that provide
support for the INSN_CONFIG_DISARM configuration
instruction. Some subdevices treat this as an instruction to disarm a
specific channel. For those subdevices, this function will disarm
channel 0 and comedi_disarm_channel
should be called instead of this one to specify the channel.
Returns:
0 on success, -1 on error.
Function: comedi_disarm_channel -- disarm a subdevice channel
Retval: int
Param: comedi_t * device
Param: unsigned int subdevice
Param: unsigned int channel
Status: alpha
Description:
This function disarms a specified channel of a subdevice. It may, for
example, stop a counter counting. This function is only useable on
subdevices that provide support for the
INSN_CONFIG_DISARM configuration instruction.
Some subdevices treat this as an instruction to disarm the whole
subdevice and ignore the specified channel. For such subdevices,
comedi_disarm is
normally called instead.
Returns:
0 on success, -1 on error.
Function: comedi_disconnect_route -- disconnect device-global route
Retval: int
Param: comedi_t * device
Param: unsigned int source
Param: unsigned int destination
Status: alpha
Description:
This function disconnects a globally-named route if such is connected.
This operation is effectively the same as calling comedi_set_routing and
comedi_dio_config on the
appropriate subdevice.
There are several routes that are not globally dis-connectable via
comedi_connect_route,
such as (NI_PFI(i) -->
NI_AO_SampleClock) as they must be connected via a trigger
argument, such as comedi_cmd->start_arg for
NI_AO_StartTrigger.
The source parameter specifies the
source of the signal route, whereas the destination parameter specifies the destination.
Possible values for source and destination are driver dependent but are
generally required to be values that are recognizable globally for a particular
device, independent of sub-device.
Returns:
0 on success, -1 on error.
Function: comedi_get_clock_source -- get master clock for a subdevice
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 queries the master clock for a subdevice, as
set by
comedi_set_clock_source.
The currently configured master clock
will be written to
*clock.
The possible values and their corresponding clocks are
driver-dependant.
The period of the clock in nanoseconds (or zero if it is unknown)
will be written to
*period_ns.
If the subdevice does not support configuring its master clocks
on a per-channel basis, then the channel
parameter will be ignored.
It is safe to pass NULL pointers as the
clock or
period_ns
parameters. This function is only useable
on subdevices that provide support for the
INSN_CONFIG_GET_CLOCK_SRC
configuration instruction.
Returns:
0 on success, -1 on error.
Function: comedi_get_cmd_timing_constraints -- Get the hardware timing constraints for a streaming subdevice
Retval: int
Param: comedi_t * device
Param: unsigned int subdevice
Param: unsigned int scan_begin_src
Param: unsigned int * scan_begin_min
Param: unsigned int convert_src
Param: unsigned int * convert_min
Param: unsigned int * chanlist
Param: unsigned int chanlist_len
Status: alpha
Description:
This function queries the hardware timing constraints of a streaming subdevice.
The values returned by this function may indicate the range of valid inputs
for
comedi_cmd->scan_begin_arg and
comedi_cmd->convert_arg, for instance when
comedi_cmd->scan_begin_src==TRIG_TIMER or
comedi_cmd->convert_src==TRIG_TIMER. For
TRIG_EXT (or other modes?), these returned values are
mostly informational and may be used in conjunction with other triggering
hardware.
If it is possible for the hardware constraints to depend on whether
[*]_src==TRIG_TIMER or
[*]_src==TRIG_EXT, the values returned by this
function will depend on these inputs. Alternatively, one can specify something
like [*]_src==TRIG_TIMER|TRIG_EXT and retrieve the
value that is the smallest that satisfies both trigger sources.
scan_begin_min may be given as
NULL, such that nothing will be returned for minimum
scan speed.
convert_min may be given as
NULL, such that nothing will be returned for minimum
scan speed.
Returns:
0 on success, -1 on error.
Function: comedi_get_gate_source -- get gate for a subdevice
Retval: int
Param: comedi_t * device
Param: unsigned int subdevice
Param: unsigned int channel
Param: unsigned int gate_index
Param: unsigned int * gate_source
Status: alpha
Description:
This function queries the gate for a subdevice, as set by
comedi_set_gate_source.
The currently configured gate source
will be written to
*gate_source.
The possible values and their corresponding gates are
driver-dependant. If the subdevice does not
support configuring its gates on a per-channel basis, then the
channel parameter will be ignored.
This function is only useable
on subdevices that provide support for the
INSN_CONFIG_GET_GATE_SRC
configuration instruction.
Returns:
0 on success, -1 on error.
Function: comedi_get_hardware_buffer_size -- get size of subdevice's hardware buffer
Retval: int
Param: comedi_t *device
Param: unsigned int subdevice
Param: enum comedi_io_direction direction
Description:
This function returns the number of bytes the subdevice can hold in it's hardware buffer.
The term hardware buffer refers to any FIFOs, etc. on the acquisition board itself which
are used during streaming commands. This does not include the buffer maintained by
the comedi kernel module in host memory, whose size may be queried by
comedi_get_buffer_size.
The direction parameter of type
enum
comedi_io_direction
should be set to COMEDI_INPUT to query the input buffer size (e.g., the buffer of an analog
input subdevice), or COMEDI_OUTPUT to query the output buffer size (e.g., the buffer of
an analog output).
Returns:
Hardware buffer size in bytes, or -1 on error.
Function: comedi_get_routes -- obtain list of all possible device-globally named routes
Retval: int
Param: comedi_t * device
Param: comedi_route_pair * routelist
Param: size_t n
Status: alpha
Description:
This function obtains a list of all possible globally-named routes for the
particular device.
A globally-named route is a route where the source and destination values are
globally recognized, regardless of the subdevice.
This function returns all possible signal routes that are either connectible
via comedi_cmd->start_arg aruments or via the
device-global configuration interface of comedi_connect_route
and comedi_disconnect_route.
The routelist parameter provides memory
into which the results may be copied. The comedi_route_pair is
(as specified in comedi.h):
typedef struct {
unsigned int source;
unsigned int destination;
} comedi_route_pair;
routelist may be specified as
NULL, in which case only the number of routes will be
returned.
The n parameter provides specifies the
number of slots available in the routelist array.
Returns:
The number of routes available if routelist is NULL, the number
of routes copied if routelist is not
NULL, or -1 on error.
Function: comedi_get_routing -- get routing for an output
Retval: int
Param: comedi_t * device
Param: unsigned int subdevice
Param: unsigned int channel
Param: unsigned int * routing
Status: alpha
Description:
This function queries the routing for an output, as
set by
comedi_set_routing.
The currently configured routing
will be written to
*routing.
The possible values and their corresponding routings are
driver-dependant.
This function is only useable
on subdevices that provide support for the
INSN_CONFIG_GET_ROUTING
configuration instruction.
Returns:
0 on success, -1 on error.
Function: comedi_reset -- reset a subdevice
Retval: int
Param: comedi_t * device
Param: unsigned int subdevice
Status: alpha
Description:
This function resets a subdevice. It is only useable on subdevices
that provide support for the INSN_CONFIG_RESET
configuration instruction. Some subdevices treat this as an
instruction to reset a specific channel. For those subdevices, this
function will reset channel 0 and comedi_reset_channel
should be called instead of this one to specify the channel.
Returns:
0 on success, -1 on error.
Function: comedi_reset_channel -- reset a subdevice channel
Retval: int
Param: comedi_t * device
Param: unsigned int subdevice
Param: unsigned int channel
Status: alpha
Description:
This function resets a specified channel of a subdevice. It is only
useable on subdevices that provide support for the
INSN_CONFIG_RESET configuration instruction. Some
subdevices treat this as an instruction to reset the whole subdevice
and ignore the specified channel. For such subdevices, comedi_reset is
normally called instead.
Returns:
0 on success, -1 on error.
Function: comedi_set_clock_source -- set master clock for a subdevice
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 clock
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 channel parameter
will be ignored.
The period_ns
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 (e.g. for an
on-board 20MHz oscillator). Certain boards which use a phase-locked loop to
synchronize to external clock sources must be told the period of the external
clock. Specifying a clock period for an external clock may also allow
the driver to support TRIG_TIMER sources in commands while
using the external clock.
The clock may be queried with the
comedi_get_clock_source
function.
This function is only useable
on subdevices that provide support for the
INSN_CONFIG_SET_CLOCK_SRC configuration instruction.
Returns:
0 on success, -1 on error.
Function: comedi_set_counter_mode -- change mode of a counter subdevice
Retval: int
Param: comedi_t * device
Param: unsigned int subdevice
Param: unsigned int channel
Param: unsigned int mode
Status: alpha
Description:
This function configures a counter subdevice. The meaning of the
mode parameter is driver-dependent.
If the subdevice does not
support configuring its mode on a per-channel basis, then the
channel
parameter will be ignored.
It is only useable
on subdevices that provide support for the
INSN_CONFIG_SET_COUNTER_MODE configuration instruction.
Returns:
0 on success, -1 on error.
Function: comedi_set_filter -- select a filter for a subdevice
Retval: int
Param: comedi_t * device
Param: unsigned int subdevice
Param: unsigned int channel
Param: unsigned int filter
Status: alpha
Description:
This function selects a filter for a subdevice. For instance, a digital
input subdevice may provide deglitching filters with varying cutoff frequencies.
The filters are used to prevent high-frequency
noise from causing unwanted transitions on the digital inputs. This function can
tell the hardware which deglitching filter to use, or to use none at all.
The filter
parameter selects which of the subdevice's filters to use, and is driver-dependant.
This function is only useable
on subdevices that provide support for the
INSN_CONFIG_FILTER configuration instruction.
Returns:
0 on success, -1 on error.
Function: comedi_set_gate_source -- select gate source for a subdevice
Retval: int
Param: comedi_t * device
Param: unsigned int subdevice
Param: unsigned int channel
Param: unsigned int gate_index
Param: unsigned int gate_source
Status: alpha
Description:
This function selects a gate source for a subdevice. The
gate_index
parameter selects which gate is being configured, should the subdevice have
multiple gates. It takes a value
from 0 to N-1 for a subdevice with N different gates.
The gate_source parameter selects which signal you wish to
use as
the gate, and is also driver-dependent. If the subdevice does not
support configuring its gates on a per-channel basis, then the
channel parameter will be ignored.
You may query the gate source with the
comedi_get_gate_source
function.
This function is only useable
on subdevices that provide support for the
INSN_CONFIG_SET_GATE_SRC
configuration instruction.
Returns:
0 on success, -1 on error.
Function: comedi_set_other_source -- select source signal for something other than a gate or clock
Retval: int
Param: comedi_t * device
Param: unsigned int subdevice
Param: unsigned int channel
Param: unsigned int other
Param: unsigned int source
Status: alpha
Description:
This function allows selection of a source signal for something on a subdevice
other than a gate (which uses
comedi_set_gate_source)
or a clock (which uses
comedi_set_clock_source).
The other parameter selects
which other we are configuring, and is driver-dependent. The
source parameter selects the source
we which to use for the other. If the subdevice does not
support configuring its other sources on a per-channel basis,
then the channel
parameter will be ignored.
As an example, this function is used to select which PFI digital input channels
should be used as the A/B/Z signals when running a counter on an NI M-Series board as
a quadrature encoder. The other parameter selects either the A, B,
or Z signal, and the source parameter is used to specify
which PFI digital input channel the external A, B, or Z signal is
physically connected to.
This function is only useable
on subdevices that provide support for the
INSN_CONFIG_SET_OTHER_SRC
configuration instruction.
Returns:
0 on success, -1 on error.
Function: comedi_set_routing -- select a routing for an output
Retval: int
Param: comedi_t * device
Param: unsigned int subdevice
Param: unsigned int channel
Param: unsigned int routing
Status: alpha
Description:
This function configures a mutiplexed output channel which can
output a variety of different signals (such as NI's RTSI and PFI lines).
The routing
parameter selects which signal should be routed to appear on the
selected output channel, and is driver-dependant.
The routing may be queried with the
comedi_get_routing
function.
This function is only useable
on subdevices that provide support for the
INSN_CONFIG_SET_ROUTING
configuration instruction.
Returns:
0 on success, -1 on error.
Function: comedi_test_route -- validate and test device-global route
Retval: int
Param: comedi_t * device
Param: unsigned int source
Param: unsigned int destination
Status: alpha
Description:
This function validates a globally-named route as connectible and tests whether
the route is connected.
Note that since comedi_connect_route
and comedi_disconnect_route
effectively perform the same operations as comedi_set_routing /
comedi_get_routing and
comedi_dio_config, this
operation will only report a route as connected _if_ both operations have been
performed directly or effectively via comedi_connect_route.
There are several routes that are not globally connectable via comedi_connect_route,
such as (NI_PFI(i) -->
NI_AO_SampleClock) as they must be connected via a trigger
argument, such as comedi_cmd->start_arg for
NI_AO_StartTrigger. This function can still be used for
such routes to test whether they are valid.
The source parameter specifies the
source of the signal route, whereas the destination parameter specifies the destination.
Possible values for source and destination are driver dependent but are
generally required to be values that are recognizable globally for a particular
device, independent of sub-device.
Returns:
-1 if not connectible, 0 if connectible
but not connected, 1 if connectible and
connected.