libiio  0.23
Library for interfacing with IIO devices
/home/rchis/v0.23/libiio/dns_sd.h
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-2020 Analog Devices, Inc.
6  * Author: Paul Cercueil
7  * Robin Getz
8  */
9 
10 #ifndef __IIO_DNS_SD_H
11 #define __IIO_DNS_SD_H
12 
13 #include <stdbool.h>
14 #include <stdint.h>
15 
16 #ifdef _WIN32
17 #include <winsock2.h>
18 #ifndef MAXHOSTNAMELEN
19 #define MAXHOSTNAMELEN (MAX_COMPUTERNAME_LENGTH+1)
20 #endif /* MAXHOSTNAMELEN */
21 #else
22 #include <sys/param.h>
23 #endif
24 
25 #define DNS_SD_ADDRESS_STR_MAX (40) /* IPv6 Max = 4*8 + 7 + 1 for NUL */
26 
27 /* MacOS doesn't include ENOMEDIUM (No medium found) like Linux does */
28 #ifndef ENOMEDIUM
29 #define ENOMEDIUM ENOENT
30 #endif
31 
32 /* Used everywhere */
33 #define IIOD_PORT 30431
34 
35 struct addrinfo;
36 struct AvahiSimplePoll;
37 struct AvahiAddress;
38 
39 /* Common structure which all dns_sd_[*] files fill out
40  * Anything that is dynamically allocated (malloc) needs to be managed
41  */
42 struct dns_sd_discovery_data {
43  struct iio_mutex *lock;
44  struct AvahiSimplePoll *poll;
45  struct AvahiAddress *address;
46  uint16_t found, resolved;
47  char addr_str[DNS_SD_ADDRESS_STR_MAX];
48  char *hostname;
49  uint16_t port;
50  struct dns_sd_discovery_data *next;
51 };
52 
53 
54 /* This functions is implemented in network.c, but used in dns_sd.c
55  */
56 int create_socket(const struct addrinfo *addrinfo);
57 
58 /* These functions are common, and implemented in dns_sd_[*].c based on the
59  * implementations: avahi (linux), bonjour (mac), or ServiceDiscovery (Win10)
60  */
61 
62 /* Resolves all IIO hosts on the available networks, and passes back a linked list */
63 int dnssd_find_hosts(struct dns_sd_discovery_data ** ddata);
64 
65 /* Deallocates complete list of discovery data */
66 void dnssd_free_all_discovery_data(struct dns_sd_discovery_data *d);
67 
68 /* These functions are common, and found in dns_sd.c, but are used in the
69  * dns_sd_[*].c implementations or network.c
70  */
71 
72 /* Passed back the first (random) IIOD service resolved by DNS DS. */
73 int dnssd_discover_host(char *addr_str, size_t addr_len, uint16_t *port);
74 
75 /* remove duplicates from the list */
76 void remove_dup_discovery_data(struct dns_sd_discovery_data **ddata);
77 
78 /* port knocks */
79 void port_knock_discovery_data(struct dns_sd_discovery_data **ddata);
80 
81 /* Use dnssd to resolve a given hostname */
82 int dnssd_resolve_host(const char *hostname, char *ip_addr, const int addr_len);
83 
84 #endif /* __IIO_DNS_SD_H */
iio_device_get_name
const char * iio_device_get_name(const struct iio_device *dev)
Retrieve the device name (e.g. xadc)
Definition: device.c:133
iio_buffer_foreach_sample
__api __check_ret ssize_t iio_buffer_foreach_sample(struct iio_buffer *buf, ssize_t(*callback)(const struct iio_channel *chn, void *src, size_t bytes, void *d), void *data)
Call the supplied callback for each sample found in a buffer.
iio_channel_convert_inverse
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:513
iio_buffer_end
void * iio_buffer_end(const struct iio_buffer *buffer)
Get the address that follows the last sample in a buffer.
Definition: buffer.c:293
iio_device_debug_attr_write
ssize_t iio_device_debug_attr_write(const struct iio_device *dev, const char *attr, const char *src)
Set the value of the given debug attribute.
Definition: device.c:655
iio_channel
Represents an input or output channel of a device.
iio_device_buffer_attr_write_bool
int iio_device_buffer_attr_write_bool(const struct iio_device *dev, const char *attr, bool val)
Set the value of the given buffer-specific attribute.
Definition: device.c:622
iio_buffer_push_partial
ssize_t iio_buffer_push_partial(struct iio_buffer *buffer, size_t samples_count)
Send a given number of samples to the hardware.
Definition: buffer.c:183
iio_buffer_push
ssize_t iio_buffer_push(struct iio_buffer *buffer)
Send the samples to the hardware.
Definition: buffer.c:147
iio_device_buffer_attr_read
ssize_t iio_device_buffer_attr_read(const struct iio_device *dev, const char *attr, char *dst, size_t len)
Read the content of the given buffer-specific attribute.
Definition: device.c:332
iio_channel_attr_write_raw
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:324
iio_device_attr_write_longlong
int iio_device_attr_write_longlong(const struct iio_device *dev, const char *attr, long long val)
Set the value of the given device-specific attribute.
Definition: device.c:521
iio_channel_is_enabled
bool iio_channel_is_enabled(const struct iio_channel *chn)
Returns True if the channel is enabled.
Definition: channel.c:361
iio_context_get_attrs_count
unsigned int iio_context_get_attrs_count(const struct iio_context *ctx)
Get the number of context-specific attributes.
Definition: context.c:465
iio_device_debug_attr_write_bool
int iio_device_debug_attr_write_bool(const struct iio_device *dev, const char *attr, bool val)
Set the value of the given debug attribute.
Definition: device.c:736
iio_device_reg_write
int iio_device_reg_write(struct iio_device *dev, uint32_t address, uint32_t value)
Set the value of a hardware register.
Definition: device.c:788
iio_data_format::bits
unsigned int bits
Length of valuable data in the sample, in bits.
Definition: iio.h:1565
iio_device_debug_attr_read
ssize_t iio_device_debug_attr_read(const struct iio_device *dev, const char *attr, char *dst, size_t len)
Read the content of the given debug attribute.
Definition: device.c:635
iio_context_info
The information related to a discovered context.
iio_device_get_data
void * iio_device_get_data(const struct iio_device *dev)
Retrieve a previously associated pointer of an iio_device structure.
Definition: device.c:363
iio_channel_get_data
void * iio_channel_get_data(const struct iio_channel *chn)
Retrieve a previously associated pointer of an iio_channel structure.
Definition: channel.c:345
iio_device_get_buffer_attr
const char * iio_device_get_buffer_attr(const struct iio_device *dev, unsigned int index)
Get the buffer-specific attribute present at the given index.
Definition: device.c:216
iio_device_find_channel
struct iio_channel * iio_device_find_channel(const struct iio_device *dev, const char *name, bool output)
Try to find a channel structure by its name of ID.
Definition: device.c:157
iio_device_buffer_attr_write_all
int iio_device_buffer_attr_write_all(struct iio_device *dev, ssize_t(*cb)(struct iio_device *dev, const char *attr, void *buf, size_t len, void *d), void *data)
Set the values of all buffer-specific attributes.
Definition: device.c:1037
iio_channel_attr_read_longlong
int iio_channel_attr_read_longlong(const struct iio_channel *chn, const char *attr, long long *val)
Read the content of the given channel-specific attribute.
Definition: channel.c:604
iio_channel_set_data
void iio_channel_set_data(struct iio_channel *chn, void *data)
Associate a pointer to an iio_channel structure.
Definition: channel.c:340
iio_device_attr_read_double
int iio_device_attr_read_double(const struct iio_device *dev, const char *attr, double *val)
Read the content of the given device-specific attribute.
Definition: device.c:510
iio_create_local_context
struct iio_context * iio_create_local_context(void)
Create a context from local IIO devices (Linux only)
Definition: context.c:429
iio_device_get_context
const struct iio_context * iio_device_get_context(const struct iio_device *dev)
Retrieve a pointer to the iio_context structure.
Definition: device.c:1053
iio_channel_read
size_t iio_channel_read(const struct iio_channel *chn, struct iio_buffer *buf, void *dst, size_t len)
Demultiplex and convert the samples of a given channel.
Definition: channel.c:557
iio_data_format::shift
unsigned int shift
Right-shift to apply when converting sample.
Definition: iio.h:1568
iio_channel_attr_write_longlong
int iio_channel_attr_write_longlong(const struct iio_channel *chn, const char *attr, long long val)
Set the value of the given channel-specific attribute.
Definition: channel.c:644
iio_context_get_name
const char * iio_context_get_name(const struct iio_context *ctx)
Get the name of the given context.
Definition: context.c:245
iio_channel_get_attr
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:293
iio_buffer_set_data
void iio_buffer_set_data(struct iio_buffer *buf, void *data)
Associate a pointer to an iio_buffer structure.
Definition: buffer.c:298
iio_device_buffer_attr_read_all
__api __check_ret int iio_device_buffer_attr_read_all(struct iio_device *dev, int(*cb)(struct iio_device *dev, const char *attr, const char *value, size_t len, void *d), void *data)
Read the content of all buffer-specific attributes.
iio_channel_attr_write
ssize_t iio_channel_attr_write(const struct iio_channel *chn, const char *attr, const char *src)
Set the value of the given channel-specific attribute.
Definition: channel.c:334
iio_device_attr_read_bool
int iio_device_attr_read_bool(const struct iio_device *dev, const char *attr, bool *val)
Read the content of the given device-specific attribute.
Definition: device.c:498
iio_device_attr_write_double
int iio_device_attr_write_double(const struct iio_device *dev, const char *attr, double val)
Set the value of the given device-specific attribute.
Definition: device.c:533
iio_channel_enable
void iio_channel_enable(struct iio_channel *chn)
Enable the given channel.
Definition: channel.c:367
iio_channel_disable
void iio_channel_disable(struct iio_channel *chn)
Disable the given channel.
Definition: channel.c:373
iio_context_get_device
struct iio_device * iio_context_get_device(const struct iio_context *ctx, unsigned int index)
Get the device present at the given index.
Definition: context.c:285
iio_context_set_timeout
int iio_context_set_timeout(struct iio_context *ctx, unsigned int timeout)
Set a timeout for I/O operations.
Definition: context.c:376
iio_create_network_context
struct iio_context * iio_create_network_context(const char *hostname)
Create a context from the network.
Definition: context.c:438
iio_buffer_step
ptrdiff_t iio_buffer_step(const struct iio_buffer *buffer)
Get the step size between two samples of one channel.
Definition: buffer.c:288
iio_channel_attr_write_bool
int iio_channel_attr_write_bool(const struct iio_channel *chn, const char *attr, bool val)
Set the value of the given channel-specific attribute.
Definition: channel.c:666
iio_channel_get_type
enum iio_chan_type iio_channel_get_type(const struct iio_channel *chn)
Get the type of the given channel.
Definition: channel.c:283
iio_device_find_buffer_attr
const char * iio_device_find_buffer_attr(const struct iio_device *dev, const char *name)
Try to find a buffer-specific attribute by its name.
Definition: device.c:222
iio_buffer_refill
ssize_t iio_buffer_refill(struct iio_buffer *buffer)
Fetch more samples from the hardware.
Definition: buffer.c:123
iio_create_xml_context_mem
struct iio_context * iio_create_xml_context_mem(const char *xml, size_t len)
Create a context from XML data in memory.
Definition: context.c:447
iio_device_attr_read_all
__api __check_ret int iio_device_attr_read_all(struct iio_device *dev, int(*cb)(struct iio_device *dev, const char *attr, const char *value, size_t len, void *d), void *data)
Read the content of all device-specific attributes.
iio_device_identify_filename
int iio_device_identify_filename(const struct iio_device *dev, const char *filename, struct iio_channel **chn, const char **attr)
Identify the channel or debug attribute corresponding to a filename.
Definition: device.c:749
iio_device_attr_write_raw
ssize_t iio_device_attr_write_raw(const struct iio_device *dev, const char *attr, const void *src, size_t len)
Set the value of the given device-specific attribute.
Definition: device.c:316
iio_context_clone
struct iio_context * iio_context_clone(const struct iio_context *ctx)
Duplicate a pre-existing IIO context.
Definition: context.c:384
iio_device_buffer_attr_read_longlong
int iio_device_buffer_attr_read_longlong(const struct iio_device *dev, const char *attr, long long *val)
Read the content of the given buffer-specific attribute.
Definition: device.c:558
iio_context_get_devices_count
unsigned int iio_context_get_devices_count(const struct iio_context *ctx)
Enumerate the devices found in the given context.
Definition: context.c:280
iio_device_get_channel
struct iio_channel * iio_device_get_channel(const struct iio_device *dev, unsigned int index)
Get the channel present at the given index.
Definition: device.c:148
iio_device_reg_read
int iio_device_reg_read(struct iio_device *dev, uint32_t address, uint32_t *value)
Get the value of a hardware register.
Definition: device.c:801
iio_buffer
An input or output buffer, used to read or write samples.
iio_device_get_id
const char * iio_device_get_id(const struct iio_device *dev)
Retrieve the device ID (e.g. iio:device0)
Definition: device.c:128
iio_context_get_xml
const char * iio_context_get_xml(const struct iio_context *ctx)
Obtain a XML representation of the given context.
Definition: context.c:240
iio_channel_find_attr
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:302
iio_context_get_attr_value
const char * iio_context_get_attr_value(const struct iio_context *ctx, const char *name)
Retrieve the value of a context-specific attribute.
Definition: context.c:483
iio_data_format
Contains the format of a data sample.
Definition: iio.h:1560
iio_device_set_data
void iio_device_set_data(struct iio_device *dev, void *data)
Associate a pointer to an iio_device structure.
Definition: device.c:358
iio_device_debug_attr_write_double
int iio_device_debug_attr_write_double(const struct iio_device *dev, const char *attr, double val)
Set the value of the given debug attribute.
Definition: device.c:724
iio_device_get_trigger
int iio_device_get_trigger(const struct iio_device *dev, const struct iio_device **trigger)
Retrieve the trigger of a given device.
Definition: device.c:391
iio_buffer_get_poll_fd
int iio_buffer_get_poll_fd(struct iio_buffer *buffer)
Get a pollable file descriptor.
Definition: buffer.c:113
iio_device_get_label
const char * iio_device_get_label(const struct iio_device *dev)
Retrieve the device label (e.g. lo_pll0_rx_adf4351)
Definition: device.c:138
iio_channel_is_output
bool iio_channel_is_output(const struct iio_channel *chn)
Return True if the given channel is an output channel.
Definition: channel.c:268
iio_context_destroy
void iio_context_destroy(struct iio_context *ctx)
Destroy the given context.
Definition: context.c:258
iio_device_find_debug_attr
const char * iio_device_find_debug_attr(const struct iio_device *dev, const char *name)
Try to find a debug attribute by its name.
Definition: device.c:228
iio_device_get_attr
const char * iio_device_get_attr(const struct iio_device *dev, unsigned int index)
Get the device-specific attribute present at the given index.
Definition: device.c:199
iio_channel_get_id
const char * iio_channel_get_id(const struct iio_channel *chn)
Retrieve the channel ID (e.g. voltage0)
Definition: channel.c:258
iio_channel_attr_write_double
int iio_channel_attr_write_double(const struct iio_channel *chn, const char *attr, double val)
Set the value of the given channel-specific attribute.
Definition: channel.c:654
iio_buffer_set_blocking_mode
int iio_buffer_set_blocking_mode(struct iio_buffer *buffer, bool blocking)
Make iio_buffer_refill() and iio_buffer_push() blocking or not.
Definition: buffer.c:118
iio_device_buffer_attr_read_bool
int iio_device_buffer_attr_read_bool(const struct iio_device *dev, const char *attr, bool *val)
Read the content of the given buffer-specific attribute.
Definition: device.c:575
iio_device_debug_attr_read_all
__api __check_ret int iio_device_debug_attr_read_all(struct iio_device *dev, int(*cb)(struct iio_device *dev, const char *attr, const char *value, size_t len, void *d), void *data)
Read the content of all debug attributes.
iio_device_debug_attr_read_longlong
int iio_device_debug_attr_read_longlong(const struct iio_device *dev, const char *attr, long long *val)
Read the content of the given debug attribute.
Definition: device.c:672
iio_data_format::length
unsigned int length
Total length of the sample, in bits.
Definition: iio.h:1562
iio_buffer_destroy
void iio_buffer_destroy(struct iio_buffer *buffer)
Destroy the given buffer.
Definition: buffer.c:104
iio_buffer_cancel
void iio_buffer_cancel(struct iio_buffer *buf)
Cancel all buffer operations.
Definition: buffer.c:313
iio_device_buffer_attr_read_double
int iio_device_buffer_attr_read_double(const struct iio_device *dev, const char *attr, double *val)
Read the content of the given buffer-specific attribute.
Definition: device.c:587
iio_device_get_sample_size
ssize_t iio_device_get_sample_size(const struct iio_device *dev)
Get the current sample size.
Definition: device.c:476
iio_device_attr_read
ssize_t iio_device_attr_read(const struct iio_device *dev, const char *attr, char *dst, size_t len)
Read the content of the given device-specific attribute.
Definition: device.c:306
iio_channel_get_attrs_count
unsigned int iio_channel_get_attrs_count(const struct iio_channel *chn)
Enumerate the channel-specific attributes of the given channel.
Definition: channel.c:288
iio_channel_is_scan_element
bool iio_channel_is_scan_element(const struct iio_channel *chn)
Return True if the given channel is a scan element.
Definition: channel.c:273
iio_channel_write_raw
size_t iio_channel_write_raw(const struct iio_channel *chn, struct iio_buffer *buf, const void *src, size_t len)
Multiplex the samples of a given channel.
Definition: channel.c:573
iio_channel_attr_read
ssize_t iio_channel_attr_read(const struct iio_channel *chn, const char *attr, char *dst, size_t len)
Read the content of the given channel-specific attribute.
Definition: channel.c:314
iio_device_debug_attr_read_double
int iio_device_debug_attr_read_double(const struct iio_device *dev, const char *attr, double *val)
Read the content of the given debug attribute.
Definition: device.c:701
iio_channel_get_index
long iio_channel_get_index(const struct iio_channel *chn)
Get the index of the given channel.
Definition: channel.c:350
iio_context_get_attr
int iio_context_get_attr(const struct iio_context *ctx, unsigned int index, const char **name, const char **value)
Retrieve the name and value of a context-specific attribute.
Definition: context.c:470
iio_device_set_trigger
int iio_device_set_trigger(const struct iio_device *dev, const struct iio_device *trigger)
Associate a trigger to a given device.
Definition: device.c:402
iio_device_get_buffer_attrs_count
unsigned int iio_device_get_buffer_attrs_count(const struct iio_device *dev)
Enumerate the buffer-specific attributes of the given device.
Definition: device.c:211
iio_channel_attr_get_filename
const char * iio_channel_attr_get_filename(const struct iio_channel *chn, const char *attr)
Retrieve the filename of an attribute.
Definition: channel.c:677
iio_device_buffer_attr_write_raw
ssize_t iio_device_buffer_attr_write_raw(const struct iio_device *dev, const char *attr, const void *src, size_t len)
Set the value of the given buffer-specific attribute.
Definition: device.c:342
iio_channel_attr_read_all
int iio_channel_attr_read_all(struct iio_channel *chn, int(*cb)(struct iio_channel *chn, const char *attr, const char *val, size_t len, void *d), void *data)
Read the content of all channel-specific attributes.
Definition: channel.c:688
iio_channel_attr_write_all
int iio_channel_attr_write_all(struct iio_channel *chn, ssize_t(*cb)(struct iio_channel *chn, const char *attr, void *buf, size_t len, void *d), void *data)
Set the values of all channel-specific attributes.
Definition: channel.c:747
iio_context
Contains the representation of an IIO context.
iio_buffer_first
void * iio_buffer_first(const struct iio_buffer *buffer, const struct iio_channel *chn)
Find the first sample of a channel in a buffer.
Definition: buffer.c:250
iio_buffer_get_data
void * iio_buffer_get_data(const struct iio_buffer *buf)
Retrieve a previously associated pointer of an iio_buffer structure.
Definition: buffer.c:303
iio_device
Represents a device in the IIO context.
iio_channel_get_device
const struct iio_device * iio_channel_get_device(const struct iio_channel *chn)
Retrieve a pointer to the iio_device structure.
Definition: channel.c:790
iio_get_backend
const char * iio_get_backend(unsigned int index)
Retrieve the name of a given backend.
Definition: backend.c:27
iio_get_backends_count
unsigned int iio_get_backends_count(void)
Get the number of available backends.
Definition: backend.c:14
iio_context_get_description
const char * iio_context_get_description(const struct iio_context *ctx)
Get a description of the given context.
Definition: context.c:250
iio_modifier
iio_modifier
IIO channel modifier.
Definition: iio.h:140
iio_device_buffer_attr_write_double
int iio_device_buffer_attr_write_double(const struct iio_device *dev, const char *attr, double val)
Set the value of the given buffer-specific attribute.
Definition: device.c:610
iio_create_context_from_uri
struct iio_context * iio_create_context_from_uri(const char *uri)
Create a context from a URI description.
Definition: context.c:394
iio_buffer_start
void * iio_buffer_start(const struct iio_buffer *buffer)
Get the start address of the buffer.
Definition: buffer.c:245
iio_device_debug_attr_write_longlong
int iio_device_debug_attr_write_longlong(const struct iio_device *dev, const char *attr, long long val)
Set the value of the given debug attribute.
Definition: device.c:712
iio_device_attr_read_longlong
int iio_device_attr_read_longlong(const struct iio_device *dev, const char *attr, long long *val)
Read the content of the given device-specific attribute.
Definition: device.c:481
iio_channel_attr_read_bool
int iio_channel_attr_read_bool(const struct iio_channel *chn, const char *attr, bool *val)
Read the content of the given channel-specific attribute.
Definition: channel.c:621
iio_has_backend
bool iio_has_backend(const char *backend)
Check if the specified backend is available.
Definition: backend.c:62
iio_chan_type
iio_chan_type
IIO channel type.
Definition: iio.h:94
iio_device_buffer_attr_write
ssize_t iio_device_buffer_attr_write(const struct iio_device *dev, const char *attr, const char *src)
Set the value of the given buffer-specific attribute.
Definition: device.c:352
iio_channel_get_data_format
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:355
iio_device_get_debug_attrs_count
unsigned int iio_device_get_debug_attrs_count(const struct iio_device *dev)
Enumerate the debug attributes of the given device.
Definition: device.c:661
iio_context_find_device
struct iio_device * iio_context_find_device(const struct iio_context *ctx, const char *name)
Try to find a device structure by its ID, label or name.
Definition: context.c:294
iio_device_debug_attr_write_raw
ssize_t iio_device_debug_attr_write_raw(const struct iio_device *dev, const char *attr, const void *src, size_t len)
Set the value of the given debug attribute.
Definition: device.c:645
iio_device_debug_attr_read_bool
int iio_device_debug_attr_read_bool(const struct iio_device *dev, const char *attr, bool *val)
Read the content of the given debug attribute.
Definition: device.c:689
iio_device_attr_write_bool
int iio_device_attr_write_bool(const struct iio_device *dev, const char *attr, bool val)
Set the value of the given device-specific attribute.
Definition: device.c:545
iio_device_debug_attr_write_all
int iio_device_debug_attr_write_all(struct iio_device *dev, ssize_t(*cb)(struct iio_device *dev, const char *attr, void *buf, size_t len, void *d), void *data)
Set the values of all debug attributes.
Definition: device.c:1029
iio_context_get_version
int iio_context_get_version(const struct iio_context *ctx, unsigned int *major, unsigned int *minor, char git_tag[8])
Get the version of the backend in use.
Definition: context.c:355
iio_device_create_buffer
struct iio_buffer * iio_device_create_buffer(const struct iio_device *dev, size_t samples_count, bool cyclic)
Create an input or output buffer associated to the given device.
Definition: buffer.c:26
iio_device_set_kernel_buffers_count
int iio_device_set_kernel_buffers_count(const struct iio_device *dev, unsigned int nb_buffers)
Configure the number of kernel buffers for a device.
Definition: device.c:380
iio_device_get_attrs_count
unsigned int iio_device_get_attrs_count(const struct iio_device *dev)
Enumerate the device-specific attributes of the given device.
Definition: device.c:194
iio_device_buffer_attr_write_longlong
int iio_device_buffer_attr_write_longlong(const struct iio_device *dev, const char *attr, long long val)
Set the value of the given buffer-specific attribute.
Definition: device.c:598
iio_channel_get_modifier
enum iio_modifier iio_channel_get_modifier(const struct iio_channel *chn)
Get the modifier type of the given channel.
Definition: channel.c:278
iio_create_xml_context
struct iio_context * iio_create_xml_context(const char *xml_file)
Create a context from a XML file.
Definition: context.c:456
iio_channel_read_raw
size_t iio_channel_read_raw(const struct iio_channel *chn, struct iio_buffer *buf, void *dst, size_t len)
Demultiplex the samples of a given channel.
Definition: channel.c:542
iio_buffer_get_device
const struct iio_device * iio_buffer_get_device(const struct iio_buffer *buf)
Retrieve a pointer to the iio_device structure.
Definition: buffer.c:308
iio_library_get_version
__api void iio_library_get_version(unsigned int *major, unsigned int *minor, char git_tag[8])
Get the version of the libiio library.
Definition: utilities.c:186
iio_device_attr_write_all
int iio_device_attr_write_all(struct iio_device *dev, ssize_t(*cb)(struct iio_device *dev, const char *attr, void *buf, size_t len, void *d), void *data)
Set the values of all device-specific attributes.
Definition: device.c:1045
iio_device_find_attr
const char * iio_device_find_attr(const struct iio_device *dev, const char *name)
Try to find a device-specific attribute by its name.
Definition: device.c:205
iio_device_get_debug_attr
const char * iio_device_get_debug_attr(const struct iio_device *dev, unsigned int index)
Get the debug attribute present at the given index.
Definition: device.c:666
iio_device_is_trigger
bool iio_device_is_trigger(const struct iio_device *dev)
Return True if the given device is a trigger.
Definition: device.c:368
iio_channel_convert
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:481
iio_device_attr_write
ssize_t iio_device_attr_write(const struct iio_device *dev, const char *attr, const char *src)
Set the value of the given device-specific attribute.
Definition: device.c:326
iio_channel_attr_read_double
int iio_channel_attr_read_double(const struct iio_channel *chn, const char *attr, double *val)
Read the content of the given channel-specific attribute.
Definition: channel.c:633
iio_channel_get_name
const char * iio_channel_get_name(const struct iio_channel *chn)
Retrieve the channel name (e.g. vccint)
Definition: channel.c:263
iio_create_default_context
struct iio_context * iio_create_default_context(void)
Create a context from local or remote IIO devices.
Definition: context.c:415
iio_device_get_channels_count
unsigned int iio_device_get_channels_count(const struct iio_device *dev)
Enumerate the channels of the given device.
Definition: device.c:143
iio_channel_write
size_t iio_channel_write(const struct iio_channel *chn, struct iio_buffer *buf, const void *src, size_t len)
Convert and multiplex the samples of a given channel.
Definition: channel.c:588