IIO ring buffer

From: Barry Song
Date: Mon Feb 22 2010 - 04:04:08 EST


Hi Jonathan,
Now users depend on iio ring
events(IIO_EVENT_CODE_RING_50/75/100_FULL) to read data:
read_size = fread(&dat, 1, sizeof(struct iio_event_data),
fp_ev);
switch (dat.id) {
case IIO_EVENT_CODE_RING_100_FULL:
toread = RingLength;
break;
case IIO_EVENT_CODE_RING_75_FULL:
toread = RingLength*3/4;
break;
case IIO_EVENT_CODE_RING_50_FULL:
toread = RingLength/2;
break;
default:
printf("Unexpecteded event code\n");
continue;
}
read_size = read(fp,
data,
toread*size_from_scanmode(NumVals, scan_ts));
if (read_size == -EAGAIN) {
printf("nothing available \n");
continue;
}
And iio ring access node doesn't support blocking io too. It seems we
lost to let users read data once ring is not empty. And some users
maybe not care about iio ring events at all, but just want to read
data like a input or audio driver. So how about adding the following
support in iio ring:
1. add NOT EMPTY event in IIO event nodes
2. add blocking io support in read function of IIO access nodes
If you agree with that, I can begin to add these and send you a patch.
And a problem I don't know is what you and other people have changed
to Greg's staging tree, and I am not sure what tree the patch should
be againest.

For long term plan, is it possible for ring common level to handle
more common work to avoid code repeating in different drivers?

Thanks
Barry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/