Commit 00295132 authored by Alessandro Rubini's avatar Alessandro Rubini

lib: fdelay_open: don't set post-samples if not needed

Changing critical trigger parameters forces an abort of pending
blocks.  This means that a running reader will loos its own active
block when lib/fdelay-pulse is called (the incoming samples are not
lost, but the reader must be restarted).

The previous code would work with the new self-timed feature in recent
zio master, but by now this patch allows remaining at zio-1.0 -- in
the "fixes" branch.
Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent 4fb0f523
...@@ -131,8 +131,13 @@ void fdelay_exit(void) ...@@ -131,8 +131,13 @@ void fdelay_exit(void)
struct fdelay_board *fdelay_open(int offset, int dev_id) struct fdelay_board *fdelay_open(int offset, int dev_id)
{ {
struct __fdelay_board *b = NULL; struct __fdelay_board *b = NULL;
uint32_t nsamples = 1; uint32_t nsamples;
int i; int i;
char name[64], **np, *channels[] = {
"fd-input",
"fd-ch1", "fd-ch2", "fd-ch3", "fd-ch4",
NULL
};
if (offset >= fd_nboards) { if (offset >= fd_nboards) {
errno = ENODEV; errno = ENODEV;
...@@ -157,12 +162,15 @@ struct fdelay_board *fdelay_open(int offset, int dev_id) ...@@ -157,12 +162,15 @@ struct fdelay_board *fdelay_open(int offset, int dev_id)
return NULL; return NULL;
found: found:
/* Trim all block sizes to 1 sample (i.e. 4 bytes) */ /* Check and set all block sizes to 1 sample (i.e. 4 bytes) */
fdelay_sysfs_set(b, "fd-input/trigger/post-samples", &nsamples); for (np = channels; *np; np++) {
fdelay_sysfs_set(b, "fd-ch1/trigger/post-samples", &nsamples); sprintf(name, "%s/trigger/post-samples", *np);
fdelay_sysfs_set(b, "fd-ch2/trigger/post-samples", &nsamples); fdelay_sysfs_get(b, name, &nsamples);
fdelay_sysfs_set(b, "fd-ch3/trigger/post-samples", &nsamples); if (nsamples == 1)
fdelay_sysfs_set(b, "fd-ch4/trigger/post-samples", &nsamples); continue;
nsamples = 1;
fdelay_sysfs_set(b, name, &nsamples);
}
return (void *)b; return (void *)b;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment