Added some stuff
[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=0: COMEDI_INPUT
28 ID=1: COMEDI_OUTPUT
29 ID=2: open drain input (?)
30 ID=3: open drain output
31
32   length=1
33   chanspec is used to specify channel
34   type: SUBD_DIO
35
36   These are used to configure the direction of digital I/O lines.
37
38   Modifications: none
39
40   Errors: none
41
42   Notes:
43     - does "open drain input" make sense? (no)
44
45
46 ID=xxx:  analog output waveform generation
47
48   Specify the number of samples in buffer.
49
50
51 ID=xxx:  analog output deglitch configuration
52 ID=xxx:  analog input dithering configuration
53   
54   Also could put AO range configuration here.  (ds: that would be
55   dumb.)
56
57
58 ID=xxx:  analog triggering
59
60   length=N
61   chanspec is ignored
62   type: any with cmd
63
64   [0] - ID
65   [1] - analog trigger channel
66   [2] - flags
67           trigger
68           slope/level
69           hysteresis
70   [3] - high
71   [4] - low
72
73   Modifications: ?
74   Errors:
75     - bad channel
76     - bad flags
77     - 
78   Notes:
79     - are there devices that can specify debouncing?
80     - are there devices that can specify a time value after
81       which the analog trigger resets?
82     - has to account for hysteresis
83
84
85 ID=xxx: simple digital triggering
86
87   length =
88   chanspec is ignored
89   type: any with cmd
90
91   [0] - ID
92   [1] - flags
93           trigger 
94           edge/level
95           rising/falling
96   [2] - divider (?)
97
98   Notes:
99     - should this configure pins, or configure triggers?
100       (ds: triggers, see independent subdevice design rule)
101       (ds: pins, because it makes other things easier)
102     - divider?  (ds: too complicated.  This is supposed to
103       be simple.)
104     - should this be encoded into the TRIG_EXT argument?
105       
106
107 ID=xxx: extended digital triggering
108
109   length =
110   chanspec: ignored
111   type: any with cmd
112
113   [0] - ID
114   [1] - flags
115           trigger
116
117   Notes:
118     - should this be the same as triggering for counter/timers?
119
120
121 ID=xxx: counter configuration
122
123   The subdevice has an accumulator which changes based on
124   triggers.
125
126   [0] - ID
127   [ ] - flags
128           generate command trigger when?
129   [1] - mode
130   [2] - source1_src
131   [3] - source1_arg
132   [4] - source2_src
133   [5] - source2_arg
134   [6] - gate_src
135   [7] - gate_arg
136
137   Modes:
138     UP_COUNTER:
139       acc++ on source1
140
141     DOWN_COUNTER:
142       acc-- on source1
143     
144     QUADRATURE:
145       acc+=atan(source1,source2)
146
147   Notes:
148     - configuring pins vs. configuring triggers would make this
149       easier
150
151
152 ID=xxx: counter configuration, up counter
153
154   chanspec: used to determine particular counter channel
155
156   [0] - ID
157   [1] - flags
158           up/down
159   [2] - src (like command trigger)
160   [3] - arg
161
162   Notes:
163     - too simple?  no gating
164
165 ID=xxx: counter configuration, up counter with gating
166 ID=xxx: counter configuration, quadrature
167
168
169 ID=xxx: command trigger, pattern matching
170
171   [0] - ID
172   [1] - bit mask (1 - watch, 0 - don't watch)
173   [2] - bit pattern
174
175
176 ID=xxx: set software gate
177   [0] - ID
178   [1] - set/clear gate
179
180
181
182
183 Applications:
184
185  - Pulse counting:
186    (STC: simple event counting)
187
188     mode - up counter
189     primary source - external line (+/-)
190
191  - Pulse counting with gate:
192    (STC: simple gated event counting)
193     
194     mode - up counter
195     primary source - external line
196     gate source - external line
197
198  - Pulse length measurement:
199     (STC: single pulse-width measurement)
200
201     mode - up counter with gate
202     primary source - timer
203     gate source - external line (+/-)
204
205     latch and reset on gate (-) transition
206
207  - Timestamping
208     (STC: buffered [non-]cumulative event counting,
209           single period measurement)
210
211     mode - up counter
212     primary source - timer
213     secondary source - external line
214
215     latch on secondary source (+) transition
216
217  - Up/Down counter:
218     (STC: relative position sensing)
219
220     mode - up/down counter
221     primary source - external line
222     secondary source - external line
223
224     when(P)acc+=S?+1:-1
225
226  - Quadrature counting:
227     
228     mode - quadrature
229     primary source - external line 1
230     secondary source - external line 2
231
232  - Frequency generation:
233
234     mode - up counter
235     primary source - timer
236     
237     invert output on primary source trigger
238
239  - Pulse generation
240     
241     (XXX needs work)
242     mode - dual up counter
243     primary source - timer
244     secondary source - timer
245
246     set output on primary source trigger
247     clear output on secondary source trigger
248
249   - Pulse Width Modulation
250
251     same as above
252     secondary source - timer (latch arg)
253
254   - Frequency Shift Keying:
255
256     mode - double up counter
257     primary source - timer
258     secondary source - timer
259     gate - soft, or external line
260
261     invert output on gate?primary:secondary source trigger
262
263   - 
264
265