rigol-ds: Experimental support for segmented data with PROTOCOL_V3 models

This commit is contained in:
Valentin Ochs 2020-06-13 22:24:09 +02:00 committed by Uwe Hermann
parent 19f31c8ace
commit 06ed999aa4
2 changed files with 18 additions and 8 deletions

View File

@ -876,9 +876,11 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
gboolean some_digital;
GSList *l;
char *cmd;
int protocol;
scpi = sdi->conn;
devc = sdi->priv;
protocol = devc->model->series->protocol;
devc->num_frames = 0;
devc->num_frames_segmented = 0;
@ -902,7 +904,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
/* Only one list entry for older protocols. All channels are
* retrieved together when this entry is processed. */
if (ch->enabled && (
devc->model->series->protocol > PROTOCOL_V3 ||
protocol > PROTOCOL_V3 ||
!some_digital))
devc->enabled_channels = g_slist_append(
devc->enabled_channels, ch);
@ -910,8 +912,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
some_digital = TRUE;
/* Turn on LA module if currently off. */
if (!devc->la_enabled) {
if (rigol_ds_config_set(sdi,
devc->model->series->protocol >= PROTOCOL_V3 ?
if (rigol_ds_config_set(sdi, protocol >= PROTOCOL_V3 ?
":LA:STAT ON" : ":LA:DISP ON") != SR_OK)
return SR_ERR;
devc->la_enabled = TRUE;
@ -919,9 +920,9 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
}
if (ch->enabled != devc->digital_channels[ch->index]) {
/* Enabled channel is currently disabled, or vice versa. */
if (devc->model->series->protocol >= PROTOCOL_V5)
if (protocol >= PROTOCOL_V5)
cmd = ":LA:DISP D%d,%s";
else if (devc->model->series->protocol >= PROTOCOL_V3)
else if (protocol >= PROTOCOL_V3)
cmd = ":LA:DIG%d:DISP %s";
else
cmd = ":DIG%d:TURN %s";
@ -946,11 +947,20 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
/* Set memory mode. */
if (devc->data_source == DATA_SOURCE_SEGMENTED) {
switch (devc->model->series->protocol) {
switch (protocol) {
case PROTOCOL_V1:
case PROTOCOL_V2:
/* V1 and V2 do not have segmented data */
sr_err("Data source 'Segmented' not supported on this model");
break;
case PROTOCOL_V3:
case PROTOCOL_V4:
{
int frames = 0;
sr_scpi_get_int(sdi->conn, "FUNC:WREP:FEND?", &frames);
if (sr_scpi_get_int(sdi->conn,
protocol == PROTOCOL_V4 ? "FUNC:WREP:FEND?" :
"FUNC:WREP:FMAX?", &frames) != SR_OK)
return SR_ERR;
if (frames <= 0) {
sr_err("No segmented data available");
return SR_ERR;

View File

@ -432,7 +432,7 @@ SR_PRIV int rigol_ds_capture_start(const struct sr_dev_inst *sdi)
return SR_ERR;
rigol_ds_set_wait_event(devc, WAIT_STOP);
if (devc->data_source == DATA_SOURCE_SEGMENTED &&
devc->model->series->protocol == PROTOCOL_V4)
devc->model->series->protocol <= PROTOCOL_V4)
if (rigol_ds_config_set(sdi, "FUNC:WREP:FCUR %d", devc->num_frames + 1) != SR_OK)
return SR_ERR;
}