mirror of
https://github.com/DreamSourceLab/DSView.git
synced 2025-01-13 13:32:53 +08:00
none
This commit is contained in:
parent
21be857649
commit
801af9e125
@ -71,8 +71,10 @@ bool AppControl::Init()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char *decoderScriptDir = "/home/lala/tmpdir/any";
|
||||||
|
|
||||||
// Initialise libsigrokdecode
|
// Initialise libsigrokdecode
|
||||||
if (srd_init(NULL) != SRD_OK)
|
if (srd_init(decoderScriptDir) != SRD_OK)
|
||||||
{
|
{
|
||||||
m_error = "ERROR: libsigrokdecode init failed.";
|
m_error = "ERROR: libsigrokdecode init failed.";
|
||||||
return false;
|
return false;
|
||||||
|
@ -516,11 +516,18 @@ void DecoderStack::decode_data(const uint64_t decode_start, const uint64_t decod
|
|||||||
if (chunk_end - i > MaxChunkSize)
|
if (chunk_end - i > MaxChunkSize)
|
||||||
chunk_end = i + MaxChunkSize;
|
chunk_end = i + MaxChunkSize;
|
||||||
|
|
||||||
if (srd_session_send(session, i, chunk_end,
|
if (srd_session_send(
|
||||||
chunk.data(), chunk_const.data(), chunk_end - i, &error) != SRD_OK) {
|
session,
|
||||||
|
i,
|
||||||
|
chunk_end,
|
||||||
|
chunk.data(),
|
||||||
|
chunk_const.data(),
|
||||||
|
chunk_end - i,
|
||||||
|
&error) != SRD_OK){
|
||||||
_error_message = QString::fromLocal8Bit(error);
|
_error_message = QString::fromLocal8Bit(error);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
i = chunk_end;
|
i = chunk_end;
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -94,9 +94,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void push(decode::Decoder *decoder);
|
void push(decode::Decoder *decoder);
|
||||||
|
|
||||||
void remove(decode::Decoder *decoder);
|
void remove(decode::Decoder *decoder);
|
||||||
|
|
||||||
void build_row();
|
void build_row();
|
||||||
|
|
||||||
int64_t samples_decoded();
|
int64_t samples_decoded();
|
||||||
@ -111,7 +109,6 @@ public:
|
|||||||
|
|
||||||
uint64_t get_annotation_index(
|
uint64_t get_annotation_index(
|
||||||
const decode::Row &row, uint64_t start_sample);
|
const decode::Row &row, uint64_t start_sample);
|
||||||
|
|
||||||
uint64_t get_max_annotation(const decode::Row &row);
|
uint64_t get_max_annotation(const decode::Row &row);
|
||||||
uint64_t get_min_annotation(const decode::Row &row); // except instant(end=start) annotation
|
uint64_t get_min_annotation(const decode::Row &row); // except instant(end=start) annotation
|
||||||
|
|
||||||
@ -119,9 +116,7 @@ public:
|
|||||||
std::map<const decode::Row, bool> get_rows_lshow();
|
std::map<const decode::Row, bool> get_rows_lshow();
|
||||||
void set_rows_gshow(const decode::Row row, bool show);
|
void set_rows_gshow(const decode::Row row, bool show);
|
||||||
void set_rows_lshow(const decode::Row row, bool show);
|
void set_rows_lshow(const decode::Row row, bool show);
|
||||||
|
|
||||||
bool has_annotations(const decode::Row &row);
|
bool has_annotations(const decode::Row &row);
|
||||||
|
|
||||||
uint64_t list_annotation_size();
|
uint64_t list_annotation_size();
|
||||||
uint64_t list_annotation_size(uint16_t row_index);
|
uint64_t list_annotation_size(uint16_t row_index);
|
||||||
|
|
||||||
@ -131,13 +126,9 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
bool list_row_title(int row, QString &title);
|
bool list_row_title(int row, QString &title);
|
||||||
|
|
||||||
QString error_message();
|
QString error_message();
|
||||||
|
|
||||||
void clear();
|
void clear();
|
||||||
|
|
||||||
void init();
|
void init();
|
||||||
|
|
||||||
uint64_t get_max_sample_count();
|
uint64_t get_max_sample_count();
|
||||||
|
|
||||||
inline bool IsRunning(){
|
inline bool IsRunning(){
|
||||||
@ -145,31 +136,22 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void begin_decode_work();
|
void begin_decode_work();
|
||||||
|
|
||||||
void do_decode_work();
|
void do_decode_work();
|
||||||
|
void stop_decode_work();
|
||||||
void stop_decode_work();
|
|
||||||
|
|
||||||
int list_rows_size();
|
int list_rows_size();
|
||||||
|
|
||||||
bool options_changed();
|
bool options_changed();
|
||||||
void set_options_changed(bool changed);
|
void set_options_changed(bool changed);
|
||||||
|
|
||||||
uint64_t sample_count();
|
uint64_t sample_count();
|
||||||
uint64_t sample_rate();
|
uint64_t sample_rate();
|
||||||
|
|
||||||
bool out_of_memory();
|
bool out_of_memory();
|
||||||
|
|
||||||
void set_mark_index(int64_t index);
|
void set_mark_index(int64_t index);
|
||||||
int64_t get_mark_index();
|
int64_t get_mark_index();
|
||||||
|
|
||||||
void frame_ended();
|
void frame_ended();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void decode_data(const uint64_t decode_start, const uint64_t decode_end, srd_session *const session);
|
void decode_data(const uint64_t decode_start, const uint64_t decode_end, srd_session *const session);
|
||||||
|
|
||||||
void decode_proc();
|
void decode_proc();
|
||||||
|
|
||||||
static void annotation_callback(srd_proto_data *pdata, void *decoder);
|
static void annotation_callback(srd_proto_data *pdata, void *decoder);
|
||||||
|
|
||||||
|
|
||||||
@ -179,7 +161,6 @@ signals:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
std::list<decode::Decoder*> _stack;
|
std::list<decode::Decoder*> _stack;
|
||||||
|
|
||||||
pv::data::LogicSnapshot *_snapshot;
|
pv::data::LogicSnapshot *_snapshot;
|
||||||
|
|
||||||
std::map<const decode::Row, decode::RowData*> _rows;
|
std::map<const decode::Row, decode::RowData*> _rows;
|
||||||
@ -192,15 +173,15 @@ private:
|
|||||||
volatile bool _options_changed;
|
volatile bool _options_changed;
|
||||||
volatile bool _no_memory;
|
volatile bool _no_memory;
|
||||||
int64_t _mark_index;
|
int64_t _mark_index;
|
||||||
|
|
||||||
DecoderStatus *_decoder_status;
|
DecoderStatus *_decoder_status;
|
||||||
QString _error_message;
|
QString _error_message;
|
||||||
int64_t _samples_decoded;
|
int64_t _samples_decoded;
|
||||||
uint64_t _sample_count;
|
uint64_t _sample_count;
|
||||||
|
|
||||||
decode_task_status *_stask_stauts;
|
decode_task_status *_stask_stauts;
|
||||||
|
|
||||||
mutable std::mutex _output_mutex;
|
mutable std::mutex _output_mutex;
|
||||||
|
|
||||||
friend class DecoderStackTest::TwoDecoderStack;
|
friend class DecoderStackTest::TwoDecoderStack;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -195,9 +195,7 @@ ProtocolDock::ProtocolDock(QWidget *parent, view::View &view, SigSession *sessio
|
|||||||
connect(_table_view->horizontalHeader(), SIGNAL(sectionResized(int,int,int)), this, SLOT(column_resize(int, int, int)));
|
connect(_table_view->horizontalHeader(), SIGNAL(sectionResized(int,int,int)), this, SLOT(column_resize(int, int, int)));
|
||||||
connect(_search_edit, SIGNAL(editingFinished()), this, SLOT(search_changed()));
|
connect(_search_edit, SIGNAL(editingFinished()), this, SLOT(search_changed()));
|
||||||
|
|
||||||
retranslateUi();
|
retranslateUi();
|
||||||
|
|
||||||
ds_debug("protocol panel\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ProtocolDock::~ProtocolDock()
|
ProtocolDock::~ProtocolDock()
|
||||||
@ -303,14 +301,19 @@ void ProtocolDock::add_protocol(bool silent)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//have no protocol
|
||||||
|
if (_protocol_combobox->count() == 0){
|
||||||
|
if (!silent){
|
||||||
|
MsgBox::Show(NULL, "Protocol list is empty!");
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
srd_decoder *const decoder =
|
srd_decoder *const decoder =
|
||||||
(srd_decoder *)(_protocol_combobox->itemData(_protocol_combobox->currentIndex())).value<void *>();
|
(srd_decoder *)(_protocol_combobox->itemData(_protocol_combobox->currentIndex())).value<void *>();
|
||||||
|
|
||||||
DecoderStatus *dstatus = new DecoderStatus();
|
DecoderStatus *dstatus = new DecoderStatus();
|
||||||
dstatus->m_format = (int)DecoderDataFormat::hex;
|
dstatus->m_format = (int)DecoderDataFormat::hex;
|
||||||
|
|
||||||
int numm= _protocol_items.size();
|
|
||||||
numm += 0;
|
|
||||||
|
|
||||||
if (_session->add_decoder(decoder, silent, dstatus))
|
if (_session->add_decoder(decoder, silent, dstatus))
|
||||||
{
|
{
|
||||||
|
@ -21,9 +21,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include <libsigrokdecode4DSL/libsigrokdecode.h>
|
|
||||||
#include "dock/protocoldock.h"
|
|
||||||
|
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
#include <QButtonGroup>
|
#include <QButtonGroup>
|
||||||
@ -70,6 +67,7 @@
|
|||||||
#include "dock/dsotriggerdock.h"
|
#include "dock/dsotriggerdock.h"
|
||||||
#include "dock/measuredock.h"
|
#include "dock/measuredock.h"
|
||||||
#include "dock/searchdock.h"
|
#include "dock/searchdock.h"
|
||||||
|
#include "dock/protocoldock.h"
|
||||||
|
|
||||||
#include "view/view.h"
|
#include "view/view.h"
|
||||||
#include "view/trace.h"
|
#include "view/trace.h"
|
||||||
@ -168,19 +166,16 @@ void MainWindow::setup_ui()
|
|||||||
addToolBar(_trig_bar);
|
addToolBar(_trig_bar);
|
||||||
addToolBar(_file_bar);
|
addToolBar(_file_bar);
|
||||||
addToolBar(_logo_bar);
|
addToolBar(_logo_bar);
|
||||||
|
|
||||||
// Setup the dockWidget
|
//Setup the dockWidget
|
||||||
|
|
||||||
// protocol dock
|
|
||||||
_protocol_dock=new QDockWidget(tr("Protocol"),this);
|
_protocol_dock=new QDockWidget(tr("Protocol"),this);
|
||||||
_protocol_dock->setObjectName("protocol_dock");
|
_protocol_dock->setObjectName("protocol_dock");
|
||||||
_protocol_dock->setFeatures(QDockWidget::DockWidgetMovable);
|
_protocol_dock->setFeatures(QDockWidget::DockWidgetMovable);
|
||||||
_protocol_dock->setAllowedAreas(Qt::RightDockWidgetArea);
|
_protocol_dock->setAllowedAreas(Qt::RightDockWidgetArea);
|
||||||
_protocol_dock->setVisible(false);
|
_protocol_dock->setVisible(false);
|
||||||
//dock::ProtocolDock *_protocol_widget = new dock::ProtocolDock(_protocol_dock, _session);
|
|
||||||
_protocol_widget = new dock::ProtocolDock(_protocol_dock, *_view, _session);
|
_protocol_widget = new dock::ProtocolDock(_protocol_dock, *_view, _session);
|
||||||
_protocol_dock->setWidget(_protocol_widget);
|
_protocol_dock->setWidget(_protocol_widget);
|
||||||
qDebug() << "Protocol decoder enabled!\n";
|
//qDebug() << "Protocol decoder enabled!\n";
|
||||||
|
|
||||||
|
|
||||||
// measure dock
|
// measure dock
|
||||||
@ -224,9 +219,7 @@ void MainWindow::setup_ui()
|
|||||||
_logo_bar->installEventFilter(this);
|
_logo_bar->installEventFilter(this);
|
||||||
_dso_trigger_dock->installEventFilter(this);
|
_dso_trigger_dock->installEventFilter(this);
|
||||||
_trigger_dock->installEventFilter(this);
|
_trigger_dock->installEventFilter(this);
|
||||||
|
|
||||||
_protocol_dock->installEventFilter(this);
|
_protocol_dock->installEventFilter(this);
|
||||||
|
|
||||||
_measure_dock->installEventFilter(this);
|
_measure_dock->installEventFilter(this);
|
||||||
_search_dock->installEventFilter(this);
|
_search_dock->installEventFilter(this);
|
||||||
|
|
||||||
|
@ -437,8 +437,7 @@ void SigSession::start_capture(bool instant)
|
|||||||
dsoSig->set_mValid(false);
|
dsoSig->set_mValid(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// update setting
|
// update setting
|
||||||
qDebug()<<"device name:"<<_dev_inst->name();
|
|
||||||
|
|
||||||
if (_dev_inst->name() != "virtual-session")
|
if (_dev_inst->name() != "virtual-session")
|
||||||
_instant = instant;
|
_instant = instant;
|
||||||
@ -1167,8 +1166,6 @@ void SigSession::data_feed_in(const struct sr_dev_inst *sdi,
|
|||||||
_dso_data->snapshot()->capture_ended();
|
_dso_data->snapshot()->capture_ended();
|
||||||
_analog_data->snapshot()->capture_ended();
|
_analog_data->snapshot()->capture_ended();
|
||||||
|
|
||||||
qDebug()<<"data frame end";
|
|
||||||
|
|
||||||
for (auto trace : _decode_traces){
|
for (auto trace : _decode_traces){
|
||||||
trace->decoder()->frame_ended();
|
trace->decoder()->frame_ended();
|
||||||
trace->frame_ended();
|
trace->frame_ended();
|
||||||
@ -1248,7 +1245,7 @@ void SigSession::hotplug_proc()
|
|||||||
} catch(...) {
|
} catch(...) {
|
||||||
qDebug("Interrupt exception for hotplug thread was thrown.");
|
qDebug("Interrupt exception for hotplug thread was thrown.");
|
||||||
}
|
}
|
||||||
qDebug("Hotplug thread exit!");
|
// qDebug("Hotplug thread exit!");
|
||||||
}
|
}
|
||||||
|
|
||||||
void SigSession::register_hotplug_callback()
|
void SigSession::register_hotplug_callback()
|
||||||
@ -1271,10 +1268,9 @@ void SigSession::deregister_hotplug_callback()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SigSession::start_hotplug_work()
|
void SigSession::start_hotplug_work()
|
||||||
{
|
{
|
||||||
|
|
||||||
// Begin the session
|
// Begin the session
|
||||||
qDebug() << "Starting a hotplug thread...\n";
|
// qDebug() << "Starting a hotplug thread...\n";
|
||||||
_hot_attach = false;
|
_hot_attach = false;
|
||||||
_hot_detach = false;
|
_hot_detach = false;
|
||||||
|
|
||||||
@ -1788,7 +1784,7 @@ void SigSession::set_stop_scale(float scale)
|
|||||||
//append a decode task, and try create a thread
|
//append a decode task, and try create a thread
|
||||||
void SigSession::add_decode_task(view::DecodeTrace *trace)
|
void SigSession::add_decode_task(view::DecodeTrace *trace)
|
||||||
{
|
{
|
||||||
qDebug()<<"add a decode task";
|
//qDebug()<<"add a decode task";
|
||||||
|
|
||||||
std::lock_guard<std::mutex> lock(_decode_task_mutex);
|
std::lock_guard<std::mutex> lock(_decode_task_mutex);
|
||||||
_decode_tasks.push_back(trace);
|
_decode_tasks.push_back(trace);
|
||||||
@ -1844,7 +1840,7 @@ void SigSession::set_stop_scale(float scale)
|
|||||||
//wait thread end
|
//wait thread end
|
||||||
if (_decode_thread.joinable())
|
if (_decode_thread.joinable())
|
||||||
{
|
{
|
||||||
qDebug() << "wait the decode thread end";
|
// qDebug() << "wait the decode thread end";
|
||||||
_decode_thread.join();
|
_decode_thread.join();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1900,12 +1896,12 @@ void SigSession::set_stop_scale(float scale)
|
|||||||
//the decode task thread proc
|
//the decode task thread proc
|
||||||
void SigSession::decode_task_proc(){
|
void SigSession::decode_task_proc(){
|
||||||
|
|
||||||
qDebug()<<"decode thread start";
|
//qDebug()<<"decode thread start";
|
||||||
auto task = get_top_decode_task();
|
auto task = get_top_decode_task();
|
||||||
|
|
||||||
while (task != NULL)
|
while (task != NULL)
|
||||||
{
|
{
|
||||||
qDebug()<<"one decode task be actived";
|
// qDebug()<<"one decode task be actived";
|
||||||
|
|
||||||
if (!task->_delete_flag){
|
if (!task->_delete_flag){
|
||||||
task->decoder()->begin_decode_work();
|
task->decoder()->begin_decode_work();
|
||||||
@ -1924,7 +1920,7 @@ void SigSession::set_stop_scale(float scale)
|
|||||||
task = get_top_decode_task();
|
task = get_top_decode_task();
|
||||||
}
|
}
|
||||||
|
|
||||||
qDebug()<<"decode thread end";
|
// qDebug()<<"decode thread end";
|
||||||
_bDecodeRunning = false;
|
_bDecodeRunning = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -274,7 +274,6 @@ private:
|
|||||||
void set_capture_state(capture_state state);
|
void set_capture_state(capture_state state);
|
||||||
void register_hotplug_callback();
|
void register_hotplug_callback();
|
||||||
void deregister_hotplug_callback();
|
void deregister_hotplug_callback();
|
||||||
|
|
||||||
bool do_add_decoder(srd_decoder *const dec, bool silent, DecoderStatus *dstatus);
|
bool do_add_decoder(srd_decoder *const dec, bool silent, DecoderStatus *dstatus);
|
||||||
|
|
||||||
void add_decode_task(view::DecodeTrace *trace);
|
void add_decode_task(view::DecodeTrace *trace);
|
||||||
@ -301,25 +300,17 @@ private:
|
|||||||
* used, or NULL if no input format was selected or
|
* used, or NULL if no input format was selected or
|
||||||
* auto-detected.
|
* auto-detected.
|
||||||
*/
|
*/
|
||||||
static sr_input_format* determine_input_file_format(
|
static sr_input_format* determine_input_file_format(const std::string &filename);
|
||||||
const std::string &filename);
|
|
||||||
|
|
||||||
void sample_thread_proc(DevInst *dev_inst);
|
void sample_thread_proc(DevInst *dev_inst);
|
||||||
|
|
||||||
// data feed
|
// data feed
|
||||||
void feed_in_header(const sr_dev_inst *sdi);
|
void feed_in_header(const sr_dev_inst *sdi);
|
||||||
|
void feed_in_meta(const sr_dev_inst *sdi, const sr_datafeed_meta &meta);
|
||||||
void feed_in_meta(const sr_dev_inst *sdi,
|
|
||||||
const sr_datafeed_meta &meta);
|
|
||||||
|
|
||||||
void feed_in_trigger(const ds_trigger_pos &trigger_pos);
|
void feed_in_trigger(const ds_trigger_pos &trigger_pos);
|
||||||
|
|
||||||
void feed_in_logic(const sr_datafeed_logic &logic);
|
void feed_in_logic(const sr_datafeed_logic &logic);
|
||||||
|
|
||||||
void feed_in_dso(const sr_datafeed_dso &dso);
|
void feed_in_dso(const sr_datafeed_dso &dso);
|
||||||
|
void feed_in_analog(const sr_datafeed_analog &analog);
|
||||||
void feed_in_analog(const sr_datafeed_analog &analog);
|
|
||||||
|
|
||||||
void data_feed_in(const struct sr_dev_inst *sdi,
|
void data_feed_in(const struct sr_dev_inst *sdi,
|
||||||
const struct sr_datafeed_packet *packet);
|
const struct sr_datafeed_packet *packet);
|
||||||
|
|
||||||
|
@ -23,23 +23,22 @@
|
|||||||
#define __STDC_FORMAT_MACROS
|
#define __STDC_FORMAT_MACROS
|
||||||
|
|
||||||
#include "storesession.h"
|
#include "storesession.h"
|
||||||
|
#include "sigsession.h"
|
||||||
|
|
||||||
#include <pv/sigsession.h>
|
#include "data/logic.h"
|
||||||
#include <pv/data/logic.h>
|
#include "data/logicsnapshot.h"
|
||||||
#include <pv/data/logicsnapshot.h>
|
#include "data/dsosnapshot.h"
|
||||||
#include <pv/data/dsosnapshot.h>
|
#include "data/analogsnapshot.h"
|
||||||
#include <pv/data/analogsnapshot.h>
|
#include "data/decoderstack.h"
|
||||||
#include <pv/data/decoderstack.h>
|
#include "data/decode/decoder.h"
|
||||||
#include <pv/data/decode/decoder.h>
|
#include "data/decode/row.h"
|
||||||
#include <pv/data/decode/row.h>
|
#include "view/trace.h"
|
||||||
#include <pv/view/trace.h>
|
#include "view/signal.h"
|
||||||
#include <pv/view/signal.h>
|
#include "view/logicsignal.h"
|
||||||
#include <pv/view/logicsignal.h>
|
#include "view/dsosignal.h"
|
||||||
#include <pv/view/dsosignal.h>
|
#include "view/decodetrace.h"
|
||||||
#include <pv/view/decodetrace.h>
|
#include "device/devinst.h"
|
||||||
#include <pv/device/devinst.h>
|
#include "dock/protocoldock.h"
|
||||||
#include <pv/dock/protocoldock.h>
|
|
||||||
|
|
||||||
|
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
@ -51,7 +50,7 @@
|
|||||||
#include <QTextStream>
|
#include <QTextStream>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
|
#include <libsigrokdecode4DSL/libsigrokdecode.h>
|
||||||
#include "config/appconfig.h"
|
#include "config/appconfig.h"
|
||||||
|
|
||||||
namespace pv {
|
namespace pv {
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
|
||||||
#include <libsigrok4DSL/libsigrok.h>
|
#include <libsigrok4DSL/libsigrok.h>
|
||||||
#include <libsigrokdecode4DSL/libsigrokdecode.h>
|
|
||||||
#include "ZipMaker.h"
|
#include "ZipMaker.h"
|
||||||
|
|
||||||
namespace pv {
|
namespace pv {
|
||||||
|
@ -339,11 +339,14 @@ void SamplingBar::zero_adj()
|
|||||||
if ((dsoSig = dynamic_cast<view::DsoSignal*>(s)))
|
if ((dsoSig = dynamic_cast<view::DsoSignal*>(s)))
|
||||||
dsoSig->set_enable(true);
|
dsoSig->set_enable(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
const int index_back = _sample_count.currentIndex();
|
const int index_back = _sample_count.currentIndex();
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
for (i = 0; i < _sample_count.count(); i++)
|
for (i = 0; i < _sample_count.count(); i++)
|
||||||
if (_sample_count.itemData(i).value<uint64_t>() == ZeroTimeBase)
|
if (_sample_count.itemData(i).value<uint64_t>() == ZeroTimeBase)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
_sample_count.setCurrentIndex(i);
|
_sample_count.setCurrentIndex(i);
|
||||||
commit_hori_res();
|
commit_hori_res();
|
||||||
|
|
||||||
@ -722,8 +725,6 @@ double SamplingBar::get_hori_res()
|
|||||||
double SamplingBar::hori_knob(int dir)
|
double SamplingBar::hori_knob(int dir)
|
||||||
{
|
{
|
||||||
double hori_res = -1;
|
double hori_res = -1;
|
||||||
disconnect(&_sample_count, SIGNAL(currentIndexChanged(int)),
|
|
||||||
this, SLOT(on_samplecount_sel(int)));
|
|
||||||
|
|
||||||
if (0 == dir) {
|
if (0 == dir) {
|
||||||
hori_res = commit_hori_res();
|
hori_res = commit_hori_res();
|
||||||
@ -735,6 +736,9 @@ double SamplingBar::hori_knob(int dir)
|
|||||||
hori_res = commit_hori_res();
|
hori_res = commit_hori_res();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
disconnect(&_sample_count, SIGNAL(currentIndexChanged(int)),
|
||||||
|
this, SLOT(on_samplecount_sel(int)));
|
||||||
|
|
||||||
connect(&_sample_count, SIGNAL(currentIndexChanged(int)),
|
connect(&_sample_count, SIGNAL(currentIndexChanged(int)),
|
||||||
this, SLOT(on_samplecount_sel(int)));
|
this, SLOT(on_samplecount_sel(int)));
|
||||||
|
|
||||||
|
@ -64,6 +64,7 @@ namespace pv
|
|||||||
static const int RefreshShort = 500;
|
static const int RefreshShort = 500;
|
||||||
static const uint64_t LogicMaxSWDepth64 = SR_GB(16);
|
static const uint64_t LogicMaxSWDepth64 = SR_GB(16);
|
||||||
static const uint64_t LogicMaxSWDepth32 = SR_GB(8);
|
static const uint64_t LogicMaxSWDepth32 = SR_GB(8);
|
||||||
|
|
||||||
static const uint64_t AnalogMaxSWDepth = SR_Mn(100);
|
static const uint64_t AnalogMaxSWDepth = SR_Mn(100);
|
||||||
static const QString RLEString;
|
static const QString RLEString;
|
||||||
static const QString DIVString;
|
static const QString DIVString;
|
||||||
@ -71,11 +72,8 @@ namespace pv
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
SamplingBar(SigSession *session, QWidget *parent);
|
SamplingBar(SigSession *session, QWidget *parent);
|
||||||
|
|
||||||
void set_device_list(const std::list<DevInst*> &devices, DevInst* selected);
|
void set_device_list(const std::list<DevInst*> &devices, DevInst* selected);
|
||||||
|
|
||||||
DevInst *get_selected_device();
|
DevInst *get_selected_device();
|
||||||
|
|
||||||
void update_sample_rate_selector();
|
void update_sample_rate_selector();
|
||||||
|
|
||||||
void set_sampling(bool sampling);
|
void set_sampling(bool sampling);
|
||||||
@ -83,9 +81,7 @@ namespace pv
|
|||||||
bool get_instant();
|
bool get_instant();
|
||||||
|
|
||||||
void enable_toggle(bool enable);
|
void enable_toggle(bool enable);
|
||||||
|
|
||||||
void enable_run_stop(bool enable);
|
void enable_run_stop(bool enable);
|
||||||
|
|
||||||
void enable_instant(bool enable);
|
void enable_instant(bool enable);
|
||||||
|
|
||||||
double hori_knob(int dir);
|
double hori_knob(int dir);
|
||||||
@ -132,37 +128,33 @@ namespace pv
|
|||||||
void reload();
|
void reload();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SigSession *_session;
|
SigSession *_session;
|
||||||
|
mutable std::mutex _sampling_mutex;
|
||||||
|
bool _enable;
|
||||||
|
bool _sampling;
|
||||||
|
|
||||||
mutable std::mutex _sampling_mutex;
|
QToolButton _device_type;
|
||||||
bool _enable;
|
QComboBox _device_selector;
|
||||||
bool _sampling;
|
|
||||||
|
|
||||||
QToolButton _device_type;
|
|
||||||
|
|
||||||
QComboBox _device_selector;
|
|
||||||
std::map<const void *, DevInst*> _device_selector_map;
|
std::map<const void *, DevInst*> _device_selector_map;
|
||||||
bool _updating_device_selector;
|
bool _updating_device_selector;
|
||||||
|
|
||||||
QToolButton _configure_button;
|
QToolButton _configure_button;
|
||||||
|
QComboBox _sample_count;
|
||||||
|
QComboBox _sample_rate;
|
||||||
|
bool _updating_sample_rate;
|
||||||
|
bool _updating_sample_count;
|
||||||
|
|
||||||
QComboBox _sample_count;
|
QToolButton _run_stop_button;
|
||||||
QComboBox _sample_rate;
|
QToolButton _instant_button;
|
||||||
bool _updating_sample_rate;
|
QAction *_run_stop_action;
|
||||||
bool _updating_sample_count;
|
QAction *_instant_action;
|
||||||
|
QAction *_mode_action;
|
||||||
|
QToolButton _mode_button;
|
||||||
|
|
||||||
QToolButton _run_stop_button;
|
QMenu *_mode_menu;
|
||||||
QToolButton _instant_button;
|
QAction *_action_repeat;
|
||||||
QAction *_run_stop_action;
|
QAction *_action_single;
|
||||||
QAction *_instant_action;
|
bool _instant;
|
||||||
|
|
||||||
QAction *_mode_action;
|
|
||||||
QToolButton _mode_button;
|
|
||||||
QMenu *_mode_menu;
|
|
||||||
QAction *_action_repeat;
|
|
||||||
QAction *_action_single;
|
|
||||||
|
|
||||||
bool _instant;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace toolbars
|
} // namespace toolbars
|
||||||
|
@ -58,6 +58,8 @@ Header::Header(View &parent) :
|
|||||||
_moveFlag = false;
|
_moveFlag = false;
|
||||||
_colorFlag = false;
|
_colorFlag = false;
|
||||||
_nameFlag = false;
|
_nameFlag = false;
|
||||||
|
_context_trace = NULL;
|
||||||
|
|
||||||
nameEdit = new QLineEdit(this);
|
nameEdit = new QLineEdit(this);
|
||||||
nameEdit->setFixedWidth(100);
|
nameEdit->setFixedWidth(100);
|
||||||
nameEdit->hide();
|
nameEdit->hide();
|
||||||
|
@ -190,7 +190,7 @@ SRD_API int srd_init(const char *path)
|
|||||||
size_t i;
|
size_t i;
|
||||||
int ret;
|
int ret;
|
||||||
const char *env_path;
|
const char *env_path;
|
||||||
|
|
||||||
if (max_session_id != -1) {
|
if (max_session_id != -1) {
|
||||||
srd_err("libsigrokdecode is already initialized.");
|
srd_err("libsigrokdecode is already initialized.");
|
||||||
return SRD_ERR;
|
return SRD_ERR;
|
||||||
@ -202,30 +202,15 @@ SRD_API int srd_init(const char *path)
|
|||||||
PyImport_AppendInittab("sigrokdecode", PyInit_sigrokdecode);
|
PyImport_AppendInittab("sigrokdecode", PyInit_sigrokdecode);
|
||||||
|
|
||||||
/* Initialize the Python interpreter. */
|
/* Initialize the Python interpreter. */
|
||||||
Py_InitializeEx(0);
|
Py_InitializeEx(0);
|
||||||
|
|
||||||
/* Locations relative to the XDG system data directories. */
|
|
||||||
sys_datadirs = g_get_system_data_dirs();
|
|
||||||
for (i = g_strv_length((char **)sys_datadirs); i > 0; i--) {
|
|
||||||
ret = searchpath_add_xdg_dir(sys_datadirs[i-1]);
|
|
||||||
if (ret != SRD_OK) {
|
|
||||||
Py_Finalize();
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#ifdef DECODERS_DIR
|
#ifdef DECODERS_DIR
|
||||||
/* Hardcoded decoders install location, if defined. */
|
/* Hardcoded decoders install location, if defined. */
|
||||||
if ((ret = srd_decoder_searchpath_add(DECODERS_DIR)) != SRD_OK) {
|
if ((ret = srd_decoder_searchpath_add(DECODERS_DIR)) != SRD_OK) {
|
||||||
Py_Finalize();
|
Py_Finalize();
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
/* Location relative to the XDG user data directory. */
|
|
||||||
ret = searchpath_add_xdg_dir(g_get_user_data_dir());
|
|
||||||
if (ret != SRD_OK) {
|
|
||||||
Py_Finalize();
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Path specified by the user. */
|
/* Path specified by the user. */
|
||||||
if (path) {
|
if (path) {
|
||||||
@ -234,13 +219,36 @@ SRD_API int srd_init(const char *path)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else{
|
||||||
|
/* Locations relative to the XDG system data directories. */
|
||||||
|
sys_datadirs = g_get_system_data_dirs();
|
||||||
|
for (i = g_strv_length((char **)sys_datadirs); i > 0; i--)
|
||||||
|
{
|
||||||
|
ret = searchpath_add_xdg_dir(sys_datadirs[i - 1]);
|
||||||
|
if (ret != SRD_OK)
|
||||||
|
{
|
||||||
|
Py_Finalize();
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Environment variable overrides everything, for debugging. */
|
/* Location relative to the XDG user data directory. */
|
||||||
if ((env_path = g_getenv("SIGROKDECODE_DIR"))) {
|
ret = searchpath_add_xdg_dir(g_get_user_data_dir());
|
||||||
if ((ret = srd_decoder_searchpath_add(env_path)) != SRD_OK) {
|
if (ret != SRD_OK)
|
||||||
|
{
|
||||||
Py_Finalize();
|
Py_Finalize();
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Environment variable overrides everything, for debugging. */
|
||||||
|
if ((env_path = g_getenv("SIGROKDECODE_DIR")))
|
||||||
|
{
|
||||||
|
if ((ret = srd_decoder_searchpath_add(env_path)) != SRD_OK)
|
||||||
|
{
|
||||||
|
Py_Finalize();
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize the Python GIL (this also happens to acquire it). */
|
/* Initialize the Python GIL (this also happens to acquire it). */
|
||||||
|
@ -39,13 +39,13 @@ SRD_PRIV PyObject *py_import_by_name(const char *name)
|
|||||||
PyGILState_STATE gstate;
|
PyGILState_STATE gstate;
|
||||||
|
|
||||||
gstate = PyGILState_Ensure();
|
gstate = PyGILState_Ensure();
|
||||||
|
|
||||||
py_modname = PyUnicode_FromString(name);
|
py_modname = PyUnicode_FromString(name);
|
||||||
if (!py_modname) {
|
if (!py_modname) {
|
||||||
PyGILState_Release(gstate);
|
PyGILState_Release(gstate);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
py_mod = PyImport_Import(py_modname);
|
py_mod = PyImport_Import(py_modname);
|
||||||
Py_DECREF(py_modname);
|
Py_DECREF(py_modname);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user