2
0
forked from Ivasoft/DSView

Add RLE compress options under LA mode

This commit is contained in:
DreamSourceLab
2018-05-27 20:32:39 +08:00
parent 7ffab48d84
commit c7cba6a79b
7 changed files with 38 additions and 2 deletions

View File

@@ -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:

View File

@@ -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<double>();
_sample_count.clear();
const uint64_t samplerate = _sample_rate.itemData(
_sample_rate.currentIndex()).value<uint64_t>();
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);

View File

@@ -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;

View File

@@ -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;

View File

@@ -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) {

View File

@@ -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},

View File

@@ -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,