forked from Ivasoft/DSView
Merge remote-tracking branch 'source/dev-1.3' into demo
This commit is contained in:
@@ -415,7 +415,8 @@ void DecoderStack::do_decode_work()
|
||||
_decoder_status->clear(); //clear old items
|
||||
|
||||
if (!_options_changed)
|
||||
{
|
||||
{
|
||||
dsv_err("ERROR:Decoder options have not changed.");
|
||||
return;
|
||||
}
|
||||
_options_changed = false;
|
||||
@@ -452,17 +453,25 @@ void DecoderStack::do_decode_work()
|
||||
}
|
||||
|
||||
if (_snapshot == NULL)
|
||||
return;
|
||||
{
|
||||
_error_message = L_S(STR_PAGE_MSG, S_ID(IDS_MSG_DECODERSTACK_DECODE_WORK_ERROR),
|
||||
"One or more required channels have not been specified");
|
||||
return;
|
||||
}
|
||||
|
||||
if (_session->is_realtime_refresh() == false && _snapshot->empty())
|
||||
{
|
||||
dsv_err("ERROR:Decode data is empty.");
|
||||
return;
|
||||
}
|
||||
|
||||
// Get the samplerate
|
||||
_samplerate = _snapshot->samplerate();
|
||||
if (_samplerate == 0.0)
|
||||
{
|
||||
dsv_err("ERROR:Decode data got an invalid sample rate.");
|
||||
return;
|
||||
}
|
||||
|
||||
execute_decode_stack();
|
||||
}
|
||||
@@ -508,7 +517,7 @@ void DecoderStack::decode_data(const uint64_t decode_start, const uint64_t decod
|
||||
//struct srd_push_param push_param;
|
||||
|
||||
if( i >= decode_end){
|
||||
dsv_info("%s", "decode data index have been end");
|
||||
dsv_info("%s", "decode data index have been to end");
|
||||
}
|
||||
|
||||
std::vector<const uint8_t *> chunk;
|
||||
@@ -558,12 +567,14 @@ void DecoderStack::decode_data(const uint64_t decode_start, const uint64_t decod
|
||||
if (sig_index == -1) {
|
||||
chunk.push_back(NULL);
|
||||
chunk_const.push_back(0);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
if (_snapshot->has_data(sig_index)) {
|
||||
auto data_ptr = _snapshot->get_decode_samples(i, chunk_end, sig_index);
|
||||
chunk.push_back(data_ptr);
|
||||
chunk_const.push_back(_snapshot->get_sample(i, sig_index));
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
_error_message = L_S(STR_PAGE_MSG, S_ID(IDS_MSG_DECODERSTACK_DECODE_DATA_ERROR),
|
||||
"At least one of selected channels are not enabled.");
|
||||
return;
|
||||
@@ -622,13 +633,13 @@ void DecoderStack::decode_data(const uint64_t decode_start, const uint64_t decod
|
||||
if (!bError && bEndTime){
|
||||
srd_session_end(session, &error);
|
||||
|
||||
if (error)
|
||||
if (error != NULL)
|
||||
_error_message = QString::fromLocal8Bit(error);
|
||||
}
|
||||
|
||||
dsv_info("%s%llu", "send to decoder times: ", entry_cnt);
|
||||
|
||||
if (error)
|
||||
if (error != NULL)
|
||||
g_free(error);
|
||||
|
||||
if (!_session->is_closed())
|
||||
@@ -692,14 +703,16 @@ void DecoderStack::execute_decode_stack()
|
||||
_stask_stauts);
|
||||
|
||||
char *error = NULL;
|
||||
if (srd_session_start(session, &error) == SRD_OK)
|
||||
if (srd_session_start(session, &error) == SRD_OK){
|
||||
//need a lot time
|
||||
decode_data(decode_start, decode_end, session);
|
||||
else
|
||||
}
|
||||
else if (error != NULL){
|
||||
_error_message = QString::fromLocal8Bit(error);
|
||||
}
|
||||
|
||||
// Destroy the session
|
||||
if (error) {
|
||||
if (error != NULL) {
|
||||
g_free(error);
|
||||
}
|
||||
|
||||
|
||||
@@ -98,6 +98,7 @@ void DsoSnapshot::clear()
|
||||
free_envelop();
|
||||
init_all();
|
||||
_have_data = false;
|
||||
_envelope_en = false;
|
||||
}
|
||||
|
||||
void DsoSnapshot::free_data()
|
||||
@@ -141,7 +142,8 @@ void DsoSnapshot::first_payload(const sr_datafeed_dso &dso, uint64_t total_sampl
|
||||
|
||||
if (total_sample_count != _total_sample_count
|
||||
|| channel_num != _channel_num
|
||||
|| channel_changed){
|
||||
|| channel_changed
|
||||
|| isFile){
|
||||
|
||||
std::lock_guard<std::mutex> lock(_mutex);
|
||||
|
||||
|
||||
@@ -94,7 +94,8 @@ MeasureDock::MeasureDock(QWidget *parent, View &view, SigSession *session) :
|
||||
_dist_layout->setVerticalSpacing(5);
|
||||
_dist_layout->addWidget(_dist_add_btn, 0, 0);
|
||||
_dist_layout->addWidget(new QLabel(_widget), 0, 1, 1, 3);
|
||||
_dist_layout->addWidget(new QLabel(L_S(STR_PAGE_DLG, S_ID(IDS_DLG_TIME_SAMPLES), "Time/Samples"), _widget), 0, 4);
|
||||
_add_dec_label = new QLabel(L_S(STR_PAGE_DLG, S_ID(IDS_DLG_TIME_SAMPLES), "Time/Samples"), _widget);
|
||||
_dist_layout->addWidget(_add_dec_label, 0, 4);
|
||||
_dist_layout->addWidget(new QLabel(_widget), 0, 5, 1, 2);
|
||||
_dist_layout->setColumnStretch(1, 50);
|
||||
_dist_layout->setColumnStretch(6, 100);
|
||||
@@ -171,6 +172,7 @@ void MeasureDock::retranslateUi()
|
||||
_channel_label->setText(L_S(STR_PAGE_DLG, S_ID(IDS_DLG_CHANNEL), "Channel"));
|
||||
_edge_label->setText(L_S(STR_PAGE_DLG, S_ID(IDS_DLG_RIS_OR_FAL_EDGE), "Rising/Falling/Edges"));
|
||||
_time_label->setText(L_S(STR_PAGE_DLG, S_ID(IDS_DLG_TIME_SAMPLES), "Time/Samples"));
|
||||
_add_dec_label->setText(_time_label->text());
|
||||
|
||||
_w_label->setText(L_S(STR_PAGE_DLG, S_ID(IDS_DLG_W), "W: "));
|
||||
_p_label->setText(L_S(STR_PAGE_DLG, S_ID(IDS_DLG_P), "P: "));
|
||||
|
||||
@@ -111,6 +111,7 @@ private:
|
||||
QLabel *_period_label;
|
||||
QLabel *_freq_label;
|
||||
QLabel *_duty_label;
|
||||
QLabel *_add_dec_label;
|
||||
|
||||
QGridLayout *_dist_layout;
|
||||
QGroupBox *_dist_groupBox;
|
||||
|
||||
@@ -38,6 +38,8 @@
|
||||
#include "../deviceagent.h"
|
||||
#include "../view/logicsignal.h"
|
||||
#include "../ui/langresource.h"
|
||||
#include <QRegExp>
|
||||
#include <QRegExpValidator>
|
||||
|
||||
namespace pv {
|
||||
namespace dock {
|
||||
@@ -587,6 +589,7 @@ void TriggerDock::setup_adv_tab()
|
||||
const QString mask = "N N N N N N N N N N N N N N N N";
|
||||
QRegularExpression value_rx("[10XRFCxrfc ]+");
|
||||
QValidator *value_validator = new QRegularExpressionValidator(value_rx, _stage_tabWidget);
|
||||
|
||||
for (int i = 0; i < TriggerStages; i++) {
|
||||
DsComboBox *_logic_comboBox = new DsComboBox(_stage_tabWidget);
|
||||
_logic_comboBox->addItem(L_S(STR_PAGE_DLG, S_ID(IDS_DLG_OR), "Or"));
|
||||
@@ -756,21 +759,27 @@ void TriggerDock::setup_adv_tab()
|
||||
|
||||
_serial_data_label = new QLabel(_serial_groupBox);
|
||||
_serial_data_comboBox = new DsComboBox(_serial_groupBox);
|
||||
for(int i = 0; i < _cur_ch_num; i++)
|
||||
|
||||
for(int i = 0; i < _cur_ch_num; i++){
|
||||
_serial_data_comboBox->addItem(QString::number(i));
|
||||
}
|
||||
|
||||
_serial_value_label = new QLabel(_serial_groupBox);
|
||||
_serial_value_lineEdit = new QLineEdit("X X X X X X X X X X X X X X X X", _serial_groupBox);
|
||||
_serial_value_lineEdit->setFont(font);
|
||||
_serial_value_lineEdit->setValidator(value_validator);
|
||||
_serial_value_lineEdit->setMaxLength(TriggerProbes * 2 - 1);
|
||||
_serial_value_lineEdit->setInputMask(mask);
|
||||
_serial_value_lineEdit->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
|
||||
|
||||
_serial_bits_comboBox = new DsComboBox(_serial_groupBox);
|
||||
for(int i = 1; i <= 16; i++)
|
||||
_serial_bits_comboBox->addItem(QString::number(i));
|
||||
QRegularExpression value_rx2("[10Xx ]+");
|
||||
QValidator *value_validator2 = new QRegularExpressionValidator(value_rx2, _stage_tabWidget);
|
||||
_serial_value_lineEdit->setValidator(value_validator2);
|
||||
|
||||
_serial_bits_comboBox = new DsComboBox(_serial_groupBox);
|
||||
|
||||
for(int i = 1; i <= 16; i++){
|
||||
_serial_bits_comboBox->addItem(QString::number(i));
|
||||
}
|
||||
|
||||
QVBoxLayout *serial_layout = new QVBoxLayout();
|
||||
QGridLayout *serial_glayout = new QGridLayout();
|
||||
|
||||
@@ -453,11 +453,14 @@ void DsoSignal::set_trig_ratio(double ratio, bool delta_change)
|
||||
_trig_value = ratio2value(delta + 0.5);
|
||||
}
|
||||
else {
|
||||
if (delta < 0.06f)
|
||||
delta = 0.06f;
|
||||
if (delta > 0.945f)
|
||||
delta = 0.945f;
|
||||
|
||||
_trig_value = ratio2value(delta);
|
||||
}
|
||||
|
||||
int margin = TrigMargin;
|
||||
_trig_value = std::min(std::max(_trig_value, margin), (ratio2value(1) - margin));
|
||||
|
||||
if (delta_change)
|
||||
_trig_delta = get_trig_vrate() - get_zero_ratio();
|
||||
session->get_device()->set_config(_probe, NULL, SR_CONF_TRIGGER_VALUE,
|
||||
|
||||
@@ -1474,7 +1474,7 @@ static int receive_data_logic_decoder(int fd, int revents, const struct sr_dev_i
|
||||
|
||||
if (!bCheckFile)
|
||||
{
|
||||
sr_err("cant't locate zip inner file:\"%s\"", file_name);
|
||||
sr_err("can't locate zip inner file:\"%s\"", file_name);
|
||||
send_error_packet(sdi, vdev, &packet);
|
||||
return FALSE;
|
||||
}
|
||||
@@ -1521,7 +1521,7 @@ static int receive_data_logic_decoder(int fd, int revents, const struct sr_dev_i
|
||||
// Read the data to buffer.
|
||||
if (unzOpenCurrentFile(vdev->archive) != UNZ_OK)
|
||||
{
|
||||
sr_err("cant't open zip inner file:\"%s\"", file_name);
|
||||
sr_err("can't open zip inner file:\"%s\"", file_name);
|
||||
send_error_packet(sdi, vdev, &packet);
|
||||
return FALSE;
|
||||
}
|
||||
@@ -1763,7 +1763,14 @@ static int receive_data_dso(int fd, int revents, const struct sr_dev_inst *sdi)
|
||||
|
||||
for (ch_index = 0; ch_index < chan_num; ch_index++)
|
||||
{
|
||||
<<<<<<< HEAD
|
||||
bCheckFile = 0;
|
||||
=======
|
||||
sr_err("can't locate zip inner file:\"%s\"", file_name);
|
||||
send_error_packet(sdi, vdev, &packet);
|
||||
return FALSE;
|
||||
}
|
||||
>>>>>>> source/dev-1.3
|
||||
|
||||
while (1)
|
||||
{
|
||||
@@ -1845,8 +1852,52 @@ static int receive_data_dso(int fd, int revents, const struct sr_dev_inst *sdi)
|
||||
unzCloseCurrentFile(vdev->archive);
|
||||
pack_buffer->block_read_positions[ch_index] = 0; // Reset the read position.
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
vdev->cur_block++;
|
||||
pack_buffer->block_chan_read_pos = 0;
|
||||
=======
|
||||
|
||||
// Read the data to buffer.
|
||||
if (unzOpenCurrentFile(vdev->archive) != UNZ_OK)
|
||||
{
|
||||
sr_err("can't open zip inner file:\"%s\"", file_name);
|
||||
send_error_packet(sdi, vdev, &packet);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
ret = unzReadCurrentFile(vdev->archive, pack_buffer->block_bufs[ch_index], pack_buffer->block_data_len);
|
||||
if (-1 == ret)
|
||||
{
|
||||
sr_err("read zip inner file error:\"%s\"", file_name);
|
||||
send_error_packet(sdi, vdev, &packet);
|
||||
return FALSE;
|
||||
}
|
||||
unzCloseCurrentFile(vdev->archive);
|
||||
pack_buffer->block_read_positions[ch_index] = 0; // Reset the read position.
|
||||
}
|
||||
vdev->cur_block++;
|
||||
pack_buffer->block_chan_read_pos = 0;
|
||||
}
|
||||
|
||||
p_wr = (uint8_t*)pack_buffer->post_buf + pack_buffer->post_len;
|
||||
p_rd = (uint8_t*)pack_buffer->block_bufs[read_chan_index] + pack_buffer->block_read_positions[read_chan_index];
|
||||
*p_wr = *p_rd;
|
||||
|
||||
pack_buffer->post_len++;
|
||||
pack_buffer->block_read_positions[read_chan_index]++;
|
||||
|
||||
if (pack_buffer->block_read_positions[read_chan_index] % byte_align == 0
|
||||
|| pack_buffer->block_read_positions[read_chan_index] == pack_buffer->block_data_len)
|
||||
{
|
||||
read_chan_index++;
|
||||
|
||||
if (pack_buffer->block_read_positions[read_chan_index] == pack_buffer->block_data_len){
|
||||
sr_info("Block read end.");
|
||||
if (vdev->cur_block < vdev->num_blocks){
|
||||
sr_err("%s", "The block data is not align.");
|
||||
break;
|
||||
}
|
||||
>>>>>>> source/dev-1.3
|
||||
}
|
||||
|
||||
p_wr = (uint8_t*)pack_buffer->post_buf + pack_buffer->post_len;
|
||||
@@ -2129,13 +2180,13 @@ static int receive_data_analog(int fd, int revents, const struct sr_dev_inst *sd
|
||||
|
||||
if (unzLocateFile(vdev->archive, file_name, 0) != UNZ_OK)
|
||||
{
|
||||
sr_err("cant't locate zip inner file:\"%s\"", file_name);
|
||||
sr_err("can't locate zip inner file:\"%s\"", file_name);
|
||||
send_error_packet(sdi, vdev, &packet);
|
||||
return FALSE;
|
||||
}
|
||||
if (unzOpenCurrentFile(vdev->archive) != UNZ_OK)
|
||||
{
|
||||
sr_err("cant't open zip inner file:\"%s\"", file_name);
|
||||
sr_err("can't open zip inner file:\"%s\"", file_name);
|
||||
send_error_packet(sdi, vdev, &packet);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -165,6 +165,8 @@ static const char *probeMapUnits[] = {
|
||||
"m/s",
|
||||
};
|
||||
|
||||
static void free_temp_buffer(struct session_vdev *vdev);
|
||||
|
||||
static int trans_data(struct sr_dev_inst *sdi)
|
||||
{
|
||||
// translate for old format
|
||||
@@ -298,13 +300,13 @@ static int receive_data(int fd, int revents, const struct sr_dev_inst *sdi)
|
||||
|
||||
if (unzLocateFile(vdev->archive, file_name, 0) != UNZ_OK)
|
||||
{
|
||||
sr_err("cant't locate zip inner file:\"%s\"", file_name);
|
||||
sr_err("can't locate zip inner file:\"%s\"", file_name);
|
||||
send_error_packet(sdi, vdev, &packet);
|
||||
return FALSE;
|
||||
}
|
||||
if (unzOpenCurrentFile(vdev->archive) != UNZ_OK)
|
||||
{
|
||||
sr_err("cant't open zip inner file:\"%s\"", file_name);
|
||||
sr_err("can't open zip inner file:\"%s\"", file_name);
|
||||
send_error_packet(sdi, vdev, &packet);
|
||||
return FALSE;
|
||||
}
|
||||
@@ -483,7 +485,7 @@ static int receive_data_logic_dso_v2(int fd, int revents, const struct sr_dev_in
|
||||
if (sdi->mode == LOGIC)
|
||||
vdev->packet_buffer->post_buf_len = 8 * chan_num * 1000;
|
||||
else
|
||||
vdev->packet_buffer->post_buf_len = chan_num * 1000;
|
||||
vdev->packet_buffer->post_buf_len = chan_num * 10000;
|
||||
|
||||
vdev->packet_buffer->post_buf = g_try_malloc0(vdev->packet_buffer->post_buf_len + 1);
|
||||
if (vdev->packet_buffer->post_buf == NULL){
|
||||
@@ -495,7 +497,10 @@ static int receive_data_logic_dso_v2(int fd, int revents, const struct sr_dev_in
|
||||
pack_buffer->post_len;
|
||||
pack_buffer->block_buf_len = 0;
|
||||
pack_buffer->block_data_len = 0;
|
||||
pack_buffer->block_chan_read_pos = 0;
|
||||
pack_buffer->block_chan_read_pos = 0;
|
||||
|
||||
if (sdi->mode == DSO)
|
||||
vdev->num_blocks = 1; // Only one data file.
|
||||
}
|
||||
pack_buffer = vdev->packet_buffer;
|
||||
|
||||
@@ -534,7 +539,7 @@ static int receive_data_logic_dso_v2(int fd, int revents, const struct sr_dev_in
|
||||
|
||||
if (!bCheckFile)
|
||||
{
|
||||
sr_err("cant't locate zip inner file:\"%s\"", file_name);
|
||||
sr_err("can't locate zip inner file:\"%s\"", file_name);
|
||||
send_error_packet(sdi, vdev, &packet);
|
||||
return FALSE;
|
||||
}
|
||||
@@ -581,7 +586,7 @@ static int receive_data_logic_dso_v2(int fd, int revents, const struct sr_dev_in
|
||||
// Read the data to buffer.
|
||||
if (unzOpenCurrentFile(vdev->archive) != UNZ_OK)
|
||||
{
|
||||
sr_err("cant't open zip inner file:\"%s\"", file_name);
|
||||
sr_err("can't open zip inner file:\"%s\"", file_name);
|
||||
send_error_packet(sdi, vdev, &packet);
|
||||
return FALSE;
|
||||
}
|
||||
@@ -650,7 +655,7 @@ static int receive_data_logic_dso_v2(int fd, int revents, const struct sr_dev_in
|
||||
dso.mqflags = SR_MQFLAG_AC;
|
||||
dso.num_samples = pack_buffer->post_len / chan_num;
|
||||
dso.data = pack_buffer->post_buf;
|
||||
}
|
||||
}
|
||||
|
||||
// Send data back.
|
||||
ds_data_forward(sdi, &packet);
|
||||
@@ -663,6 +668,7 @@ static int receive_data_logic_dso_v2(int fd, int revents, const struct sr_dev_in
|
||||
ds_data_forward(sdi, &packet);
|
||||
sr_session_source_remove(-1);
|
||||
close_archive(vdev);
|
||||
free_temp_buffer(vdev);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
@@ -755,35 +761,44 @@ static int dev_open(struct sr_dev_inst *sdi)
|
||||
return SR_OK;
|
||||
}
|
||||
|
||||
static void free_temp_buffer(struct session_vdev *vdev)
|
||||
{
|
||||
struct session_packet_buffer *pack_buf;
|
||||
int i;
|
||||
|
||||
assert(vdev);
|
||||
|
||||
pack_buf = vdev->packet_buffer;
|
||||
|
||||
if (pack_buf != NULL)
|
||||
{
|
||||
g_safe_free(pack_buf->post_buf);
|
||||
|
||||
for (i = 0; i < SESSION_MAX_CHANNEL_COUNT; i++){
|
||||
if (pack_buf->block_bufs[i] != NULL){
|
||||
g_free(pack_buf->block_bufs[i]);
|
||||
pack_buf->block_bufs[i] = NULL;
|
||||
}
|
||||
else{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
g_safe_free(vdev->packet_buffer);
|
||||
g_safe_free(vdev->buf);
|
||||
g_safe_free(vdev->logic_buf);
|
||||
}
|
||||
|
||||
static int dev_close(struct sr_dev_inst *sdi)
|
||||
{
|
||||
struct session_vdev *vdev;
|
||||
int i;
|
||||
struct session_packet_buffer *pack_buf;
|
||||
|
||||
if (sdi && sdi->priv)
|
||||
{
|
||||
vdev = sdi->priv;
|
||||
|
||||
if (vdev->packet_buffer != NULL){
|
||||
pack_buf = vdev->packet_buffer;
|
||||
free_temp_buffer(vdev);
|
||||
|
||||
g_safe_free(pack_buf->post_buf);
|
||||
|
||||
for (i = 0; i < SESSION_MAX_CHANNEL_COUNT; i++){
|
||||
if (pack_buf->block_bufs[i] != NULL){
|
||||
g_free(pack_buf->block_bufs[i]);
|
||||
pack_buf->block_bufs[i] = NULL;
|
||||
}
|
||||
else{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
g_safe_free(vdev->packet_buffer);
|
||||
g_safe_free(vdev->buf);
|
||||
g_safe_free(vdev->logic_buf);
|
||||
g_safe_free(sdi->priv);
|
||||
|
||||
sdi->status = SR_ST_INACTIVE;
|
||||
@@ -1369,13 +1384,13 @@ static int dev_acquisition_start(struct sr_dev_inst *sdi, void *cb_data)
|
||||
{
|
||||
if (unzLocateFile(vdev->archive, "data", 0) != UNZ_OK)
|
||||
{
|
||||
sr_err("cant't locate zip inner file:\"%s\"", "data");
|
||||
sr_err("can't locate zip inner file:\"%s\"", "data");
|
||||
close_archive(vdev);
|
||||
return SR_ERR;
|
||||
}
|
||||
if (unzOpenCurrentFile(vdev->archive) != UNZ_OK)
|
||||
{
|
||||
sr_err("cant't open zip inner file:\"%s\"", "data");
|
||||
sr_err("can't open zip inner file:\"%s\"", "data");
|
||||
close_archive(vdev);
|
||||
return SR_ERR;
|
||||
}
|
||||
@@ -1473,7 +1488,7 @@ SR_PRIV int sr_new_virtual_device(const char *filename, struct sr_dev_inst **out
|
||||
}
|
||||
if (unzOpenCurrentFile(archive) != UNZ_OK)
|
||||
{
|
||||
sr_err("cant't open zip inner file:'header',%s", filename);
|
||||
sr_err("can't open zip inner file:'header',%s", filename);
|
||||
unzClose(archive);
|
||||
return SR_ERR;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user