The saved session file does not use a string value, use a code value instead.

This commit is contained in:
dreamsourcelabTAI 2022-10-19 18:41:13 +08:00
parent 7bf81734d4
commit da1461640f
18 changed files with 467 additions and 579 deletions

View File

@ -302,11 +302,6 @@ const struct sr_config_info *DeviceAgent::get_config_info(int key)
return ds_get_actived_device_config_info(key); return ds_get_actived_device_config_info(key);
} }
const struct sr_config_info *DeviceAgent::get_config_info_by_name(const char *optname)
{
return ds_get_actived_device_config_info_by_name(optname);
}
bool DeviceAgent::get_device_status(struct sr_status &status, gboolean prg) bool DeviceAgent::get_device_status(struct sr_status &status, gboolean prg)
{ {
if (ds_get_actived_device_status(&status, prg) == SR_OK) if (ds_get_actived_device_status(&status, prg) == SR_OK)

View File

@ -173,8 +173,6 @@ public:
const struct sr_config_info* get_config_info(int key); const struct sr_config_info* get_config_info(int key);
const struct sr_config_info* get_config_info_by_name(const char *optname);
bool get_device_status(struct sr_status &status, gboolean prg); bool get_device_status(struct sr_status &status, gboolean prg);
struct sr_config* new_config(int key, GVariant *data); struct sr_config* new_config(int key, GVariant *data);

View File

@ -599,6 +599,124 @@ namespace pv
return load_session_json(sessionDoc, bDone); return load_session_json(sessionDoc, bDone);
} }
bool MainWindow::gen_session_json(QJsonObject &sessionVar)
{
AppConfig &app = AppConfig::Instance();
GVariant *gvar_opts;
GVariant *gvar;
gsize num_opts;
QString title = QApplication::applicationName() + " v" + QApplication::applicationVersion();
QJsonArray channelVar;
sessionVar["Version"] = QJsonValue::fromVariant(BASE_SESSION_VERSION);
sessionVar["Device"] = QJsonValue::fromVariant(_device_agent->driver_name());
sessionVar["DeviceMode"] = QJsonValue::fromVariant(_device_agent->get_work_mode());
sessionVar["Language"] = QJsonValue::fromVariant(app._frameOptions.language);
sessionVar["Title"] = QJsonValue::fromVariant(title);
gvar_opts = _device_agent->get_config_list(NULL, SR_CONF_DEVICE_SESSIONS);
if (gvar_opts == NULL)
{
dsv_warn("%s", "Device config list is empty. id:SR_CONF_DEVICE_SESSIONS");
/* Driver supports no device instance sessions. */
return false;
}
const int *const options = (const int32_t *)g_variant_get_fixed_array(
gvar_opts, &num_opts, sizeof(int32_t));
for (unsigned int i = 0; i < num_opts; i++)
{
const struct sr_config_info *const info = _device_agent->get_config_info(options[i]);
gvar = _device_agent->get_config(NULL, NULL, info->key);
if (gvar != NULL)
{
if (info->datatype == SR_T_BOOL)
sessionVar[info->name] = QJsonValue::fromVariant(g_variant_get_boolean(gvar));
else if (info->datatype == SR_T_UINT64)
sessionVar[info->name] = QJsonValue::fromVariant(QString::number(g_variant_get_uint64(gvar)));
else if (info->datatype == SR_T_UINT8)
sessionVar[info->name] = QJsonValue::fromVariant(QString::number(g_variant_get_byte(gvar)));
else if (info->datatype == SR_T_FLOAT)
sessionVar[info->name] = QJsonValue::fromVariant(g_variant_get_double(gvar));
else if (info->datatype == SR_T_CHAR)
sessionVar[info->name] = QJsonValue::fromVariant(g_variant_get_string(gvar, NULL));
else if (info->datatype == SR_T_LIST)
sessionVar[info->name] = QJsonValue::fromVariant(QString::number(g_variant_get_uint16(gvar)));
else{
dsv_err("Unkown config info type:%d", info->datatype);
assert(false);
}
g_variant_unref(gvar);
}
}
for (auto &s : _session->get_signals())
{
QJsonObject s_obj;
s_obj["index"] = s->get_index();
s_obj["type"] = s->get_type();
s_obj["enabled"] = s->enabled();
s_obj["name"] = s->get_name();
if (s->get_colour().isValid())
s_obj["colour"] = QJsonValue::fromVariant(s->get_colour());
else
s_obj["colour"] = QJsonValue::fromVariant("default");
view::LogicSignal *logicSig = NULL;
if ((logicSig = dynamic_cast<view::LogicSignal *>(s)))
{
s_obj["strigger"] = logicSig->get_trig();
}
view::DsoSignal *dsoSig = NULL;
if ((dsoSig = dynamic_cast<view::DsoSignal *>(s)))
{
s_obj["vdiv"] = QJsonValue::fromVariant(static_cast<qulonglong>(dsoSig->get_vDialValue()));
s_obj["vfactor"] = QJsonValue::fromVariant(static_cast<qulonglong>(dsoSig->get_factor()));
s_obj["coupling"] = dsoSig->get_acCoupling();
s_obj["trigValue"] = dsoSig->get_trig_vrate();
s_obj["zeroPos"] = dsoSig->get_zero_ratio();
}
view::AnalogSignal *analogSig = NULL;
if ((analogSig = dynamic_cast<view::AnalogSignal *>(s)))
{
s_obj["vdiv"] = QJsonValue::fromVariant(static_cast<qulonglong>(analogSig->get_vdiv()));
s_obj["vfactor"] = QJsonValue::fromVariant(static_cast<qulonglong>(analogSig->get_factor()));
s_obj["coupling"] = analogSig->get_acCoupling();
s_obj["zeroPos"] = analogSig->get_zero_ratio();
s_obj["mapUnit"] = analogSig->get_mapUnit();
s_obj["mapMin"] = analogSig->get_mapMin();
s_obj["mapMax"] = analogSig->get_mapMax();
}
channelVar.append(s_obj);
}
sessionVar["channel"] = channelVar;
if (_device_agent->get_work_mode() == LOGIC)
{
sessionVar["trigger"] = _trigger_widget->get_session();
}
StoreSession ss(_session);
QJsonArray decodeJson;
ss.json_decoders(decodeJson);
sessionVar["decoder"] = decodeJson;
if (_device_agent->get_work_mode() == DSO)
{
sessionVar["measure"] = _view->get_viewstatus()->get_session();
}
if (gvar_opts != NULL)
g_variant_unref(gvar_opts);
return true;
}
bool MainWindow::load_session_json(QJsonDocument json, bool &haveDecoder) bool MainWindow::load_session_json(QJsonDocument json, bool &haveDecoder)
{ {
haveDecoder = false; haveDecoder = false;
@ -606,6 +724,7 @@ namespace pv
QJsonObject sessionObj = json.object(); QJsonObject sessionObj = json.object();
int mode = _device_agent->get_work_mode(); int mode = _device_agent->get_work_mode();
bool isNew = false;
// check session file version // check session file version
if (!sessionObj.contains("Version")) if (!sessionObj.contains("Version"))
@ -620,16 +739,15 @@ namespace pv
return false; return false;
} }
// old version(<= 1.1.2), restore the language if (sessionObj.contains("Title"))
if (sessionObj["Version"].toInt() == BASE_SESSION_VERSION) isNew = true;
{
} int sessionMode = sessionObj["DeviceMode"].toInt();
if (_device_agent->is_hardware()) if (_device_agent->is_hardware())
{ {
QString driverName = _device_agent->driver_name(); QString driverName = _device_agent->driver_name();
QString sessionDevice = sessionObj["Device"].toString(); QString sessionDevice = sessionObj["Device"].toString();
int sessionMode = sessionObj["DeviceMode"].toInt();
// check device and mode // check device and mode
if (driverName != sessionDevice || mode != sessionMode) if (driverName != sessionDevice || mode != sessionMode)
{ {
@ -663,13 +781,9 @@ namespace pv
else if (info->datatype == SR_T_FLOAT) else if (info->datatype == SR_T_FLOAT)
_device_agent->set_config(NULL, NULL, info->key, g_variant_new_double(sessionObj[info->name].toDouble())); _device_agent->set_config(NULL, NULL, info->key, g_variant_new_double(sessionObj[info->name].toDouble()));
else if (info->datatype == SR_T_CHAR) else if (info->datatype == SR_T_CHAR)
{ _device_agent->set_config(NULL, NULL, info->key, g_variant_new_string(sessionObj[info->name].toString().toUtf8()));
QString v = sessionObj[info->name].toString(); else if (info->datatype == SR_T_LIST)
if (info->key == SR_CONF_OPERATION_MODE){ _device_agent->set_config(NULL, NULL, info->key, g_variant_new_uint16(sessionObj[info->name].toString().toInt()));
}
_device_agent->set_config(NULL, NULL, info->key, g_variant_new_string(v.toUtf8()));
}
} }
} }
@ -832,114 +946,8 @@ namespace pv
_view->get_viewstatus()->load_session(sessionObj["measure"].toArray()); _view->get_viewstatus()->load_session(sessionObj["measure"].toArray());
} }
return true; if (gvar_opts != NULL)
} g_variant_unref(gvar_opts);
bool MainWindow::gen_session_json(QJsonObject &sessionVar)
{
AppConfig &app = AppConfig::Instance();
GVariant *gvar_opts;
GVariant *gvar;
gsize num_opts;
QString title = QApplication::applicationName() + " v" + QApplication::applicationVersion();
QJsonArray channelVar;
sessionVar["Version"] = QJsonValue::fromVariant(BASE_SESSION_VERSION);
sessionVar["Device"] = QJsonValue::fromVariant(_device_agent->driver_name());
sessionVar["DeviceMode"] = QJsonValue::fromVariant(_device_agent->get_work_mode());
sessionVar["Language"] = QJsonValue::fromVariant(app._frameOptions.language);
sessionVar["Title"] = QJsonValue::fromVariant(title);
gvar_opts = _device_agent->get_config_list(NULL, SR_CONF_DEVICE_SESSIONS);
if (gvar_opts == NULL)
{
dsv_warn("%s", "Device config list is empty. id:SR_CONF_DEVICE_SESSIONS");
/* Driver supports no device instance sessions. */
return false;
}
const int *const options = (const int32_t *)g_variant_get_fixed_array(
gvar_opts, &num_opts, sizeof(int32_t));
for (unsigned int i = 0; i < num_opts; i++)
{
const struct sr_config_info *const info = _device_agent->get_config_info(options[i]);
gvar = _device_agent->get_config(NULL, NULL, info->key);
if (gvar != NULL)
{
if (info->datatype == SR_T_BOOL)
sessionVar[info->name] = QJsonValue::fromVariant(g_variant_get_boolean(gvar));
else if (info->datatype == SR_T_UINT64)
sessionVar[info->name] = QJsonValue::fromVariant(QString::number(g_variant_get_uint64(gvar)));
else if (info->datatype == SR_T_UINT8)
sessionVar[info->name] = QJsonValue::fromVariant(QString::number(g_variant_get_byte(gvar)));
else if (info->datatype == SR_T_FLOAT)
sessionVar[info->name] = QJsonValue::fromVariant(g_variant_get_double(gvar));
else if (info->datatype == SR_T_CHAR)
sessionVar[info->name] = QJsonValue::fromVariant(g_variant_get_string(gvar, NULL));
g_variant_unref(gvar);
}
}
for (auto &s : _session->get_signals())
{
QJsonObject s_obj;
s_obj["index"] = s->get_index();
s_obj["type"] = s->get_type();
s_obj["enabled"] = s->enabled();
s_obj["name"] = s->get_name();
if (s->get_colour().isValid())
s_obj["colour"] = QJsonValue::fromVariant(s->get_colour());
else
s_obj["colour"] = QJsonValue::fromVariant("default");
view::LogicSignal *logicSig = NULL;
if ((logicSig = dynamic_cast<view::LogicSignal *>(s)))
{
s_obj["strigger"] = logicSig->get_trig();
}
view::DsoSignal *dsoSig = NULL;
if ((dsoSig = dynamic_cast<view::DsoSignal *>(s)))
{
s_obj["vdiv"] = QJsonValue::fromVariant(static_cast<qulonglong>(dsoSig->get_vDialValue()));
s_obj["vfactor"] = QJsonValue::fromVariant(static_cast<qulonglong>(dsoSig->get_factor()));
s_obj["coupling"] = dsoSig->get_acCoupling();
s_obj["trigValue"] = dsoSig->get_trig_vrate();
s_obj["zeroPos"] = dsoSig->get_zero_ratio();
}
view::AnalogSignal *analogSig = NULL;
if ((analogSig = dynamic_cast<view::AnalogSignal *>(s)))
{
s_obj["vdiv"] = QJsonValue::fromVariant(static_cast<qulonglong>(analogSig->get_vdiv()));
s_obj["vfactor"] = QJsonValue::fromVariant(static_cast<qulonglong>(analogSig->get_factor()));
s_obj["coupling"] = analogSig->get_acCoupling();
s_obj["zeroPos"] = analogSig->get_zero_ratio();
s_obj["mapUnit"] = analogSig->get_mapUnit();
s_obj["mapMin"] = analogSig->get_mapMin();
s_obj["mapMax"] = analogSig->get_mapMax();
}
channelVar.append(s_obj);
}
sessionVar["channel"] = channelVar;
if (_device_agent->get_work_mode() == LOGIC)
{
sessionVar["trigger"] = _trigger_widget->get_session();
}
StoreSession ss(_session);
QJsonArray decodeJson;
ss.json_decoders(decodeJson);
sessionVar["decoder"] = decodeJson;
if (_device_agent->get_work_mode() == DSO)
{
sessionVar["measure"] = _view->get_viewstatus()->get_session();
}
return true; return true;
} }
@ -1154,9 +1162,7 @@ namespace pv
{ {
if (language == 0) if (language == 0)
return; return;
if (_device_agent->have_instance())
_device_agent->set_config(NULL, NULL, SR_CONF_LANGUAGE, g_variant_new_int16(language));
AppConfig &app = AppConfig::Instance(); AppConfig &app = AppConfig::Instance();
if (app._frameOptions.language != language && language > 0) if (app._frameOptions.language != language && language > 0)

View File

@ -87,15 +87,6 @@ public:
explicit MainWindow(QWidget *parent = 0); explicit MainWindow(QWidget *parent = 0);
void openDoc(); void openDoc();
private:
void closeEvent(QCloseEvent *event);
void setup_ui();
void retranslateUi();
bool eventFilter(QObject *object, QEvent *event);
bool load_session_json(QJsonDocument json, bool &haveDecoder);
QString genSessionFileName();
public slots: public slots:
void switchTheme(QString style); void switchTheme(QString style);
@ -139,10 +130,22 @@ public:
void session_save(); void session_save();
private: private:
void closeEvent(QCloseEvent *event);
void setup_ui();
void retranslateUi();
bool eventFilter(QObject *object, QEvent *event);
void check_usb_device_speed(); void check_usb_device_speed();
void reset_all_view(); void reset_all_view();
bool confirm_to_store_data(); bool confirm_to_store_data();
void update_toolbar_view_status(); void update_toolbar_view_status();
bool load_session_json(QJsonDocument json, bool &haveDecoder);
QString genSessionFileName();
bool gen_session_json(QJsonObject &sessionVar);
void check_session_file_version();
void load_device_config();
QJsonDocument get_session_json_from_file(QString file);
QJsonArray get_decoder_json_from_file(QString file);
private: private:
//ISessionCallback //ISessionCallback
@ -168,11 +171,6 @@ private:
//ISessionDataGetter //ISessionDataGetter
bool genSessionData(std::string &str); bool genSessionData(std::string &str);
bool gen_session_json(QJsonObject &sessionVar);
void check_session_file_version();
void load_device_config();
QJsonDocument get_session_json_from_file(QString file);
QJsonArray get_decoder_json_from_file(QString file);
//IMessageListener //IMessageListener
void OnMessage(int msg); void OnMessage(int msg);

View File

@ -70,15 +70,7 @@ DeviceOptions::DeviceOptions()
gvar_list = _device_agent->get_config_list(NULL, key); gvar_list = _device_agent->get_config_list(NULL, key);
const QString name(info->name); const QString name(info->name);
char *label_char = info->label; char *label_char = info->name;
GVariant *gvar_tmp = _device_agent->get_config(NULL, NULL, SR_CONF_LANGUAGE);
if (gvar_tmp != NULL) {
int language = g_variant_get_int16(gvar_tmp);
if (language == LAN_CN)
label_char = info->label_cn;
g_variant_unref(gvar_tmp);
}
QString label(label_char); QString label(label_char);
switch(key) switch(key)

View File

@ -42,14 +42,14 @@ ProbeOptions::ProbeOptions(struct sr_channel *probe) :
Binding(), Binding(),
_probe(probe) _probe(probe)
{ {
GVariant *gvar_opts, *gvar_list; GVariant *gvar_opts;
gsize num_opts; gsize num_opts;
SigSession *session = AppControl::Instance()->GetSession(); SigSession *session = AppControl::Instance()->GetSession();
_device_agent = session->get_device(); _device_agent = session->get_device();
gvar_opts = _device_agent->get_config_list(NULL, SR_CONF_PROBE_CONFIGS); gvar_opts = _device_agent->get_config_list(NULL, SR_CONF_PROBE_CONFIGS);
if (gvar_opts != NULL){ if (gvar_opts == NULL){
/* Driver supports no device instance options. */ /* Driver supports no device instance options. */
return; return;
} }
@ -57,7 +57,8 @@ ProbeOptions::ProbeOptions(struct sr_channel *probe) :
const int *const options = (const int32_t *)g_variant_get_fixed_array( const int *const options = (const int32_t *)g_variant_get_fixed_array(
gvar_opts, &num_opts, sizeof(int32_t)); gvar_opts, &num_opts, sizeof(int32_t));
for (unsigned int i = 0; i < num_opts; i++) { for (unsigned int i = 0; i < num_opts; i++)
{
const struct sr_config_info *const info = const struct sr_config_info *const info =
_device_agent->get_config_info(options[i]); _device_agent->get_config_info(options[i]);
@ -66,18 +67,10 @@ ProbeOptions::ProbeOptions(struct sr_channel *probe) :
const int key = info->key; const int key = info->key;
gvar_list = _device_agent->get_config_list(NULL, key); GVariant *gvar_list = _device_agent->get_config_list(NULL, key);
const QString name(info->name); const QString name(info->name);
char *label_char = info->label; char *label_char = info->name;
GVariant *gvar_tmp = _device_agent->get_config(NULL, NULL, SR_CONF_LANGUAGE);
if (gvar_tmp != NULL) {
int language = g_variant_get_int16(gvar_tmp);
if (language == LAN_CN)
label_char = info->label_cn;
g_variant_unref(gvar_tmp);
}
const QString label(label_char); const QString label(label_char);
switch(key) switch(key)
@ -103,16 +96,12 @@ ProbeOptions::ProbeOptions(struct sr_channel *probe) :
case SR_CONF_PROBE_MAP_DEFAULT: case SR_CONF_PROBE_MAP_DEFAULT:
bind_bool(name, label, key); bind_bool(name, label, key);
break; break;
default:
gvar_list = NULL;
} }
if (gvar_list) if (gvar_list)
g_variant_unref(gvar_list); g_variant_unref(gvar_list);
} }
if (gvar_opts) g_variant_unref(gvar_opts);
g_variant_unref(gvar_opts);
} }
GVariant* ProbeOptions::config_getter(const struct sr_channel *probe, int key) GVariant* ProbeOptions::config_getter(const struct sr_channel *probe, int key)

View File

@ -191,16 +191,11 @@ void FileBar::on_actionDefault_triggered()
QString driver_name = _session->get_device()->name(); QString driver_name = _session->get_device()->name();
QString mode_name = QString::number(_session->get_device()->get_work_mode()); QString mode_name = QString::number(_session->get_device()->get_work_mode());
int language = LAN_EN;
GVariant *gvar_tmp = _session->get_device()->get_config(NULL, NULL, SR_CONF_LANGUAGE); int language = AppConfig::Instance()._frameOptions.language;
if (gvar_tmp != NULL) {
language = g_variant_get_int16(gvar_tmp);
g_variant_unref(gvar_tmp);
}
QString file_name = dir.absolutePath() + "/" + driver_name + mode_name + QString file_name = dir.absolutePath() + "/" + driver_name + mode_name +
".def"+QString::number(language)+".dsc"; ".def" + QString::number(language) + ".dsc";
if (!file_name.isEmpty()) sig_load_session(file_name);
sig_load_session(file_name);
} }
void FileBar::on_actionStore_triggered() void FileBar::on_actionStore_triggered()

View File

@ -29,31 +29,22 @@
static int dev_destroy(struct sr_dev_inst *sdi); static int dev_destroy(struct sr_dev_inst *sdi);
enum { enum DSCOPE_OPERATION_MODE
{
/** Normal */ /** Normal */
OP_NORMAL = 0, OP_NORMAL = 0,
/** Internal pattern test mode */ /** Internal pattern test mode */
OP_INTEST = 1, OP_INTEST = 1,
}; };
static const char *opmodes_cn[] = {
"正常",
"内部测试",
};
static const char *opmodes[] = {
"Normal",
"Internal Test",
};
enum { enum {
BW_FULL = 0, BW_FULL = 0,
BW_20M = 1, BW_20M = 1,
}; };
static const char *bandwidths_cn[] = { static const char *opmodes[] = {
"全带宽", "Normal",
"20MHz", "Internal Test",
}; };
static const char *bandwidths[] = { static const char *bandwidths[] = {
@ -61,6 +52,15 @@ static const char *bandwidths[] = {
"20MHz", "20MHz",
}; };
static struct lang_text_map_item opmodes_map[] =
{
{SR_CONF_OPERATION_MODE, OP_NORMAL, "Normal", "正常"},
{SR_CONF_OPERATION_MODE, OP_INTEST, "Internal Test", "内部测试"},
{SR_CONF_BANDWIDTH_LIMIT, BW_FULL, "Full Bandwidth", "全带宽"},
{SR_CONF_BANDWIDTH_LIMIT, BW_20M, "20MHz", NULL},
};
static const int32_t hwoptions[] = { static const int32_t hwoptions[] = {
SR_CONF_OPERATION_MODE, SR_CONF_OPERATION_MODE,
SR_CONF_BANDWIDTH_LIMIT, SR_CONF_BANDWIDTH_LIMIT,
@ -96,22 +96,6 @@ static const uint8_t zero_big_addr = 0x20;
SR_PRIV struct sr_dev_driver DSCope_driver_info; SR_PRIV struct sr_dev_driver DSCope_driver_info;
static struct sr_dev_driver *di = &DSCope_driver_info; static struct sr_dev_driver *di = &DSCope_driver_info;
static const char ** get_opmodes(struct DSL_context *devc)
{
if (devc->language == LANGUAGE_CN)
return opmodes_cn;
else
return opmodes;
}
static const char ** get_bandwidths(struct DSL_context *devc)
{
if (devc->language == LANGUAGE_CN)
return bandwidths_cn;
else
return bandwidths;
}
static uint16_t get_default_preoff(const struct sr_dev_inst *sdi, const struct sr_channel* ch) static uint16_t get_default_preoff(const struct sr_dev_inst *sdi, const struct sr_channel* ch)
{ {
int i; int i;
@ -1059,12 +1043,12 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
case SR_CONF_OPERATION_MODE: case SR_CONF_OPERATION_MODE:
if (!sdi) if (!sdi)
return SR_ERR; return SR_ERR;
*data = g_variant_new_string(get_opmodes(devc)[devc->op_mode]); *data = g_variant_new_string(opmodes[devc->op_mode]);
break; break;
case SR_CONF_BANDWIDTH_LIMIT: case SR_CONF_BANDWIDTH_LIMIT:
if (!sdi) if (!sdi)
return SR_ERR; return SR_ERR;
*data = g_variant_new_string(get_bandwidths(devc)[devc->bw_limit]); *data = g_variant_new_string(bandwidths[devc->bw_limit]);
break; break;
case SR_CONF_CALI: case SR_CONF_CALI:
if (!sdi) if (!sdi)
@ -1385,10 +1369,10 @@ static int config_set(int id, GVariant *data, struct sr_dev_inst *sdi,
sr_dbg("%s: setting mode to %d", __func__, sdi->mode); sr_dbg("%s: setting mode to %d", __func__, sdi->mode);
} else if (id == SR_CONF_OPERATION_MODE) { } else if (id == SR_CONF_OPERATION_MODE) {
stropt = g_variant_get_string(data, NULL); stropt = g_variant_get_string(data, NULL);
if (!strcmp(stropt, get_opmodes(devc)[OP_NORMAL])) { if (!strcmp(stropt, opmodes[OP_NORMAL])) {
devc->op_mode = OP_NORMAL; devc->op_mode = OP_NORMAL;
devc->test_mode = SR_TEST_NONE; devc->test_mode = SR_TEST_NONE;
} else if (!strcmp(stropt, get_opmodes(devc)[OP_INTEST])) { } else if (!strcmp(stropt, opmodes[OP_INTEST])) {
devc->op_mode = OP_INTEST; devc->op_mode = OP_INTEST;
devc->test_mode = SR_TEST_INTERNAL; devc->test_mode = SR_TEST_INTERNAL;
} else { } else {
@ -1398,10 +1382,10 @@ static int config_set(int id, GVariant *data, struct sr_dev_inst *sdi,
__func__, devc->op_mode); __func__, devc->op_mode);
} else if (id == SR_CONF_BANDWIDTH_LIMIT) { } else if (id == SR_CONF_BANDWIDTH_LIMIT) {
stropt = g_variant_get_string(data, NULL); stropt = g_variant_get_string(data, NULL);
if (!strcmp(stropt, get_bandwidths(devc)[BW_FULL])) { if (!strcmp(stropt, bandwidths[BW_FULL])) {
devc->bw_limit = BW_FULL; devc->bw_limit = BW_FULL;
dsl_wr_reg(sdi, CTR0_ADDR, bmBW20M_CLR); dsl_wr_reg(sdi, CTR0_ADDR, bmBW20M_CLR);
} else if (!strcmp(stropt, get_bandwidths(devc)[BW_20M])) { } else if (!strcmp(stropt, bandwidths[BW_20M])) {
devc->bw_limit = BW_20M; devc->bw_limit = BW_20M;
dsl_wr_reg(sdi, CTR0_ADDR, bmBW20M_SET); dsl_wr_reg(sdi, CTR0_ADDR, bmBW20M_SET);
} else { } else {
@ -1727,10 +1711,10 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
sessions_daq, ARRAY_SIZE(sessions_daq)*sizeof(int32_t), TRUE, NULL, NULL); sessions_daq, ARRAY_SIZE(sessions_daq)*sizeof(int32_t), TRUE, NULL, NULL);
break; break;
case SR_CONF_OPERATION_MODE: case SR_CONF_OPERATION_MODE:
*data = g_variant_new_strv(get_opmodes(devc), ARRAY_SIZE(opmodes)); *data = g_variant_new_strv(opmodes, ARRAY_SIZE(opmodes));
break; break;
case SR_CONF_BANDWIDTH_LIMIT: case SR_CONF_BANDWIDTH_LIMIT:
*data = g_variant_new_strv(get_bandwidths(devc), ARRAY_SIZE(bandwidths)); *data = g_variant_new_strv(bandwidths, ARRAY_SIZE(bandwidths));
break; break;
default: default:
return SR_ERR_NA; return SR_ERR_NA;

View File

@ -1479,11 +1479,6 @@ SR_PRIV int dsl_config_get(int id, GVariant **data, const struct sr_dev_inst *sd
(void)cg; (void)cg;
switch (id) { switch (id) {
case SR_CONF_LANGUAGE:
if (!sdi)
return SR_ERR;
*data = g_variant_new_int16(devc->language);
break;
case SR_CONF_CONN: case SR_CONF_CONN:
if (!sdi || !sdi->conn) if (!sdi || !sdi->conn)
return SR_ERR_ARG; return SR_ERR_ARG;
@ -1715,9 +1710,7 @@ SR_PRIV int dsl_config_set(int id, GVariant *data, struct sr_dev_inst *sdi,
struct DSL_context *devc = sdi->priv; struct DSL_context *devc = sdi->priv;
int ret = SR_OK; int ret = SR_OK;
if (id == SR_CONF_LANGUAGE) { if (id == SR_CONF_ZERO_COMB) {
devc->language = g_variant_get_int16(data);
} else if (id == SR_CONF_ZERO_COMB) {
devc->zero_comb = g_variant_get_boolean(data); devc->zero_comb = g_variant_get_boolean(data);
} else if (id == SR_CONF_PROBE_MAP_DEFAULT) { } else if (id == SR_CONF_PROBE_MAP_DEFAULT) {
ch->map_default = g_variant_get_boolean(data); ch->map_default = g_variant_get_boolean(data);

View File

@ -141,11 +141,6 @@
*/ */
#define CALI_VGAIN_RANGE 200 #define CALI_VGAIN_RANGE 200
enum LANGUAGE {
LANGUAGE_CN = 25,
LANGUAGE_EN = 31,
};
struct DSL_caps { struct DSL_caps {
uint64_t mode_caps; uint64_t mode_caps;
uint64_t feature_caps; uint64_t feature_caps;
@ -350,48 +345,8 @@ static const struct DSL_vga vga_defaults[] = {
{0, 0, 0, 0, 0} {0, 0, 0, 0, 0}
}; };
enum CHANNEL_ID {
DSL_STREAM20x16 = 0,
DSL_STREAM25x12,
DSL_STREAM50x6,
DSL_STREAM100x3,
DSL_STREAM20x16_3DN2,
DSL_STREAM25x12_3DN2,
DSL_STREAM50x6_3DN2,
DSL_STREAM100x3_3DN2,
DSL_STREAM10x32_32_3DN2,
DSL_STREAM20x16_32_3DN2,
DSL_STREAM25x12_32_3DN2,
DSL_STREAM50x6_32_3DN2,
DSL_STREAM100x3_32_3DN2,
DSL_STREAM50x32,
DSL_STREAM100x30,
DSL_STREAM250x12,
DSL_STREAM125x16_16,
DSL_STREAM250x12_16,
DSL_STREAM500x6,
DSL_STREAM1000x3,
DSL_BUFFER100x16,
DSL_BUFFER200x8,
DSL_BUFFER400x4,
DSL_BUFFER250x32,
DSL_BUFFER500x16,
DSL_BUFFER1000x8,
DSL_ANALOG10x2,
DSL_ANALOG10x2_500,
DSL_DSO200x2,
DSL_DSO1000x2,
};
struct DSL_channels { struct DSL_channels {
enum CHANNEL_ID id; enum DSL_CHANNEL_ID id;
enum OPERATION_MODE mode; enum OPERATION_MODE mode;
enum CHANNEL_TYPE type; enum CHANNEL_TYPE type;
gboolean stream; gboolean stream;
@ -404,81 +359,80 @@ struct DSL_channels {
uint64_t hw_max_samplerate; uint64_t hw_max_samplerate;
uint8_t pre_div; uint8_t pre_div;
const char *descr; const char *descr;
const char *descr_cn;
}; };
static const struct DSL_channels channel_modes[] = { static const struct DSL_channels channel_modes[] = {
// LA Stream // LA Stream
{DSL_STREAM20x16, LOGIC, SR_CHANNEL_LOGIC, TRUE, 16, 16, 1, SR_KHZ(10), SR_MHZ(20), {DSL_STREAM20x16, LOGIC, SR_CHANNEL_LOGIC, TRUE, 16, 16, 1, SR_KHZ(10), SR_MHZ(20),
SR_KHZ(10), SR_MHZ(100), 1, "Use 16 Channels (Max 20MHz)", "使用16个通道(最大采样率 20MHz)"}, SR_KHZ(10), SR_MHZ(100), 1, "Use 16 Channels (Max 20MHz)"},
{DSL_STREAM25x12, LOGIC, SR_CHANNEL_LOGIC, TRUE, 16, 12, 1, SR_KHZ(10), SR_MHZ(25), {DSL_STREAM25x12, LOGIC, SR_CHANNEL_LOGIC, TRUE, 16, 12, 1, SR_KHZ(10), SR_MHZ(25),
SR_KHZ(10), SR_MHZ(100), 1, "Use 12 Channels (Max 25MHz)", "使用12个通道(最大采样率 25MHz)"}, SR_KHZ(10), SR_MHZ(100), 1, "Use 12 Channels (Max 25MHz)"},
{DSL_STREAM50x6, LOGIC, SR_CHANNEL_LOGIC, TRUE, 16, 6, 1, SR_KHZ(10), SR_MHZ(50), {DSL_STREAM50x6, LOGIC, SR_CHANNEL_LOGIC, TRUE, 16, 6, 1, SR_KHZ(10), SR_MHZ(50),
SR_KHZ(10), SR_MHZ(100), 1, "Use 6 Channels (Max 50MHz)", "使用6个通道(最大采样率 50MHz)"}, SR_KHZ(10), SR_MHZ(100), 1, "Use 6 Channels (Max 50MHz)"},
{DSL_STREAM100x3, LOGIC, SR_CHANNEL_LOGIC, TRUE, 16, 3, 1, SR_KHZ(10), SR_MHZ(100), {DSL_STREAM100x3, LOGIC, SR_CHANNEL_LOGIC, TRUE, 16, 3, 1, SR_KHZ(10), SR_MHZ(100),
SR_KHZ(10), SR_MHZ(100), 1, "Use 3 Channels (Max 100MHz)", "使用3个通道(最大采样率 100MHz)"}, SR_KHZ(10), SR_MHZ(100), 1, "Use 3 Channels (Max 100MHz)"},
{DSL_STREAM20x16_3DN2, LOGIC, SR_CHANNEL_LOGIC, TRUE, 16, 16, 1, SR_KHZ(10), SR_MHZ(20), {DSL_STREAM20x16_3DN2, LOGIC, SR_CHANNEL_LOGIC, TRUE, 16, 16, 1, SR_KHZ(10), SR_MHZ(20),
SR_KHZ(10), SR_MHZ(500), 5, "Use 16 Channels (Max 20MHz)", "使用16个通道(最大采样率 20MHz)"}, SR_KHZ(10), SR_MHZ(500), 5, "Use 16 Channels (Max 20MHz)"},
{DSL_STREAM25x12_3DN2, LOGIC, SR_CHANNEL_LOGIC, TRUE, 16, 12, 1, SR_KHZ(10), SR_MHZ(25), {DSL_STREAM25x12_3DN2, LOGIC, SR_CHANNEL_LOGIC, TRUE, 16, 12, 1, SR_KHZ(10), SR_MHZ(25),
SR_KHZ(10), SR_MHZ(500), 5, "Use 12 Channels (Max 25MHz)", "使用12个通道(最大采样率 25MHz)"}, SR_KHZ(10), SR_MHZ(500), 5, "Use 12 Channels (Max 25MHz)"},
{DSL_STREAM50x6_3DN2, LOGIC, SR_CHANNEL_LOGIC, TRUE, 16, 6, 1, SR_KHZ(10), SR_MHZ(50), {DSL_STREAM50x6_3DN2, LOGIC, SR_CHANNEL_LOGIC, TRUE, 16, 6, 1, SR_KHZ(10), SR_MHZ(50),
SR_KHZ(10), SR_MHZ(500), 5, "Use 6 Channels (Max 50MHz)", "使用6个通道(最大采样率 50MHz)"}, SR_KHZ(10), SR_MHZ(500), 5, "Use 6 Channels (Max 50MHz)"},
{DSL_STREAM100x3_3DN2, LOGIC, SR_CHANNEL_LOGIC, TRUE, 16, 3, 1, SR_KHZ(10), SR_MHZ(100), {DSL_STREAM100x3_3DN2, LOGIC, SR_CHANNEL_LOGIC, TRUE, 16, 3, 1, SR_KHZ(10), SR_MHZ(100),
SR_KHZ(10), SR_MHZ(500), 5, "Use 3 Channels (Max 100MHz)", "使用3个通道(最大采样率 100MHz)"}, SR_KHZ(10), SR_MHZ(500), 5, "Use 3 Channels (Max 100MHz)"},
{DSL_STREAM10x32_32_3DN2, LOGIC, SR_CHANNEL_LOGIC, TRUE, 32, 32, 1, SR_KHZ(10), SR_MHZ(10), {DSL_STREAM10x32_32_3DN2, LOGIC, SR_CHANNEL_LOGIC, TRUE, 32, 32, 1, SR_KHZ(10), SR_MHZ(10),
SR_KHZ(10), SR_MHZ(500), 5, "Use 32 Channels (Max 10MHz)", "使用32个通道(最大采样率 10MHz)"}, SR_KHZ(10), SR_MHZ(500), 5, "Use 32 Channels (Max 10MHz)"},
{DSL_STREAM20x16_32_3DN2, LOGIC, SR_CHANNEL_LOGIC, TRUE, 32, 16, 1, SR_KHZ(10), SR_MHZ(20), {DSL_STREAM20x16_32_3DN2, LOGIC, SR_CHANNEL_LOGIC, TRUE, 32, 16, 1, SR_KHZ(10), SR_MHZ(20),
SR_KHZ(10), SR_MHZ(500), 5, "Use 16 Channels (Max 20MHz)", "使用16个通道(最大采样率 20MHz)"}, SR_KHZ(10), SR_MHZ(500), 5, "Use 16 Channels (Max 20MHz)"},
{DSL_STREAM25x12_32_3DN2, LOGIC, SR_CHANNEL_LOGIC, TRUE, 32, 12, 1, SR_KHZ(10), SR_MHZ(25), {DSL_STREAM25x12_32_3DN2, LOGIC, SR_CHANNEL_LOGIC, TRUE, 32, 12, 1, SR_KHZ(10), SR_MHZ(25),
SR_KHZ(10), SR_MHZ(500), 5, "Use 12 Channels (Max 25MHz)", "使用12个通道(最大采样率 25MHz)"}, SR_KHZ(10), SR_MHZ(500), 5, "Use 12 Channels (Max 25MHz)"},
{DSL_STREAM50x6_32_3DN2, LOGIC, SR_CHANNEL_LOGIC, TRUE, 32, 6, 1, SR_KHZ(10), SR_MHZ(50), {DSL_STREAM50x6_32_3DN2, LOGIC, SR_CHANNEL_LOGIC, TRUE, 32, 6, 1, SR_KHZ(10), SR_MHZ(50),
SR_KHZ(10), SR_MHZ(500), 5, "Use 6 Channels (Max 50MHz)", "使用6个通道(最大采样率 50MHz)"}, SR_KHZ(10), SR_MHZ(500), 5, "Use 6 Channels (Max 50MHz)"},
{DSL_STREAM100x3_32_3DN2, LOGIC, SR_CHANNEL_LOGIC, TRUE, 32, 3, 1, SR_KHZ(10), SR_MHZ(100), {DSL_STREAM100x3_32_3DN2, LOGIC, SR_CHANNEL_LOGIC, TRUE, 32, 3, 1, SR_KHZ(10), SR_MHZ(100),
SR_KHZ(10), SR_MHZ(500), 5, "Use 3 Channels (Max 100MHz)", "使用3个通道(最大采样率 100MHz)"}, SR_KHZ(10), SR_MHZ(500), 5, "Use 3 Channels (Max 100MHz)"},
{DSL_STREAM50x32, LOGIC, SR_CHANNEL_LOGIC, TRUE, 32, 32, 1, SR_KHZ(10), SR_MHZ(50), {DSL_STREAM50x32, LOGIC, SR_CHANNEL_LOGIC, TRUE, 32, 32, 1, SR_KHZ(10), SR_MHZ(50),
SR_KHZ(10), SR_MHZ(500), 5, "Use 32 Channels (Max 50MHz)", "使用32个通道(最大采样率 50MHz)"}, SR_KHZ(10), SR_MHZ(500), 5, "Use 32 Channels (Max 50MHz)"},
{DSL_STREAM100x30, LOGIC, SR_CHANNEL_LOGIC, TRUE, 32, 30, 1, SR_KHZ(10), SR_MHZ(100), {DSL_STREAM100x30, LOGIC, SR_CHANNEL_LOGIC, TRUE, 32, 30, 1, SR_KHZ(10), SR_MHZ(100),
SR_KHZ(10), SR_MHZ(500), 5, "Use 30 Channels (Max 100MHz)", "使用30个通道(最大采样率 100MHz)"}, SR_KHZ(10), SR_MHZ(500), 5, "Use 30 Channels (Max 100MHz)"},
{DSL_STREAM250x12, LOGIC, SR_CHANNEL_LOGIC, TRUE, 32, 12, 1, SR_KHZ(10), SR_MHZ(250), {DSL_STREAM250x12, LOGIC, SR_CHANNEL_LOGIC, TRUE, 32, 12, 1, SR_KHZ(10), SR_MHZ(250),
SR_KHZ(10), SR_MHZ(500), 5, "Use 12 Channels (Max 250MHz)", "使用12个通道(最大采样率 250MHz)"}, SR_KHZ(10), SR_MHZ(500), 5, "Use 12 Channels (Max 250MHz)"},
{DSL_STREAM125x16_16, LOGIC, SR_CHANNEL_LOGIC, TRUE, 16, 16, 1, SR_KHZ(10), SR_MHZ(125), {DSL_STREAM125x16_16, LOGIC, SR_CHANNEL_LOGIC, TRUE, 16, 16, 1, SR_KHZ(10), SR_MHZ(125),
SR_KHZ(10), SR_MHZ(500), 5, "Use 16 Channels (Max 125MHz)", "使用16个通道(最大采样率 125MHz)"}, SR_KHZ(10), SR_MHZ(500), 5, "Use 16 Channels (Max 125MHz)"},
{DSL_STREAM250x12_16, LOGIC, SR_CHANNEL_LOGIC, TRUE, 16, 12, 1, SR_KHZ(10), SR_MHZ(250), {DSL_STREAM250x12_16, LOGIC, SR_CHANNEL_LOGIC, TRUE, 16, 12, 1, SR_KHZ(10), SR_MHZ(250),
SR_KHZ(10), SR_MHZ(500), 5, "Use 12 Channels (Max 250MHz)", "使用12个通道(最大采样率 250MHz)"}, SR_KHZ(10), SR_MHZ(500), 5, "Use 12 Channels (Max 250MHz)"},
{DSL_STREAM500x6, LOGIC, SR_CHANNEL_LOGIC, TRUE, 16, 6, 1, SR_KHZ(10), SR_MHZ(500), {DSL_STREAM500x6, LOGIC, SR_CHANNEL_LOGIC, TRUE, 16, 6, 1, SR_KHZ(10), SR_MHZ(500),
SR_KHZ(10), SR_MHZ(500), 5, "Use 6 Channels (Max 500MHz)", "使用6个通道(最大采样率 500MHz)"}, SR_KHZ(10), SR_MHZ(500), 5, "Use 6 Channels (Max 500MHz)"},
{DSL_STREAM1000x3, LOGIC, SR_CHANNEL_LOGIC, TRUE, 8, 3, 1, SR_KHZ(10), SR_GHZ(1), {DSL_STREAM1000x3, LOGIC, SR_CHANNEL_LOGIC, TRUE, 8, 3, 1, SR_KHZ(10), SR_GHZ(1),
SR_KHZ(10), SR_MHZ(500), 5, "Use 3 Channels (Max 1GHz)", "使用3个通道(最大采样率 1GHz)"}, SR_KHZ(10), SR_MHZ(500), 5, "Use 3 Channels (Max 1GHz)"},
// LA Buffer // LA Buffer
{DSL_BUFFER100x16, LOGIC, SR_CHANNEL_LOGIC, FALSE, 16, 16, 1, SR_KHZ(10), SR_MHZ(100), {DSL_BUFFER100x16, LOGIC, SR_CHANNEL_LOGIC, FALSE, 16, 16, 1, SR_KHZ(10), SR_MHZ(100),
SR_KHZ(10), SR_MHZ(100), 1, "Use Channels 0~15 (Max 100MHz)", "使用通道 0~15 (最大采样率 100MHz)"}, SR_KHZ(10), SR_MHZ(100), 1, "Use Channels 0~15 (Max 100MHz)"},
{DSL_BUFFER200x8, LOGIC, SR_CHANNEL_LOGIC, FALSE, 8, 8, 1, SR_KHZ(10), SR_MHZ(200), {DSL_BUFFER200x8, LOGIC, SR_CHANNEL_LOGIC, FALSE, 8, 8, 1, SR_KHZ(10), SR_MHZ(200),
SR_KHZ(10), SR_MHZ(100), 1, "Use Channels 0~7 (Max 200MHz)", "使用通道 0~7 (最大采样率 200MHz)"}, SR_KHZ(10), SR_MHZ(100), 1, "Use Channels 0~7 (Max 200MHz)"},
{DSL_BUFFER400x4, LOGIC, SR_CHANNEL_LOGIC, FALSE, 4, 4, 1, SR_KHZ(10), SR_MHZ(400), {DSL_BUFFER400x4, LOGIC, SR_CHANNEL_LOGIC, FALSE, 4, 4, 1, SR_KHZ(10), SR_MHZ(400),
SR_KHZ(10), SR_MHZ(100), 1, "Use Channels 0~3 (Max 400MHz)", "使用通道 0~3 (最大采样率 400MHz)"}, SR_KHZ(10), SR_MHZ(100), 1, "Use Channels 0~3 (Max 400MHz)"},
{DSL_BUFFER250x32, LOGIC, SR_CHANNEL_LOGIC, FALSE, 32, 32, 1, SR_KHZ(10), SR_MHZ(250), {DSL_BUFFER250x32, LOGIC, SR_CHANNEL_LOGIC, FALSE, 32, 32, 1, SR_KHZ(10), SR_MHZ(250),
SR_KHZ(10), SR_MHZ(500), 5, "Use Channels 0~31 (Max 250MHz)", "使用通道 0~31 (最大采样率 250MHz)"}, SR_KHZ(10), SR_MHZ(500), 5, "Use Channels 0~31 (Max 250MHz)"},
{DSL_BUFFER500x16, LOGIC, SR_CHANNEL_LOGIC, FALSE, 16, 16, 1, SR_KHZ(10), SR_MHZ(500), {DSL_BUFFER500x16, LOGIC, SR_CHANNEL_LOGIC, FALSE, 16, 16, 1, SR_KHZ(10), SR_MHZ(500),
SR_KHZ(10), SR_MHZ(500), 5, "Use Channels 0~15 (Max 500MHz)", "使用通道 0~15 (最大采样率 500MHz)"}, SR_KHZ(10), SR_MHZ(500), 5, "Use Channels 0~15 (Max 500MHz)"},
{DSL_BUFFER1000x8, LOGIC, SR_CHANNEL_LOGIC, FALSE, 8, 8, 1, SR_KHZ(10), SR_GHZ(1), {DSL_BUFFER1000x8, LOGIC, SR_CHANNEL_LOGIC, FALSE, 8, 8, 1, SR_KHZ(10), SR_GHZ(1),
SR_KHZ(10), SR_MHZ(500), 5, "Use Channels 0~7 (Max 1GHz)", "使用通道 0~7 (最大采样率 1GHz)"}, SR_KHZ(10), SR_MHZ(500), 5, "Use Channels 0~7 (Max 1GHz)"},
// DAQ // DAQ
{DSL_ANALOG10x2, ANALOG, SR_CHANNEL_ANALOG, TRUE, 2, 2, 8, SR_HZ(10), SR_MHZ(10), {DSL_ANALOG10x2, ANALOG, SR_CHANNEL_ANALOG, TRUE, 2, 2, 8, SR_HZ(10), SR_MHZ(10),
SR_KHZ(10), SR_MHZ(100), 1, "Use Channels 0~1 (Max 10MHz)", "使用通道 0~1 (最大采样率 10MHz)"}, SR_KHZ(10), SR_MHZ(100), 1, "Use Channels 0~1 (Max 10MHz)"},
{DSL_ANALOG10x2_500, ANALOG, SR_CHANNEL_ANALOG, TRUE, 2, 2, 8, SR_HZ(10), SR_MHZ(10), {DSL_ANALOG10x2_500, ANALOG, SR_CHANNEL_ANALOG, TRUE, 2, 2, 8, SR_HZ(10), SR_MHZ(10),
SR_KHZ(10), SR_MHZ(500), 1, "Use Channels 0~1 (Max 10MHz)", "使用通道 0~1 (最大采样率 10MHz)"}, SR_KHZ(10), SR_MHZ(500), 1, "Use Channels 0~1 (Max 10MHz)"},
// OSC // OSC
{DSL_DSO200x2, DSO, SR_CHANNEL_DSO, FALSE, 2, 2, 8, SR_KHZ(10), SR_MHZ(200), {DSL_DSO200x2, DSO, SR_CHANNEL_DSO, FALSE, 2, 2, 8, SR_KHZ(10), SR_MHZ(200),
SR_KHZ(10), SR_MHZ(100), 1, "Use Channels 0~1 (Max 200MHz)", "使用通道 0~1 (最大采样率 200MHz)"}, SR_KHZ(10), SR_MHZ(100), 1, "Use Channels 0~1 (Max 200MHz)"},
{DSL_DSO1000x2, DSO, SR_CHANNEL_DSO, FALSE, 2, 2, 8, SR_KHZ(10), SR_GHZ(1), {DSL_DSO1000x2, DSO, SR_CHANNEL_DSO, FALSE, 2, 2, 8, SR_KHZ(10), SR_GHZ(1),
SR_KHZ(10), SR_MHZ(500), 1, "Use Channels 0~1 (Max 1GHz)", "使用通道 0~1 (最大采样率 1GHz)"} SR_KHZ(10), SR_MHZ(500), 1, "Use Channels 0~1 (Max 1GHz)"}
}; };
/* hardware Capabilities */ /* hardware Capabilities */
@ -1083,7 +1037,7 @@ struct DSL_context {
gboolean stream; gboolean stream;
uint8_t test_mode; uint8_t test_mode;
uint16_t buf_options; uint16_t buf_options;
enum CHANNEL_ID ch_mode; enum DSL_CHANNEL_ID ch_mode;
uint16_t samplerates_min_index; uint16_t samplerates_min_index;
uint16_t samplerates_max_index; uint16_t samplerates_max_index;
uint16_t th_level; uint16_t th_level;
@ -1140,8 +1094,6 @@ struct DSL_context {
gboolean overflow; gboolean overflow;
int bw_limit; int bw_limit;
int empty_poll_count; int empty_poll_count;
int language;
}; };
/* /*

View File

@ -38,7 +38,8 @@ static const char *maxHeights[] = {
"5X", "5X",
}; };
enum { enum DSLOGIC_OPERATION_MODE
{
/** Buffer mode */ /** Buffer mode */
OP_BUFFER = 0, OP_BUFFER = 0,
/** Stream mode */ /** Stream mode */
@ -51,27 +52,13 @@ enum {
OP_LPTEST = 4, OP_LPTEST = 4,
}; };
static const char *opmodes_cn[] = { /** Device buffer mode */
"Buffer模式", enum DSLOGIC_BUFFER_OPT_MODE
"Stream模式", {
"内部测试", /** Stop immediately */
"外部测试", SR_BUF_STOP = 0,
"内存回环测试", /** Upload captured data */
}; SR_BUF_UPLOAD = 1,
static const char *bufoptions_cn[] = {
"立即停止",
"上传已采集的数据",
};
static const char *thresholds_cn[] = {
"1.8/2.5/3.3V Level",
"5.0V Level",
};
static const char *filters_cn[] = {
"",
"1个采样周期",
}; };
static const char *opmodes[] = { static const char *opmodes[] = {
@ -97,6 +84,24 @@ static const char *filters[] = {
"1 Sample Clock", "1 Sample Clock",
}; };
static struct lang_text_map_item opmodes_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_BUFFER_OPTIONS, SR_BUF_STOP, "Stop immediately", "立即停止"},
{SR_CONF_BUFFER_OPTIONS, SR_BUF_UPLOAD, "Upload captured data", "上传已采集的数据"},
{SR_CONF_THRESHOLD, SR_TH_3V3, "1.8/2.5/3.3V Level", NULL},
{SR_CONF_THRESHOLD, SR_TH_5V0, "5.0V Level", NULL},
{SR_CONF_FILTER, SR_FILTER_NONE, "None", ""},
{SR_CONF_FILTER, SR_FILTER_1T, "1 Sample Clock", "1个采样周期"},
};
static const int32_t hwoptions[] = { static const int32_t hwoptions[] = {
SR_CONF_OPERATION_MODE, SR_CONF_OPERATION_MODE,
SR_CONF_BUFFER_OPTIONS, SR_CONF_BUFFER_OPTIONS,
@ -164,38 +169,6 @@ static uint16_t opmodes_show_count = 3;
SR_PRIV struct sr_dev_driver DSLogic_driver_info; SR_PRIV struct sr_dev_driver DSLogic_driver_info;
static struct sr_dev_driver *di = &DSLogic_driver_info; static struct sr_dev_driver *di = &DSLogic_driver_info;
static const char ** get_opmodes(struct DSL_context *devc)
{
if (devc->language == LANGUAGE_CN)
return opmodes_cn;
else
return opmodes;
}
static const char ** get_bufoptions(struct DSL_context *devc)
{
if (devc->language == LANGUAGE_CN)
return bufoptions_cn;
else
return bufoptions;
}
static const char ** get_thresholds(struct DSL_context *devc)
{
if (devc->language == LANGUAGE_CN)
return thresholds_cn;
else
return thresholds;
}
static const char ** get_filters(struct DSL_context *devc)
{
if (devc->language == LANGUAGE_CN)
return filters_cn;
else
return filters;
}
static struct DSL_context *DSLogic_dev_new(const struct DSL_profile *prof) static struct DSL_context *DSLogic_dev_new(const struct DSL_profile *prof)
{ {
struct DSL_context *devc; struct DSL_context *devc;
@ -615,12 +588,12 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
case SR_CONF_OPERATION_MODE: case SR_CONF_OPERATION_MODE:
if (!sdi) if (!sdi)
return SR_ERR; return SR_ERR;
*data = g_variant_new_string(get_opmodes(devc)[devc->op_mode]); *data = g_variant_new_string(opmodes[devc->op_mode]);
break; break;
case SR_CONF_FILTER: case SR_CONF_FILTER:
if (!sdi) if (!sdi)
return SR_ERR; return SR_ERR;
*data = g_variant_new_string(get_filters(devc)[devc->filter]); *data = g_variant_new_string(filters[devc->filter]);
break; break;
case SR_CONF_RLE: case SR_CONF_RLE:
if (!sdi) if (!sdi)
@ -647,15 +620,12 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
case SR_CONF_BUFFER_OPTIONS: case SR_CONF_BUFFER_OPTIONS:
if (!sdi) if (!sdi)
return SR_ERR; return SR_ERR;
*data = g_variant_new_string(get_bufoptions(devc)[devc->buf_options]); *data = g_variant_new_string(bufoptions[devc->buf_options]);
break; break;
case SR_CONF_CHANNEL_MODE: case SR_CONF_CHANNEL_MODE:
if (!sdi) if (!sdi)
return SR_ERR; return SR_ERR;
if (devc->language == LANGUAGE_CN) *data = g_variant_new_string(channel_modes[devc->ch_mode].descr);
*data = g_variant_new_string(channel_modes[devc->ch_mode].descr_cn);
else
*data = g_variant_new_string(channel_modes[devc->ch_mode].descr);
break; break;
case SR_CONF_MAX_HEIGHT: case SR_CONF_MAX_HEIGHT:
if (!sdi) if (!sdi)
@ -670,7 +640,7 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
case SR_CONF_THRESHOLD: case SR_CONF_THRESHOLD:
if (!sdi) if (!sdi)
return SR_ERR; return SR_ERR;
*data = g_variant_new_string(get_thresholds(devc)[devc->th_level]); *data = g_variant_new_string(thresholds[devc->th_level]);
break; break;
case SR_CONF_VTH: case SR_CONF_VTH:
if (!sdi) if (!sdi)
@ -744,13 +714,17 @@ static int config_set(int id, GVariant *data, struct sr_dev_inst *sdi,
ret = SR_OK; ret = SR_OK;
if (id == SR_CONF_CLOCK_TYPE) { if (id == SR_CONF_CLOCK_TYPE) {
devc->clock_type = g_variant_get_boolean(data); devc->clock_type = g_variant_get_boolean(data);
} else if (id == SR_CONF_RLE_SUPPORT) { }
else if (id == SR_CONF_RLE_SUPPORT) {
devc->rle_support = g_variant_get_boolean(data); devc->rle_support = g_variant_get_boolean(data);
} else if (id == SR_CONF_CLOCK_EDGE) { }
else if (id == SR_CONF_CLOCK_EDGE) {
devc->clock_edge = g_variant_get_boolean(data); devc->clock_edge = g_variant_get_boolean(data);
} else if (id == SR_CONF_LIMIT_SAMPLES) { }
else if (id == SR_CONF_LIMIT_SAMPLES) {
devc->limit_samples = g_variant_get_uint64(data); devc->limit_samples = g_variant_get_uint64(data);
} else if (id == SR_CONF_PROBE_VDIV) { }
else if (id == SR_CONF_PROBE_VDIV) {
ch->vdiv = g_variant_get_uint64(data); ch->vdiv = g_variant_get_uint64(data);
if (sdi->mode != LOGIC) { if (sdi->mode != LOGIC) {
ret = dsl_wr_dso(sdi, dso_cmd_gen(sdi, ch, SR_CONF_PROBE_VDIV)); ret = dsl_wr_dso(sdi, dso_cmd_gen(sdi, ch, SR_CONF_PROBE_VDIV));
@ -761,13 +735,16 @@ static int config_set(int id, GVariant *data, struct sr_dev_inst *sdi,
else else
sr_dbg("%s: setting VDIV of channel %d to %d mv failed", sr_dbg("%s: setting VDIV of channel %d to %d mv failed",
__func__, ch->index, ch->vdiv); __func__, ch->index, ch->vdiv);
} else if (id == SR_CONF_PROBE_FACTOR) { }
else if (id == SR_CONF_PROBE_FACTOR) {
ch->vfactor = g_variant_get_uint64(data); ch->vfactor = g_variant_get_uint64(data);
sr_dbg("%s: setting Factor of channel %d to %d", __func__, sr_dbg("%s: setting Factor of channel %d to %d", __func__,
ch->index, ch->vfactor); ch->index, ch->vfactor);
} else if (id == SR_CONF_TIMEBASE) { }
else if (id == SR_CONF_TIMEBASE) {
devc->timebase = g_variant_get_uint64(data); devc->timebase = g_variant_get_uint64(data);
} else if (id == SR_CONF_PROBE_COUPLING) { }
else if (id == SR_CONF_PROBE_COUPLING) {
ch->coupling = g_variant_get_byte(data); ch->coupling = g_variant_get_byte(data);
if (ch->coupling == SR_GND_COUPLING) if (ch->coupling == SR_GND_COUPLING)
ch->coupling = SR_DC_COUPLING; ch->coupling = SR_DC_COUPLING;
@ -780,7 +757,8 @@ static int config_set(int id, GVariant *data, struct sr_dev_inst *sdi,
else else
sr_dbg("%s: setting AC COUPLING of channel %d to %d failed", sr_dbg("%s: setting AC COUPLING of channel %d to %d failed",
__func__, ch->index, ch->coupling); __func__, ch->index, ch->coupling);
} else if (id == SR_CONF_TRIGGER_SLOPE) { }
else if (id == SR_CONF_TRIGGER_SLOPE) {
devc->trigger_slope = g_variant_get_byte(data); devc->trigger_slope = g_variant_get_byte(data);
if (sdi->mode == DSO) { if (sdi->mode == DSO) {
ret = dsl_wr_dso(sdi, dso_cmd_gen(sdi, NULL, SR_CONF_TRIGGER_SLOPE)); ret = dsl_wr_dso(sdi, dso_cmd_gen(sdi, NULL, SR_CONF_TRIGGER_SLOPE));
@ -791,7 +769,8 @@ static int config_set(int id, GVariant *data, struct sr_dev_inst *sdi,
else else
sr_dbg("%s: setting DSO Trigger Slope to %d failed", sr_dbg("%s: setting DSO Trigger Slope to %d failed",
__func__, devc->trigger_slope); __func__, devc->trigger_slope);
} else if (id == SR_CONF_TRIGGER_VALUE) { }
else if (id == SR_CONF_TRIGGER_VALUE) {
ch->trig_value = g_variant_get_byte(data); ch->trig_value = g_variant_get_byte(data);
if (sdi->mode == DSO) { if (sdi->mode == DSO) {
ret = dsl_wr_dso(sdi, dso_cmd_gen(sdi, ch, SR_CONF_TRIGGER_VALUE)); ret = dsl_wr_dso(sdi, dso_cmd_gen(sdi, ch, SR_CONF_TRIGGER_VALUE));
@ -802,7 +781,8 @@ static int config_set(int id, GVariant *data, struct sr_dev_inst *sdi,
else else
sr_dbg("%s: setting DSO Trigger Value to %d failed", sr_dbg("%s: setting DSO Trigger Value to %d failed",
__func__, ch->index, ch->trig_value); __func__, ch->index, ch->trig_value);
} else if (id == SR_CONF_HORIZ_TRIGGERPOS) { }
else if (id == SR_CONF_HORIZ_TRIGGERPOS) {
if (sdi->mode == DSO) { if (sdi->mode == DSO) {
devc->trigger_hrate = g_variant_get_byte(data); devc->trigger_hrate = g_variant_get_byte(data);
//devc->trigger_hpos = devc->trigger_hrate * dsl_en_ch_num(sdi) * devc->limit_samples / 200.0; //devc->trigger_hpos = devc->trigger_hrate * dsl_en_ch_num(sdi) * devc->limit_samples / 200.0;
@ -820,7 +800,8 @@ static int config_set(int id, GVariant *data, struct sr_dev_inst *sdi,
} else { } else {
devc->trigger_hpos = g_variant_get_byte(data) * devc->limit_samples / 100.0; devc->trigger_hpos = g_variant_get_byte(data) * devc->limit_samples / 100.0;
} }
} else if (id == SR_CONF_TRIGGER_HOLDOFF) { }
else if (id == SR_CONF_TRIGGER_HOLDOFF) {
devc->trigger_holdoff = g_variant_get_uint64(data); devc->trigger_holdoff = g_variant_get_uint64(data);
if (sdi->mode == DSO) { if (sdi->mode == DSO) {
ret = dsl_wr_dso(sdi, dso_cmd_gen(sdi, NULL, SR_CONF_TRIGGER_HOLDOFF)); ret = dsl_wr_dso(sdi, dso_cmd_gen(sdi, NULL, SR_CONF_TRIGGER_HOLDOFF));
@ -831,7 +812,8 @@ static int config_set(int id, GVariant *data, struct sr_dev_inst *sdi,
else else
sr_dbg("%s: setting Trigger Holdoff Time to %d failed", sr_dbg("%s: setting Trigger Holdoff Time to %d failed",
__func__, devc->trigger_holdoff); __func__, devc->trigger_holdoff);
} else if (id == SR_CONF_TRIGGER_MARGIN) { }
else if (id == SR_CONF_TRIGGER_MARGIN) {
devc->trigger_margin = g_variant_get_byte(data); devc->trigger_margin = g_variant_get_byte(data);
if (sdi->mode == DSO) { if (sdi->mode == DSO) {
ret = dsl_wr_dso(sdi, dso_cmd_gen(sdi, NULL, SR_CONF_TRIGGER_MARGIN)); ret = dsl_wr_dso(sdi, dso_cmd_gen(sdi, NULL, SR_CONF_TRIGGER_MARGIN));
@ -842,27 +824,31 @@ static int config_set(int id, GVariant *data, struct sr_dev_inst *sdi,
else else
sr_dbg("%s: setting Trigger Margin to %d failed", sr_dbg("%s: setting Trigger Margin to %d failed",
__func__, devc->trigger_margin); __func__, devc->trigger_margin);
} else if (id == SR_CONF_SAMPLERATE) { }
else if (id == SR_CONF_SAMPLERATE) {
if (devc->test_mode == SR_TEST_NONE) { if (devc->test_mode == SR_TEST_NONE) {
devc->cur_samplerate = g_variant_get_uint64(data); devc->cur_samplerate = g_variant_get_uint64(data);
if(sdi->mode != LOGIC) { if(sdi->mode != LOGIC) {
ret = dsl_wr_dso(sdi, dso_cmd_gen(sdi, 0, SR_CONF_SAMPLERATE)); ret = dsl_wr_dso(sdi, dso_cmd_gen(sdi, 0, SR_CONF_SAMPLERATE));
} }
} }
} else if (id == SR_CONF_FILTER) { }
else if (id == SR_CONF_FILTER) {
stropt = g_variant_get_string(data, NULL); stropt = g_variant_get_string(data, NULL);
if (!strcmp(stropt, get_filters(devc)[SR_FILTER_NONE])) { if (!strcmp(stropt, filters[SR_FILTER_NONE])) {
devc->filter = SR_FILTER_NONE; devc->filter = SR_FILTER_NONE;
} else if (!strcmp(stropt, get_filters(devc)[SR_FILTER_1T])) { } else if (!strcmp(stropt, filters[SR_FILTER_1T])) {
devc->filter = SR_FILTER_1T; devc->filter = SR_FILTER_1T;
} else { } else {
ret = SR_ERR; ret = SR_ERR;
} }
sr_dbg("%s: setting filter to %d", sr_dbg("%s: setting filter to %d",
__func__, devc->filter); __func__, devc->filter);
} else if (id == SR_CONF_RLE) { }
else if (id == SR_CONF_RLE) {
devc->rle_mode = g_variant_get_boolean(data); devc->rle_mode = g_variant_get_boolean(data);
} else if (id == SR_CONF_INSTANT) { }
else if (id == SR_CONF_INSTANT) {
if (sdi->mode == DSO) { if (sdi->mode == DSO) {
devc->instant = g_variant_get_boolean(data); devc->instant = g_variant_get_boolean(data);
if (dsl_en_ch_num(sdi) != 0) { if (dsl_en_ch_num(sdi) != 0) {
@ -872,7 +858,8 @@ static int config_set(int id, GVariant *data, struct sr_dev_inst *sdi,
devc->limit_samples = devc->profile->dev_caps.dso_depth / dsl_en_ch_num(sdi); devc->limit_samples = devc->profile->dev_caps.dso_depth / dsl_en_ch_num(sdi);
} }
} }
} else if (id == SR_CONF_DEVICE_MODE) { }
else if (id == SR_CONF_DEVICE_MODE) {
sdi->mode = g_variant_get_int16(data); sdi->mode = g_variant_get_int16(data);
if (sdi->mode == LOGIC) { if (sdi->mode == LOGIC) {
dsl_wr_reg(sdi, CTR0_ADDR, bmSCOPE_CLR); dsl_wr_reg(sdi, CTR0_ADDR, bmSCOPE_CLR);
@ -886,7 +873,8 @@ static int config_set(int id, GVariant *data, struct sr_dev_inst *sdi,
break; break;
} }
} }
} else if (sdi->mode == DSO) { }
else if (sdi->mode == DSO) {
dsl_wr_reg(sdi, CTR0_ADDR, bmSCOPE_SET); dsl_wr_reg(sdi, CTR0_ADDR, bmSCOPE_SET);
ret = dsl_wr_dso(sdi, dso_cmd_gen(sdi, NULL, SR_CONF_DSO_SYNC)); ret = dsl_wr_dso(sdi, dso_cmd_gen(sdi, NULL, SR_CONF_DSO_SYNC));
if (ret != SR_OK) if (ret != SR_OK)
@ -903,7 +891,8 @@ static int config_set(int id, GVariant *data, struct sr_dev_inst *sdi,
} }
} }
devc->limit_samples = devc->profile->dev_caps.dso_depth / num_probes; devc->limit_samples = devc->profile->dev_caps.dso_depth / num_probes;
} else if (sdi->mode == ANALOG) { }
else if (sdi->mode == ANALOG) {
dsl_wr_reg(sdi, CTR0_ADDR, bmSCOPE_SET); dsl_wr_reg(sdi, CTR0_ADDR, bmSCOPE_SET);
ret = dsl_wr_dso(sdi, dso_cmd_gen(sdi, NULL, SR_CONF_DSO_SYNC)); ret = dsl_wr_dso(sdi, dso_cmd_gen(sdi, NULL, SR_CONF_DSO_SYNC));
if (ret != SR_OK) if (ret != SR_OK)
@ -920,7 +909,8 @@ static int config_set(int id, GVariant *data, struct sr_dev_inst *sdi,
break; break;
} }
} }
} else { }
else {
ret = SR_ERR; ret = SR_ERR;
} }
assert(num_probes != 0); assert(num_probes != 0);
@ -934,7 +924,7 @@ static int config_set(int id, GVariant *data, struct sr_dev_inst *sdi,
else if (id == SR_CONF_OPERATION_MODE) { else if (id == SR_CONF_OPERATION_MODE) {
stropt = g_variant_get_string(data, NULL); stropt = g_variant_get_string(data, NULL);
if (sdi->mode == LOGIC) { if (sdi->mode == LOGIC) {
if (!strcmp(stropt, get_opmodes(devc)[OP_BUFFER])) { if (!strcmp(stropt, opmodes[OP_BUFFER])) {
if (devc->op_mode != OP_BUFFER) { if (devc->op_mode != OP_BUFFER) {
devc->op_mode = OP_BUFFER; devc->op_mode = OP_BUFFER;
devc->test_mode = SR_TEST_NONE; devc->test_mode = SR_TEST_NONE;
@ -948,7 +938,8 @@ static int config_set(int id, GVariant *data, struct sr_dev_inst *sdi,
} }
} }
} }
} else if (!strcmp(stropt, get_opmodes(devc)[OP_STREAM])) { }
else if (!strcmp(stropt, opmodes[OP_STREAM])) {
if (devc->op_mode != OP_STREAM) { if (devc->op_mode != OP_STREAM) {
devc->op_mode = OP_STREAM; devc->op_mode = OP_STREAM;
devc->test_mode = SR_TEST_NONE; devc->test_mode = SR_TEST_NONE;
@ -962,14 +953,16 @@ static int config_set(int id, GVariant *data, struct sr_dev_inst *sdi,
} }
} }
} }
} else if (!strcmp(stropt, get_opmodes(devc)[OP_INTEST])) { }
else if (!strcmp(stropt, opmodes[OP_INTEST])) {
if (devc->op_mode != OP_INTEST) { if (devc->op_mode != OP_INTEST) {
devc->op_mode = OP_INTEST; devc->op_mode = OP_INTEST;
devc->test_mode = SR_TEST_INTERNAL; devc->test_mode = SR_TEST_INTERNAL;
devc->ch_mode = devc->profile->dev_caps.intest_channel; devc->ch_mode = devc->profile->dev_caps.intest_channel;
devc->stream = !(devc->profile->dev_caps.feature_caps & CAPS_FEATURE_BUF); devc->stream = !(devc->profile->dev_caps.feature_caps & CAPS_FEATURE_BUF);
} }
} else { }
else {
ret = SR_ERR; ret = SR_ERR;
} }
dsl_adjust_probes(sdi, channel_modes[devc->ch_mode].num); dsl_adjust_probes(sdi, channel_modes[devc->ch_mode].num);
@ -983,29 +976,24 @@ static int config_set(int id, GVariant *data, struct sr_dev_inst *sdi,
} }
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_BUFFER_OPTIONS) { }
else if (id == SR_CONF_BUFFER_OPTIONS) {
stropt = g_variant_get_string(data, NULL); stropt = g_variant_get_string(data, NULL);
if (sdi->mode == LOGIC) { if (sdi->mode == LOGIC) {
if (!strcmp(stropt, get_bufoptions(devc)[SR_BUF_STOP])) if (!strcmp(stropt, bufoptions[SR_BUF_STOP]))
devc->buf_options = SR_BUF_STOP; devc->buf_options = SR_BUF_STOP;
else if (!strcmp(stropt, get_bufoptions(devc)[SR_BUF_UPLOAD])) else if (!strcmp(stropt, bufoptions[SR_BUF_UPLOAD]))
devc->buf_options = SR_BUF_UPLOAD; devc->buf_options = SR_BUF_UPLOAD;
} }
} else if (id == SR_CONF_CHANNEL_MODE) { }
else if (id == SR_CONF_CHANNEL_MODE) {
stropt = g_variant_get_string(data, NULL); stropt = g_variant_get_string(data, NULL);
if (sdi->mode == LOGIC) { if (sdi->mode == LOGIC) {
for (i = 0; i < ARRAY_SIZE(channel_modes); i++) { for (i = 0; i < ARRAY_SIZE(channel_modes); i++) {
if (devc->profile->dev_caps.channels & (1 << i)) { if (devc->profile->dev_caps.channels & (1 << i)) {
if (devc->language == LANGUAGE_CN) { if (!strcmp(stropt, channel_modes[i].descr)) {
if (!strcmp(stropt, channel_modes[i].descr_cn)) { devc->ch_mode = channel_modes[i].id;
devc->ch_mode = channel_modes[i].id; break;
break;
}
} else {
if (!strcmp(stropt, channel_modes[i].descr)) {
devc->ch_mode = channel_modes[i].id;
break;
}
} }
} }
} }
@ -1014,13 +1002,14 @@ static int config_set(int id, GVariant *data, struct sr_dev_inst *sdi,
} }
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) {
if (sdi->mode == LOGIC) { if (sdi->mode == LOGIC) {
stropt = g_variant_get_string(data, NULL); stropt = g_variant_get_string(data, NULL);
if (strcmp(stropt, get_thresholds(devc)[devc->th_level])) { if (strcmp(stropt, thresholds[devc->th_level])) {
if (!strcmp(stropt, get_thresholds(devc)[SR_TH_3V3])) { if (!strcmp(stropt, thresholds[SR_TH_3V3])) {
devc->th_level = SR_TH_3V3; devc->th_level = SR_TH_3V3;
} else if (!strcmp(stropt, get_thresholds(devc)[SR_TH_5V0])) { } else if (!strcmp(stropt, thresholds[SR_TH_5V0])) {
devc->th_level = SR_TH_5V0; devc->th_level = SR_TH_5V0;
} else { } else {
ret = SR_ERR; ret = SR_ERR;
@ -1051,10 +1040,12 @@ static int config_set(int id, GVariant *data, struct sr_dev_inst *sdi,
sr_dbg("%s: setting threshold to %d", sr_dbg("%s: setting threshold to %d",
__func__, devc->th_level); __func__, devc->th_level);
} }
} else if (id == SR_CONF_VTH) { }
else if (id == SR_CONF_VTH) {
devc->vth = g_variant_get_double(data); devc->vth = g_variant_get_double(data);
ret = dsl_wr_reg(sdi, VTH_ADDR, (uint8_t)(devc->vth/5.0*255)); ret = dsl_wr_reg(sdi, VTH_ADDR, (uint8_t)(devc->vth/5.0*255));
} else if (id == SR_CONF_MAX_HEIGHT) { }
else if (id == SR_CONF_MAX_HEIGHT) {
stropt = g_variant_get_string(data, NULL); stropt = g_variant_get_string(data, NULL);
for (i = 0; i < ARRAY_SIZE(maxHeights); i++) { for (i = 0; i < ARRAY_SIZE(maxHeights); i++) {
if (!strcmp(stropt, maxHeights[i])) { if (!strcmp(stropt, maxHeights[i])) {
@ -1064,7 +1055,8 @@ static int config_set(int id, GVariant *data, struct sr_dev_inst *sdi,
} }
sr_dbg("%s: setting Signal Max Height to %d", sr_dbg("%s: setting Signal Max Height to %d",
__func__, devc->max_height); __func__, devc->max_height);
} else if (id == SR_CONF_PROBE_EN) { }
else if (id == SR_CONF_PROBE_EN) {
ch->enabled = g_variant_get_boolean(data); ch->enabled = g_variant_get_boolean(data);
if (sdi->mode == DSO) { if (sdi->mode == DSO) {
ret = dsl_wr_dso(sdi, dso_cmd_gen(sdi, ch, SR_CONF_PROBE_EN)); ret = dsl_wr_dso(sdi, dso_cmd_gen(sdi, ch, SR_CONF_PROBE_EN));
@ -1083,11 +1075,13 @@ static int config_set(int id, GVariant *data, struct sr_dev_inst *sdi,
else else
sr_dbg("%s: setting ENABLE of channel %d to %d", sr_dbg("%s: setting ENABLE of channel %d to %d",
__func__, ch->index, ch->enabled); __func__, ch->index, ch->enabled);
} else if (id == SR_CONF_PROBE_OFFSET) { }
else if (id == SR_CONF_PROBE_OFFSET) {
ch->offset = g_variant_get_uint16(data); ch->offset = g_variant_get_uint16(data);
sr_dbg("%s: setting OFFSET of channel %d to %d", __func__, sr_dbg("%s: setting OFFSET of channel %d to %d", __func__,
ch->index, ch->offset); ch->index, ch->offset);
} else if (id == SR_CONF_TRIGGER_SOURCE) { }
else if (id == SR_CONF_TRIGGER_SOURCE) {
devc->trigger_source = g_variant_get_byte(data); devc->trigger_source = g_variant_get_byte(data);
if (sdi->mode == DSO) { if (sdi->mode == DSO) {
ret = dsl_wr_dso(sdi, dso_cmd_gen(sdi, NULL, SR_CONF_TRIGGER_SOURCE)); ret = dsl_wr_dso(sdi, dso_cmd_gen(sdi, NULL, SR_CONF_TRIGGER_SOURCE));
@ -1098,7 +1092,8 @@ static int config_set(int id, GVariant *data, struct sr_dev_inst *sdi,
else else
sr_dbg("%s: setting DSO Trigger Source to %d failed", sr_dbg("%s: setting DSO Trigger Source to %d failed",
__func__, devc->trigger_source); __func__, devc->trigger_source);
} else if (id == SR_CONF_TRIGGER_CHANNEL) { }
else if (id == SR_CONF_TRIGGER_CHANNEL) {
devc->trigger_source = (g_variant_get_byte(data) << 4) + (devc->trigger_source & 0x0f); devc->trigger_source = (g_variant_get_byte(data) << 4) + (devc->trigger_source & 0x0f);
if (sdi->mode == DSO) { if (sdi->mode == DSO) {
ret = dsl_wr_dso(sdi, dso_cmd_gen(sdi, NULL, SR_CONF_TRIGGER_SOURCE)); ret = dsl_wr_dso(sdi, dso_cmd_gen(sdi, NULL, SR_CONF_TRIGGER_SOURCE));
@ -1109,9 +1104,11 @@ static int config_set(int id, GVariant *data, struct sr_dev_inst *sdi,
else else
sr_dbg("%s: setting DSO Trigger Source to %d failed", sr_dbg("%s: setting DSO Trigger Source to %d failed",
__func__, devc->trigger_source); __func__, devc->trigger_source);
} else if (id == SR_CONF_STREAM) { }
else if (id == SR_CONF_STREAM) {
devc->stream = g_variant_get_boolean(data); devc->stream = g_variant_get_boolean(data);
} else { }
else {
ret = SR_ERR_NA; ret = SR_ERR_NA;
} }
@ -1150,10 +1147,10 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
sessions, ARRAY_SIZE(sessions)*sizeof(int32_t), TRUE, NULL, NULL); sessions, ARRAY_SIZE(sessions)*sizeof(int32_t), TRUE, NULL, NULL);
break; break;
case SR_CONF_OPERATION_MODE: case SR_CONF_OPERATION_MODE:
*data = g_variant_new_strv(get_opmodes(devc), opmodes_show_count); *data = g_variant_new_strv(opmodes, opmodes_show_count);
break; break;
case SR_CONF_BUFFER_OPTIONS: case SR_CONF_BUFFER_OPTIONS:
*data = g_variant_new_strv(get_bufoptions(devc), ARRAY_SIZE(bufoptions)); *data = g_variant_new_strv(bufoptions, ARRAY_SIZE(bufoptions));
break; break;
case SR_CONF_CHANNEL_MODE: case SR_CONF_CHANNEL_MODE:
g_variant_builder_init(&gvb, G_VARIANT_TYPE("as")); g_variant_builder_init(&gvb, G_VARIANT_TYPE("as"));
@ -1162,19 +1159,16 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
devc->profile->dev_caps.channels & (1 << i)) { devc->profile->dev_caps.channels & (1 << i)) {
if (devc->test_mode != SR_TEST_NONE && devc->profile->dev_caps.intest_channel != channel_modes[i].id) if (devc->test_mode != SR_TEST_NONE && devc->profile->dev_caps.intest_channel != channel_modes[i].id)
continue; continue;
if (devc->language == LANGUAGE_CN) g_variant_builder_add(&gvb, "s", channel_modes[i].descr);
g_variant_builder_add(&gvb, "s", channel_modes[i].descr_cn);
else
g_variant_builder_add(&gvb, "s", channel_modes[i].descr);
} }
} }
*data = g_variant_builder_end(&gvb); *data = g_variant_builder_end(&gvb);
break; break;
case SR_CONF_THRESHOLD: case SR_CONF_THRESHOLD:
*data = g_variant_new_strv(get_thresholds(devc), ARRAY_SIZE(thresholds)); *data = g_variant_new_strv(thresholds, ARRAY_SIZE(thresholds));
break; break;
case SR_CONF_FILTER: case SR_CONF_FILTER:
*data = g_variant_new_strv(get_filters(devc), ARRAY_SIZE(filters)); *data = g_variant_new_strv(filters, ARRAY_SIZE(filters));
break; break;
case SR_CONF_MAX_HEIGHT: case SR_CONF_MAX_HEIGHT:
*data = g_variant_new_strv(maxHeights, ARRAY_SIZE(maxHeights)); *data = g_variant_new_strv(maxHeights, ARRAY_SIZE(maxHeights));

View File

@ -280,9 +280,6 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
case SR_CONF_TEST: case SR_CONF_TEST:
*data = g_variant_new_boolean(FALSE); *data = g_variant_new_boolean(FALSE);
break; break;
case SR_CONF_LANGUAGE:
*data = g_variant_new_int16(devc->language);
break;
case SR_CONF_INSTANT: case SR_CONF_INSTANT:
*data = g_variant_new_boolean(devc->instant); *data = g_variant_new_boolean(devc->instant);
break; break;
@ -578,10 +575,6 @@ static int config_set(int id, GVariant *data, struct sr_dev_inst *sdi,
ch->map_max = g_variant_get_double(data); ch->map_max = g_variant_get_double(data);
ret = SR_OK; ret = SR_OK;
} }
else if (id == SR_CONF_LANGUAGE) {
devc->language = g_variant_get_int16(data);
ret = SR_OK;
}
else { else {
ret = SR_ERR_NA; ret = SR_ERR_NA;
} }

View File

@ -75,14 +75,14 @@ static const uint64_t vdivs10to2000[] = {
0, 0,
}; };
enum CHANNEL_ID { enum DEMO_CHANNEL_ID {
DEMO_LOGIC100x16 = 0, DEMO_LOGIC100x16 = 0,
DEMO_ANALOG10x2, DEMO_ANALOG10x2,
DEMO_DSO200x2, DEMO_DSO200x2,
}; };
struct DEMO_channels { struct DEMO_channels {
enum CHANNEL_ID id; enum DEMO_CHANNEL_ID id;
enum OPERATION_MODE mode; enum OPERATION_MODE mode;
enum CHANNEL_TYPE type; enum CHANNEL_TYPE type;
@ -111,7 +111,7 @@ struct demo_context {
int64_t starttime; int64_t starttime;
int stop; int stop;
uint64_t timebase; uint64_t timebase;
enum CHANNEL_ID ch_mode; enum DEMO_CHANNEL_ID ch_mode;
uint16_t samplerates_min_index; uint16_t samplerates_min_index;
uint16_t samplerates_max_index; uint16_t samplerates_max_index;
gboolean instant; gboolean instant;
@ -128,8 +128,6 @@ struct demo_context {
uint16_t trigger_edge; uint16_t trigger_edge;
uint8_t trigger_slope; uint8_t trigger_slope;
uint8_t trigger_source; uint8_t trigger_source;
int language;
}; };
static const uint64_t samplerates[] = { static const uint64_t samplerates[] = {

View File

@ -44,84 +44,47 @@
* @{ * @{
*/ */
static struct sr_config_info sr_config_info_data[] = { static struct sr_config_info sr_config_info_data[] = {
{SR_CONF_CONN, SR_T_CHAR, "conn", {SR_CONF_CONN, SR_T_CHAR, "Connection"},
"Connection", "Connection", "连接", NULL}, {SR_CONF_SERIALCOMM, SR_T_CHAR,"Serial communication"},
{SR_CONF_SERIALCOMM, SR_T_CHAR, "serialcomm", {SR_CONF_SAMPLERATE, SR_T_UINT64,"Sample rate"},
"Serial communication", "Serial communication", "串口通讯", NULL}, {SR_CONF_LIMIT_SAMPLES, SR_T_UINT64,"Sample depth"},
{SR_CONF_SAMPLERATE, SR_T_UINT64, "samplerate", {SR_CONF_ACTUAL_SAMPLES, SR_T_UINT64,"Sample count"},
"Sample rate", "Sample rate", "采样率", NULL}, {SR_CONF_CLOCK_TYPE, SR_T_BOOL,"Using External Clock"},
{SR_CONF_LIMIT_SAMPLES, SR_T_UINT64, "samplecount", {SR_CONF_CLOCK_EDGE, SR_T_BOOL, "Using Clock Negedge"},
"Sample count", "Sample count", "采样深度", NULL}, {SR_CONF_CAPTURE_RATIO, SR_T_UINT64,"Pre-trigger capture ratio"},
{SR_CONF_ACTUAL_SAMPLES, SR_T_UINT64, "samplecount", {SR_CONF_PATTERN_MODE, SR_T_CHAR,"Pattern mode"},
"Sample count", "Sample count", "实际采样数", NULL}, {SR_CONF_RLE, SR_T_BOOL,"Run Length Encoding"},
{SR_CONF_CLOCK_TYPE, SR_T_BOOL, "clocktype", {SR_CONF_WAIT_UPLOAD, SR_T_BOOL,"Wait Buffer Upload"},
"Using External Clock", "Using External Clock", "使用外部输入时钟采样", NULL}, {SR_CONF_TRIGGER_SLOPE, SR_T_UINT8,"Trigger slope"},
{SR_CONF_CLOCK_EDGE, SR_T_BOOL, "clockedge", {SR_CONF_TRIGGER_SOURCE, SR_T_UINT8,"Trigger source"},
"Using Clock Negedge", "Using Clock Negedge", "使用时钟下降沿采样", NULL}, {SR_CONF_TRIGGER_CHANNEL, SR_T_UINT8,"Trigger channel"},
{SR_CONF_CAPTURE_RATIO, SR_T_UINT64, "captureratio", {SR_CONF_HORIZ_TRIGGERPOS, SR_T_UINT8,"Horizontal trigger position"},
"Pre-trigger capture ratio", "Pre-trigger capture ratio", "触发前采样比例", NULL}, {SR_CONF_TRIGGER_HOLDOFF, SR_T_UINT64,"Trigger hold off"},
{SR_CONF_PATTERN_MODE, SR_T_CHAR, "pattern", {SR_CONF_TRIGGER_MARGIN, SR_T_UINT8,"Trigger margin"},
"Pattern mode", "Pattern mode", "信号模式", NULL}, {SR_CONF_BUFFERSIZE, SR_T_UINT64,"Buffer size"},
{SR_CONF_RLE, SR_T_BOOL, "rle", {SR_CONF_TIMEBASE, SR_T_UINT64,"Time base"},
"Run Length Encoding", "Run Length Encoding", "RLE编码", NULL}, {SR_CONF_MAX_HEIGHT, SR_T_CHAR,"Max Height"},
{SR_CONF_WAIT_UPLOAD, SR_T_BOOL, "buf_upload", {SR_CONF_MAX_HEIGHT_VALUE, SR_T_UINT8,"Max Height value"},
"Wait Buffer Upload", "Wait Buffer Upload", "上传已采集数据", NULL}, {SR_CONF_FILTER, SR_T_CHAR,"Filter Targets"},
{SR_CONF_TRIGGER_SLOPE, SR_T_UINT8, "triggerslope", {SR_CONF_DATALOG, SR_T_BOOL,"Datalog"},
"Trigger slope", "Trigger slope", "触发沿", NULL}, {SR_CONF_OPERATION_MODE, SR_T_CHAR,"Operation Mode"},
{SR_CONF_TRIGGER_SOURCE, SR_T_UINT8, "triggersource", {SR_CONF_BUFFER_OPTIONS, SR_T_CHAR,"Stop Options"},
"Trigger source", "Trigger source", "触发源", NULL}, {SR_CONF_CHANNEL_MODE, SR_T_CHAR,"Channel Mode"},
{SR_CONF_TRIGGER_CHANNEL, SR_T_UINT8, "triggerchannel", {SR_CONF_THRESHOLD, SR_T_CHAR,"Threshold Levels"},
"Trigger channel", "Trigger channel", "触发通道", NULL}, {SR_CONF_VTH, SR_T_FLOAT,"Threshold Level"},
{SR_CONF_HORIZ_TRIGGERPOS, SR_T_UINT8, "horiz_triggerpos", {SR_CONF_RLE_SUPPORT, SR_T_BOOL,"Enable RLE Compress"},
"Horizontal trigger position", "Horizontal trigger position", "触发位置", NULL}, {SR_CONF_BANDWIDTH_LIMIT, SR_T_CHAR,"Bandwidth Limit"},
{SR_CONF_TRIGGER_HOLDOFF, SR_T_UINT64, "triggerholdoff", {SR_CONF_PROBE_COUPLING, SR_T_CHAR,"Coupling"},
"Trigger hold off", "Trigger hold off", "触发释抑时间", NULL}, {SR_CONF_PROBE_VDIV, SR_T_RATIONAL_VOLT,"Volts/div"},
{SR_CONF_TRIGGER_MARGIN, SR_T_UINT8, "triggermargin", {SR_CONF_PROBE_FACTOR, SR_T_UINT64,"Probe Factor"},
"Trigger margin", "Trigger margin", "触发灵敏度", NULL}, {SR_CONF_PROBE_MAP_DEFAULT, SR_T_BOOL,"Map Default"},
{SR_CONF_BUFFERSIZE, SR_T_UINT64, "buffersize", {SR_CONF_PROBE_MAP_UNIT, SR_T_CHAR,"Map Unit"},
"Buffer size", "Buffer size", "缓存大小", NULL}, {SR_CONF_PROBE_MAP_MIN, SR_T_FLOAT,"Map Min"},
{SR_CONF_TIMEBASE, SR_T_UINT64, "timebase", {SR_CONF_PROBE_MAP_MAX, SR_T_FLOAT,"Map Max"},
"Time base", "Time base", "时基", NULL}, {0, 0, NULL, NULL},
{SR_CONF_MAX_HEIGHT, SR_T_CHAR, "height",
"Max Height", "Max Height", "最大高度", NULL},
{SR_CONF_MAX_HEIGHT_VALUE, SR_T_UINT8, "height",
"Max Height", "Max Height", "最大高度值", NULL},
{SR_CONF_FILTER, SR_T_CHAR, "filter",
"Filter Targets", "Filter Targets", "滤波器设置", NULL},
{SR_CONF_DATALOG, SR_T_BOOL, "datalog",
"Datalog", "Datalog", "数据记录", NULL},
{SR_CONF_OPERATION_MODE, SR_T_CHAR, "operation",
"Operation Mode", "Operation Mode", "运行模式", NULL},
{SR_CONF_BUFFER_OPTIONS, SR_T_CHAR, "stopoptions",
"Stop Options", "Stop Options", "停止选项", NULL},
{SR_CONF_CHANNEL_MODE, SR_T_CHAR, "channel",
"Channel Mode", "Channel Mode", "通道模式", NULL},
{SR_CONF_THRESHOLD, SR_T_CHAR, "threshold",
"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", "RLE硬件压缩", NULL},
{SR_CONF_BANDWIDTH_LIMIT, SR_T_CHAR, "bandwidth",
"Bandwidth Limit", "Bandwidth Limit", "带宽限制", NULL},
{SR_CONF_PROBE_COUPLING, SR_T_CHAR, "coupling",
"Coupling", "Coupling", "耦合", NULL},
{SR_CONF_PROBE_VDIV, SR_T_RATIONAL_VOLT, "vdiv",
"Volts/div", "Volts/div", "电压/格", NULL},
{SR_CONF_PROBE_FACTOR, SR_T_UINT64, "factor",
"Probe Factor", "Probe Factor", "探头衰减", NULL},
{SR_CONF_PROBE_MAP_DEFAULT, SR_T_BOOL, "mdefault",
"Map Default", "Map Default", "默认电压", NULL},
{SR_CONF_PROBE_MAP_UNIT, SR_T_CHAR, "munit",
"Map Unit", "Map Unit", "对应单位", NULL},
{SR_CONF_PROBE_MAP_MIN, SR_T_FLOAT, "MMIN",
"Map Min", "Map Min", "对应最小值", NULL},
{SR_CONF_PROBE_MAP_MAX, SR_T_FLOAT, "MMAX",
"Map Max", "Map Max", "对应最大值", NULL},
{0, 0, NULL, NULL, NULL, NULL, NULL},
}; };
/** @cond PRIVATE */ /** @cond PRIVATE */
#ifdef HAVE_LA_DEMO #ifdef HAVE_LA_DEMO
extern SR_PRIV struct sr_dev_driver demo_driver_info; extern SR_PRIV struct sr_dev_driver demo_driver_info;
@ -154,6 +117,12 @@ SR_PRIV struct sr_dev_driver **sr_driver_list(void)
return drivers_list; return drivers_list;
} }
SR_API int ds_map_lang_text_id(int conf_id, int item_id, char *text)
{
return -1;
}
/** /**
* Initialize a hardware driver. * Initialize a hardware driver.
* *
@ -387,26 +356,6 @@ SR_PRIV int sr_status_get(const struct sr_dev_inst *sdi,
return ret; return ret;
} }
/**
* Get status about an acquisition.
*
* @param optname The configuration key.
*
* @return A pointer to a struct sr_config_info, or NULL if the key
* was not found.
*/
SR_PRIV const struct sr_config_info *sr_config_info_name_get(const char *optname)
{
int i;
for (i = 0; sr_config_info_data[i].key; i++) {
if (!strcmp(sr_config_info_data[i].id, optname))
return &sr_config_info_data[i];
}
return NULL;
}
/* Unnecessary level of indirection follows. */ /* Unnecessary level of indirection follows. */
/** @private */ /** @private */

View File

@ -898,16 +898,6 @@ SR_API const struct sr_config_info *ds_get_actived_device_config_info(int key)
return sr_config_info_get(key); return sr_config_info_get(key);
} }
SR_API const struct sr_config_info *ds_get_actived_device_config_info_by_name(const char *optname)
{
if (lib_ctx.actived_device_instance == NULL)
{
sr_err("%s", "Have no actived device.");
return SR_ERR_CALL_STATUS;
}
return sr_config_info_name_get(optname);
}
SR_API int ds_get_actived_device_status(struct sr_status *status, gboolean prg) SR_API int ds_get_actived_device_status(struct sr_status *status, gboolean prg)
{ {
if (lib_ctx.actived_device_instance == NULL) if (lib_ctx.actived_device_instance == NULL)

View File

@ -82,6 +82,13 @@ enum sr_dev_driver_type
DRIVER_TYPE_HARDWARE = 2 DRIVER_TYPE_HARDWARE = 2
}; };
struct lang_text_map_item{
int config_id;
int id;
char *en_name;
char *cn_name;
};
struct sr_dev_driver { struct sr_dev_driver {
/* Driver-specific */ /* Driver-specific */
char *name; char *name;
@ -413,7 +420,6 @@ SR_PRIV int sr_config_list(const struct sr_dev_driver *driver,
const struct sr_channel_group *cg, const struct sr_channel_group *cg,
int key, GVariant **data); int key, GVariant **data);
SR_PRIV const struct sr_config_info *sr_config_info_get(int key); SR_PRIV const struct sr_config_info *sr_config_info_get(int key);
SR_PRIV const struct sr_config_info *sr_config_info_name_get(const char *optname);
SR_PRIV int sr_status_get(const struct sr_dev_inst *sdi, struct sr_status *status, gboolean prg); SR_PRIV int sr_status_get(const struct sr_dev_inst *sdi, struct sr_status *status, gboolean prg);
SR_PRIV struct sr_config *sr_config_new(int key, GVariant *data); SR_PRIV struct sr_config *sr_config_new(int key, GVariant *data);
SR_PRIV void sr_config_free(struct sr_config *src); SR_PRIV void sr_config_free(struct sr_config *src);

View File

@ -100,6 +100,7 @@ enum {
#define SAMPLES_ALIGN 1023ULL #define SAMPLES_ALIGN 1023ULL
#define STR_ID(id) #id
/* Handy little macros */ /* Handy little macros */
#define SR_HZ(n) (n) #define SR_HZ(n) (n)
@ -180,6 +181,7 @@ enum {
SR_T_RATIONAL_PERIOD, SR_T_RATIONAL_PERIOD,
SR_T_RATIONAL_VOLT, SR_T_RATIONAL_VOLT,
SR_T_KEYVALUE, SR_T_KEYVALUE,
SR_T_LIST,
}; };
/** Value for sr_datafeed_packet.type. */ /** Value for sr_datafeed_packet.type. */
@ -681,13 +683,9 @@ struct sr_config {
}; };
struct sr_config_info { struct sr_config_info {
int key; int key;
int datatype; int datatype;
char *id;
char *name; char *name;
char *label;
char *label_cn;
char *description;
}; };
struct sr_status { struct sr_status {
@ -744,7 +742,8 @@ struct sr_status {
uint32_t ch1_acc_mean_p3; uint32_t ch1_acc_mean_p3;
}; };
enum sr_config_option_id{ enum sr_config_option_id
{
/*--- Device classes ------------------------------------------------*/ /*--- Device classes ------------------------------------------------*/
/** The device can act as logic analyzer. */ /** The device can act as logic analyzer. */
@ -1017,9 +1016,6 @@ enum sr_config_option_id{
/** The device supports setting the number of data blocks. */ /** The device supports setting the number of data blocks. */
SR_CONF_NUM_BLOCKS = 30104, SR_CONF_NUM_BLOCKS = 30104,
/** language (string code) **/
SR_CONF_LANGUAGE = 30105,
/*--- Acquisition modes ---------------------------------------------*/ /*--- Acquisition modes ---------------------------------------------*/
/** /**
@ -1095,16 +1091,8 @@ enum {
SR_TEST_LOOPBACK, SR_TEST_LOOPBACK,
}; };
/** Device buffer mode */
enum {
/** Stop immediately */
SR_BUF_STOP = 0,
/** Upload captured data */
SR_BUF_UPLOAD = 1,
};
/** Device threshold level. */ /** Device threshold level. */
enum { enum DSL_THRESHOLD_LEVEL{
/** 1.8/2.5/3.3 level */ /** 1.8/2.5/3.3 level */
SR_TH_3V3 = 0, SR_TH_3V3 = 0,
/** 5.0 level */ /** 5.0 level */
@ -1162,8 +1150,86 @@ struct ds_trigger_pos {
uint32_t status; uint32_t status;
}; };
enum DSL_CHANNEL_ID {
DSL_STREAM20x16 = 0,
DSL_STREAM25x12,
DSL_STREAM50x6,
DSL_STREAM100x3,
DSL_STREAM20x16_3DN2,
DSL_STREAM25x12_3DN2,
DSL_STREAM50x6_3DN2,
DSL_STREAM100x3_3DN2,
DSL_STREAM10x32_32_3DN2,
DSL_STREAM20x16_32_3DN2,
DSL_STREAM25x12_32_3DN2,
DSL_STREAM50x6_32_3DN2,
DSL_STREAM100x3_32_3DN2,
DSL_STREAM50x32,
DSL_STREAM100x30,
DSL_STREAM250x12,
DSL_STREAM125x16_16,
DSL_STREAM250x12_16,
DSL_STREAM500x6,
DSL_STREAM1000x3,
DSL_BUFFER100x16,
DSL_BUFFER200x8,
DSL_BUFFER400x4,
DSL_BUFFER250x32,
DSL_BUFFER500x16,
DSL_BUFFER1000x8,
DSL_ANALOG10x2,
DSL_ANALOG10x2_500,
DSL_DSO200x2,
DSL_DSO1000x2,
};
static char* DSL_CHANNEL_ID_NAMES[] =
{
"DSL_STREAM20x16",
"DSL_STREAM25x12",
"DSL_STREAM50x6",
"DSL_STREAM100x3",
"DSL_STREAM20x16_3DN2",
"DSL_STREAM25x12_3DN2",
"DSL_STREAM50x6_3DN2",
"DSL_STREAM100x3_3DN2",
"DSL_STREAM10x32_32_3DN2",
"DSL_STREAM20x16_32_3DN2",
"DSL_STREAM25x12_32_3DN2",
"DSL_STREAM50x6_32_3DN2",
"DSL_STREAM100x3_32_3DN2",
"DSL_STREAM50x32",
"DSL_STREAM100x30",
"DSL_STREAM250x12",
"DSL_STREAM125x16_16",
"DSL_STREAM250x12_16",
"DSL_STREAM500x6",
"DSL_STREAM1000x3",
"DSL_BUFFER100x16",
"DSL_BUFFER200x8",
"DSL_BUFFER400x4",
"DSL_BUFFER250x32",
"DSL_BUFFER500x16",
"DSL_BUFFER1000x8",
"DSL_ANALOG10x2",
"DSL_ANALOG10x2_500",
"DSL_DSO200x2",
"DSL_DSO1000x2",
};
/*--- input/input.c ---------------------------------------------------------*/ /*--- input/input.c ---------------------------------------------------------*/

View File

@ -97,8 +97,7 @@ static void get_file_short_name(const char *file, char *buf, int buflen)
} }
struct session_vdev struct session_vdev
{ {
int language;
int version; int version;
unzFile archive; // zip document unzFile archive; // zip document
int capfile; // current inner file open status int capfile; // current inner file open status
@ -526,12 +525,6 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
switch (id) switch (id)
{ {
case SR_CONF_LANGUAGE:
if (!sdi)
return SR_ERR;
vdev = sdi->priv;
*data = g_variant_new_int16(vdev->language);
break;
case SR_CONF_SAMPLERATE: case SR_CONF_SAMPLERATE:
if (sdi) if (sdi)
{ {
@ -756,9 +749,6 @@ static int config_set(int id, GVariant *data, struct sr_dev_inst *sdi,
switch (id) switch (id)
{ {
case SR_CONF_LANGUAGE:
vdev->language = g_variant_get_int16(data);
break;
case SR_CONF_SAMPLERATE: case SR_CONF_SAMPLERATE:
vdev->samplerate = g_variant_get_uint64(data); vdev->samplerate = g_variant_get_uint64(data);
samplerates[0] = vdev->samplerate; samplerates[0] = vdev->samplerate;