This file is indexed.

/usr/share/doc/libcomedi-dev/html/x4629.html is in libcomedi-dev 0.8.1-5ubuntu6.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

   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
  91
  92
  93
  94
  95
  96
  97
  98
  99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
 135
 136
 137
 138
 139
 140
 141
 142
 143
 144
 145
 146
 147
 148
 149
 150
 151
 152
 153
 154
 155
 156
 157
 158
 159
 160
 161
 162
 163
 164
 165
 166
 167
 168
 169
 170
 171
 172
 173
 174
 175
 176
 177
 178
 179
 180
 181
 182
 183
 184
 185
 186
 187
 188
 189
 190
 191
 192
 193
 194
 195
 196
 197
 198
 199
 200
 201
 202
 203
 204
 205
 206
 207
 208
 209
 210
 211
 212
 213
 214
 215
 216
 217
 218
 219
 220
 221
 222
 223
 224
 225
 226
 227
 228
 229
 230
 231
 232
 233
 234
 235
 236
 237
 238
 239
 240
 241
 242
 243
 244
 245
 246
 247
 248
 249
 250
 251
 252
 253
 254
 255
 256
 257
 258
 259
 260
 261
 262
 263
 264
 265
 266
 267
 268
 269
 270
 271
 272
 273
 274
 275
 276
 277
 278
 279
 280
 281
 282
 283
 284
 285
 286
 287
 288
 289
 290
 291
 292
 293
 294
 295
 296
 297
 298
 299
 300
 301
 302
 303
 304
 305
 306
 307
 308
 309
 310
 311
 312
 313
 314
 315
 316
 317
 318
 319
 320
 321
 322
 323
 324
 325
 326
 327
 328
 329
 330
 331
 332
 333
 334
 335
 336
 337
 338
 339
 340
 341
 342
 343
 344
 345
 346
 347
 348
 349
 350
 351
 352
 353
 354
 355
 356
 357
 358
 359
 360
 361
 362
 363
 364
 365
 366
 367
 368
 369
 370
 371
 372
 373
 374
 375
 376
 377
 378
 379
 380
 381
 382
 383
 384
 385
 386
 387
 388
 389
 390
 391
 392
 393
 394
 395
 396
 397
 398
 399
 400
 401
 402
 403
 404
 405
 406
 407
 408
 409
 410
 411
 412
 413
 414
 415
 416
 417
 418
 419
 420
 421
 422
 423
 424
 425
 426
 427
 428
 429
 430
 431
 432
 433
 434
 435
 436
 437
 438
 439
 440
 441
 442
 443
 444
 445
 446
 447
 448
 449
 450
 451
 452
 453
 454
 455
 456
 457
 458
 459
 460
 461
 462
 463
 464
 465
 466
 467
 468
 469
 470
 471
 472
 473
 474
 475
 476
 477
 478
 479
 480
 481
 482
 483
 484
 485
 486
 487
 488
 489
 490
 491
 492
 493
 494
 495
 496
 497
 498
 499
 500
 501
 502
 503
 504
 505
 506
 507
 508
 509
 510
 511
 512
 513
 514
 515
 516
 517
 518
 519
 520
 521
 522
 523
 524
 525
 526
 527
 528
 529
 530
 531
 532
 533
 534
 535
 536
 537
 538
 539
 540
 541
 542
 543
 544
 545
 546
 547
 548
 549
 550
 551
 552
 553
 554
 555
 556
 557
 558
 559
 560
 561
 562
 563
 564
 565
 566
 567
 568
 569
 570
 571
 572
 573
 574
 575
 576
 577
 578
 579
 580
 581
 582
 583
 584
 585
 586
 587
 588
 589
 590
 591
 592
 593
 594
 595
 596
 597
 598
 599
 600
 601
 602
 603
 604
 605
 606
 607
 608
 609
 610
 611
 612
 613
 614
 615
 616
 617
 618
 619
 620
 621
 622
 623
 624
 625
 626
 627
 628
 629
 630
 631
 632
 633
 634
 635
 636
 637
 638
 639
 640
 641
 642
 643
 644
 645
 646
 647
 648
 649
 650
 651
 652
 653
 654
 655
 656
 657
 658
 659
 660
 661
 662
 663
 664
 665
 666
 667
 668
 669
 670
 671
 672
 673
 674
 675
 676
 677
 678
 679
 680
 681
 682
 683
 684
 685
 686
 687
 688
 689
 690
 691
 692
 693
 694
 695
 696
 697
 698
 699
 700
 701
 702
 703
 704
 705
 706
 707
 708
 709
 710
 711
 712
 713
 714
 715
 716
 717
 718
 719
 720
 721
 722
 723
 724
 725
 726
 727
 728
 729
 730
 731
 732
 733
 734
 735
 736
 737
 738
 739
 740
 741
 742
 743
 744
 745
 746
 747
 748
 749
 750
 751
 752
 753
 754
 755
 756
 757
 758
 759
 760
 761
 762
 763
 764
 765
 766
 767
 768
 769
 770
 771
 772
 773
 774
 775
 776
 777
 778
 779
 780
 781
 782
 783
 784
 785
 786
 787
 788
 789
 790
 791
 792
 793
 794
 795
 796
 797
 798
 799
 800
 801
 802
 803
 804
 805
 806
 807
 808
 809
 810
 811
 812
 813
 814
 815
 816
 817
 818
 819
 820
 821
 822
 823
 824
 825
 826
 827
 828
 829
 830
 831
 832
 833
 834
 835
 836
 837
 838
 839
 840
 841
 842
 843
 844
 845
 846
 847
 848
 849
 850
 851
 852
 853
 854
 855
 856
 857
 858
 859
 860
 861
 862
 863
 864
 865
 866
 867
 868
 869
 870
 871
 872
 873
 874
 875
 876
 877
 878
 879
 880
 881
 882
 883
 884
 885
 886
 887
 888
 889
 890
 891
 892
 893
 894
 895
 896
 897
 898
 899
 900
 901
 902
 903
 904
 905
 906
 907
 908
 909
 910
 911
 912
 913
 914
 915
 916
 917
 918
 919
 920
 921
 922
 923
 924
 925
 926
 927
 928
 929
 930
 931
 932
 933
 934
 935
 936
 937
 938
 939
 940
 941
 942
 943
 944
 945
 946
 947
 948
 949
 950
 951
 952
 953
 954
 955
 956
 957
 958
 959
 960
 961
 962
 963
 964
 965
 966
 967
 968
 969
 970
 971
 972
 973
 974
 975
 976
 977
 978
 979
 980
 981
 982
 983
 984
 985
 986
 987
 988
 989
 990
 991
 992
 993
 994
 995
 996
 997
 998
 999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
<HTML
><HEAD
><TITLE
>    Comedi Reference
  </TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
REL="HOME"
TITLE="    Comedi
  "
HREF="index.html"><LINK
REL="PREVIOUS"
TITLE="    Low-level drivers
  "
HREF="x1781.html"><LINK
REL="NEXT"
TITLE="comedi_close"
HREF="r4835.html"></HEAD
><BODY
CLASS="SECTION"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>Comedi: The <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>Control and Measurement Device Interface</I
></SPAN
>
handbook
  </TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="x1781.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="r4835.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="SECTION"
><H1
CLASS="SECTION"
><A
NAME="COMEDIREFERENCE"
>7. <ACRONYM
CLASS="ACRONYM"
>Comedi</ACRONYM
> Reference</A
></H1
><P
>    Reference for
  <A
HREF="x4629.html#CONSTANTSMACROS"
>constants and macros</A
>,
  <A
HREF="x4629.html#DATATYPESSTRUCTURES"
>data types and structures</A
>,
  and <A
HREF="x4629.html#FUNCTIONREFERENCE"
>functions</A
>.
  </P
><DIV
CLASS="SECTION"
><H2
CLASS="SECTION"
><A
NAME="COMEDI-COMEDILIB-H"
>7.1. Headerfiles: <TT
CLASS="FILENAME"
>comedi.h</TT
> and <TT
CLASS="FILENAME"
>comedilib.h</TT
></A
></H2
><P
>All <A
HREF="x403.html"
>application programs</A
> must
include the header file <TT
CLASS="FILENAME"
>comedilib.h</TT
>. (This file
itself includes <TT
CLASS="FILENAME"
>comedi.h</TT
>.) They contain the full
interface of <ACRONYM
CLASS="ACRONYM"
>Comedi</ACRONYM
>: defines, function prototypes, data structures.</P
><P
>The following Sections give more details.</P
></DIV
><DIV
CLASS="SECTION"
><H2
CLASS="SECTION"
><A
NAME="CONSTANTSMACROS"
>7.2. Constants and Macros</A
></H2
><DIV
CLASS="SECTION"
><H3
CLASS="SECTION"
><A
NAME="REF-MACRO-CR-PACK"
>7.2.1. CR_PACK</A
></H3
><P
>CR_PACK is used to initialize the elements of the
<CODE
CLASS="PARAMETER"
>chanlist</CODE
> array in the
<A
HREF="x4629.html#REF-TYPE-COMEDI-CMD"
>comedi_cmd</A
> data structure,
and the <CODE
CLASS="PARAMETER"
>chanspec</CODE
> member of the
<A
HREF="x4629.html#REF-TYPE-COMEDI-INSN"
>comedi_insn</A
> structure.</P
><PRE
CLASS="PROGRAMLISTING"
>#define CR_PACK(chan,rng,aref)      ( (((aref)&#38;0x3)&#60;&#60;24) | (((rng)&#38;0xff)&#60;&#60;16) | (chan) )</PRE
><P
>The <CODE
CLASS="PARAMETER"
>chan</CODE
> argument is the channel you wish to
use, with the channel numbering starting at zero.</P
><P
>The range <CODE
CLASS="PARAMETER"
>rng</CODE
> is an index, starting at zero,
whose meaning is device dependent.  The
<A
HREF="r5360.html"
>comedi_get_n_ranges()</A
>
and
<A
HREF="r5383.html"
>comedi_get_range()</A
>
functions are useful in discovering information about the available
ranges.</P
><P
>The <CODE
CLASS="PARAMETER"
>aref</CODE
> argument indicates what reference you
want the device to use.  It can be any of the following:
<P
></P
><DIV
CLASS="VARIABLELIST"
><DL
><DT
>AREF_GROUND <A
NAME="AREF-GROUND"
></A
></DT
><DD
><P
>        is for inputs/outputs referenced to ground.
      </P
></DD
><DT
>AREF_COMMON <A
NAME="AREF-COMMON"
></A
></DT
><DD
><P
>	 is for a <SPAN
CLASS="QUOTE"
>"common"</SPAN
> reference (the low inputs of all the
channels are tied together, but are isolated from ground).
      </P
></DD
><DT
>AREF_DIFF <A
NAME="AREF-DIFF"
></A
></DT
><DD
><P
>    is for differential inputs/outputs.
      </P
></DD
><DT
>AREF_OTHER <A
NAME="AREF-OTHER"
></A
></DT
><DD
><P
>    is for any reference that does not fit into the above categories.
      </P
></DD
></DL
></DIV
>
Particular drivers may or may not use the AREF flags.  If they are
not supported, they are silently ignored.</P
></DIV
><DIV
CLASS="SECTION"
><H3
CLASS="SECTION"
><A
NAME="REF-MACRO-RANGE-LENGTH"
>7.2.2. RANGE_LENGTH (deprecated)</A
></H3
><P
>Rangetype values are library-internal tokens that represent an
array of range information structures.  These numbers are primarily
used for communication between the kernel and library.</P
><P
>The RANGE_LENGTH() macro returns the length of the array that is
specified by the rangetype token.</P
><P
>The RANGE_LENGTH() macro is deprecated, and should not be used in
new applications.  It is scheduled to be removed from the header
file at version 1.0.  Binary compatibility may be broken for version
1.1.</P
></DIV
><DIV
CLASS="SECTION"
><H3
CLASS="SECTION"
><A
NAME="REF-ENUM-COMEDI-CONVERSION-DIRECTION"
>7.2.3. enum comedi_conversion_direction</A
></H3
><P
><PRE
CLASS="PROGRAMLISTING"
>enum comedi_conversion_direction
{
	COMEDI_TO_PHYSICAL,
	COMEDI_FROM_PHYSICAL
};</PRE
></P
><P
>A comedi_conversion_direction is used to choose between converting data
from Comedi's integer sample values to a physical value (COMEDI_TO_PHYSICAL),
and converting from a physical value to Comedi's integer sample values (COMEDI_FROM_PHYSICAL).</P
></DIV
></DIV
><DIV
CLASS="SECTION"
><H2
CLASS="SECTION"
><A
NAME="DATATYPESSTRUCTURES"
>7.3. Data Types and Structures</A
></H2
><P
>This Section explains the data structures that users of the <ACRONYM
CLASS="ACRONYM"
>Comedi</ACRONYM
>
API are confronted with:
<PRE
CLASS="PROGRAMLISTING"
>typedef struct subdevice_struct       <A
HREF="x4629.html#REF-TYPE-SUBDEVICE-STRUCT"
>subdevice_struct</A
>:
typedef struct comedi_devinfo_struct  <A
HREF="x4629.html#REF-TYPE-COMEDI-DEVINFO"
>comedi_devinfo</A
>;
typedef struct comedi_t_struct        <A
HREF="x4629.html#REF-TYPE-COMEDI-T"
>comedi_t</A
>;
typedef struct sampl_t_struct         <A
HREF="x4629.html#REF-TYPE-SAMPL-T"
>sampl_t</A
>;
typedef struct lsampl_t_struct        <A
HREF="x4629.html#REF-TYPE-LSAMPL-T"
>lsampl_t</A
>;
typedef struct comedi_sv_t_struct     <A
HREF="x4629.html#REF-TYPE-COMEDI-SV-T"
>comedi_sv_t</A
>;
typedef struct comedi_cmd_struct      <A
HREF="x4629.html#REF-TYPE-COMEDI-CMD"
>comedi_cmd</A
>;
typedef struct comedi_insn_struct     <A
HREF="x4629.html#REF-TYPE-COMEDI-INSN"
>comedi_insn</A
>;
typedef struct comedi_range_struct    <A
HREF="x4629.html#REF-TYPE-COMEDI-RANGE"
>comedi_range</A
>;
typedef struct comedi_krange_struct   <A
HREF="x4629.html#REF-TYPE-COMEDI-KRANGE"
>comedi_krange</A
>;
typedef struct comedi_insnlist_struct <A
HREF="x4629.html#REF-TYPE-COMEDI-INSNLIST"
>comedi_insnlist</A
>;</PRE
>
The data structures used in the implementation of the <ACRONYM
CLASS="ACRONYM"
>Comedi</ACRONYM
> drivers
are treated <A
HREF="x1394.html#DRIVERDATASTRUCTURES"
>elsewhere</A
>.</P
><DIV
CLASS="SECTION"
><H3
CLASS="SECTION"
><A
NAME="REF-TYPE-SUBDEVICE-STRUCT"
>7.3.1. subdevice_struct</A
></H3
><P
>The data type <CODE
CLASS="PARAMETER"
>subdevice_struct</CODE
> is used to store
information about a subdevice. This structure is usually filled in
automatically when the driver is loaded (<SPAN
CLASS="QUOTE"
>"attached"</SPAN
>), so
programmers need not access this data structure directly.
<PRE
CLASS="PROGRAMLISTING"
>typedef struct subdevice_struct <A
NAME="REF-TYPE-SUBDEVICE"
></A
>subdevice;

struct subdevice_struct{
  unsigned int type;
  unsigned int n_chan;
  unsigned int subd_flags;
  unsigned int timer_type;
  unsigned int len_chanlist;
  <A
HREF="x4629.html#REF-TYPE-LSAMPL-T"
>lsampl_t</A
> maxdata;
  unsigned int flags;
  unsigned int range_type;

  <A
HREF="x4629.html#REF-TYPE-LSAMPL-T"
>lsampl_t</A
> *maxdata_list;
  unsigned int *range_type_list;
  unsigned int *flags_list;

  <A
HREF="x4629.html#REF-TYPE-COMEDI-RANGE"
>comedi_range</A
> *rangeinfo;
  <A
HREF="x4629.html#REF-TYPE-COMEDI-RANGE"
>ccomedi_range</A
> **rangeinfo_list;

  unsigned int has_cmd;
  unsigned int has_insn_bits;

  int cmd_mask_errno;
  <A
HREF="x4629.html#REF-TYPE-COMEDI-CMD"
>comedi_cmd</A
> *cmd_mask;
  int cmd_timed_errno;
  <A
HREF="x4629.html#REF-TYPE-COMEDI-CMD"
>comedi_cmd</A
> *cmd_timed;
};</PRE
>&#13;</P
></DIV
><DIV
CLASS="SECTION"
><H3
CLASS="SECTION"
><A
NAME="REF-TYPE-COMEDI-DEVINFO"
>7.3.2. comedi_devinfo</A
></H3
><P
>The data type <CODE
CLASS="PARAMETER"
>comedi_devinfo</CODE
> is used to store
information about a device. This structure is usually filled in
automatically when the driver is loaded (<SPAN
CLASS="QUOTE"
>"attached"</SPAN
>), so
programmers need not access this data structure directly.
<PRE
CLASS="PROGRAMLISTING"
>typedef struct comedi_devinfo_struct comedi_devinfo;

struct comedi_devinfo_struct{
  unsigned int version_code;    // version number of the Comedi code
  unsigned int n_subdevs;       // number of subdevices on this device
  char         driver_name[COMEDI_NAMELEN];
  char         board_name[COMEDI_NAMELEN];
  int          read_subdevice;  // index of subdevice whose buffer is read by read(), etc. on file descriptor from comedi_fileno() (negative means none)
  int          write_subdevice; // index of subdevice whose buffer is written by write(), etc. on file descriptor from comedi_fileno() (negatove means none).
  int          unused[30];
};&#13;</PRE
></P
></DIV
><DIV
CLASS="SECTION"
><H3
CLASS="SECTION"
><A
NAME="REF-TYPE-COMEDI-T"
>7.3.3. comedi_t</A
></H3
><P
>The data type <CODE
CLASS="PARAMETER"
>comedi_t</CODE
> is used to represent an
open <ACRONYM
CLASS="ACRONYM"
>Comedi</ACRONYM
> device:
<PRE
CLASS="PROGRAMLISTING"
>typedef struct comedi_t_struct comedi_t;

struct comedi_t_struct{
  int magic;        // driver-specific magic number, for identification
  int fd;           // file descriptor, for open() and close()
  int n_subdevices; // number of subdevices on this device
  <A
HREF="x4629.html#REF-TYPE-COMEDI-DEVINFO"
>comedi_devinfo</A
> devinfo;
  <A
HREF="x4629.html#REF-TYPE-SUBDEVICE"
>subdevice</A
> *subdevices; // pointer to subdevice list
                         // filled in automatically at load time
  unsigned int has_insnlist_ioctl; // can process <A
HREF="x621.html#ANCHOR.INSTRUCTION.LIST"
>instruction lists</A
>
  unsigned int has_insn_ioctl;     // can process <A
HREF="x621.html#INSTRUCTIONS"
>instructions</A
>
};</PRE
>
A valid <CODE
CLASS="PARAMETER"
>comedi_t</CODE
> pointer is returned by a
successful call to
<A
HREF="r4857.html"
>comedi_open()</A
>,
and should be used for subsequent access to the device.
It is a transparent type, and pointers to type
<CODE
CLASS="PARAMETER"
>comedi_t</CODE
>
should not be dereferenced by the application.</P
></DIV
><DIV
CLASS="SECTION"
><H3
CLASS="SECTION"
><A
NAME="REF-TYPE-SAMPL-T"
>7.3.4. sampl_t</A
></H3
><PRE
CLASS="PROGRAMLISTING"
>typedef unsigned short sampl_t;</PRE
><P
>The data type <A
HREF="x4629.html#REF-TYPE-SAMPL-T"
>sampl_t</A
> is one
of the generic
types used to represent data values in Comedilib.  It is used in a few
places where a data type
shorter than <A
HREF="x4629.html#REF-TYPE-LSAMPL-T"
>lsampl_t</A
> is
useful.  On most architectures,
<A
HREF="x4629.html#REF-TYPE-SAMPL-T"
>sampl_t</A
>
is defined to be <CODE
CLASS="PARAMETER"
>uint16</CODE
>.</P
><P
>Most drivers represent data transferred by <CODE
CLASS="FUNCTION"
>read()</CODE
> and
<CODE
CLASS="FUNCTION"
>write()</CODE
> using
<A
HREF="x4629.html#REF-TYPE-SAMPL-T"
>sampl_t</A
>.
Applications should check the subdevice flag
SDF_LSAMPL to determine if the subdevice uses
<A
HREF="x4629.html#REF-TYPE-SAMPL-T"
>sampl_t</A
> or
<A
HREF="x4629.html#REF-TYPE-LSAMPL-T"
>lsampl_t</A
>.</P
></DIV
><DIV
CLASS="SECTION"
><H3
CLASS="SECTION"
><A
NAME="REF-TYPE-LSAMPL-T"
>7.3.5. lsampl_t</A
></H3
><PRE
CLASS="PROGRAMLISTING"
>typedef unsigned int lsampl_t;</PRE
><P
>The data type
<A
HREF="x4629.html#REF-TYPE-LSAMPL-T"
>lsampl_t</A
>
is the data type typically used to represent
data values in libcomedi.  On most architectures,
<A
HREF="x4629.html#REF-TYPE-LSAMPL-T"
>lsampl_t</A
>
is defined to be uint32.</P
></DIV
><DIV
CLASS="SECTION"
><H3
CLASS="SECTION"
><A
NAME="REF-TYPE-COMEDI-TRIG"
>7.3.6. comedi_trig (deprecated)</A
></H3
><PRE
CLASS="PROGRAMLISTING"
>typedef struct comedi_trig_struct comedi_trig;

struct comedi_trig_struct{
  unsigned int subdev;   /* subdevice */
  unsigned int mode;  /* mode */
  unsigned int flags;
  unsigned int n_chan;  /* number of channels */
  unsigned int *chanlist;   /* channel/range list */
  <A
HREF="x4629.html#REF-TYPE-SAMPL-T"
>sampl_t</A
> *data;  /* data list, size depends on subd flags */
  unsigned int n;  /* number of scans */
  unsigned int trigsrc;
  unsigned int trigvar;
  unsigned int trigvar1;
  unsigned int data_len;
  unsigned int unused[3];
};</PRE
><P
>The comedi_trig structure is a control structure used by the
COMEDI_TRIG ioctl, an older method of communicating
instructions to the driver and hardware.  Use of comedi_trig is
deprecated, and should not be used in new applications.</P
></DIV
><DIV
CLASS="SECTION"
><H3
CLASS="SECTION"
><A
NAME="REF-TYPE-COMEDI-SV-T"
>7.3.7. comedi_sv_t</A
></H3
><PRE
CLASS="PROGRAMLISTING"
>typedef struct comedi_sv_struct comedi_sv_t;

struct comedi_sv_struct{
  comedi_t *dev;
  unsigned int subdevice;
  unsigned int chan;

  /* range policy */
  int range;
  int aref;

  /* number of measurements to average (for ai) */
  int n;

  <A
HREF="x4629.html#REF-TYPE-LSAMPL-T"
>lsampl_t</A
> maxdata;
};</PRE
><P
>The comedi_sv_t structure is used by the comedi_sv_*()
functions to provide a simple method of accurately measuring
slowly varying inputs.  See the relevant section for more
details.</P
></DIV
><DIV
CLASS="SECTION"
><H3
CLASS="SECTION"
><A
NAME="REF-TYPE-COMEDI-CMD"
>7.3.8. comedi_cmd</A
></H3
><PRE
CLASS="PROGRAMLISTING"
>typedef struct comedi_cmd_struct comedi_cmd;

struct comedi_cmd_struct{
  unsigned int subdev;
  unsigned int flags;

  unsigned int start_src;
  unsigned int start_arg;

  unsigned int scan_begin_src;
  unsigned int scan_begin_arg;

  unsigned int convert_src;
  unsigned int convert_arg;

  unsigned int scan_end_src;
  unsigned int scan_end_arg;

  unsigned int stop_src;
  unsigned int stop_arg;

  unsigned int *chanlist;
  unsigned int chanlist_len;

  <A
HREF="x4629.html#REF-TYPE-SAMPL-T"
>sampl_t</A
> *data;
  unsigned int data_len;
};</PRE
><P
>More information on using commands can be found in the
command section.</P
></DIV
><DIV
CLASS="SECTION"
><H3
CLASS="SECTION"
><A
NAME="REF-TYPE-COMEDI-INSN"
>7.3.9. comedi_insn</A
></H3
><PRE
CLASS="PROGRAMLISTING"
>typedef struct comedi_insn_struct comedi_insn;

struct comedi_insn_struct{
  unsigned int insn;
  unsigned int n;
  <A
HREF="x4629.html#REF-TYPE-LSAMPL-T"
>lsampl_t</A
>*data;
  unsigned int subdev;
  unsigned int chanspec;
  unsigned int unused[3];
};</PRE
><P
>Comedi instructions are described by the comedi_insn structure.
Applications send instructions to the driver in order to perform
control and measurement operations that are done immediately or
synchronously, i.e., the operations complete before program control
returns to the application.  In particular, instructions cannot
describe acquisition that involves timers or external events.</P
><P
>The field insn determines the type of instruction that is sent
to the driver. Valid instruction types are:</P
><P
></P
><DIV
CLASS="VARIABLELIST"
><DL
><DT
><A
NAME="INSN-READ"
></A
>
INSN_READ</DT
><DD
><P
>read values from an input channel
      </P
></DD
><DT
><A
NAME="INSN-WRITE"
></A
>
INSN_WRITE</DT
><DD
><P
>write values to an output channel
      </P
></DD
><DT
><A
NAME="INSN-BITS"
></A
>
INSN_BITS</DT
><DD
><P
>read/write values on multiple digital I/O channels
      </P
></DD
><DT
><A
NAME="INSN-CONFIG"
></A
>
INSN_CONFIG</DT
><DD
><P
>configure a subdevice
      </P
></DD
><DT
><A
NAME="INSN-GTOD"
></A
>
INSN_GTOD</DT
><DD
><P
>read a timestamp, identical to gettimeofday()
      </P
></DD
><DT
><A
NAME="INSN-WAIT"
></A
>
INSN_WAIT</DT
><DD
><P
>wait a specified number of nanoseconds
      </P
></DD
></DL
></DIV
><P
>The number of samples to read or write, or the size of the configuration
structure is specified by the field n, and the buffer for those
samples by data.  The field subdev is the subdevice index
that the instruction is sent to.  The field chanspec specifies
the channel, range, and analog reference (if applicable).</P
><P
>Instructions can be sent to drivers using comedi_do_insn().
Multiple instructions can be sent to drivers in the same system
call using comedi_do_insnlist().</P
></DIV
><DIV
CLASS="SECTION"
><H3
CLASS="SECTION"
><A
NAME="REF-TYPE-COMEDI-RANGE"
>7.3.10. comedi_range</A
></H3
><PRE
CLASS="PROGRAMLISTING"
>typedef struct comedi_range_struct comedi_range;

struct comedi_range_struct{
  double min;
  double max;
  unsigned int unit;
}comedi_range;</PRE
><P
>The comedi_range structure conveys part of the information
necessary to translate sample values to physical units, in particular,
the endpoints of the range and the physical unit type.  The
physical unit type is specified by the field unit, which may
take the values UNIT_volt for volts, UNIT_mA for milliamps,
or UNIT_none for unitless.  The endpoints are specified by
the fields min and max.</P
></DIV
><DIV
CLASS="SECTION"
><H3
CLASS="SECTION"
><A
NAME="REF-TYPE-COMEDI-KRANGE"
>7.3.11. comedi_krange</A
></H3
><PRE
CLASS="PROGRAMLISTING"
>typedef struct comedi_krange_struct comedi_krange;

struct comedi_krange_struct{
  int min;
  int max;
  unsigned int flags;
};</PRE
><P
>The comedi_krange structure is used to transfer range information
between the driver and Comedilib, and should not normally be used
by applications.  The structure conveys the same information as the
comedi_range structure, except the fields min and max
are integers, multiplied by a factor of 1000000 compared to the
counterparts in comedi_range.</P
><P
>In addition, kcomedilib uses the comedi_krange structure in place
of the comedi_range structure.</P
></DIV
><DIV
CLASS="SECTION"
><H3
CLASS="SECTION"
><A
NAME="REF-TYPE-COMEDI-INSNLIST"
>7.3.12. comedi_insnlist</A
></H3
><PRE
CLASS="PROGRAMLISTING"
>typedef struct comedi_insnlist_struct comedi_insnlist;

struct comedi_insnlist_struct{
  unsigned int n_insns;
  comedi_insn *insns;
};</PRE
><P
>An instruction list (insnlist) structure is used to communicate
a list of instructions.</P
></DIV
></DIV
><DIV
CLASS="SECTION"
><H2
CLASS="SECTION"
><A
NAME="FUNCTIONREFERENCE"
>7.4. Comedi Function Reference</A
></H2
><DIV
CLASS="TOC"
><DL
><DT
><B
>Table of Contents</B
></DT
><DT
><A
HREF="r4835.html"
>comedi_close</A
>&nbsp;--&nbsp;close a Comedi device</DT
><DT
><A
HREF="r4857.html"
>comedi_open</A
>&nbsp;--&nbsp;open a Comedi device</DT
><DT
><A
HREF="r4879.html"
>comedi_loglevel</A
>&nbsp;--&nbsp;change Comedilib logging properties</DT
><DT
><A
HREF="r4909.html"
>comedi_perror</A
>&nbsp;--&nbsp;print a Comedilib error message</DT
><DT
><A
HREF="r4930.html"
>comedi_strerror</A
>&nbsp;--&nbsp;return string describing Comedilib error code</DT
><DT
><A
HREF="r4951.html"
>comedi_errno</A
>&nbsp;--&nbsp;number of last Comedilib error</DT
><DT
><A
HREF="r4973.html"
>comedi_fileno</A
>&nbsp;--&nbsp;integer descriptor of Comedilib device</DT
><DT
><A
HREF="r4992.html"
>comedi_get_n_subdevices</A
>&nbsp;--&nbsp;number of subdevices</DT
><DT
><A
HREF="r5011.html"
>comedi_get_version_code</A
>&nbsp;--&nbsp;Comedi version code</DT
><DT
><A
HREF="r5032.html"
>comedi_get_driver_name</A
>&nbsp;--&nbsp;Comedi driver name</DT
><DT
><A
HREF="r5051.html"
>comedi_get_board_name</A
>&nbsp;--&nbsp;Comedi device name</DT
><DT
><A
HREF="r5070.html"
>comedi_get_subdevice_type</A
>&nbsp;--&nbsp;type of subdevice</DT
><DT
><A
HREF="r5092.html"
>comedi_find_subdevice_by_type</A
>&nbsp;--&nbsp;search for subdevice type</DT
><DT
><A
HREF="r5115.html"
>comedi_get_read_subdevice</A
>&nbsp;--&nbsp;find streaming input subdevice</DT
><DT
><A
HREF="r5134.html"
>comedi_get_write_subdevice</A
>&nbsp;--&nbsp;find streaming output subdevice</DT
><DT
><A
HREF="r5153.html"
>comedi_get_subdevice_flags</A
>&nbsp;--&nbsp;properties of subdevice</DT
><DT
><A
HREF="r5268.html"
>comedi_get_n_channels</A
>&nbsp;--&nbsp;number of subdevice channels</DT
><DT
><A
HREF="r5289.html"
>comedi_range_is_chan_specific</A
>&nbsp;--&nbsp;range information depends on channel</DT
><DT
><A
HREF="r5310.html"
>comedi_maxdata_is_chan_specific</A
>&nbsp;--&nbsp;maximum sample depends on channel</DT
><DT
><A
HREF="r5331.html"
>comedi_get_maxdata</A
>&nbsp;--&nbsp;maximum sample of channel</DT
><DT
><A
HREF="r5360.html"
>comedi_get_n_ranges</A
>&nbsp;--&nbsp;number of ranges of channel</DT
><DT
><A
HREF="r5383.html"
>comedi_get_range</A
>&nbsp;--&nbsp;range information of channel</DT
><DT
><A
HREF="r5408.html"
>comedi_find_range</A
>&nbsp;--&nbsp;search for range</DT
><DT
><A
HREF="r5437.html"
>comedi_get_buffer_size</A
>&nbsp;--&nbsp;streaming buffer size of subdevice</DT
><DT
><A
HREF="r5458.html"
>comedi_get_max_buffer_size</A
>&nbsp;--&nbsp;maximum streaming buffer size</DT
><DT
><A
HREF="r5479.html"
>comedi_set_buffer_size</A
>&nbsp;--&nbsp;streaming buffer size of subdevice</DT
><DT
><A
HREF="r5503.html"
>comedi_trigger</A
>&nbsp;--&nbsp;perform streaming input/output (deprecated)</DT
><DT
><A
HREF="r5527.html"
>comedi_do_insnlist</A
>&nbsp;--&nbsp;perform multiple instructions</DT
><DT
><A
HREF="r5553.html"
>comedi_do_insn</A
>&nbsp;--&nbsp;perform instruction</DT
><DT
><A
HREF="r5574.html"
>comedi_lock</A
>&nbsp;--&nbsp;subdevice reservation</DT
><DT
><A
HREF="r5598.html"
>comedi_unlock</A
>&nbsp;--&nbsp;subdevice reservation</DT
><DT
><A
HREF="r5619.html"
>comedi_to_phys</A
>&nbsp;--&nbsp;convert sample to physical units</DT
><DT
><A
HREF="r5644.html"
>comedi_to_physical</A
>&nbsp;--&nbsp;convert sample to physical units</DT
><DT
><A
HREF="r5673.html"
>comedi_from_phys</A
>&nbsp;--&nbsp;convert physical units to sample</DT
><DT
><A
HREF="r5697.html"
>comedi_from_physical</A
>&nbsp;--&nbsp;convert physical units to sample</DT
><DT
><A
HREF="r5725.html"
>comedi_data_read</A
>&nbsp;--&nbsp;read single sample from channel</DT
><DT
><A
HREF="r5758.html"
>comedi_data_read_delayed</A
>&nbsp;--&nbsp;read single sample from channel after delaying for specified settling time</DT
><DT
><A
HREF="r5790.html"
>comedi_data_read_hint</A
>&nbsp;--&nbsp;tell driver which channel/range/aref you are going to read from next</DT
><DT
><A
HREF="r5818.html"
>comedi_data_write</A
>&nbsp;--&nbsp;write single sample to channel</DT
><DT
><A
HREF="r5849.html"
>comedi_dio_config</A
>&nbsp;--&nbsp;change input/output properties of channel</DT
><DT
><A
HREF="r5876.html"
>comedi_dio_get_config</A
>&nbsp;--&nbsp;query input/output properties of channel</DT
><DT
><A
HREF="r5903.html"
>comedi_dio_read</A
>&nbsp;--&nbsp;read single bit from digital channel</DT
><DT
><A
HREF="r5929.html"
>comedi_dio_write</A
>&nbsp;--&nbsp;write single bit to digital channel</DT
><DT
><A
HREF="r5955.html"
>comedi_dio_bitfield</A
>&nbsp;--&nbsp;read/write multiple digital channels</DT
><DT
><A
HREF="r5983.html"
>comedi_dio_bitfield2</A
>&nbsp;--&nbsp;read/write multiple digital channels</DT
><DT
><A
HREF="r6018.html"
>comedi_sv_init</A
>&nbsp;--&nbsp;slowly-varying inputs</DT
><DT
><A
HREF="r6046.html"
>comedi_sv_update</A
>&nbsp;--&nbsp;slowly-varying inputs</DT
><DT
><A
HREF="r6068.html"
>comedi_sv_measure</A
>&nbsp;--&nbsp;slowly-varying inputs</DT
><DT
><A
HREF="r6092.html"
>comedi_get_cmd_src_mask</A
>&nbsp;--&nbsp;streaming input/output capabilities</DT
><DT
><A
HREF="r6115.html"
>comedi_get_cmd_generic_timed</A
>&nbsp;--&nbsp;streaming input/output capabilities</DT
><DT
><A
HREF="r6142.html"
>comedi_cancel</A
>&nbsp;--&nbsp;stop streaming input/output in progress</DT
><DT
><A
HREF="r6164.html"
>comedi_command</A
>&nbsp;--&nbsp;start streaming input/output</DT
><DT
><A
HREF="r6186.html"
>comedi_command_test</A
>&nbsp;--&nbsp;test streaming input/output configuration</DT
><DT
><A
HREF="r6214.html"
>comedi_poll</A
>&nbsp;--&nbsp;force updating of streaming buffer</DT
><DT
><A
HREF="r6235.html"
>comedi_set_max_buffer_size</A
>&nbsp;--&nbsp;streaming buffer size of subdevice</DT
><DT
><A
HREF="r6258.html"
>comedi_get_buffer_contents</A
>&nbsp;--&nbsp;streaming buffer status</DT
><DT
><A
HREF="r6279.html"
>comedi_mark_buffer_read</A
>&nbsp;--&nbsp;streaming buffer control</DT
><DT
><A
HREF="r6302.html"
>comedi_mark_buffer_written</A
>&nbsp;--&nbsp;streaming buffer control</DT
><DT
><A
HREF="r6325.html"
>comedi_get_buffer_offset</A
>&nbsp;--&nbsp;streaming buffer status</DT
><DT
><A
HREF="r6346.html"
>comedi_get_timer</A
>&nbsp;--&nbsp;timer information (deprecated)</DT
><DT
><A
HREF="r6376.html"
>comedi_timed_1chan</A
>&nbsp;--&nbsp;streaming input (deprecated)</DT
><DT
><A
HREF="r6412.html"
>comedi_set_global_oor_behavior</A
>&nbsp;--&nbsp;out-of-range behavior</DT
><DT
><A
HREF="r6435.html"
>comedi_apply_calibration</A
>&nbsp;--&nbsp;set hardware calibration from file</DT
><DT
><A
HREF="r6475.html"
>comedi_apply_parsed_calibration</A
>&nbsp;--&nbsp;set calibration from memory</DT
><DT
><A
HREF="r6512.html"
>comedi_cleanup_calibration_file</A
>&nbsp;--&nbsp;free calibration resources</DT
><DT
><A
HREF="r6535.html"
>comedi_get_default_calibration_path</A
>&nbsp;--&nbsp;get default calibration file path</DT
><DT
><A
HREF="r6561.html"
>comedi_parse_calibration_file</A
>&nbsp;--&nbsp;load contents of calibration file</DT
><DT
><A
HREF="r6587.html"
>comedi_get_hardcal_converter</A
>&nbsp;--&nbsp;get converter for hardware-calibrated subdevice</DT
><DT
><A
HREF="r6633.html"
>comedi_get_softcal_converter</A
>&nbsp;--&nbsp;get converter for software-calibrated subdevice</DT
></DL
></DIV
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="x1781.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="r4835.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Low-level drivers</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
>&nbsp;</TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>comedi_close</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>