m4/as-linux.m4: don't use backported pcmcia_loop_tuple()
[comedi.git] / Documentation / comedi / insn_config
1
2
3 INSN_CONFIG:
4
5 The first data element (data[0]) is an ID.
6
7 Generic return values:
8
9   Bad ID: EINVAL  (should be EIO?)
10   Length is wrong: EINVAL
11
12   EAGAIN: changed arguments, retry (like command_test)
13
14
15 Notes:
16   - Should we use the length as an ID? (no, cuz its dumb)
17   - Should there be a generic flags parameter? (no)
18   - Should trigger source configs return a token? (no)
19   - Would it be better to have a special subdevice for trigger
20     configuration? (no, because it goes against the "subdevices
21     are independent" design.)
22   - Should this configure generic triggers and return a token
23     to be put into a command, or configure specific triggers
24     that are tied to start_src, convert_src, etc.?
25
26
27 ID=INSN_CONFIG_BLOCK_SIZE: configure size of blocks to transfer during commands
28
29         [0] - ID
30         [1] - block size in bytes
31
32         Writes back actual block size to [1].  Acts as query if block size is
33         set to zero.
34
35 ID=xxx: counter configuration
36
37   The subdevice has an accumulator which changes based on
38   triggers.
39
40   [0] - ID
41   [ ] - flags
42           generate command trigger when?
43   [1] - mode
44   [2] - source1_src
45   [3] - source1_arg
46   [4] - source2_src
47   [5] - source2_arg
48   [6] - gate_src
49   [7] - gate_arg
50
51   Modes:
52     UP_COUNTER:
53       acc++ on source1
54
55     DOWN_COUNTER:
56       acc-- on source1
57
58     QUADRATURE:
59       acc+=atan(source1,source2)
60
61   Notes:
62     - configuring pins vs. configuring triggers would make this
63       easier
64
65
66 ID=xxx: counter configuration, up counter
67
68   chanspec: used to determine particular counter channel
69
70   [0] - ID
71   [1] - flags
72           up/down
73   [2] - src (like command trigger)
74   [3] - arg
75
76   Notes:
77     - too simple?  no gating
78
79 ID=xxx: counter configuration, up counter with gating
80 ID=xxx: counter configuration, quadrature
81
82
83 ID=xxx: set software gate
84   [0] - ID
85   [1] - set/clear gate
86
87
88 Applications:
89
90  - Pulse counting:
91    (STC: simple event counting)
92
93     mode - up counter
94     primary source - external line (+/-)
95
96  - Pulse counting with gate:
97    (STC: simple gated event counting)
98
99     mode - up counter
100     primary source - external line
101     gate source - external line
102
103  - Pulse length measurement:
104     (STC: single pulse-width measurement)
105
106     mode - up counter with gate
107     primary source - timer
108     gate source - external line (+/-)
109
110     latch and reset on gate (-) transition
111
112  - Timestamping
113     (STC: buffered [non-]cumulative event counting,
114           single period measurement)
115
116     mode - up counter
117     primary source - timer
118     secondary source - external line
119
120     latch on secondary source (+) transition
121
122  - Up/Down counter:
123     (STC: relative position sensing)
124
125     mode - up/down counter
126     primary source - external line
127     secondary source - external line
128
129     when(P)acc+=S?+1:-1
130
131  - Quadrature counting:
132
133     mode - quadrature
134     primary source - external line 1
135     secondary source - external line 2
136
137  - Frequency generation:
138
139     mode - up counter
140     primary source - timer
141
142     invert output on primary source trigger
143
144  - Pulse generation
145
146     (XXX needs work)
147     mode - dual up counter
148     primary source - timer
149     secondary source - timer
150
151     set output on primary source trigger
152     clear output on secondary source trigger
153
154   - Pulse Width Modulation
155
156     same as above
157     secondary source - timer (latch arg)
158
159   - Frequency Shift Keying:
160
161     mode - double up counter
162     primary source - timer
163     secondary source - timer
164     gate - soft, or external line
165
166     invert output on gate?primary:secondary source trigger
167
168
169 ID=INSN_CONFIG_ALT_SOURCE: Select alternate input source.  This is
170         used by comedi_calibrate to configure an
171         analog input channel which can be redirected to read internal calibration
172         references.
173         You need to set the CR_ALT_SOURCE flag in the chanlist/chanspec when
174         reading to read from the configured alternate input source.
175
176   [0] - ID
177   [1] - source
178
179 ID=INSN_CONFIG_SET_ROUTING: This is used to configure an output channel
180         which can be multiplexed to output a variety of
181         different signals (such as NI's RTSI and PFI lines).
182
183   chanspec: channel whose routing is being configured
184
185   [0] - ID
186   [1] - source
187
188 ID=INSN_CONFIG_GET_ROUTING: Queries the routing configuration.  See
189         INSN_CONFIG_SET_ROUTING.
190
191   chanspec: channel whose routing is being queried
192
193   [0] - ID
194   [1] - source
195
196 ID=INSN_CONFIG_TIMER_1: Deprecated.  Use INSN_CONFIG_SET_CLOCK_SRC and
197         TRIG_COUNT or TRIG_TIMER.
198         Configure an external master clock and divisor
199         to divide clock by.  Used with commands by setting scan_begin_src or
200         convert_src set to TRIG_OTHER.
201
202   [0] - ID
203   [1] - trigger configuration (COMEDI_EV_SCAN_BEGIN, COMEDI_EV_CONVERT, etc.)
204   [2] - primary input chanspec (also specifies polarity and edge/level )
205   [3] - primary combining machine configuration (should always be 0x04)
206   [4] - divisor
207
208
209 ID=INSN_CONFIG_PWM_OUTPUT: Configure a pulse-width-modulated output.  Returns
210         EAGAIN error with modified values if exact timing is not achievable.
211
212         [0] - ID
213         [1] - up time flags (rounding mode for time: TRIG_ROUND_NEAREST, etc.)
214         [2] - up time (nanoseconds)
215         [3] - down time flags (rounding mode for time: TRIG_ROUND_NEAREST, etc.)
216         [4] - down time (nanoseconds)
217
218 ID=INSN_CONFIG_GET_PWM_OUTPUT: Query a pulse-width-modulation output.
219
220         [0] - ID
221         [1] - up time (nanoseconds)
222         [2] - down time (nanoseconds)
223
224 ID=INSN_CONFIG_SET_CLOCK_SRC: Choose a source for the master clock.
225         The frequency of the clock is specified in data[2], or left
226         unspecified by using a value of 0.  The driver will ignore the clock
227         period setting if it already knows what the clock period should be
228         for the specified source (i.e. for an internal master clock).  Certain
229         boards which use a phase-locked loop to synchronize to an external
230         clock source must be told the frequency of the external clock.
231         Specifying a clock period for an external clock may also allow
232         the driver to support TRIG_TIMER sources in commands while
233         using the external clock.
234         [0] - ID
235         [1] - clock source
236         [2] - clock period (nanoseconds)
237
238 ID=INSN_CONFIG_GET_CLOCK_SRC: Ask which master clock is being used
239         [0] - ID
240         [1] - clock source
241         [2] - clock period (nanoseconds)
242
243 ID=INSN_CONFIG_SET_GATE_SRC: Select gate source.
244         [0] - ID
245         [1] - index identifying which gate we are configuring (0 if there is only one gate)
246         [2] - gate source
247
248 ID=INSN_CONFIG_GET_GATE_SRC: Query gate
249         chanspec - the gate whose source is being queried (if the subdevice has multiple gates)
250         [0] - ID
251         [1] - index identifying which gate we are querying (0 if there is only one gate)
252         [2] - gate source
253
254 ID=INSN_CONFIG_ARM: Arm a device (such as a counter) to start on the specified source
255         [0] - ID
256         [1] - Source
257
258 ID=INSN_CONFIG_DISARM: Disarm a device (such as a counter) and force it to stop.
259         [0] - ID
260
261 ID=INSN_CONFIG_RESET_COUNT: Resets a counter's count to zero.  On NI general-purpose
262         counters, it also has the side-effect of disarming the counter.
263         [0] - ID
264
265 ID=INSN_CONFIG_SET_COUNTER_MODE: Set a counter's mode.  The specific meaning of the
266         the mode field is hardware-dependent.
267         [0] - ID
268         [1] - mode
269
270 ID=INSN_CONFIG_FILTER:  Select an input filter.
271         [0] - ID
272         [1] - filter