summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Cameron <jic23@cam.ac.uk>2011-02-11 13:09:13 +0000
committerGreg Kroah-Hartman <gregkh@suse.de>2011-02-18 13:22:52 -0800
commit96df9799a4dd62aab7566165d887ea40b1c8aa00 (patch)
tree65870816c751b966d9d33e808e1769c9ffd56e00
parent30268a3da9325a2267cfc99efae7c192fa88199f (diff)
downloadtalos-op-linux-96df9799a4dd62aab7566165d887ea40b1c8aa00.tar.gz
talos-op-linux-96df9799a4dd62aab7566165d887ea40b1c8aa00.zip
staging:iio: buffer example - add lots more runtime parameters
Add ability to control delay for event free buffers Add ability to control length of buffer Add ability to control how many read cycles occur Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk> Tested-by: Michael Hennerich <michael.hennerich@analog.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/staging/iio/Documentation/generic_buffer.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/drivers/staging/iio/Documentation/generic_buffer.c b/drivers/staging/iio/Documentation/generic_buffer.c
index 0befcb89ea3a..771b23627797 100644
--- a/drivers/staging/iio/Documentation/generic_buffer.c
+++ b/drivers/staging/iio/Documentation/generic_buffer.c
@@ -29,9 +29,6 @@
#include <string.h>
#include "iio_utils.h"
-const int buf_len = 128;
-const int num_loops = 2;
-
/**
* size_from_channelarray() - calculate the storage size of a scan
* @channels: the channel info array
@@ -119,6 +116,11 @@ void process_scan(char *data,
int main(int argc, char **argv)
{
+ unsigned long num_loops = 2;
+ unsigned long timedelay = 1000000;
+ unsigned long buf_len = 128;
+
+
int ret, c, i, j, toread;
FILE *fp_ev;
@@ -136,10 +138,11 @@ int main(int argc, char **argv)
char *buffer_access, *buffer_event;
int scan_size;
int noevents = 0;
+ char *dummy;
struct iio_channel_info *infoarray;
- while ((c = getopt(argc, argv, "et:n:")) != -1) {
+ while ((c = getopt(argc, argv, "l:w:c:et:n:")) != -1) {
switch (c) {
case 'n':
device_name = optarg;
@@ -151,6 +154,15 @@ int main(int argc, char **argv)
case 'e':
noevents = 1;
break;
+ case 'c':
+ num_loops = strtoul(optarg, &dummy, 10);
+ break;
+ case 'w':
+ timedelay = strtoul(optarg, &dummy, 10);
+ break;
+ case 'l':
+ buf_len = strtoul(optarg, &dummy, 10);
+ break;
case '?':
return -1;
}
@@ -285,7 +297,7 @@ int main(int argc, char **argv)
continue;
}
} else {
- usleep(1000);
+ usleep(timedelay);
toread = 64;
}
OpenPOWER on IntegriCloud