Commit 1dcd92cf authored by DreamSourceLab's avatar DreamSourceLab

Fix session load issues

parent 51cb900c
...@@ -144,6 +144,7 @@ set(DSView_SOURCES ...@@ -144,6 +144,7 @@ set(DSView_SOURCES
pv/dialogs/storeprogress.cpp pv/dialogs/storeprogress.cpp
pv/dialogs/streamoptions.cpp pv/dialogs/streamoptions.cpp
pv/dialogs/waitingdialog.cpp pv/dialogs/waitingdialog.cpp
pv/dialogs/dsomeasure.cpp
pv/dock/dsotriggerdock.cpp pv/dock/dsotriggerdock.cpp
pv/dock/measuredock.cpp pv/dock/measuredock.cpp
pv/dock/searchdock.cpp pv/dock/searchdock.cpp
...@@ -189,6 +190,7 @@ set(DSView_HEADERS ...@@ -189,6 +190,7 @@ set(DSView_HEADERS
pv/dialogs/storeprogress.h pv/dialogs/storeprogress.h
pv/dialogs/streamoptions.h pv/dialogs/streamoptions.h
pv/dialogs/waitingdialog.h pv/dialogs/waitingdialog.h
pv/dialogs/dsomeasure.h
pv/dock/dsotriggerdock.h pv/dock/dsotriggerdock.h
pv/dock/measuredock.h pv/dock/measuredock.h
pv/dock/searchdock.h pv/dock/searchdock.h
......
...@@ -134,6 +134,7 @@ set< shared_ptr<pv::data::Logic> > Decoder::get_data() ...@@ -134,6 +134,7 @@ set< shared_ptr<pv::data::Logic> > Decoder::get_data()
srd_decoder_inst* Decoder::create_decoder_inst(srd_session *session, int unit_size) const srd_decoder_inst* Decoder::create_decoder_inst(srd_session *session, int unit_size) const
{ {
(void)unit_size;
GHashTable *const opt_hash = g_hash_table_new_full(g_str_hash, GHashTable *const opt_hash = g_hash_table_new_full(g_str_hash,
g_str_equal, g_free, (GDestroyNotify)g_variant_unref); g_str_equal, g_free, (GDestroyNotify)g_variant_unref);
......
...@@ -148,7 +148,7 @@ void DsoSnapshot::reallocate_envelope(Envelope &e) ...@@ -148,7 +148,7 @@ void DsoSnapshot::reallocate_envelope(Envelope &e)
void DsoSnapshot::append_payload_to_envelope_levels() void DsoSnapshot::append_payload_to_envelope_levels()
{ {
for (int i = 0; i < _channel_num; i++) { for (unsigned int i = 0; i < _channel_num; i++) {
Envelope &e0 = _envelope_levels[i][0]; Envelope &e0 = _envelope_levels[i][0];
uint64_t prev_length; uint64_t prev_length;
EnvelopeSample *dest_ptr; EnvelopeSample *dest_ptr;
......
...@@ -126,8 +126,6 @@ const uint16_t* GroupSnapshot::get_samples( ...@@ -126,8 +126,6 @@ const uint16_t* GroupSnapshot::get_samples(
assert(start_sample <= end_sample); assert(start_sample <= end_sample);
int64_t i; int64_t i;
uint64_t pow;
uint16_t mask;
uint16_t tmpl, tmpr; uint16_t tmpl, tmpr;
boost::lock_guard<boost::recursive_mutex> lock(_mutex); boost::lock_guard<boost::recursive_mutex> lock(_mutex);
...@@ -192,7 +190,6 @@ void GroupSnapshot::append_payload_to_envelope_levels() ...@@ -192,7 +190,6 @@ void GroupSnapshot::append_payload_to_envelope_levels()
Envelope &e0 = _envelope_levels[0]; Envelope &e0 = _envelope_levels[0];
uint64_t prev_length; uint64_t prev_length;
EnvelopeSample *dest_ptr; EnvelopeSample *dest_ptr;
uint16_t mask;
// Expand the data buffer to fit the new samples // Expand the data buffer to fit the new samples
prev_length = e0.length; prev_length = e0.length;
...@@ -226,56 +223,8 @@ void GroupSnapshot::append_payload_to_envelope_levels() ...@@ -226,56 +223,8 @@ void GroupSnapshot::append_payload_to_envelope_levels()
group_value[i] <<= _bubble_start[j]; group_value[i] <<= _bubble_start[j];
group_value[i] += tmpr; group_value[i] += tmpr;
} }
// group_value[i] = 0;
// std::list<int>::iterator j = _index_list.begin();
// pow = 0;
// while(j != _index_list.end()) {
// mask = value_mask[(*j)];
// if ( *(j+1) == (*j) + 1)
// mask |= value_mask[*(j+1)];
// group_value[i] += ((*(src_ptr + i) & value_mask[(*j)]) >> ((*j) - pow));
// pow++;
// j++;
// }
} }
// group_value[0] = 0;
// group_value[1] = 0;
// group_value[2] = 0;
// group_value[3] = 0;
// group_value[4] = 0;
// group_value[5] = 0;
// group_value[6] = 0;
// group_value[7] = 0;
// group_value[8] = 0;
// group_value[9] = 0;
// group_value[10] = 0;
// group_value[11] = 0;
// group_value[12] = 0;
// group_value[13] = 0;
// group_value[14] = 0;
// group_value[15] = 0;
// std::list<int>::iterator j = _index_list.begin();
// pow = 0;
// while(j != _index_list.end()) {
// group_value[0] += ((*(src_ptr + 0) & value_mask[(*j)]) >> ((*j) - pow));
// group_value[1] += ((*(src_ptr + 1) & value_mask[(*j)]) >> ((*j) - pow));
// group_value[2] += ((*(src_ptr + 2) & value_mask[(*j)]) >> ((*j) - pow));
// group_value[3] += ((*(src_ptr + 3) & value_mask[(*j)]) >> ((*j) - pow));
// group_value[4] += ((*(src_ptr + 4) & value_mask[(*j)]) >> ((*j) - pow));
// group_value[5] += ((*(src_ptr + 5) & value_mask[(*j)]) >> ((*j) - pow));
// group_value[6] += ((*(src_ptr + 6) & value_mask[(*j)]) >> ((*j) - pow));
// group_value[7] += ((*(src_ptr + 7) & value_mask[(*j)]) >> ((*j) - pow));
// group_value[8] += ((*(src_ptr + 8) & value_mask[(*j)]) >> ((*j) - pow));
// group_value[9] += ((*(src_ptr + 9) & value_mask[(*j)]) >> ((*j) - pow));
// group_value[10] += ((*(src_ptr + 10) & value_mask[(*j)]) >> ((*j) - pow));
// group_value[11] += ((*(src_ptr + 11) & value_mask[(*j)]) >> ((*j) - pow));
// group_value[12] += ((*(src_ptr + 12) & value_mask[(*j)]) >> ((*j) - pow));
// group_value[13] += ((*(src_ptr + 13) & value_mask[(*j)]) >> ((*j) - pow));
// group_value[14] += ((*(src_ptr + 14) & value_mask[(*j)]) >> ((*j) - pow));
// group_value[15] += ((*(src_ptr + 15) & value_mask[(*j)]) >> ((*j) - pow));
// pow++;
// j++;
// }
const EnvelopeSample sub_sample = { const EnvelopeSample sub_sample = {
*min_element(group_value, group_value + EnvelopeScaleFactor), *min_element(group_value, group_value + EnvelopeScaleFactor),
*max_element(group_value, group_value + EnvelopeScaleFactor), *max_element(group_value, group_value + EnvelopeScaleFactor),
......
...@@ -83,6 +83,7 @@ uint8_t * LogicSnapshot::get_samples(int64_t start_sample, int64_t end_sample) c ...@@ -83,6 +83,7 @@ uint8_t * LogicSnapshot::get_samples(int64_t start_sample, int64_t end_sample) c
assert(end_sample <= (int64_t)_sample_count); assert(end_sample <= (int64_t)_sample_count);
assert(start_sample <= end_sample); assert(start_sample <= end_sample);
(void)end_sample;
//lock_guard<recursive_mutex> lock(_mutex); //lock_guard<recursive_mutex> lock(_mutex);
//const size_t size = (end_sample - start_sample) * _unit_size; //const size_t size = (end_sample - start_sample) * _unit_size;
......
...@@ -139,7 +139,7 @@ void DeviceOptions::setup_probes() ...@@ -139,7 +139,7 @@ void DeviceOptions::setup_probes()
int row0 = 0, row1 = 0, col = 0; int row0 = 0, row1 = 0, col = 0;
int index = 0; int index = 0;
uint16_t ch_mode; QString ch_mode;
while(_probes_box_layout.count() > 0) while(_probes_box_layout.count() > 0)
{ {
...@@ -159,16 +159,17 @@ void DeviceOptions::setup_probes() ...@@ -159,16 +159,17 @@ void DeviceOptions::setup_probes()
const char **const options = g_variant_get_strv(gvar_opts, &num_opts); const char **const options = g_variant_get_strv(gvar_opts, &num_opts);
GVariant* gvar = _dev_inst->get_config(NULL, NULL, SR_CONF_CHANNEL_MODE); GVariant* gvar = _dev_inst->get_config(NULL, NULL, SR_CONF_CHANNEL_MODE);
if (gvar != NULL) { if (gvar != NULL) {
ch_mode = g_variant_get_uint16(gvar); ch_mode = g_variant_get_string(gvar, NULL);
g_variant_unref(gvar); g_variant_unref(gvar);
}
for (int i=0; i<num_opts; i++){ for (unsigned int i=0; i<num_opts; i++){
QRadioButton *ch_opts = new QRadioButton(options[i]); QRadioButton *ch_opts = new QRadioButton(options[i]);
_probes_box_layout.addWidget(ch_opts, row0, col, 1, 8); _probes_box_layout.addWidget(ch_opts, row0, col, 1, 8);
connect(ch_opts, SIGNAL(pressed()), this, SLOT(channel_check())); connect(ch_opts, SIGNAL(pressed()), this, SLOT(channel_check()));
row0++; row0++;
if (i == ch_mode) if (QString::fromLocal8Bit(options[i]) == ch_mode)
ch_opts->setChecked(true); ch_opts->setChecked(true);
}
} }
} }
g_variant_unref(gvar_opts); g_variant_unref(gvar_opts);
......
...@@ -61,6 +61,7 @@ DsoMeasure::DsoMeasure(QWidget *parent, boost::shared_ptr<DsoSignal> dsoSig) : ...@@ -61,6 +61,7 @@ DsoMeasure::DsoMeasure(QWidget *parent, boost::shared_ptr<DsoSignal> dsoSig) :
void DsoMeasure::set_measure(bool en) void DsoMeasure::set_measure(bool en)
{ {
(void)en;
QCheckBox* sc=dynamic_cast<QCheckBox*>(sender()); QCheckBox* sc=dynamic_cast<QCheckBox*>(sender());
if(sc != NULL) { if(sc != NULL) {
QVariant id = sc->property("id"); QVariant id = sc->property("id");
......
...@@ -436,6 +436,7 @@ void SigSession::start_capture(bool instant, ...@@ -436,6 +436,7 @@ void SigSession::start_capture(bool instant,
void SigSession::stop_capture() void SigSession::stop_capture()
{ {
_instant = false;
if (get_capture_state() != Running) if (get_capture_state() != Running)
return; return;
sr_session_stop(); sr_session_stop();
......
...@@ -122,8 +122,6 @@ public: ...@@ -122,8 +122,6 @@ public:
void set_default_device(boost::function<void (const QString)> error_handler); void set_default_device(boost::function<void (const QString)> error_handler);
void export_file(const QString name, QWidget* parent, const QString ext); void export_file(const QString name, QWidget* parent, const QString ext);
void set_default_device();
void release_device(device::DevInst *dev_inst); void release_device(device::DevInst *dev_inst);
capture_state get_capture_state() const; capture_state get_capture_state() const;
......
...@@ -291,12 +291,24 @@ void SamplingBar::set_record_length(uint64_t length) ...@@ -291,12 +291,24 @@ void SamplingBar::set_record_length(uint64_t length)
void SamplingBar::update_record_length() void SamplingBar::update_record_length()
{ {
disconnect(&_sample_count, SIGNAL(currentIndexChanged(int)),
this, SLOT(on_samplecount_sel(int)));
update_sample_count_selector_value(); update_sample_count_selector_value();
connect(&_sample_count, SIGNAL(currentIndexChanged(int)),
this, SLOT(on_samplecount_sel(int)));
} }
void SamplingBar::update_sample_rate() void SamplingBar::update_sample_rate()
{ {
disconnect(&_sample_rate, SIGNAL(currentIndexChanged(int)),
this, SLOT(on_samplerate_sel(int)));
update_sample_rate_selector_value(); update_sample_rate_selector_value();
connect(&_sample_rate, SIGNAL(currentIndexChanged(int)),
this, SLOT(on_samplerate_sel(int)));
} }
void SamplingBar::set_sampling(bool sampling) void SamplingBar::set_sampling(bool sampling)
...@@ -417,9 +429,9 @@ void SamplingBar::update_sample_rate_selector() ...@@ -417,9 +429,9 @@ void SamplingBar::update_sample_rate_selector()
_updating_sample_rate = false; _updating_sample_rate = false;
g_variant_unref(gvar_dict); g_variant_unref(gvar_dict);
update_sample_rate_selector_value();
connect(&_sample_rate, SIGNAL(currentIndexChanged(int)), connect(&_sample_rate, SIGNAL(currentIndexChanged(int)),
this, SLOT(on_samplerate_sel(int))); this, SLOT(on_samplerate_sel(int)));
update_sample_rate_selector_value();
} }
void SamplingBar::update_sample_rate_selector_value() void SamplingBar::update_sample_rate_selector_value()
...@@ -486,13 +498,14 @@ void SamplingBar::on_samplecount_sel(int index) ...@@ -486,13 +498,14 @@ void SamplingBar::on_samplecount_sel(int index)
//bool buffer2stream = false; //bool buffer2stream = false;
//bool stream2buffer = false; //bool stream2buffer = false;
qDebug() << "index: " << index;
if (index >= 0) if (index >= 0)
sample_count = _sample_count.itemData( sample_count = _sample_count.itemData(
index).value<uint64_t>(); index).value<uint64_t>();
boost::shared_ptr<pv::device::DevInst> _devInst = get_selected_device(); boost::shared_ptr<pv::device::DevInst> _devInst = get_selected_device();
assert(_devInst); assert(_devInst);
qDebug() << "1!\n";
if (strcmp(_devInst->dev_inst()->driver->name, "DSLogic") == 0 && _devInst->dev_inst()->mode != DSO) { if (strcmp(_devInst->dev_inst()->driver->name, "DSLogic") == 0 && _devInst->dev_inst()->mode != DSO) {
/*GVariant* gvar = _devInst->get_config(NULL, NULL, SR_CONF_LIMIT_SAMPLES); /*GVariant* gvar = _devInst->get_config(NULL, NULL, SR_CONF_LIMIT_SAMPLES);
if (gvar != NULL) { if (gvar != NULL) {
...@@ -518,23 +531,26 @@ void SamplingBar::on_samplecount_sel(int index) ...@@ -518,23 +531,26 @@ void SamplingBar::on_samplecount_sel(int index)
stream_mode = sample_count > max_sample_count; stream_mode = sample_count > max_sample_count;
stream2buffer = true; stream2buffer = true;
}*/ }*/
qDebug() << "2!\n";
// Set the sample count // Set the sample count
_devInst->set_config(NULL, NULL, _devInst->set_config(NULL, NULL,
SR_CONF_LIMIT_SAMPLES, SR_CONF_LIMIT_SAMPLES,
g_variant_new_uint64(sample_count)); g_variant_new_uint64(sample_count));
qDebug() << "21!\n";
GVariant* gvar = _devInst->get_config(NULL, NULL, SR_CONF_STREAM); GVariant* gvar = _devInst->get_config(NULL, NULL, SR_CONF_STREAM);
if (gvar != NULL) { if (gvar != NULL) {
stream_mode = g_variant_get_boolean(gvar); stream_mode = g_variant_get_boolean(gvar);
g_variant_unref(gvar); g_variant_unref(gvar);
} }
qDebug() << "22!\n";
gvar = _devInst->get_config(NULL, NULL, SR_CONF_MAX_LOGIC_SAMPLELIMITS); gvar = _devInst->get_config(NULL, NULL, SR_CONF_MAX_LOGIC_SAMPLELIMITS);
qDebug() << "23!\n";
if (gvar != NULL) { if (gvar != NULL) {
max_sample_count = g_variant_get_uint64(gvar); max_sample_count = g_variant_get_uint64(gvar);
g_variant_unref(gvar); g_variant_unref(gvar);
} }
qDebug() << "3!\n";
if (!stream_mode) { if (!stream_mode) {
if (sample_count > max_sample_count) { if (sample_count > max_sample_count) {
_devInst->set_config(NULL, NULL, _devInst->set_config(NULL, NULL,
...@@ -546,7 +562,7 @@ void SamplingBar::on_samplecount_sel(int index) ...@@ -546,7 +562,7 @@ void SamplingBar::on_samplecount_sel(int index)
g_variant_new_boolean(false)); g_variant_new_boolean(false));
} }
} }
qDebug() << "4!\n";
/*if (buffer2stream) { /*if (buffer2stream) {
pv::dialogs::StreamOptions stream(this, _devInst, sample_count, stream_mode); pv::dialogs::StreamOptions stream(this, _devInst, sample_count, stream_mode);
stream.setFixedSize(300, 150); stream.setFixedSize(300, 150);
...@@ -675,9 +691,9 @@ void SamplingBar::update_sample_count_selector() ...@@ -675,9 +691,9 @@ void SamplingBar::update_sample_count_selector()
_updating_sample_count = false; _updating_sample_count = false;
g_variant_unref(gvar_dict); g_variant_unref(gvar_dict);
update_sample_count_selector_value();
connect(&_sample_count, SIGNAL(currentIndexChanged(int)), connect(&_sample_count, SIGNAL(currentIndexChanged(int)),
this, SLOT(on_samplecount_sel(int))); this, SLOT(on_samplecount_sel(int)));
update_sample_count_selector_value();
} }
void SamplingBar::update_sample_count_selector_value() void SamplingBar::update_sample_count_selector_value()
......
...@@ -428,6 +428,7 @@ bool DsoSignal::go_hDialNext(bool setted) ...@@ -428,6 +428,7 @@ bool DsoSignal::go_hDialNext(bool setted)
bool DsoSignal::update_vDial() bool DsoSignal::update_vDial()
{ {
uint64_t vdiv; uint64_t vdiv;
uint64_t vfactor;
//uint64_t pre_vdiv = _vDial->get_value(); //uint64_t pre_vdiv = _vDial->get_value();
GVariant* gvar = _dev_inst->get_config(_probe, NULL, SR_CONF_VDIV); GVariant* gvar = _dev_inst->get_config(_probe, NULL, SR_CONF_VDIV);
if (gvar != NULL) { if (gvar != NULL) {
...@@ -437,10 +438,18 @@ bool DsoSignal::update_vDial() ...@@ -437,10 +438,18 @@ bool DsoSignal::update_vDial()
qDebug() << "ERROR: config_get SR_CONF_TIMEBASE failed."; qDebug() << "ERROR: config_get SR_CONF_TIMEBASE failed.";
return false; return false;
} }
gvar = _dev_inst->get_config(_probe, NULL, SR_CONF_FACTOR);
if (gvar != NULL) {
vfactor = g_variant_get_uint64(gvar);
g_variant_unref(gvar);
} else {
qDebug() << "ERROR: config_get SR_CONF_TIMEBASE failed.";
return false;
}
_vDial->set_value(vdiv); _vDial->set_value(vdiv);
_dev_inst->set_config(_probe, NULL, SR_CONF_VDIV, _vDial->set_factor(vfactor);
g_variant_new_uint64(_vDial->get_value()));
if (_view) { if (_view) {
update_zeroPos(); update_zeroPos();
_view->set_need_update(true); _view->set_need_update(true);
...@@ -599,6 +608,7 @@ void DsoSignal::set_zeroPos(int pos) ...@@ -599,6 +608,7 @@ void DsoSignal::set_zeroPos(int pos)
void DsoSignal::set_zeroRate(double rate) void DsoSignal::set_zeroRate(double rate)
{ {
_zeroPos = rate; _zeroPos = rate;
_zero_off = rate * 255;
update_zeroPos(); update_zeroPos();
} }
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
#include "../data/logic.h" #include "../data/logic.h"
#include "../data/logicsnapshot.h" #include "../data/logicsnapshot.h"
#include "../sigsession.h" #include "../sigsession.h"
#include <../dialogs/dsomeasure.h> #include "../dialogs/dsomeasure.h"
#include <QMouseEvent> #include <QMouseEvent>
#include <QStyleOption> #include <QStyleOption>
......
...@@ -48,8 +48,12 @@ static struct sr_dev_mode mode_list[] = { ...@@ -48,8 +48,12 @@ static struct sr_dev_mode mode_list[] = {
static const char *opmodes[] = { static const char *opmodes[] = {
"Normal", "Normal",
"Internal Test", "Internal Test",
"External Test",
"DRAM Loopback Test",
}; };
static uint16_t opmodes_show_count = 2;
static const char *thresholds[] = { static const char *thresholds[] = {
"1.8/2.5/3.3V Level", "1.8/2.5/3.3V Level",
"5.0V Level", "5.0V Level",
...@@ -1649,7 +1653,7 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, ...@@ -1649,7 +1653,7 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
*data = g_variant_new_string(TRIGGER_TYPE); *data = g_variant_new_string(TRIGGER_TYPE);
break; break;
case SR_CONF_OPERATION_MODE: case SR_CONF_OPERATION_MODE:
*data = g_variant_new_strv(opmodes, ARRAY_SIZE(opmodes)); *data = g_variant_new_strv(opmodes, opmodes_show_count);
break; break;
case SR_CONF_THRESHOLD: case SR_CONF_THRESHOLD:
*data = g_variant_new_strv(thresholds, ARRAY_SIZE(thresholds)); *data = g_variant_new_strv(thresholds, ARRAY_SIZE(thresholds));
......
...@@ -55,8 +55,12 @@ static const char *opmodes[] = { ...@@ -55,8 +55,12 @@ static const char *opmodes[] = {
"Buffer Mode", "Buffer Mode",
"Stream Mode", "Stream Mode",
"Internal Test", "Internal Test",
"External Test",
"DRAM Loopback Test",
}; };
static uint16_t opmodes_show_count = 3;
static const char *stream_ch_modes[] = { static const char *stream_ch_modes[] = {
"Use Channels 0~15 (Max 10MHz)", "Use Channels 0~15 (Max 10MHz)",
"Use Channels 0~7 (Max 25MHz)", "Use Channels 0~7 (Max 25MHz)",
...@@ -229,7 +233,6 @@ static const uint64_t samplecounts[] = { ...@@ -229,7 +233,6 @@ static const uint64_t samplecounts[] = {
SR_MB(128), SR_MB(128),
SR_MB(256), SR_MB(256),
SR_MB(512), SR_MB(512),
SR_GB(1),
}; };
static const uint8_t zero_base_addr = 0x80; static const uint8_t zero_base_addr = 0x80;
...@@ -1172,7 +1175,6 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi, ...@@ -1172,7 +1175,6 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
struct DSL_context *devc; struct DSL_context *devc;
struct sr_usb_dev_inst *usb; struct sr_usb_dev_inst *usb;
char str[128]; char str[128];
uint64_t max_limits = DSLOGIC_MAX_LOGIC_DEPTH;
(void)cg; (void)cg;
...@@ -1234,7 +1236,10 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi, ...@@ -1234,7 +1236,10 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
if (!sdi) if (!sdi)
return SR_ERR; return SR_ERR;
devc = sdi->priv; devc = sdi->priv;
*data = g_variant_new_uint16(devc->ch_mode); if (devc->stream)
*data = g_variant_new_string(stream_ch_modes[devc->ch_mode]);
else
*data = g_variant_new_string(buffer_ch_modes[devc->ch_mode]);
break; break;
case SR_CONF_TEST: case SR_CONF_TEST:
if (!sdi) if (!sdi)
...@@ -1371,16 +1376,18 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi, ...@@ -1371,16 +1376,18 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
case SR_CONF_MAX_LOGIC_SAMPLELIMITS: case SR_CONF_MAX_LOGIC_SAMPLELIMITS:
if (!sdi) if (!sdi)
return SR_ERR; return SR_ERR;
if (devc->cur_samplerate == 2*DSLOGIC_MAX_LOGIC_SAMPLERATE) { sr_spew("dslogic:before");
max_limits = DSLOGIC_MAX_LOGIC_DEPTH * 2; devc = sdi->priv;
} else if (devc->cur_samplerate == 4*DSLOGIC_MAX_LOGIC_SAMPLERATE) { sr_spew("DSLOGIC_MAX_LOGIC_DEPTH: %d", DSLOGIC_MAX_LOGIC_DEPTH);
max_limits = DSLOGIC_MAX_LOGIC_DEPTH * 4; sr_spew("devc->cur_samplerate: %d", devc->cur_samplerate);
} sr_spew("DSLOGIC_MAX_LOGIC_SAMPLERATE: %d", DSLOGIC_MAX_LOGIC_SAMPLERATE);
*data = g_variant_new_uint64(max_limits); *data = g_variant_new_uint64(DSLOGIC_MAX_LOGIC_DEPTH*ceil(devc->cur_samplerate * 1.0 / DSLOGIC_MAX_LOGIC_SAMPLERATE));
sr_spew("dslogic:after");
break; break;
case SR_CONF_STATUS: case SR_CONF_STATUS:
if (!sdi) if (!sdi)
return SR_ERR; return SR_ERR;
devc = sdi->priv;
*data = g_variant_new_boolean(devc->status != DSL_INIT); *data = g_variant_new_boolean(devc->status != DSL_INIT);
break; break;
default: default:
...@@ -1589,6 +1596,8 @@ static int config_set(int id, GVariant *data, struct sr_dev_inst *sdi, ...@@ -1589,6 +1596,8 @@ static int config_set(int id, GVariant *data, struct sr_dev_inst *sdi,
} else { } else {
ret = SR_ERR; ret = SR_ERR;
} }
if (devc->cur_samplerate > samplerates[devc->samplerates_size-1])
devc->cur_samplerate = samplerates[devc->samplerates_size-1];
sr_dbg("%s: setting pattern to %d", sr_dbg("%s: setting pattern to %d",
__func__, devc->op_mode); __func__, devc->op_mode);
} else if (id == SR_CONF_CHANNEL_MODE) { } else if (id == SR_CONF_CHANNEL_MODE) {
...@@ -1611,6 +1620,8 @@ static int config_set(int id, GVariant *data, struct sr_dev_inst *sdi, ...@@ -1611,6 +1620,8 @@ static int config_set(int id, GVariant *data, struct sr_dev_inst *sdi,
break; break;
} }
} }
if (devc->cur_samplerate > samplerates[devc->samplerates_size-1])
devc->cur_samplerate = samplerates[devc->samplerates_size-1];
sr_dbg("%s: setting channel mode to %d", sr_dbg("%s: setting channel mode to %d",
__func__, devc->ch_mode); __func__, devc->ch_mode);
} else if (id == SR_CONF_THRESHOLD) { } else if (id == SR_CONF_THRESHOLD) {
...@@ -1897,7 +1908,7 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, ...@@ -1897,7 +1908,7 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
*data = g_variant_new_string(TRIGGER_TYPE); *data = g_variant_new_string(TRIGGER_TYPE);
break; break;
case SR_CONF_OPERATION_MODE: case SR_CONF_OPERATION_MODE:
*data = g_variant_new_strv(opmodes, ARRAY_SIZE(opmodes)); *data = g_variant_new_strv(opmodes, opmodes_show_count);
break; break;
case SR_CONF_CHANNEL_MODE: case SR_CONF_CHANNEL_MODE:
if (devc->stream) if (devc->stream)
...@@ -2356,13 +2367,6 @@ static int dev_transfer_start(const struct sr_dev_inst *sdi) ...@@ -2356,13 +2367,6 @@ static int dev_transfer_start(const struct sr_dev_inst *sdi)
else else
dso_buffer_size = devc->limit_samples * channel_en_cnt + 512; dso_buffer_size = devc->limit_samples * channel_en_cnt + 512;
// if (sdi->mode == DSO) {
// timeout = 500;
// num_transfers = buffer_cnt;
// } else {
// timeout = get_timeout(devc);
// num_transfers = get_number_of_transfers(devc);
// }
num_transfers = 1; num_transfers = 1;
size = (sdi->mode == ANALOG) ? cons_buffer_size : ((sdi->mode == DSO) ? dso_buffer_size : get_buffer_size(devc)); size = (sdi->mode == ANALOG) ? cons_buffer_size : ((sdi->mode == DSO) ? dso_buffer_size : get_buffer_size(devc));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment