Lines Matching +full:input +full:- +full:disable

1 // SPDX-License-Identifier: GPL-2.0-only
12 * generic_buffer -n <device_name> -t <trigger_name>
38 * enum autochan - state for the automatic channel enabling mechanism
47 * size_from_channelarray() - calculate the storage size of a scan
63 channels[i].location = bytes - bytes % channels[i].bytes in size_from_channelarray()
73 static void print1byte(uint8_t input, struct iio_channel_info *info) in print1byte() argument
79 input >>= info->shift; in print1byte()
80 input &= info->mask; in print1byte()
81 if (info->is_signed) { in print1byte()
82 int8_t val = (int8_t)(input << (8 - info->bits_used)) >> in print1byte()
83 (8 - info->bits_used); in print1byte()
84 printf("%05f ", ((float)val + info->offset) * info->scale); in print1byte()
86 printf("%05f ", ((float)input + info->offset) * info->scale); in print1byte()
90 static void print2byte(uint16_t input, struct iio_channel_info *info) in print2byte() argument
93 if (info->be) in print2byte()
94 input = be16toh(input); in print2byte()
96 input = le16toh(input); in print2byte()
102 input >>= info->shift; in print2byte()
103 input &= info->mask; in print2byte()
104 if (info->is_signed) { in print2byte()
105 int16_t val = (int16_t)(input << (16 - info->bits_used)) >> in print2byte()
106 (16 - info->bits_used); in print2byte()
107 printf("%05f ", ((float)val + info->offset) * info->scale); in print2byte()
109 printf("%05f ", ((float)input + info->offset) * info->scale); in print2byte()
113 static void print4byte(uint32_t input, struct iio_channel_info *info) in print4byte() argument
116 if (info->be) in print4byte()
117 input = be32toh(input); in print4byte()
119 input = le32toh(input); in print4byte()
125 input >>= info->shift; in print4byte()
126 input &= info->mask; in print4byte()
127 if (info->is_signed) { in print4byte()
128 int32_t val = (int32_t)(input << (32 - info->bits_used)) >> in print4byte()
129 (32 - info->bits_used); in print4byte()
130 printf("%05f ", ((float)val + info->offset) * info->scale); in print4byte()
132 printf("%05f ", ((float)input + info->offset) * info->scale); in print4byte()
136 static void print8byte(uint64_t input, struct iio_channel_info *info) in print8byte() argument
139 if (info->be) in print8byte()
140 input = be64toh(input); in print8byte()
142 input = le64toh(input); in print8byte()
148 input >>= info->shift; in print8byte()
149 input &= info->mask; in print8byte()
150 if (info->is_signed) { in print8byte()
151 int64_t val = (int64_t)(input << (64 - info->bits_used)) >> in print8byte()
152 (64 - info->bits_used); in print8byte()
154 if (info->scale == 1.0f && info->offset == 0.0f) in print8byte()
158 ((float)val + info->offset) * info->scale); in print8byte()
160 printf("%05f ", ((float)input + info->offset) * info->scale); in print8byte()
165 * process_scan() - print out the values in SI units
211 scanelemdir[sizeof(scanelemdir)-1] = '\0'; in enable_disable_all_channels()
217 return -EIO; in enable_disable_all_channels()
220 ret = -ENOENT; in enable_disable_all_channels()
222 if (iioutils_check_suffix(ent->d_name, "_en")) { in enable_disable_all_channels()
225 ent->d_name); in enable_disable_all_channels()
226 ret = write_sysfs_int(ent->d_name, scanelemdir, in enable_disable_all_channels()
229 fprintf(stderr, "Failed to enable/disable %s\n", in enable_disable_all_channels()
230 ent->d_name); in enable_disable_all_channels()
234 if (closedir(dp) == -1) { in enable_disable_all_channels()
237 return -errno; 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()
248 " -b <n> The buffer which to open (by index), default 0\n" in print_usage()
249 " -c <n> Do n conversions, or loop forever if n < 0\n" in print_usage()
250 " -e Disable wait for event (new data)\n" in print_usage()
251 " -g Use trigger-less mode\n" in print_usage()
252 " -l <n> Set buffer length to n samples\n" in print_usage()
253 " --device-name -n <name>\n" in print_usage()
254 " --device-num -N <num>\n" in print_usage()
256 " --trigger-name -t <name>\n" in print_usage()
257 " --trigger-num -T <num>\n" in print_usage()
259 " -w <n> Set delay between reads in us (event-less mode)\n"); in print_usage()
272 /* Disable trigger */ in cleanup()
274 /* Disconnect the trigger - just write a dummy name. */ in cleanup()
278 fprintf(stderr, "Failed to disable trigger: %s\n", in cleanup()
279 strerror(-ret)); in cleanup()
283 /* Disable buffer */ in cleanup()
287 fprintf(stderr, "Failed to disable buffer: %s\n", in cleanup()
288 strerror(-ret)); in cleanup()
291 /* Disable channels if auto-enabled */ in cleanup()
295 fprintf(stderr, "Failed to disable all channels\n"); in cleanup()
304 exit(-signum); in sig_handler()
317 exit(-1); in register_cleanup()
323 { "device-name", 1, 0, 'n' },
324 { "device-num", 1, 0, 'N' },
325 { "trigger-name", 1, 0, 't' },
326 { "trigger-num", 1, 0, 'T' },
341 int fd = -1; in main()
342 int buf_fd = -1; in main()
349 int dev_num = -1, trig_num = -1; in main()
362 NULL)) != -1) { in main()
375 ret = -errno; in main()
379 ret = -ERANGE; in main()
388 ret = -errno; in main()
403 ret = -errno; in main()
415 ret = -errno; in main()
426 return -errno; in main()
432 ret = -errno; in main()
438 ret = -1; in main()
447 ret = -1; in main()
450 fprintf(stderr, "Only one of --device-num or --device-name needs to be set\n"); in main()
452 ret = -1; in main()
466 return -ENOMEM; in main()
471 ret = -ENOMEM; in main()
482 printf("trigger-less mode selected\n"); in main()
487 return -ENOMEM; in main()
505 "%s-dev%d", device_name, dev_num); in main()
507 ret = -ENOMEM; in main()
512 /* Look for this "-devN" trigger */ in main()
515 /* OK try the simpler "-trigger" suffix instead */ in main()
518 "%s-trigger", device_name); in main()
520 ret = -ENOMEM; in main()
548 fprintf(stderr, "Auto-channels selected but some channels " in main()
563 /* This flags that we need to disable the channels again */ in main()
576 "auto-enabling, giving up\n"); in main()
586 "/*_en or pass -a to autoenable channels and " in main()
588 ret = -ENOENT; in main()
600 ret = -ENOMEM; in main()
607 ret = -errno; in main()
613 ret = -EFAULT; in main()
635 ret = -ENOMEM; in main()
641 if (fd == -1) { /* TODO: If it isn't there make the node */ in main()
642 ret = -errno; in main()
651 if (ret == -1 || buf_fd == -1) { in main()
652 ret = -errno; in main()
653 if (ret == -ENODEV || ret == -EINVAL) in main()
672 buf_dir_name, strerror(-ret)); in main()
679 ret = -ENOMEM; in main()
691 if (read_size > -1 || errno != EBUSY) { in main()
692 ret = -EFAULT; in main()
699 if (close(fd) == -1) in main()
701 fd = -1; in main()
710 ret = poll(&pfd, 1, -1); in main()
712 ret = -errno; in main()
741 if (fd >= 0 && close(fd) == -1) in main()
743 if (buf_fd >= 0 && close(buf_fd) == -1) in main()
748 for (i = num_channels - 1; i >= 0; i--) { in main()