libiio
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 #ifndef DOXYGEN
16 
17 #ifdef __cplusplus
18 extern "C" {
19 #endif
20 
21 #include <limits.h>
22 #include <stdint.h>
23 #include <stdlib.h>
24 #include <stddef.h>
25 #include <stdio.h>
26 
27 #if (defined(_WIN32) || defined(__MBED__))
28 #ifndef _SSIZE_T_DEFINED
29 typedef ptrdiff_t ssize_t;
30 #define _SSIZE_T_DEFINED
31 #endif
32 #else
33 #include <sys/types.h>
34 #endif
35 
36 #if defined(_MSC_VER) && (_MSC_VER < 1800) && !defined(__BOOL_DEFINED)
37 #undef bool
38 #undef false
39 #undef true
40 #define bool char
41 #define false 0
42 #define true 1
43 #else
44 #include <stdbool.h>
45 #endif
46 
47 #if defined(__GNUC__) && !defined(MATLAB_MEX_FILE) && !defined(MATLAB_LOADLIBRARY)
48 #ifndef __cnst
49 #define __cnst __attribute__((const))
50 #endif
51 #ifndef __pure
52 #define __pure __attribute__((pure))
53 #endif
54 #define __notused __attribute__((unused))
55 #ifdef IIO_CHECK_RET
56 #define __check_ret __attribute__((warn_unused_result))
57 #else
58 #define __check_ret
59 #endif
60 #else
61 #define __cnst
62 #define __pure
63 #define __notused
64 #define __check_ret
65 #endif
66 
67 #if !defined(_WIN32) && __GNUC__ >= 4 && \
68  !defined(MATLAB_MEX_FILE) && !defined(MATLAB_LOADLIBRARY)
69 # define __iio_api_export __attribute__((visibility ("default")))
70 # define __iio_api_import
71 #elif defined(_WIN32) && !defined(LIBIIO_STATIC)
72 # define __iio_api_export __declspec(dllexport)
73 # define __iio_api_import __declspec(dllimport)
74 #else
75 # define __iio_api_export
76 # define __iio_api_import
77 #endif
78 
79 #ifdef LIBIIO_EXPORTS
80 # define __iio_api __iio_api_export
81 #else
82 # define __iio_api __iio_api_import
83 #endif
84 
85 #define __api __iio_api
86 
87 #endif /* DOXYGEN */
88 
89 struct iio_block;
90 struct iio_context;
91 struct iio_device;
92 struct iio_channel;
93 struct iio_channels_mask;
94 struct iio_buffer;
95 struct iio_scan;
96 struct iio_stream;
97 
103  /* @brief No log output from the library */
104  LEVEL_NOLOG = 1,
105 
106  /* @brief Only print error messages */
107  LEVEL_ERROR = 2,
108 
109  /* @brief Also print warnings */
110  LEVEL_WARNING = 3,
111 
112  /* @brief Also print noteworthy information */
113  LEVEL_INFO = 4,
114 
115  /* @brief Also print debug messages */
116  LEVEL_DEBUG = 5,
117 };
118 
128  unsigned int timeout_ms;
129 
131  FILE *out;
132 
134  FILE *err;
135 
139 
145 };
146 
147 /*
148  * <linux/iio/types.h> header guard to protect these enums from being defined
149  * twice
150  */
151 #ifndef _IIO_TYPES_H_
152 #define _IIO_TYPES_H_
153 
162  IIO_VOLTAGE,
163  IIO_CURRENT,
164  IIO_POWER,
165  IIO_ACCEL,
166  IIO_ANGL_VEL,
167  IIO_MAGN,
168  IIO_LIGHT,
169  IIO_INTENSITY,
170  IIO_PROXIMITY,
171  IIO_TEMP,
172  IIO_INCLI,
173  IIO_ROT,
174  IIO_ANGL,
175  IIO_TIMESTAMP,
176  IIO_CAPACITANCE,
177  IIO_ALTVOLTAGE,
178  IIO_CCT,
179  IIO_PRESSURE,
180  IIO_HUMIDITYRELATIVE,
181  IIO_ACTIVITY,
182  IIO_STEPS,
183  IIO_ENERGY,
184  IIO_DISTANCE,
185  IIO_VELOCITY,
186  IIO_CONCENTRATION,
187  IIO_RESISTANCE,
188  IIO_PH,
189  IIO_UVINDEX,
190  IIO_ELECTRICALCONDUCTIVITY,
191  IIO_COUNT,
192  IIO_INDEX,
193  IIO_GRAVITY,
194  IIO_POSITIONRELATIVE,
195  IIO_PHASE,
196  IIO_MASSCONCENTRATION,
197  IIO_CHAN_TYPE_UNKNOWN = INT_MAX
198 };
199 
208  IIO_NO_MOD,
209  IIO_MOD_X,
210  IIO_MOD_Y,
211  IIO_MOD_Z,
212  IIO_MOD_X_AND_Y,
213  IIO_MOD_X_AND_Z,
214  IIO_MOD_Y_AND_Z,
215  IIO_MOD_X_AND_Y_AND_Z,
216  IIO_MOD_X_OR_Y,
217  IIO_MOD_X_OR_Z,
218  IIO_MOD_Y_OR_Z,
219  IIO_MOD_X_OR_Y_OR_Z,
220  IIO_MOD_LIGHT_BOTH,
221  IIO_MOD_LIGHT_IR,
222  IIO_MOD_ROOT_SUM_SQUARED_X_Y,
223  IIO_MOD_SUM_SQUARED_X_Y_Z,
224  IIO_MOD_LIGHT_CLEAR,
225  IIO_MOD_LIGHT_RED,
226  IIO_MOD_LIGHT_GREEN,
227  IIO_MOD_LIGHT_BLUE,
228  IIO_MOD_QUATERNION,
229  IIO_MOD_TEMP_AMBIENT,
230  IIO_MOD_TEMP_OBJECT,
231  IIO_MOD_NORTH_MAGN,
232  IIO_MOD_NORTH_TRUE,
233  IIO_MOD_NORTH_MAGN_TILT_COMP,
234  IIO_MOD_NORTH_TRUE_TILT_COMP,
235  IIO_MOD_RUNNING,
236  IIO_MOD_JOGGING,
237  IIO_MOD_WALKING,
238  IIO_MOD_STILL,
239  IIO_MOD_ROOT_SUM_SQUARED_X_Y_Z,
240  IIO_MOD_I,
241  IIO_MOD_Q,
242  IIO_MOD_CO2,
243  IIO_MOD_VOC,
244  IIO_MOD_LIGHT_UV,
245  IIO_MOD_LIGHT_DUV,
246  IIO_MOD_PM1,
247  IIO_MOD_PM2P5,
248  IIO_MOD_PM4,
249  IIO_MOD_PM10,
250  IIO_MOD_ETHANOL,
251  IIO_MOD_H2,
252  IIO_MOD_O2,
253  IIO_MOD_LINEAR_X,
254  IIO_MOD_LINEAR_Y,
255  IIO_MOD_LINEAR_Z,
256  IIO_MOD_PITCH,
257  IIO_MOD_YAW,
258  IIO_MOD_ROLL,
259 };
260 
269  IIO_EV_TYPE_THRESH,
270  IIO_EV_TYPE_MAG,
271  IIO_EV_TYPE_ROC,
272  IIO_EV_TYPE_THRESH_ADAPTIVE,
273  IIO_EV_TYPE_MAG_ADAPTIVE,
274  IIO_EV_TYPE_CHANGE,
275  IIO_EV_TYPE_MAG_REFERENCED,
276  IIO_EV_TYPE_GESTURE,
277 };
278 
286  IIO_EV_DIR_EITHER,
287  IIO_EV_DIR_RISING,
288  IIO_EV_DIR_FALLING,
289  IIO_EV_DIR_NONE,
290  IIO_EV_DIR_SINGLETAP,
291  IIO_EV_DIR_DOUBLETAP,
292 };
293 
294 #endif /* _IIO_TYPES_H_ */
295 
296 /* ---------------------------------------------------------------------------*/
297 /* ---------------------------- Error handling -------------------------------*/
303 static inline __check_ret void *iio_ptr(int err)
304 {
305  return (void *)(intptr_t) err;
306 }
307 
311 static inline __check_ret int iio_err(const void *ptr)
312 {
313  return (uintptr_t) ptr >= (uintptr_t) -4095 ? (int)(intptr_t) ptr : 0;
314 }
315 
319 static inline __check_ret void *iio_err_cast(const void *ptr)
320 {
321  return (void *) ptr;
322 }
323 /* ------------------------------------------------------------------*/
325 /* ------------------------- Scan functions ----------------------------------*/
347 __api __check_ret struct iio_scan *
348 iio_scan(const struct iio_context_params *params, const char *backends);
349 
350 
355 __api void iio_scan_destroy(struct iio_scan *ctx);
356 
357 
362 __api __check_ret __pure size_t
363 iio_scan_get_results_count(const struct iio_scan *ctx);
364 
365 
371 __api __check_ret __pure const char *
372 iio_scan_get_description(const struct iio_scan *ctx, size_t idx);
373 
374 
380 __api __check_ret __pure const char *
381 iio_scan_get_uri(const struct iio_scan *ctx, size_t idx);
382 
383 /* ------------------------------------------------------------------*/
385 /* ------------------------- Top-level functions -----------------------------*/
395 __api void iio_strerror(int err, char *dst, size_t len);
396 
397 
403 __api __check_ret __cnst bool iio_has_backend(const char *backend);
404 
405 
410 __api __check_ret __cnst unsigned int iio_get_backends_count(void);
411 
412 
419 __api __check_ret __cnst const char * iio_get_backend(unsigned int index);
420 
421 /* ------------------------------------------------------------------*/
423 /* ------------------------- Context functions -------------------------------*/
478 __api __check_ret struct iio_context *
479 iio_create_context(const struct iio_context_params *params, const char *uri);
480 
481 
486 __api void iio_context_destroy(struct iio_context *ctx);
487 
488 
495 __api __pure unsigned int iio_context_get_version_major(const struct iio_context *ctx);
496 
497 
504 __api __pure unsigned int iio_context_get_version_minor(const struct iio_context *ctx);
505 
506 
513 __api __pure const char * iio_context_get_version_tag(const struct iio_context *ctx);
514 
515 
519 __api __check_ret __pure const char * iio_context_get_xml(const struct iio_context *ctx);
520 
521 
529 __api __check_ret __pure const char * iio_context_get_name(const struct iio_context *ctx);
530 
531 
538 __api __check_ret __pure const char * iio_context_get_description(
539  const struct iio_context *ctx);
540 
541 
547 __api __check_ret __pure unsigned int iio_context_get_attrs_count(
548  const struct iio_context *ctx);
549 
550 
560 __api __check_ret int iio_context_get_attr(
561  const struct iio_context *ctx, unsigned int index,
562  const char **name, const char **value);
563 
564 
573 __api __check_ret const char * iio_context_get_attr_value(
574  const struct iio_context *ctx, const char *name);
575 
576 
580 __api __check_ret __pure unsigned int iio_context_get_devices_count(
581  const struct iio_context *ctx);
582 
583 
589 __api __check_ret __pure struct iio_device * iio_context_get_device(
590  const struct iio_context *ctx, unsigned int index);
591 
592 
600 __api __check_ret __pure struct iio_device * iio_context_find_device(
601  const struct iio_context *ctx, const char *name);
602 
603 
611 __api __check_ret int iio_context_set_timeout(
612  struct iio_context *ctx, unsigned int timeout_ms);
613 
614 
618 __api __cnst const struct iio_context_params *
619 iio_context_get_params(const struct iio_context *ctx);
620 
621 
625 __api void iio_context_set_data(struct iio_context *ctx, void *data);
626 
627 
631 __api void * iio_context_get_data(const struct iio_context *ctx);
632 
633 /* ------------------------------------------------------------------*/
635 /* ------------------------- Device functions --------------------------------*/
645 __api __check_ret __pure const struct iio_context * iio_device_get_context(
646  const struct iio_device *dev);
647 
648 
652 __api __check_ret __pure const char * iio_device_get_id(const struct iio_device *dev);
653 
654 
660 __api __check_ret __pure const char * iio_device_get_name(const struct iio_device *dev);
661 
662 
668 __api __check_ret __pure const char * iio_device_get_label(const struct iio_device *dev);
669 
670 
674 __api __check_ret __pure unsigned int iio_device_get_channels_count(
675  const struct iio_device *dev);
676 
677 
681 __api __check_ret __pure unsigned int iio_device_get_attrs_count(
682  const struct iio_device *dev);
683 
687 __api __check_ret __pure unsigned int iio_device_get_buffer_attrs_count(
688  const struct iio_device *dev);
689 
695 __api __check_ret __pure struct iio_channel * iio_device_get_channel(
696  const struct iio_device *dev, unsigned int index);
697 
698 
704 __api __check_ret __pure const char * iio_device_get_attr(
705  const struct iio_device *dev, unsigned int index);
706 
712 __api __check_ret __pure const char * iio_device_get_buffer_attr(
713  const struct iio_device *dev, unsigned int index);
714 
723 __api __check_ret __pure struct iio_channel * iio_device_find_channel(
724  const struct iio_device *dev, const char *name, bool output);
725 
726 
738 __api __check_ret __pure const char * iio_device_find_attr(
739  const struct iio_device *dev, const char *name);
740 
752 __api __check_ret __pure const char * iio_device_find_buffer_attr(
753  const struct iio_device *dev, const char *name);
754 
764 __api __check_ret ssize_t
765 iio_device_attr_read_raw(const struct iio_device *dev,
766  const char *attr, char *dst, size_t len);
767 
768 
776 #define iio_device_attr_read(dev, attr, ptr) \
777  _Generic((ptr), \
778  bool *: iio_device_attr_read_bool, \
779  long long *: iio_device_attr_read_longlong, \
780  double *: iio_device_attr_read_double)(dev, attr, ptr)
781 
782 
791 __api __check_ret ssize_t
792 iio_device_attr_write_raw(const struct iio_device *dev,
793  const char *attr, const void *src, size_t len);
794 
795 
803 #define iio_device_attr_write(dev, attr, val) \
804  _Generic((val), \
805  const char *: iio_device_attr_write_string, \
806  char *: iio_device_attr_write_string, \
807  bool: iio_device_attr_write_bool, \
808  long long: iio_device_attr_write_longlong, \
809  double: iio_device_attr_write_double)(dev, attr, val)
810 
811 
822 __api __check_ret ssize_t
824  unsigned int buf_id,
825  const char *attr, char *dst, size_t len);
826 
827 
836 #define iio_device_buffer_attr_read(dev, buf_id, attr, ptr) \
837  _Generic((ptr), \
838  bool *: iio_device_buffer_attr_read_bool, \
839  long long *: iio_device_buffer_attr_read_longlong, \
840  double *: iio_device_buffer_attr_read_double)(dev, buf_id, attr, ptr)
841 
842 
852 __api __check_ret ssize_t
854  unsigned int buf_id, const char *attr,
855  const void *src, size_t len);
856 
857 
866 #define iio_device_buffer_attr_write(dev, buf_id, attr, val) \
867  _Generic((val), \
868  const char *: iio_device_buffer_attr_write_string, \
869  char *: iio_device_buffer_attr_write_string, \
870  bool: iio_device_buffer_attr_write_bool, \
871  long long: iio_device_buffer_attr_write_longlong, \
872  double: iio_device_buffer_attr_write_double)(dev, buf_id, attr, val)
873 
874 
878 __api void iio_device_set_data(struct iio_device *dev, void *data);
879 
880 
884 __api void * iio_device_get_data(const struct iio_device *dev);
885 
886 
894 __api __check_ret int iio_device_get_trigger(const struct iio_device *dev,
895  const struct iio_device **trigger);
896 
897 
904 __api __check_ret int iio_device_set_trigger(const struct iio_device *dev,
905  const struct iio_device *trigger);
906 
907 
911 __api __check_ret __pure bool iio_device_is_trigger(const struct iio_device *dev);
912 
913 /* ------------------------------------------------------------------*/
915 /* ------------------------- Channel functions -------------------------------*/
925 __api __check_ret __pure const struct iio_device * iio_channel_get_device(
926  const struct iio_channel *chn);
927 
928 
932 __api __check_ret __pure const char * iio_channel_get_id(const struct iio_channel *chn);
933 
934 
940 __api __check_ret __pure const char * iio_channel_get_name(const struct iio_channel *chn);
941 
942 
946 __api __check_ret __pure bool iio_channel_is_output(const struct iio_channel *chn);
947 
948 
956 __api __check_ret __pure bool iio_channel_is_scan_element(const struct iio_channel *chn);
957 
958 
962 __api __check_ret __pure unsigned int iio_channel_get_attrs_count(
963  const struct iio_channel *chn);
964 
965 
971 __api __check_ret __pure const char * iio_channel_get_attr(
972  const struct iio_channel *chn, unsigned int index);
973 
974 
986 __api __check_ret __pure const char * iio_channel_find_attr(
987  const struct iio_channel *chn, const char *name);
988 
989 
996 __api __check_ret __pure const char * iio_channel_attr_get_filename(
997  const struct iio_channel *chn, const char *attr);
998 
999 
1009 __api __check_ret ssize_t
1010 iio_channel_attr_read_raw(const struct iio_channel *chn,
1011  const char *attr, char *dst, size_t len);
1012 
1013 
1021 #define iio_channel_attr_read(chn, attr, ptr) \
1022  _Generic((ptr), \
1023  bool *: iio_channel_attr_read_bool, \
1024  long long *: iio_channel_attr_read_longlong, \
1025  double *: iio_channel_attr_read_double)(chn, attr, ptr)
1026 
1027 
1036 __api __check_ret ssize_t
1037 iio_channel_attr_write_raw(const struct iio_channel *chn,
1038  const char *attr, const void *src, size_t len);
1039 
1040 
1048 #define iio_channel_attr_write(chn, attr, val) \
1049  _Generic((val), \
1050  const char *: iio_channel_attr_write_string, \
1051  char *: iio_channel_attr_write_string, \
1052  bool: iio_channel_attr_write_bool, \
1053  long long: iio_channel_attr_write_longlong, \
1054  double: iio_channel_attr_write_double)(chn, attr, val)
1055 
1056 
1060 __api void iio_channel_enable(const struct iio_channel *chn,
1061  struct iio_channels_mask *mask);
1062 
1063 
1067 __api void iio_channel_disable(const struct iio_channel *chn,
1068  struct iio_channels_mask *mask);
1069 
1070 
1074 __api __check_ret bool
1075 iio_channel_is_enabled(const struct iio_channel *chn,
1076  const struct iio_channels_mask *mask);
1077 
1078 
1088 __api __check_ret size_t iio_channel_read(const struct iio_channel *chn,
1089  const struct iio_block *block,
1090  void *dst, size_t len, bool raw);
1091 
1092 
1102 __api __check_ret size_t iio_channel_write(const struct iio_channel *chn,
1103  struct iio_block *block,
1104  const void *src, size_t len,
1105  bool raw);
1106 
1107 
1111 __api void iio_channel_set_data(struct iio_channel *chn, void *data);
1112 
1113 
1117 __api void * iio_channel_get_data(const struct iio_channel *chn);
1118 
1119 
1123 __api __check_ret __pure enum iio_chan_type iio_channel_get_type(
1124  const struct iio_channel *chn);
1125 
1126 
1130 __api __check_ret __pure enum iio_modifier iio_channel_get_modifier(
1131  const struct iio_channel *chn);
1132 
1133 /* ------------------------------------------------------------------*/
1135 /* ------------------------- Buffer functions --------------------------------*/
1145 __api __check_ret __pure const struct iio_device * iio_buffer_get_device(
1146  const struct iio_buffer *buf);
1147 
1148 
1155 __api __check_ret struct iio_buffer *
1156 iio_device_create_buffer(const struct iio_device *dev, unsigned int idx,
1157  const struct iio_channels_mask *mask);
1158 
1159 
1163 __api void iio_buffer_set_data(struct iio_buffer *buf, void *data);
1164 
1165 
1169 __api void * iio_buffer_get_data(const struct iio_buffer *buf);
1170 
1171 
1174 __api void iio_buffer_destroy(struct iio_buffer *buf);
1175 
1176 
1200 __api void iio_buffer_cancel(struct iio_buffer *buf);
1201 
1202 
1207 __api __check_ret int iio_buffer_enable(struct iio_buffer *buf);
1208 
1209 
1214 __api int iio_buffer_disable(struct iio_buffer *buf);
1215 
1216 
1223 __api const struct iio_channels_mask *
1224 iio_buffer_get_channels_mask(const struct iio_buffer *buf);
1225 
1226 /* ------------------------------------------------------------------*/
1228 /* -------------------------- Block functions --------------------------------*/
1240 __api __check_ret struct iio_block *
1241 iio_buffer_create_block(struct iio_buffer *buffer, size_t size);
1242 
1243 
1246 __api void iio_block_destroy(struct iio_block *block);
1247 
1248 
1252 __api void *iio_block_start(const struct iio_block *block);
1253 
1254 
1276 __api void *iio_block_first(const struct iio_block *block,
1277  const struct iio_channel *chn);
1278 
1279 
1284 __api void *iio_block_end(const struct iio_block *block);
1285 
1286 
1298 __api __check_ret ssize_t
1300  const struct iio_channels_mask *mask,
1301  ssize_t (*callback)(const struct iio_channel *chn,
1302  void *src, size_t bytes, void *d),
1303  void *data);
1304 
1305 
1317 __api int iio_block_enqueue(struct iio_block *block, size_t bytes_used, bool cyclic);
1318 
1319 
1326 __api int iio_block_dequeue(struct iio_block *block, bool nonblock);
1327 
1328 
1332 __api struct iio_buffer * iio_block_get_buffer(const struct iio_block *block);
1333 
1334 /* ------------------------------------------------------------------*/
1336 /* ------------------------- Stream functions --------------------------------*/
1350 __api __check_ret struct iio_stream *
1351 iio_buffer_create_stream(struct iio_buffer *buffer, size_t nb_blocks,
1352  size_t samples_count);
1353 
1354 
1357 __api void
1358 iio_stream_destroy(struct iio_stream *stream);
1359 
1360 
1365 __api __check_ret const struct iio_block *
1366 iio_stream_get_next_block(struct iio_stream *stream);
1367 
1368 /* ------------------------------------------------------------------*/
1370 /* ---------------------------- HWMON support --------------------------------*/
1384  HWMON_VOLTAGE,
1385  HWMON_FAN,
1386  HWMON_PWM,
1387  HWMON_TEMP,
1388  HWMON_CURRENT,
1389  HWMON_POWER,
1390  HWMON_ENERGY,
1391  HWMON_HUMIDITY,
1392  HWMON_INTRUSION,
1393  HWMON_CHAN_TYPE_UNKNOWN = IIO_CHAN_TYPE_UNKNOWN,
1394 };
1395 
1400 static inline enum hwmon_chan_type
1401 hwmon_channel_get_type(const struct iio_channel *chn)
1402 {
1403  return (enum hwmon_chan_type) iio_channel_get_type(chn);
1404 }
1405 
1411 static inline bool iio_device_is_hwmon(const struct iio_device *dev)
1412 {
1413  const char *id = iio_device_get_id(dev);
1414 
1415  return id[0] == 'h';
1416 }
1417 
1418 /* ------------------------------------------------------------------*/
1420 /* ------------------------- Low-level functions -----------------------------*/
1432  unsigned int length;
1433 
1435  unsigned int bits;
1436 
1438  unsigned int shift;
1439 
1442 
1445 
1447  bool is_be;
1448 
1451 
1453  double scale;
1454 
1456  unsigned int repeat;
1457 };
1458 
1459 
1464 __api struct iio_channels_mask *
1465 iio_create_channels_mask(unsigned int nb_channels);
1466 
1467 
1470 __api void
1472 
1473 
1483 __api __check_ret ssize_t
1484 iio_device_get_sample_size(const struct iio_device *dev,
1485  const struct iio_channels_mask *mask);
1486 
1487 
1492 __api __check_ret __pure long iio_channel_get_index(const struct iio_channel *chn);
1493 
1494 
1498 __api __check_ret __cnst const struct iio_data_format * iio_channel_get_data_format(
1499  const struct iio_channel *chn);
1500 
1501 
1507 __api void iio_channel_convert(const struct iio_channel *chn,
1508  void *dst, const void *src);
1509 
1510 
1516 __api void iio_channel_convert_inverse(const struct iio_channel *chn,
1517  void *dst, const void *src);
1518 
1519 
1523 __api __check_ret __pure unsigned int iio_device_get_debug_attrs_count(
1524  const struct iio_device *dev);
1525 
1526 
1532 __api __check_ret __pure const char * iio_device_get_debug_attr(
1533  const struct iio_device *dev, unsigned int index);
1534 
1535 
1548 __api __check_ret __pure const char * iio_device_find_debug_attr(
1549  const struct iio_device *dev, const char *name);
1550 
1551 
1561 __api __check_ret ssize_t
1562 iio_device_debug_attr_read_raw(const struct iio_device *dev,
1563  const char *attr, char *dst, size_t len);
1564 
1565 
1573 #define iio_device_debug_attr_read(dev, attr, ptr) \
1574  _Generic((ptr), \
1575  bool *: iio_device_debug_attr_read_bool, \
1576  long long *: iio_device_debug_attr_read_longlong, \
1577  double *: iio_device_debug_attr_read_double)(dev, attr, ptr)
1578 
1579 
1588 __api __check_ret ssize_t
1590  const char *attr, const void *src, size_t len);
1591 
1592 
1600 #define iio_device_debug_attr_write(dev, attr, val) \
1601  _Generic((val), \
1602  const char *: iio_device_debug_attr_write_string, \
1603  char *: iio_device_debug_attr_write_string, \
1604  bool: iio_device_debug_attr_write_bool, \
1605  long long: iio_device_debug_attr_write_longlong, \
1606  double: iio_device_debug_attr_write_double)(dev, attr, val)
1607 
1608 
1621 __api __check_ret int iio_device_identify_filename(const struct iio_device *dev,
1622  const char *filename, struct iio_channel **chn,
1623  const char **attr);
1624 
1625 
1632 __api __check_ret int iio_device_reg_write(struct iio_device *dev,
1633  uint32_t address, uint32_t value);
1634 
1635 
1642 __api __check_ret int iio_device_reg_read(struct iio_device *dev,
1643  uint32_t address, uint32_t *value);
1644 
1645 
1648 #ifndef DOXYGEN
1649 /* These functions can be used directly, but should be used through the generic
1650  * macros iio_{device,channel,device_buffer,device_debug}_attr_{read,write}() */
1651 __api __check_ret int
1652 iio_device_attr_read_bool(const struct iio_device *dev,
1653  const char *attr, bool *val);
1654 __api __check_ret int
1655 iio_device_attr_read_longlong(const struct iio_device *dev,
1656  const char *attr, long long *val);
1657 __api __check_ret int
1658 iio_device_attr_read_double(const struct iio_device *dev,
1659  const char *attr, double *val);
1660 __api __check_ret ssize_t
1661 iio_device_attr_write_string(const struct iio_device *dev,
1662  const char *attr, const char *src);
1663 __api __check_ret int
1664 iio_device_attr_write_bool(const struct iio_device *dev,
1665  const char *attr, bool val);
1666 __api __check_ret int
1667 iio_device_attr_write_longlong(const struct iio_device *dev,
1668  const char *attr, long long val);
1669 __api __check_ret int
1670 iio_device_attr_write_double(const struct iio_device *dev,
1671  const char *attr, double val);
1672 __api __check_ret int
1673 iio_device_buffer_attr_read_bool(const struct iio_device *dev,
1674  unsigned int buf_id,
1675  const char *attr, bool *val);
1676 __api __check_ret int
1677 iio_device_buffer_attr_read_longlong(const struct iio_device *dev,
1678  unsigned int buf_id,
1679  const char *attr, long long *val);
1680 __api __check_ret int
1681 iio_device_buffer_attr_read_double(const struct iio_device *dev,
1682  unsigned int buf_id,
1683  const char *attr, double *val);
1684 __api __check_ret ssize_t
1685 iio_device_buffer_attr_write_string(const struct iio_device *dev,
1686  unsigned int buf_id,
1687  const char *attr, const char *src);
1688 __api __check_ret int
1689 iio_device_buffer_attr_write_bool(const struct iio_device *dev,
1690  unsigned int buf_id,
1691  const char *attr, bool val);
1692 __api __check_ret int
1693 iio_device_buffer_attr_write_longlong(const struct iio_device *dev,
1694  unsigned int buf_id,
1695  const char *attr, long long val);
1696 __api __check_ret int
1697 iio_device_buffer_attr_write_double(const struct iio_device *dev,
1698  unsigned int buf_id,
1699  const char *attr, double val);
1700 __api __check_ret int
1701 iio_channel_attr_read_bool(const struct iio_channel *chn,
1702  const char *attr, bool *val);
1703 __api __check_ret int
1704 iio_channel_attr_read_longlong(const struct iio_channel *chn,
1705  const char *attr, long long *val);
1706 __api __check_ret int
1707 iio_channel_attr_read_double(const struct iio_channel *chn,
1708  const char *attr, double *val);
1709 __api __check_ret ssize_t
1710 iio_channel_attr_write_string(const struct iio_channel *chn,
1711  const char *attr, const char *src);
1712 __api __check_ret
1713 int iio_channel_attr_write_bool(const struct iio_channel *chn,
1714  const char *attr, bool val);
1715 __api __check_ret int
1716 iio_channel_attr_write_longlong(const struct iio_channel *chn,
1717  const char *attr, long long val);
1718 __api __check_ret int
1719 iio_channel_attr_write_double(const struct iio_channel *chn,
1720  const char *attr, double val);
1721 __api __check_ret int
1722 iio_device_debug_attr_read_bool(const struct iio_device *dev,
1723  const char *attr, bool *val);
1724 __api __check_ret int
1725 iio_device_debug_attr_read_longlong(const struct iio_device *dev,
1726  const char *attr, long long *val);
1727 __api __check_ret int
1728 iio_device_debug_attr_read_double(const struct iio_device *dev,
1729  const char *attr, double *val);
1730 __api __check_ret ssize_t
1731 iio_device_debug_attr_write_string(const struct iio_device *dev,
1732  const char *attr, const char *src);
1733 __api __check_ret int
1734 iio_device_debug_attr_write_bool(const struct iio_device *dev,
1735  const char *attr, bool val);
1736 __api __check_ret int
1737 iio_device_debug_attr_write_longlong(const struct iio_device *dev,
1738  const char *attr, long long val);
1739 __api __check_ret int
1740 iio_device_debug_attr_write_double(const struct iio_device *dev,
1741  const char *attr, double val);
1742 #endif /* DOXYGEN */
1743 
1744 #ifdef __cplusplus
1745 }
1746 #endif
1747 
1748 #undef __api
1749 
1750 #endif /* __IIO_H__ */
__api __check_ret __pure size_t iio_scan_get_results_count(const struct iio_scan *ctx)
Get number of results of a scan operation.
Definition: scan.c:146
__api __check_ret __pure const char * iio_channel_get_name(const struct iio_channel *chn)
Retrieve the channel name (e.g.
Definition: channel.c:308
__api __pure unsigned int iio_context_get_version_minor(const struct iio_context *ctx)
Get the minor number of the library version.
Definition: context.c:378
__api __check_ret __pure const char * iio_channel_get_id(const struct iio_channel *chn)
Retrieve the channel ID (e.g.
Definition: channel.c:303
__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:313
__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: compat.c:867
__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: compat.c:753
__api int iio_block_dequeue(struct iio_block *block, bool nonblock)
Dequeue the given iio_block from the buffer&#39;s queue.
Definition: block.c:166
iio_event_type
IIO event type.
Definition: iio.h:268
__api __check_ret __pure bool iio_device_is_trigger(const struct iio_device *dev)
Return True if the given device is a trigger.
Definition: compat.c:1328
__api __check_ret ssize_t iio_device_attr_read_raw(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:249
__api void * iio_buffer_get_data(const struct iio_buffer *buf)
Retrieve a previously associated pointer of an iio_buffer structure.
Definition: buffer.c:22
bool is_be
Contains True if the sample is in big-endian format.
Definition: iio.h:1447
__api void iio_context_destroy(struct iio_context *ctx)
Destroy the given context.
Definition: compat.c:492
__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:27
__api void iio_buffer_set_data(struct iio_buffer *buf, void *data)
Associate a pointer to an iio_buffer structure.
Definition: buffer.c:17
hwmon_chan_type
Hwmon channel type.
Definition: iio.h:1383
unsigned int bits
Length of valuable data in the sample, in bits.
Definition: iio.h:1435
__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:601
__api __check_ret struct iio_block * iio_buffer_create_block(struct iio_buffer *buffer, size_t size)
Create a data block for the given buffer.
Definition: block.c:28
__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:442
__api __check_ret struct iio_buffer * iio_device_create_buffer(const struct iio_device *dev, unsigned int idx, const struct iio_channels_mask *mask)
Create an input or output buffer associated to the given device.
Definition: buffer.c:98
__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: compat.c:884
FILE * err
Handle to the error output.
Definition: iio.h:134
Structure holding scanning information.
Definition: scan.c:16
__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:807
__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: compat.c:850
Represents an input or output channel of a device.
Definition: iio-private.h:106
unsigned int length
Total length of the sample, in bits.
Definition: iio.h:1432
__api __check_ret ssize_t iio_channel_attr_read_raw(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:387
__api struct iio_channels_mask * iio_create_channels_mask(unsigned int nb_channels)
Create a new empty channels mask.
Definition: mask.c:14
__api __pure unsigned int iio_context_get_version_major(const struct iio_context *ctx)
Get the major number of the library version.
Definition: context.c:370
__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:318
__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:333
__api __check_ret __pure const char * iio_scan_get_description(const struct iio_scan *ctx, size_t idx)
Get description of scanned context.
Definition: scan.c:152
__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: compat.c:839
__api __check_ret __pure const char * iio_device_get_label(const struct iio_device *dev)
Retrieve the device label (e.g.
Definition: compat.c:807
__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: compat.c:780
Represents a device in the IIO context.
Definition: iio-private.h:130
__api __check_ret size_t iio_channel_read(const struct iio_channel *chn, const struct iio_block *block, void *dst, size_t len, bool raw)
Demultiplex and convert the samples of a given channel.
Definition: channel.c:638
__api __check_ret struct iio_stream * iio_buffer_create_stream(struct iio_buffer *buffer, size_t nb_blocks, size_t samples_count)
Create a iio_stream object for the given iio_buffer.
Definition: stream.c:25
__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: compat.c:872
__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: compat.c:765
__api __check_ret int iio_buffer_enable(struct iio_buffer *buf)
Enable the buffer.
Definition: buffer.c:60
__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: compat.c:907
__api __check_ret ssize_t iio_device_debug_attr_read_raw(const struct iio_device *dev, const char *attr, char *dst, size_t len)
Read the content of the given debug attribute.
Definition: device.c:603
__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: compat.c:1099
__api __check_ret __pure const char * iio_scan_get_uri(const struct iio_scan *ctx, size_t idx)
Get URI of scanned context.
Definition: scan.c:160
iio_log_level
Level of verbosity of libiio&#39;s log output.
Definition: iio.h:102
FILE * out
Handle to the standard output.
Definition: iio.h:131
__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:796
iio_modifier
IIO channel modifier.
Definition: iio.h:207
double value(Channel ch)
Reads the value of a channel by using "input" or "raw" attribute and applying "scale" and "offset" if...
Definition: iiopp.h:806
__api int iio_block_enqueue(struct iio_block *block, size_t bytes_used, bool cyclic)
Enqueue the given iio_block to the buffer&#39;s queue.
Definition: block.c:145
__api __check_ret ssize_t iio_device_get_sample_size(const struct iio_device *dev, const struct iio_channels_mask *mask)
Get the current sample size.
Definition: device.c:388
__api void iio_buffer_destroy(struct iio_buffer *buf)
Destroy the given buffer.
Definition: buffer.c:161
__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: compat.c:901
__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: compat.c:786
__api __check_ret struct iio_scan * iio_scan(const struct iio_context_params *params, const char *backends)
Scan backends for IIO contexts.
Definition: scan.c:21
bool is_signed
Contains True if the sample is signed.
Definition: iio.h:1441
unsigned int repeat
Number of times length repeats (added in v0.8)
Definition: iio.h:1456
enum iio_log_level stderr_level
Under this log level (included), messages are sent to the error output ; above this log level (exclud...
Definition: iio.h:144
__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:323
__api __check_ret struct iio_context * iio_create_context(const struct iio_context_params *params, const char *uri)
Create a context from a URI description.
Definition: context.c:421
bool with_scale
Contains True if the sample should be scaled when converted.
Definition: iio.h:1450
__api __check_ret ssize_t iio_device_buffer_attr_read_raw(const struct iio_device *dev, unsigned int buf_id, const char *attr, char *dst, size_t len)
Read the content of the given buffer-specific attribute.
Definition: device.c:281
__api __check_ret __pure const char * iio_context_get_name(const struct iio_context *ctx)
Get the name of the given context.
Definition: compat.c:738
__api void * iio_device_get_data(const struct iio_device *dev)
Retrieve a previously associated pointer of an iio_device structure.
Definition: compat.c:812
__api void * iio_block_first(const struct iio_block *block, const struct iio_channel *chn)
Find the first sample of a channel in a block.
Definition: block.c:204
__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: compat.c:878
__api __cnst const struct iio_context_params * iio_context_get_params(const struct iio_context *ctx)
Get a pointer to the params structure.
Definition: context.c:236
double scale
Contains the scale to apply if with_scale is set.
Definition: iio.h:1453
__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: compat.c:855
__api __check_ret bool iio_channel_is_enabled(const struct iio_channel *chn, const struct iio_channels_mask *mask)
Returns True if the channel is enabled.
Definition: channel.c:448
__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: compat.c:1242
enum iio_log_level log_level
Log level to use.
Definition: iio.h:138
__api void iio_context_set_data(struct iio_context *ctx, void *data)
Associate a pointer to an iio_context structure.
Definition: context.c:638
__api __check_ret __pure const char * iio_device_get_id(const struct iio_device *dev)
Retrieve the device ID (e.g.
Definition: compat.c:797
iio_event_direction
IIO event direction.
Definition: iio.h:285
__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: compat.c:792
__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: compat.c:826
iio_chan_type
IIO channel type.
Definition: iio.h:161
__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: compat.c:895
__api void iio_buffer_cancel(struct iio_buffer *buf)
Cancel all buffer operations.
Definition: buffer.c:32
__api __pure const char * iio_context_get_version_tag(const struct iio_context *ctx)
Get the git hash string of the library version.
Definition: context.c:386
__api __check_ret __pure long iio_channel_get_index(const struct iio_channel *chn)
Get the index of the given channel.
Definition: channel.c:437
Definition: local-mmap.c:45
__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:569
__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:404
__api void * iio_channel_get_data(const struct iio_channel *chn)
Retrieve a previously associated pointer of an iio_channel structure.
Definition: channel.c:432
__api __check_ret const struct iio_block * iio_stream_get_next_block(struct iio_stream *stream)
Get a pointer to the next data block.
Definition: stream.c:85
__api void iio_channel_set_data(struct iio_channel *chn, void *data)
Associate a pointer to an iio_channel structure.
Definition: channel.c:427
bool is_fully_defined
Contains True if the sample is fully defined, sign extended, etc.
Definition: iio.h:1444
__api void iio_device_set_data(struct iio_device *dev, void *data)
Associate a pointer to an iio_device structure.
Definition: compat.c:819
__api __check_ret __pure unsigned int iio_context_get_attrs_count(const struct iio_context *ctx)
Get the number of context-specific attributes.
Definition: compat.c:775
__api const struct iio_channels_mask * iio_buffer_get_channels_mask(const struct iio_buffer *buf)
Retrieve a mask of the channels enabled for the given buffer.
Definition: buffer.c:177
An input or output buffer, used to read or write samples.
Definition: iio-private.h:145
__api void iio_strerror(int err, char *dst, size_t len)
Get a string description of an error code.
Definition: compat.c:1630
Definition: iio-private.h:169
__api __check_ret ssize_t iio_device_buffer_attr_write_raw(const struct iio_device *dev, unsigned int buf_id, const char *attr, const void *src, size_t len)
Set the value of the given buffer-specific attribute.
Definition: device.c:295
unsigned int shift
Right-shift to apply when converting sample.
Definition: iio.h:1438
__api void iio_channels_mask_destroy(struct iio_channels_mask *mask)
Destroy a channels mask.
Definition: mask.c:40
__api struct iio_buffer * iio_block_get_buffer(const struct iio_block *block)
Retrieve a pointer to the iio_buffer structure.
Definition: block.c:299
__api int iio_buffer_disable(struct iio_buffer *buf)
Disable the buffer.
Definition: buffer.c:79
__api void iio_channel_enable(const struct iio_channel *chn, struct iio_channels_mask *mask)
Enable the given channel.
Definition: channel.c:454
IIO context creation information.
Definition: iio.h:126
__api __check_ret __pure const char * iio_device_get_name(const struct iio_device *dev)
Retrieve the device name (e.g.
Definition: compat.c:802
__api __check_ret __pure const char * iio_context_get_xml(const struct iio_context *ctx)
Obtain a XML representation of the given context.
Definition: compat.c:748
__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: compat.c:861
__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_channel_disable(const struct iio_channel *chn, struct iio_channels_mask *mask)
Disable the given channel.
Definition: channel.c:461
__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: compat.c:758
__api __check_ret int iio_context_set_timeout(struct iio_context *ctx, unsigned int timeout_ms)
Set a timeout for I/O operations.
Definition: compat.c:770
__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:338
__api __check_ret __cnst unsigned int iio_get_backends_count(void)
Get the number of available backends.
Definition: backend.c:14
__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:361
__api __check_ret ssize_t iio_block_foreach_sample(const struct iio_block *block, const struct iio_channels_mask *mask, 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 block.
__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: compat.c:1321
__api __check_ret __pure unsigned int iio_device_get_channels_count(const struct iio_device *dev)
Enumerate the channels of the given device.
Definition: compat.c:845
A helper object to simplify reading/writing to a iio_buffer.
Definition: stream.c:16
unsigned int timeout_ms
Timeout for I/O operations.
Definition: iio.h:128
A block of memory containing data samples.
Definition: block.c:16
__api __check_ret size_t iio_channel_write(const struct iio_channel *chn, struct iio_block *block, const void *src, size_t len, bool raw)
Convert and multiplex the samples of a given channel.
Definition: channel.c:679
__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: compat.c:1314
__api __check_ret __pure const char * iio_context_get_description(const struct iio_context *ctx)
Get a description of the given context.
Definition: compat.c:743
__api void * iio_block_end(const struct iio_block *block)
Get the address after the last sample in a block.
Definition: block.c:199
__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: compat.c:889
__api void iio_stream_destroy(struct iio_stream *stream)
Destroy the given stream object.
Definition: stream.c:73
__api void iio_scan_destroy(struct iio_scan *ctx)
Destroy the given scan context.
Definition: scan.c:133
Contains the format of a data sample.
Definition: iio.h:1430
__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: compat.c:833
__api void * iio_context_get_data(const struct iio_context *ctx)
Retrieve a previously associated pointer of an iio_context structure.
Definition: context.c:643
__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:328
__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_block_start(const struct iio_block *block)
Get the start address of the block.
Definition: block.c:194
Contains the representation of an IIO context.
Definition: iio-private.h:81
__api void iio_block_destroy(struct iio_block *block)
Destroy the given block.
Definition: block.c:81