comedilib/doc/extensions_funcref.txt
Ian Abbott 27509ba9c9 Add digital trigger configuration functions
Add wrapper functions for the INSN_CONFIG_DIGITAL_TRIG configuration
instruction.  These are comedi_digital_trigger_disable(),
comedi_digital_trigger_enable_edges(), and
comedi_digital_trigger_enable_levels().
2016-03-21 11:28:29 +00:00

498 lines
21 KiB
Text

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 <parameter class="function">source</parameter>
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
<constant>INSN_CONFIG_ARM</constant> configuration instruction.
Some subdevices treat this as an instruction to arm a specific channel.
For those subdevices, this function will arm channel
<literal>0</literal> and <function><link
linkend="func-ref-comedi-arm-channel">comedi_arm_channel</link></function>
should be called instead of this one to specify the channel.
Returns:
<literal>0</literal> on success, <literal>-1</literal> 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 <parameter
class="function">source</parameter> 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 <constant>INSN_CONFIG_ARM</constant>
configuration instruction. Some subdevices treat this as an
instruction to arm the whole subdevice and ignore the specified
channel. For such subdevices, <function><link
linkend="func-ref-comedi-arm">comedi_arm</link></function> is normally
called instead.
Returns:
<literal>0</literal> on success, <literal>-1</literal> on error.
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 <code language="C"><parameter
class="function">trigger_id</parameter></code> selects one.
This function is only useable on subdevices that provide support for
the <constant>INSN_CONFIG_DIGITAL_TRIG</constant> configuration
instruction.
Returns:
<literal>0</literal> on success, <literal>-1</literal> 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
<code language="C"><parameter
class="function">trigger_id</parameter></code> selects one. The <code
language="C"><parameter
class="function">rising_edge_inputs</parameter></code> and <code
language="C"><parameter
class="function">falling_edge_inputs</parameter></code> 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 <code
language="C"><parameter>base_input</parameter></code> 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 <function><link
linkend="func-ref-comedi-digital-trigger-enable-levels">comedi_digital_trigger_enable_levels</link></function>
if the digital trigger supports a combination of edge and level
triggering. Due to the cumulative effect, it may be necessary to call
<function><link
linkend="func-ref-comedi-digital-trigger-disable">comedi_digital_trigger_disable</link></function>
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 <constant>INSN_CONFIG_DIGITAL_TRIG</constant> configuration
instruction, and only if the digital trigger supports edge detection.
Returns:
<literal>0</literal> on success, <literal>-1</literal> 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
<code language="C"><parameter
class="function">trigger_id</parameter></code> selects one. The <code
language="C"><parameter
class="function">high_level_inputs</parameter></code> and <code
language="C"><parameter
class="function">low_level_inputs</parameter></code> 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 <code
language="C"><parameter>base_input</parameter></code> 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 <function><link
linkend="func-ref-comedi-digital-trigger-enable-edges">comedi_digital_trigger_enable_edges</link></function>
if the digital trigger supports a combination of edge and level
triggering. Due to the cumulative effect, it may be necessary to call
<function><link
linkend="func-ref-comedi-digital-trigger-disable">comedi_digital_trigger_disable</link></function>
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 <constant>INSN_CONFIG_DIGITAL_TRIG</constant> configuration
instruction, and only if the digital trigger supports level detection.
Returns:
<literal>0</literal> on success, <literal>-1</literal> 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 <constant>INSN_CONFIG_DISARM</constant> configuration
instruction. Some subdevices treat this as an instruction to disarm a
specific channel. For those subdevices, this function will disarm
channel <literal>0</literal> and <function><link
linkend="func-ref-comedi-disarm-channel">comedi_disarm_channel</link></function>
should be called instead of this one to specify the channel.
Returns:
<literal>0</literal> on success, <literal>-1</literal> 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
<constant>INSN_CONFIG_DISARM</constant> configuration instruction.
Some subdevices treat this as an instruction to disarm the whole
subdevice and ignore the specified channel. For such subdevices,
<function><link
linkend="func-ref-comedi-disarm">comedi_disarm</link></function> is
normally called instead.
Returns:
<literal>0</literal> on success, <literal>-1</literal> 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
<function><link linkend="func-ref-comedi-set-clock-source">comedi_set_clock_source</link></function>.
The currently configured master clock
will be written to
<code language="C">*<parameter class="function">clock</parameter></code>.
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
<code language="C">*<parameter class="function">period_ns</parameter></code>.
If the subdevice does not support configuring its master clocks
on a per-channel basis, then the <parameter class="function">channel</parameter>
parameter will be ignored.
It is safe to pass <constant>NULL</constant> pointers as the
<parameter class="function">clock</parameter> or
<parameter class="function">period_ns</parameter>
parameters. This function is only useable
on subdevices that provide support for the
<constant>INSN_CONFIG_GET_CLOCK_SRC</constant>
configuration instruction.
Returns:
<literal>0</literal> on success, <literal>-1</literal> 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
<function><link linkend="func-ref-comedi-set-gate-source">comedi_set_gate_source</link></function>.
The currently configured gate source
will be written to
<code language="C">*<parameter class="function">gate_source</parameter></code>.
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
<parameter class="function">channel</parameter> parameter will be ignored.
This function is only useable
on subdevices that provide support for the
<constant>INSN_CONFIG_GET_GATE_SRC</constant>
configuration instruction.
Returns:
<literal>0</literal> on success, <literal>-1</literal> 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: <link linkend="ref-enum-comedi-io-direction">enum comedi_io_direction</link> direction
Description:
This function returns the number of bytes the subdevice can hold in it's hardware buffer.
The term <quote>hardware buffer</quote> 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
<function><link
linkend="func-ref-comedi-get-buffer-size">comedi_get_buffer_size</link></function>.
The <parameter class="function">direction</parameter> parameter of type
<type><link linkend="ref-enum-comedi-io-direction">enum
comedi_io_direction</link></type>
should be set to <constant>COMEDI_INPUT</constant> to query the input buffer size (e.g., the buffer of an analog
input subdevice), or <constant>COMEDI_OUTPUT</constant> to query the output buffer size (e.g., the buffer of
an analog output).
Returns:
Hardware buffer size in bytes, or <literal>-1</literal> 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
<function><link linkend="func-ref-comedi-set-routing">comedi_set_routing</link></function>.
The currently configured routing
will be written to
<code language="C">*<parameter class="function">routing</parameter></code>.
The possible values and their corresponding routings are
driver-dependant.
This function is only useable
on subdevices that provide support for the
<constant>INSN_CONFIG_GET_ROUTING</constant>
configuration instruction.
Returns:
<literal>0</literal> on success, <literal>-1</literal> 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 <constant>INSN_CONFIG_RESET</constant>
configuration instruction. Some subdevices treat this as an
instruction to reset a specific channel. For those subdevices, this
function will reset channel <literal>0</literal> and <function><link
linkend="func-ref-comedi-reset-channel">comedi_reset_channel</link></function>
should be called instead of this one to specify the channel.
Returns:
<literal>0</literal> on success, <literal>-1</literal> 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
<constant>INSN_CONFIG_RESET</constant> configuration instruction. Some
subdevices treat this as an instruction to reset the whole subdevice
and ignore the specified channel. For such subdevices, <function><link
linkend="func-ref-comedi-reset">comedi_reset</link></function> is
normally called instead.
Returns:
<literal>0</literal> on success, <literal>-1</literal> 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 <parameter
class="function">clock</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 class="function">channel</parameter> parameter
will be ignored.
The <parameter class="function">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 (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 <constant>TRIG_TIMER</constant> sources in commands while
using the external clock.
The clock may be queried with the
<function><link linkend="func-ref-comedi-get-clock-source">comedi_get_clock_source</link></function>
function.
This function is only useable
on subdevices that provide support for the
<constant>INSN_CONFIG_SET_CLOCK_SRC</constant> configuration instruction.
Returns:
<literal>0</literal> on success, <literal>-1</literal> 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
<parameter class="function">mode</parameter> parameter is driver-dependent.
If the subdevice does not
support configuring its mode on a per-channel basis, then the
<parameter class="function">channel</parameter>
parameter will be ignored.
It is only useable
on subdevices that provide support for the
<constant>INSN_CONFIG_SET_COUNTER_MODE</constant> configuration instruction.
Returns:
<literal>0</literal> on success, <literal>-1</literal> 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 <parameter class="function">filter</parameter>
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
<constant>INSN_CONFIG_FILTER</constant> configuration instruction.
Returns:
<literal>0</literal> on success, <literal>-1</literal> 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
<parameter class="function">gate_index</parameter>
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 <parameter class="function">gate_source</parameter> 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
<parameter class="function">channel</parameter> parameter will be ignored.
You may query the gate source with the
<function><link linkend="func-ref-comedi-get-gate-source">comedi_get_gate_source</link></function>
function.
This function is only useable
on subdevices that provide support for the
<constant>INSN_CONFIG_SET_GATE_SRC</constant>
configuration instruction.
Returns:
<literal>0</literal> on success, <literal>-1</literal> 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
<function><link
linkend="func-ref-comedi-set-gate-source">comedi_set_gate_source</link></function>)
or a clock (which uses
<function><link
linkend="func-ref-comedi-set-clock-source">comedi_set_clock_source</link></function>).
The <parameter class="function">other</parameter> parameter selects
which <quote>other</quote> we are configuring, and is driver-dependent. The
<parameter class="function">source</parameter> parameter selects the source
we which to use for the <quote>other</quote>. If the subdevice does not
support configuring its <quote>other</quote> sources on a per-channel basis,
then the <parameter class="function">channel</parameter>
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 <parameter class="function">other</parameter> parameter selects either the A, B,
or Z signal, and the <parameter class="function">source</parameter> 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
<constant>INSN_CONFIG_SET_OTHER_SRC</constant>
configuration instruction.
Returns:
<literal>0</literal> on success, <literal>-1</literal> 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 <parameter class="function">routing</parameter>
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
<function><link linkend="func-ref-comedi-get-routing">comedi_get_routing</link></function>
function.
This function is only useable
on subdevices that provide support for the
<constant>INSN_CONFIG_SET_ROUTING</constant>
configuration instruction.
Returns:
<literal>0</literal> on success, <literal>-1</literal> on error.