mirror of
https://github.com/DreamSourceLab/DSView.git
synced 2025-01-23 13:42:55 +08:00
fix conflict issue when read status from hardware
This commit is contained in:
parent
040475c67a
commit
c180b108de
@ -443,7 +443,7 @@ bool SigSession::get_capture_status(bool &triggered, int &progress)
|
|||||||
{
|
{
|
||||||
uint64_t sample_limits = cur_samplelimits();
|
uint64_t sample_limits = cur_samplelimits();
|
||||||
sr_status status;
|
sr_status status;
|
||||||
if (sr_status_get(_dev_inst->dev_inst(), &status, SR_STATUS_TRIG_BEGIN, SR_STATUS_TRIG_END) == SR_OK){
|
if (sr_status_get(_dev_inst->dev_inst(), &status, true, SR_STATUS_TRIG_BEGIN, SR_STATUS_TRIG_END) == SR_OK){
|
||||||
triggered = status.trig_hit & 0x01;
|
triggered = status.trig_hit & 0x01;
|
||||||
uint64_t captured_cnt = status.trig_hit >> 2;
|
uint64_t captured_cnt = status.trig_hit >> 2;
|
||||||
captured_cnt = ((uint64_t)status.captured_cnt0 +
|
captured_cnt = ((uint64_t)status.captured_cnt0 +
|
||||||
|
@ -344,7 +344,7 @@ QString StoreSession::meta_gen(boost::shared_ptr<data::Snapshot> snapshot)
|
|||||||
fprintf(meta, " vFactor%d = %d\n", probe->index, probe->vfactor);
|
fprintf(meta, " vFactor%d = %d\n", probe->index, probe->vfactor);
|
||||||
fprintf(meta, " vPos%d = %lf\n", probe->index, probe->vpos);
|
fprintf(meta, " vPos%d = %lf\n", probe->index, probe->vpos);
|
||||||
fprintf(meta, " vTrig%d = %d\n", probe->index, probe->trig_value);
|
fprintf(meta, " vTrig%d = %d\n", probe->index, probe->trig_value);
|
||||||
if (sr_status_get(sdi, &status, 0, 0) == SR_OK) {
|
if (sr_status_get(sdi, &status, false, 0, 0) == SR_OK) {
|
||||||
if (probe->index == 0) {
|
if (probe->index == 0) {
|
||||||
fprintf(meta, " period%d = %" PRIu64 "\n", probe->index, status.ch0_period);
|
fprintf(meta, " period%d = %" PRIu64 "\n", probe->index, status.ch0_period);
|
||||||
fprintf(meta, " pcnt%d = %" PRIu32 "\n", probe->index, status.ch0_pcnt);
|
fprintf(meta, " pcnt%d = %" PRIu32 "\n", probe->index, status.ch0_pcnt);
|
||||||
|
@ -1343,7 +1343,7 @@ void DsoSignal::paint_measure(QPainter &p)
|
|||||||
int index = get_index();
|
int index = get_index();
|
||||||
const int st_begin = (index == 0) ? SR_STATUS_CH0_BEGIN : SR_STATUS_CH1_BEGIN;
|
const int st_begin = (index == 0) ? SR_STATUS_CH0_BEGIN : SR_STATUS_CH1_BEGIN;
|
||||||
const int st_end = (index == 0) ? SR_STATUS_CH0_END : SR_STATUS_CH1_END;
|
const int st_end = (index == 0) ? SR_STATUS_CH0_END : SR_STATUS_CH1_END;
|
||||||
if (sr_status_get(_dev_inst->dev_inst(), &status, st_begin, st_end) == SR_OK) {
|
if (sr_status_get(_dev_inst->dev_inst(), &status, false, st_begin, st_end) == SR_OK) {
|
||||||
_max = (index == 0) ? status.ch0_max : status.ch1_max;
|
_max = (index == 0) ? status.ch0_max : status.ch1_max;
|
||||||
_min = (index == 0) ? status.ch0_min : status.ch1_min;
|
_min = (index == 0) ? status.ch0_min : status.ch1_min;
|
||||||
const uint64_t period = (index == 0) ? status.ch0_period : status.ch1_period;
|
const uint64_t period = (index == 0) ? status.ch0_period : status.ch1_period;
|
||||||
|
@ -1129,33 +1129,6 @@ void View::repeat_show()
|
|||||||
_viewbottom->update();
|
_viewbottom->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool View::get_capture_status(bool &triggered, int &progress)
|
|
||||||
{
|
|
||||||
uint64_t sample_limits = _session.cur_samplelimits();
|
|
||||||
sr_status status;
|
|
||||||
if (sr_status_get(_session.get_device()->dev_inst(), &status, SR_STATUS_TRIG_BEGIN, SR_STATUS_TRIG_END) == SR_OK){
|
|
||||||
triggered = status.trig_hit & 0x01;
|
|
||||||
const bool captured_cnt_dec = status.trig_hit & 0x02;
|
|
||||||
uint64_t captured_cnt = status.trig_hit >> 2;
|
|
||||||
captured_cnt = ((uint64_t)status.captured_cnt0 +
|
|
||||||
((uint64_t)status.captured_cnt1 << 8) +
|
|
||||||
((uint64_t)status.captured_cnt2 << 16) +
|
|
||||||
((uint64_t)status.captured_cnt3 << 24) +
|
|
||||||
(captured_cnt << 32));
|
|
||||||
if (_session.get_device()->dev_inst()->mode == DSO)
|
|
||||||
captured_cnt = captured_cnt * _session.get_signals().size() / _session.get_ch_num(SR_CHANNEL_DSO);
|
|
||||||
if (captured_cnt_dec)
|
|
||||||
progress = (sample_limits - captured_cnt) * 100.0 / sample_limits;
|
|
||||||
else
|
|
||||||
progress = captured_cnt * 100.0 / sample_limits;
|
|
||||||
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void View::set_capture_status()
|
void View::set_capture_status()
|
||||||
{
|
{
|
||||||
bool triggered;
|
bool triggered;
|
||||||
|
@ -192,7 +192,6 @@ public:
|
|||||||
|
|
||||||
void viewport_update();
|
void viewport_update();
|
||||||
|
|
||||||
bool get_capture_status(bool &triggered, int &progress);
|
|
||||||
void set_capture_status();
|
void set_capture_status();
|
||||||
|
|
||||||
bool get_dso_trig_moved() const;
|
bool get_dso_trig_moved() const;
|
||||||
|
@ -1633,15 +1633,10 @@ static int dev_acquisition_stop(const struct sr_dev_inst *sdi, void *cb_data)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int dev_status_get(const struct sr_dev_inst *sdi, struct sr_status *status, int begin, int end)
|
static int dev_status_get(const struct sr_dev_inst *sdi, struct sr_status *status, gboolean prg, int begin, int end)
|
||||||
{
|
{
|
||||||
struct DSL_context *devc = sdi->priv;
|
int ret = dsl_dev_status_get(sdi, status, prg, begin, end);
|
||||||
if (devc->instant || devc->status == DSL_DATA) {
|
return ret;
|
||||||
int ret = dsl_dev_status_get(sdi, status, begin, end);
|
|
||||||
return ret;
|
|
||||||
} else {
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SR_PRIV struct sr_dev_driver DSCope_driver_info = {
|
SR_PRIV struct sr_dev_driver DSCope_driver_info = {
|
||||||
|
@ -1082,7 +1082,7 @@ SR_PRIV int dsl_dev_acquisition_stop(const struct sr_dev_inst *sdi, void *cb_dat
|
|||||||
return SR_OK;
|
return SR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
SR_PRIV int dsl_dev_status_get(const struct sr_dev_inst *sdi, struct sr_status *status, int begin, int end)
|
SR_PRIV int dsl_dev_status_get(const struct sr_dev_inst *sdi, struct sr_status *status, gboolean prg, int begin, int end)
|
||||||
{
|
{
|
||||||
int ret = SR_ERR;
|
int ret = SR_ERR;
|
||||||
struct ctl_rd_cmd rd_cmd;
|
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 *
|
|||||||
|
|
||||||
devc = sdi->priv;
|
devc = sdi->priv;
|
||||||
usb = sdi->conn;
|
usb = sdi->conn;
|
||||||
if (devc->status == DSL_START) {
|
if (prg && (devc->status == DSL_START)) {
|
||||||
rd_cmd.header.dest = DSL_CTL_DSO_MEASURE;
|
rd_cmd.header.dest = DSL_CTL_DSO_MEASURE;
|
||||||
rd_cmd.header.offset = begin;
|
rd_cmd.header.offset = begin;
|
||||||
rd_cmd.header.size = end - begin + 1;
|
rd_cmd.header.size = end - begin + 1;
|
||||||
|
@ -418,7 +418,7 @@ SR_PRIV int dsl_config_get(int id, GVariant **data, const struct sr_dev_inst *sd
|
|||||||
SR_PRIV int dsl_dev_open(struct sr_dev_driver *di, struct sr_dev_inst *sdi, gboolean *fpga_done);
|
SR_PRIV int dsl_dev_open(struct sr_dev_driver *di, struct sr_dev_inst *sdi, gboolean *fpga_done);
|
||||||
SR_PRIV int dsl_dev_close(struct sr_dev_inst *sdi);
|
SR_PRIV int dsl_dev_close(struct sr_dev_inst *sdi);
|
||||||
SR_PRIV int dsl_dev_acquisition_stop(const struct sr_dev_inst *sdi, void *cb_data);
|
SR_PRIV int dsl_dev_acquisition_stop(const struct sr_dev_inst *sdi, void *cb_data);
|
||||||
SR_PRIV int dsl_dev_status_get(const struct sr_dev_inst *sdi, struct sr_status *status, int begin, int end);
|
SR_PRIV int dsl_dev_status_get(const struct sr_dev_inst *sdi, struct sr_status *status, gboolean prg, int begin, int end);
|
||||||
|
|
||||||
SR_PRIV unsigned int dsl_get_timeout(struct DSL_context *devc);
|
SR_PRIV unsigned int dsl_get_timeout(struct DSL_context *devc);
|
||||||
SR_PRIV int dsl_start_transfers(const struct sr_dev_inst *sdi);
|
SR_PRIV int dsl_start_transfers(const struct sr_dev_inst *sdi);
|
||||||
|
@ -1498,9 +1498,9 @@ static int dev_acquisition_stop(const struct sr_dev_inst *sdi, void *cb_data)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int dev_status_get(const struct sr_dev_inst *sdi, struct sr_status *status, int begin, int end)
|
static int dev_status_get(const struct sr_dev_inst *sdi, struct sr_status *status, gboolean prg, int begin, int end)
|
||||||
{
|
{
|
||||||
int ret = dsl_dev_status_get(sdi, status, begin, end);
|
int ret = dsl_dev_status_get(sdi, status, prg, begin, end);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1179,8 +1179,9 @@ static int hw_dev_acquisition_stop(const struct sr_dev_inst *sdi, void *cb_data)
|
|||||||
return SR_OK;
|
return SR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int hw_dev_status_get(const struct sr_dev_inst *sdi, struct sr_status *status, int begin, int end)
|
static int hw_dev_status_get(const struct sr_dev_inst *sdi, struct sr_status *status, gboolean prg, int begin, int end)
|
||||||
{
|
{
|
||||||
|
(void)prg;
|
||||||
(void)begin;
|
(void)begin;
|
||||||
(void)end;
|
(void)end;
|
||||||
if (sdi) {
|
if (sdi) {
|
||||||
|
@ -415,7 +415,7 @@ SR_API const struct sr_config_info *sr_config_info_get(int key)
|
|||||||
*/
|
*/
|
||||||
SR_API int sr_status_get(const struct sr_dev_inst *sdi,
|
SR_API int sr_status_get(const struct sr_dev_inst *sdi,
|
||||||
struct sr_status *status,
|
struct sr_status *status,
|
||||||
int begin, int end)
|
gboolean prg, int begin, int end)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
@ -424,7 +424,7 @@ SR_API int sr_status_get(const struct sr_dev_inst *sdi,
|
|||||||
else if (!sdi->driver->dev_status_get)
|
else if (!sdi->driver->dev_status_get)
|
||||||
ret = SR_ERR_ARG;
|
ret = SR_ERR_ARG;
|
||||||
else
|
else
|
||||||
ret = sdi->driver->dev_status_get(sdi, status, begin, end);
|
ret = sdi->driver->dev_status_get(sdi, status, prg, begin, end);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -1084,7 +1084,7 @@ struct sr_dev_driver {
|
|||||||
int (*dev_close) (struct sr_dev_inst *sdi);
|
int (*dev_close) (struct sr_dev_inst *sdi);
|
||||||
int (*dev_status_get) (const struct sr_dev_inst *sdi,
|
int (*dev_status_get) (const struct sr_dev_inst *sdi,
|
||||||
struct sr_status *status,
|
struct sr_status *status,
|
||||||
int begin, int end);
|
gboolean prg, int begin, int end);
|
||||||
int (*dev_acquisition_start) (struct sr_dev_inst *sdi,
|
int (*dev_acquisition_start) (struct sr_dev_inst *sdi,
|
||||||
void *cb_data);
|
void *cb_data);
|
||||||
int (*dev_acquisition_stop) (const struct sr_dev_inst *sdi,
|
int (*dev_acquisition_stop) (const struct sr_dev_inst *sdi,
|
||||||
|
@ -79,7 +79,7 @@ SR_API int sr_config_list(const struct sr_dev_driver *driver,
|
|||||||
int key, GVariant **data);
|
int key, GVariant **data);
|
||||||
SR_API const struct sr_config_info *sr_config_info_get(int key);
|
SR_API const struct sr_config_info *sr_config_info_get(int key);
|
||||||
SR_API const struct sr_config_info *sr_config_info_name_get(const char *optname);
|
SR_API const struct sr_config_info *sr_config_info_name_get(const char *optname);
|
||||||
SR_API int sr_status_get(const struct sr_dev_inst *sdi, struct sr_status *status, int begin, int end);
|
SR_API int sr_status_get(const struct sr_dev_inst *sdi, struct sr_status *status, gboolean prg, int begin, int end);
|
||||||
|
|
||||||
/*--- session.c -------------------------------------------------------------*/
|
/*--- session.c -------------------------------------------------------------*/
|
||||||
|
|
||||||
|
@ -624,8 +624,9 @@ static int config_list(int key, GVariant **data,
|
|||||||
return SR_OK;
|
return SR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int dev_status_get(const struct sr_dev_inst *sdi, struct sr_status *status, int begin, int end)
|
static int dev_status_get(const struct sr_dev_inst *sdi, struct sr_status *status, gboolean prg, int begin, int end)
|
||||||
{
|
{
|
||||||
|
(void)prg;
|
||||||
(void)begin;
|
(void)begin;
|
||||||
(void)end;
|
(void)end;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user