libiio  0.21
Library for interfacing with IIO devices
iio.h
Go to the documentation of this file.
1 /*
2  * libiio - Library for interfacing industrial I/O (IIO) devices
3  *
4  * Copyright (C) 2014 Analog Devices, Inc.
5  * Author: Paul Cercueil <paul.cercueil@analog.com>
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * */
18 
22 #ifndef __IIO_H__
23 #define __IIO_H__
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
29 #include <limits.h>
30 #include <stdint.h>
31 #include <stdlib.h>
32 #include <stddef.h>
33 
34 #if (defined(_WIN32) || defined(__MBED__))
35 #ifndef _SSIZE_T_DEFINED
36 typedef ptrdiff_t ssize_t;
37 #define _SSIZE_T_DEFINED
38 #endif
39 #else
40 #include <sys/types.h>
41 #endif
42 
43 #if defined(_MSC_VER) && (_MSC_VER < 1800) && !defined(__BOOL_DEFINED)
44 #undef bool
45 #undef false
46 #undef true
47 #define bool char
48 #define false 0
49 #define true 1
50 #else
51 #include <stdbool.h>
52 #endif
53 
54 #if defined(__GNUC__) && !defined(MATLAB_MEX_FILE) && !defined(MATLAB_LOADLIBRARY)
55 #ifndef __cnst
56 #define __cnst __attribute__((const))
57 #endif
58 #ifndef __pure
59 #define __pure __attribute__((pure))
60 #endif
61 #define __notused __attribute__((unused))
62 #ifdef IIO_CHECK_RET
63 #define __check_ret __attribute__((warn_unused_result))
64 #else
65 #define __check_ret
66 #endif
67 #else
68 #define __cnst
69 #define __pure
70 #define __notused
71 #define __check_ret
72 #endif
73 
74 #ifdef _WIN32
75 # ifdef LIBIIO_EXPORTS
76 # define __api __declspec(dllexport)
77 # else
78 # define __api __declspec(dllimport)
79 # endif
80 #elif __GNUC__ >= 4 && !defined(MATLAB_MEX_FILE) && !defined(MATLAB_LOADLIBRARY)
81 # define __api __attribute__((visibility ("default")))
82 #else
83 # define __api
84 #endif
85 
86 struct iio_context;
87 struct iio_device;
88 struct iio_channel;
89 struct iio_buffer;
90 
91 struct iio_context_info;
92 struct iio_scan_context;
93 struct iio_scan_block;
94 
103  IIO_VOLTAGE,
104  IIO_CURRENT,
105  IIO_POWER,
106  IIO_ACCEL,
107  IIO_ANGL_VEL,
108  IIO_MAGN,
109  IIO_LIGHT,
110  IIO_INTENSITY,
111  IIO_PROXIMITY,
112  IIO_TEMP,
113  IIO_INCLI,
114  IIO_ROT,
115  IIO_ANGL,
116  IIO_TIMESTAMP,
117  IIO_CAPACITANCE,
118  IIO_ALTVOLTAGE,
119  IIO_CCT,
120  IIO_PRESSURE,
121  IIO_HUMIDITYRELATIVE,
122  IIO_ACTIVITY,
123  IIO_STEPS,
124  IIO_ENERGY,
125  IIO_DISTANCE,
126  IIO_VELOCITY,
127  IIO_CONCENTRATION,
128  IIO_RESISTANCE,
129  IIO_PH,
130  IIO_UVINDEX,
131  IIO_ELECTRICALCONDUCTIVITY,
132  IIO_COUNT,
133  IIO_INDEX,
134  IIO_GRAVITY,
135  IIO_POSITIONRELATIVE,
136  IIO_PHASE,
137  IIO_MASSCONCENTRATION,
138  IIO_CHAN_TYPE_UNKNOWN = INT_MAX
139 };
140 
149  IIO_NO_MOD,
150  IIO_MOD_X,
151  IIO_MOD_Y,
152  IIO_MOD_Z,
153  IIO_MOD_X_AND_Y,
154  IIO_MOD_X_AND_Z,
155  IIO_MOD_Y_AND_Z,
156  IIO_MOD_X_AND_Y_AND_Z,
157  IIO_MOD_X_OR_Y,
158  IIO_MOD_X_OR_Z,
159  IIO_MOD_Y_OR_Z,
160  IIO_MOD_X_OR_Y_OR_Z,
161  IIO_MOD_LIGHT_BOTH,
162  IIO_MOD_LIGHT_IR,
163  IIO_MOD_ROOT_SUM_SQUARED_X_Y,
164  IIO_MOD_SUM_SQUARED_X_Y_Z,
165  IIO_MOD_LIGHT_CLEAR,
166  IIO_MOD_LIGHT_RED,
167  IIO_MOD_LIGHT_GREEN,
168  IIO_MOD_LIGHT_BLUE,
169  IIO_MOD_QUATERNION,
170  IIO_MOD_TEMP_AMBIENT,
171  IIO_MOD_TEMP_OBJECT,
172  IIO_MOD_NORTH_MAGN,
173  IIO_MOD_NORTH_TRUE,
174  IIO_MOD_NORTH_MAGN_TILT_COMP,
175  IIO_MOD_NORTH_TRUE_TILT_COMP,
176  IIO_MOD_RUNNING,
177  IIO_MOD_JOGGING,
178  IIO_MOD_WALKING,
179  IIO_MOD_STILL,
180  IIO_MOD_ROOT_SUM_SQUARED_X_Y_Z,
181  IIO_MOD_I,
182  IIO_MOD_Q,
183  IIO_MOD_CO2,
184  IIO_MOD_VOC,
185  IIO_MOD_LIGHT_UV,
186  IIO_MOD_LIGHT_DUV,
187  IIO_MOD_PM1,
188  IIO_MOD_PM2P5,
189  IIO_MOD_PM4,
190  IIO_MOD_PM10,
191  IIO_MOD_ETHANOL,
192  IIO_MOD_H2,
193  IIO_MOD_O2,
194 };
195 
196 /* ---------------------------------------------------------------------------*/
197 /* ------------------------- Scan functions ----------------------------------*/
216 __api __check_ret struct iio_scan_context * iio_create_scan_context(
217  const char *backend, unsigned int flags);
218 
219 
224 __api void iio_scan_context_destroy(struct iio_scan_context *ctx);
225 
226 
234 __api __check_ret ssize_t iio_scan_context_get_info_list(struct iio_scan_context *ctx,
235  struct iio_context_info ***info);
236 
237 
241 __api void iio_context_info_list_free(struct iio_context_info **info);
242 
243 
248 __api __check_ret __pure const char * iio_context_info_get_description(
249  const struct iio_context_info *info);
250 
251 
256 __api __check_ret __pure const char * iio_context_info_get_uri(
257  const struct iio_context_info *info);
258 
259 
268 __api struct iio_scan_block * iio_create_scan_block(
269  const char *backend, unsigned int flags);
270 
271 
278 __api void iio_scan_block_destroy(struct iio_scan_block *blk);
279 
280 
287 __api ssize_t iio_scan_block_scan(struct iio_scan_block *blk);
288 
289 
299  struct iio_scan_block *blk, unsigned int index);
300 
301 /* ------------------------------------------------------------------*/
303 /* ------------------------- Top-level functions -----------------------------*/
312 __api void iio_library_get_version(unsigned int *major,
313  unsigned int *minor, char git_tag[8]);
314 
315 
321 __api void iio_strerror(int err, char *dst, size_t len);
322 
323 
329 __api __check_ret __cnst bool iio_has_backend(const char *backend);
330 
331 
336 __api __check_ret __cnst unsigned int iio_get_backends_count(void);
337 
338 
345 __api __check_ret __cnst const char * iio_get_backend(unsigned int index);
346 
347 /* ------------------------------------------------------------------*/
349 /* ------------------------- Context functions -------------------------------*/
365 __api __check_ret struct iio_context * iio_create_default_context(void);
366 
367 
371 __api __check_ret struct iio_context * iio_create_local_context(void);
372 
373 
381 __api __check_ret struct iio_context * iio_create_xml_context(const char *xml_file);
382 
383 
392 __api __check_ret struct iio_context * iio_create_xml_context_mem(
393  const char *xml, size_t len);
394 
395 
400 __api __check_ret struct iio_context * iio_create_network_context(const char *host);
401 
402 
433 __api __check_ret struct iio_context * iio_create_context_from_uri(const char *uri);
434 
435 
444 __api __check_ret struct iio_context * iio_context_clone(const struct iio_context *ctx);
445 
446 
451 __api void iio_context_destroy(struct iio_context *ctx);
452 
453 
461 __api __check_ret int iio_context_get_version(const struct iio_context *ctx,
462  unsigned int *major, unsigned int *minor, char git_tag[8]);
463 
464 
468 __api __check_ret __pure const char * iio_context_get_xml(const struct iio_context *ctx);
469 
470 
478 __api __check_ret __pure const char * iio_context_get_name(const struct iio_context *ctx);
479 
480 
487 __api __check_ret __pure const char * iio_context_get_description(
488  const struct iio_context *ctx);
489 
490 
496 __api __check_ret __pure unsigned int iio_context_get_attrs_count(
497  const struct iio_context *ctx);
498 
499 
509 __api __check_ret int iio_context_get_attr(
510  const struct iio_context *ctx, unsigned int index,
511  const char **name, const char **value);
512 
513 
522 __api __check_ret const char * iio_context_get_attr_value(
523  const struct iio_context *ctx, const char *name);
524 
525 
529 __api __check_ret __pure unsigned int iio_context_get_devices_count(
530  const struct iio_context *ctx);
531 
532 
538 __api __check_ret __pure struct iio_device * iio_context_get_device(
539  const struct iio_context *ctx, unsigned int index);
540 
541 
549 __api __check_ret __pure struct iio_device * iio_context_find_device(
550  const struct iio_context *ctx, const char *name);
551 
552 
560 __api __check_ret int iio_context_set_timeout(
561  struct iio_context *ctx, unsigned int timeout_ms);
562 
563 /* ------------------------------------------------------------------*/
565 /* ------------------------- Device functions --------------------------------*/
575 __api __check_ret __pure const struct iio_context * iio_device_get_context(
576  const struct iio_device *dev);
577 
578 
582 __api __check_ret __pure const char * iio_device_get_id(const struct iio_device *dev);
583 
584 
590 __api __check_ret __pure const char * iio_device_get_name(const struct iio_device *dev);
591 
592 
596 __api __check_ret __pure unsigned int iio_device_get_channels_count(
597  const struct iio_device *dev);
598 
599 
603 __api __check_ret __pure unsigned int iio_device_get_attrs_count(
604  const struct iio_device *dev);
605 
609 __api __check_ret __pure unsigned int iio_device_get_buffer_attrs_count(
610  const struct iio_device *dev);
611 
617 __api __check_ret __pure struct iio_channel * iio_device_get_channel(
618  const struct iio_device *dev, unsigned int index);
619 
620 
626 __api __check_ret __pure const char * iio_device_get_attr(
627  const struct iio_device *dev, unsigned int index);
628 
634 __api __check_ret __pure const char * iio_device_get_buffer_attr(
635  const struct iio_device *dev, unsigned int index);
636 
645 __api __check_ret __pure struct iio_channel * iio_device_find_channel(
646  const struct iio_device *dev, const char *name, bool output);
647 
648 
660 __api __check_ret __pure const char * iio_device_find_attr(
661  const struct iio_device *dev, const char *name);
662 
674 __api __check_ret __pure const char * iio_device_find_buffer_attr(
675  const struct iio_device *dev, const char *name);
676 
698 __api __check_ret ssize_t iio_device_attr_read(const struct iio_device *dev,
699  const char *attr, char *dst, size_t len);
700 
701 
712 __api __check_ret int iio_device_attr_read_all(struct iio_device *dev,
713  int (*cb)(struct iio_device *dev, const char *attr,
714  const char *value, size_t len, void *d),
715  void *data);
716 
717 
725 __api __check_ret int iio_device_attr_read_bool(const struct iio_device *dev,
726  const char *attr, bool *val);
727 
728 
736 __api __check_ret int iio_device_attr_read_longlong(const struct iio_device *dev,
737  const char *attr, long long *val);
738 
739 
747 __api __check_ret int iio_device_attr_read_double(const struct iio_device *dev,
748  const char *attr, double *val);
749 
750 
769 __api __check_ret ssize_t iio_device_attr_write(const struct iio_device *dev,
770  const char *attr, const char *src);
771 
772 
781 __api __check_ret ssize_t iio_device_attr_write_raw(const struct iio_device *dev,
782  const char *attr, const void *src, size_t len);
783 
784 
795 __api __check_ret int iio_device_attr_write_all(struct iio_device *dev,
796  ssize_t (*cb)(struct iio_device *dev,
797  const char *attr, void *buf, size_t len, void *d),
798  void *data);
799 
800 
808 __api __check_ret int iio_device_attr_write_bool(const struct iio_device *dev,
809  const char *attr, bool val);
810 
811 
819 __api __check_ret int iio_device_attr_write_longlong(const struct iio_device *dev,
820  const char *attr, long long val);
821 
822 
830 __api __check_ret int iio_device_attr_write_double(const struct iio_device *dev,
831  const char *attr, double val);
832 
855 __api __check_ret ssize_t iio_device_buffer_attr_read(const struct iio_device *dev,
856  const char *attr, char *dst, size_t len);
857 
868 __api __check_ret int iio_device_buffer_attr_read_all(struct iio_device *dev,
869  int (*cb)(struct iio_device *dev, const char *attr,
870  const char *value, size_t len, void *d),
871  void *data);
872 
873 
881 __api __check_ret int iio_device_buffer_attr_read_bool(const struct iio_device *dev,
882  const char *attr, bool *val);
883 
884 
892 __api __check_ret int iio_device_buffer_attr_read_longlong(const struct iio_device *dev,
893  const char *attr, long long *val);
894 
895 
903 __api __check_ret int iio_device_buffer_attr_read_double(const struct iio_device *dev,
904  const char *attr, double *val);
905 
906 
926 __api __check_ret ssize_t iio_device_buffer_attr_write(const struct iio_device *dev,
927  const char *attr, const char *src);
928 
929 
938 __api __check_ret ssize_t iio_device_buffer_attr_write_raw(const struct iio_device *dev,
939  const char *attr, const void *src, size_t len);
940 
941 
952 __api __check_ret int iio_device_buffer_attr_write_all(struct iio_device *dev,
953  ssize_t (*cb)(struct iio_device *dev,
954  const char *attr, void *buf, size_t len, void *d),
955  void *data);
956 
957 
965 __api __check_ret int iio_device_buffer_attr_write_bool(const struct iio_device *dev,
966  const char *attr, bool val);
967 
968 
976 __api __check_ret int iio_device_buffer_attr_write_longlong(const struct iio_device *dev,
977  const char *attr, long long val);
978 
979 
987 __api __check_ret int iio_device_buffer_attr_write_double(const struct iio_device *dev,
988  const char *attr, double val);
989 
990 
994 __api void iio_device_set_data(struct iio_device *dev, void *data);
995 
996 
1000 __api void * iio_device_get_data(const struct iio_device *dev);
1001 
1002 
1010 __api __check_ret int iio_device_get_trigger(const struct iio_device *dev,
1011  const struct iio_device **trigger);
1012 
1013 
1020 __api __check_ret int iio_device_set_trigger(const struct iio_device *dev,
1021  const struct iio_device *trigger);
1022 
1023 
1027 __api __check_ret __pure bool iio_device_is_trigger(const struct iio_device *dev);
1028 
1036 __api __check_ret int iio_device_set_kernel_buffers_count(const struct iio_device *dev,
1037  unsigned int nb_buffers);
1038 /* ------------------------------------------------------------------*/
1040 /* ------------------------- Channel functions -------------------------------*/
1050 __api __check_ret __pure const struct iio_device * iio_channel_get_device(
1051  const struct iio_channel *chn);
1052 
1053 
1057 __api __check_ret __pure const char * iio_channel_get_id(const struct iio_channel *chn);
1058 
1059 
1065 __api __check_ret __pure const char * iio_channel_get_name(const struct iio_channel *chn);
1066 
1067 
1071 __api __check_ret __pure bool iio_channel_is_output(const struct iio_channel *chn);
1072 
1073 
1081 __api __check_ret __pure bool iio_channel_is_scan_element(const struct iio_channel *chn);
1082 
1083 
1087 __api __check_ret __pure unsigned int iio_channel_get_attrs_count(
1088  const struct iio_channel *chn);
1089 
1090 
1096 __api __check_ret __pure const char * iio_channel_get_attr(
1097  const struct iio_channel *chn, unsigned int index);
1098 
1099 
1111 __api __check_ret __pure const char * iio_channel_find_attr(
1112  const struct iio_channel *chn, const char *name);
1113 
1114 
1121 __api __check_ret __pure const char * iio_channel_attr_get_filename(
1122  const struct iio_channel *chn, const char *attr);
1123 
1124 
1146 __api __check_ret ssize_t iio_channel_attr_read(const struct iio_channel *chn,
1147  const char *attr, char *dst, size_t len);
1148 
1149 
1160 __api __check_ret int iio_channel_attr_read_all(struct iio_channel *chn,
1161  int (*cb)(struct iio_channel *chn,
1162  const char *attr, const char *val, size_t len, void *d),
1163  void *data);
1164 
1165 
1173 __api __check_ret int iio_channel_attr_read_bool(const struct iio_channel *chn,
1174  const char *attr, bool *val);
1175 
1176 
1184 __api __check_ret int iio_channel_attr_read_longlong(const struct iio_channel *chn,
1185  const char *attr, long long *val);
1186 
1187 
1195 __api __check_ret int iio_channel_attr_read_double(const struct iio_channel *chn,
1196  const char *attr, double *val);
1197 
1198 
1217 __api __check_ret ssize_t iio_channel_attr_write(const struct iio_channel *chn,
1218  const char *attr, const char *src);
1219 
1220 
1229 __api __check_ret ssize_t iio_channel_attr_write_raw(const struct iio_channel *chn,
1230  const char *attr, const void *src, size_t len);
1231 
1232 
1243 __api __check_ret int iio_channel_attr_write_all(struct iio_channel *chn,
1244  ssize_t (*cb)(struct iio_channel *chn,
1245  const char *attr, void *buf, size_t len, void *d),
1246  void *data);
1247 
1248 
1256 __api __check_ret int iio_channel_attr_write_bool(const struct iio_channel *chn,
1257  const char *attr, bool val);
1258 
1259 
1267 __api __check_ret int iio_channel_attr_write_longlong(const struct iio_channel *chn,
1268  const char *attr, long long val);
1269 
1270 
1278 __api __check_ret int iio_channel_attr_write_double(const struct iio_channel *chn,
1279  const char *attr, double val);
1280 
1281 
1288 __api void iio_channel_enable(struct iio_channel *chn);
1289 
1290 
1293 __api void iio_channel_disable(struct iio_channel *chn);
1294 
1295 
1299 __api __check_ret bool iio_channel_is_enabled(const struct iio_channel *chn);
1300 
1301 
1309 __api __check_ret size_t iio_channel_read_raw(const struct iio_channel *chn,
1310  struct iio_buffer *buffer, void *dst, size_t len);
1311 
1312 
1320 __api __check_ret size_t iio_channel_read(const struct iio_channel *chn,
1321  struct iio_buffer *buffer, void *dst, size_t len);
1322 
1323 
1331 __api __check_ret size_t iio_channel_write_raw(const struct iio_channel *chn,
1332  struct iio_buffer *buffer, const void *src, size_t len);
1333 
1334 
1342 __api __check_ret size_t iio_channel_write(const struct iio_channel *chn,
1343  struct iio_buffer *buffer, const void *src, size_t len);
1344 
1345 
1349 __api void iio_channel_set_data(struct iio_channel *chn, void *data);
1350 
1351 
1355 __api void * iio_channel_get_data(const struct iio_channel *chn);
1356 
1357 
1361 __api __check_ret __pure enum iio_chan_type iio_channel_get_type(
1362  const struct iio_channel *chn);
1363 
1364 
1368 __api __check_ret __pure enum iio_modifier iio_channel_get_modifier(
1369  const struct iio_channel *chn);
1370 
1371 /* ------------------------------------------------------------------*/
1373 /* ------------------------- Buffer functions --------------------------------*/
1383 __api __check_ret __pure const struct iio_device * iio_buffer_get_device(
1384  const struct iio_buffer *buf);
1385 
1386 
1396 __api __check_ret struct iio_buffer * iio_device_create_buffer(const struct iio_device *dev,
1397  size_t samples_count, bool cyclic);
1398 
1399 
1404 __api void iio_buffer_destroy(struct iio_buffer *buf);
1405 
1414 __api __check_ret int iio_buffer_get_poll_fd(struct iio_buffer *buf);
1415 
1427 __api __check_ret int iio_buffer_set_blocking_mode(struct iio_buffer *buf, bool blocking);
1428 
1429 
1436 __api __check_ret ssize_t iio_buffer_refill(struct iio_buffer *buf);
1437 
1438 
1445 __api __check_ret ssize_t iio_buffer_push(struct iio_buffer *buf);
1446 
1447 
1455 __api __check_ret ssize_t iio_buffer_push_partial(struct iio_buffer *buf,
1456  size_t samples_count);
1457 
1481 __api void iio_buffer_cancel(struct iio_buffer *buf);
1482 
1483 
1487 __api void * iio_buffer_start(const struct iio_buffer *buf);
1488 
1489 
1505 __api void * iio_buffer_first(const struct iio_buffer *buf,
1506  const struct iio_channel *chn);
1507 
1508 
1513 __api __check_ret ptrdiff_t iio_buffer_step(const struct iio_buffer *buf);
1514 
1515 
1520 __api void * iio_buffer_end(const struct iio_buffer *buf);
1521 
1522 
1534 __api __check_ret ssize_t iio_buffer_foreach_sample(struct iio_buffer *buf,
1535  ssize_t (*callback)(const struct iio_channel *chn,
1536  void *src, size_t bytes, void *d), void *data);
1537 
1538 
1542 __api void iio_buffer_set_data(struct iio_buffer *buf, void *data);
1543 
1544 
1548 __api void * iio_buffer_get_data(const struct iio_buffer *buf);
1549 
1550 /* ------------------------------------------------------------------*/
1552 /* ------------------------- Low-level functions -----------------------------*/
1564  unsigned int length;
1565 
1567  unsigned int bits;
1568 
1570  unsigned int shift;
1571 
1574 
1577 
1579  bool is_be;
1580 
1583 
1585  double scale;
1586 
1588  unsigned int repeat;
1589 };
1590 
1591 
1599 __api __check_ret ssize_t iio_device_get_sample_size(const struct iio_device *dev);
1600 
1601 
1606 __api __check_ret __pure long iio_channel_get_index(const struct iio_channel *chn);
1607 
1608 
1612 __api __check_ret __cnst const struct iio_data_format * iio_channel_get_data_format(
1613  const struct iio_channel *chn);
1614 
1615 
1621 __api void iio_channel_convert(const struct iio_channel *chn,
1622  void *dst, const void *src);
1623 
1624 
1630 __api void iio_channel_convert_inverse(const struct iio_channel *chn,
1631  void *dst, const void *src);
1632 
1633 
1637 __api __check_ret __pure unsigned int iio_device_get_debug_attrs_count(
1638  const struct iio_device *dev);
1639 
1640 
1646 __api __check_ret __pure const char * iio_device_get_debug_attr(
1647  const struct iio_device *dev, unsigned int index);
1648 
1649 
1662 __api __check_ret __pure const char * iio_device_find_debug_attr(
1663  const struct iio_device *dev, const char *name);
1664 
1665 
1688 __api __check_ret ssize_t iio_device_debug_attr_read(const struct iio_device *dev,
1689  const char *attr, char *dst, size_t len);
1690 
1691 
1701 __api __check_ret int iio_device_debug_attr_read_all(struct iio_device *dev,
1702  int (*cb)(struct iio_device *dev, const char *attr,
1703  const char *value, size_t len, void *d),
1704  void *data);
1705 
1706 
1726 __api __check_ret ssize_t iio_device_debug_attr_write(const struct iio_device *dev,
1727  const char *attr, const char *src);
1728 
1729 
1738 __api __check_ret ssize_t iio_device_debug_attr_write_raw(const struct iio_device *dev,
1739  const char *attr, const void *src, size_t len);
1740 
1741 
1751 __api __check_ret int iio_device_debug_attr_write_all(struct iio_device *dev,
1752  ssize_t (*cb)(struct iio_device *dev,
1753  const char *attr, void *buf, size_t len, void *d),
1754  void *data);
1755 
1756 
1764 __api __check_ret int iio_device_debug_attr_read_bool(const struct iio_device *dev,
1765  const char *attr, bool *val);
1766 
1767 
1775 __api __check_ret int iio_device_debug_attr_read_longlong(const struct iio_device *dev,
1776  const char *attr, long long *val);
1777 
1778 
1786 __api __check_ret int iio_device_debug_attr_read_double(const struct iio_device *dev,
1787  const char *attr, double *val);
1788 
1789 
1797 __api __check_ret int iio_device_debug_attr_write_bool(const struct iio_device *dev,
1798  const char *attr, bool val);
1799 
1800 
1808 __api __check_ret int iio_device_debug_attr_write_longlong(const struct iio_device *dev,
1809  const char *attr, long long val);
1810 
1811 
1819 __api __check_ret int iio_device_debug_attr_write_double(const struct iio_device *dev,
1820  const char *attr, double val);
1821 
1822 
1835 __api __check_ret int iio_device_identify_filename(const struct iio_device *dev,
1836  const char *filename, struct iio_channel **chn,
1837  const char **attr);
1838 
1839 
1846 __api __check_ret int iio_device_reg_write(struct iio_device *dev,
1847  uint32_t address, uint32_t value);
1848 
1849 
1856 __api __check_ret int iio_device_reg_read(struct iio_device *dev,
1857  uint32_t address, uint32_t *value);
1858 
1859 
1862 #ifdef __cplusplus
1863 }
1864 #endif
1865 
1866 #undef __api
1867 
1868 #endif /* __IIO_H__ */
__api __check_ret __pure const char * iio_channel_get_name(const struct iio_channel *chn)
Retrieve the channel name (e.g. vccint)
Definition: channel.c:349
__api __check_ret struct iio_context * iio_context_clone(const struct iio_context *ctx)
Duplicate a pre-existing IIO context.
Definition: context.c:372
__api __check_ret ssize_t iio_device_debug_attr_write(const struct iio_device *dev, const char *attr, const char *src)
Set the value of the given debug attribute.
Definition: device.c:790
__api __check_ret int iio_buffer_get_poll_fd(struct iio_buffer *buf)
Get a pollable file descriptor.
Definition: buffer.c:123
__api __check_ret __pure const char * iio_channel_get_id(const struct iio_channel *chn)
Retrieve the channel ID (e.g. voltage0)
Definition: channel.c:344
__api __check_ret int iio_device_attr_write_double(const struct iio_device *dev, const char *attr, double val)
Set the value of the given device-specific attribute.
Definition: device.c:668
__api __check_ret __pure bool iio_channel_is_output(const struct iio_channel *chn)
Return True if the given channel is an output channel.
Definition: channel.c:354
__api __check_ret __pure unsigned int iio_device_get_buffer_attrs_count(const struct iio_device *dev)
Enumerate the buffer-specific attributes of the given device.
Definition: device.c:331
__api __check_ret int iio_channel_attr_write_double(const struct iio_channel *chn, const char *attr, double val)
Set the value of the given channel-specific attribute.
Definition: channel.c:755
__api __check_ret __pure unsigned int iio_context_get_devices_count(const struct iio_context *ctx)
Enumerate the devices found in the given context.
Definition: context.c:280
__api __check_ret __pure bool iio_device_is_trigger(const struct iio_device *dev)
Return True if the given device is a trigger.
Definition: device.c:503
__api __check_ret struct iio_scan_context * iio_create_scan_context(const char *backend, unsigned int flags)
Create a scan context.
Definition: scan.c:139
__api __check_ret int iio_device_attr_read_all(struct iio_device *dev, int(*cb)(struct iio_device *dev, const char *attr, const char *value, size_t len, void *d), void *data)
Read the content of all device-specific attributes.
__api void * iio_buffer_get_data(const struct iio_buffer *buf)
Retrieve a previously associated pointer of an iio_buffer structure.
Definition: buffer.c:313
bool is_be
Contains True if the sample is in big-endian format.
Definition: iio.h:1579
__api void iio_scan_block_destroy(struct iio_scan_block *blk)
Destroy the given scan block.
Definition: scan.c:228
__api void iio_context_destroy(struct iio_context *ctx)
Destroy the given context.
Definition: context.c:253
__api __check_ret __pure const struct iio_device * iio_buffer_get_device(const struct iio_buffer *buf)
Retrieve a pointer to the iio_device structure.
Definition: buffer.c:318
__api void iio_buffer_set_data(struct iio_buffer *buf, void *data)
Associate a pointer to an iio_buffer structure.
Definition: buffer.c:308
__api __check_ret ssize_t iio_buffer_refill(struct iio_buffer *buf)
Fetch more samples from the hardware.
Definition: buffer.c:133
unsigned int bits
Length of valuable data in the sample, in bits.
Definition: iio.h:1567
__api void iio_channel_convert_inverse(const struct iio_channel *chn, void *dst, const void *src)
Convert the sample from host format to hardware format.
Definition: channel.c:610
__api __check_ret __cnst const struct iio_data_format * iio_channel_get_data_format(const struct iio_channel *chn)
Get a pointer to a channel&#39;s data format structure.
Definition: channel.c:441
__api __check_ret __pure unsigned int iio_device_get_debug_attrs_count(const struct iio_device *dev)
Enumerate the debug attributes of the given device.
Definition: device.c:796
__api __check_ret int iio_channel_attr_read_all(struct iio_channel *chn, int(*cb)(struct iio_channel *chn, const char *attr, const char *val, size_t len, void *d), void *data)
Read the content of all channel-specific attributes.
Definition: channel.c:789
__api __check_ret int iio_device_buffer_attr_read_all(struct iio_device *dev, int(*cb)(struct iio_device *dev, const char *attr, const char *value, size_t len, void *d), void *data)
Read the content of all buffer-specific attributes.
__api __check_ret __pure const struct iio_device * iio_channel_get_device(const struct iio_channel *chn)
Retrieve a pointer to the iio_device structure.
Definition: channel.c:891
__api __check_ret int iio_device_set_kernel_buffers_count(const struct iio_device *dev, unsigned int nb_buffers)
Configure the number of kernel buffers for a device.
Definition: device.c:515
__api __check_ret __pure unsigned int iio_device_get_attrs_count(const struct iio_device *dev)
Enumerate the device-specific attributes of the given device.
Definition: device.c:305
__api __check_ret int iio_device_buffer_attr_write_longlong(const struct iio_device *dev, const char *attr, long long val)
Set the value of the given buffer-specific attribute.
Definition: device.c:733
__api __check_ret int iio_device_attr_write_longlong(const struct iio_device *dev, const char *attr, long long val)
Set the value of the given device-specific attribute.
Definition: device.c:656
Represents an input or output channel of a device.
unsigned int length
Total length of the sample, in bits.
Definition: iio.h:1564
__api __check_ret __pure bool iio_channel_is_scan_element(const struct iio_channel *chn)
Return True if the given channel is a scan element.
Definition: channel.c:359
__api __check_ret size_t iio_channel_write_raw(const struct iio_channel *chn, struct iio_buffer *buffer, const void *src, size_t len)
Multiplex the samples of a given channel.
Definition: channel.c:674
__api void * iio_buffer_end(const struct iio_buffer *buf)
Get the address that follows the last sample in a buffer.
Definition: buffer.c:303
__api __check_ret __pure unsigned int iio_channel_get_attrs_count(const struct iio_channel *chn)
Enumerate the channel-specific attributes of the given channel.
Definition: channel.c:374
__api __check_ret ssize_t iio_channel_attr_read(const struct iio_channel *chn, const char *attr, char *dst, size_t len)
Read the content of the given channel-specific attribute.
Definition: channel.c:400
__api __check_ret int iio_device_reg_write(struct iio_device *dev, uint32_t address, uint32_t value)
Set the value of a hardware register.
Definition: device.c:926
__api __check_ret int iio_context_get_attr(const struct iio_context *ctx, unsigned int index, const char **name, const char **value)
Retrieve the name and value of a context-specific attribute.
Definition: context.c:472
__api __check_ret __pure const char * iio_context_info_get_uri(const struct iio_context_info *info)
Get the URI of a discovered context.
Definition: scan.c:41
Represents a device in the IIO context.
__api __check_ret int iio_channel_attr_write_all(struct iio_channel *chn, ssize_t(*cb)(struct iio_channel *chn, const char *attr, void *buf, size_t len, void *d), void *data)
Set the values of all channel-specific attributes.
Definition: channel.c:848
__api __check_ret int iio_channel_attr_read_bool(const struct iio_channel *chn, const char *attr, bool *val)
Read the content of the given channel-specific attribute.
Definition: channel.c:722
__api __check_ret __pure const char * iio_device_get_buffer_attr(const struct iio_device *dev, unsigned int index)
Get the buffer-specific attribute present at the given index.
Definition: device.c:336
__api void iio_scan_context_destroy(struct iio_scan_context *ctx)
Destroy the given scan context.
Definition: scan.c:171
__api __check_ret __pure struct iio_device * iio_context_find_device(const struct iio_context *ctx, const char *name)
Try to find a device structure by its name of ID.
Definition: context.c:294
__api __check_ret __pure struct iio_channel * iio_device_find_channel(const struct iio_device *dev, const char *name, bool output)
Try to find a channel structure by its name of ID.
Definition: device.c:289
__api __check_ret int iio_device_buffer_attr_write_all(struct iio_device *dev, ssize_t(*cb)(struct iio_device *dev, const char *attr, void *buf, size_t len, void *d), void *data)
Set the values of all buffer-specific attributes.
Definition: device.c:1175
__api __check_ret ssize_t iio_device_attr_write_raw(const struct iio_device *dev, const char *attr, const void *src, size_t len)
Set the value of the given device-specific attribute.
Definition: device.c:451
__api __check_ret int iio_device_debug_attr_write_bool(const struct iio_device *dev, const char *attr, bool val)
Set the value of the given debug attribute.
Definition: device.c:874
__api __check_ret struct iio_context * iio_create_context_from_uri(const char *uri)
Create a context from a URI description.
Definition: context.c:382
__api __check_ret int iio_context_get_version(const struct iio_context *ctx, unsigned int *major, unsigned int *minor, char git_tag[8])
Get the version of the backend in use.
Definition: context.c:354
__api __check_ret int iio_device_buffer_attr_read_longlong(const struct iio_device *dev, const char *attr, long long *val)
Read the content of the given buffer-specific attribute.
Definition: device.c:693
__api __check_ret int iio_device_buffer_attr_write_bool(const struct iio_device *dev, const char *attr, bool val)
Set the value of the given buffer-specific attribute.
Definition: device.c:757
__api __check_ret __pure const char * iio_channel_attr_get_filename(const struct iio_channel *chn, const char *attr)
Retrieve the filename of an attribute.
Definition: channel.c:778
iio_modifier
IIO channel modifier.
Definition: iio.h:148
__api __check_ret size_t iio_channel_read_raw(const struct iio_channel *chn, struct iio_buffer *buffer, void *dst, size_t len)
Demultiplex the samples of a given channel.
Definition: channel.c:643
__api __check_ret struct iio_context * iio_create_xml_context(const char *xml_file)
Create a context from a XML file.
Definition: context.c:457
__api __check_ret int iio_device_debug_attr_read_double(const struct iio_device *dev, const char *attr, double *val)
Read the content of the given debug attribute.
Definition: device.c:839
__api __check_ret ssize_t iio_buffer_foreach_sample(struct iio_buffer *buf, ssize_t(*callback)(const struct iio_channel *chn, void *src, size_t bytes, void *d), void *data)
Call the supplied callback for each sample found in a buffer.
__api __check_ret ssize_t iio_scan_context_get_info_list(struct iio_scan_context *ctx, struct iio_context_info ***info)
Enumerate available contexts.
Definition: scan.c:47
__api struct iio_context_info * iio_scan_block_get_info(struct iio_scan_block *blk, unsigned int index)
Get the iio_context_info for a particular context.
Definition: scan.c:198
__api __check_ret ptrdiff_t iio_buffer_step(const struct iio_buffer *buf)
Get the step size between two samples of one channel.
Definition: buffer.c:298
__api void iio_buffer_destroy(struct iio_buffer *buf)
Destroy the given buffer.
Definition: buffer.c:114
__api __check_ret __pure struct iio_channel * iio_device_get_channel(const struct iio_device *dev, unsigned int index)
Get the channel present at the given index.
Definition: device.c:280
__api __check_ret const char * iio_context_get_attr_value(const struct iio_context *ctx, const char *name)
Retrieve the value of a context-specific attribute.
Definition: context.c:485
__api __check_ret ssize_t iio_buffer_push(struct iio_buffer *buf)
Send the samples to the hardware.
Definition: buffer.c:157
__api __check_ret struct iio_context * iio_create_default_context(void)
Create a context from local or remote IIO devices.
Definition: context.c:413
__api __check_ret int iio_device_debug_attr_read_longlong(const struct iio_device *dev, const char *attr, long long *val)
Read the content of the given debug attribute.
Definition: device.c:810
bool is_signed
Contains True if the sample is signed.
Definition: iio.h:1573
__api void * iio_buffer_start(const struct iio_buffer *buf)
Get the start address of the buffer.
Definition: buffer.c:255
unsigned int repeat
Number of times length repeats (added in v0.8)
Definition: iio.h:1588
__api __check_ret struct iio_buffer * iio_device_create_buffer(const struct iio_device *dev, size_t samples_count, bool cyclic)
Create an input or output buffer associated to the given device.
Definition: buffer.c:36
__api ssize_t iio_scan_block_scan(struct iio_scan_block *blk)
Enumerate available contexts via scan block.
Definition: scan.c:190
__api __check_ret __pure enum iio_modifier iio_channel_get_modifier(const struct iio_channel *chn)
Get the modifier type of the given channel.
Definition: channel.c:364
bool with_scale
Contains True if the sample should be scaled when converted.
Definition: iio.h:1582
__api __check_ret int iio_device_debug_attr_write_longlong(const struct iio_device *dev, const char *attr, long long val)
Set the value of the given debug attribute.
Definition: device.c:850
__api __check_ret int iio_device_buffer_attr_read_bool(const struct iio_device *dev, const char *attr, bool *val)
Read the content of the given buffer-specific attribute.
Definition: device.c:710
__api __check_ret __pure const char * iio_context_get_name(const struct iio_context *ctx)
Get the name of the given context.
Definition: context.c:240
__api void * iio_device_get_data(const struct iio_device *dev)
Retrieve a previously associated pointer of an iio_device structure.
Definition: device.c:498
__api __check_ret __pure const char * iio_device_find_buffer_attr(const struct iio_device *dev, const char *name)
Try to find a buffer-specific attribute by its name.
Definition: device.c:345
double scale
Contains the scale to apply if with_scale is set.
Definition: iio.h:1585
__api __check_ret __pure const char * iio_device_get_attr(const struct iio_device *dev, unsigned int index)
Get the device-specific attribute present at the given index.
Definition: device.c:310
__api __check_ret int iio_channel_attr_read_double(const struct iio_channel *chn, const char *attr, double *val)
Read the content of the given channel-specific attribute.
Definition: channel.c:734
__api __check_ret ssize_t iio_device_debug_attr_write_raw(const struct iio_device *dev, const char *attr, const void *src, size_t len)
Set the value of the given debug attribute.
Definition: device.c:780
__api __check_ret ssize_t iio_device_get_sample_size(const struct iio_device *dev)
Get the current sample size.
Definition: device.c:611
__api __check_ret int iio_device_attr_read_longlong(const struct iio_device *dev, const char *attr, long long *val)
Read the content of the given device-specific attribute.
Definition: device.c:616
__api __check_ret size_t iio_channel_write(const struct iio_channel *chn, struct iio_buffer *buffer, const void *src, size_t len)
Convert and multiplex the samples of a given channel.
Definition: channel.c:689
__api __check_ret int iio_device_debug_attr_read_all(struct iio_device *dev, int(*cb)(struct iio_device *dev, const char *attr, const char *value, size_t len, void *d), void *data)
Read the content of all debug attributes.
__api __check_ret __pure const char * iio_device_get_id(const struct iio_device *dev)
Retrieve the device ID (e.g. iio:device0)
Definition: device.c:265
__api __check_ret int iio_device_attr_read_double(const struct iio_device *dev, const char *attr, double *val)
Read the content of the given device-specific attribute.
Definition: device.c:645
__api struct iio_scan_block * iio_create_scan_block(const char *backend, unsigned int flags)
Create a scan block.
Definition: scan.c:208
__api __check_ret __pure const struct iio_context * iio_device_get_context(const struct iio_device *dev)
Retrieve a pointer to the iio_context structure.
Definition: device.c:1191
__api __check_ret int iio_device_identify_filename(const struct iio_device *dev, const char *filename, struct iio_channel **chn, const char **attr)
Identify the channel or debug attribute corresponding to a filename.
Definition: device.c:887
iio_chan_type
IIO channel type.
Definition: iio.h:102
__api __check_ret ssize_t iio_device_debug_attr_read(const struct iio_device *dev, const char *attr, char *dst, size_t len)
Read the content of the given debug attribute.
Definition: device.c:770
__api void * iio_buffer_first(const struct iio_buffer *buf, const struct iio_channel *chn)
Find the first sample of a channel in a buffer.
Definition: buffer.c:260
__api __check_ret __pure const char * iio_device_find_debug_attr(const struct iio_device *dev, const char *name)
Try to find a debug attribute by its name.
Definition: device.c:357
__api void iio_buffer_cancel(struct iio_buffer *buf)
Cancel all buffer operations.
Definition: buffer.c:323
__api __check_ret __pure long iio_channel_get_index(const struct iio_channel *chn)
Get the index of the given channel.
Definition: channel.c:436
__api __check_ret int iio_device_attr_write_all(struct iio_device *dev, ssize_t(*cb)(struct iio_device *dev, const char *attr, void *buf, size_t len, void *d), void *data)
Set the values of all device-specific attributes.
Definition: device.c:1183
__api __check_ret ssize_t iio_device_buffer_attr_write_raw(const struct iio_device *dev, const char *attr, const void *src, size_t len)
Set the value of the given buffer-specific attribute.
Definition: device.c:477
__api void iio_channel_convert(const struct iio_channel *chn, void *dst, const void *src)
Convert the sample from hardware format to host format.
Definition: channel.c:574
__api __check_ret ssize_t iio_channel_attr_write_raw(const struct iio_channel *chn, const char *attr, const void *src, size_t len)
Set the value of the given channel-specific attribute.
Definition: channel.c:410
__api __check_ret int iio_device_attr_read_bool(const struct iio_device *dev, const char *attr, bool *val)
Read the content of the given device-specific attribute.
Definition: device.c:633
__api void * iio_channel_get_data(const struct iio_channel *chn)
Retrieve a previously associated pointer of an iio_channel structure.
Definition: channel.c:431
__api __check_ret ssize_t iio_device_attr_write(const struct iio_device *dev, const char *attr, const char *src)
Set the value of the given device-specific attribute.
Definition: device.c:461
__api __check_ret bool iio_channel_is_enabled(const struct iio_channel *chn)
Returns True if the channel is enabled.
Definition: channel.c:447
__api void iio_channel_set_data(struct iio_channel *chn, void *data)
Associate a pointer to an iio_channel structure.
Definition: channel.c:426
bool is_fully_defined
Contains True if the sample is fully defined, sign extended, etc.
Definition: iio.h:1576
__api void iio_device_set_data(struct iio_device *dev, void *data)
Associate a pointer to an iio_device structure.
Definition: device.c:493
__api __check_ret __pure unsigned int iio_context_get_attrs_count(const struct iio_context *ctx)
Get the number of context-specific attributes.
Definition: context.c:467
__api __check_ret int iio_device_buffer_attr_write_double(const struct iio_device *dev, const char *attr, double val)
Set the value of the given buffer-specific attribute.
Definition: device.c:745
An input or output buffer, used to read or write samples.
__api __check_ret struct iio_context * iio_create_local_context(void)
Create a context from local IIO devices (Linux only)
Definition: context.c:427
__api void iio_strerror(int err, char *dst, size_t len)
Get a string description of an error code.
Definition: utilities.c:207
__api __check_ret ssize_t iio_buffer_push_partial(struct iio_buffer *buf, size_t samples_count)
Send a given number of samples to the hardware.
Definition: buffer.c:193
unsigned int shift
Right-shift to apply when converting sample.
Definition: iio.h:1570
__api __check_ret size_t iio_channel_read(const struct iio_channel *chn, struct iio_buffer *buffer, void *dst, size_t len)
Demultiplex and convert the samples of a given channel.
Definition: channel.c:658
__api __check_ret ssize_t iio_device_buffer_attr_write(const struct iio_device *dev, const char *attr, const char *src)
Set the value of the given buffer-specific attribute.
Definition: device.c:487
__api __check_ret int iio_channel_attr_write_longlong(const struct iio_channel *chn, const char *attr, long long val)
Set the value of the given channel-specific attribute.
Definition: channel.c:745
__api __check_ret __pure const char * iio_device_get_name(const struct iio_device *dev)
Retrieve the device name (e.g. xadc)
Definition: device.c:270
__api __check_ret int iio_device_attr_write_bool(const struct iio_device *dev, const char *attr, bool val)
Set the value of the given device-specific attribute.
Definition: device.c:680
__api __check_ret __pure const char * iio_context_get_xml(const struct iio_context *ctx)
Obtain a XML representation of the given context.
Definition: context.c:235
The information related to a discovered context.
__api void iio_context_info_list_free(struct iio_context_info **info)
Free a context info list.
Definition: scan.c:90
__api __check_ret ssize_t iio_channel_attr_write(const struct iio_channel *chn, const char *attr, const char *src)
Set the value of the given channel-specific attribute.
Definition: channel.c:420
__api __check_ret ssize_t iio_device_buffer_attr_read(const struct iio_device *dev, const char *attr, char *dst, size_t len)
Read the content of the given buffer-specific attribute.
Definition: device.c:467
__api __check_ret int iio_channel_attr_read_longlong(const struct iio_channel *chn, const char *attr, long long *val)
Read the content of the given channel-specific attribute.
Definition: channel.c:705
__api __check_ret __pure const char * iio_device_find_attr(const struct iio_device *dev, const char *name)
Try to find a device-specific attribute by its name.
Definition: device.c:319
__api __check_ret int iio_buffer_set_blocking_mode(struct iio_buffer *buf, bool blocking)
Make iio_buffer_refill() and iio_buffer_push() blocking or not.
Definition: buffer.c:128
__api __check_ret int iio_device_buffer_attr_read_double(const struct iio_device *dev, const char *attr, double *val)
Read the content of the given buffer-specific attribute.
Definition: device.c:722
__api __check_ret __cnst bool iio_has_backend(const char *backend)
Check if the specified backend is available.
Definition: backend.c:75
__api void iio_channel_enable(struct iio_channel *chn)
Enable the given channel.
Definition: channel.c:453
__api __check_ret ssize_t iio_device_attr_read(const struct iio_device *dev, const char *attr, char *dst, size_t len)
Read the content of the given device-specific attribute.
Definition: device.c:441
__api __check_ret __pure struct iio_device * iio_context_get_device(const struct iio_context *ctx, unsigned int index)
Get the device present at the given index.
Definition: context.c:285
__api __check_ret int iio_context_set_timeout(struct iio_context *ctx, unsigned int timeout_ms)
Set a timeout for I/O operations.
Definition: context.c:364
__api void iio_channel_disable(struct iio_channel *chn)
Disable the given channel.
Definition: channel.c:459
__api __check_ret __pure const char * iio_channel_get_attr(const struct iio_channel *chn, unsigned int index)
Get the channel-specific attribute present at the given index.
Definition: channel.c:379
__api __check_ret __cnst unsigned int iio_get_backends_count(void)
Get the number of available backends.
Definition: backend.c:23
__api __check_ret __pure const char * iio_channel_find_attr(const struct iio_channel *chn, const char *name)
Try to find a channel-specific attribute by its name.
Definition: channel.c:388
__api __check_ret int iio_device_set_trigger(const struct iio_device *dev, const struct iio_device *trigger)
Associate a trigger to a given device.
Definition: device.c:537
__api __check_ret __pure unsigned int iio_device_get_channels_count(const struct iio_device *dev)
Enumerate the channels of the given device.
Definition: device.c:275
__api __check_ret int iio_device_debug_attr_write_double(const struct iio_device *dev, const char *attr, double val)
Set the value of the given debug attribute.
Definition: device.c:862
__api __check_ret int iio_device_get_trigger(const struct iio_device *dev, const struct iio_device **trigger)
Retrieve the trigger of a given device.
Definition: device.c:526
__api __check_ret __pure const char * iio_context_get_description(const struct iio_context *ctx)
Get a description of the given context.
Definition: context.c:245
__api void iio_library_get_version(unsigned int *major, unsigned int *minor, char git_tag[8])
Get the version of the libiio library.
Definition: utilities.c:195
__api __check_ret __pure const char * iio_device_get_debug_attr(const struct iio_device *dev, unsigned int index)
Get the debug attribute present at the given index.
Definition: device.c:801
__api __check_ret int iio_device_debug_attr_write_all(struct iio_device *dev, ssize_t(*cb)(struct iio_device *dev, const char *attr, void *buf, size_t len, void *d), void *data)
Set the values of all debug attributes.
Definition: device.c:1167
__api __check_ret struct iio_context * iio_create_network_context(const char *host)
Create a context from the network.
Definition: context.c:437
Contains the format of a data sample.
Definition: iio.h:1562
__api __check_ret int iio_device_reg_read(struct iio_device *dev, uint32_t address, uint32_t *value)
Get the value of a hardware register.
Definition: device.c:939
__api __check_ret __pure enum iio_chan_type iio_channel_get_type(const struct iio_channel *chn)
Get the type of the given channel.
Definition: channel.c:369
__api __check_ret int iio_channel_attr_write_bool(const struct iio_channel *chn, const char *attr, bool val)
Set the value of the given channel-specific attribute.
Definition: channel.c:767
__api __check_ret __cnst const char * iio_get_backend(unsigned int index)
Retrieve the name of a given backend.
Definition: backend.c:46
Contains the representation of an IIO context.
__api __check_ret struct iio_context * iio_create_xml_context_mem(const char *xml, size_t len)
Create a context from XML data in memory.
Definition: context.c:447
__api __check_ret int iio_device_debug_attr_read_bool(const struct iio_device *dev, const char *attr, bool *val)
Read the content of the given debug attribute.
Definition: device.c:827
__api __check_ret __pure const char * iio_context_info_get_description(const struct iio_context_info *info)
Get a description of a discovered context.
Definition: scan.c:35