Title: [9672] trunk/drivers/staging/iio/Documentation/generic_buffer.c: merge from upstream: staging:iio: buffer example - add lots more runtime parameters
Revision
9672
Author
vapier
Date
2011-03-01 16:17:39 -0500 (Tue, 01 Mar 2011)

Log Message

merge from upstream: staging:iio: buffer example - add lots more runtime parameters

From: Jonathan Cameron <[email protected]>

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 <[email protected]>
Tested-by: Michael Hennerich <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

Modified Paths

Diff

Modified: trunk/drivers/staging/iio/Documentation/generic_buffer.c (9671 => 9672)


--- trunk/drivers/staging/iio/Documentation/generic_buffer.c	2011-03-01 21:17:35 UTC (rev 9671)
+++ trunk/drivers/staging/iio/Documentation/generic_buffer.c	2011-03-01 21:17:39 UTC (rev 9672)
@@ -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 @@
 
 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 @@
 	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 @@
 		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 @@
 				continue;
 			}
 		} else {
-			usleep(1000);
+			usleep(timedelay);
 			toread = 64;
 		}
 
_______________________________________________
Linux-kernel-commits mailing list
[email protected]
https://blackfin.uclinux.org/mailman/listinfo/linux-kernel-commits

Reply via email to