diff --git a/DSView/pv/prop/binding/deviceoptions.cpp b/DSView/pv/prop/binding/deviceoptions.cpp index 382d51a5..c77dcb03 100644 --- a/DSView/pv/prop/binding/deviceoptions.cpp +++ b/DSView/pv/prop/binding/deviceoptions.cpp @@ -105,6 +105,7 @@ DeviceOptions::DeviceOptions(struct sr_dev_inst *sdi) : bind_bool(name, key); break; + case SR_CONF_RLE_SUPPORT: case SR_CONF_CLOCK_TYPE: case SR_CONF_CLOCK_EDGE: case SR_CONF_INSTANT: diff --git a/DSView/pv/toolbars/samplingbar.cpp b/DSView/pv/toolbars/samplingbar.cpp index 0b5c5879..00a31d50 100644 --- a/DSView/pv/toolbars/samplingbar.cpp +++ b/DSView/pv/toolbars/samplingbar.cpp @@ -426,8 +426,10 @@ void SamplingBar::update_sample_count_selector() bool stream_mode = false; uint64_t hw_depth = 0; uint64_t sw_depth; + uint64_t rle_depth = 0; double pre_duration = SR_SEC(1); double duration; + bool rle_support = false; if (_updating_sample_count) return; @@ -464,23 +466,38 @@ void SamplingBar::update_sample_count_selector() sw_depth = AnalogMaxSWDepth; } + if (dev_inst->dev_inst()->mode == LOGIC) { + gvar = dev_inst->get_config(NULL, NULL, SR_CONF_RLE_SUPPORT); + if (gvar != NULL) { + rle_support = g_variant_get_boolean(gvar); + g_variant_unref(gvar); + } + if (rle_support) + rle_depth = min(hw_depth*SR_KB(1), sw_depth); + } + if (0 != _sample_count.count()) pre_duration = _sample_count.itemData( _sample_count.currentIndex()).value(); _sample_count.clear(); const uint64_t samplerate = _sample_rate.itemData( _sample_rate.currentIndex()).value(); + const double hw_duration = hw_depth / (samplerate * (1.0 / SR_SEC(1))); if (dev_inst->dev_inst()->mode == DSO) duration = SR_SEC(10); else if (stream_mode) duration = sw_depth / (samplerate * (1.0 / SR_SEC(1))); + else if (rle_support) + duration = rle_depth / (samplerate * (1.0 / SR_SEC(1))); else - duration = hw_depth / (samplerate * (1.0 / SR_SEC(1))); + duration = hw_duration; bool not_last = true; do { + QString suffix = (dev_inst->dev_inst()->mode == DSO) ? DIVString : + (!stream_mode & duration > hw_duration) ? RLEString : ""; char *const s = sr_time_string(duration); - _sample_count.addItem(QString(s) + ((dev_inst->dev_inst()->mode == DSO) ? DIVString : ""), + _sample_count.addItem(QString(s) + suffix, qVariantFromValue(duration)); g_free(s); diff --git a/libsigrok4DSL/hardware/DSL/dsl.c b/libsigrok4DSL/hardware/DSL/dsl.c index e19a75c4..8ba08175 100755 --- a/libsigrok4DSL/hardware/DSL/dsl.c +++ b/libsigrok4DSL/hardware/DSL/dsl.c @@ -861,6 +861,12 @@ SR_PRIV int dsl_config_get(int id, GVariant **data, const struct sr_dev_inst *sd devc = sdi->priv; *data = g_variant_new_uint64(devc->cur_samplerate); break; + case SR_CONF_RLE_SUPPORT: + if (!sdi) + return SR_ERR; + devc = sdi->priv; + *data = g_variant_new_boolean(devc->rle_support); + break; case SR_CONF_CLOCK_TYPE: if (!sdi) return SR_ERR; diff --git a/libsigrok4DSL/hardware/DSL/dsl.h b/libsigrok4DSL/hardware/DSL/dsl.h index 0cc1e0cd..1a1bf1a0 100644 --- a/libsigrok4DSL/hardware/DSL/dsl.h +++ b/libsigrok4DSL/hardware/DSL/dsl.h @@ -333,6 +333,7 @@ struct DSL_context { gboolean clock_type; gboolean clock_edge; gboolean rle_mode; + gboolean rle_support; gboolean instant; uint16_t op_mode; gboolean stream; diff --git a/libsigrok4DSL/hardware/DSL/dslogic.c b/libsigrok4DSL/hardware/DSL/dslogic.c index 6ab06b27..60f19229 100755 --- a/libsigrok4DSL/hardware/DSL/dslogic.c +++ b/libsigrok4DSL/hardware/DSL/dslogic.c @@ -124,6 +124,7 @@ static const int32_t hwoptions[] = { SR_CONF_THRESHOLD, SR_CONF_FILTER, SR_CONF_MAX_HEIGHT, + SR_CONF_RLE_SUPPORT, SR_CONF_CLOCK_TYPE, SR_CONF_CLOCK_EDGE, }; @@ -134,6 +135,7 @@ static const int32_t hwoptions_pro[] = { SR_CONF_VTH, SR_CONF_FILTER, SR_CONF_MAX_HEIGHT, + SR_CONF_RLE_SUPPORT, SR_CONF_CLOCK_TYPE, SR_CONF_CLOCK_EDGE, }; @@ -145,6 +147,7 @@ static const int32_t sessions[] = { SR_CONF_CHANNEL_MODE, SR_CONF_SAMPLERATE, SR_CONF_LIMIT_SAMPLES, + SR_CONF_RLE_SUPPORT, SR_CONF_CLOCK_TYPE, SR_CONF_CLOCK_EDGE, SR_CONF_THRESHOLD, @@ -163,6 +166,7 @@ static const int32_t sessions_pro[] = { SR_CONF_CHANNEL_MODE, SR_CONF_SAMPLERATE, SR_CONF_LIMIT_SAMPLES, + SR_CONF_RLE_SUPPORT, SR_CONF_CLOCK_TYPE, SR_CONF_CLOCK_EDGE, SR_CONF_VTH, @@ -864,6 +868,8 @@ static int config_set(int id, GVariant *data, struct sr_dev_inst *sdi, if (id == SR_CONF_CLOCK_TYPE) { devc->clock_type = g_variant_get_boolean(data); + } else if (id == SR_CONF_RLE_SUPPORT) { + devc->rle_support = g_variant_get_boolean(data); } else if (id == SR_CONF_CLOCK_EDGE) { devc->clock_edge = g_variant_get_boolean(data); } else if (id == SR_CONF_LIMIT_SAMPLES) { diff --git a/libsigrok4DSL/hwdriver.c b/libsigrok4DSL/hwdriver.c index faf5ab5e..f1dc7ef0 100644 --- a/libsigrok4DSL/hwdriver.c +++ b/libsigrok4DSL/hwdriver.c @@ -108,6 +108,8 @@ static struct sr_config_info sr_config_info_data[] = { "Threshold Level", "Threshold Level", NULL}, {SR_CONF_VTH, SR_T_FLOAT, "threshold", "Threshold Level", "Threshold Level", NULL}, + {SR_CONF_RLE_SUPPORT, SR_T_BOOL, "rle", + "Enable RLE Compress", "Enable RLE Compress", NULL}, {SR_CONF_PROBE_COUPLING, SR_T_CHAR, "coupling", "Coupling", "Coupling", NULL}, diff --git a/libsigrok4DSL/libsigrok.h b/libsigrok4DSL/libsigrok.h index cc5fb547..3583202f 100644 --- a/libsigrok4DSL/libsigrok.h +++ b/libsigrok4DSL/libsigrok.h @@ -874,6 +874,9 @@ enum { /** Device channel mode */ SR_CONF_CHANNEL_MODE, + /** RLE compress support */ + SR_CONF_RLE_SUPPORT, + /** Signal max height **/ SR_CONF_MAX_HEIGHT, SR_CONF_MAX_HEIGHT_VALUE,