File: instructionsconfiguration.html

package info (click to toggle)
comedilib 0.11.0%2B5-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, trixie
  • size: 8,540 kB
  • sloc: xml: 19,779; ansic: 14,719; sh: 5,672; cpp: 2,211; ruby: 1,658; perl: 700; makefile: 594; yacc: 439; lex: 86; python: 17
file content (90 lines) | stat: -rw-r--r-- 7,417 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>4.3.  Instructions for configuration</title><link rel="stylesheet" type="text/css" href="comedilib.css"><meta name="generator" content="DocBook XSL Stylesheets V1.79.1"><link rel="home" href="index.html" title="Comedi"><link rel="up" href="acquisitionfunctions.html" title="4.  Acquisition and configuration functions"><link rel="prev" href="instructions.html" title="4.2.  Instructions for multiple acquisitions"><link rel="next" href="inttrigconfiguration.html" title="4.4.  Instruction for internal triggering"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">4.3. 
Instructions for configuration
</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="instructions.html">Prev</a> </td><th width="60%" align="center">4. 
Acquisition and configuration functions
</th><td width="20%" align="right"> <a accesskey="n" href="inttrigconfiguration.html">Next</a></td></tr></table><hr></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="instructionsconfiguration"></a>4.3. 
Instructions for configuration
</h3></div></div></div><p>
<a class="xref" href="instructions.html" title="4.2.  Instructions for multiple acquisitions">Section 4.2</a> explains how instructions are used to do
<span class="emphasis"><em>acquisition</em></span> on channels. This section explains
how they are used to <span class="emphasis"><em>configure</em></span> a subdevice.
There are various sorts of configurations, and the
specific information for each different configuration possibility is
to be specified via the
<em class="structfield"><code><a class="link" href="instructions.html#insn-data-structure-data">data</a></code></em>
buffer of the
<a class="link" href="instructions.html#insn-data-structure">instruction data structure</a>.
(So, the pointer to a
<span class="type"><a class="link" href="datatypesstructures.html#ref-type-lsampl-t" title="5.3.4.  lsampl_t">lsampl_t</a></span>
is misused as a pointer to an array with board-specific information.)
</p><p>
Using <code class="constant">INSN_CONFIG</code> as the
<em class="structfield"><code><a class="link" href="instructions.html#insn-data-structure-insn">insn</a></code></em>
member in an
<a class="link" href="instructions.html#insn-data-structure">instruction data structure</a>
indicates that the instruction will
<span class="emphasis"><em>not perform acquisition</em></span> on a
channel, but will <span class="emphasis"><em>configure</em></span> that channel.
The
<em class="structfield"><code><a class="link" href="constantsmacros.html#ref-macro-CR-PACK" title="5.2.1.  CR_PACK">chanspec</a></code></em>
member in the
<span class="type"><a class="link" href="instructions.html#insn-data-structure-chanspec">comedi_insn</a></span>
data structure, contains the channel to be configured.
The zeroth element of the data array
is always an id that specifies
what type of configuration instruction is being performed.  The
meaning of rest of the elements in the data array
depend on the configuration instruction id.
Some of the
possible ids are summarised in the table below, along with the
meanings of the data array elements for
each type of configuration instruction.
</p><div class="informaltable"><table class="informaltable" border="1"><colgroup><col align="left"><col align="left"><col align="left"><col align="left"></colgroup><thead><tr><th align="left">data[0]</th><th align="left">Description</th><th align="left">n (number of elements in data array)</th><th align="left">Meanings of data[1], ..., data[n-1]</th></tr></thead><tbody><tr><td align="left"><code class="constant">INSN_CONFIG_DIO_INPUT</code></td><td align="left">
Configure a DIO line as input.  It is easier to use
<code class="function"><a class="link" href="func-ref-comedi-dio-config.html" title="comedi_dio_config">comedi_dio_config</a></code>
than to use this configuration instruction directly.
</td><td align="left">1</td><td align="left">
n/a
</td></tr><tr><td align="left"><code class="constant">INSN_CONFIG_DIO_OUTPUT</code></td><td align="left">
Configure a DIO line as output.  It is easier to use
<code class="function"><a class="link" href="func-ref-comedi-dio-config.html" title="comedi_dio_config">comedi_dio_config</a></code>
than to use this configuration instruction directly.
</td><td align="left">1</td><td align="left">
n/a
</td></tr><tr><td align="left"><code class="constant">INSN_CONFIG_ALT_SOURCE</code></td><td align="left">
Select an alternate input source.  This instruction is used by calibration
programs to configure analog input channels
which can be redirected to read internal calibration
references.  You need to set the <code class="constant">CR_ALT_SOURCE</code> flag in the chanspec
when reading to actually read from the configured alternate input source.
If you are using <code class="function">comedi_data_read</code>, then the channel parameter can be
bitwise or'd with the <code class="constant">CR_ALT_SOURCE</code> flag.
</td><td align="left">2</td><td align="left">
data[1]: alternate input source.
</td></tr><tr><td align="left"><code class="constant">INSN_CONFIG_BLOCK_SIZE</code></td><td align="left">
Specify block size for asynchonous command data.
When performing streaming input, many boards accumulate
samples in internal fifos and transfer them to the host
computer in chunks.  Some drivers let you suggest a size in bytes for how big a
the chunks should be.  This lets you tune how often the host computer is
interrupted with a new chunk of data.
</td><td align="left">2</td><td align="left">
data[1]: The desired block size in bytes.  The actual configured block size is
writen back to data[1] after the instruction completes.  This instruction
acts purely as a query if the block size is set to zero.
</td></tr><tr><td align="left"><code class="constant">INSN_CONFIG_DIO_QUERY</code></td><td align="left">
Queries the configuration of a DIO line to see if it is an input or output.
It is probably easier to use the comedilib function
<code class="function"><a class="link" href="func-ref-comedi-dio-get-config.html" title="comedi_dio_get_config">comedi_dio_get_config</a></code>
than to use this instruction directly.
</td><td align="left">2</td><td align="left">
data[1]: The instruction sets this element to either
<code class="constant">COMEDI_INPUT</code> or <code class="constant">COMEDI_OUTPUT</code>.
</td></tr></tbody></table></div><p>
See the comedilib demo program <code class="filename">demo/choose_clock.c</code> for an example
of using a configuration instruction.
</p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="instructions.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="acquisitionfunctions.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="inttrigconfiguration.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">4.2. 
Instructions for multiple acquisitions
 </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 4.4. 
Instruction for internal triggering
</td></tr></table></div></body></html>