2
0
forked from Ivasoft/DSView

update: The acquisition stops halfway and the decoding continues

This commit is contained in:
dreamsourcelabTAI
2022-04-29 18:37:40 +08:00
parent c3ab42fcf5
commit 041f8eb071
7 changed files with 24 additions and 10 deletions

View File

@@ -22,6 +22,7 @@
#include "row.h"
#include <libsigrokdecode4DSL/libsigrokdecode.h>
#include <assert.h>
namespace pv {
namespace data {
@@ -63,6 +64,8 @@ QString Row::title() const
bool Row::operator<(const Row &other) const
{
assert(_decoder);
return (_decoder < other._decoder) ||
(_decoder == other._decoder && _order < other._order);
}

View File

@@ -65,7 +65,7 @@ DecoderStack::DecoderStack(pv::SigSession *session,
_no_memory = false;
_mark_index = -1;
_decoder_status = decoder_status;
_stask_stauts = NULL;
_stask_stauts = NULL;
_stack.push_back(new decode::Decoder(dec));
@@ -595,7 +595,7 @@ void DecoderStack::decode_data(const uint64_t decode_start, const uint64_t decod
void DecoderStack::execute_decode_stack()
{
srd_session *session;
srd_session *session = NULL;
srd_decoder_inst *prev_di = NULL;
uint64_t decode_start = 0;
uint64_t decode_end = 0;
@@ -655,6 +655,7 @@ void DecoderStack::execute_decode_stack()
if (error) {
g_free(error);
}
srd_session_destroy(session);
}
@@ -683,7 +684,7 @@ void DecoderStack::annotation_callback(srd_proto_data *pdata, void *self)
assert(d);
if (st->_bStop){
qDebug()<<"decode task was stoped.";
// qDebug()<<"decode task was stoped.";
return;
}
if (d->_decoder_status == NULL){

View File

@@ -193,7 +193,7 @@ private:
uint64_t _sample_count;
decode_task_status *_stask_stauts;
mutable std::mutex _output_mutex;
mutable std::mutex _output_mutex;
friend class DecoderStackTest::TwoDecoderStack;
};

View File

@@ -430,6 +430,10 @@ void SigSession::start_capture(bool instant)
return;
}
// stop all decode tasks
int run_dex = 0;
clear_all_decode_task(run_dex);
// stop previous capture
stop_capture();
@@ -1366,7 +1370,12 @@ bool SigSession::add_decoder(srd_decoder *const dec, bool silent, DecoderStatus
if (ret)
{
_decode_traces.push_back(trace);
add_decode_task(trace);
//add decode task from ui
if (!silent){
add_decode_task(trace);
}
signals_changed();
data_updated();
}
@@ -1917,7 +1926,7 @@ void SigSession::set_stop_scale(float scale)
//the decode task thread proc
void SigSession::decode_task_proc(){
//qDebug()<<"decode thread start";
qDebug()<<"------->decode thread start";
auto task = get_top_decode_task();
while (task != NULL)
@@ -1941,7 +1950,7 @@ void SigSession::set_stop_scale(float scale)
task = get_top_decode_task();
}
// qDebug()<<"decode thread end";
qDebug()<<"------->decode thread end";
_bDecodeRunning = false;
}

View File

@@ -1229,8 +1229,9 @@ SRD_PRIV int srd_inst_decode(struct srd_decoder_inst *di,
if (!di->thread_handle) {
srd_dbg("No worker thread for this decoder stack "
"exists yet, creating one: %s.", di->inst_id);
di->thread_handle = g_thread_new(di->inst_id,
di_thread, di);
di_thread, di);
}
/* Push the new sample chunk to the worker thread. */

View File

@@ -349,7 +349,7 @@ struct srd_proto_data {
uint64_t start_sample;
uint64_t end_sample;
struct srd_pd_output *pdo;
void *data;
void *data;
};
struct srd_proto_data_annotation {
int ann_class;

View File

@@ -463,7 +463,7 @@ static PyObject *Decoder_put(PyObject *self, PyObject *args)
uint64_t start_sample, end_sample;
int output_id;
struct srd_pd_callback *cb;
PyGILState_STATE gstate;
PyGILState_STATE gstate;
py_data = NULL; //the fourth param from python