Lines Matching full:channels
48 * @channels: the channel info array
49 * @num_channels: number of channels
51 * Has the side effect of filling the channels[i].location values used
54 static int size_from_channelarray(struct iio_channel_info *channels, int num_channels) in size_from_channelarray() argument
60 if (bytes % channels[i].bytes == 0) in size_from_channelarray()
61 channels[i].location = bytes; in size_from_channelarray()
63 channels[i].location = bytes - bytes % channels[i].bytes in size_from_channelarray()
64 + channels[i].bytes; in size_from_channelarray()
66 bytes = channels[i].location + channels[i].bytes; in size_from_channelarray()
167 * @channels: information about the channels.
170 * @num_channels: number of channels
172 static void process_scan(char *data, struct iio_channel_info *channels, in process_scan() argument
178 switch (channels[k].bytes) { in process_scan()
181 print1byte(*(uint8_t *)(data + channels[k].location), in process_scan()
182 &channels[k]); in process_scan()
185 print2byte(*(uint16_t *)(data + channels[k].location), in process_scan()
186 &channels[k]); in process_scan()
189 print4byte(*(uint32_t *)(data + channels[k].location), in process_scan()
190 &channels[k]); in process_scan()
193 print8byte(*(uint64_t *)(data + channels[k].location), in process_scan()
194 &channels[k]); in process_scan()
215 fprintf(stderr, "Enabling/disabling channels: can't open %s\n", in enable_disable_all_channels()
235 perror("Enabling/disabling channels: " in enable_disable_all_channels()
246 " -a Auto-activate all available channels\n" in print_usage()
247 " -A Force-activate ALL channels\n" in print_usage()
291 /* Disable channels if auto-enabled */ in cleanup()
295 fprintf(stderr, "Failed to disable all channels\n"); in cleanup()
357 struct iio_channel_info *channels = NULL; in main() local
537 * Parse the files in scan_elements to identify what channels are in main()
540 ret = build_channel_array(dev_dir_name, buffer_idx, &channels, &num_channels); in main()
548 fprintf(stderr, "Auto-channels selected but some channels " in main()
550 fprintf(stderr, "Proceeding without activating any channels\n"); in main()
555 fprintf(stderr, "Enabling all channels\n"); in main()
559 fprintf(stderr, "Failed to enable all channels\n"); in main()
563 /* This flags that we need to disable the channels again */ in main()
566 ret = build_channel_array(dev_dir_name, buffer_idx, &channels, in main()
575 fprintf(stderr, "Still no channels after " in main()
583 "No channels are enabled, we have nothing to scan.\n"); in main()
584 fprintf(stderr, "Enable channels manually in " in main()
586 "/*_en or pass -a to autoenable channels and " in main()
676 scan_size = size_from_channelarray(channels, num_channels); in main()
734 process_scan(data + scan_size * i, channels, in main()
749 free(channels[i].name); in main()
750 free(channels[i].generic_name); in main()
752 free(channels); in main()