Commit a5f47b42 authored by DreamSourceLab's avatar DreamSourceLab

Add new products support (DSLogicU3Pro16/DSLogicU3Pro32/DSCopeU2B100/DSCopeU3P100)

parent 235a863b
......@@ -170,8 +170,34 @@ void WaitingDialog::changeText()
{
tips->setText(tr("Waiting"));
index = 0;
GVariant* gvar;
bool comb_comp_en = false;
bool zero_fgain = false;
GVariant* gvar = _dev_inst->get_config(NULL, NULL, _key);
gvar = _dev_inst->get_config(NULL, NULL, SR_CONF_PROBE_COMB_COMP_EN);
if (gvar != NULL) {
comb_comp_en = g_variant_get_boolean(gvar);
g_variant_unref(gvar);
if (comb_comp_en) {
gvar = _dev_inst->get_config(NULL, NULL, SR_CONF_ZERO_COMB_FGAIN);
if (gvar != NULL) {
zero_fgain = g_variant_get_boolean(gvar);
g_variant_unref(gvar);
if (zero_fgain) {
boost::shared_ptr<view::DsoSignal> dsoSig;
BOOST_FOREACH(const boost::shared_ptr<view::Signal> s, _session.get_signals())
{
if ((dsoSig = dynamic_pointer_cast<view::DsoSignal>(s)))
dsoSig->set_enable(dsoSig->get_index() == 0);
}
boost::this_thread::sleep(boost::posix_time::millisec(100));
_dev_inst->set_config(NULL, NULL, SR_CONF_ZERO_COMB, g_variant_new_boolean(true));
}
}
}
}
gvar = _dev_inst->get_config(NULL, NULL, _key);
if (gvar != NULL) {
bool zero = g_variant_get_boolean(gvar);
g_variant_unref(gvar);
......
......@@ -505,7 +505,7 @@ bool SigSession::get_capture_status(bool &triggered, int &progress)
{
uint64_t sample_limits = cur_samplelimits();
sr_status status;
if (sr_status_get(_dev_inst->dev_inst(), &status, true, SR_STATUS_TRIG_BEGIN, SR_STATUS_TRIG_END) == SR_OK){
if (sr_status_get(_dev_inst->dev_inst(), &status, true) == SR_OK){
triggered = status.trig_hit & 0x01;
uint64_t captured_cnt = status.trig_hit >> 2;
captured_cnt = ((uint64_t)status.captured_cnt0 +
......
......@@ -460,7 +460,7 @@ QString StoreSession::meta_gen(boost::shared_ptr<data::Snapshot> snapshot)
fprintf(meta, " vFactor%d = %" PRIu64 "\n", probecnt, probe->vfactor);
fprintf(meta, " vOffset%d = %d\n", probecnt, probe->hw_offset);
fprintf(meta, " vTrig%d = %d\n", probecnt, probe->trig_value);
if (sr_status_get(sdi, &status, false, 0, 0) == SR_OK) {
if (sr_status_get(sdi, &status, false) == SR_OK) {
if (probe->index == 0) {
fprintf(meta, " period%d = %" PRIu32 "\n", probecnt, status.ch0_cyc_tlen);
fprintf(meta, " pcnt%d = %" PRIu32 "\n", probecnt, status.ch0_cyc_cnt);
......
......@@ -804,7 +804,7 @@ void SamplingBar::commit_settings()
g_variant_new_uint64(sample_rate));
if (dev_inst->dev_inst()->mode != DSO) {
const uint64_t sample_count = ((uint64_t)ceil(sample_duration / SR_SEC(1) *
sample_rate) + 1023ULL) & ~1023ULL;
sample_rate) + SAMPLES_ALIGN) & ~SAMPLES_ALIGN;
if (sample_count != dev_inst->get_sample_limit())
dev_inst->set_config(NULL, NULL,
SR_CONF_LIMIT_SAMPLES,
......
......@@ -892,7 +892,7 @@ void DsoSignal::paint_mid(QPainter &p, int left, int right, QColor fore, QColor
}
sr_status status;
if (sr_status_get(_dev_inst->dev_inst(), &status, false, 0, 0) == SR_OK) {
if (sr_status_get(_dev_inst->dev_inst(), &status, false) == SR_OK) {
_mValid = true;
if (status.measure_valid) {
_min = (index == 0) ? status.ch0_min : status.ch1_min;
......
No preview for this file type
No preview for this file type
......@@ -137,6 +137,14 @@ struct cmd_zero_info {
uint8_t trans0;
uint8_t trans1;
uint8_t comb_comp;
uint8_t fgain0_code;
uint8_t fgain1_code;
uint8_t fgain2_code;
uint8_t fgain3_code;
uint8_t comb_fgain0_code;
uint8_t comb_fgain1_code;
uint8_t comb_fgain2_code;
uint8_t comb_fgain3_code;
};
struct cmd_vga_info {
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -228,6 +228,9 @@ static struct DSL_context *DSLogic_dev_new(const struct DSL_profile *prof)
devc->trigger_hrate = 0;
devc->trigger_holdoff = 0;
devc->zero = FALSE;
devc->zero_branch = FALSE;
devc->zero_comb_fgain = FALSE;
devc->zero_comb = FALSE;
devc->status = DSL_FINISH;
devc->mstatus_valid = FALSE;
......@@ -932,7 +935,7 @@ static int config_set(int id, GVariant *data, struct sr_dev_inst *sdi,
dsl_adjust_samplerate(devc);
if (devc->op_mode == OP_INTEST) {
devc->cur_samplerate = devc->stream ? channel_modes[devc->ch_mode].max_samplerate / 10 :
channel_modes[devc->ch_mode].max_samplerate;
SR_MHZ(100);
devc->limit_samples = devc->stream ? devc->cur_samplerate * 3 :
devc->profile->dev_caps.hw_depth / dsl_en_ch_num(sdi);
}
......@@ -1042,10 +1045,6 @@ static int config_set(int id, GVariant *data, struct sr_dev_inst *sdi,
ch->offset = g_variant_get_uint16(data);
sr_dbg("%s: setting OFFSET of channel %d to %d", __func__,
ch->index, ch->offset);
} else if (id == SR_CONF_PROBE_HW_OFFSET) {
ch->hw_offset = g_variant_get_uint16(data);
sr_dbg("%s: setting OFFSET of channel %d to %d", __func__,
ch->index, ch->offset);
} else if (id == SR_CONF_TRIGGER_SOURCE) {
devc->trigger_source = g_variant_get_byte(data);
if (sdi->mode == DSO) {
......@@ -1119,12 +1118,12 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
for (i = 0; i < ARRAY_SIZE(channel_modes); i++) {
if (channel_modes[i].stream == devc->stream &&
devc->profile->dev_caps.channels & (1 << i)) {
if (devc->test_mode != SR_TEST_NONE && devc->profile->dev_caps.intest_channel != channel_modes[i].id)
continue;
if (devc->language == LANGUAGE_CN)
g_variant_builder_add(&gvb, "s", channel_modes[i].descr_cn);
else
g_variant_builder_add(&gvb, "s", channel_modes[i].descr);
if (devc->test_mode != SR_TEST_NONE)
break;
}
}
*data = g_variant_builder_end(&gvb);
......@@ -1197,6 +1196,17 @@ static void remove_sources(struct DSL_context *devc)
g_free(devc->usbfd);
}
static void report_overflow(struct DSL_context *devc)
{
struct sr_datafeed_packet packet;
struct sr_dev_inst *sdi = devc->cb_data;
packet.status = SR_PKT_OK;
packet.type = SR_DF_OVERFLOW;
packet.payload = NULL;
sr_session_send(sdi, &packet);
}
static int receive_data(int fd, int revents, const struct sr_dev_inst *sdi)
{
int completed = 0;
......@@ -1218,16 +1228,44 @@ static int receive_data(int fd, int revents, const struct sr_dev_inst *sdi)
tv.tv_sec = tv.tv_usec = 0;
libusb_handle_events_timeout_completed(drvc->sr_ctx->libusb_ctx, &tv, &completed);
// overflow check
if (devc->stream && devc->trf_completed) {
rd_cmd.header.dest = DSL_CTL_HW_STATUS;
rd_cmd.header.size = 1;
hw_info = 0;
rd_cmd.data = &hw_info;
if (devc->trf_completed)
devc->empty_poll_count = 0;
else
devc->empty_poll_count++;
// --
// progress check
// must before overflow check (1ch@10K)
// --
if ((devc->empty_poll_count > MAX_EMPTY_POLL) && (devc->status == DSL_START)) {
devc->mstatus.captured_cnt0 = 0;
rd_cmd.header.dest = DSL_CTL_I2C_STATUS;
rd_cmd.header.offset = 0;
rd_cmd.header.size = 4;
rd_cmd.data = (unsigned char*)&devc->mstatus;
if ((ret = command_ctl_rd(usb->devhdl, rd_cmd)) != SR_OK)
sr_err("Failed to get hardware infos.");
else
devc->overflow = (hw_info & bmSYS_OVERFLOW) != 0;
sr_err("Failed to get progress infos.");
devc->empty_poll_count = 0;
}
// overflow check
if (devc->stream) {
if (devc->empty_poll_count > MAX_EMPTY_POLL) {
rd_cmd.header.dest = DSL_CTL_HW_STATUS;
rd_cmd.header.size = 1;
hw_info = 0;
rd_cmd.data = &hw_info;
if ((ret = command_ctl_rd(usb->devhdl, rd_cmd)) != SR_OK)
sr_err("Failed to get hardware infos.");
else
devc->overflow = (hw_info & bmSYS_OVERFLOW) != 0;
if (devc->overflow)
report_overflow(devc);
devc->empty_poll_count = 0;
}
}
if (devc->status == DSL_FINISH) {
......@@ -1263,13 +1301,19 @@ static int dev_acquisition_start(struct sr_dev_inst *sdi, void *cb_data)
devc->num_samples = 0;
devc->num_bytes = 0;
devc->empty_transfer_count = 0;
devc->empty_poll_count = 0;
devc->status = DSL_INIT;
devc->num_transfers = 0;
devc->submitted_transfers = 0;
devc->actual_samples = (devc->limit_samples + 1023ULL) & ~1023ULL;
devc->actual_samples = (devc->limit_samples + SAMPLES_ALIGN) & ~SAMPLES_ALIGN;
devc->actual_bytes = devc->actual_samples / DSLOGIC_ATOMIC_SAMPLES * dsl_en_ch_num(sdi) * DSLOGIC_ATOMIC_SIZE;
devc->abort = FALSE;
devc->mstatus_valid = FALSE;
devc->mstatus.captured_cnt0 = 0;
devc->mstatus.captured_cnt1 = 0;
devc->mstatus.captured_cnt2 = 0;
devc->mstatus.captured_cnt3 = 0;
devc->mstatus.trig_hit = 0;
devc->overflow = FALSE;
/* Configures devc->trigger_* and devc->sample_wide */
......@@ -1346,9 +1390,9 @@ static int dev_acquisition_stop(const struct sr_dev_inst *sdi, void *cb_data)
return ret;
}
static int dev_status_get(const struct sr_dev_inst *sdi, struct sr_status *status, gboolean prg, int begin, int end)
static int dev_status_get(const struct sr_dev_inst *sdi, struct sr_status *status, gboolean prg)
{
int ret = dsl_dev_status_get(sdi, status, prg, begin, end);
int ret = dsl_dev_status_get(sdi, status, prg);
return ret;
}
......
......@@ -1074,11 +1074,10 @@ static int hw_dev_acquisition_stop(const struct sr_dev_inst *sdi, void *cb_data)
return SR_OK;
}
static int hw_dev_status_get(const struct sr_dev_inst *sdi, struct sr_status *status, gboolean prg, int begin, int end)
static int hw_dev_status_get(const struct sr_dev_inst *sdi, struct sr_status *status, gboolean prg)
{
(void)prg;
(void)begin;
(void)end;
if (sdi) {
struct demo_context *const devc = sdi->priv;
*status = devc->mstatus;
......
......@@ -425,8 +425,7 @@ SR_API const struct sr_config_info *sr_config_info_get(int key)
* as an indication that it's not applicable.
*/
SR_API int sr_status_get(const struct sr_dev_inst *sdi,
struct sr_status *status,
gboolean prg, int begin, int end)
struct sr_status *status, gboolean prg)
{
int ret;
......@@ -435,7 +434,7 @@ SR_API int sr_status_get(const struct sr_dev_inst *sdi,
else if (!sdi->driver->dev_status_get)
ret = SR_ERR_ARG;
else
ret = sdi->driver->dev_status_get(sdi, status, prg, begin, end);
ret = sdi->driver->dev_status_get(sdi, status, prg);
return ret;
}
......
......@@ -126,6 +126,8 @@ enum {
#define DS_CONF_DSO_VDIVS 10
#define DS_MAX_TRIG_PERCENT 90
#define SAMPLES_ALIGN 1023ULL
/*
* Oscilloscope
*/
......@@ -647,6 +649,16 @@ struct sr_channel {
int8_t comb_diff_top;
int8_t comb_diff_bom;
int8_t comb_comp;
uint16_t digi_fgain;
double cali_fgain0;
double cali_fgain1;
double cali_fgain2;
double cali_fgain3;
double cali_comb_fgain0;
double cali_comb_fgain1;
double cali_comb_fgain2;
double cali_comb_fgain3;
gboolean map_default;
const char *map_unit;
......@@ -680,17 +692,6 @@ struct sr_config_info {
char *description;
};
enum {
SR_STATUS_TRIG_BEGIN = 0,
SR_STATUS_TRIG_END = 4,
SR_STATUS_CH0_BEGIN = 5,
SR_STATUS_CH0_END = 14,
SR_STATUS_CH1_BEGIN = 15,
SR_STATUS_CH1_END = 24,
SR_STATUS_ZERO_BEGIN = 128,
SR_STATUS_ZERO_END = 135,
};
struct sr_status {
uint8_t trig_hit;
uint8_t captured_cnt3;
......@@ -722,6 +723,9 @@ struct sr_status {
uint32_t ch0_cyc_flen;
uint64_t ch0_acc_square;
uint32_t ch0_acc_mean;
uint32_t ch0_acc_mean_p1;
uint32_t ch0_acc_mean_p2;
uint32_t ch0_acc_mean_p3;
uint8_t ch1_max;
uint8_t ch1_min;
......@@ -737,6 +741,9 @@ struct sr_status {
uint32_t ch1_cyc_flen;
uint64_t ch1_acc_square;
uint32_t ch1_acc_mean;
uint32_t ch1_acc_mean_p1;
uint32_t ch1_acc_mean_p2;
uint32_t ch1_acc_mean_p3;
};
enum {
......@@ -877,6 +884,8 @@ enum {
SR_CONF_ZERO_SET,
SR_CONF_ZERO_LOAD,
SR_CONF_ZERO_DEFAULT,
SR_CONF_ZERO_COMB_FGAIN,
SR_CONF_ZERO_COMB,
SR_CONF_VOCM,
SR_CONF_CALI,
......@@ -1199,8 +1208,7 @@ struct sr_dev_driver {
int (*dev_open) (struct sr_dev_inst *sdi);
int (*dev_close) (struct sr_dev_inst *sdi);
int (*dev_status_get) (const struct sr_dev_inst *sdi,
struct sr_status *status,
gboolean prg, int begin, int end);
struct sr_status *status, gboolean prg);
int (*dev_acquisition_start) (struct sr_dev_inst *sdi,
void *cb_data);
int (*dev_acquisition_stop) (const struct sr_dev_inst *sdi,
......
......@@ -78,7 +78,7 @@ SR_API int sr_config_list(const struct sr_dev_driver *driver,
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_name_get(const char *optname);
SR_API int sr_status_get(const struct sr_dev_inst *sdi, struct sr_status *status, gboolean prg, int begin, int end);
SR_API int sr_status_get(const struct sr_dev_inst *sdi, struct sr_status *status, gboolean prg);
SR_API struct sr_config *sr_config_new(int key, GVariant *data);
SR_API void sr_config_free(struct sr_config *src);
......
......@@ -867,11 +867,9 @@ static int config_list(int key, GVariant **data,
return SR_OK;
}
static int dev_status_get(const struct sr_dev_inst *sdi, struct sr_status *status, gboolean prg, int begin, int end)
static int dev_status_get(const struct sr_dev_inst *sdi, struct sr_status *status, gboolean prg)
{
(void)prg;
(void)begin;
(void)end;
struct session_vdev *vdev;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment