0abb2012057933958d49006b8d88b718374e12dc
[comedilib.git] / doc / extensions_funcref.txt
1 Extensions
2 Function: comedi_arm -- arm a subdevice
3 Retval: int
4 Param: comedi_t * device
5 Param: unsigned int subdevice
6 Param: unsigned int source
7 Status: alpha
8 Description:
9  This function arms a subdevice.  It may, for example, arm a counter
10  to begin counting.  The <parameter>source</parameter> parameter specifies
11  what source should trigger the subdevice to begin.  The possible
12  sources are driver-dependant.  This function is only useable
13  on subdevices that provide support for the INSN_CONFIG_ARM configuration
14  instruction.
15 Returns:
16  0 on success, -1 on error.
17
18 Function: comedi_get_clock_source -- get master clock for a subdevice
19 Retval: int
20 Param: comedi_t * device
21 Param: unsigned int subdevice
22 Param: unsigned int channel
23 Param: unsigned int *clock
24 Param: unsigned int *period_ns
25 Status: alpha
26 Description:
27  This function queries the master clock for a subdevice, as
28  set by
29  <link linkend="func-ref-comedi-set-clock-source">comedi_set_clock_source()</link>.
30  The currently configured master clock
31  will be written to *<parameter>clock</parameter>.
32  The possible values and their corresponding clocks are
33  driver-dependant.
34  The frequency of the clock in nanoseconds (or zero if it is unknown)
35  will be written to
36  *<parameter>period_ns</parameter>.
37  If the subdevice does not support configuring its master clocks
38  on a per-channel basis, then the <parameter>channel</parameter>
39  parameter will be ignored.
40
41  It is safe to pass NULL pointers as the <parameter>clock</parameter> or
42  <parameter>period_ns</parameter>
43  parameters.  This function is only useable
44  on subdevices that provide support for the INSN_CONFIG_GET_CLOCK_SOURCE
45  configuration instruction.
46 Returns:
47  0 on success, -1 on error.
48
49 Function: comedi_get_gate_source -- get gate for a subdevice
50 Retval: int
51 Param: comedi_t * device
52 Param: unsigned int subdevice
53 Param: unsigned int channel
54 Param: unsigned int gate_index
55 Param: unsigned int *gate_source
56 Status: alpha
57 Description:
58  This function queries the gate for a subdevice, as
59  set by
60  <link linkend="func-ref-comedi-set-gate-source">comedi_set_gate_source()</link>.
61  The currently configured gate source
62  will be written to *<parameter>gate_source</parameter>.
63  The possible values and their corresponding gates are
64  driver-dependant.  If the subdevice does not
65  support configuring its gates on a per-channel basis, then the
66  <parameter>channel</parameter> parameter will be ignored.
67
68  This function is only useable
69  on subdevices that provide support for the INSN_CONFIG_GET_GATE_SOURCE
70  configuration instruction.
71 Returns:
72  0 on success, -1 on error.
73
74 Function: comedi_get_hardware_buffer_size -- get size of subdevice's hardware buffer
75 Retval: int
76 Param: comedi_t *device
77 Param: unsigned int subdevice
78 Param: <link linkend="ref-enum-comedi-io-direction">enum comedi_io_direction</link> direction
79 Description:
80         This functions returns the number of bytes the subdevice can hold in it's hardware buffer.
81         The term "hardware buffer" refers to any fifos, etc. on the acquisition board itself which
82         are used during streaming commands.  This does not include the buffer maintained by
83         the comedi kernel module in host memory, whose size may be queried by
84         <link linkend="func-ref-comedi-get-buffer-size"><function>comedi_get_buffer_size</function></link>.
85         The <parameter>direction</parameter> parameter of type
86         <link linkend="ref-enum-comedi-io-direction">enum comedi_io_direction</link>
87         should be set to COMEDI_INPUT to query the input buffer size (e.g., the buffer of an analog
88         input subdevice), or COMEDI_OUTPUT to query the output buffer size (e.g., the buffer of
89         an analog output).
90 Returns:
91         Number of bytes, or -1 on error.
92
93 Function: comedi_get_routing -- get routing for an output
94 Retval: int
95 Param: comedi_t * device
96 Param: unsigned int subdevice
97 Param: unsigned int channel
98 Param: unsigned int *routing
99 Status: alpha
100 Description:
101  This function queries the routing for an output, as
102  set by
103  <link linkend="func-ref-comedi-set-routing">comedi_set_routing()</link>.
104  The currently configured routing
105  will be written to *<parameter>routing</parameter>.
106  The possible values and their corresponding routings are
107  driver-dependant.
108
109  This function is only useable
110  on subdevices that provide support for the INSN_CONFIG_GET_ROUTING
111  configuration instruction.
112 Returns:
113  0 on success, -1 on error.
114
115 Function: comedi_reset -- reset a subdevice
116 Retval: int
117 Param: comedi_t * device
118 Param: unsigned int subdevice
119 Status: alpha
120 Description:
121  This function resets a subdevice.  It is only useable
122  on subdevices that provide support for the INSN_CONFIG_RESET configuration
123  instruction.
124 Returns:
125  0 on success, -1 on error.
126
127 Function: comedi_set_clock_source -- set master clock for a subdevice
128 Retval: int
129 Param: comedi_t * device
130 Param: unsigned int subdevice
131 Param: unsigned int channel
132 Param: unsigned int clock
133 Param: unsigned int period_ns
134 Status: alpha
135 Description:
136  This function selects a master clock for a subdevice.  The <parameter>clock</parameter>
137  parameter selects the master clock, and is driver-dependant.  
138  If the subdevice does not support configuring its master clocks on a
139  per-channel basis, then the <parameter>channel</parameter> parameter
140  will be ignored.
141  The <parameter>period_ns</parameter>
142  parameter specifies the clock's period in nanoseconds.  It may left unspecified by using
143  a value of zero.  Drivers will ignore the clock period if they already
144  know what the clock period should be for the specified clock (i.e. for an
145  on-board 20MHz oscillator).  Certain boards which use a phase-locked loop to
146  synchronize to external clock sources must be told the frequency of the external
147  clock. Specifying a clock period for an external clock may also allow
148  the driver to support TRIG_TIMER sources in commands while
149  using the external clock.
150
151  The clock may be queried with the <link linkend="func-ref-comedi-get-clock-source">comedi_get_clock_source()</link>
152  function.
153
154  This function is only useable
155  on subdevices that provide support for the INSN_CONFIG_SET_CLOCK_SOURCE
156  configuration instruction.
157 Returns:
158  0 on success, -1 on error.
159
160 Function: comedi_set_counter_mode -- change mode of a counter subdevice
161 Retval: int
162 Param: comedi_t * device
163 Param: unsigned int subdevice
164 Param: unsigned int channel
165 Param: unsigned int mode
166 Status: alpha
167 Description:
168  This function configures a counter subdevice.  The meaning of the
169  <parameter>mode</parameter> parameter is driver-dependent.
170  If the subdevice does not
171  support configuring its mode on a per-channel basis, then the
172  <parameter>channel</parameter>
173  parameter will be ignored.
174
175  It is only useable
176  on subdevices that provide support for the INSN_CONFIG_SET_COUNTER_MODE
177  configuration instruction.
178 Returns:
179  0 on success, -1 on error.
180
181 Function: comedi_set_filter -- select a filter for a subdevice
182 Retval: int
183 Param: comedi_t * device
184 Param: unsigned int subdevice
185 Param: unsigned int channel
186 Param: unsigned int filter
187 Status: alpha
188 Description:
189  This function selects a filter for a subdevice.  For instance, a digital
190  input subdevice may provide deglitching filters with varying cutoff frequencies.
191  The filters are used to prevent high-frequency
192  noise from causing unwanted transitions on the digital inputs.  This function can
193  tell the hardware which deglitching filter to use, or to use none at all.
194
195  The <parameter>filter</parameter>
196  parameter selects which of the subdevice's filters to use, and is driver-dependant.
197
198  This function is only useable
199  on subdevices that provide support for the INSN_CONFIG_FILTER
200  configuration instruction.
201 Returns:
202  0 on success, -1 on error.
203
204 Function: comedi_set_gate_source -- select gate source for a subdevice
205 Retval: int
206 Param: comedi_t * device
207 Param: unsigned int subdevice
208 Param: unsigned int channel
209 Param: unsigned int gate_index
210 Param: unsigned int gate_source
211 Status: alpha
212 Description:
213  This function selects a gate source for a subdevice.  The <parameter>gate_index</parameter>
214  parameter selects which gate is being configured, should the subdevice have
215  multiple gates.  It takes a value
216  from 0 to N-1 for a subdevice with N different gates.
217  The <parameter>gate_source</parameter> parameter selects which signal you wish to
218  use as
219  the gate, and is also driver-dependent.  If the subdevice does not
220  support configuring its gates on a per-channel basis, then the
221  <parameter>channel</parameter> parameter will be ignored.
222
223  You may query the gate source with the <link linkend="func-ref-comedi-get-gate-source">comedi_get_gate_source()</link>
224  function.
225  This function is only useable
226  on subdevices that provide support for the INSN_CONFIG_SET_GATE_SOURCE
227  configuration instruction.
228 Returns:
229  0 on success, -1 on error.
230
231 Function: comedi_set_other_source -- select source signal for something other than a gate or clock
232 Retval: int
233 Param: comedi_t * device
234 Param: unsigned int subdevice
235 Param: unsigned int channel
236 Param: unsigned int other
237 Param: unsigned int source
238 Status: alpha
239 Description:
240  This function allows selection of a source signal for something on a subdevice
241  other than a gate (which uses comedi_set_gate_source()) or a clock (which uses
242  comedi_set_clock_source()).  The <parameter>other</parameter> parameter selects
243  which "other" we are configuring, and is driver-dependent.  The
244  <parameter>source</parameter> selects the source we which to use for the
245  "other".  If the subdevice does not
246  support configuring its "other" sources on a per-channel basis, then the
247  <parameter>channel</parameter>
248  parameter will be ignored.
249
250  As an example, this function is used to select which PFI digital input channels
251  should be used as the A/B/Z signals when running a counter on an NI M-Series board as
252  a quadrature encoder.  The <parameter>other</parameter> parameter selects either the A, B,
253  or Z signal, and the <parameter>source</parameter> parameter is used to specify
254  which PFI digital input channel the external A, B, or Z signal is
255  physically connected to.
256
257  This function is only useable
258  on subdevices that provide support for the INSN_CONFIG_SET_OTHER_SOURCE
259  configuration instruction.
260 Returns:
261  0 on success, -1 on error.
262
263 Function: comedi_set_routing -- select a routing for an output
264 Retval: int
265 Param: comedi_t * device
266 Param: unsigned int subdevice
267 Param: unsigned int channel
268 Param: unsigned int routing
269 Status: alpha
270 Description:
271  This function configures a mutiplexed output channel which can
272  output a variety of different signals (such as NI's RTSI and PFI lines).
273  The <parameter>routing</parameter>
274  parameter selects which signal should be routed to appear on the
275  selected output channel, and is driver-dependant.
276
277  The routing may be queried with the
278  <link linkend="func-ref-comedi-get-routing">comedi_get_routing()</link> function.
279  This function is only useable
280  on subdevices that provide support for the INSN_CONFIG_SET_ROUTING
281  configuration instruction.
282 Returns:
283  0 on success, -1 on error.