Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 236040
b: refs/heads/master
c: 30268a3
h: refs/heads/master
v: v3
  • Loading branch information
Jonathan Cameron authored and Greg Kroah-Hartman committed Feb 18, 2011
1 parent 95cb10f commit aecdd7e
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 17 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b949793b2c319b9ea3c2594aab203664caf2923e
refs/heads/master: 30268a3da9325a2267cfc99efae7c192fa88199f
45 changes: 29 additions & 16 deletions trunk/drivers/staging/iio/Documentation/generic_buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include <sys/stat.h>
#include <sys/dir.h>
#include <linux/types.h>
#include <string.h>
#include "iio_utils.h"

const int buf_len = 128;
Expand Down Expand Up @@ -134,10 +135,11 @@ int main(int argc, char **argv)
int dev_num, trig_num;
char *buffer_access, *buffer_event;
int scan_size;
int noevents = 0;

struct iio_channel_info *infoarray;

while ((c = getopt(argc, argv, "t:n:")) != -1) {
while ((c = getopt(argc, argv, "et:n:")) != -1) {
switch (c) {
case 'n':
device_name = optarg;
Expand All @@ -146,6 +148,9 @@ int main(int argc, char **argv)
trigger_name = optarg;
datardytrigger = 0;
break;
case 'e':
noevents = 1;
break;
case '?':
return -1;
}
Expand Down Expand Up @@ -260,22 +265,30 @@ int main(int argc, char **argv)

/* Wait for events 10 times */
for (j = 0; j < num_loops; j++) {
read_size = fread(&dat, 1, sizeof(struct iio_event_data),
fp_ev);
switch (dat.id) {
case IIO_EVENT_CODE_RING_100_FULL:
toread = buf_len;
break;
case IIO_EVENT_CODE_RING_75_FULL:
toread = buf_len*3/4;
break;
case IIO_EVENT_CODE_RING_50_FULL:
toread = buf_len/2;
break;
default:
printf("Unexpecteded event code\n");
continue;
if (!noevents) {
read_size = fread(&dat,
1,
sizeof(struct iio_event_data),
fp_ev);
switch (dat.id) {
case IIO_EVENT_CODE_RING_100_FULL:
toread = buf_len;
break;
case IIO_EVENT_CODE_RING_75_FULL:
toread = buf_len*3/4;
break;
case IIO_EVENT_CODE_RING_50_FULL:
toread = buf_len/2;
break;
default:
printf("Unexpecteded event code\n");
continue;
}
} else {
usleep(1000);
toread = 64;
}

read_size = read(fp,
data,
toread*scan_size);
Expand Down

0 comments on commit aecdd7e

Please sign in to comment.