rigol-ds: Correct digital waveform block sizes.

This commit is contained in:
Martin Ling 2014-01-17 02:56:01 +00:00
parent 3ed7a40c75
commit d22250a96a
3 changed files with 24 additions and 7 deletions

View File

@ -489,6 +489,20 @@ static int analog_frame_size(const struct sr_dev_inst *sdi)
}
}
static int digital_frame_size(const struct sr_dev_inst *sdi)
{
struct dev_context *devc = sdi->priv;
switch (devc->model->series) {
case RIGOL_VS5000:
return VS5000_DIGITAL_WAVEFORM_SIZE;
case RIGOL_DS1000:
return DS1000_DIGITAL_WAVEFORM_SIZE;
default:
return 0;
}
}
static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
const struct sr_probe_group *probe_group)
{
@ -875,6 +889,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
devc->channel_entry = devc->enabled_digital_probes;
devc->analog_frame_size = analog_frame_size(sdi);
devc->digital_frame_size = digital_frame_size(sdi);
if (devc->model->protocol == PROTOCOL_LEGACY) {
/* Fetch the first frame. */

View File

@ -477,10 +477,7 @@ SR_PRIV int rigol_ds_receive(int fd, int revents, void *cb_data)
devc->num_block_bytes = len;
} else {
devc->num_block_bytes = probe->type == SR_PROBE_ANALOG ?
(devc->model->series == RIGOL_VS5000 ?
VS5000_ANALOG_LIVE_WAVEFORM_SIZE :
DS1000_ANALOG_LIVE_WAVEFORM_SIZE) :
DIGITAL_WAVEFORM_SIZE;
devc->analog_frame_size : devc->digital_frame_size;
}
devc->num_block_read = 0;
}
@ -553,7 +550,7 @@ SR_PRIV int rigol_ds_receive(int fd, int revents, void *cb_data)
devc->num_frame_samples += len;
if (devc->num_frame_samples < (probe->type == SR_PROBE_ANALOG ?
devc->analog_frame_size : DIGITAL_WAVEFORM_SIZE))
devc->analog_frame_size : devc->digital_frame_size))
/* Don't have the whole frame yet. */
return TRUE;

View File

@ -28,14 +28,18 @@
#define LOG_PREFIX "rigol-ds"
/* Analog waveform block sizes */
#define DS1000_ANALOG_LIVE_WAVEFORM_SIZE 600
#define DS2000_ANALOG_LIVE_WAVEFORM_SIZE 1400
#define VS5000_ANALOG_LIVE_WAVEFORM_SIZE 2048
#define DSO1000_ANALOG_LIVE_WAVEFORM_SIZE 600
/* Needs to be made configurable later */
#define DS2000_ANALOG_MEM_WAVEFORM_SIZE_1C 14000
#define DS2000_ANALOG_MEM_WAVEFORM_SIZE_2C 7000
#define DIGITAL_WAVEFORM_SIZE 1210
/* Digital waveform block size */
#define DS1000_DIGITAL_WAVEFORM_SIZE 1200
#define VS5000_DIGITAL_WAVEFORM_SIZE 4096
/* Size of acquisition buffers */
#define ACQ_BUFFER_SIZE 32768
@ -107,6 +111,7 @@ struct dev_context {
void *cb_data;
enum data_source data_source;
uint64_t analog_frame_size;
uint64_t digital_frame_size;
/* Device settings */
gboolean analog_channels[MAX_ANALOG_PROBES];