Paul Cercueil | bb4401d | 2014-02-28 16:10:49 +0100 | [diff] [blame] | 1 | /* |
| 2 | * libiio - Library for interfacing industrial I/O (IIO) devices |
| 3 | * |
| 4 | * Copyright (C) 2014 Analog Devices, Inc. |
| 5 | * Author: Paul Cercueil <paul.cercueil@analog.com> |
| 6 | * |
| 7 | * This library is free software; you can redistribute it and/or |
| 8 | * modify it under the terms of the GNU Lesser General Public |
| 9 | * License as published by the Free Software Foundation; either |
| 10 | * version 2.1 of the License, or (at your option) any later version. |
| 11 | * |
| 12 | * This library is distributed in the hope that it will be useful, |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 15 | * Lesser General Public License for more details. |
| 16 | * |
| 17 | * */ |
| 18 | |
Paul Cercueil | 0b2ce71 | 2014-02-17 15:04:18 +0100 | [diff] [blame] | 19 | #ifndef __IIO_PRIVATE_H__ |
| 20 | #define __IIO_PRIVATE_H__ |
| 21 | |
Paul Cercueil | 0023624 | 2014-02-18 15:09:06 +0100 | [diff] [blame] | 22 | /* Include public interface */ |
Paul Cercueil | 0b2ce71 | 2014-02-17 15:04:18 +0100 | [diff] [blame] | 23 | #include "iio.h" |
| 24 | |
Paul Cercueil | 30f74d1 | 2017-01-24 10:58:37 +0100 | [diff] [blame] | 25 | #include "iio-config.h" |
| 26 | |
Paul Cercueil | 0b2ce71 | 2014-02-17 15:04:18 +0100 | [diff] [blame] | 27 | #include <stdbool.h> |
| 28 | |
Paul Cercueil | 1ab707c | 2016-02-09 17:12:25 +0100 | [diff] [blame] | 29 | #ifdef _MSC_BUILD |
Lars-Peter Clausen | d1be838 | 2016-02-24 11:13:45 +0100 | [diff] [blame] | 30 | #define inline __inline |
Paul Cercueil | 9c9a556 | 2017-01-24 10:48:31 +0100 | [diff] [blame] | 31 | #define iio_snprintf sprintf_s |
| 32 | #else |
| 33 | #define iio_snprintf snprintf |
| 34 | #endif |
| 35 | |
Paul Cercueil | 65f90e4 | 2016-02-25 16:00:10 +0100 | [diff] [blame] | 36 | #ifdef _WIN32 |
| 37 | # ifdef LIBIIO_EXPORTS |
| 38 | # define __api __declspec(dllexport) |
| 39 | # else |
| 40 | # define __api __declspec(dllimport) |
| 41 | # endif |
| 42 | #elif __GNUC__ >= 4 |
| 43 | # define __api __attribute__((visibility ("default"))) |
| 44 | #else |
| 45 | # define __api |
| 46 | #endif |
| 47 | |
Matt Fornero | 10c541a | 2016-12-15 15:37:56 -0800 | [diff] [blame] | 48 | #ifdef WITH_MATLAB_BINDINGS_API |
| 49 | #include "bindings/matlab/iio-wrapper.h" |
| 50 | #endif |
| 51 | |
Paul Cercueil | 0967b1c | 2015-04-20 11:55:47 +0200 | [diff] [blame] | 52 | #define ARRAY_SIZE(x) (sizeof(x) ? sizeof(x) / sizeof((x)[0]) : 0) |
| 53 | #define BIT(x) (1 << (x)) |
| 54 | #define BIT_MASK(bit) BIT((bit) % 32) |
Paul Cercueil | e131122 | 2014-03-12 15:46:16 +0100 | [diff] [blame] | 55 | #define BIT_WORD(bit) ((bit) / 32) |
| 56 | #define TEST_BIT(addr, bit) (!!(*(((uint32_t *) addr) + BIT_WORD(bit)) \ |
| 57 | & BIT_MASK(bit))) |
| 58 | #define SET_BIT(addr, bit) \ |
| 59 | *(((uint32_t *) addr) + BIT_WORD(bit)) |= BIT_MASK(bit) |
| 60 | #define CLEAR_BIT(addr, bit) \ |
| 61 | *(((uint32_t *) addr) + BIT_WORD(bit)) &= ~BIT_MASK(bit) |
| 62 | |
Paul Cercueil | 2042c90 | 2016-04-25 18:43:45 +0200 | [diff] [blame] | 63 | |
| 64 | /* ntohl/htonl are a nightmare to use in cross-platform applications, |
| 65 | * since they are defined in different headers on different platforms. |
| 66 | * iio_be32toh/iio_htobe32 are just clones of ntohl/htonl. */ |
| 67 | static inline uint32_t iio_be32toh(uint32_t word) |
| 68 | { |
| 69 | #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ |
| 70 | #ifdef __GNUC__ |
| 71 | return __builtin_bswap32(word); |
| 72 | #else |
| 73 | return ((word & 0xff) << 24) | ((word & 0xff00) << 8) | |
| 74 | ((word >> 8) & 0xff00) | ((word >> 24) & 0xff); |
| 75 | #endif |
| 76 | #else |
| 77 | return word; |
| 78 | #endif |
| 79 | } |
| 80 | |
| 81 | static inline uint32_t iio_htobe32(uint32_t word) |
| 82 | { |
| 83 | return iio_be32toh(word); |
| 84 | } |
| 85 | |
Lars-Peter Clausen | d1be838 | 2016-02-24 11:13:45 +0100 | [diff] [blame] | 86 | /* Allocate zeroed out memory */ |
| 87 | static inline void *zalloc(size_t size) |
| 88 | { |
| 89 | return calloc(1, size); |
| 90 | } |
| 91 | |
Matt Fornero | 81f04a5 | 2017-11-30 14:36:37 -0500 | [diff] [blame] | 92 | enum iio_attr_type { |
| 93 | IIO_ATTR_TYPE_DEVICE = 0, |
| 94 | IIO_ATTR_TYPE_DEBUG, |
| 95 | IIO_ATTR_TYPE_BUFFER, |
| 96 | }; |
| 97 | |
Paul Cercueil | 0b2ce71 | 2014-02-17 15:04:18 +0100 | [diff] [blame] | 98 | struct iio_backend_ops { |
Paul Cercueil | 63d5e7c | 2014-10-28 14:33:08 +0100 | [diff] [blame] | 99 | struct iio_context * (*clone)(const struct iio_context *ctx); |
Paul Cercueil | 45c575d | 2014-03-20 15:14:01 +0100 | [diff] [blame] | 100 | ssize_t (*read)(const struct iio_device *dev, void *dst, size_t len, |
| 101 | uint32_t *mask, size_t words); |
Paul Cercueil | ec1760d | 2014-02-21 11:31:20 +0100 | [diff] [blame] | 102 | ssize_t (*write)(const struct iio_device *dev, |
| 103 | const void *src, size_t len); |
Paul Cercueil | 92f15c2 | 2015-04-20 11:36:51 +0200 | [diff] [blame] | 104 | int (*open)(const struct iio_device *dev, |
| 105 | size_t samples_count, bool cyclic); |
Paul Cercueil | ec1760d | 2014-02-21 11:31:20 +0100 | [diff] [blame] | 106 | int (*close)(const struct iio_device *dev); |
Romain Roffé | 6a88170 | 2015-06-30 16:25:43 +0200 | [diff] [blame] | 107 | int (*get_fd)(const struct iio_device *dev); |
Romain Roffé | 0ea038d | 2015-06-30 13:35:38 +0200 | [diff] [blame] | 108 | int (*set_blocking_mode)(const struct iio_device *dev, bool blocking); |
Paul Cercueil | 0b2ce71 | 2014-02-17 15:04:18 +0100 | [diff] [blame] | 109 | |
Lars-Peter Clausen | 48c0160 | 2016-04-20 13:10:05 +0200 | [diff] [blame] | 110 | void (*cancel)(const struct iio_device *dev); |
| 111 | |
Romain Roffé | 6c385d9 | 2015-06-30 13:36:05 +0200 | [diff] [blame] | 112 | int (*set_kernel_buffers_count)(const struct iio_device *dev, |
| 113 | unsigned int nb_blocks); |
Paul Cercueil | 93f7e1f | 2014-04-23 16:49:56 +0200 | [diff] [blame] | 114 | ssize_t (*get_buffer)(const struct iio_device *dev, |
Paul Cercueil | 76ca884 | 2015-03-05 11:16:16 +0100 | [diff] [blame] | 115 | void **addr_ptr, size_t bytes_used, |
| 116 | uint32_t *mask, size_t words); |
Paul Cercueil | 93f7e1f | 2014-04-23 16:49:56 +0200 | [diff] [blame] | 117 | |
Paul Cercueil | 167d311 | 2014-02-18 12:23:53 +0100 | [diff] [blame] | 118 | ssize_t (*read_device_attr)(const struct iio_device *dev, |
Matt Fornero | 81f04a5 | 2017-11-30 14:36:37 -0500 | [diff] [blame] | 119 | const char *attr, char *dst, size_t len, enum iio_attr_type); |
Paul Cercueil | 167d311 | 2014-02-18 12:23:53 +0100 | [diff] [blame] | 120 | ssize_t (*write_device_attr)(const struct iio_device *dev, |
Paul Cercueil | cecda35 | 2014-05-06 18:14:29 +0200 | [diff] [blame] | 121 | const char *attr, const char *src, |
Matt Fornero | 81f04a5 | 2017-11-30 14:36:37 -0500 | [diff] [blame] | 122 | size_t len, enum iio_attr_type); |
Paul Cercueil | 167d311 | 2014-02-18 12:23:53 +0100 | [diff] [blame] | 123 | ssize_t (*read_channel_attr)(const struct iio_channel *chn, |
| 124 | const char *attr, char *dst, size_t len); |
| 125 | ssize_t (*write_channel_attr)(const struct iio_channel *chn, |
Paul Cercueil | cecda35 | 2014-05-06 18:14:29 +0200 | [diff] [blame] | 126 | const char *attr, const char *src, size_t len); |
Paul Cercueil | 0b2ce71 | 2014-02-17 15:04:18 +0100 | [diff] [blame] | 127 | |
Paul Cercueil | 24ffa53 | 2014-03-10 12:39:58 +0100 | [diff] [blame] | 128 | int (*get_trigger)(const struct iio_device *dev, |
| 129 | const struct iio_device **trigger); |
| 130 | int (*set_trigger)(const struct iio_device *dev, |
| 131 | const struct iio_device *trigger); |
| 132 | |
Paul Cercueil | 0b2ce71 | 2014-02-17 15:04:18 +0100 | [diff] [blame] | 133 | void (*shutdown)(struct iio_context *ctx); |
Paul Cercueil | e45f876 | 2014-05-02 11:19:26 +0200 | [diff] [blame] | 134 | |
Harvey Yang | bc3f48e | 2019-10-22 11:17:28 +0800 | [diff] [blame] | 135 | int (*request_client_id)(const struct iio_context *ctx); |
| 136 | int (*register_client_id)(const struct iio_device *dev); |
Paul Cercueil | 9de9e9d | 2014-05-20 13:18:19 +0200 | [diff] [blame] | 137 | int (*get_version)(const struct iio_context *ctx, unsigned int *major, |
| 138 | unsigned int *minor, char git_tag[8]); |
Paul Cercueil | 4ca7354 | 2014-06-10 16:23:29 +0200 | [diff] [blame] | 139 | |
| 140 | int (*set_timeout)(struct iio_context *ctx, unsigned int timeout); |
Paul Cercueil | 0b2ce71 | 2014-02-17 15:04:18 +0100 | [diff] [blame] | 141 | }; |
| 142 | |
Robin Getz | 57295ce | 2018-05-24 21:45:08 +0000 | [diff] [blame] | 143 | /* |
| 144 | * If these structures are updated, the qsort functions defined in sort.c |
| 145 | * may need to be updated. |
| 146 | */ |
| 147 | |
Paul Cercueil | 82b3c1c | 2014-02-24 13:15:56 +0100 | [diff] [blame] | 148 | struct iio_context_pdata; |
Paul Cercueil | eaab658 | 2014-02-21 09:35:59 +0100 | [diff] [blame] | 149 | struct iio_device_pdata; |
| 150 | struct iio_channel_pdata; |
Lars-Peter Clausen | 794ba03 | 2016-04-25 15:07:00 +0200 | [diff] [blame] | 151 | struct iio_scan_backend_context; |
Paul Cercueil | 82b3c1c | 2014-02-24 13:15:56 +0100 | [diff] [blame] | 152 | |
Paul Cercueil | b34e022 | 2014-05-05 15:32:38 +0200 | [diff] [blame] | 153 | struct iio_channel_attr { |
| 154 | char *name; |
Paul Cercueil | 42d1235 | 2014-05-05 16:11:58 +0200 | [diff] [blame] | 155 | char *filename; |
Paul Cercueil | b34e022 | 2014-05-05 15:32:38 +0200 | [diff] [blame] | 156 | }; |
| 157 | |
Paul Cercueil | 0b2ce71 | 2014-02-17 15:04:18 +0100 | [diff] [blame] | 158 | struct iio_context { |
Paul Cercueil | 82b3c1c | 2014-02-24 13:15:56 +0100 | [diff] [blame] | 159 | struct iio_context_pdata *pdata; |
Paul Cercueil | 0b2ce71 | 2014-02-17 15:04:18 +0100 | [diff] [blame] | 160 | const struct iio_backend_ops *ops; |
Paul Cercueil | 0b2ce71 | 2014-02-17 15:04:18 +0100 | [diff] [blame] | 161 | const char *name; |
Paul Cercueil | 3ac36c1 | 2015-01-08 14:44:00 +0100 | [diff] [blame] | 162 | char *description; |
Paul Cercueil | 0b2ce71 | 2014-02-17 15:04:18 +0100 | [diff] [blame] | 163 | |
| 164 | struct iio_device **devices; |
| 165 | unsigned int nb_devices; |
Paul Cercueil | 4c6729d | 2014-04-04 17:24:41 +0200 | [diff] [blame] | 166 | |
| 167 | char *xml; |
Paul Cercueil | 60b4d1b | 2016-11-15 15:55:41 +0100 | [diff] [blame] | 168 | |
| 169 | char **attrs; |
| 170 | char **values; |
| 171 | unsigned int nb_attrs; |
Harvey Yang | bc3f48e | 2019-10-22 11:17:28 +0800 | [diff] [blame] | 172 | int client_id; |
Paul Cercueil | 0b2ce71 | 2014-02-17 15:04:18 +0100 | [diff] [blame] | 173 | }; |
| 174 | |
Paul Cercueil | 0b2ce71 | 2014-02-17 15:04:18 +0100 | [diff] [blame] | 175 | struct iio_channel { |
Paul Cercueil | eaab658 | 2014-02-21 09:35:59 +0100 | [diff] [blame] | 176 | struct iio_device *dev; |
| 177 | struct iio_channel_pdata *pdata; |
Paul Cercueil | d96e61f | 2014-03-07 16:13:37 +0100 | [diff] [blame] | 178 | void *userdata; |
Paul Cercueil | eaab658 | 2014-02-21 09:35:59 +0100 | [diff] [blame] | 179 | |
Paul Cercueil | 35a0131 | 2014-02-20 10:56:57 +0100 | [diff] [blame] | 180 | bool is_output; |
Paul Cercueil | 85aaf48 | 2014-04-24 16:39:09 +0200 | [diff] [blame] | 181 | bool is_scan_element; |
Paul Cercueil | cd6ce84 | 2014-03-14 13:21:06 +0100 | [diff] [blame] | 182 | struct iio_data_format format; |
Paul Cercueil | bb61827 | 2014-02-20 11:35:52 +0100 | [diff] [blame] | 183 | char *name, *id; |
Paul Cercueil | ae88fde | 2014-03-12 11:47:10 +0100 | [diff] [blame] | 184 | long index; |
Lars-Peter Clausen | 093ae46 | 2016-06-21 11:43:54 +0200 | [diff] [blame] | 185 | enum iio_modifier modifier; |
Lars-Peter Clausen | c6f8592 | 2016-04-20 15:03:49 +0200 | [diff] [blame] | 186 | enum iio_chan_type type; |
Paul Cercueil | 0b2ce71 | 2014-02-17 15:04:18 +0100 | [diff] [blame] | 187 | |
Paul Cercueil | b34e022 | 2014-05-05 15:32:38 +0200 | [diff] [blame] | 188 | struct iio_channel_attr *attrs; |
Paul Cercueil | 0b2ce71 | 2014-02-17 15:04:18 +0100 | [diff] [blame] | 189 | unsigned int nb_attrs; |
Paul Cercueil | 5e3b9cd | 2017-04-11 17:31:46 +0200 | [diff] [blame] | 190 | |
| 191 | unsigned int number; |
Paul Cercueil | 0b2ce71 | 2014-02-17 15:04:18 +0100 | [diff] [blame] | 192 | }; |
| 193 | |
| 194 | struct iio_device { |
| 195 | const struct iio_context *ctx; |
Paul Cercueil | eaab658 | 2014-02-21 09:35:59 +0100 | [diff] [blame] | 196 | struct iio_device_pdata *pdata; |
Paul Cercueil | d96e61f | 2014-03-07 16:13:37 +0100 | [diff] [blame] | 197 | void *userdata; |
Paul Cercueil | eaab658 | 2014-02-21 09:35:59 +0100 | [diff] [blame] | 198 | |
Paul Cercueil | bb61827 | 2014-02-20 11:35:52 +0100 | [diff] [blame] | 199 | char *name, *id; |
Paul Cercueil | 0b2ce71 | 2014-02-17 15:04:18 +0100 | [diff] [blame] | 200 | |
Paul Cercueil | bb61827 | 2014-02-20 11:35:52 +0100 | [diff] [blame] | 201 | char **attrs; |
Paul Cercueil | 0b2ce71 | 2014-02-17 15:04:18 +0100 | [diff] [blame] | 202 | unsigned int nb_attrs; |
| 203 | |
Matt Fornero | 7f9598f | 2017-11-30 14:07:52 -0500 | [diff] [blame] | 204 | char **buffer_attrs; |
| 205 | unsigned int nb_buffer_attrs; |
| 206 | |
Paul Cercueil | ddaa26a | 2014-04-14 17:32:18 +0200 | [diff] [blame] | 207 | char **debug_attrs; |
| 208 | unsigned int nb_debug_attrs; |
| 209 | |
Paul Cercueil | 0b2ce71 | 2014-02-17 15:04:18 +0100 | [diff] [blame] | 210 | struct iio_channel **channels; |
| 211 | unsigned int nb_channels; |
Paul Cercueil | ff77823 | 2014-03-24 14:23:08 +0100 | [diff] [blame] | 212 | |
| 213 | uint32_t *mask; |
| 214 | size_t words; |
Paul Cercueil | 0b2ce71 | 2014-02-17 15:04:18 +0100 | [diff] [blame] | 215 | }; |
| 216 | |
Paul Cercueil | a689cd9 | 2014-03-20 16:37:25 +0100 | [diff] [blame] | 217 | struct iio_buffer { |
| 218 | const struct iio_device *dev; |
Paul Cercueil | a2d4bad | 2014-05-27 10:15:29 +0200 | [diff] [blame] | 219 | void *buffer, *userdata; |
Paul Cercueil | a689cd9 | 2014-03-20 16:37:25 +0100 | [diff] [blame] | 220 | size_t length, data_length; |
| 221 | |
Paul Cercueil | 645ab97 | 2014-03-24 14:36:12 +0100 | [diff] [blame] | 222 | uint32_t *mask; |
Paul Cercueil | 9e5301d | 2014-11-19 15:34:28 +0100 | [diff] [blame] | 223 | unsigned int dev_sample_size; |
Paul Cercueil | a689cd9 | 2014-03-20 16:37:25 +0100 | [diff] [blame] | 224 | unsigned int sample_size; |
Paul Cercueil | 2a74bd7 | 2014-04-28 13:18:48 +0200 | [diff] [blame] | 225 | bool is_output, dev_is_high_speed; |
Paul Cercueil | a689cd9 | 2014-03-20 16:37:25 +0100 | [diff] [blame] | 226 | }; |
| 227 | |
Lars-Peter Clausen | 0863373 | 2016-02-22 14:35:17 +0100 | [diff] [blame] | 228 | struct iio_context_info { |
| 229 | char *description; |
| 230 | char *uri; |
| 231 | }; |
| 232 | |
| 233 | struct iio_scan_result { |
| 234 | size_t size; |
| 235 | struct iio_context_info **info; |
| 236 | }; |
| 237 | |
| 238 | struct iio_context_info ** iio_scan_result_add( |
| 239 | struct iio_scan_result *scan_result, size_t num); |
| 240 | |
Paul Cercueil | 0023624 | 2014-02-18 15:09:06 +0100 | [diff] [blame] | 241 | void free_channel(struct iio_channel *chn); |
| 242 | void free_device(struct iio_device *dev); |
Paul Cercueil | 0b2ce71 | 2014-02-17 15:04:18 +0100 | [diff] [blame] | 243 | |
Paul Cercueil | 42090d1 | 2014-02-24 12:32:23 +0100 | [diff] [blame] | 244 | char *iio_channel_get_xml(const struct iio_channel *chn, size_t *len); |
| 245 | char *iio_device_get_xml(const struct iio_device *dev, size_t *len); |
| 246 | |
Paul Cercueil | c1ed848 | 2014-06-11 16:29:43 +0200 | [diff] [blame] | 247 | char *iio_context_create_xml(const struct iio_context *ctx); |
Paul Cercueil | fd38747 | 2015-08-05 10:34:19 +0200 | [diff] [blame] | 248 | int iio_context_init(struct iio_context *ctx); |
Paul Cercueil | ae88fde | 2014-03-12 11:47:10 +0100 | [diff] [blame] | 249 | |
Lars-Peter Clausen | 62bd552 | 2015-03-27 16:06:52 +0100 | [diff] [blame] | 250 | bool iio_device_is_tx(const struct iio_device *dev); |
Paul Cercueil | 6d3fb8d | 2014-05-27 10:04:00 +0200 | [diff] [blame] | 251 | int iio_device_open(const struct iio_device *dev, |
| 252 | size_t samples_count, bool cyclic); |
| 253 | int iio_device_close(const struct iio_device *dev); |
Romain Roffé | cead1da | 2015-06-30 13:35:51 +0200 | [diff] [blame] | 254 | int iio_device_set_blocking_mode(const struct iio_device *dev, bool blocking); |
Paul Cercueil | 6d3fb8d | 2014-05-27 10:04:00 +0200 | [diff] [blame] | 255 | ssize_t iio_device_read_raw(const struct iio_device *dev, |
| 256 | void *dst, size_t len, uint32_t *mask, size_t words); |
| 257 | ssize_t iio_device_write_raw(const struct iio_device *dev, |
| 258 | const void *src, size_t len); |
Romain Roffé | 6a88170 | 2015-06-30 16:25:43 +0200 | [diff] [blame] | 259 | int iio_device_get_poll_fd(const struct iio_device *dev); |
Paul Cercueil | 6d3fb8d | 2014-05-27 10:04:00 +0200 | [diff] [blame] | 260 | |
Paul Cercueil | 542cbb4 | 2014-10-21 13:00:38 +0200 | [diff] [blame] | 261 | int read_double(const char *str, double *val); |
Paul Cercueil | 225a3e1 | 2015-03-03 18:08:41 +0100 | [diff] [blame] | 262 | int write_double(char *buf, size_t len, double val); |
Paul Cercueil | 542cbb4 | 2014-10-21 13:00:38 +0200 | [diff] [blame] | 263 | |
Paul Cercueil | 63e5218 | 2014-12-11 12:52:48 +0100 | [diff] [blame] | 264 | struct iio_context * local_create_context(void); |
| 265 | struct iio_context * network_create_context(const char *hostname); |
| 266 | struct iio_context * xml_create_context_mem(const char *xml, size_t len); |
| 267 | struct iio_context * xml_create_context(const char *xml_file); |
Lars-Peter Clausen | 7a8e6b5 | 2016-02-22 13:25:12 +0100 | [diff] [blame] | 268 | struct iio_context * usb_create_context(unsigned int bus, unsigned int address, |
| 269 | unsigned int interface); |
Lars-Peter Clausen | 60f1c9a | 2016-02-22 13:20:40 +0100 | [diff] [blame] | 270 | struct iio_context * usb_create_context_from_uri(const char *uri); |
Paul Cercueil | bcb0452 | 2016-03-22 17:03:29 +0100 | [diff] [blame] | 271 | struct iio_context * serial_create_context_from_uri(const char *uri); |
Paul Cercueil | 63e5218 | 2014-12-11 12:52:48 +0100 | [diff] [blame] | 272 | |
Lars-Peter Clausen | 3db58d6 | 2016-04-25 15:00:54 +0200 | [diff] [blame] | 273 | int local_context_scan(struct iio_scan_result *scan_result); |
| 274 | |
Lars-Peter Clausen | 794ba03 | 2016-04-25 15:07:00 +0200 | [diff] [blame] | 275 | struct iio_scan_backend_context * usb_context_scan_init(void); |
| 276 | void usb_context_scan_free(struct iio_scan_backend_context *ctx); |
| 277 | |
| 278 | int usb_context_scan(struct iio_scan_backend_context *ctx, |
| 279 | struct iio_scan_result *scan_result); |
| 280 | |
Paul Cercueil | e98500b | 2014-04-10 13:31:04 +0200 | [diff] [blame] | 281 | /* This function is not part of the API, but is used by the IIO daemon */ |
Paul Cercueil | 59f2aa3 | 2014-04-04 16:28:51 +0200 | [diff] [blame] | 282 | __api ssize_t iio_device_get_sample_size_mask(const struct iio_device *dev, |
Paul Cercueil | 92f15c2 | 2015-04-20 11:36:51 +0200 | [diff] [blame] | 283 | const uint32_t *mask, size_t words); |
Paul Cercueil | 4682594 | 2014-03-18 14:28:49 +0100 | [diff] [blame] | 284 | |
Lars-Peter Clausen | c6f8592 | 2016-04-20 15:03:49 +0200 | [diff] [blame] | 285 | void iio_channel_init_finalize(struct iio_channel *chn); |
Lars-Peter Clausen | ca20c24 | 2018-01-24 11:04:10 +0100 | [diff] [blame] | 286 | unsigned int find_channel_modifier(const char *s, size_t *len_p); |
Lars-Peter Clausen | c6f8592 | 2016-04-20 15:03:49 +0200 | [diff] [blame] | 287 | |
Paul Cercueil | caf0e71 | 2016-08-25 17:27:02 +0200 | [diff] [blame] | 288 | char *iio_strdup(const char *str); |
| 289 | |
Paul Cercueil | a09970b | 2016-11-24 17:30:07 +0100 | [diff] [blame] | 290 | int iio_context_add_attr(struct iio_context *ctx, |
| 291 | const char *key, const char *value); |
| 292 | |
Paul Cercueil | 65f90e4 | 2016-02-25 16:00:10 +0100 | [diff] [blame] | 293 | #undef __api |
| 294 | |
Paul Cercueil | 0b2ce71 | 2014-02-17 15:04:18 +0100 | [diff] [blame] | 295 | #endif /* __IIO_PRIVATE_H__ */ |