Skip to content

Commit c180b10

Browse files
fix conflict issue when read status from hardware
1 parent 040475c commit c180b10

File tree

14 files changed

+19
-50
lines changed

14 files changed

+19
-50
lines changed

DSView/pv/sigsession.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ bool SigSession::get_capture_status(bool &triggered, int &progress)
443443
{
444444
uint64_t sample_limits = cur_samplelimits();
445445
sr_status status;
446-
if (sr_status_get(_dev_inst->dev_inst(), &status, SR_STATUS_TRIG_BEGIN, SR_STATUS_TRIG_END) == SR_OK){
446+
if (sr_status_get(_dev_inst->dev_inst(), &status, true, SR_STATUS_TRIG_BEGIN, SR_STATUS_TRIG_END) == SR_OK){
447447
triggered = status.trig_hit & 0x01;
448448
uint64_t captured_cnt = status.trig_hit >> 2;
449449
captured_cnt = ((uint64_t)status.captured_cnt0 +

DSView/pv/storesession.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ QString StoreSession::meta_gen(boost::shared_ptr<data::Snapshot> snapshot)
344344
fprintf(meta, " vFactor%d = %d\n", probe->index, probe->vfactor);
345345
fprintf(meta, " vPos%d = %lf\n", probe->index, probe->vpos);
346346
fprintf(meta, " vTrig%d = %d\n", probe->index, probe->trig_value);
347-
if (sr_status_get(sdi, &status, 0, 0) == SR_OK) {
347+
if (sr_status_get(sdi, &status, false, 0, 0) == SR_OK) {
348348
if (probe->index == 0) {
349349
fprintf(meta, " period%d = %" PRIu64 "\n", probe->index, status.ch0_period);
350350
fprintf(meta, " pcnt%d = %" PRIu32 "\n", probe->index, status.ch0_pcnt);

DSView/pv/view/dsosignal.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1343,7 +1343,7 @@ void DsoSignal::paint_measure(QPainter &p)
13431343
int index = get_index();
13441344
const int st_begin = (index == 0) ? SR_STATUS_CH0_BEGIN : SR_STATUS_CH1_BEGIN;
13451345
const int st_end = (index == 0) ? SR_STATUS_CH0_END : SR_STATUS_CH1_END;
1346-
if (sr_status_get(_dev_inst->dev_inst(), &status, st_begin, st_end) == SR_OK) {
1346+
if (sr_status_get(_dev_inst->dev_inst(), &status, false, st_begin, st_end) == SR_OK) {
13471347
_max = (index == 0) ? status.ch0_max : status.ch1_max;
13481348
_min = (index == 0) ? status.ch0_min : status.ch1_min;
13491349
const uint64_t period = (index == 0) ? status.ch0_period : status.ch1_period;

DSView/pv/view/view.cpp

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1129,33 +1129,6 @@ void View::repeat_show()
11291129
_viewbottom->update();
11301130
}
11311131

1132-
bool View::get_capture_status(bool &triggered, int &progress)
1133-
{
1134-
uint64_t sample_limits = _session.cur_samplelimits();
1135-
sr_status status;
1136-
if (sr_status_get(_session.get_device()->dev_inst(), &status, SR_STATUS_TRIG_BEGIN, SR_STATUS_TRIG_END) == SR_OK){
1137-
triggered = status.trig_hit & 0x01;
1138-
const bool captured_cnt_dec = status.trig_hit & 0x02;
1139-
uint64_t captured_cnt = status.trig_hit >> 2;
1140-
captured_cnt = ((uint64_t)status.captured_cnt0 +
1141-
((uint64_t)status.captured_cnt1 << 8) +
1142-
((uint64_t)status.captured_cnt2 << 16) +
1143-
((uint64_t)status.captured_cnt3 << 24) +
1144-
(captured_cnt << 32));
1145-
if (_session.get_device()->dev_inst()->mode == DSO)
1146-
captured_cnt = captured_cnt * _session.get_signals().size() / _session.get_ch_num(SR_CHANNEL_DSO);
1147-
if (captured_cnt_dec)
1148-
progress = (sample_limits - captured_cnt) * 100.0 / sample_limits;
1149-
else
1150-
progress = captured_cnt * 100.0 / sample_limits;
1151-
1152-
1153-
return true;
1154-
}
1155-
1156-
return false;
1157-
}
1158-
11591132
void View::set_capture_status()
11601133
{
11611134
bool triggered;

DSView/pv/view/view.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,6 @@ class View : public QScrollArea {
192192

193193
void viewport_update();
194194

195-
bool get_capture_status(bool &triggered, int &progress);
196195
void set_capture_status();
197196

198197
bool get_dso_trig_moved() const;

libsigrok4DSL/hardware/DSL/dscope.c

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1633,15 +1633,10 @@ static int dev_acquisition_stop(const struct sr_dev_inst *sdi, void *cb_data)
16331633
return ret;
16341634
}
16351635

1636-
static int dev_status_get(const struct sr_dev_inst *sdi, struct sr_status *status, int begin, int end)
1636+
static int dev_status_get(const struct sr_dev_inst *sdi, struct sr_status *status, gboolean prg, int begin, int end)
16371637
{
1638-
struct DSL_context *devc = sdi->priv;
1639-
if (devc->instant || devc->status == DSL_DATA) {
1640-
int ret = dsl_dev_status_get(sdi, status, begin, end);
1641-
return ret;
1642-
} else {
1643-
return FALSE;
1644-
}
1638+
int ret = dsl_dev_status_get(sdi, status, prg, begin, end);
1639+
return ret;
16451640
}
16461641

16471642
SR_PRIV struct sr_dev_driver DSCope_driver_info = {

libsigrok4DSL/hardware/DSL/dsl.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1082,7 +1082,7 @@ SR_PRIV int dsl_dev_acquisition_stop(const struct sr_dev_inst *sdi, void *cb_dat
10821082
return SR_OK;
10831083
}
10841084

1085-
SR_PRIV int dsl_dev_status_get(const struct sr_dev_inst *sdi, struct sr_status *status, int begin, int end)
1085+
SR_PRIV int dsl_dev_status_get(const struct sr_dev_inst *sdi, struct sr_status *status, gboolean prg, int begin, int end)
10861086
{
10871087
int ret = SR_ERR;
10881088
struct ctl_rd_cmd rd_cmd;
@@ -1093,7 +1093,7 @@ SR_PRIV int dsl_dev_status_get(const struct sr_dev_inst *sdi, struct sr_status *
10931093

10941094
devc = sdi->priv;
10951095
usb = sdi->conn;
1096-
if (devc->status == DSL_START) {
1096+
if (prg && (devc->status == DSL_START)) {
10971097
rd_cmd.header.dest = DSL_CTL_DSO_MEASURE;
10981098
rd_cmd.header.offset = begin;
10991099
rd_cmd.header.size = end - begin + 1;

libsigrok4DSL/hardware/DSL/dsl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ SR_PRIV int dsl_config_get(int id, GVariant **data, const struct sr_dev_inst *sd
418418
SR_PRIV int dsl_dev_open(struct sr_dev_driver *di, struct sr_dev_inst *sdi, gboolean *fpga_done);
419419
SR_PRIV int dsl_dev_close(struct sr_dev_inst *sdi);
420420
SR_PRIV int dsl_dev_acquisition_stop(const struct sr_dev_inst *sdi, void *cb_data);
421-
SR_PRIV int dsl_dev_status_get(const struct sr_dev_inst *sdi, struct sr_status *status, int begin, int end);
421+
SR_PRIV int dsl_dev_status_get(const struct sr_dev_inst *sdi, struct sr_status *status, gboolean prg, int begin, int end);
422422

423423
SR_PRIV unsigned int dsl_get_timeout(struct DSL_context *devc);
424424
SR_PRIV int dsl_start_transfers(const struct sr_dev_inst *sdi);

libsigrok4DSL/hardware/DSL/dslogic.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1498,9 +1498,9 @@ static int dev_acquisition_stop(const struct sr_dev_inst *sdi, void *cb_data)
14981498
return ret;
14991499
}
15001500

1501-
static int dev_status_get(const struct sr_dev_inst *sdi, struct sr_status *status, int begin, int end)
1501+
static int dev_status_get(const struct sr_dev_inst *sdi, struct sr_status *status, gboolean prg, int begin, int end)
15021502
{
1503-
int ret = dsl_dev_status_get(sdi, status, begin, end);
1503+
int ret = dsl_dev_status_get(sdi, status, prg, begin, end);
15041504
return ret;
15051505
}
15061506

libsigrok4DSL/hardware/demo/demo.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1179,8 +1179,9 @@ static int hw_dev_acquisition_stop(const struct sr_dev_inst *sdi, void *cb_data)
11791179
return SR_OK;
11801180
}
11811181

1182-
static int hw_dev_status_get(const struct sr_dev_inst *sdi, struct sr_status *status, int begin, int end)
1182+
static int hw_dev_status_get(const struct sr_dev_inst *sdi, struct sr_status *status, gboolean prg, int begin, int end)
11831183
{
1184+
(void)prg;
11841185
(void)begin;
11851186
(void)end;
11861187
if (sdi) {

0 commit comments

Comments
 (0)