Commit 9f5a9acd authored by Federico Vaga's avatar Federico Vaga

lib: remove zio generic operations for acquisition start and stop

ZIO does not support start and stop, so it wrong to provide a common
ZIO feature about this.

Moreover, its usage in the FMC-ADC100M14B4CH device is buggy because
it forces a flush while the acquisition is running; instead, we want
to flush *before* starting the acquisition.
Signed-off-by: Federico Vaga's avatarFederico Vaga <federico.vaga@cern.ch>
parent 3fcbbe75
......@@ -143,16 +143,10 @@ struct adc_dev *adc_zio_open(const struct adc_board_type *b,
int adc_zio_close(struct adc_dev *dev);
int adc_zio_acq_start(struct adc_dev *dev,
unsigned int flags,
struct timeval *timeout);
int adc_zio_acq_poll(struct adc_dev *dev,
unsigned int flags,
struct timeval *timeout);
int adc_zio_acq_stop(struct adc_dev *dev, unsigned int flags);
int adc_zio_acq_flush(struct adc_dev *dev, unsigned int flags);
struct adc_buffer *adc_zio_request_buffer(struct adc_dev *dev,
......
......@@ -167,26 +167,6 @@ int adc_zio_acq_poll(struct adc_dev *dev,
return 0;
}
int adc_zio_acq_start(struct adc_dev *dev,
unsigned int flags, struct timeval *timeout)
{
if (flags & ADC_F_FLUSH)
if (adc_acq_flush(dev, ADC_FLUSH_F_ANY) < 0)
return -1;
if (timeout && timeout->tv_sec == 0 && timeout->tv_usec == 0)
return 0;
return adc_zio_acq_poll(dev, flags, timeout);
}
int adc_zio_acq_stop(struct adc_dev *dev, unsigned int flags)
{
/*A portable stop-command could be inserted here*/
return 0;
}
int adc_zio_acq_flush(struct adc_dev *dev, unsigned int flags)
{
struct __adc_dev_zio *fa = to_dev_zio(dev);
......
......@@ -34,6 +34,32 @@ static struct adc_dev *adc_ziofake_open(const struct adc_board_type *b,
return dev;
}
static int adc_ziofake_acq_start(struct adc_dev *dev, unsigned int flags,
struct timeval *timeout)
{
if (flags & ADC_F_FLUSH) {
int err = adc_acq_flush(dev, ADC_FLUSH_F_ANY);
if (err)
return err;
}
if (timeout && timeout->tv_sec == 0 && timeout->tv_usec == 0)
return 0;
return adc_acq_poll(dev, 0, timeout);
}
static int adc_ziofake_acq_stop(struct adc_dev *dev, unsigned int flags)
{
return 0;
}
static int adc_ziofake_acq_flush(struct adc_dev *dev, unsigned int flags)
{
return adc_zio_acq_flush(dev, flags);
}
static int adc_ziofake_buffer_get_sample(struct adc_buffer *buf,
unsigned int chan,
unsigned int acq_sample,
......@@ -62,9 +88,10 @@ static struct adc_operations fa_zio_fake_op = {
.open = adc_ziofake_open,
.close = adc_zio_close,
.acq_start = adc_zio_acq_start,
.acq_start = adc_ziofake_acq_start,
.acq_poll = adc_zio_acq_poll,
.acq_stop = adc_zio_acq_stop,
.acq_stop = adc_ziofake_acq_stop,
.acq_flush = adc_ziofake_acq_flush,
.apply_config = adc_zio_apply_config,
.retrieve_config = adc_zio_retrieve_config,
......
......@@ -219,6 +219,12 @@ static int adc_100m14b4cha_acq_start(struct adc_dev *dev,
int tmp = 1; /* enable the trigger */
int err;
if (flags & ADC_F_FLUSH) {
err = adc_acq_flush(dev, ADC_FLUSH_F_ANY);
if (err)
return err;
}
err = adc_set_param(dev, "cset0/trigger/enable", NULL, &tmp);
if (err)
return err;
......@@ -226,7 +232,10 @@ static int adc_100m14b4cha_acq_start(struct adc_dev *dev,
if (err)
return err;
return adc_zio_acq_start(dev, flags, timeout);
if (timeout && timeout->tv_sec == 0 && timeout->tv_usec == 0)
return 0;
return adc_acq_poll(dev, 0, timeout);
}
......
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