The following data sources are supported: "Live", reads data from display
memory; "Memory", reads data from sample memory; and "Segmented" (support
depends on scope model), reads data from segmented memory.
---
hardware/rigol-ds/api.c | 44 ++++++++++++++++++++++++++++++++++++++++++
hardware/rigol-ds/protocol.h | 6 ++++++
2 files changed, 50 insertions(+)
diff --git a/hardware/rigol-ds/api.c b/hardware/rigol-ds/api.c
index d1d9e8a..757a1d2 100644
--- a/hardware/rigol-ds/api.c
+++ b/hardware/rigol-ds/api.c
@@ -42,6 +42,7 @@ static const int32_t hwcaps[] = {
SR_CONF_COUPLING,
SR_CONF_NUM_TIMEBASE,
SR_CONF_NUM_VDIV,
+ SR_CONF_DATA_SOURCE,
};
static const uint64_t timebases[][2] = {
@@ -138,6 +139,12 @@ static const char *coupling[] = {
"GND",
};
+static const char *data_sources[] = {
+ "Live",
+ "Memory",
+ "Segmented",
+};
+
/*
* name, series, protocol flavor, min timebase, max timebase, min vdiv,
* digital channels, number of horizontal divs
@@ -305,6 +312,8 @@ static int probe_port(const char *port, GSList **devices)
}
}
+ devc->data_source = DATA_SOURCE_LIVE;
+
sdi->priv = devc;
*devices = g_slist_append(NULL, sdi);
@@ -409,6 +418,14 @@ static int config_get(int id, GVariant **data, const
struct sr_dev_inst *sdi)
case SR_CONF_NUM_VDIV:
*data = g_variant_new_int32(devc->num_vdivs);
break;
+ case SR_CONF_DATA_SOURCE:
+ if (devc->data_source == DATA_SOURCE_LIVE)
+ *data = g_variant_new_string("Live");
+ else if (devc->data_source == DATA_SOURCE_MEMORY)
+ *data = g_variant_new_string("Memory");
+ else
+ *data = g_variant_new_string("Segmented");
+ break;
default:
return SR_ERR_NA;
}
@@ -516,6 +533,18 @@ static int config_set(int id, GVariant *data, const struct
sr_dev_inst *sdi)
if (i == ARRAY_SIZE(coupling))
ret = SR_ERR_ARG;
break;
+ case SR_CONF_DATA_SOURCE:
+ tmp_str = g_variant_get_string(data, NULL);
+ if (!strcmp(tmp_str, "Live"))
+ devc->data_source = DATA_SOURCE_LIVE;
+ else if (!strcmp(tmp_str, "Memory"))
+ devc->data_source = DATA_SOURCE_MEMORY;
+ else if (devc->model->protocol == PROTOCOL_IEEE488_2
+ && !strcmp(tmp_str, "Segmented"))
+ devc->data_source = DATA_SOURCE_SEGMENTED;
+ else
+ return SR_ERR;
+ break;
default:
ret = SR_ERR_NA;
break;
@@ -579,6 +608,16 @@ static int config_list(int key, GVariant **data, const
struct sr_dev_inst *sdi)
*data = g_variant_new_strv(trigger_sources,
devc->model->has_digital ?
ARRAY_SIZE(trigger_sources) : 4);
break;
+ case SR_CONF_DATA_SOURCE:
+ if (!devc)
+ /* Can't know this until we have the exact model. */
+ return SR_ERR_ARG;
+ /* This needs tweaking by series/model! */
+ if (devc->model->series == RIGOL_DS2000)
+ *data = g_variant_new_strv(data_sources,
ARRAY_SIZE(data_sources));
+ else
+ *data = g_variant_new_strv(data_sources,
ARRAY_SIZE(data_sources) - 1);
+ break;
default:
return SR_ERR_NA;
}
@@ -600,6 +639,11 @@ static int dev_acquisition_start(const struct sr_dev_inst
*sdi, void *cb_data)
serial = sdi->conn;
devc = sdi->priv;
+ if (devc->data_source != DATA_SOURCE_LIVE) {
+ sr_err("Only data source Live supported for now");
+ return SR_ERR;
+ }
+
for (l = sdi->probes; l; l = l->next) {
probe = l->data;
sr_dbg("handling probe %s", probe->name);
diff --git a/hardware/rigol-ds/protocol.h b/hardware/rigol-ds/protocol.h
index eb8bb4e..d63d756 100644
--- a/hardware/rigol-ds/protocol.h
+++ b/hardware/rigol-ds/protocol.h
@@ -54,6 +54,11 @@ enum rigol_protocol_flavor {
PROTOCOL_IEEE488_2,
};
+enum data_source {
+ DATA_SOURCE_LIVE,
+ DATA_SOURCE_MEMORY,
+ DATA_SOURCE_SEGMENTED,
+};
struct rigol_ds_model {
char *name;
@@ -82,6 +87,7 @@ struct dev_context {
GSList *enabled_digital_probes;
uint64_t limit_frames;
void *cb_data;
+ enum data_source data_source;
/* Device settings */
gboolean analog_channels[2];
--
1.7.10.4
------------------------------------------------------------------------------
Shape the Mobile Experience: Free Subscription
Software experts and developers: Be at the forefront of tech innovation.
Intel(R) Software Adrenaline delivers strategic insight and game-changing
conversations that shape the rapidly evolving mobile landscape. Sign up now.
http://pubads.g.doubleclick.net/gampad/clk?id=63431311&iu=/4140/ostg.clktrk
_______________________________________________
sigrok-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sigrok-devel