libiio  0.24
Library for interfacing with IIO devices
/builddir/build/BUILD/libiio-0.24/iio.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
2 /*
3  * libiio - Library for interfacing industrial I/O (IIO) devices
4  *
5  * Copyright (C) 2014 Analog Devices, Inc.
6  * Author: Paul Cercueil <paul.cercueil@analog.com>
7  */
8 
12 #ifndef __IIO_H__
13 #define __IIO_H__
14 
15 #ifdef __cplusplus
16 extern "C" {
17 #endif
18 
19 #include <limits.h>
20 #include <stdint.h>
21 #include <stdlib.h>
22 #include <stddef.h>
23 
24 #if (defined(_WIN32) || defined(__MBED__))
25 #ifndef _SSIZE_T_DEFINED
26 typedef ptrdiff_t ssize_t;
27 #define _SSIZE_T_DEFINED
28 #endif
29 #else
30 #include <sys/types.h>
31 #endif
32 
33 #if defined(_MSC_VER) && (_MSC_VER < 1800) && !defined(__BOOL_DEFINED)
34 #undef bool
35 #undef false
36 #undef true
37 #define bool char
38 #define false 0
39 #define true 1
40 #else
41 #include <stdbool.h>
42 #endif
43 
44 #if defined(__GNUC__) && !defined(MATLAB_MEX_FILE) && !defined(MATLAB_LOADLIBRARY)
45 #ifndef __cnst
46 #define __cnst __attribute__((const))
47 #endif
48 #ifndef __pure
49 #define __pure __attribute__((pure))
50 #endif
51 #define __notused __attribute__((unused))
52 #ifdef IIO_CHECK_RET
53 #define __check_ret __attribute__((warn_unused_result))
54 #else
55 #define __check_ret
56 #endif
57 #else
58 #define __cnst
59 #define __pure
60 #define __notused
61 #define __check_ret
62 #endif
63 
64 #ifdef _WIN32
65 # ifdef LIBIIO_STATIC
66 # define __api
67 # elif defined(LIBIIO_EXPORTS)
68 # define __api __declspec(dllexport)
69 # else
70 # define __api __declspec(dllimport)
71 # endif
72 #elif __GNUC__ >= 4 && !defined(MATLAB_MEX_FILE) && !defined(MATLAB_LOADLIBRARY)
73 # define __api __attribute__((visibility ("default")))
74 #else
75 # define __api
76 #endif
77 
78 struct iio_context;
79 struct iio_device;
80 struct iio_channel;
81 struct iio_buffer;
82 
83 struct iio_context_info;
84 struct iio_scan_context;
85 struct iio_scan_block;
86 
87 /*
88  * <linux/iio/types.h> header guard to protect these enums from being defined
89  * twice
90  */
91 #ifndef _IIO_TYPES_H_
92 #define _IIO_TYPES_H_
93 
102  IIO_VOLTAGE,
103  IIO_CURRENT,
104  IIO_POWER,
105  IIO_ACCEL,
106  IIO_ANGL_VEL,
107  IIO_MAGN,
108  IIO_LIGHT,
109  IIO_INTENSITY,
110  IIO_PROXIMITY,
111  IIO_TEMP,
112  IIO_INCLI,
113  IIO_ROT,
114  IIO_ANGL,
115  IIO_TIMESTAMP,
116  IIO_CAPACITANCE,
117  IIO_ALTVOLTAGE,
118  IIO_CCT,
119  IIO_PRESSURE,
120  IIO_HUMIDITYRELATIVE,
121  IIO_ACTIVITY,
122  IIO_STEPS,
123  IIO_ENERGY,
124  IIO_DISTANCE,
125  IIO_VELOCITY,
126  IIO_CONCENTRATION,
127  IIO_RESISTANCE,
128  IIO_PH,
129  IIO_UVINDEX,
130  IIO_ELECTRICALCONDUCTIVITY,
131  IIO_COUNT,
132  IIO_INDEX,
133  IIO_GRAVITY,
134  IIO_POSITIONRELATIVE,
135  IIO_PHASE,
136  IIO_MASSCONCENTRATION,
137  IIO_CHAN_TYPE_UNKNOWN = INT_MAX
138 };
139 
148  IIO_NO_MOD,
149  IIO_MOD_X,
150  IIO_MOD_Y,
151  IIO_MOD_Z,
152  IIO_MOD_X_AND_Y,
153  IIO_MOD_X_AND_Z,
154  IIO_MOD_Y_AND_Z,
155  IIO_MOD_X_AND_Y_AND_Z,
156  IIO_MOD_X_OR_Y,
157  IIO_MOD_X_OR_Z,
158  IIO_MOD_Y_OR_Z,
159  IIO_MOD_X_OR_Y_OR_Z,
160  IIO_MOD_LIGHT_BOTH,
161  IIO_MOD_LIGHT_IR,
162  IIO_MOD_ROOT_SUM_SQUARED_X_Y,
163  IIO_MOD_SUM_SQUARED_X_Y_Z,
164  IIO_MOD_LIGHT_CLEAR,
165  IIO_MOD_LIGHT_RED,
166  IIO_MOD_LIGHT_GREEN,
167  IIO_MOD_LIGHT_BLUE,
168  IIO_MOD_QUATERNION,
169  IIO_MOD_TEMP_AMBIENT,
170  IIO_MOD_TEMP_OBJECT,
171  IIO_MOD_NORTH_MAGN,
172  IIO_MOD_NORTH_TRUE,
173  IIO_MOD_NORTH_MAGN_TILT_COMP,
174  IIO_MOD_NORTH_TRUE_TILT_COMP,
175  IIO_MOD_RUNNING,
176  IIO_MOD_JOGGING,
177  IIO_MOD_WALKING,
178  IIO_MOD_STILL,
179  IIO_MOD_ROOT_SUM_SQUARED_X_Y_Z,
180  IIO_MOD_I,
181  IIO_MOD_Q,
182  IIO_MOD_CO2,
183  IIO_MOD_VOC,
184  IIO_MOD_LIGHT_UV,
185  IIO_MOD_LIGHT_DUV,
186  IIO_MOD_PM1,
187  IIO_MOD_PM2P5,
188  IIO_MOD_PM4,
189  IIO_MOD_PM10,
190  IIO_MOD_ETHANOL,
191  IIO_MOD_H2,
192  IIO_MOD_O2,
193 };
194 
203  IIO_EV_TYPE_THRESH,
204  IIO_EV_TYPE_MAG,
205  IIO_EV_TYPE_ROC,
206  IIO_EV_TYPE_THRESH_ADAPTIVE,
207  IIO_EV_TYPE_MAG_ADAPTIVE,
208  IIO_EV_TYPE_CHANGE,
209 };
210 
218  IIO_EV_DIR_EITHER,
219  IIO_EV_DIR_RISING,
220  IIO_EV_DIR_FALLING,
221  IIO_EV_DIR_NONE,
222 };
223 
224 #endif /* _IIO_TYPES_H_ */
225 
226 /* ---------------------------------------------------------------------------*/
227 /* ------------------------- Scan functions ----------------------------------*/
255 __api __check_ret struct iio_scan_context * iio_create_scan_context(
256  const char *backend, unsigned int flags);
257 
258 
263 __api void iio_scan_context_destroy(struct iio_scan_context *ctx);
264 
265 
273 __api __check_ret ssize_t iio_scan_context_get_info_list(struct iio_scan_context *ctx,
274  struct iio_context_info ***info);
275 
276 
280 __api void iio_context_info_list_free(struct iio_context_info **info);
281 
282 
287 __api __check_ret __pure const char * iio_context_info_get_description(
288  const struct iio_context_info *info);
289 
290 
295 __api __check_ret __pure const char * iio_context_info_get_uri(
296  const struct iio_context_info *info);
297 
298 
307 __api struct iio_scan_block * iio_create_scan_block(
308  const char *backend, unsigned int flags);
309 
310 
317 __api void iio_scan_block_destroy(struct iio_scan_block *blk);
318 
319 
326 __api ssize_t iio_scan_block_scan(struct iio_scan_block *blk);
327 
328 
338  struct iio_scan_block *blk, unsigned int index);
339 
340 /* ------------------------------------------------------------------*/
342 /* ------------------------- Top-level functions -----------------------------*/
351 __api void iio_library_get_version(unsigned int *major,
352  unsigned int *minor, char git_tag[8]);
353 
354 
360 __api void iio_strerror(int err, char *dst, size_t len);
361 
362 
368 __api __check_ret __cnst bool iio_has_backend(const char *backend);
369 
370 
375 __api __check_ret __cnst unsigned int iio_get_backends_count(void);
376 
377 
384 __api __check_ret __cnst const char * iio_get_backend(unsigned int index);
385 
386 /* ------------------------------------------------------------------*/
388 /* ------------------------- Context functions -------------------------------*/
402 __api __check_ret struct iio_context * iio_create_default_context(void);
403 
404 
408 __api __check_ret struct iio_context * iio_create_local_context(void);
409 
410 
418 __api __check_ret struct iio_context * iio_create_xml_context(const char *xml_file);
419 
420 
429 __api __check_ret struct iio_context * iio_create_xml_context_mem(
430  const char *xml, size_t len);
431 
432 
437 __api __check_ret struct iio_context * iio_create_network_context(const char *host);
438 
439 
482 __api __check_ret struct iio_context * iio_create_context_from_uri(const char *uri);
483 
484 
493 __api __check_ret struct iio_context * iio_context_clone(const struct iio_context *ctx);
494 
495 
500 __api void iio_context_destroy(struct iio_context *ctx);
501 
502 
510 __api __check_ret int iio_context_get_version(const struct iio_context *ctx,
511  unsigned int *major, unsigned int *minor, char git_tag[8]);
512 
513 
517 __api __check_ret __pure const char * iio_context_get_xml(const struct iio_context *ctx);
518 
519 
527 __api __check_ret __pure const char * iio_context_get_name(const struct iio_context *ctx);
528 
529 
536 __api __check_ret __pure const char * iio_context_get_description(
537  const struct iio_context *ctx);
538 
539 
545 __api __check_ret __pure unsigned int iio_context_get_attrs_count(
546  const struct iio_context *ctx);
547 
548 
558 __api __check_ret int iio_context_get_attr(
559  const struct iio_context *ctx, unsigned int index,
560  const char **name, const char **value);
561 
562 
571 __api __check_ret const char * iio_context_get_attr_value(
572  const struct iio_context *ctx, const char *name);
573 
574 
578 __api __check_ret __pure unsigned int iio_context_get_devices_count(
579  const struct iio_context *ctx);
580 
581 
587 __api __check_ret __pure struct iio_device * iio_context_get_device(
588  const struct iio_context *ctx, unsigned int index);
589 
590 
598 __api __check_ret __pure struct iio_device * iio_context_find_device(
599  const struct iio_context *ctx, const char *name);
600 
601 
609 __api __check_ret int iio_context_set_timeout(
610  struct iio_context *ctx, unsigned int timeout_ms);
611 
612 /* ------------------------------------------------------------------*/
614 /* ------------------------- Device functions --------------------------------*/
624 __api __check_ret __pure const struct iio_context * iio_device_get_context(
625  const struct iio_device *dev);
626 
627 
631 __api __check_ret __pure const char * iio_device_get_id(const struct iio_device *dev);
632 
633 
639 __api __check_ret __pure const char * iio_device_get_name(const struct iio_device *dev);
640 
641 
647 __api __check_ret __pure const char * iio_device_get_label(const struct iio_device *dev);
648 
649 
653 __api __check_ret __pure unsigned int iio_device_get_channels_count(
654  const struct iio_device *dev);
655 
656 
660 __api __check_ret __pure unsigned int iio_device_get_attrs_count(
661  const struct iio_device *dev);
662 
666 __api __check_ret __pure unsigned int iio_device_get_buffer_attrs_count(
667  const struct iio_device *dev);
668 
674 __api __check_ret __pure struct iio_channel * iio_device_get_channel(
675  const struct iio_device *dev, unsigned int index);
676 
677 
683 __api __check_ret __pure const char * iio_device_get_attr(
684  const struct iio_device *dev, unsigned int index);
685 
691 __api __check_ret __pure const char * iio_device_get_buffer_attr(
692  const struct iio_device *dev, unsigned int index);
693 
702 __api __check_ret __pure struct iio_channel * iio_device_find_channel(
703  const struct iio_device *dev, const char *name, bool output);
704 
705 
717 __api __check_ret __pure const char * iio_device_find_attr(
718  const struct iio_device *dev, const char *name);
719 
731 __api __check_ret __pure const char * iio_device_find_buffer_attr(
732  const struct iio_device *dev, const char *name);
733 
755 __api __check_ret ssize_t iio_device_attr_read(const struct iio_device *dev,
756  const char *attr, char *dst, size_t len);
757 
758 
769 __api __check_ret int iio_device_attr_read_all(struct iio_device *dev,
770  int (*cb)(struct iio_device *dev, const char *attr,
771  const char *value, size_t len, void *d),
772  void *data);
773 
774 
782 __api __check_ret int iio_device_attr_read_bool(const struct iio_device *dev,
783  const char *attr, bool *val);
784 
785 
793 __api __check_ret int iio_device_attr_read_longlong(const struct iio_device *dev,
794  const char *attr, long long *val);
795 
796 
804 __api __check_ret int iio_device_attr_read_double(const struct iio_device *dev,
805  const char *attr, double *val);
806 
807 
826 __api __check_ret ssize_t iio_device_attr_write(const struct iio_device *dev,
827  const char *attr, const char *src);
828 
829 
838 __api __check_ret ssize_t iio_device_attr_write_raw(const struct iio_device *dev,
839  const char *attr, const void *src, size_t len);
840 
841 
852 __api __check_ret int iio_device_attr_write_all(struct iio_device *dev,
853  ssize_t (*cb)(struct iio_device *dev,
854  const char *attr, void *buf, size_t len, void *d),
855  void *data);
856 
857 
865 __api __check_ret int iio_device_attr_write_bool(const struct iio_device *dev,
866  const char *attr, bool val);
867 
868 
876 __api __check_ret int iio_device_attr_write_longlong(const struct iio_device *dev,
877  const char *attr, long long val);
878 
879 
887 __api __check_ret int iio_device_attr_write_double(const struct iio_device *dev,
888  const char *attr, double val);
889 
912 __api __check_ret ssize_t iio_device_buffer_attr_read(const struct iio_device *dev,
913  const char *attr, char *dst, size_t len);
914 
925 __api __check_ret int iio_device_buffer_attr_read_all(struct iio_device *dev,
926  int (*cb)(struct iio_device *dev, const char *attr,
927  const char *value, size_t len, void *d),
928  void *data);
929 
930 
938 __api __check_ret int iio_device_buffer_attr_read_bool(const struct iio_device *dev,
939  const char *attr, bool *val);
940 
941 
949 __api __check_ret int iio_device_buffer_attr_read_longlong(const struct iio_device *dev,
950  const char *attr, long long *val);
951 
952 
960 __api __check_ret int iio_device_buffer_attr_read_double(const struct iio_device *dev,
961  const char *attr, double *val);
962 
963 
983 __api __check_ret ssize_t iio_device_buffer_attr_write(const struct iio_device *dev,
984  const char *attr, const char *src);
985 
986 
995 __api __check_ret ssize_t iio_device_buffer_attr_write_raw(const struct iio_device *dev,
996  const char *attr, const void *src, size_t len);
997 
998 
1009 __api __check_ret int iio_device_buffer_attr_write_all(struct iio_device *dev,
1010  ssize_t (*cb)(struct iio_device *dev,
1011  const char *attr, void *buf, size_t len, void *d),
1012  void *data);
1013 
1014 
1022 __api __check_ret int iio_device_buffer_attr_write_bool(const struct iio_device *dev,
1023  const char *attr, bool val);
1024 
1025 
1033 __api __check_ret int iio_device_buffer_attr_write_longlong(const struct iio_device *dev,
1034  const char *attr, long long val);
1035 
1036 
1044 __api __check_ret int iio_device_buffer_attr_write_double(const struct iio_device *dev,
1045  const char *attr, double val);
1046 
1047 
1051 __api void iio_device_set_data(struct iio_device *dev, void *data);
1052 
1053 
1057 __api void * iio_device_get_data(const struct iio_device *dev);
1058 
1059 
1067 __api __check_ret int iio_device_get_trigger(const struct iio_device *dev,
1068  const struct iio_device **trigger);
1069 
1070 
1077 __api __check_ret int iio_device_set_trigger(const struct iio_device *dev,
1078  const struct iio_device *trigger);
1079 
1080 
1084 __api __check_ret __pure bool iio_device_is_trigger(const struct iio_device *dev);
1085 
1093 __api __check_ret int iio_device_set_kernel_buffers_count(const struct iio_device *dev,
1094  unsigned int nb_buffers);
1095 /* ------------------------------------------------------------------*/
1097 /* ------------------------- Channel functions -------------------------------*/
1107 __api __check_ret __pure const struct iio_device * iio_channel_get_device(
1108  const struct iio_channel *chn);
1109 
1110 
1114 __api __check_ret __pure const char * iio_channel_get_id(const struct iio_channel *chn);
1115 
1116 
1122 __api __check_ret __pure const char * iio_channel_get_name(const struct iio_channel *chn);
1123 
1124 
1128 __api __check_ret __pure bool iio_channel_is_output(const struct iio_channel *chn);
1129 
1130 
1138 __api __check_ret __pure bool iio_channel_is_scan_element(const struct iio_channel *chn);
1139 
1140 
1144 __api __check_ret __pure unsigned int iio_channel_get_attrs_count(
1145  const struct iio_channel *chn);
1146 
1147 
1153 __api __check_ret __pure const char * iio_channel_get_attr(
1154  const struct iio_channel *chn, unsigned int index);
1155 
1156 
1168 __api __check_ret __pure const char * iio_channel_find_attr(
1169  const struct iio_channel *chn, const char *name);
1170 
1171 
1178 __api __check_ret __pure const char * iio_channel_attr_get_filename(
1179  const struct iio_channel *chn, const char *attr);
1180 
1181 
1203 __api __check_ret ssize_t iio_channel_attr_read(const struct iio_channel *chn,
1204  const char *attr, char *dst, size_t len);
1205 
1206 
1217 __api __check_ret int iio_channel_attr_read_all(struct iio_channel *chn,
1218  int (*cb)(struct iio_channel *chn,
1219  const char *attr, const char *val, size_t len, void *d),
1220  void *data);
1221 
1222 
1230 __api __check_ret int iio_channel_attr_read_bool(const struct iio_channel *chn,
1231  const char *attr, bool *val);
1232 
1233 
1241 __api __check_ret int iio_channel_attr_read_longlong(const struct iio_channel *chn,
1242  const char *attr, long long *val);
1243 
1244 
1252 __api __check_ret int iio_channel_attr_read_double(const struct iio_channel *chn,
1253  const char *attr, double *val);
1254 
1255 
1274 __api __check_ret ssize_t iio_channel_attr_write(const struct iio_channel *chn,
1275  const char *attr, const char *src);
1276 
1277 
1286 __api __check_ret ssize_t iio_channel_attr_write_raw(const struct iio_channel *chn,
1287  const char *attr, const void *src, size_t len);
1288 
1289 
1300 __api __check_ret int iio_channel_attr_write_all(struct iio_channel *chn,
1301  ssize_t (*cb)(struct iio_channel *chn,
1302  const char *attr, void *buf, size_t len, void *d),
1303  void *data);
1304 
1305 
1313 __api __check_ret int iio_channel_attr_write_bool(const struct iio_channel *chn,
1314  const char *attr, bool val);
1315 
1316 
1324 __api __check_ret int iio_channel_attr_write_longlong(const struct iio_channel *chn,
1325  const char *attr, long long val);
1326 
1327 
1335 __api __check_ret int iio_channel_attr_write_double(const struct iio_channel *chn,
1336  const char *attr, double val);
1337 
1338 
1345 __api void iio_channel_enable(struct iio_channel *chn);
1346 
1347 
1350 __api void iio_channel_disable(struct iio_channel *chn);
1351 
1352 
1356 __api __check_ret bool iio_channel_is_enabled(const struct iio_channel *chn);
1357 
1358 
1366 __api __check_ret size_t iio_channel_read_raw(const struct iio_channel *chn,
1367  struct iio_buffer *buffer, void *dst, size_t len);
1368 
1369 
1377 __api __check_ret size_t iio_channel_read(const struct iio_channel *chn,
1378  struct iio_buffer *buffer, void *dst, size_t len);
1379 
1380 
1388 __api __check_ret size_t iio_channel_write_raw(const struct iio_channel *chn,
1389  struct iio_buffer *buffer, const void *src, size_t len);
1390 
1391 
1399 __api __check_ret size_t iio_channel_write(const struct iio_channel *chn,
1400  struct iio_buffer *buffer, const void *src, size_t len);
1401 
1402 
1406 __api void iio_channel_set_data(struct iio_channel *chn, void *data);
1407 
1408 
1412 __api void * iio_channel_get_data(const struct iio_channel *chn);
1413 
1414 
1418 __api __check_ret __pure enum iio_chan_type iio_channel_get_type(
1419  const struct iio_channel *chn);
1420 
1421 
1425 __api __check_ret __pure enum iio_modifier iio_channel_get_modifier(
1426  const struct iio_channel *chn);
1427 
1428 /* ------------------------------------------------------------------*/
1430 /* ------------------------- Buffer functions --------------------------------*/
1440 __api __check_ret __pure const struct iio_device * iio_buffer_get_device(
1441  const struct iio_buffer *buf);
1442 
1443 
1453 __api __check_ret struct iio_buffer * iio_device_create_buffer(const struct iio_device *dev,
1454  size_t samples_count, bool cyclic);
1455 
1456 
1461 __api void iio_buffer_destroy(struct iio_buffer *buf);
1462 
1471 __api __check_ret int iio_buffer_get_poll_fd(struct iio_buffer *buf);
1472 
1484 __api __check_ret int iio_buffer_set_blocking_mode(struct iio_buffer *buf, bool blocking);
1485 
1486 
1493 __api __check_ret ssize_t iio_buffer_refill(struct iio_buffer *buf);
1494 
1495 
1502 __api __check_ret ssize_t iio_buffer_push(struct iio_buffer *buf);
1503 
1504 
1512 __api __check_ret ssize_t iio_buffer_push_partial(struct iio_buffer *buf,
1513  size_t samples_count);
1514 
1538 __api void iio_buffer_cancel(struct iio_buffer *buf);
1539 
1540 
1544 __api void * iio_buffer_start(const struct iio_buffer *buf);
1545 
1546 
1562 __api void * iio_buffer_first(const struct iio_buffer *buf,
1563  const struct iio_channel *chn);
1564 
1565 
1570 __api __check_ret ptrdiff_t iio_buffer_step(const struct iio_buffer *buf);
1571 
1572 
1577 __api void * iio_buffer_end(const struct iio_buffer *buf);
1578 
1579 
1591 __api __check_ret ssize_t iio_buffer_foreach_sample(struct iio_buffer *buf,
1592  ssize_t (*callback)(const struct iio_channel *chn,
1593  void *src, size_t bytes, void *d), void *data);
1594 
1595 
1599 __api void iio_buffer_set_data(struct iio_buffer *buf, void *data);
1600 
1601 
1605 __api void * iio_buffer_get_data(const struct iio_buffer *buf);
1606 /* ------------------------------------------------------------------*/
1608 /* ---------------------------- HWMON support --------------------------------*/
1622  HWMON_VOLTAGE,
1623  HWMON_FAN,
1624  HWMON_PWM,
1625  HWMON_TEMP,
1626  HWMON_CURRENT,
1627  HWMON_POWER,
1628  HWMON_ENERGY,
1629  HWMON_HUMIDITY,
1630  HWMON_INTRUSION,
1631  HWMON_CHAN_TYPE_UNKNOWN = IIO_CHAN_TYPE_UNKNOWN,
1632 };
1633 
1638 static inline enum hwmon_chan_type
1639 hwmon_channel_get_type(const struct iio_channel *chn)
1640 {
1641  return (enum hwmon_chan_type) iio_channel_get_type(chn);
1642 }
1643 
1649 static inline bool iio_device_is_hwmon(const struct iio_device *dev)
1650 {
1651  const char *id = iio_device_get_id(dev);
1652 
1653  return id[0] == 'h';
1654 }
1655 
1656 /* ------------------------------------------------------------------*/
1658 /* ------------------------- Low-level functions -----------------------------*/
1670  unsigned int length;
1671 
1673  unsigned int bits;
1674 
1676  unsigned int shift;
1677 
1680 
1683 
1685  bool is_be;
1686 
1689 
1691  double scale;
1692 
1694  unsigned int repeat;
1695 };
1696 
1697 
1705 __api __check_ret ssize_t iio_device_get_sample_size(const struct iio_device *dev);
1706 
1707 
1712 __api __check_ret __pure long iio_channel_get_index(const struct iio_channel *chn);
1713 
1714 
1718 __api __check_ret __cnst const struct iio_data_format * iio_channel_get_data_format(
1719  const struct iio_channel *chn);
1720 
1721 
1727 __api void iio_channel_convert(const struct iio_channel *chn,
1728  void *dst, const void *src);
1729 
1730 
1736 __api void iio_channel_convert_inverse(const struct iio_channel *chn,
1737  void *dst, const void *src);
1738 
1739 
1743 __api __check_ret __pure unsigned int iio_device_get_debug_attrs_count(
1744  const struct iio_device *dev);
1745 
1746 
1752 __api __check_ret __pure const char * iio_device_get_debug_attr(
1753  const struct iio_device *dev, unsigned int index);
1754 
1755 
1768 __api __check_ret __pure const char * iio_device_find_debug_attr(
1769  const struct iio_device *dev, const char *name);
1770 
1771 
1794 __api __check_ret ssize_t iio_device_debug_attr_read(const struct iio_device *dev,
1795  const char *attr, char *dst, size_t len);
1796 
1797 
1807 __api __check_ret int iio_device_debug_attr_read_all(struct iio_device *dev,
1808  int (*cb)(struct iio_device *dev, const char *attr,
1809  const char *value, size_t len, void *d),
1810  void *data);
1811 
1812 
1832 __api __check_ret ssize_t iio_device_debug_attr_write(const struct iio_device *dev,
1833  const char *attr, const char *src);
1834 
1835 
1844 __api __check_ret ssize_t iio_device_debug_attr_write_raw(const struct iio_device *dev,
1845  const char *attr, const void *src, size_t len);
1846 
1847 
1857 __api __check_ret int iio_device_debug_attr_write_all(struct iio_device *dev,
1858  ssize_t (*cb)(struct iio_device *dev,
1859  const char *attr, void *buf, size_t len, void *d),
1860  void *data);
1861 
1862 
1870 __api __check_ret int iio_device_debug_attr_read_bool(const struct iio_device *dev,
1871  const char *attr, bool *val);
1872 
1873 
1881 __api __check_ret int iio_device_debug_attr_read_longlong(const struct iio_device *dev,
1882  const char *attr, long long *val);
1883 
1884 
1892 __api __check_ret int iio_device_debug_attr_read_double(const struct iio_device *dev,
1893  const char *attr, double *val);
1894 
1895 
1903 __api __check_ret int iio_device_debug_attr_write_bool(const struct iio_device *dev,
1904  const char *attr, bool val);
1905 
1906 
1914 __api __check_ret int iio_device_debug_attr_write_longlong(const struct iio_device *dev,
1915  const char *attr, long long val);
1916 
1917 
1925 __api __check_ret int iio_device_debug_attr_write_double(const struct iio_device *dev,
1926  const char *attr, double val);
1927 
1928 
1941 __api __check_ret int iio_device_identify_filename(const struct iio_device *dev,
1942  const char *filename, struct iio_channel **chn,
1943  const char **attr);
1944 
1945 
1952 __api __check_ret int iio_device_reg_write(struct iio_device *dev,
1953  uint32_t address, uint32_t value);
1954 
1955 
1962 __api __check_ret int iio_device_reg_read(struct iio_device *dev,
1963  uint32_t address, uint32_t *value);
1964 
1965 
1968 #ifdef __cplusplus
1969 }
1970 #endif
1971 
1972 #undef __api
1973 
1974 #endif /* __IIO_H__ */
__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:250
__api void iio_buffer_set_data(struct iio_buffer *buf, void *data)
Associate a pointer to an iio_buffer structure.
Definition: buffer.c:298
__api void iio_buffer_cancel(struct iio_buffer *buf)
Cancel all buffer operations.
Definition: buffer.c:313
__api __check_ret int iio_buffer_get_poll_fd(struct iio_buffer *buf)
Get a pollable file descriptor.
Definition: buffer.c:113
__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:183
__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:308
__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:288
__api void * iio_buffer_start(const struct iio_buffer *buf)
Get the start address of the buffer.
Definition: buffer.c:245
__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 void * iio_buffer_end(const struct iio_buffer *buf)
Get the address that follows the last sample in a buffer.
Definition: buffer.c:293
__api void iio_buffer_destroy(struct iio_buffer *buf)
Destroy the given buffer.
Definition: buffer.c:104
__api void * iio_buffer_get_data(const struct iio_buffer *buf)
Retrieve a previously associated pointer of an iio_buffer structure.
Definition: buffer.c:303
__api __check_ret ssize_t iio_buffer_refill(struct iio_buffer *buf)
Fetch more samples from the hardware.
Definition: buffer.c:123
__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:118
__api __check_ret ssize_t iio_buffer_push(struct iio_buffer *buf)
Send the samples to the hardware.
Definition: buffer.c:147
__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:26
__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:312
__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:643
__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:341
__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:327
__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:322
__api void iio_channel_enable(struct iio_channel *chn)
Enable the given channel.
Definition: channel.c:406
__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:353
__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:660
__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:612
__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:373
__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:302
__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:307
__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:317
__api void iio_channel_set_data(struct iio_channel *chn, void *data)
Associate a pointer to an iio_channel structure.
Definition: channel.c:379
__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:627
__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:596
__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:786
__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:672
__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:705
__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:716
__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:727
__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:683
__api void * iio_channel_get_data(const struct iio_channel *chn)
Retrieve a previously associated pointer of an iio_channel structure.
Definition: channel.c:384
__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:363
__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:581
__api void iio_channel_disable(struct iio_channel *chn)
Disable the given channel.
Definition: channel.c:412
__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:693
__api __check_ret bool iio_channel_is_enabled(const struct iio_channel *chn)
Returns True if the channel is enabled.
Definition: channel.c:400
__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:829
__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:332
__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:297
__api __check_ret struct iio_context * iio_context_clone(const struct iio_context *ctx)
Duplicate a pre-existing IIO context.
Definition: context.c:384
__api __check_ret struct iio_context * iio_create_default_context(void)
Create a context from local or remote IIO devices.
Definition: context.c:415
__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:355
__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_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:470
__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:250
__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:483
__api void iio_context_destroy(struct iio_context *ctx)
Destroy the given context.
Definition: context.c:258
__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:240
__api __check_ret struct iio_context * iio_create_network_context(const char *host)
Create a context from the network.
Definition: context.c:438
__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:465
__api __check_ret struct iio_context * iio_create_xml_context(const char *xml_file)
Create a context from a XML file.
Definition: context.c:456
__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 int iio_context_set_timeout(struct iio_context *ctx, unsigned int timeout_ms)
Set a timeout for I/O operations.
Definition: context.c:376
__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 __pure struct iio_device * iio_context_find_device(const struct iio_context *ctx, const char *name)
Try to find a device structure by its ID, label or name.
Definition: context.c:294
__api __check_ret struct iio_context * iio_create_local_context(void)
Create a context from local IIO devices (Linux only)
Definition: context.c:429
__api __check_ret struct iio_context * iio_create_context_from_uri(const char *uri)
Create a context from a URI description.
Definition: context.c:394
__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:245
__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:701
__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:788
__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:645
__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 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:712
__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:228
__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:724
__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:736
__api __check_ret ssize_t iio_device_get_sample_size(const struct iio_device *dev)
Get the current sample size.
Definition: device.c:476
__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:1029
__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:801
__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:749
__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:635
__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:661
__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's data format structure.
Definition: channel.c:394
__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:689
__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:655
__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:552
__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:520
__api __check_ret __pure long iio_channel_get_index(const struct iio_channel *chn)
Get the index of the given channel.
Definition: channel.c:389
__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:666
__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:672
__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:481
__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:610
__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:316
__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:194
__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:402
__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:1037
__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:622
__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:521
__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:587
__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:222
__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 __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:148
__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:211
__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:199
__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:133
__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:216
__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:368
__api void * iio_device_get_data(const struct iio_device *dev)
Retrieve a previously associated pointer of an iio_device structure.
Definition: device.c:363
__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:352
__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:380
__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:575
__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:498
__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:342
__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:128
__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:545
__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:332
__api __check_ret __pure const char * iio_device_get_label(const struct iio_device *dev)
Retrieve the device label (e.g. lo_pll0_rx_adf4351)
Definition: device.c:138
__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:326
__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 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:510
__api void iio_device_set_data(struct iio_device *dev, void *data)
Associate a pointer to an iio_device structure.
Definition: device.c:358
__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:598
__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:1053
__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:533
__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:1045
__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:143
__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:391
__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:558
__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:306
__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:205
__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:157
hwmon_chan_type
Hwmon channel type.
Definition: iio.h:1621
__api void iio_context_info_list_free(struct iio_context_info **info)
Free a context info list.
Definition: scan.c:103
__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:33
__api void iio_scan_context_destroy(struct iio_scan_context *ctx)
Destroy the given scan context.
Definition: scan.c:188
__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:27
__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:21
__api void iio_scan_block_destroy(struct iio_scan_block *blk)
Destroy the given scan block.
Definition: scan.c:238
__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:208
__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 struct iio_scan_block * iio_create_scan_block(const char *backend, unsigned int flags)
Create a scan block.
Definition: scan.c:218
__api ssize_t iio_scan_block_scan(struct iio_scan_block *blk)
Enumerate available contexts via scan block.
Definition: scan.c:200
__api __check_ret __cnst const char * iio_get_backend(unsigned int index)
Retrieve the name of a given backend.
Definition: backend.c:27
__api void iio_strerror(int err, char *dst, size_t len)
Get a string description of an error code.
Definition: utilities.c:198
__api __check_ret __cnst bool iio_has_backend(const char *backend)
Check if the specified backend is available.
Definition: backend.c:62
__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:186
__api __check_ret __cnst unsigned int iio_get_backends_count(void)
Get the number of available backends.
Definition: backend.c:14
iio_event_type
IIO event type.
Definition: iio.h:202
iio_chan_type
IIO channel type.
Definition: iio.h:101
iio_event_direction
IIO event direction.
Definition: iio.h:217
iio_modifier
IIO channel modifier.
Definition: iio.h:147
An input or output buffer, used to read or write samples.
Represents an input or output channel of a device.
The information related to a discovered context.
Contains the representation of an IIO context.
Contains the format of a data sample.
Definition: iio.h:1668
bool is_signed
Contains True if the sample is signed.
Definition: iio.h:1679
bool is_be
Contains True if the sample is in big-endian format.
Definition: iio.h:1685
bool with_scale
Contains True if the sample should be scaled when converted.
Definition: iio.h:1688
double scale
Contains the scale to apply if with_scale is set.
Definition: iio.h:1691
unsigned int repeat
Number of times length repeats (added in v0.8)
Definition: iio.h:1694
unsigned int length
Total length of the sample, in bits.
Definition: iio.h:1670
bool is_fully_defined
Contains True if the sample is fully defined, sign extended, etc.
Definition: iio.h:1682
unsigned int shift
Right-shift to apply when converting sample.
Definition: iio.h:1676
unsigned int bits
Length of valuable data in the sample, in bits.
Definition: iio.h:1673
Represents a device in the IIO context.