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 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611
|
<!--This file is autogenerated. Do not edit-->
<section id="functionreference">
<title>
Comedi Function Reference
</title>
<refentry id="func-ref-comedi-close">
<refmeta>
<refentrytitle>comedi_close</refentrytitle>
<manvolnum>3</manvolnum>
</refmeta>
<refnamediv>
<refname>comedi_close</refname>
<refpurpose>close a Comedi device</refpurpose>
</refnamediv>
<refsynopsisdiv>
<funcsynopsis>
<funcsynopsisinfo>#include <comedilib.h></funcsynopsisinfo>
<funcprototype>
<funcdef>int <function>comedi_close</function></funcdef>
<paramdef>comedi * <parameter>device</parameter></paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsect1>
<title>
Description
</title>
<para>
Close a device previously opened by comedi_open().
</para>
</refsect1>
<refsect1>
<title>
Return value
</title>
<para>
If sucessful, comedi_close returns 0. On failure, -1 is returned.
</para><para>
</para>
</refsect1>
</refentry>
<refentry id="func-ref-comedi-open">
<refmeta>
<refentrytitle>comedi_open</refentrytitle>
<manvolnum>3</manvolnum>
</refmeta>
<refnamediv>
<refname>comedi_open</refname>
<refpurpose>open a Comedi device</refpurpose>
</refnamediv>
<refsynopsisdiv>
<funcsynopsis>
<funcsynopsisinfo>#include <comedilib.h></funcsynopsisinfo>
<funcprototype>
<funcdef>comedi_t * <function>comedi_open</function></funcdef>
<paramdef>const char * <parameter>filename</parameter></paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsect1>
<title>
Description
</title>
<para>
Open a Comedi device specified by the file filename.
</para>
</refsect1>
<refsect1>
<title>
Return value
</title>
<para>
If sucessful, comedi_open returns a pointer to a valid comedi_t
structure. This structure is transparent; the pointer should not
be dereferenced by the application. NULL is returned on failure.
</para><para>
</para>
</refsect1>
</refentry>
<refentry id="func-ref-comedi-loglevel">
<refmeta>
<refentrytitle>comedi_loglevel</refentrytitle>
<manvolnum>3</manvolnum>
</refmeta>
<refnamediv>
<refname>comedi_loglevel</refname>
<refpurpose>change Comedilib logging properties</refpurpose>
</refnamediv>
<refsynopsisdiv>
<funcsynopsis>
<funcsynopsisinfo>#include <comedilib.h></funcsynopsisinfo>
<funcprototype>
<funcdef>int <function>comedi_loglevel</function></funcdef>
<paramdef>int <parameter>loglevel</parameter></paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsect1>
<title>
Description
</title>
<para>
This function affects the output of debugging and error messages
from Comedilib. By increasing the loglevel, additional debugging
information will be printed. Error and debugging messages are
printed to the stream stderr.
</para><para>
The default loglevel can be set by using the environment variable
COMEDI_LOGLEVEL. The default loglevel is 1.
</para><para>
In order to conserve resources, some debugging information is
disabled by default when Comedilib is compiled.
</para><para>
The meaning of the loglevels is as follows:
</para><para>
COMEDI_LOGLEVEL=0 Comedilib prints nothing.
</para><para>
COMEDI_LOGLEVEL=1 (default) Comedilib prints error messages when
there is a self-consistency error (i.e., an internal bug.)
</para><para>
COMEDI_LOGLEVEL=2 Comedilib prints an error message when an invalid
parameter is passed.
</para><para>
COMEDI_LOGLEVEL=3 Comedilib prints an error message whenever an
error is generated in the Comedilib library or in the C library,
when called by Comedilib.
</para><para>
COMEDI_LOGLEVEL=4 Comedilib prints a lot of junk.
</para>
</refsect1>
<refsect1>
<title>
Return value
</title>
<para>
This function returns the previous loglevel.
</para><para>
</para>
</refsect1>
</refentry>
<refentry id="func-ref-comedi-perror">
<refmeta>
<refentrytitle>comedi_perror</refentrytitle>
<manvolnum>3</manvolnum>
</refmeta>
<refnamediv>
<refname>comedi_perror</refname>
<refpurpose>print a Comedilib error message</refpurpose>
</refnamediv>
<refsynopsisdiv>
<funcsynopsis>
<funcsynopsisinfo>#include <comedilib.h></funcsynopsisinfo>
<funcprototype>
<funcdef>void <function>comedi_perror</function></funcdef>
<paramdef>const char * <parameter>s</parameter></paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsect1>
<title>
Description
</title>
<para>
When a Comedilib function fails, it usually returns -1 or
NULL, depending on the return type. An internal library
variable stores an error number, which can be retrieved with
comedi_errno(). This error number can be converted to a
human-readable form by the functions comedi_perror()
and comedi_strerror().
</para><para>
These functions are intended to mimic the behavior of the
standard C library functions perror(), strerror(), and errno.
In particular, Comedilib functions sometimes return an error
that is generated inside the C library; the comedi error
message in this case is the same as the C library.
</para><para>
The function comedi_perror() prints an error message to stderr.
The error message consists of the argument string, a colon, a
space, a description of the error condition, and a new line.
</para><para>
</para>
</refsect1>
</refentry>
<refentry id="func-ref-comedi-strerror">
<refmeta>
<refentrytitle>comedi_strerror</refentrytitle>
<manvolnum>3</manvolnum>
</refmeta>
<refnamediv>
<refname>comedi_strerror</refname>
<refpurpose>return string describing Comedilib error code</refpurpose>
</refnamediv>
<refsynopsisdiv>
<funcsynopsis>
<funcsynopsisinfo>#include <comedilib.h></funcsynopsisinfo>
<funcprototype>
<funcdef>char * <function>comedi_strerror</function></funcdef>
<paramdef>int <parameter>errnum</parameter></paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsect1>
<title>
Description
</title>
<para>
When a Comedilib function fails, it usually returns -1 or
NULL, depending on the return type. An internal library
variable stores an error number, which can be retrieved with
comedi_errno(). This error number can be converted to a
human-readable form by the functions comedi_perror()
and comedi_strerror().
</para><para>
These functions are intended to mimic the behavior of the
standard C library functions perror(), strerror(), and errno.
In particular, Comedilib functions sometimes return an error
that is generated inside the C library; the comedi error
message in this case is the same as the C library.
</para><para>
The function comedi_strerror() returns a pointer to a
character string
describing the Comedilib error errnum. The persistence
of the returned pointer is undefined, and should not be trusted
after the next Comedilib call. An unrecognized error number will
return a pointer to the string "undefined error", or similar.
</para><para>
</para>
</refsect1>
</refentry>
<refentry id="func-ref-comedi-errno">
<refmeta>
<refentrytitle>comedi_errno</refentrytitle>
<manvolnum>3</manvolnum>
</refmeta>
<refnamediv>
<refname>comedi_errno</refname>
<refpurpose>number of last Comedilib error</refpurpose>
</refnamediv>
<refsynopsisdiv>
<funcsynopsis>
<funcsynopsisinfo>#include <comedilib.h></funcsynopsisinfo>
<funcprototype>
<funcdef>int <function>comedi_errno</function></funcdef>
<paramdef>void <parameter></parameter></paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsect1>
<title>
Description
</title>
<para>
When a Comedilib function fails, it usually returns -1 or
NULL, depending on the return type. An internal library
variable stores an error number, which can be retrieved with
comedi_errno(). This error number can be converted to a
human-readable form by the functions comedi_perror()
and comedi_strerror().
</para><para>
These functions are intended to mimic the behavior of the
standard C library functions perror(), strerror(), and errno.
In particular, Comedilib functions sometimes return an error
that is generated inside the C library; the comedi error
message in this case is the same as the C library.
</para><para>
The function comedi_errno() returns an integer describing
the most recent comedilib error. This integer may be used
as the errnum parameter for comedi_strerror().
</para><para>
Note that comedi_errno() is deliberately different than the
variable errno. This is to overcome difficulties in making
errno thread-safe.
</para><para>
</para>
</refsect1>
</refentry>
<refentry id="func-ref-comedi-fileno">
<refmeta>
<refentrytitle>comedi_fileno</refentrytitle>
<manvolnum>3</manvolnum>
</refmeta>
<refnamediv>
<refname>comedi_fileno</refname>
<refpurpose>integer descriptor of Comedilib device</refpurpose>
</refnamediv>
<refsynopsisdiv>
<funcsynopsis>
<funcsynopsisinfo>#include <comedilib.h></funcsynopsisinfo>
<funcprototype>
<funcdef>int <function>comedi_fileno</function></funcdef>
<paramdef>comedi_t * <parameter>device</parameter></paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsect1>
<title>
Description
</title>
<para>
The function comedi_fileno returns the integer descriptor for
the device dev. This descriptor can then be used as the
file descriptor parameter of read(), write(), etc.
This function is intended to mimic the standard C library
function fileno(). If dev is an invalid comedi_t
pointer, the function returns -1 and sets the appropriate
Comedilib error value.
</para><para>
</para>
</refsect1>
</refentry>
<refentry id="func-ref-comedi-get-n-subdevices">
<refmeta>
<refentrytitle>comedi_get_n_subdevices</refentrytitle>
<manvolnum>3</manvolnum>
</refmeta>
<refnamediv>
<refname>comedi_get_n_subdevices</refname>
<refpurpose>number of subdevices </refpurpose>
</refnamediv>
<refsynopsisdiv>
<funcsynopsis>
<funcsynopsisinfo>#include <comedilib.h></funcsynopsisinfo>
<funcprototype>
<funcdef>int <function>comedi_get_n_subdevices</function></funcdef>
<paramdef>comedi_t * <parameter>device</parameter></paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsect1>
<title>
Description
</title>
<para>
Returns the number of subdevices belonging to the Comedi
device referenced by the parameter device.
</para><para>
</para>
</refsect1>
</refentry>
<refentry id="func-ref-comedi-get-version-code">
<refmeta>
<refentrytitle>comedi_get_version_code</refentrytitle>
<manvolnum>3</manvolnum>
</refmeta>
<refnamediv>
<refname>comedi_get_version_code</refname>
<refpurpose>Comedi version code</refpurpose>
</refnamediv>
<refsynopsisdiv>
<funcsynopsis>
<funcsynopsisinfo>#include <comedilib.h></funcsynopsisinfo>
<funcprototype>
<funcdef>int <function>comedi_get_version_code</function></funcdef>
<paramdef>comedi_t * <parameter>device</parameter></paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsect1>
<title>
Description
</title>
<para>
Returns the Comedi kernel module version code. A valid Comedi
device referenced by the parameter device is necessary to
communicate with the kernel module. On error, -1 is returned.
</para><para>
The version code is encoded as a bitfield of three 8-bit
numbers. For example, 0x00073d is the version code for
version 0.7.61.
</para><para>
This function is of limited usefulness. A typical
mis-application of this function is to use it to determine
if a certain feature is supported. If the application needs
to know of the existence of a particular feature, an existence
test function should be written and put in the Comedilib source.
</para><para>
</para>
</refsect1>
</refentry>
<refentry id="func-ref-comedi-get-driver-name">
<refmeta>
<refentrytitle>comedi_get_driver_name</refentrytitle>
<manvolnum>3</manvolnum>
</refmeta>
<refnamediv>
<refname>comedi_get_driver_name</refname>
<refpurpose>Comedi driver name</refpurpose>
</refnamediv>
<refsynopsisdiv>
<funcsynopsis>
<funcsynopsisinfo>#include <comedilib.h></funcsynopsisinfo>
<funcprototype>
<funcdef>char * <function>comedi_get_driver_name</function></funcdef>
<paramdef>comedi_t * <parameter>device</parameter></paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsect1>
<title>
Description
</title>
<para>
The function comedi_get_driver_name returns a pointer
to a string containing the name of the driver being used by comedi
for the comedi device represented by device. This pointer is
valid until the device is closed. This function returns NULL
if there is an error.
</para><para>
</para>
</refsect1>
</refentry>
<refentry id="func-ref-comedi-get-board-name">
<refmeta>
<refentrytitle>comedi_get_board_name</refentrytitle>
<manvolnum>3</manvolnum>
</refmeta>
<refnamediv>
<refname>comedi_get_board_name</refname>
<refpurpose>Comedi device name</refpurpose>
</refnamediv>
<refsynopsisdiv>
<funcsynopsis>
<funcsynopsisinfo>#include <comedilib.h></funcsynopsisinfo>
<funcprototype>
<funcdef>char * <function>comedi_get_board_name</function></funcdef>
<paramdef>comedi_t * <parameter>device</parameter></paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsect1>
<title>
Description
</title>
<para>
The function comedi_get_board_name returns a pointer
to a string containing the name of the device. This pointer is
valid until the comedi descriptor it is closed. This
function returns NULL if there is an error.
</para><para>
</para>
</refsect1>
</refentry>
<refentry id="func-ref-comedi-get-subdevice-type">
<refmeta>
<refentrytitle>comedi_get_subdevice_type</refentrytitle>
<manvolnum>3</manvolnum>
</refmeta>
<refnamediv>
<refname>comedi_get_subdevice_type</refname>
<refpurpose>type of subdevice</refpurpose>
</refnamediv>
<refsynopsisdiv>
<funcsynopsis>
<funcsynopsisinfo>#include <comedilib.h></funcsynopsisinfo>
<funcprototype>
<funcdef>int <function>comedi_get_subdevice_type</function></funcdef>
<paramdef>comedi_t * <parameter>device</parameter></paramdef>
<paramdef>unsigned int <parameter>subdevice</parameter></paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsect1>
<title>
Description
</title>
<para>
The function comedi_get_subdevice_type() returns an
integer describing the type of subdevice that belongs to the comedi
device device and has the index subdevice. The
function returns -1 if there is an error.
XXX Subdevice type table
</para><para>
</para>
</refsect1>
</refentry>
<refentry id="func-ref-comedi-find-subdevice-by-type">
<refmeta>
<refentrytitle>comedi_find_subdevice_by_type</refentrytitle>
<manvolnum>3</manvolnum>
</refmeta>
<refnamediv>
<refname>comedi_find_subdevice_by_type</refname>
<refpurpose>search for subdevice type</refpurpose>
</refnamediv>
<refsynopsisdiv>
<funcsynopsis>
<funcsynopsisinfo>#include <comedilib.h></funcsynopsisinfo>
<funcprototype>
<funcdef>int <function>comedi_find_subdevice_by_type</function></funcdef>
<paramdef>comedi_t * <parameter>device</parameter></paramdef>
<paramdef>int <parameter>type</parameter></paramdef>
<paramdef>unsigned int <parameter>start_subdevice</parameter></paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsect1>
<title>
Description
</title>
<para>
The function comedi_find_subdevice_by_type() tries to
locate a subdevice belonging to comedi device device,
having type type, starting with the subdevice
start_subdevice. If it finds a subdevice with the requested
type, it returns its index. If it does not locate the requested
subdevice, it returns -1 and sets the Comedilib error number to
XXX "subdevice not found". If there is an error, the function
returns -1 and sets the appropriate error.
</para><para>
</para>
</refsect1>
</refentry>
<refentry id="func-ref-comedi-get-read-subdevice">
<refmeta>
<refentrytitle>comedi_get_read_subdevice</refentrytitle>
<manvolnum>3</manvolnum>
</refmeta>
<refnamediv>
<refname>comedi_get_read_subdevice</refname>
<refpurpose>find streaming input subdevice</refpurpose>
</refnamediv>
<refsynopsisdiv>
<funcsynopsis>
<funcsynopsisinfo>#include <comedilib.h></funcsynopsisinfo>
<funcprototype>
<funcdef>int <function>comedi_get_read_subdevice</function></funcdef>
<paramdef>comedi_t * <parameter>device</parameter></paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsect1>
<title>
Description
</title>
<para>
The function comedi_get_read_subdevice() returns the subdevice
that allows streaming input for device dev. If no subdevice
supports streaming input, -1 is returned and the Comedilib error
number is set to XXX "subdevice not found".
</para><para>
</para>
</refsect1>
</refentry>
<refentry id="func-ref-comedi-get-write-subdevice">
<refmeta>
<refentrytitle>comedi_get_write_subdevice</refentrytitle>
<manvolnum>3</manvolnum>
</refmeta>
<refnamediv>
<refname>comedi_get_write_subdevice</refname>
<refpurpose>find streaming output subdevice</refpurpose>
</refnamediv>
<refsynopsisdiv>
<funcsynopsis>
<funcsynopsisinfo>#include <comedilib.h></funcsynopsisinfo>
<funcprototype>
<funcdef>int <function>comedi_get_write_subdevice</function></funcdef>
<paramdef>comedi_t * <parameter>device</parameter></paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsect1>
<title>
Description
</title>
<para>
The function comedi_get_write_subdevice() returns the subdevice
that allows streaming output for device dev. If no subdevice
supports streaming output, -1 is returned and the Comedilib error
number is set to XXX "subdevice not found".
</para><para>
</para>
</refsect1>
</refentry>
<refentry id="func-ref-comedi-get-subdevice-flags">
<refmeta>
<refentrytitle>comedi_get_subdevice_flags</refentrytitle>
<manvolnum>3</manvolnum>
</refmeta>
<refnamediv>
<refname>comedi_get_subdevice_flags</refname>
<refpurpose>properties of subdevice</refpurpose>
</refnamediv>
<refsynopsisdiv>
<funcsynopsis>
<funcsynopsisinfo>#include <comedilib.h></funcsynopsisinfo>
<funcprototype>
<funcdef>int <function>comedi_get_subdevice_flags</function></funcdef>
<paramdef>comedi_t * <parameter>device</parameter></paramdef>
<paramdef>unsigned int <parameter>subdevice</parameter></paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsect1>
<title>
Description
</title>
<para>
This function returns a bitfield describing the capabilities of
the specified subdevice. If there is an error, -1 is returned,
and the Comedilib error value is set.
</para><para>
XXX table.
</para><para>
</para>
</refsect1>
</refentry>
<refentry id="func-ref-comedi-get-n-channels">
<refmeta>
<refentrytitle>comedi_get_n_channels</refentrytitle>
<manvolnum>3</manvolnum>
</refmeta>
<refnamediv>
<refname>comedi_get_n_channels</refname>
<refpurpose>number of subdevice channels</refpurpose>
</refnamediv>
<refsynopsisdiv>
<funcsynopsis>
<funcsynopsisinfo>#include <comedilib.h></funcsynopsisinfo>
<funcprototype>
<funcdef>int <function>comedi_get_n_channels</function></funcdef>
<paramdef>comedi_t * <parameter>device</parameter></paramdef>
<paramdef>unsigned int <parameter>subdevice</parameter></paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsect1>
<title>
Description
</title>
<para>
The function comedi_get_n_channels() returns the number
of channels of the subdevice belonging to the comedi device device
and having index subdevice. This function returns -1 on error and
the Comedilib error value is set.
</para><para>
</para>
</refsect1>
</refentry>
<refentry id="func-ref-comedi-range-is-chan-specific">
<refmeta>
<refentrytitle>comedi_range_is_chan_specific</refentrytitle>
<manvolnum>3</manvolnum>
</refmeta>
<refnamediv>
<refname>comedi_range_is_chan_specific</refname>
<refpurpose>range information depends on channel</refpurpose>
</refnamediv>
<refsynopsisdiv>
<funcsynopsis>
<funcsynopsisinfo>#include <comedilib.h></funcsynopsisinfo>
<funcprototype>
<funcdef>int <function>comedi_range_is_chan_specific</function></funcdef>
<paramdef>comedi_t * <parameter>device</parameter></paramdef>
<paramdef>unsigned int <parameter>subdevice</parameter></paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsect1>
<title>
Description
</title>
<para>
If each channel of the specified subdevice has different range
information, this function returns 1. Otherwise, this function
returns 0. On error, this function returns -1.
</para><para>
</para>
</refsect1>
</refentry>
<refentry id="func-ref-comedi-maxdata-is-chan-specific">
<refmeta>
<refentrytitle>comedi_maxdata_is_chan_specific</refentrytitle>
<manvolnum>3</manvolnum>
</refmeta>
<refnamediv>
<refname>comedi_maxdata_is_chan_specific</refname>
<refpurpose>maximum sample depends on channel</refpurpose>
</refnamediv>
<refsynopsisdiv>
<funcsynopsis>
<funcsynopsisinfo>#include <comedilib.h></funcsynopsisinfo>
<funcprototype>
<funcdef>int <function>comedi_maxdata_is_chan_specific</function></funcdef>
<paramdef>comedi_t * <parameter>device</parameter></paramdef>
<paramdef>unsigned int <parameter>subdevice</parameter></paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsect1>
<title>
Description
</title>
<para>
If each channel of the specified subdevice has different maximum
sample values, this function returns 1. Otherwise, this function
returns 0. On error, this function returns -1.
</para><para>
</para>
</refsect1>
</refentry>
<refentry id="func-ref-comedi-get-maxdata">
<refmeta>
<refentrytitle>comedi_get_maxdata</refentrytitle>
<manvolnum>3</manvolnum>
</refmeta>
<refnamediv>
<refname>comedi_get_maxdata</refname>
<refpurpose>maximum sample of channel</refpurpose>
</refnamediv>
<refsynopsisdiv>
<funcsynopsis>
<funcsynopsisinfo>#include <comedilib.h></funcsynopsisinfo>
<funcprototype>
<funcdef>lsampl_t <function>comedi_get_maxdata</function></funcdef>
<paramdef>comedi_t * <parameter>device</parameter></paramdef>
<paramdef>unsigned int <parameter>subdevice</parameter></paramdef>
<paramdef>unsigned int <parameter>channel</parameter></paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsect1>
<title>
Description
</title>
<para>
The function comedi_get_maxdata() returns the maximum
valid data value for channel chan of subdevice
subdevice belonging to the comedi device device
This function returns 0 on error.
</para><para>
</para>
</refsect1>
</refentry>
<refentry id="func-ref-comedi-get-n-ranges">
<refmeta>
<refentrytitle>comedi_get_n_ranges</refentrytitle>
<manvolnum>3</manvolnum>
</refmeta>
<refnamediv>
<refname>comedi_get_n_ranges</refname>
<refpurpose>number of ranges of channel</refpurpose>
</refnamediv>
<refsynopsisdiv>
<funcsynopsis>
<funcsynopsisinfo>#include <comedilib.h></funcsynopsisinfo>
<funcprototype>
<funcdef>int <function>comedi_get_n_ranges</function></funcdef>
<paramdef>comedi_t * <parameter>device</parameter></paramdef>
<paramdef>unsigned int <parameter>subdevice</parameter></paramdef>
<paramdef>unsigned int <parameter>channel</parameter></paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsect1>
<title>
Description
</title>
<para>
The function comedi_get_n_ranges() returns the number
of ranges of the channel chan belonging to the subdevice
of the comedi device device. This function returns -1 on error.
</para><para>
</para>
</refsect1>
</refentry>
<refentry id="func-ref-comedi-get-range">
<refmeta>
<refentrytitle>comedi_get_range</refentrytitle>
<manvolnum>3</manvolnum>
</refmeta>
<refnamediv>
<refname>comedi_get_range</refname>
<refpurpose>range information of channel</refpurpose>
</refnamediv>
<refsynopsisdiv>
<funcsynopsis>
<funcsynopsisinfo>#include <comedilib.h></funcsynopsisinfo>
<funcprototype>
<funcdef>comedi_range * <function>comedi_get_range</function></funcdef>
<paramdef>comedi_t * <parameter>device</parameter></paramdef>
<paramdef>unsigned int <parameter>subdevice</parameter></paramdef>
<paramdef>unsigned int <parameter>channel</parameter></paramdef>
<paramdef>unsigned int <parameter>range</parameter></paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsect1>
<title>
Description
</title>
<para>
The function comedi_get_range() returns a pointer to a
comedi_range structure that contains information that can be used to
convert sample values to or from physical units. The pointer is valid
until the Comedi device device is closed. If there is an
error, NULL is returned.
</para><para>
</para>
</refsect1>
</refentry>
<refentry id="func-ref-comedi-find-range">
<refmeta>
<refentrytitle>comedi_find_range</refentrytitle>
<manvolnum>3</manvolnum>
</refmeta>
<refnamediv>
<refname>comedi_find_range</refname>
<refpurpose>search for range</refpurpose>
</refnamediv>
<refsynopsisdiv>
<funcsynopsis>
<funcsynopsisinfo>#include <comedilib.h></funcsynopsisinfo>
<funcprototype>
<funcdef>int <function>comedi_find_range</function></funcdef>
<paramdef>comedi_t * <parameter>device</parameter></paramdef>
<paramdef>unsigned int <parameter>subdevice</parameter></paramdef>
<paramdef>unsigned int <parameter>channel</parameter></paramdef>
<paramdef>unsigned int <parameter>unit</parameter></paramdef>
<paramdef>double <parameter>min</parameter></paramdef>
<paramdef>double <parameter>max</parameter></paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsect1>
<title>
Description
</title>
<para>
The function comedi_find_range() tries to
locate the optimal (smallest) range for the channel chan
belonging to a subdevice of the comedi device device,
that includes both min and max in units.
If a matching range is found, the index of the matching range is
returned. If no matching range is available, the function returns
-1.
</para><para>
</para>
</refsect1>
</refentry>
<refentry id="func-ref-comedi-get-buffer-size">
<refmeta>
<refentrytitle>comedi_get_buffer_size</refentrytitle>
<manvolnum>3</manvolnum>
</refmeta>
<refnamediv>
<refname>comedi_get_buffer_size</refname>
<refpurpose>streaming buffer size of subdevice</refpurpose>
</refnamediv>
<refsynopsisdiv>
<funcsynopsis>
<funcsynopsisinfo>#include <comedilib.h></funcsynopsisinfo>
<funcprototype>
<funcdef>int <function>comedi_get_buffer_size</function></funcdef>
<paramdef>comedi_t * <parameter>device</parameter></paramdef>
<paramdef>unsigned int <parameter>subdevice</parameter></paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsect1>
<title>
Description
</title>
<para>
The function comedi_get_buffer_size() returns the size (in bytes)
of the streaming buffer for the subdevice specified by device and
subdevice. On error, -1 is returned.
</para><para>
</para>
</refsect1>
</refentry>
<refentry id="func-ref-comedi-get-max-buffer-size">
<refmeta>
<refentrytitle>comedi_get_max_buffer_size</refentrytitle>
<manvolnum>3</manvolnum>
</refmeta>
<refnamediv>
<refname>comedi_get_max_buffer_size</refname>
<refpurpose>maximum streaming buffer size</refpurpose>
</refnamediv>
<refsynopsisdiv>
<funcsynopsis>
<funcsynopsisinfo>#include <comedilib.h></funcsynopsisinfo>
<funcprototype>
<funcdef>int <function>comedi_get_max_buffer_size</function></funcdef>
<paramdef>comedi_t * <parameter>device</parameter></paramdef>
<paramdef>unsigned int <parameter>subdevice</parameter></paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsect1>
<title>
Description
</title>
<para>
The function comedi_get_max_buffer_size() returns the maximum
allowable size (in bytes) of the streaming buffer for the subdevice
specified by device and subdevice. Changing the maximum buffer
size requires appropriate privileges. On error, -1 is returned.
</para><para>
</para>
</refsect1>
</refentry>
<refentry id="func-ref-comedi-set-buffer-size">
<refmeta>
<refentrytitle>comedi_set_buffer_size</refentrytitle>
<manvolnum>3</manvolnum>
</refmeta>
<refnamediv>
<refname>comedi_set_buffer_size</refname>
<refpurpose>streaming buffer size of subdevice</refpurpose>
</refnamediv>
<refsynopsisdiv>
<funcsynopsis>
<funcsynopsisinfo>#include <comedilib.h></funcsynopsisinfo>
<funcprototype>
<funcdef>int <function>comedi_set_buffer_size</function></funcdef>
<paramdef>comedi_t * <parameter>device</parameter></paramdef>
<paramdef>unsigned int <parameter>subdevice</parameter></paramdef>
<paramdef>unsigned int <parameter>size</parameter></paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsect1>
<title>
Description
</title>
<para>
The function comedi_set_buffer_size() changes the size of the
streaming buffer for the subdevice specified by device and subdevice.
The parameter size must be a multiple of the virtual memory page
size.
</para><para>
The virtual memory page size can be determined using
sysconf(_SC_PAGE_SIZE).
</para><para>
</para>
</refsect1>
</refentry>
<refentry id="func-ref-comedi-trigger">
<refmeta>
<refentrytitle>comedi_trigger</refentrytitle>
<manvolnum>3</manvolnum>
</refmeta>
<refnamediv>
<refname>comedi_trigger</refname>
<refpurpose>perform streaming input/output (deprecated)</refpurpose>
</refnamediv>
<refsynopsisdiv>
<funcsynopsis>
<funcsynopsisinfo>#include <comedilib.h></funcsynopsisinfo>
<funcprototype>
<funcdef>int <function>comedi_trigger</function></funcdef>
<paramdef>comedi_t * <parameter>device</parameter></paramdef>
<paramdef>comedi_trig * <parameter>trig</parameter></paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsect1>
<title>
Status
</title>
<para>
deprecated
</para>
</refsect1>
<refsect1>
<title>
Description
</title>
<para>
The function comedi_trigger() instructs Comedi to
perform the command specified by the trigger structure trig.
The return value depends on
the particular trig being issued. If there is an
error, -1 is returned.
</para><para>
</para>
</refsect1>
</refentry>
<refentry id="func-ref-comedi-do-insnlist">
<refmeta>
<refentrytitle>comedi_do_insnlist</refentrytitle>
<manvolnum>3</manvolnum>
</refmeta>
<refnamediv>
<refname>comedi_do_insnlist</refname>
<refpurpose>perform multiple instructions</refpurpose>
</refnamediv>
<refsynopsisdiv>
<funcsynopsis>
<funcsynopsisinfo>#include <comedilib.h></funcsynopsisinfo>
<funcprototype>
<funcdef>int <function>comedi_do_insnlist</function></funcdef>
<paramdef>comedi_t * <parameter>device</parameter></paramdef>
<paramdef>comedi_insnlist * <parameter>list</parameter></paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsect1>
<title>
Description
</title>
<para>
The function comedi_do_insnlist() performs multiple Comedi
instructions as part of one system call. In addition, Comedi
attempts to perform the instructions atomically, that is, on
standard Linux kernels, no process preemption should occur
during the instructions. However, the process may be preempted
before or after the group of instructions.
</para><para>
This function can be used to avoid the overhead of multiple
system calls, or to ensure that multiple instructions occur
without significant delay between them.
Preemption may occur if any of the instructions or the data
arrays of any of the instructions exist in non-resident or
copy-on-write pages.
</para>
</refsect1>
<refsect1>
<title>
Return value
</title>
<para>
The function comedi_do_insnlist() returns the number of
sucessfully completed instructions. Error information for
the unsucessful instruction is not available. If there is
an error before the first instruction can be executed, -1
is returned.
</para><para>
</para>
</refsect1>
</refentry>
<refentry id="func-ref-comedi-do-insn">
<refmeta>
<refentrytitle>comedi_do_insn</refentrytitle>
<manvolnum>3</manvolnum>
</refmeta>
<refnamediv>
<refname>comedi_do_insn</refname>
<refpurpose>perform instruction</refpurpose>
</refnamediv>
<refsynopsisdiv>
<funcsynopsis>
<funcsynopsisinfo>#include <comedilib.h></funcsynopsisinfo>
<funcprototype>
<funcdef>int <function>comedi_do_insn</function></funcdef>
<paramdef>comedi_t * <parameter>device</parameter></paramdef>
<paramdef>comedi_insn * <parameter>instruction</parameter></paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsect1>
<title>
Description
</title>
<para>
The function comedi_do_insn() performs a single instruction.
If sucessful, comedi_do_insn() returns the number of samples
measured, which may be less than the number of requested
samples. Comedi limits the number of requested samples in
order to enforce fairness among processes. If there is an
error, -1 is returned.
</para><para>
</para>
</refsect1>
</refentry>
<refentry id="func-ref-comedi-lock">
<refmeta>
<refentrytitle>comedi_lock</refentrytitle>
<manvolnum>3</manvolnum>
</refmeta>
<refnamediv>
<refname>comedi_lock</refname>
<refpurpose>subdevice reservation</refpurpose>
</refnamediv>
<refsynopsisdiv>
<funcsynopsis>
<funcsynopsisinfo>#include <comedilib.h></funcsynopsisinfo>
<funcprototype>
<funcdef>int <function>comedi_lock</function></funcdef>
<paramdef>comedi_t * <parameter>device</parameter></paramdef>
<paramdef>unsigned int <parameter>subdevice</parameter></paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsect1>
<title>
Description
</title>
<para>
The function comedi_lock() reserves a subdevice for use by the
current process. While the lock is held, no other process is
allowed to read, write, or configure that subdevice, although
other processes can read information about the subdevice. The
lock is released when comedi_unlock() is called, or the device
is closed. If sucessful, 0 is returned. If there is an error,
-1 is returned.
</para><para>
</para>
</refsect1>
</refentry>
<refentry id="func-ref-comedi-unlock">
<refmeta>
<refentrytitle>comedi_unlock</refentrytitle>
<manvolnum>3</manvolnum>
</refmeta>
<refnamediv>
<refname>comedi_unlock</refname>
<refpurpose>subdevice reservation</refpurpose>
</refnamediv>
<refsynopsisdiv>
<funcsynopsis>
<funcsynopsisinfo>#include <comedilib.h></funcsynopsisinfo>
<funcprototype>
<funcdef>int <function>comedi_unlock</function></funcdef>
<paramdef>comedi_t * <parameter>device</parameter></paramdef>
<paramdef>unsigned int <parameter>subdevice</parameter></paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsect1>
<title>
Description
</title>
<para>
The function comedi_unlock() released a subdevice lock acquired
by comedi_lock(). If sucessful, 0 is returned, otherwise -1.
</para><para>
</para>
</refsect1>
</refentry>
<refentry id="func-ref-comedi-to-phys">
<refmeta>
<refentrytitle>comedi_to_phys</refentrytitle>
<manvolnum>3</manvolnum>
</refmeta>
<refnamediv>
<refname>comedi_to_phys</refname>
<refpurpose>convert sample to physical units</refpurpose>
</refnamediv>
<refsynopsisdiv>
<funcsynopsis>
<funcsynopsisinfo>#include <comedilib.h></funcsynopsisinfo>
<funcprototype>
<funcdef>double <function>comedi_to_phys</function></funcdef>
<paramdef>lsampl_t <parameter>data</parameter></paramdef>
<paramdef>comedi_range * <parameter>range</parameter></paramdef>
<paramdef>lsampl_t <parameter>maxdata</parameter></paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsect1>
<title>
Description
</title>
<para>
Converts data given in sample values (lsampl_t, between 0 and
maxdata) into physical units (double). The parameter range
represents the conversion information to use, and the parameter
maxdata represents the maximum possible data value for the
channel that the data was read.
</para><para>
Conversion of endpoint sample values, that is, sample values
equal to 0 or maxdata, is affected by the Comedilib out-of-range
behavior. If the out-of-range behavior is set to COMEDI_OOR_NAN,
endpoint values are converted to NAN. If the out-of-range
behavior is set to COMEDI_OOR_NUMBER, the endpoint values are
converted similarly to other values.
</para><para>
If there is an error, NAN is returned.
</para><para>
</para>
</refsect1>
</refentry>
<refentry id="func-ref-comedi-from-phys">
<refmeta>
<refentrytitle>comedi_from_phys</refentrytitle>
<manvolnum>3</manvolnum>
</refmeta>
<refnamediv>
<refname>comedi_from_phys</refname>
<refpurpose>convert physical units to sample</refpurpose>
</refnamediv>
<refsynopsisdiv>
<funcsynopsis>
<funcsynopsisinfo>#include <comedilib.h></funcsynopsisinfo>
<funcprototype>
<funcdef>lsampl_t <function>comedi_from_phys</function></funcdef>
<paramdef>double <parameter>data</parameter></paramdef>
<paramdef>comedi_range * <parameter>range</parameter></paramdef>
<paramdef>lsampl_t <parameter>maxdata</parameter></paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsect1>
<title>
Description
</title>
<para>
Converts data given in physical units (data) into sample values
(lsampl_t, between 0 and maxdata). The parameter rng
represents the conversion information to use, and the parameter
maxdata represents the maximum possible data value for the
channel that the data will be written to.
</para><para>
Conversion is not affected by out-of-range behavior. Out-of-range
data parameters are silently truncated to the range 0 to maxdata.
</para><para>
</para>
</refsect1>
</refentry>
<refentry id="func-ref-comedi-data-read">
<refmeta>
<refentrytitle>comedi_data_read</refentrytitle>
<manvolnum>3</manvolnum>
</refmeta>
<refnamediv>
<refname>comedi_data_read</refname>
<refpurpose>read single sample from channel</refpurpose>
</refnamediv>
<refsynopsisdiv>
<funcsynopsis>
<funcsynopsisinfo>#include <comedilib.h></funcsynopsisinfo>
<funcprototype>
<funcdef>int <function>comedi_data_read</function></funcdef>
<paramdef>comedi_t * <parameter>device</parameter></paramdef>
<paramdef>unsigned int <parameter>subdevice</parameter></paramdef>
<paramdef>unsigned int <parameter>channel</parameter></paramdef>
<paramdef>unsigned int <parameter>range</parameter></paramdef>
<paramdef>unsigned int <parameter>aref</parameter></paramdef>
<paramdef>lsampl_t * <parameter>data</parameter></paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsect1>
<title>
Description
</title>
<para>
Reads a single sample on the channel specified by the Comedi
device device, the subdevice subdevice, and the channel channel.
For the A/D conversion (if appropriate),
the device is configured to use range specification
range and (if appropriate) analog reference type
aref. Analog reference types that are not supported
by the device are silently ignored.
</para><para>
The function comedi_data_read() reads one data value from
the specified channel and places the data value in the
location pointed to by data.
</para><para>
WARNING: comedi_data_read() does not do any pausing to
allow multiplexed analog inputs to settle before
performing an analog to digital conversion. If you are
switching between different channels and need to allow
your analog input to settle for an accurate reading,
use comedi_data_read_delayed(), or set the
input channel at an earlier time with
comedi_data_read_hint().
</para><para>
On sucess, comedi_data_read() returns 1 (the number of samples
read). If there is an error, -1 is returned.
</para><para>
Data values returned by this function are unsigned integers
less than or equal to the maximum sample value of the channel,
which can be determined using the function comedi_get_maxdata().
Conversion of data values to physical units can be performed
by the function comedi_to_phys().
</para><para>
</para>
</refsect1>
</refentry>
<refentry id="func-ref-comedi-data-read-delayed">
<refmeta>
<refentrytitle>comedi_data_read_delayed</refentrytitle>
<manvolnum>3</manvolnum>
</refmeta>
<refnamediv>
<refname>comedi_data_read_delayed</refname>
<refpurpose>read single sample from channel after delaying for specified settling time</refpurpose>
</refnamediv>
<refsynopsisdiv>
<funcsynopsis>
<funcsynopsisinfo>#include <comedilib.h></funcsynopsisinfo>
<funcprototype>
<funcdef>int <function>comedi_data_read_delayed</function></funcdef>
<paramdef>comedi_t * <parameter>device</parameter></paramdef>
<paramdef>unsigned int <parameter>subdevice</parameter></paramdef>
<paramdef>unsigned int <parameter>channel</parameter></paramdef>
<paramdef>unsigned int <parameter>range</parameter></paramdef>
<paramdef>unsigned int <parameter>aref</parameter></paramdef>
<paramdef>lsampl_t * <parameter>data</parameter></paramdef>
<paramdef>unsigned int <parameter>nanosec</parameter></paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsect1>
<title>
Description
</title>
<para>
Similar to comedi_data_read() except it will wait for the
specified number of nanoseconds between setting the input
channel and taking a sample. For analog inputs, most
boards have a single
analog to digital converter which is multiplexed to be
able to read multiple channels. If the input is not allowed
to settle after the multiplexer switches channels, the
reading will be inaccurate. This function is useful
for allowing a multiplexed analog input to settle
when switching channels.
</para><para>
Although the settling time is specified in nanoseconds, the
actual settling time will be rounded up to the nearest
microsecond.
</para><para>
</para>
</refsect1>
</refentry>
<refentry id="func-ref-comedi-data-read-hint">
<refmeta>
<refentrytitle>comedi_data_read_hint</refentrytitle>
<manvolnum>3</manvolnum>
</refmeta>
<refnamediv>
<refname>comedi_data_read_hint</refname>
<refpurpose>tell driver which channel/range/aref you are going to read from next</refpurpose>
</refnamediv>
<refsynopsisdiv>
<funcsynopsis>
<funcsynopsisinfo>#include <comedilib.h></funcsynopsisinfo>
<funcprototype>
<funcdef>int <function>comedi_data_read_hint</function></funcdef>
<paramdef>comedi_t * <parameter>device</parameter></paramdef>
<paramdef>unsigned int <parameter>subdevice</parameter></paramdef>
<paramdef>unsigned int <parameter>channel</parameter></paramdef>
<paramdef>unsigned int <parameter>range</parameter></paramdef>
<paramdef>unsigned int <parameter>aref</parameter></paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsect1>
<title>
Description
</title>
<para>
Used to prepare an analog input for a subsequent call to
comedi_data_read(). It is not necessary to use this
function, but it can be useful for eliminating inaccuaracies
caused by insufficient settling times when switching the
channel
or gain on an analog input. This function sets an analog input
to the channel, range, and aref specified but does not
perform an actual analog to digital conversion.
</para><para>
Alternatively, one can simply use comedi_data_read_delayed(),
which sets up the
input, pauses to allow settling, then performs a conversion.
</para><para>
</para>
</refsect1>
</refentry>
<refentry id="func-ref-comedi-data-write">
<refmeta>
<refentrytitle>comedi_data_write</refentrytitle>
<manvolnum>3</manvolnum>
</refmeta>
<refnamediv>
<refname>comedi_data_write</refname>
<refpurpose>write single sample to channel</refpurpose>
</refnamediv>
<refsynopsisdiv>
<funcsynopsis>
<funcsynopsisinfo>#include <comedilib.h></funcsynopsisinfo>
<funcprototype>
<funcdef>int <function>comedi_data_write</function></funcdef>
<paramdef>comedi_t * <parameter>device</parameter></paramdef>
<paramdef>unsigned int <parameter>subdevice</parameter></paramdef>
<paramdef>unsigned int <parameter>channel</parameter></paramdef>
<paramdef>unsigned int <parameter>range</parameter></paramdef>
<paramdef>unsigned int <parameter>aref</parameter></paramdef>
<paramdef>lsampl_t <parameter>data</parameter></paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsect1>
<title>
Description
</title>
<para>
Writes a single sample on the channel that is specified by the
Comedi device device, the subdevice subdevice, and the channel
channel. If appropriate, the device is configured to use range
specification range and analog reference type aref. Analog
reference types that are not supported by the device are
silently ignored.
</para><para>
The function comedi_data_write() writes the data value specified
by the parameter data to the specified channel.
</para><para>
On sucess, comedi_data_write() returns 1 (the number of samples
written). If there is an error, -1 is returned.
</para><para>
</para>
</refsect1>
</refentry>
<refentry id="func-ref-comedi-dio-config">
<refmeta>
<refentrytitle>comedi_dio_config</refentrytitle>
<manvolnum>3</manvolnum>
</refmeta>
<refnamediv>
<refname>comedi_dio_config</refname>
<refpurpose>change input/output properties of channel</refpurpose>
</refnamediv>
<refsynopsisdiv>
<funcsynopsis>
<funcsynopsisinfo>#include <comedilib.h></funcsynopsisinfo>
<funcprototype>
<funcdef>int <function>comedi_dio_config</function></funcdef>
<paramdef>comedi_t * <parameter>device</parameter></paramdef>
<paramdef>unsigned int <parameter>subdevice</parameter></paramdef>
<paramdef>unsigned int <parameter>channel</parameter></paramdef>
<paramdef>unsigned int <parameter>direction</parameter></paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsect1>
<title>
Description
</title>
<para>
The function comedi_dio_config() configures individual channels
in a digital I/O subdevice to be either input or output, depending
on the value of parameter direction. Valid directions are
COMEDI_INPUT or COMEDI_OUTPUT.
</para><para>
Depending on the capabilities of the hardware device, multiple
channels may be grouped together to determine direction. In this
case, a single call to comedi_dio_config() for any channel in the
group will affect the entire group.
</para><para>
If sucessful, 1 is returned, otherwise -1.
</para><para>
</para>
</refsect1>
</refentry>
<refentry id="func-ref-comedi-dio-read">
<refmeta>
<refentrytitle>comedi_dio_read</refentrytitle>
<manvolnum>3</manvolnum>
</refmeta>
<refnamediv>
<refname>comedi_dio_read</refname>
<refpurpose>read single bit from digital channel</refpurpose>
</refnamediv>
<refsynopsisdiv>
<funcsynopsis>
<funcsynopsisinfo>#include <comedilib.h></funcsynopsisinfo>
<funcprototype>
<funcdef>int <function>comedi_dio_read</function></funcdef>
<paramdef>comedi_t * <parameter>device</parameter></paramdef>
<paramdef>unsigned int <parameter>subdevice</parameter></paramdef>
<paramdef>unsigned int <parameter>channel</parameter></paramdef>
<paramdef>unsigned int * <parameter>bit</parameter></paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsect1>
<title>
Description
</title>
<para>
The function reads the channel channel belonging to the
subdevice subdevice of device device. The data value that is
read is stored in the location pointed to by bit. This function
is equivalent to comedi_data_read(device,subdevice,channel,0,0,bit).
This function does not require a digital subdevice or a subdevice
with a maximum data value of 1 to work properly.
</para><para>
Return values and errors are the same as comedi_data_read().
</para><para>
</para>
</refsect1>
</refentry>
<refentry id="func-ref-comedi-dio-write">
<refmeta>
<refentrytitle>comedi_dio_write</refentrytitle>
<manvolnum>3</manvolnum>
</refmeta>
<refnamediv>
<refname>comedi_dio_write</refname>
<refpurpose>write single bit to digital channel</refpurpose>
</refnamediv>
<refsynopsisdiv>
<funcsynopsis>
<funcsynopsisinfo>#include <comedilib.h></funcsynopsisinfo>
<funcprototype>
<funcdef>int <function>comedi_dio_write</function></funcdef>
<paramdef>comedi_t * <parameter>device</parameter></paramdef>
<paramdef>unsigned int <parameter>subdevice</parameter></paramdef>
<paramdef>unsigned int <parameter>channel</parameter></paramdef>
<paramdef>unsigned int <parameter>bit</parameter></paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsect1>
<title>
Description
</title>
<para>
The function writes the value bit to the channel channel belonging
to the subdevice subdevice of device device. This function
is equivalent to comedi_data_write(device,subdevice,channel,0,0,bit).
This function does not require a digital subdevice or a subdevice
with a maximum data value of 1 to work properly.
</para><para>
Return values and errors are the same as comedi_data_write().
</para><para>
</para>
</refsect1>
</refentry>
<refentry id="func-ref-comedi-dio-bitfield">
<refmeta>
<refentrytitle>comedi_dio_bitfield</refentrytitle>
<manvolnum>3</manvolnum>
</refmeta>
<refnamediv>
<refname>comedi_dio_bitfield</refname>
<refpurpose>read/write multiple digital channels</refpurpose>
</refnamediv>
<refsynopsisdiv>
<funcsynopsis>
<funcsynopsisinfo>#include <comedilib.h></funcsynopsisinfo>
<funcprototype>
<funcdef>int <function>comedi_dio_bitfield</function></funcdef>
<paramdef>comedi_t * <parameter>device</parameter></paramdef>
<paramdef>unsigned int <parameter>subdevice</parameter></paramdef>
<paramdef>unsigned int <parameter>write_mask</parameter></paramdef>
<paramdef>unsigned int * <parameter>bits</parameter></paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsect1>
<title>
Description
</title>
<para>
The function comedi_dio_bitfield() allows multiple channels to
be read simultaneously from a digital input or digital I/O device.
The parameter write_mask and the value pointed to by bits
are interpreted as bit fields, with the least significant bit
representing channel 0. For each bit in write_mask that is
set to 1, the cooresponding bit in *bits is written to the digital
output channel. After writing all the output channels, each
channel is read, and the result placed in the approprate bits in
*bits. The result of reading an output channel is undefined.
It is not possible to access channels greater than 31 using this
function.
</para><para>
</para>
</refsect1>
</refentry>
<refentry id="func-ref-comedi-sv-init">
<refmeta>
<refentrytitle>comedi_sv_init</refentrytitle>
<manvolnum>3</manvolnum>
</refmeta>
<refnamediv>
<refname>comedi_sv_init</refname>
<refpurpose>slowly-varying inputs</refpurpose>
</refnamediv>
<refsynopsisdiv>
<funcsynopsis>
<funcsynopsisinfo>#include <comedilib.h></funcsynopsisinfo>
<funcprototype>
<funcdef>int <function>comedi_sv_init</function></funcdef>
<paramdef>comedi_sv_t * <parameter>sv</parameter></paramdef>
<paramdef>comedi_t * <parameter>device</parameter></paramdef>
<paramdef>unsigned int <parameter>subdevice</parameter></paramdef>
<paramdef>unsigned int <parameter>channel</parameter></paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsect1>
<title>
Status
</title>
<para>
deprecated
</para>
</refsect1>
<refsect1>
<title>
Description
</title>
<para>
The function comedi_sv_init() initializes the slow varying Comedi
structure sv to use the device device, the analog input subdevice
subdevice, and the channel channel. The slow varying Comedi
structure is used by comedi_sv_measure() to accurately measure
an analog input by averaging over many samples. The default
number of samples is 100. This function returns 0 on success,
-1 on error.
</para><para>
</para>
</refsect1>
</refentry>
<refentry id="func-ref-comedi-sv-update">
<refmeta>
<refentrytitle>comedi_sv_update</refentrytitle>
<manvolnum>3</manvolnum>
</refmeta>
<refnamediv>
<refname>comedi_sv_update</refname>
<refpurpose>slowly-varying inputs</refpurpose>
</refnamediv>
<refsynopsisdiv>
<funcsynopsis>
<funcsynopsisinfo>#include <comedilib.h></funcsynopsisinfo>
<funcprototype>
<funcdef>int <function>comedi_sv_update</function></funcdef>
<paramdef>comedi_sv_t * <parameter>sv</parameter></paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsect1>
<title>
Status
</title>
<para>
deprecated
</para>
</refsect1>
<refsect1>
<title>
Description
</title>
<para>
The function comedi_sv_update() updates internal parameters of
the slowly varying Comedi structure sv.
</para><para>
</para>
</refsect1>
</refentry>
<refentry id="func-ref-comedi-sv-measure">
<refmeta>
<refentrytitle>comedi_sv_measure</refentrytitle>
<manvolnum>3</manvolnum>
</refmeta>
<refnamediv>
<refname>comedi_sv_measure</refname>
<refpurpose>slowly-varying inputs</refpurpose>
</refnamediv>
<refsynopsisdiv>
<funcsynopsis>
<funcsynopsisinfo>#include <comedilib.h></funcsynopsisinfo>
<funcprototype>
<funcdef>int <function>comedi_sv_measure</function></funcdef>
<paramdef>comedi_sv_t * <parameter>sv</parameter></paramdef>
<paramdef>double * <parameter>data</parameter></paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsect1>
<title>
Status
</title>
<para>
deprecated
</para>
</refsect1>
<refsect1>
<title>
Description
</title>
<para>
The function comedi_sv_measure() uses the slowly varying Comedi
structure sv to measure a slowly varying signal. If sucessful,
the result (in physical units) is stored in the location pointed
to by data, and the number of samples is returned. On error, -1
is returned.
</para><para>
</para>
</refsect1>
</refentry>
<refentry id="func-ref-comedi-get-cmd-src-mask">
<refmeta>
<refentrytitle>comedi_get_cmd_src_mask</refentrytitle>
<manvolnum>3</manvolnum>
</refmeta>
<refnamediv>
<refname>comedi_get_cmd_src_mask</refname>
<refpurpose>streaming input/output capabilities</refpurpose>
</refnamediv>
<refsynopsisdiv>
<funcsynopsis>
<funcsynopsisinfo>#include <comedilib.h></funcsynopsisinfo>
<funcprototype>
<funcdef>int <function>comedi_get_cmd_src_mask</function></funcdef>
<paramdef>comedi_t * <parameter>device</parameter></paramdef>
<paramdef>unsigned int <parameter>subdevice</parameter></paramdef>
<paramdef>comedi_cmd * <parameter>command</parameter></paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsect1>
<title>
Description
</title>
<para>
The command capabilities of the subdevice indicated by the parameters
device and subdevice are probed, and the results placed in the
command structure pointed to by the parameter command. The trigger
source elements of the command structure are set to the logical OR
value of possible trigger sources. Other elements in the structure
are undefined. If sucessful, 0 is returned, otherwise -1.
</para><para>
</para>
</refsect1>
</refentry>
<refentry id="func-ref-comedi-get-cmd-generic-timed">
<refmeta>
<refentrytitle>comedi_get_cmd_generic_timed</refentrytitle>
<manvolnum>3</manvolnum>
</refmeta>
<refnamediv>
<refname>comedi_get_cmd_generic_timed</refname>
<refpurpose>streaming input/output capabilities</refpurpose>
</refnamediv>
<refsynopsisdiv>
<funcsynopsis>
<funcsynopsisinfo>#include <comedilib.h></funcsynopsisinfo>
<funcprototype>
<funcdef>int <function>comedi_get_cmd_generic_timed</function></funcdef>
<paramdef>comedi_t * <parameter>device</parameter></paramdef>
<paramdef>unsigned int <parameter>subdevice</parameter></paramdef>
<paramdef>comedi_cmd * <parameter>command</parameter></paramdef>
<paramdef>unsigned int <parameter>period_ns</parameter></paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsect1>
<title>
Description
</title>
<para>
The command capabilities of the subdevice indicated by the parameters
device and subdevice are probed, and the results placed in the
command structure pointed to by the parameter command. The command
structure pointed to by the parameter command is modified to be a
valid command that can be used as a parameter to comedi_command().
The command measures samples at a rate that corresponds to the
period period_ns. The rate is adjusted to a rate that the device
can handle. If sucessful, 0 is returned, otherwise -1.
</para><para>
</para>
</refsect1>
</refentry>
<refentry id="func-ref-comedi-cancel">
<refmeta>
<refentrytitle>comedi_cancel</refentrytitle>
<manvolnum>3</manvolnum>
</refmeta>
<refnamediv>
<refname>comedi_cancel</refname>
<refpurpose>stop streaming input/output in progress</refpurpose>
</refnamediv>
<refsynopsisdiv>
<funcsynopsis>
<funcsynopsisinfo>#include <comedilib.h></funcsynopsisinfo>
<funcprototype>
<funcdef>int <function>comedi_cancel</function></funcdef>
<paramdef>comedi_t * <parameter>device</parameter></paramdef>
<paramdef>unsigned int <parameter>subdevice</parameter></paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsect1>
<title>
Description
</title>
<para>
The function comedi_cancel() can be used to stop a Comedi command
previously started by comedi_command() that is still in progress
on the subdevice indicated by the parameters device and subdevice.
This may not return the subdevice to a ready state, since there may
be samples in the buffer that need to be read.
</para><para>
If sucessful, 0 is returned, otherwise -1.
</para><para>
</para>
</refsect1>
</refentry>
<refentry id="func-ref-comedi-command">
<refmeta>
<refentrytitle>comedi_command</refentrytitle>
<manvolnum>3</manvolnum>
</refmeta>
<refnamediv>
<refname>comedi_command</refname>
<refpurpose>start streaming input/output</refpurpose>
</refnamediv>
<refsynopsisdiv>
<funcsynopsis>
<funcsynopsisinfo>#include <comedilib.h></funcsynopsisinfo>
<funcprototype>
<funcdef>int <function>comedi_command</function></funcdef>
<paramdef>comedi_t * <parameter>device</parameter></paramdef>
<paramdef>comedi_cmd * <parameter>command</parameter></paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsect1>
<title>
Description
</title>
<para>
The function comedi_command() starts streaming input or output. The
command structure pointed to by the parameter command specifies the
acquisition. The command must be able to pass comedi_command_test()
with a return value of 0, or comedi_command() will fail.
For input subdevices, sample values are read using the
function read(). For output subdevices, sample values are written
using the function write().
</para><para>
If sucessful, 0 is returned, otherwise -1.
</para><para>
</para>
</refsect1>
</refentry>
<refentry id="func-ref-comedi-command-test">
<refmeta>
<refentrytitle>comedi_command_test</refentrytitle>
<manvolnum>3</manvolnum>
</refmeta>
<refnamediv>
<refname>comedi_command_test</refname>
<refpurpose>test streaming input/output configuration</refpurpose>
</refnamediv>
<refsynopsisdiv>
<funcsynopsis>
<funcsynopsisinfo>#include <comedilib.h></funcsynopsisinfo>
<funcprototype>
<funcdef>int <function>comedi_command_test</function></funcdef>
<paramdef>comedi_t * <parameter>device</parameter></paramdef>
<paramdef>comedi_cmd * <parameter>command</parameter></paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsect1>
<title>
Description
</title>
<para>
The function comedi_command_test() tests the command structure pointed
to by the parameter command and returns an integer describing the
testing stages that were sucessfully passed. In addition, if elements
of the command structure are invalid, they may be modified. Source
elements are modified to remove invalid source triggers. Argument
elements are adjusted or rounded to the nearest valid value.
</para><para>
The meanings of the return value are as follows.
</para><para>
0 indicates a valid command.
</para><para>
1 indicates that one of the *_src
members of the command contained an
unsupported trigger. The bits corresponding to the unsupported
triggers are zeroed.
</para><para>
2 indicates that the particular combination
of *_src settings is not supported by the driver, or that
one of the *_src members has the bit corresponding to
multiple trigger sources set at the same time.
</para><para>
3 indicates that one of the *_arg members
of the command is set outside the range of allowable values.
For instance, an argument for a TRIG_TIMER source which
exceeds the board's maximum speed. The invalid *_arg
members will be adjusted to valid values.
</para><para>
4 indicates that one of the *_arg members
required adjustment. For instance, the argument of a
TRIG_TIMER source may have been rounded to the nearest
timing period supported by the board.
</para><para>
5 indicates that some aspect of the
command's chanlist is unsupported by the board. For example,
some board's require that all channels in the chanlist
use the same range.
</para><para>
</para>
</refsect1>
</refentry>
<refentry id="func-ref-comedi-poll">
<refmeta>
<refentrytitle>comedi_poll</refentrytitle>
<manvolnum>3</manvolnum>
</refmeta>
<refnamediv>
<refname>comedi_poll</refname>
<refpurpose>force updating of streaming buffer</refpurpose>
</refnamediv>
<refsynopsisdiv>
<funcsynopsis>
<funcsynopsisinfo>#include <comedilib.h></funcsynopsisinfo>
<funcprototype>
<funcdef>int <function>comedi_poll</function></funcdef>
<paramdef>comedi_t * <parameter>device</parameter></paramdef>
<paramdef>unsigned int <parameter>subdevice</parameter></paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsect1>
<title>
Description
</title>
<para>
The function comedi_poll() is used on a subdevice that has a
Comedi command in progress in order to update the streaming buffer.
If supported by the driver, all available samples are copied to
the streaming buffer. These samples may be pending in DMA buffers
or device FIFOs. If sucessful, the number of additional bytes
available is returned. If there is an error, -1 is returned.
</para><para>
</para>
</refsect1>
</refentry>
<refentry id="func-ref-comedi-set-max-buffer-size">
<refmeta>
<refentrytitle>comedi_set_max_buffer_size</refentrytitle>
<manvolnum>3</manvolnum>
</refmeta>
<refnamediv>
<refname>comedi_set_max_buffer_size</refname>
<refpurpose>streaming buffer size of subdevice</refpurpose>
</refnamediv>
<refsynopsisdiv>
<funcsynopsis>
<funcsynopsisinfo>#include <comedilib.h></funcsynopsisinfo>
<funcprototype>
<funcdef>int <function>comedi_set_max_buffer_size</function></funcdef>
<paramdef>comedi_t * <parameter>device</parameter></paramdef>
<paramdef>unsigned int <parameter>subdevice</parameter></paramdef>
<paramdef>unsigned int <parameter>max_size</parameter></paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsect1>
<title>
Description
</title>
<para>
The function comedi_set_max_buffer_size() changes the maximum
allowable size (in bytes) of the streaming buffer for the subdevice
specified by device and subdevice. Changing the maximum buffer
size requires appropriate privileges. If sucessful, the old buffer
size is returned. On error, -1 is returned.
</para><para>
</para>
</refsect1>
</refentry>
<refentry id="func-ref-comedi-get-buffer-contents">
<refmeta>
<refentrytitle>comedi_get_buffer_contents</refentrytitle>
<manvolnum>3</manvolnum>
</refmeta>
<refnamediv>
<refname>comedi_get_buffer_contents</refname>
<refpurpose>streaming buffer status</refpurpose>
</refnamediv>
<refsynopsisdiv>
<funcsynopsis>
<funcsynopsisinfo>#include <comedilib.h></funcsynopsisinfo>
<funcprototype>
<funcdef>int <function>comedi_get_buffer_contents</function></funcdef>
<paramdef>comedi_t * <parameter>device</parameter></paramdef>
<paramdef>unsigned int <parameter>subdevice</parameter></paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsect1>
<title>
Description
</title>
<para>
The function comedi_get_buffer_contents() is used on a subdevice
that has a Comedi command in progress. The number of bytes that
are available in the streaming buffer is returned. If there is
an error, -1 is returned.
</para><para>
</para>
</refsect1>
</refentry>
<refentry id="func-ref-comedi-mark-buffer-read">
<refmeta>
<refentrytitle>comedi_mark_buffer_read</refentrytitle>
<manvolnum>3</manvolnum>
</refmeta>
<refnamediv>
<refname>comedi_mark_buffer_read</refname>
<refpurpose>streaming buffer status</refpurpose>
</refnamediv>
<refsynopsisdiv>
<funcsynopsis>
<funcsynopsisinfo>#include <comedilib.h></funcsynopsisinfo>
<funcprototype>
<funcdef>int <function>comedi_mark_buffer_read</function></funcdef>
<paramdef>comedi_t * <parameter>device</parameter></paramdef>
<paramdef>unsigned int <parameter>subdevice</parameter></paramdef>
<paramdef>unsigned int <parameter>num_bytes</parameter></paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsect1>
<title>
Description
</title>
<para>
The function comedi_mark_buffer_read() is used on a subdevice
that has a Comedi command in progress. This function can be
used to indicate that the next num_bytes bytes in the buffer
are no longer needed and may be discarded.
If there is an error, -1 is returned.
</para><para>
</para>
</refsect1>
</refentry>
<refentry id="func-ref-comedi-get-buffer-offset">
<refmeta>
<refentrytitle>comedi_get_buffer_offset</refentrytitle>
<manvolnum>3</manvolnum>
</refmeta>
<refnamediv>
<refname>comedi_get_buffer_offset</refname>
<refpurpose>streaming buffer status</refpurpose>
</refnamediv>
<refsynopsisdiv>
<funcsynopsis>
<funcsynopsisinfo>#include <comedilib.h></funcsynopsisinfo>
<funcprototype>
<funcdef>int <function>comedi_get_buffer_offset</function></funcdef>
<paramdef>comedi_t * <parameter>device</parameter></paramdef>
<paramdef>unsigned int <parameter>subdevice</parameter></paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsect1>
<title>
Description
</title>
<para>
The function comedi_get_buffer_offset() is used on a subdevice
that has a Comedi command in progress. This function returns
the offset in bytes of the read pointer in the streaming buffer.
This offset is only useful for memory mapped buffers.
If there is an error, -1 is returned.
</para><para>
</para>
</refsect1>
</refentry>
<refentry id="func-ref-comedi-get-timer">
<refmeta>
<refentrytitle>comedi_get_timer</refentrytitle>
<manvolnum>3</manvolnum>
</refmeta>
<refnamediv>
<refname>comedi_get_timer</refname>
<refpurpose>timer information (deprecated)</refpurpose>
</refnamediv>
<refsynopsisdiv>
<funcsynopsis>
<funcsynopsisinfo>#include <comedilib.h></funcsynopsisinfo>
<funcprototype>
<funcdef>int <function>comedi_get_timer</function></funcdef>
<paramdef>comedi_t * <parameter>device</parameter></paramdef>
<paramdef>unsigned int <parameter>subdevice</parameter></paramdef>
<paramdef>double <parameter>frequency</parameter></paramdef>
<paramdef>unsigned int * <parameter>trigvar</parameter></paramdef>
<paramdef>double * <parameter>actual_frequency</parameter></paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsect1>
<title>
Status
</title>
<para>
deprecated
</para>
</refsect1>
<refsect1>
<title>
Description
</title>
<para>
The function comedi_get_timer converts the frequency frequency
to a number suitable to send to the driver in a comedi_trig
structure. This function remains for compatibility with very
old versions of Comedi, that converted sampling rates to timer
values in the libary. This conversion is now done in the kernel,
and every device has the timer type nanosec_timer, indicating
that timer values are simply a time specified in nanoseconds.
</para><para>
</para>
</refsect1>
</refentry>
<refentry id="func-ref-comedi-timed-1chan">
<refmeta>
<refentrytitle>comedi_timed_1chan</refentrytitle>
<manvolnum>3</manvolnum>
</refmeta>
<refnamediv>
<refname>comedi_timed_1chan</refname>
<refpurpose>streaming input (deprecated)</refpurpose>
</refnamediv>
<refsynopsisdiv>
<funcsynopsis>
<funcsynopsisinfo>#include <comedilib.h></funcsynopsisinfo>
<funcprototype>
<funcdef>int <function>comedi_timed_1chan</function></funcdef>
<paramdef>comedi_t * <parameter>device</parameter></paramdef>
<paramdef>unsigned int <parameter>subdevice</parameter></paramdef>
<paramdef>unsigned int <parameter>channel</parameter></paramdef>
<paramdef>unsigned int <parameter>range</parameter></paramdef>
<paramdef>unsigned int <parameter>aref</parameter></paramdef>
<paramdef>double <parameter>frequency</parameter></paramdef>
<paramdef>unsigned int <parameter>num_samples</parameter></paramdef>
<paramdef>double * <parameter>data</parameter></paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsect1>
<title>
Status
</title>
<para>
deprecated
</para>
</refsect1>
<refsect1>
<title>
Description
</title>
<para>
Not documented.
</para><para>
</para>
</refsect1>
</refentry>
<refentry id="func-ref-comedi-set-global-oor-behavior">
<refmeta>
<refentrytitle>comedi_set_global_oor_behavior</refentrytitle>
<manvolnum>3</manvolnum>
</refmeta>
<refnamediv>
<refname>comedi_set_global_oor_behavior</refname>
<refpurpose>out-of-range behavior</refpurpose>
</refnamediv>
<refsynopsisdiv>
<funcsynopsis>
<funcsynopsisinfo>#include <comedilib.h></funcsynopsisinfo>
<funcprototype>
<funcdef>int <function>comedi_set_global_oor_behavior</function></funcdef>
<paramdef>enum comedi_oor_behavior <parameter>behavior</parameter></paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsect1>
<title>
Status
</title>
<para>
alpha
</para>
</refsect1>
<refsect1>
<title>
Description
</title>
<para>
This function changes the Comedilib out-of-range behavior.
This currently affects the behavior of comedi_to_phys() when
converting endpoint sample values, that is, sample values
equal to 0 or maxdata. If the out-of-range behavior is set to
COMEDI_OOR_NAN, endpoint values are converted to NAN. If the
out-of-range behavior is set to COMEDI_OOR_NUMBER, the endpoint
values are converted similarly to other values.
</para><para>
The previous out-of-range behavior is returned.
</para><para>
</para>
</refsect1>
</refentry>
<refentry id="func-ref-comedi-apply-calibration">
<refmeta>
<refentrytitle>comedi_apply_calibration</refentrytitle>
<manvolnum>3</manvolnum>
</refmeta>
<refnamediv>
<refname>comedi_apply_calibration</refname>
<refpurpose>set calibration from file</refpurpose>
</refnamediv>
<refsynopsisdiv>
<funcsynopsis>
<funcsynopsisinfo>#include <comedilib.h></funcsynopsisinfo>
<funcprototype>
<funcdef>int <function>comedi_apply_calibration</function></funcdef>
<paramdef>comedi_t <parameter>*device</parameter></paramdef>
<paramdef>unsigned int <parameter>subdevice</parameter></paramdef>
<paramdef>unsigned int <parameter>channel</parameter></paramdef>
<paramdef>unsigned int <parameter>range</parameter></paramdef>
<paramdef>unsigned int <parameter>aref</parameter></paramdef>
<paramdef>const char <parameter>*file_path</parameter></paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsect1>
<title>
Status
</title>
<para>
alpha
</para>
</refsect1>
<refsect1>
<title>
Description
</title>
<para>
This function sets the calibration of the specified subdevice
so that it is in proper calibration when using the specified
channel, range and aref. It does so by performing writes
to the appropriate channels of the board's calibration
subdevice(s). Depending on the hardware, the
calibration settings used may or may not depend on the channel,
range, or aref. Furthermore, the calibrations for different
channels, ranges, or arefs may not be independent.
For example, some boards cannot have their analog inputs calibrated
for multiple input
ranges simultaneously. Applying a calibration for range 1 may
blow away a previously applied calibration for range 0. Applying
a calibration for analog input channel 0 may cause the same
calibration to be applied to all the
other analog input channels as well.
Your only guarantee is that calls to comedi_apply_calibration()
on different subdevices will not interfere with each other.
</para><para>
In practice, their are some rules of thumb on how
calibrations behave. No calibrations depend on the aref.
A multiplexed analog input will have calibration settings that
do not depend on the channel, and applying a setting for one
channel will affect
all channels equally. Analog outputs, and analog inputs
with independent a/d converters for each input channel, will have
calibrations settings which do depend on the channel, and the
settings for each channel will be independent of the other
channels.
</para><para>
If you wish to investigate exactly what comedi_apply_calibration()
is doing, you can perform reads on your board's calibration
subdevice to see which calibration channels it is changing.
You can also try to decipher the calibration file directly (it's a
text file).
</para><para>
The file_path parameter can be used
to specify the file which contains the calibration information.
If <parameter>file_path</parameter> is NULL, then comedilib
will use a default
file location. The calibration information used by this function
is generated by the comedi_calibrate program (see its man page).
</para><para>
The functions comedi_parse_calibration_file(),
comedi_apply_parsed_calibration(), and comedi_cleanup_calibration()
provide the same functionality at a slightly lower level.
</para>
</refsect1>
<refsect1>
<title>
Return value
</title>
<para>
Zero on success, a negative number on failure.
</para><para>
</para>
</refsect1>
</refentry>
<refentry id="func-ref-comedi-apply-parsed-calibration">
<refmeta>
<refentrytitle>comedi_apply_parsed_calibration</refentrytitle>
<manvolnum>3</manvolnum>
</refmeta>
<refnamediv>
<refname>comedi_apply_parsed_calibration</refname>
<refpurpose>set calibration from memory</refpurpose>
</refnamediv>
<refsynopsisdiv>
<funcsynopsis>
<funcsynopsisinfo>#include <comedilib.h></funcsynopsisinfo>
<funcprototype>
<funcdef>int <function>comedi_apply_parsed_calibration</function></funcdef>
<paramdef>comedi_t * <parameter>device</parameter></paramdef>
<paramdef>unsigned int <parameter>subdevice</parameter></paramdef>
<paramdef>unsigned int <parameter>channel</parameter></paramdef>
<paramdef>unsigned int <parameter>range</parameter></paramdef>
<paramdef>unsigned int <parameter>aref</parameter></paramdef>
<paramdef>const comedi_calibration_t <parameter>*calibration</parameter></paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsect1>
<title>
Status
</title>
<para>
alpha
</para>
</refsect1>
<refsect1>
<title>
Description
</title>
<para>
This function is similar to comedi_apply_calibration()
except the calibration information is read from memory
instead of a file. This function can be more
efficient than comedi_apply_calibration() since the
calibration file does not need to be reparsed with
every call. The <parameter>calibration</parameter> is
obtained by a call to comedi_parse_calibration_file().
</para><para>
</para>
</refsect1>
<refsect1>
<title>
Return value
</title>
<para>
Zero on success, a negative number on failure.
</para><para>
</para>
</refsect1>
</refentry>
<refentry id="func-ref-comedi-cleanup-calibration-file">
<refmeta>
<refentrytitle>comedi_cleanup_calibration_file</refentrytitle>
<manvolnum>3</manvolnum>
</refmeta>
<refnamediv>
<refname>comedi_cleanup_calibration_file</refname>
<refpurpose>free calibration resources</refpurpose>
</refnamediv>
<refsynopsisdiv>
<funcsynopsis>
<funcsynopsisinfo>#include <comedilib.h></funcsynopsisinfo>
<funcprototype>
<funcdef>void <function>comedi_cleanup_calibration_file</function></funcdef>
<paramdef>comedi_calibration_t <parameter>*calibration</parameter></paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsect1>
<title>
Status
</title>
<para>
alpha
</para>
</refsect1>
<refsect1>
<title>
Description
</title>
<para>
This function frees the resources associated with a
<parameter>calibration</parameter> obtained from
comedi_parse_calibration_file(). <parameter>calibration</parameter>
can not be used again after calling this function.
</para><para>
</para>
</refsect1>
</refentry>
<refentry id="func-ref-comedi-get-default-calibration-path">
<refmeta>
<refentrytitle>comedi_get_default_calibration_path</refentrytitle>
<manvolnum>3</manvolnum>
</refmeta>
<refnamediv>
<refname>comedi_get_default_calibration_path</refname>
<refpurpose>get default calibration file path</refpurpose>
</refnamediv>
<refsynopsisdiv>
<funcsynopsis>
<funcsynopsisinfo>#include <comedilib.h></funcsynopsisinfo>
<funcprototype>
<funcdef>char* <function>comedi_get_default_calibration_path</function></funcdef>
<paramdef>comedi_t <parameter>*dev</parameter></paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsect1>
<title>
Status
</title>
<para>
alpha
</para>
</refsect1>
<refsect1>
<title>
Description
</title>
<para>
This function returns a string containing a default calibration file
path appropriate for <parameter>dev</parameter>. Memory for the
string is allocated by the function, and should be freed when
the string is no longer needed.
</para>
</refsect1>
<refsect1>
<title>
Return value
</title>
<para>
A string which contains a file path useable by
comedi_parse_calibration_file(). On error, NULL is returned.
</para><para>
</para>
</refsect1>
</refentry>
<refentry id="func-ref-comedi-parse-calibration-file">
<refmeta>
<refentrytitle>comedi_parse_calibration_file</refentrytitle>
<manvolnum>3</manvolnum>
</refmeta>
<refnamediv>
<refname>comedi_parse_calibration_file</refname>
<refpurpose>set calibration</refpurpose>
</refnamediv>
<refsynopsisdiv>
<funcsynopsis>
<funcsynopsisinfo>#include <comedilib.h></funcsynopsisinfo>
<funcprototype>
<funcdef>comedi_calibration_t* <function>comedi_parse_calibration_file</function></funcdef>
<paramdef>const char <parameter>*file_path</parameter></paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsect1>
<title>
Status
</title>
<para>
alpha
</para>
</refsect1>
<refsect1>
<title>
Description
</title>
<para>
This function parses a calibration file (produced by the
comedi_calibrate program) and returns a pointer to a
comedi_calibration_t which can be passed to the
comedi_apply_parsed_calibration() function. When you are
finished using the comedi_calibration_t, you should
call comedi_cleanup_calibration() to free the resources
associated with the comedi_calibration_t.
</para><para>
The comedi_get_default_calibration_path() function may
be useful in conjunction with this function.
</para>
</refsect1>
<refsect1>
<title>
Return value
</title>
<para>
A pointer to parsed calibration information on success, or NULL on failure.
</para>
</refsect1>
</refentry>
</section>
|