Commit 1b545af6 authored by Alessandro Rubini's avatar Alessandro Rubini

kernel and tools: TYPE_TIME channels have 0 sample size

This was not possible with the older zio, but now we have support
for that.
Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent c2ed4982
...@@ -628,7 +628,7 @@ static struct zio_cset fd_cset[] = { ...@@ -628,7 +628,7 @@ static struct zio_cset fd_cset[] = {
ZIO_SET_OBJ_NAME("fd-input"), ZIO_SET_OBJ_NAME("fd-input"),
.raw_io = fd_zio_input, .raw_io = fd_zio_input,
.n_chan = 1, .n_chan = 1,
.ssize = 4, /* FIXME: 0? */ .ssize = 0,
.flags = ZIO_DIR_INPUT | ZIO_CSET_TYPE_TIME, .flags = ZIO_DIR_INPUT | ZIO_CSET_TYPE_TIME,
.zattr_set = { .zattr_set = {
.ext_zattr = fd_zattr_input, .ext_zattr = fd_zattr_input,
...@@ -639,7 +639,7 @@ static struct zio_cset fd_cset[] = { ...@@ -639,7 +639,7 @@ static struct zio_cset fd_cset[] = {
ZIO_SET_OBJ_NAME("fd-ch1"), ZIO_SET_OBJ_NAME("fd-ch1"),
.raw_io = fd_zio_output, .raw_io = fd_zio_output,
.n_chan = 1, .n_chan = 1,
.ssize = 4, /* FIXME: 0? */ .ssize = 0,
.flags = ZIO_DIR_OUTPUT | ZIO_CSET_TYPE_TIME, .flags = ZIO_DIR_OUTPUT | ZIO_CSET_TYPE_TIME,
.zattr_set = { .zattr_set = {
.ext_zattr = fd_zattr_output, .ext_zattr = fd_zattr_output,
...@@ -650,7 +650,7 @@ static struct zio_cset fd_cset[] = { ...@@ -650,7 +650,7 @@ static struct zio_cset fd_cset[] = {
ZIO_SET_OBJ_NAME("fd-ch2"), ZIO_SET_OBJ_NAME("fd-ch2"),
.raw_io = fd_zio_output, .raw_io = fd_zio_output,
.n_chan = 1, .n_chan = 1,
.ssize = 4, /* FIXME: 0? */ .ssize = 0,
.flags = ZIO_DIR_OUTPUT | ZIO_CSET_TYPE_TIME, .flags = ZIO_DIR_OUTPUT | ZIO_CSET_TYPE_TIME,
.zattr_set = { .zattr_set = {
.ext_zattr = fd_zattr_output, .ext_zattr = fd_zattr_output,
...@@ -661,7 +661,7 @@ static struct zio_cset fd_cset[] = { ...@@ -661,7 +661,7 @@ static struct zio_cset fd_cset[] = {
ZIO_SET_OBJ_NAME("fd-ch3"), ZIO_SET_OBJ_NAME("fd-ch3"),
.raw_io = fd_zio_output, .raw_io = fd_zio_output,
.n_chan = 1, .n_chan = 1,
.ssize = 4, /* FIXME: 0? */ .ssize = 0,
.flags = ZIO_DIR_OUTPUT | ZIO_CSET_TYPE_TIME, .flags = ZIO_DIR_OUTPUT | ZIO_CSET_TYPE_TIME,
.zattr_set = { .zattr_set = {
.ext_zattr = fd_zattr_output, .ext_zattr = fd_zattr_output,
...@@ -672,7 +672,7 @@ static struct zio_cset fd_cset[] = { ...@@ -672,7 +672,7 @@ static struct zio_cset fd_cset[] = {
ZIO_SET_OBJ_NAME("fd-ch4"), ZIO_SET_OBJ_NAME("fd-ch4"),
.raw_io = fd_zio_output, .raw_io = fd_zio_output,
.n_chan = 1, .n_chan = 1,
.ssize = 4, /* FIXME: 0? */ .ssize = 0,
.flags = ZIO_DIR_OUTPUT | ZIO_CSET_TYPE_TIME, .flags = ZIO_DIR_OUTPUT | ZIO_CSET_TYPE_TIME,
.zattr_set = { .zattr_set = {
.ext_zattr = fd_zattr_output, .ext_zattr = fd_zattr_output,
......
...@@ -73,7 +73,6 @@ int fdelay_init(void) ...@@ -73,7 +73,6 @@ int fdelay_init(void)
sscanf(b->sysbase, "%*[^f]fd-%x", &b->dev_id); sscanf(b->sysbase, "%*[^f]fd-%x", &b->dev_id);
for (j = 0; j < ARRAY_SIZE(b->fdc); j++) { for (j = 0; j < ARRAY_SIZE(b->fdc); j++) {
b->fdc[j] = -1; b->fdc[j] = -1;
b->fdd[j] = -1;
} }
if (fdelay_is_verbose()) { if (fdelay_is_verbose()) {
fprintf(stderr, "%s: %04x %s %s\n", __func__, fprintf(stderr, "%s: %04x %s %s\n", __func__,
...@@ -111,11 +110,6 @@ void fdelay_exit(void) ...@@ -111,11 +110,6 @@ void fdelay_exit(void)
b->fdc[j] = -1; b->fdc[j] = -1;
err++; err++;
} }
if (b->fdd[j] >= 0) {
close(b->fdd[j]);
b->fdd[j] = -1;
err++;
}
} }
if (err) if (err)
fprintf(stderr, "%s: device %s was still open\n", fprintf(stderr, "%s: device %s was still open\n",
...@@ -162,16 +156,10 @@ struct fdelay_board *fdelay_open(int offset, int dev_id) ...@@ -162,16 +156,10 @@ struct fdelay_board *fdelay_open(int offset, int dev_id)
return NULL; return NULL;
found: found:
/* Check and set all block sizes to 1 sample (i.e. 4 bytes) */ /*
for (np = channels; *np; np++) { * We used to force post-samples to 1 here, but now
sprintf(name, "%s/trigger/post-samples", *np); * sample-size is zero and post-samples is not used
fdelay_sysfs_get(b, name, &nsamples); */
if (nsamples == 1)
continue;
nsamples = 1;
fdelay_sysfs_set(b, name, &nsamples);
}
return (void *)b; return (void *)b;
} }
...@@ -206,9 +194,6 @@ int fdelay_close(struct fdelay_board *userb) ...@@ -206,9 +194,6 @@ int fdelay_close(struct fdelay_board *userb)
if (b->fdc[j] >= 0) if (b->fdc[j] >= 0)
close(b->fdc[j]); close(b->fdc[j]);
b->fdc[j] = -1; b->fdc[j] = -1;
if (b->fdd[j] >= 0)
close(b->fdd[j]);
b->fdd[j] = -1;
} }
return 0; return 0;
......
...@@ -103,7 +103,6 @@ struct __fdelay_board { ...@@ -103,7 +103,6 @@ struct __fdelay_board {
char *devbase; char *devbase;
char *sysbase; char *sysbase;
int fdc[5]; /* The 5 control channels */ int fdc[5]; /* The 5 control channels */
int fdd[5]; /* The 5 data channels */
}; };
static inline int fdelay_is_verbose(void) static inline int fdelay_is_verbose(void)
......
...@@ -46,7 +46,7 @@ void fdelay_time_to_pico(struct fdelay_time *time, uint64_t *pico) ...@@ -46,7 +46,7 @@ void fdelay_time_to_pico(struct fdelay_time *time, uint64_t *pico)
} }
static int __fdelay_get_ch_fd(struct __fdelay_board *b, static int __fdelay_get_ch_fd(struct __fdelay_board *b,
int channel, int *fdc, int *fdd) int channel, int *fdc)
{ {
int ch14 = channel + 1; int ch14 = channel + 1;
char fname[128]; char fname[128];
...@@ -61,14 +61,7 @@ static int __fdelay_get_ch_fd(struct __fdelay_board *b, ...@@ -61,14 +61,7 @@ static int __fdelay_get_ch_fd(struct __fdelay_board *b,
if (b->fdc[ch14] < 0) if (b->fdc[ch14] < 0)
return -1; return -1;
} }
if (b->fdd[ch14] <= 0) {
sprintf(fname, "%s-%i-0-data", b->devbase, ch14);
b->fdd[ch14] = open(fname, O_WRONLY | O_NONBLOCK);
if (b->fdd[ch14] < 0)
return -1;
}
*fdc = b->fdc[ch14]; *fdc = b->fdc[ch14];
*fdd = b->fdd[ch14];
return 0; return 0;
} }
...@@ -78,9 +71,9 @@ int fdelay_config_pulse(struct fdelay_board *userb, ...@@ -78,9 +71,9 @@ int fdelay_config_pulse(struct fdelay_board *userb,
__define_board(b, userb); __define_board(b, userb);
struct zio_control ctrl = {0,}; struct zio_control ctrl = {0,};
uint32_t *a; uint32_t *a;
int fdc, fdd; int fdc;
if (__fdelay_get_ch_fd(b, channel, &fdc, &fdd) < 0) if (__fdelay_get_ch_fd(b, channel, &fdc) < 0)
return -1; /* errno already set */ return -1; /* errno already set */
a = ctrl.attr_channel.ext_val; a = ctrl.attr_channel.ext_val;
...@@ -108,7 +101,6 @@ int fdelay_config_pulse(struct fdelay_board *userb, ...@@ -108,7 +101,6 @@ int fdelay_config_pulse(struct fdelay_board *userb,
ctrl.nbits = 32; ctrl.nbits = 32;
write(fdc, &ctrl, sizeof(ctrl)); write(fdc, &ctrl, sizeof(ctrl));
write(fdd, "1234", 4); /* we need to write data to push it out */
return 0; return 0;
} }
......
...@@ -30,7 +30,7 @@ int main(int argc, char **argv) ...@@ -30,7 +30,7 @@ int main(int argc, char **argv)
{ {
glob_t glob_buf; glob_t glob_buf;
struct zio_control ctrl; struct zio_control ctrl;
int fdc, fdd; int fdc;
char *s; char *s;
int i, j, val, ch; int i, j, val, ch;
uint32_t *attrs; uint32_t *attrs;
...@@ -59,13 +59,6 @@ int main(int argc, char **argv) ...@@ -59,13 +59,6 @@ int main(int argc, char **argv)
fprintf(stderr, "%s: %s: %s\n", argv[0], s, strerror(errno)); fprintf(stderr, "%s: %s: %s\n", argv[0], s, strerror(errno));
exit(1); exit(1);
} }
/* Open the data file too, lazily */
strcpy(s + strlen(s) - 4, "data");
fdd = open(s, O_WRONLY);
if (fdd < 0) {
fprintf(stderr, "%s: %s: %s\n", argv[0], s, strerror(errno));
exit(1);
}
memset(&ctrl, 0, sizeof(ctrl)); memset(&ctrl, 0, sizeof(ctrl));
attrs = ctrl.attr_channel.ext_val; attrs = ctrl.attr_channel.ext_val;
...@@ -88,6 +81,5 @@ int main(int argc, char **argv) ...@@ -88,6 +81,5 @@ int main(int argc, char **argv)
ctrl.nbits = 32; ctrl.nbits = 32;
write(fdc, &ctrl, sizeof(ctrl)); write(fdc, &ctrl, sizeof(ctrl));
write(fdd, "1234", 4); /* we need to write data to push it out */
exit(0); exit(0);
} }
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