in CodeSnippets/Peripherals/ADC/AdvancedFunctions/advanced_functions.c [248:274]
static int SetExtInfo(int adcControllerFd, ADC_ChannelId channelId,
unsigned int extendedPropertyIndex, const char *data, size_t length)
{
if (extendedPropertyIndex < 0) {
Log_Debug("ERROR: SetExtInfo: Invalid extended property index.\n");
return -1;
}
struct iio_ioctl_write_chan_ext_info writeExtendedChannelInfo = {
.size = sizeof(writeExtendedChannelInfo),
.channel_index = channelId,
.info_index = extendedPropertyIndex,
.buffer = data,
.length = length};
int ret =
ioctl(adcControllerFd, (int)IIO_WRITE_CHANNEL_EXT_INFO_IOCTL, &writeExtendedChannelInfo);
if (ret < 0) {
Log_Debug(
"ERROR: ioctl call failed with error \"%s (%d)\" for request "
"IIO_WRITE_CHANNEL_EXT_INFO_IOCTL.\n",
strerror(errno), errno);
return -1;
}
return 0;
}