9 #ifndef __IIO_PRIVATE_H__ 10 #define __IIO_PRIVATE_H__ 12 #include "iio-config.h" 16 #include <iio/iio-backend.h> 17 #include <iio/iio-debug.h> 21 #define MAX_CHN_ID NAME_MAX 22 #define MAX_CHN_NAME NAME_MAX 23 #define MAX_DEV_ID NAME_MAX 24 #define MAX_DEV_NAME NAME_MAX 25 #define MAX_CTX_NAME NAME_MAX 26 #define MAX_CTX_DESC NAME_MAX 27 #define MAX_ATTR_NAME NAME_MAX 28 #define MAX_ATTR_VALUE (8 * PAGESIZE) 32 #define is_little_endian() true 34 #define is_little_endian() (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) 37 #define BIT(x) (1 << (x)) 38 #define BIT_MASK(bit) BIT((bit) % 32) 39 #define BIT_WORD(bit) ((bit) / 32) 44 static inline uint32_t iio_be32toh(uint32_t word)
46 if (!is_little_endian())
50 return __builtin_bswap32(word);
52 return ((word & 0xff) << 24) | ((word & 0xff00) << 8) |
53 ((word >> 8) & 0xff00) | ((word >> 24) & 0xff);
57 static inline uint32_t iio_htobe32(uint32_t word)
59 return iio_be32toh(word);
93 unsigned int nb_devices;
99 unsigned int nb_attrs;
112 bool is_scan_element;
120 unsigned int nb_attrs;
135 char *name, *id, *label;
142 unsigned int nb_channels;
161 unsigned int nb_blocks;
181 return mask->mask[BIT_WORD(bit)] & BIT_MASK(bit);
187 mask->mask[BIT_WORD(bit)] |= BIT_MASK(bit);
193 mask->mask[BIT_WORD(bit)] &= ~BIT_MASK(bit);
198 void iio_release_module(
struct iio_module *module);
205 ssize_t iio_snprintf_channel_xml(
char *str, ssize_t slen,
207 ssize_t iio_snprintf_device_xml(
char *str, ssize_t slen,
212 bool iio_device_is_tx(
const struct iio_device *dev);
214 int read_double(
const char *str,
double *val);
215 int write_double(
char *buf,
size_t len,
double val);
217 bool iio_list_has_elem(
const char *list,
const char *elem);
223 struct iio_scan *ctx,
const char *backends);
225 void iio_channel_init_finalize(
struct iio_channel *chn);
226 unsigned int find_channel_modifier(
const char *s,
size_t *len_p);
228 char *iio_strndup(
const char *str,
size_t n);
229 char *iio_strtok_r(
char *str,
const char *delim,
char **saveptr);
230 char * iio_getenv (
char * envvar);
231 uint64_t iio_read_counter_us(
void);
236 const char *key,
const char *
value);
239 const char *attr,
const char *type);
245 extern const struct iio_backend iio_serial_backend;
250 extern const unsigned int iio_backends_size;
252 ssize_t iio_xml_print_and_sanitized_param(
char *ptr, ssize_t len,
253 const char *before,
char *param,
256 static inline void iio_update_xml_indexes(ssize_t ret,
char **ptr, ssize_t *len,
266 bool iio_channel_is_hwmon(
const char *
id);
Definition: iio-backend.h:127
Definition: lock-windows.c:18
Structure holding scanning information.
Definition: scan.c:16
Represents an input or output channel of a device.
Definition: iio-private.h:106
Definition: iio-private.h:76
Represents a device in the IIO context.
Definition: iio-private.h:130
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
iio_chan_type
IIO channel type.
Definition: iio.h:161
Definition: local-mmap.c:45
Definition: iio-private.h:125
An input or output buffer, used to read or write samples.
Definition: iio-private.h:145
Definition: iio-private.h:169
IIO context creation information.
Definition: iio.h:126
A block of memory containing data samples.
Definition: block.c:16
Definition: iio-backend.h:66
Contains the representation of an IIO context.
Definition: iio-private.h:81