Disable the real-time mode when device is not stream mode

This commit is contained in:
dreamsourcelabTAI 2023-03-22 16:42:23 +08:00
parent 6cbd47cbba
commit 9092e5d617
7 changed files with 86 additions and 60 deletions

View File

@ -345,5 +345,18 @@ GSList *DeviceAgent::get_channels()
return false;
}
bool DeviceAgent::get_config_value_int16(int key, int &value)
{
GVariant* gvar = this->get_config(NULL, NULL, key);
if (gvar != NULL) {
value = g_variant_get_int16(gvar);
g_variant_unref(gvar);
return true;
}
return false;
}
//---------------device config end -----------/

View File

@ -103,6 +103,8 @@ public:
bool set_channel_name(int ch_index, const char *name);
bool get_config_value_int16(int key, int &value);
/**
* @brief Gets the sample limit from the driver.
*

View File

@ -1767,6 +1767,10 @@ namespace pv
_sampling_bar->commit_settings();
}
break;
case DSV_MSG_END_DEVICE_OPTIONS:
break;
}
}

View File

@ -310,6 +310,8 @@ namespace pv
_sample_rate.setDisabled(false);
}
}
this->reload();
}
_session->broadcast_msg(DSV_MSG_END_DEVICE_OPTIONS);
@ -901,7 +903,7 @@ namespace pv
if (_instant_action->isVisible() == false){
return;
}
if (_session->is_working())
{
bool wait_upload = false;
@ -956,7 +958,7 @@ namespace pv
else
{
_device_agent->set_config(NULL, NULL, SR_CONF_ZERO, g_variant_new_boolean(false));
update_view_status();
update_view_status();
}
return;
}
@ -1041,28 +1043,37 @@ namespace pv
{
QString iconPath = GetIconPath();
if (_device_agent->get_work_mode() == LOGIC)
int mode = _device_agent->get_work_mode();
if (mode == LOGIC)
{
if (_device_agent->name() == "virtual-session")
{
if (_device_agent->is_file()){
_mode_action->setVisible(false);
}
else
{
update_mode_icon();
_mode_action->setVisible(true);
_action_repeat->setVisible(true);
if (_device_agent->is_hardware())
{
int mode_val = 0;
if (_device_agent->get_config_value_int16(SR_CONF_OPERATION_MODE, mode_val)){
_action_realtime->setVisible(mode_val == LO_OP_STREAM);
}
}
}
_run_stop_action->setVisible(true);
_instant_action->setVisible(true);
_instant_action->setVisible(true);
}
else if (_device_agent->get_work_mode() == ANALOG)
else if (mode == ANALOG)
{
_mode_action->setVisible(false);
_run_stop_action->setVisible(true);
_instant_action->setVisible(false);
}
else if (_device_agent->get_work_mode() == DSO)
else if (mode == DSO)
{
_mode_action->setVisible(false);
_run_stop_action->setVisible(true);
@ -1156,8 +1167,8 @@ namespace pv
on_configure();
}
void SamplingBar::update_view_status()
{
void SamplingBar::update_view_status()
{
int bEnable = _session->is_working() == false;
int mode = _session->get_device()->get_work_mode();
@ -1170,10 +1181,6 @@ namespace pv
_configure_button.setEnabled(bEnable);
_device_selector.setEnabled(bEnable);
bool bNotFile = _session->get_device()->is_file() == false;
_action_repeat->setVisible(bNotFile);
_action_realtime->setVisible(bNotFile);
if (_session->get_device()->is_file()){
_sample_rate.setEnabled(false);
_sample_count.setEnabled(false);

View File

@ -32,9 +32,9 @@ static int dev_destroy(struct sr_dev_inst *sdi);
enum DSCOPE_OPERATION_MODE
{
/** Normal */
OP_NORMAL = 0,
DS_OP_NORMAL = 0,
/** Internal pattern test mode */
OP_INTEST = 1,
DS_OP_INTEST = 1,
};
enum {
@ -43,8 +43,8 @@ enum {
};
static const struct sr_list_item opmode_list[] = {
{OP_NORMAL,"Normal"},
{OP_INTEST,"Internal Test"},
{DS_OP_NORMAL,"Normal"},
{DS_OP_INTEST,"Internal Test"},
{-1, NULL},
};
@ -56,8 +56,8 @@ static const struct sr_list_item bandwidth_list[] = {
static struct lang_text_map_item lang_text_map[] =
{
{SR_CONF_OPERATION_MODE, OP_NORMAL, "Normal", "正常"},
{SR_CONF_OPERATION_MODE, OP_INTEST, "Internal Test", "内部测试"},
{SR_CONF_OPERATION_MODE, DS_OP_NORMAL, "Normal", "正常"},
{SR_CONF_OPERATION_MODE, DS_OP_INTEST, "Internal Test", "内部测试"},
{SR_CONF_BANDWIDTH_LIMIT, BW_FULL, "Full Bandwidth", "全带宽"},
{SR_CONF_BANDWIDTH_LIMIT, BW_20M, "20MHz", NULL},
@ -139,7 +139,7 @@ static struct DSL_context *DSCope_dev_new(const struct DSL_profile *prof)
devc->clock_type = FALSE;
devc->clock_edge = FALSE;
devc->instant = FALSE;
devc->op_mode = OP_NORMAL;
devc->op_mode = DS_OP_NORMAL;
devc->test_mode = SR_TEST_NONE;
devc->stream = FALSE;
devc->ch_mode = prof->dev_caps.default_channelmode;
@ -1349,7 +1349,7 @@ static int config_set(int id, GVariant *data, struct sr_dev_inst *sdi,
sr_dbg("%s: Initial setting for DSO mode", __func__);
else
sr_dbg("%s: Initial setting for DSO mode failed", __func__);
devc->op_mode = OP_NORMAL;
devc->op_mode = DS_OP_NORMAL;
devc->test_mode = SR_TEST_NONE;
devc->instant = FALSE;
for (i = 0; i < ARRAY_SIZE(channel_modes); i++) {
@ -1369,7 +1369,7 @@ static int config_set(int id, GVariant *data, struct sr_dev_inst *sdi,
sr_dbg("%s: Initial setting for DSO mode", __func__);
else
sr_dbg("%s: Initial setting for DSO mode failed", __func__);
devc->op_mode = OP_NORMAL;
devc->op_mode = DS_OP_NORMAL;
devc->test_mode = SR_TEST_NONE;
devc->instant = TRUE;
for (i = 0; i < ARRAY_SIZE(channel_modes); i++) {
@ -1391,12 +1391,12 @@ static int config_set(int id, GVariant *data, struct sr_dev_inst *sdi,
}
else if (id == SR_CONF_OPERATION_MODE) {
nv = g_variant_get_int16(data);
if (nv == OP_NORMAL) {
devc->op_mode = OP_NORMAL;
if (nv == DS_OP_NORMAL) {
devc->op_mode = DS_OP_NORMAL;
devc->test_mode = SR_TEST_NONE;
}
else if (nv == OP_INTEST) {
devc->op_mode = OP_INTEST;
else if (nv == DS_OP_INTEST) {
devc->op_mode = DS_OP_INTEST;
devc->test_mode = SR_TEST_INTERNAL;
}
else {

View File

@ -38,20 +38,6 @@ static const char *maxHeights[] = {
"5X",
};
enum DSLOGIC_OPERATION_MODE
{
/** Buffer mode */
OP_BUFFER = 0,
/** Stream mode */
OP_STREAM = 1,
/** Internal pattern test mode */
OP_INTEST = 2,
/** External pattern test mode */
OP_EXTEST = 3,
/** SDRAM loopback test mode */
OP_LPTEST = 4,
};
/** Device buffer mode */
enum DSLOGIC_BUFFER_OPT_MODE
{
@ -62,9 +48,9 @@ enum DSLOGIC_BUFFER_OPT_MODE
};
static const struct sr_list_item opmode_list[] = {
{OP_BUFFER,"Buffer Mode"},
{OP_STREAM,"Stream Mode"},
{OP_INTEST,"Internal Test"},
{LO_OP_BUFFER,"Buffer Mode"},
{LO_OP_STREAM,"Stream Mode"},
{LO_OP_INTEST,"Internal Test"},
//{OP_EXTEST,"External Test"}, // Removed
//{OP_LPTEST,"DRAM Loopback Test"},
{-1, NULL},
@ -93,11 +79,11 @@ static struct sr_list_item channel_mode_list[CHANNEL_MODE_LIST_LEN];
static struct lang_text_map_item lang_text_map[] =
{
{SR_CONF_OPERATION_MODE, OP_BUFFER, "Buffer Mode", "Buffer模式"},
{SR_CONF_OPERATION_MODE, OP_STREAM, "Stream Mode", "Stream模式"},
{SR_CONF_OPERATION_MODE, OP_INTEST, "Internal Test", "内部测试"},
{SR_CONF_OPERATION_MODE, OP_EXTEST, "External Test", "外部测试"},
{SR_CONF_OPERATION_MODE, OP_LPTEST, "DRAM Loopback Test", "内存回环测试"},
{SR_CONF_OPERATION_MODE, LO_OP_BUFFER, "Buffer Mode", "Buffer模式"},
{SR_CONF_OPERATION_MODE, LO_OP_STREAM, "Stream Mode", "Stream模式"},
{SR_CONF_OPERATION_MODE, LO_OP_INTEST, "Internal Test", "内部测试"},
{SR_CONF_OPERATION_MODE, LO_OP_EXTEST, "External Test", "外部测试"},
{SR_CONF_OPERATION_MODE, LO_OP_LPTEST, "DRAM Loopback Test", "内存回环测试"},
{SR_CONF_BUFFER_OPTIONS, SR_BUF_STOP, "Stop immediately", "立即停止"},
{SR_CONF_BUFFER_OPTIONS, SR_BUF_UPLOAD, "Upload captured data", "上传已采集的数据"},
@ -240,10 +226,10 @@ static struct DSL_context *DSLogic_dev_new(const struct DSL_profile *prof)
devc->clock_edge = FALSE;
devc->rle_mode = FALSE;
devc->instant = FALSE;
devc->op_mode = OP_STREAM;
devc->op_mode = LO_OP_STREAM;
devc->test_mode = SR_TEST_NONE;
devc->ch_mode = prof->dev_caps.default_channelmode;
devc->stream = (devc->op_mode == OP_STREAM);
devc->stream = (devc->op_mode == LO_OP_STREAM);
devc->buf_options = SR_BUF_UPLOAD;
devc->th_level = SR_TH_3V3;
devc->vth = 1.0;
@ -953,7 +939,7 @@ static int config_set(int id, GVariant *data, struct sr_dev_inst *sdi,
ret = dsl_wr_dso(sdi, dso_cmd_gen(sdi, NULL, SR_CONF_DSO_SYNC));
if (ret != SR_OK)
sr_dbg("%s: DAQ configuration sync failed", __func__);
devc->op_mode = OP_STREAM;
devc->op_mode = LO_OP_STREAM;
devc->test_mode = SR_TEST_NONE;
for (i = 0; i < ARRAY_SIZE(channel_modes); i++) {
if (channel_modes[i].mode == ANALOG &&
@ -984,8 +970,8 @@ static int config_set(int id, GVariant *data, struct sr_dev_inst *sdi,
if (sdi->mode == LOGIC && devc->op_mode != nv)
{
if (nv == OP_BUFFER) {
devc->op_mode = OP_BUFFER;
if (nv == LO_OP_BUFFER) {
devc->op_mode = LO_OP_BUFFER;
devc->test_mode = SR_TEST_NONE;
devc->stream = FALSE;
@ -998,8 +984,8 @@ static int config_set(int id, GVariant *data, struct sr_dev_inst *sdi,
}
}
}
else if (nv == OP_STREAM) {
devc->op_mode = OP_STREAM;
else if (nv == LO_OP_STREAM) {
devc->op_mode = LO_OP_STREAM;
devc->test_mode = SR_TEST_NONE;
devc->stream = TRUE;
@ -1012,8 +998,8 @@ static int config_set(int id, GVariant *data, struct sr_dev_inst *sdi,
}
}
}
else if (nv == OP_INTEST) {
devc->op_mode = OP_INTEST;
else if (nv == LO_OP_INTEST) {
devc->op_mode = LO_OP_INTEST;
devc->test_mode = SR_TEST_INTERNAL;
devc->ch_mode = devc->profile->dev_caps.intest_channel;
devc->stream = !(devc->profile->dev_caps.feature_caps & CAPS_FEATURE_BUF);
@ -1025,7 +1011,7 @@ static int config_set(int id, GVariant *data, struct sr_dev_inst *sdi,
dsl_adjust_probes(sdi, channel_modes[devc->ch_mode].num);
dsl_adjust_samplerate(devc);
if (devc->op_mode == OP_INTEST) {
if (devc->op_mode == LO_OP_INTEST) {
devc->cur_samplerate = devc->stream ? channel_modes[devc->ch_mode].max_samplerate / 10 :
SR_MHZ(100);
devc->limit_samples = devc->stream ? devc->cur_samplerate * 3 :

View File

@ -306,6 +306,20 @@ enum {
SR_MQFLAG_SPL_PCT_OVER_ALARM = 0x10000,
};
enum DSLOGIC_OPERATION_MODE
{
/** Buffer mode */
LO_OP_BUFFER = 0,
/** Stream mode */
LO_OP_STREAM = 1,
/** Internal pattern test mode */
LO_OP_INTEST = 2,
/** External pattern test mode */
LO_OP_EXTEST = 3,
/** SDRAM loopback test mode */
LO_OP_LPTEST = 4,
};
enum DSO_MEASURE_TYPE {
DSO_MS_BEGIN = 0,
DSO_MS_FREQ,