~ubuntu-branches/ubuntu/intrepid/comedilib/intrepid

« back to all changes in this revision

Viewing changes to doc/doc_html/x3563.html

  • Committer: Bazaar Package Importer
  • Author(s): David Schleef
  • Date: 2004-11-04 11:43:51 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20041104114351-a50kaei5yamka8r6
Tags: 0.7.22-2
It helps if the shared library is actually in the package.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 
2
<HTML
 
3
><HEAD
 
4
><TITLE
 
5
>    Comedi Reference
 
6
  </TITLE
 
7
><META
 
8
NAME="GENERATOR"
 
9
CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
 
10
REL="HOME"
 
11
TITLE="    Comedi 
 
12
  "
 
13
HREF="index.html"><LINK
 
14
REL="PREVIOUS"
 
15
TITLE="    Low-level drivers
 
16
  "
 
17
HREF="x1672.html"><LINK
 
18
REL="NEXT"
 
19
TITLE="comedi_close"
 
20
HREF="r3764.html"></HEAD
 
21
><BODY
 
22
CLASS="SECTION"
 
23
BGCOLOR="#FFFFFF"
 
24
TEXT="#000000"
 
25
LINK="#0000FF"
 
26
VLINK="#840084"
 
27
ALINK="#0000FF"
 
28
><DIV
 
29
CLASS="NAVHEADER"
 
30
><TABLE
 
31
SUMMARY="Header navigation table"
 
32
WIDTH="100%"
 
33
BORDER="0"
 
34
CELLPADDING="0"
 
35
CELLSPACING="0"
 
36
><TR
 
37
><TH
 
38
COLSPAN="3"
 
39
ALIGN="center"
 
40
>Comedi: The <SPAN
 
41
CLASS="emphasis"
 
42
><I
 
43
CLASS="EMPHASIS"
 
44
>Control and Measurement Device Interface</I
 
45
></SPAN
 
46
>
 
47
handbook
 
48
  </TH
 
49
></TR
 
50
><TR
 
51
><TD
 
52
WIDTH="10%"
 
53
ALIGN="left"
 
54
VALIGN="bottom"
 
55
><A
 
56
HREF="x1672.html"
 
57
ACCESSKEY="P"
 
58
>Prev</A
 
59
></TD
 
60
><TD
 
61
WIDTH="80%"
 
62
ALIGN="center"
 
63
VALIGN="bottom"
 
64
></TD
 
65
><TD
 
66
WIDTH="10%"
 
67
ALIGN="right"
 
68
VALIGN="bottom"
 
69
><A
 
70
HREF="r3764.html"
 
71
ACCESSKEY="N"
 
72
>Next</A
 
73
></TD
 
74
></TR
 
75
></TABLE
 
76
><HR
 
77
ALIGN="LEFT"
 
78
WIDTH="100%"></DIV
 
79
><DIV
 
80
CLASS="SECTION"
 
81
><H1
 
82
CLASS="SECTION"
 
83
><A
 
84
NAME="COMEDIREFERENCE"
 
85
>7. <ACRONYM
 
86
CLASS="ACRONYM"
 
87
>Comedi</ACRONYM
 
88
> Reference</A
 
89
></H1
 
90
><P
 
91
>    Reference for 
 
92
  <A
 
93
HREF="x3563.html#CONSTANTSMACROS"
 
94
>constants and macros</A
 
95
>,
 
96
  <A
 
97
HREF="x3563.html#DATATYPESSTRUCTURES"
 
98
>data types and structures</A
 
99
>,
 
100
  and <A
 
101
HREF="x3563.html#FUNCTIONREFERENCE"
 
102
>functions</A
 
103
>.
 
104
  </P
 
105
><DIV
 
106
CLASS="SECTION"
 
107
><H2
 
108
CLASS="SECTION"
 
109
><A
 
110
NAME="COMEDI-COMEDILIB-H"
 
111
>7.1. Headerfiles: <TT
 
112
CLASS="FILENAME"
 
113
>comedi.h</TT
 
114
> and <TT
 
115
CLASS="FILENAME"
 
116
>comedilib.h</TT
 
117
></A
 
118
></H2
 
119
><P
 
120
>All <A
 
121
HREF="x403.html"
 
122
>application programs</A
 
123
> must
 
124
include the header file <TT
 
125
CLASS="FILENAME"
 
126
>comedilib.h</TT
 
127
>. (This file
 
128
itself includes <TT
 
129
CLASS="FILENAME"
 
130
>comedi.h</TT
 
131
>.) They contain the full
 
132
interface of <ACRONYM
 
133
CLASS="ACRONYM"
 
134
>Comedi</ACRONYM
 
135
>: defines, function prototypes, data structures.</P
 
136
><P
 
137
>The following Sections give more details.</P
 
138
></DIV
 
139
><DIV
 
140
CLASS="SECTION"
 
141
><H2
 
142
CLASS="SECTION"
 
143
><A
 
144
NAME="CONSTANTSMACROS"
 
145
>7.2. Constants and Macros</A
 
146
></H2
 
147
><DIV
 
148
CLASS="SECTION"
 
149
><H3
 
150
CLASS="SECTION"
 
151
><A
 
152
NAME="REF-MACRO-CR-PACK"
 
153
>7.2.1. CR_PACK</A
 
154
></H3
 
155
><P
 
156
>CR_PACK is used to initialize the elements of the
 
157
<VAR
 
158
CLASS="PARAMETER"
 
159
>chanlist</VAR
 
160
> array in the
 
161
<A
 
162
HREF="x3563.html#REF-TYPE-COMEDI-CMD"
 
163
>comedi_cmd</A
 
164
> data structure,
 
165
and the <VAR
 
166
CLASS="PARAMETER"
 
167
>chanspec</VAR
 
168
> member of the 
 
169
<A
 
170
HREF="x3563.html#REF-TYPE-COMEDI-INSN"
 
171
>comedi_insn</A
 
172
> structure.</P
 
173
><PRE
 
174
CLASS="PROGRAMLISTING"
 
175
>#define CR_PACK(chan,rng,aref)      ( (((aref)&#38;0x3)&#60;&#60;24) | (((rng)&#38;0xff)&#60;&#60;16) | (chan) ) </PRE
 
176
><P
 
177
>The <VAR
 
178
CLASS="PARAMETER"
 
179
>chan</VAR
 
180
> argument is the channel you wish to
 
181
use, with the channel numbering starting at zero.</P
 
182
><P
 
183
>The range <VAR
 
184
CLASS="PARAMETER"
 
185
>rng</VAR
 
186
> is an index, starting at zero,
 
187
whose meaning is device dependent.  The 
 
188
<A
 
189
HREF="r4189.html"
 
190
>comedi_get_n_ranges()</A
 
191
>
 
192
and
 
193
<A
 
194
HREF="r4212.html"
 
195
>comedi_get_range()</A
 
196
>
 
197
functions are useful in discovering information about the available
 
198
ranges.</P
 
199
><P
 
200
>The <VAR
 
201
CLASS="PARAMETER"
 
202
>aref</VAR
 
203
> argument indicates what reference you
 
204
want the device to use.  It can be any of the following:
 
205
<P
 
206
></P
 
207
><DIV
 
208
CLASS="VARIABLELIST"
 
209
><DL
 
210
><DT
 
211
>AREF_GROUND <A
 
212
NAME="AREF-GROUND"
 
213
></A
 
214
></DT
 
215
><DD
 
216
><P
 
217
>        is for inputs/outputs referenced to ground.
 
218
      </P
 
219
></DD
 
220
><DT
 
221
>AREF_COMMON <A
 
222
NAME="AREF-COMMON"
 
223
></A
 
224
></DT
 
225
><DD
 
226
><P
 
227
>        is for a <SPAN
 
228
CLASS="QUOTE"
 
229
>"common"</SPAN
 
230
> reference (the low inputs of all the
 
231
channels are tied together, but are isolated from ground).
 
232
      </P
 
233
></DD
 
234
><DT
 
235
>AREF_DIFF <A
 
236
NAME="AREF-DIFF"
 
237
></A
 
238
></DT
 
239
><DD
 
240
><P
 
241
>    is for differential inputs/outputs.
 
242
      </P
 
243
></DD
 
244
><DT
 
245
>AREF_OTHER <A
 
246
NAME="AREF-OTHER"
 
247
></A
 
248
></DT
 
249
><DD
 
250
><P
 
251
>    is for any reference that does not fit into the above categories.
 
252
      </P
 
253
></DD
 
254
></DL
 
255
></DIV
 
256
>
 
257
Particular drivers may or may not use the AREF flags.  If they are
 
258
not supported, they are silently ignored.</P
 
259
></DIV
 
260
><DIV
 
261
CLASS="SECTION"
 
262
><H3
 
263
CLASS="SECTION"
 
264
><A
 
265
NAME="REF-MACRO-RANGE-LENGTH"
 
266
>7.2.2. RANGE_LENGTH (deprecated)</A
 
267
></H3
 
268
><P
 
269
>Rangetype values are library-internal tokens that represent an
 
270
array of range information structures.  These numbers are primarily
 
271
used for communication between the kernel and library.</P
 
272
><P
 
273
>The RANGE_LENGTH() macro returns the length of the array that is
 
274
specified by the rangetype token.</P
 
275
><P
 
276
>The RANGE_LENGTH() macro is deprecated, and should not be used in
 
277
new applications.  It is scheduled to be removed from the header
 
278
file at version 1.0.  Binary compatibility may be broken for version
 
279
1.1.</P
 
280
></DIV
 
281
></DIV
 
282
><DIV
 
283
CLASS="SECTION"
 
284
><H2
 
285
CLASS="SECTION"
 
286
><A
 
287
NAME="DATATYPESSTRUCTURES"
 
288
>7.3. Data Types and Structures</A
 
289
></H2
 
290
><P
 
291
>This Section explains the data structures that users of the <ACRONYM
 
292
CLASS="ACRONYM"
 
293
>Comedi</ACRONYM
 
294
>
 
295
API are confronted with:
 
296
<PRE
 
297
CLASS="PROGRAMLISTING"
 
298
>typedef struct subdevice_struct       <A
 
299
HREF="x3563.html#REF-TYPE-SUBDEVICE-STRUCT"
 
300
>subdevice_struct</A
 
301
>:
 
302
typedef struct comedi_devinfo_struct  <A
 
303
HREF="x3563.html#REF-TYPE-COMEDI-DEVINFO"
 
304
>comedi_devinfo</A
 
305
>;
 
306
typedef struct comedi_t_struct        <A
 
307
HREF="x3563.html#REF-TYPE-COMEDI-T"
 
308
>comedi_t</A
 
309
>;
 
310
typedef struct sampl_t_struct         <A
 
311
HREF="x3563.html#REF-TYPE-SAMPL-T"
 
312
>sampl_t</A
 
313
>;
 
314
typedef struct lsampl_t_struct        <A
 
315
HREF="x3563.html#REF-TYPE-LSAMPL-T"
 
316
>lsampl_t</A
 
317
>;
 
318
typedef struct comedi_sv_t_struct     <A
 
319
HREF="x3563.html#REF-TYPE-COMEDI-SV-T"
 
320
>comedi_sv_t</A
 
321
>;
 
322
typedef struct comedi_cmd_struct      <A
 
323
HREF="x3563.html#REF-TYPE-COMEDI-CMD"
 
324
>comedi_cmd</A
 
325
>;
 
326
typedef struct comedi_insn_struct     <A
 
327
HREF="x3563.html#REF-TYPE-COMEDI-INSN"
 
328
>comedi_insn</A
 
329
>;
 
330
typedef struct comedi_range_struct    <A
 
331
HREF="x3563.html#REF-TYPE-COMEDI-RANGE"
 
332
>comedi_range</A
 
333
>;
 
334
typedef struct comedi_krange_struct   <A
 
335
HREF="x3563.html#REF-TYPE-COMEDI-KRANGE"
 
336
>comedi_krange</A
 
337
>;
 
338
typedef struct comedi_insnlist_struct <A
 
339
HREF="x3563.html#REF-TYPE-COMEDI-INSNLIST"
 
340
>comedi_insnlist</A
 
341
>;</PRE
 
342
>
 
343
The data structures used in the implementation of the <ACRONYM
 
344
CLASS="ACRONYM"
 
345
>Comedi</ACRONYM
 
346
> drivers
 
347
are treated <A
 
348
HREF="x1283.html#DRIVERDATASTRUCTURES"
 
349
>elsewhere</A
 
350
>.</P
 
351
><DIV
 
352
CLASS="SECTION"
 
353
><H3
 
354
CLASS="SECTION"
 
355
><A
 
356
NAME="REF-TYPE-SUBDEVICE-STRUCT"
 
357
>7.3.1. subdevice_struct</A
 
358
></H3
 
359
><P
 
360
>The data type <VAR
 
361
CLASS="PARAMETER"
 
362
>subdevice_struct</VAR
 
363
> is used to store
 
364
information about a subdevice. This structure is usually filled in
 
365
automatically when the driver is loaded (<SPAN
 
366
CLASS="QUOTE"
 
367
>"attached"</SPAN
 
368
>), so
 
369
programmers need not access this data structure directly.
 
370
<PRE
 
371
CLASS="PROGRAMLISTING"
 
372
>typedef struct subdevice_struct <A
 
373
NAME="REF-TYPE-SUBDEVICE"
 
374
></A
 
375
>subdevice;
 
376
 
 
377
struct subdevice_struct{
 
378
  unsigned int type;
 
379
  unsigned int n_chan;
 
380
  unsigned int subd_flags;
 
381
  unsigned int timer_type;
 
382
  unsigned int len_chanlist;
 
383
  <A
 
384
HREF="x3563.html#REF-TYPE-LSAMPL-T"
 
385
>lsampl_t</A
 
386
> maxdata;
 
387
  unsigned int flags;
 
388
  unsigned int range_type;
 
389
 
 
390
  <A
 
391
HREF="x3563.html#REF-TYPE-LSAMPL-T"
 
392
>lsampl_t</A
 
393
> *maxdata_list;
 
394
  unsigned int *range_type_list;
 
395
  unsigned int *flags_list;
 
396
 
 
397
  <A
 
398
HREF="x3563.html#REF-TYPE-COMEDI-RANGE"
 
399
>comedi_range</A
 
400
> *rangeinfo;
 
401
  <A
 
402
HREF="x3563.html#REF-TYPE-COMEDI-RANGE"
 
403
>ccomedi_range</A
 
404
> **rangeinfo_list;
 
405
 
 
406
  unsigned int has_cmd;
 
407
  unsigned int has_insn_bits;
 
408
 
 
409
  int cmd_mask_errno;
 
410
  <A
 
411
HREF="x3563.html#REF-TYPE-COMEDI-CMD"
 
412
>comedi_cmd</A
 
413
> *cmd_mask;
 
414
  int cmd_timed_errno;
 
415
  <A
 
416
HREF="x3563.html#REF-TYPE-COMEDI-CMD"
 
417
>comedi_cmd</A
 
418
> *cmd_timed;
 
419
};</PRE
 
420
>&#13;</P
 
421
></DIV
 
422
><DIV
 
423
CLASS="SECTION"
 
424
><H3
 
425
CLASS="SECTION"
 
426
><A
 
427
NAME="REF-TYPE-COMEDI-DEVINFO"
 
428
>7.3.2. comedi_devinfo</A
 
429
></H3
 
430
><P
 
431
>The data type <VAR
 
432
CLASS="PARAMETER"
 
433
>comedi_devinfo</VAR
 
434
> is used to store
 
435
information about a device. This structure is usually filled in
 
436
automatically when the driver is loaded (<SPAN
 
437
CLASS="QUOTE"
 
438
>"attached"</SPAN
 
439
>), so
 
440
programmers need not access this data structure directly.
 
441
<PRE
 
442
CLASS="PROGRAMLISTING"
 
443
>typedef struct comedi_devinfo_struct comedi_devinfo;
 
444
 
 
445
struct comedi_devinfo_struct{
 
446
  unsigned int version_code;    // version number of the Comedi code
 
447
  unsigned int n_subdevs;       // number of subdevices on this device
 
448
  char         driver_name[COMEDI_NAMELEN];
 
449
  char         board_name[COMEDI_NAMELEN];
 
450
  int          read_subdevice;  // number of read devices
 
451
  int          write_subdevice; // number of write devices
 
452
  int          unused[30];
 
453
};&#13;</PRE
 
454
></P
 
455
></DIV
 
456
><DIV
 
457
CLASS="SECTION"
 
458
><H3
 
459
CLASS="SECTION"
 
460
><A
 
461
NAME="REF-TYPE-COMEDI-T"
 
462
>7.3.3. comedi_t</A
 
463
></H3
 
464
><P
 
465
>The data type <VAR
 
466
CLASS="PARAMETER"
 
467
>comedi_t</VAR
 
468
> is used to represent an
 
469
open <ACRONYM
 
470
CLASS="ACRONYM"
 
471
>Comedi</ACRONYM
 
472
> device:
 
473
<PRE
 
474
CLASS="PROGRAMLISTING"
 
475
>typedef struct comedi_t_struct comedi_t;
 
476
 
 
477
struct comedi_t_struct{
 
478
  int magic;        // driver-specific magic number, for identification
 
479
  int fd;           // file descriptor, for open() and close()
 
480
  int n_subdevices; // number of subdevices on this device
 
481
  <A
 
482
HREF="x3563.html#REF-TYPE-COMEDI-DEVINFO"
 
483
>comedi_devinfo</A
 
484
> devinfo;
 
485
  <A
 
486
HREF="x3563.html#REF-TYPE-SUBDEVICE"
 
487
>subdevice</A
 
488
> *subdevices; // pointer to subdevice list
 
489
                         // filled in automatically at load time
 
490
  unsigned int has_insnlist_ioctl; // can process <A
 
491
HREF="x621.html#ANCHOR.INSTRUCTION.LIST"
 
492
>instruction lists</A
 
493
>
 
494
  unsigned int has_insn_ioctl;     // can process <A
 
495
HREF="x621.html#INSTRUCTIONS"
 
496
>instructions</A
 
497
>
 
498
};</PRE
 
499
>
 
500
A valid <VAR
 
501
CLASS="PARAMETER"
 
502
>comedi_t</VAR
 
503
> pointer is returned by a
 
504
successful call to
 
505
<A
 
506
HREF="r3786.html"
 
507
>comedi_open()</A
 
508
>,
 
509
and should be used for subsequent access to the device.
 
510
It is a transparent type, and pointers to type 
 
511
<VAR
 
512
CLASS="PARAMETER"
 
513
>comedi_t</VAR
 
514
>
 
515
should not be dereferenced by the application.</P
 
516
></DIV
 
517
><DIV
 
518
CLASS="SECTION"
 
519
><H3
 
520
CLASS="SECTION"
 
521
><A
 
522
NAME="REF-TYPE-SAMPL-T"
 
523
>7.3.4. sampl_t</A
 
524
></H3
 
525
><PRE
 
526
CLASS="PROGRAMLISTING"
 
527
>typedef unsigned short sampl_t;</PRE
 
528
><P
 
529
>The data type <A
 
530
HREF="x3563.html#REF-TYPE-SAMPL-T"
 
531
>sampl_t</A
 
532
> is one
 
533
of the generic
 
534
types used to represent data values in Comedilib.  It is used in a few
 
535
places where a data type
 
536
shorter than <A
 
537
HREF="x3563.html#REF-TYPE-LSAMPL-T"
 
538
>lsampl_t</A
 
539
> is
 
540
useful.  On most architectures,
 
541
<A
 
542
HREF="x3563.html#REF-TYPE-SAMPL-T"
 
543
>sampl_t</A
 
544
>
 
545
is defined to be <VAR
 
546
CLASS="PARAMETER"
 
547
>uint16</VAR
 
548
>.</P
 
549
><P
 
550
>Most drivers represent data transferred by <CODE
 
551
CLASS="FUNCTION"
 
552
>read()</CODE
 
553
> and
 
554
<CODE
 
555
CLASS="FUNCTION"
 
556
>write()</CODE
 
557
> using
 
558
<A
 
559
HREF="x3563.html#REF-TYPE-SAMPL-T"
 
560
>sampl_t</A
 
561
>.
 
562
Applications should check the subdevice flag
 
563
SDF_LSAMPL to determine if the subdevice uses
 
564
<A
 
565
HREF="x3563.html#REF-TYPE-SAMPL-T"
 
566
>sampl_t</A
 
567
> or
 
568
<A
 
569
HREF="x3563.html#REF-TYPE-LSAMPL-T"
 
570
>lsampl_t</A
 
571
>.</P
 
572
></DIV
 
573
><DIV
 
574
CLASS="SECTION"
 
575
><H3
 
576
CLASS="SECTION"
 
577
><A
 
578
NAME="REF-TYPE-LSAMPL-T"
 
579
>7.3.5. lsampl_t</A
 
580
></H3
 
581
><PRE
 
582
CLASS="PROGRAMLISTING"
 
583
>typedef unsigned int lsampl_t;</PRE
 
584
><P
 
585
>The data type 
 
586
<A
 
587
HREF="x3563.html#REF-TYPE-LSAMPL-T"
 
588
>lsampl_t</A
 
589
>
 
590
is the data type typically used to represent
 
591
data values in libcomedi.  On most architectures,
 
592
<A
 
593
HREF="x3563.html#REF-TYPE-LSAMPL-T"
 
594
>lsampl_t</A
 
595
>
 
596
is defined to be uint32.</P
 
597
></DIV
 
598
><DIV
 
599
CLASS="SECTION"
 
600
><H3
 
601
CLASS="SECTION"
 
602
><A
 
603
NAME="REF-TYPE-COMEDI-TRIG"
 
604
>7.3.6. comedi_trig (deprecated)</A
 
605
></H3
 
606
><PRE
 
607
CLASS="PROGRAMLISTING"
 
608
>typedef struct comedi_trig_struct comedi_trig;
 
609
 
 
610
struct comedi_trig_struct{
 
611
  unsigned int subdev;   /* subdevice */
 
612
  unsigned int mode;  /* mode */
 
613
  unsigned int flags;
 
614
  unsigned int n_chan;  /* number of channels */
 
615
  unsigned int *chanlist;   /* channel/range list */
 
616
  <A
 
617
HREF="x3563.html#REF-TYPE-SAMPL-T"
 
618
>sampl_t</A
 
619
> *data;  /* data list, size depends on subd flags */
 
620
  unsigned int n;  /* number of scans */
 
621
  unsigned int trigsrc;
 
622
  unsigned int trigvar;
 
623
  unsigned int trigvar1;
 
624
  unsigned int data_len;
 
625
  unsigned int unused[3];
 
626
};</PRE
 
627
><P
 
628
>The comedi_trig structure is a control structure used by the
 
629
COMEDI_TRIG ioctl, an older method of communicating
 
630
instructions to the driver and hardware.  Use of comedi_trig is
 
631
deprecated, and should not be used in new applications.</P
 
632
></DIV
 
633
><DIV
 
634
CLASS="SECTION"
 
635
><H3
 
636
CLASS="SECTION"
 
637
><A
 
638
NAME="REF-TYPE-COMEDI-SV-T"
 
639
>7.3.7. comedi_sv_t</A
 
640
></H3
 
641
><PRE
 
642
CLASS="PROGRAMLISTING"
 
643
>typedef struct comedi_sv_struct comedi_sv_t;
 
644
 
 
645
struct comedi_sv_struct{
 
646
  comedi_t *dev;
 
647
  unsigned int subdevice;
 
648
  unsigned int chan;
 
649
 
 
650
  /* range policy */
 
651
  int range;
 
652
  int aref;
 
653
 
 
654
  /* number of measurements to average (for ai) */
 
655
  int n;
 
656
 
 
657
  <A
 
658
HREF="x3563.html#REF-TYPE-LSAMPL-T"
 
659
>lsampl_t</A
 
660
> maxdata;
 
661
};</PRE
 
662
><P
 
663
>The comedi_sv_t structure is used by the comedi_sv_*()
 
664
functions to provide a simple method of accurately measuring
 
665
slowly varying inputs.  See the relevant section for more
 
666
details.</P
 
667
></DIV
 
668
><DIV
 
669
CLASS="SECTION"
 
670
><H3
 
671
CLASS="SECTION"
 
672
><A
 
673
NAME="REF-TYPE-COMEDI-CMD"
 
674
>7.3.8. comedi_cmd</A
 
675
></H3
 
676
><PRE
 
677
CLASS="PROGRAMLISTING"
 
678
>typedef struct comedi_cmd_struct comedi_cmd;
 
679
 
 
680
struct comedi_cmd_struct{
 
681
  unsigned int subdev;
 
682
  unsigned int flags;
 
683
 
 
684
  unsigned int start_src;
 
685
  unsigned int start_arg;
 
686
 
 
687
  unsigned int scan_begin_src;
 
688
  unsigned int scan_begin_arg;
 
689
 
 
690
  unsigned int convert_src;
 
691
  unsigned int convert_arg;
 
692
 
 
693
  unsigned int scan_end_src;
 
694
  unsigned int scan_end_arg;
 
695
 
 
696
  unsigned int stop_src;
 
697
  unsigned int stop_arg;
 
698
 
 
699
  unsigned int *chanlist;
 
700
  unsigned int chanlist_len;
 
701
 
 
702
  <A
 
703
HREF="x3563.html#REF-TYPE-SAMPL-T"
 
704
>sampl_t</A
 
705
> *data;
 
706
  unsigned int data_len;
 
707
};</PRE
 
708
><P
 
709
>More information on using commands can be found in the
 
710
command section.</P
 
711
></DIV
 
712
><DIV
 
713
CLASS="SECTION"
 
714
><H3
 
715
CLASS="SECTION"
 
716
><A
 
717
NAME="REF-TYPE-COMEDI-INSN"
 
718
>7.3.9. comedi_insn</A
 
719
></H3
 
720
><PRE
 
721
CLASS="PROGRAMLISTING"
 
722
>typedef struct comedi_insn_struct comedi_insn;
 
723
 
 
724
struct comedi_insn_struct{
 
725
  unsigned int insn;
 
726
  unsigned int n;
 
727
  <A
 
728
HREF="x3563.html#REF-TYPE-LSAMPL-T"
 
729
>lsampl_t</A
 
730
>*data;
 
731
  unsigned int subdev;
 
732
  unsigned int chanspec;
 
733
  unsigned int unused[3];
 
734
};</PRE
 
735
><P
 
736
>Comedi instructions are described by the comedi_insn structure.
 
737
Applications send instructions to the driver in order to perform
 
738
control and measurement operations that are done immediately or
 
739
synchronously, i.e., the operations complete before program control
 
740
returns to the application.  In particular, instructions cannot
 
741
describe acquisition that involves timers or external events.</P
 
742
><P
 
743
>The field insn determines the type of instruction that is sent
 
744
to the driver. Valid instruction types are:</P
 
745
><P
 
746
></P
 
747
><DIV
 
748
CLASS="VARIABLELIST"
 
749
><DL
 
750
><DT
 
751
><A
 
752
NAME="INSN-READ"
 
753
></A
 
754
>
 
755
INSN_READ</DT
 
756
><DD
 
757
><P
 
758
>read values from an input channel
 
759
      </P
 
760
></DD
 
761
><DT
 
762
><A
 
763
NAME="INSN-WRITE"
 
764
></A
 
765
>
 
766
INSN_WRITE</DT
 
767
><DD
 
768
><P
 
769
>write values to an output channel
 
770
      </P
 
771
></DD
 
772
><DT
 
773
><A
 
774
NAME="INSN-BITS"
 
775
></A
 
776
>
 
777
INSN_BITS</DT
 
778
><DD
 
779
><P
 
780
>read/write values on multiple digital I/O channels
 
781
      </P
 
782
></DD
 
783
><DT
 
784
><A
 
785
NAME="INSN-CONFIG"
 
786
></A
 
787
>
 
788
INSN_CONFIG</DT
 
789
><DD
 
790
><P
 
791
>configure a subdevice
 
792
      </P
 
793
></DD
 
794
><DT
 
795
><A
 
796
NAME="INSN-GTOD"
 
797
></A
 
798
>
 
799
INSN_GTOD</DT
 
800
><DD
 
801
><P
 
802
>read a timestamp, identical to gettimeofday()
 
803
      </P
 
804
></DD
 
805
><DT
 
806
><A
 
807
NAME="INSN-WAIT"
 
808
></A
 
809
>
 
810
INSN_WAIT</DT
 
811
><DD
 
812
><P
 
813
>wait a specified number of nanoseconds
 
814
      </P
 
815
></DD
 
816
></DL
 
817
></DIV
 
818
><P
 
819
>The number of samples to read or write, or the size of the configuration
 
820
structure is specified by the field n, and the buffer for those
 
821
samples by data.  The field subdev is the subdevice index
 
822
that the instruction is sent to.  The field chanspec specifies
 
823
the channel, range, and analog reference (if applicable).</P
 
824
><P
 
825
>Instructions can be sent to drivers using comedi_do_insn().
 
826
Multiple instructions can be sent to drivers in the same system
 
827
call using comedi_do_insnlist().</P
 
828
></DIV
 
829
><DIV
 
830
CLASS="SECTION"
 
831
><H3
 
832
CLASS="SECTION"
 
833
><A
 
834
NAME="REF-TYPE-COMEDI-RANGE"
 
835
>7.3.10. comedi_range</A
 
836
></H3
 
837
><PRE
 
838
CLASS="PROGRAMLISTING"
 
839
>typedef struct comedi_range_struct comedi_range;
 
840
 
 
841
struct comedi_range_struct{
 
842
  double min;
 
843
  double max;
 
844
  unsigned int unit;
 
845
}comedi_range;</PRE
 
846
><P
 
847
>The comedi_range structure conveys part of the information
 
848
necessary to translate sample values to physical units, in particular,
 
849
the endpoints of the range and the physical unit type.  The
 
850
physical unit type is specified by the field unit, which may
 
851
take the values UNIT_volt for volts, UNIT_mA for milliamps,
 
852
or UNIT_none for unitless.  The endpoints are specified by
 
853
the fields min and max.</P
 
854
></DIV
 
855
><DIV
 
856
CLASS="SECTION"
 
857
><H3
 
858
CLASS="SECTION"
 
859
><A
 
860
NAME="REF-TYPE-COMEDI-KRANGE"
 
861
>7.3.11. comedi_krange</A
 
862
></H3
 
863
><PRE
 
864
CLASS="PROGRAMLISTING"
 
865
>typedef struct comedi_krange_struct comedi_krange;
 
866
 
 
867
struct comedi_krange_struct{
 
868
  int min;
 
869
  int max;
 
870
  unsigned int flags;
 
871
};</PRE
 
872
><P
 
873
>The comedi_krange structure is used to transfer range information
 
874
between the driver and Comedilib, and should not normally be used
 
875
by applications.  The structure conveys the same information as the
 
876
comedi_range structure, except the fields min and max
 
877
are integers, multiplied by a factor of 1000000 compared to the
 
878
counterparts in comedi_range.</P
 
879
><P
 
880
>In addition, kcomedilib uses the comedi_krange structure in place
 
881
of the comedi_range structure.</P
 
882
></DIV
 
883
><DIV
 
884
CLASS="SECTION"
 
885
><H3
 
886
CLASS="SECTION"
 
887
><A
 
888
NAME="REF-TYPE-COMEDI-INSNLIST"
 
889
>7.3.12. comedi_insnlist</A
 
890
></H3
 
891
><PRE
 
892
CLASS="PROGRAMLISTING"
 
893
>typedef struct comedi_insnlist_struct comedi_insnlist;
 
894
 
 
895
struct comedi_insnlist_struct{
 
896
  unsigned int n_insns;
 
897
  comedi_insn *insns;
 
898
};</PRE
 
899
><P
 
900
>An instruction list (insnlist) structure is used to communicate
 
901
a list of instructions.</P
 
902
></DIV
 
903
></DIV
 
904
><DIV
 
905
CLASS="SECTION"
 
906
><H2
 
907
CLASS="SECTION"
 
908
><A
 
909
NAME="FUNCTIONREFERENCE"
 
910
>7.4. Comedi Function Reference</A
 
911
></H2
 
912
><DIV
 
913
CLASS="TOC"
 
914
><DL
 
915
><DT
 
916
><B
 
917
>Table of Contents</B
 
918
></DT
 
919
><DT
 
920
><A
 
921
HREF="r3764.html"
 
922
>comedi_close</A
 
923
>&nbsp;--&nbsp;close a Comedi device</DT
 
924
><DT
 
925
><A
 
926
HREF="r3786.html"
 
927
>comedi_open</A
 
928
>&nbsp;--&nbsp;open a Comedi device</DT
 
929
><DT
 
930
><A
 
931
HREF="r3808.html"
 
932
>comedi_loglevel</A
 
933
>&nbsp;--&nbsp;change Comedilib logging properties</DT
 
934
><DT
 
935
><A
 
936
HREF="r3838.html"
 
937
>comedi_perror</A
 
938
>&nbsp;--&nbsp;print a Comedilib error message</DT
 
939
><DT
 
940
><A
 
941
HREF="r3859.html"
 
942
>comedi_strerror</A
 
943
>&nbsp;--&nbsp;return string describing Comedilib error code</DT
 
944
><DT
 
945
><A
 
946
HREF="r3880.html"
 
947
>comedi_errno</A
 
948
>&nbsp;--&nbsp;number of last Comedilib error</DT
 
949
><DT
 
950
><A
 
951
HREF="r3902.html"
 
952
>comedi_fileno</A
 
953
>&nbsp;--&nbsp;integer descriptor of Comedilib device</DT
 
954
><DT
 
955
><A
 
956
HREF="r3921.html"
 
957
>comedi_get_n_subdevices</A
 
958
>&nbsp;--&nbsp;number of subdevices </DT
 
959
><DT
 
960
><A
 
961
HREF="r3940.html"
 
962
>comedi_get_version_code</A
 
963
>&nbsp;--&nbsp;Comedi version code</DT
 
964
><DT
 
965
><A
 
966
HREF="r3961.html"
 
967
>comedi_get_driver_name</A
 
968
>&nbsp;--&nbsp;Comedi driver name</DT
 
969
><DT
 
970
><A
 
971
HREF="r3980.html"
 
972
>comedi_get_board_name</A
 
973
>&nbsp;--&nbsp;Comedi device name</DT
 
974
><DT
 
975
><A
 
976
HREF="r3999.html"
 
977
>comedi_get_subdevice_type</A
 
978
>&nbsp;--&nbsp;type of subdevice</DT
 
979
><DT
 
980
><A
 
981
HREF="r4020.html"
 
982
>comedi_find_subdevice_by_type</A
 
983
>&nbsp;--&nbsp;search for subdevice type</DT
 
984
><DT
 
985
><A
 
986
HREF="r4043.html"
 
987
>comedi_get_read_subdevice</A
 
988
>&nbsp;--&nbsp;find streaming input subdevice</DT
 
989
><DT
 
990
><A
 
991
HREF="r4062.html"
 
992
>comedi_get_write_subdevice</A
 
993
>&nbsp;--&nbsp;find streaming output subdevice</DT
 
994
><DT
 
995
><A
 
996
HREF="r4081.html"
 
997
>comedi_get_subdevice_flags</A
 
998
>&nbsp;--&nbsp;properties of subdevice</DT
 
999
><DT
 
1000
><A
 
1001
HREF="r4103.html"
 
1002
>comedi_get_n_channels</A
 
1003
>&nbsp;--&nbsp;number of subdevice channels</DT
 
1004
><DT
 
1005
><A
 
1006
HREF="r4124.html"
 
1007
>comedi_range_is_chan_specific</A
 
1008
>&nbsp;--&nbsp;range information depends on channel</DT
 
1009
><DT
 
1010
><A
 
1011
HREF="r4145.html"
 
1012
>comedi_maxdata_is_chan_specific</A
 
1013
>&nbsp;--&nbsp;maximum sample depends on channel</DT
 
1014
><DT
 
1015
><A
 
1016
HREF="r4166.html"
 
1017
>comedi_get_maxdata</A
 
1018
>&nbsp;--&nbsp;maximum sample of channel</DT
 
1019
><DT
 
1020
><A
 
1021
HREF="r4189.html"
 
1022
>comedi_get_n_ranges</A
 
1023
>&nbsp;--&nbsp;number of ranges of channel</DT
 
1024
><DT
 
1025
><A
 
1026
HREF="r4212.html"
 
1027
>comedi_get_range</A
 
1028
>&nbsp;--&nbsp;range information of channel</DT
 
1029
><DT
 
1030
><A
 
1031
HREF="r4237.html"
 
1032
>comedi_find_range</A
 
1033
>&nbsp;--&nbsp;search for range</DT
 
1034
><DT
 
1035
><A
 
1036
HREF="r4266.html"
 
1037
>comedi_get_buffer_size</A
 
1038
>&nbsp;--&nbsp;streaming buffer size of subdevice</DT
 
1039
><DT
 
1040
><A
 
1041
HREF="r4287.html"
 
1042
>comedi_get_max_buffer_size</A
 
1043
>&nbsp;--&nbsp;maximum streaming buffer size</DT
 
1044
><DT
 
1045
><A
 
1046
HREF="r4308.html"
 
1047
>comedi_set_buffer_size</A
 
1048
>&nbsp;--&nbsp;streaming buffer size of subdevice</DT
 
1049
><DT
 
1050
><A
 
1051
HREF="r4332.html"
 
1052
>comedi_trigger</A
 
1053
>&nbsp;--&nbsp;perform streaming input/output (deprecated)</DT
 
1054
><DT
 
1055
><A
 
1056
HREF="r4356.html"
 
1057
>comedi_do_insnlist</A
 
1058
>&nbsp;--&nbsp;perform multiple instructions</DT
 
1059
><DT
 
1060
><A
 
1061
HREF="r4381.html"
 
1062
>comedi_do_insn</A
 
1063
>&nbsp;--&nbsp;perform instruction</DT
 
1064
><DT
 
1065
><A
 
1066
HREF="r4402.html"
 
1067
>comedi_lock</A
 
1068
>&nbsp;--&nbsp;subdevice reservation</DT
 
1069
><DT
 
1070
><A
 
1071
HREF="r4423.html"
 
1072
>comedi_unlock</A
 
1073
>&nbsp;--&nbsp;subdevice reservation</DT
 
1074
><DT
 
1075
><A
 
1076
HREF="r4444.html"
 
1077
>comedi_to_phys</A
 
1078
>&nbsp;--&nbsp;convert sample to physical units</DT
 
1079
><DT
 
1080
><A
 
1081
HREF="r4469.html"
 
1082
>comedi_from_phys</A
 
1083
>&nbsp;--&nbsp;convert physical units to sample</DT
 
1084
><DT
 
1085
><A
 
1086
HREF="r4493.html"
 
1087
>comedi_data_read</A
 
1088
>&nbsp;--&nbsp;read single sample from channel</DT
 
1089
><DT
 
1090
><A
 
1091
HREF="r4526.html"
 
1092
>comedi_data_read_delayed</A
 
1093
>&nbsp;--&nbsp;read single sample from channel after delaying for specified settling time</DT
 
1094
><DT
 
1095
><A
 
1096
HREF="r4558.html"
 
1097
>comedi_data_read_hint</A
 
1098
>&nbsp;--&nbsp;tell driver which channel/range/aref you are going to read from next</DT
 
1099
><DT
 
1100
><A
 
1101
HREF="r4586.html"
 
1102
>comedi_data_write</A
 
1103
>&nbsp;--&nbsp;write single sample to channel</DT
 
1104
><DT
 
1105
><A
 
1106
HREF="r4617.html"
 
1107
>comedi_dio_config</A
 
1108
>&nbsp;--&nbsp;change input/output properties of channel</DT
 
1109
><DT
 
1110
><A
 
1111
HREF="r4644.html"
 
1112
>comedi_dio_read</A
 
1113
>&nbsp;--&nbsp;read single bit from digital channel</DT
 
1114
><DT
 
1115
><A
 
1116
HREF="r4670.html"
 
1117
>comedi_dio_write</A
 
1118
>&nbsp;--&nbsp;write single bit to digital channel</DT
 
1119
><DT
 
1120
><A
 
1121
HREF="r4696.html"
 
1122
>comedi_dio_bitfield</A
 
1123
>&nbsp;--&nbsp;read/write multiple digital channels</DT
 
1124
><DT
 
1125
><A
 
1126
HREF="r4721.html"
 
1127
>comedi_sv_init</A
 
1128
>&nbsp;--&nbsp;slowly-varying inputs</DT
 
1129
><DT
 
1130
><A
 
1131
HREF="r4749.html"
 
1132
>comedi_sv_update</A
 
1133
>&nbsp;--&nbsp;slowly-varying inputs</DT
 
1134
><DT
 
1135
><A
 
1136
HREF="r4771.html"
 
1137
>comedi_sv_measure</A
 
1138
>&nbsp;--&nbsp;slowly-varying inputs</DT
 
1139
><DT
 
1140
><A
 
1141
HREF="r4795.html"
 
1142
>comedi_get_cmd_src_mask</A
 
1143
>&nbsp;--&nbsp;streaming input/output capabilities</DT
 
1144
><DT
 
1145
><A
 
1146
HREF="r4818.html"
 
1147
>comedi_get_cmd_generic_timed</A
 
1148
>&nbsp;--&nbsp;streaming input/output capabilities</DT
 
1149
><DT
 
1150
><A
 
1151
HREF="r4843.html"
 
1152
>comedi_cancel</A
 
1153
>&nbsp;--&nbsp;stop streaming input/output in progress</DT
 
1154
><DT
 
1155
><A
 
1156
HREF="r4865.html"
 
1157
>comedi_command</A
 
1158
>&nbsp;--&nbsp;start streaming input/output</DT
 
1159
><DT
 
1160
><A
 
1161
HREF="r4887.html"
 
1162
>comedi_command_test</A
 
1163
>&nbsp;--&nbsp;test streaming input/output configuration</DT
 
1164
><DT
 
1165
><A
 
1166
HREF="r4915.html"
 
1167
>comedi_poll</A
 
1168
>&nbsp;--&nbsp;force updating of streaming buffer</DT
 
1169
><DT
 
1170
><A
 
1171
HREF="r4936.html"
 
1172
>comedi_set_max_buffer_size</A
 
1173
>&nbsp;--&nbsp;streaming buffer size of subdevice</DT
 
1174
><DT
 
1175
><A
 
1176
HREF="r4959.html"
 
1177
>comedi_get_buffer_contents</A
 
1178
>&nbsp;--&nbsp;streaming buffer status</DT
 
1179
><DT
 
1180
><A
 
1181
HREF="r4980.html"
 
1182
>comedi_mark_buffer_read</A
 
1183
>&nbsp;--&nbsp;streaming buffer status</DT
 
1184
><DT
 
1185
><A
 
1186
HREF="r5003.html"
 
1187
>comedi_get_buffer_offset</A
 
1188
>&nbsp;--&nbsp;streaming buffer status</DT
 
1189
><DT
 
1190
><A
 
1191
HREF="r5024.html"
 
1192
>comedi_get_timer</A
 
1193
>&nbsp;--&nbsp;timer information (deprecated)</DT
 
1194
><DT
 
1195
><A
 
1196
HREF="r5054.html"
 
1197
>comedi_timed_1chan</A
 
1198
>&nbsp;--&nbsp;streaming input (deprecated)</DT
 
1199
><DT
 
1200
><A
 
1201
HREF="r5090.html"
 
1202
>comedi_set_global_oor_behavior</A
 
1203
>&nbsp;--&nbsp;out-of-range behavior</DT
 
1204
><DT
 
1205
><A
 
1206
HREF="r5113.html"
 
1207
>comedi_apply_calibration</A
 
1208
>&nbsp;--&nbsp;set calibration from file</DT
 
1209
><DT
 
1210
><A
 
1211
HREF="r5153.html"
 
1212
>comedi_apply_parsed_calibration</A
 
1213
>&nbsp;--&nbsp;set calibration from memory</DT
 
1214
><DT
 
1215
><A
 
1216
HREF="r5190.html"
 
1217
>comedi_cleanup_calibration_file</A
 
1218
>&nbsp;--&nbsp;free calibration resources</DT
 
1219
><DT
 
1220
><A
 
1221
HREF="r5214.html"
 
1222
>comedi_get_default_calibration_path</A
 
1223
>&nbsp;--&nbsp;get default calibration file path</DT
 
1224
><DT
 
1225
><A
 
1226
HREF="r5240.html"
 
1227
>comedi_parse_calibration_file</A
 
1228
>&nbsp;--&nbsp;set calibration</DT
 
1229
></DL
 
1230
></DIV
 
1231
></DIV
 
1232
></DIV
 
1233
><DIV
 
1234
CLASS="NAVFOOTER"
 
1235
><HR
 
1236
ALIGN="LEFT"
 
1237
WIDTH="100%"><TABLE
 
1238
SUMMARY="Footer navigation table"
 
1239
WIDTH="100%"
 
1240
BORDER="0"
 
1241
CELLPADDING="0"
 
1242
CELLSPACING="0"
 
1243
><TR
 
1244
><TD
 
1245
WIDTH="33%"
 
1246
ALIGN="left"
 
1247
VALIGN="top"
 
1248
><A
 
1249
HREF="x1672.html"
 
1250
ACCESSKEY="P"
 
1251
>Prev</A
 
1252
></TD
 
1253
><TD
 
1254
WIDTH="34%"
 
1255
ALIGN="center"
 
1256
VALIGN="top"
 
1257
><A
 
1258
HREF="index.html"
 
1259
ACCESSKEY="H"
 
1260
>Home</A
 
1261
></TD
 
1262
><TD
 
1263
WIDTH="33%"
 
1264
ALIGN="right"
 
1265
VALIGN="top"
 
1266
><A
 
1267
HREF="r3764.html"
 
1268
ACCESSKEY="N"
 
1269
>Next</A
 
1270
></TD
 
1271
></TR
 
1272
><TR
 
1273
><TD
 
1274
WIDTH="33%"
 
1275
ALIGN="left"
 
1276
VALIGN="top"
 
1277
>Low-level drivers</TD
 
1278
><TD
 
1279
WIDTH="34%"
 
1280
ALIGN="center"
 
1281
VALIGN="top"
 
1282
>&nbsp;</TD
 
1283
><TD
 
1284
WIDTH="33%"
 
1285
ALIGN="right"
 
1286
VALIGN="top"
 
1287
>comedi_close</TD
 
1288
></TR
 
1289
></TABLE
 
1290
></DIV
 
1291
></BODY
 
1292
></HTML
 
1293
>
 
 
b'\\ No newline at end of file'