27 #if (defined(_WIN32) || defined(__MBED__)) 28 #ifndef _SSIZE_T_DEFINED 29 typedef ptrdiff_t ssize_t;
30 #define _SSIZE_T_DEFINED 33 #include <sys/types.h> 36 #if defined(_MSC_VER) && (_MSC_VER < 1800) && !defined(__BOOL_DEFINED) 47 #if defined(__GNUC__) && !defined(MATLAB_MEX_FILE) && !defined(MATLAB_LOADLIBRARY) 49 #define __cnst __attribute__((const)) 52 #define __pure __attribute__((pure)) 54 #define __notused __attribute__((unused)) 56 #define __check_ret __attribute__((warn_unused_result)) 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) 75 # define __iio_api_export 76 # define __iio_api_import 80 # define __iio_api __iio_api_export 82 # define __iio_api __iio_api_import 85 #define __api __iio_api 151 #ifndef _IIO_TYPES_H_ 152 #define _IIO_TYPES_H_ 180 IIO_HUMIDITYRELATIVE,
190 IIO_ELECTRICALCONDUCTIVITY,
194 IIO_POSITIONRELATIVE,
196 IIO_MASSCONCENTRATION,
197 IIO_CHAN_TYPE_UNKNOWN = INT_MAX
215 IIO_MOD_X_AND_Y_AND_Z,
222 IIO_MOD_ROOT_SUM_SQUARED_X_Y,
223 IIO_MOD_SUM_SQUARED_X_Y_Z,
229 IIO_MOD_TEMP_AMBIENT,
233 IIO_MOD_NORTH_MAGN_TILT_COMP,
234 IIO_MOD_NORTH_TRUE_TILT_COMP,
239 IIO_MOD_ROOT_SUM_SQUARED_X_Y_Z,
272 IIO_EV_TYPE_THRESH_ADAPTIVE,
273 IIO_EV_TYPE_MAG_ADAPTIVE,
275 IIO_EV_TYPE_MAG_REFERENCED,
290 IIO_EV_DIR_SINGLETAP,
291 IIO_EV_DIR_DOUBLETAP,
303 static inline __check_ret
void *iio_ptr(
int err)
305 return (
void *)(intptr_t) err;
311 static inline __check_ret
int iio_err(
const void *ptr)
313 return (uintptr_t) ptr >= (uintptr_t) -4095 ? (
int)(intptr_t) ptr : 0;
319 static inline __check_ret
void *iio_err_cast(
const void *ptr)
362 __api __check_ret __pure
size_t 371 __api __check_ret __pure
const char *
380 __api __check_ret __pure
const char *
395 __api
void iio_strerror(
int err,
char *dst,
size_t len);
419 __api __check_ret __cnst
const char *
iio_get_backend(
unsigned int index);
562 const char **name,
const char **
value);
590 const struct iio_context *ctx,
unsigned int index);
696 const struct iio_device *dev,
unsigned int index);
705 const struct iio_device *dev,
unsigned int index);
713 const struct iio_device *dev,
unsigned int index);
724 const struct iio_device *dev,
const char *name,
bool output);
739 const struct iio_device *dev,
const char *name);
753 const struct iio_device *dev,
const char *name);
764 __api __check_ret ssize_t
766 const char *attr,
char *dst,
size_t len);
776 #define iio_device_attr_read(dev, attr, 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) 791 __api __check_ret ssize_t
793 const char *attr,
const void *src,
size_t len);
803 #define iio_device_attr_write(dev, attr, 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) 822 __api __check_ret ssize_t
825 const char *attr,
char *dst,
size_t len);
836 #define iio_device_buffer_attr_read(dev, buf_id, attr, 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) 852 __api __check_ret ssize_t
854 unsigned int buf_id,
const char *attr,
855 const void *src,
size_t len);
866 #define iio_device_buffer_attr_write(dev, buf_id, attr, 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) 972 const struct iio_channel *chn,
unsigned int index);
1009 __api __check_ret ssize_t
1011 const char *attr,
char *dst,
size_t len);
1021 #define iio_channel_attr_read(chn, attr, 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) 1036 __api __check_ret ssize_t
1038 const char *attr,
const void *src,
size_t len);
1048 #define iio_channel_attr_write(chn, attr, 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) 1074 __api __check_ret
bool 1090 void *dst,
size_t len,
bool raw);
1104 const void *src,
size_t len,
1298 __api __check_ret ssize_t
1301 ssize_t (*callback)(
const struct iio_channel *chn,
1302 void *src,
size_t bytes,
void *d),
1352 size_t samples_count);
1365 __api __check_ret
const struct iio_block *
1393 HWMON_CHAN_TYPE_UNKNOWN = IIO_CHAN_TYPE_UNKNOWN,
1401 hwmon_channel_get_type(
const struct iio_channel *chn)
1411 static inline bool iio_device_is_hwmon(
const struct iio_device *dev)
1415 return id[0] ==
'h';
1483 __api __check_ret ssize_t
1508 void *dst,
const void *src);
1517 void *dst,
const void *src);
1533 const struct iio_device *dev,
unsigned int index);
1549 const struct iio_device *dev,
const char *name);
1561 __api __check_ret ssize_t
1563 const char *attr,
char *dst,
size_t len);
1573 #define iio_device_debug_attr_read(dev, attr, 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) 1588 __api __check_ret ssize_t
1590 const char *attr,
const void *src,
size_t len);
1600 #define iio_device_debug_attr_write(dev, attr, 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) 1633 uint32_t address, uint32_t value);
1643 uint32_t address, uint32_t *value);
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);
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);
__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'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
__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
__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'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
__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'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'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
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
__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
__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
__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
__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
__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