Commit 9eb36b33 authored by DreamSourceLab's avatar DreamSourceLab

v0.4 release

parent 5d7e3237
This diff is collapsed.
...@@ -4,14 +4,12 @@ ...@@ -4,14 +4,12 @@
<file>icons/next.png</file> <file>icons/next.png</file>
<file>icons/pre.png</file> <file>icons/pre.png</file>
<file>icons/file.png</file> <file>icons/file.png</file>
<file>icons/photo.png</file>
<file>icons/save.png</file> <file>icons/save.png</file>
<file>icons/open.png</file> <file>icons/open.png</file>
<file>icons/params.png</file> <file>icons/params.png</file>
<file>stylesheet.qss</file> <file>stylesheet.qss</file>
<file>icons/down-arrow.png</file> <file>icons/down-arrow.png</file>
<file>icons/slider-handle.png</file> <file>icons/slider-handle.png</file>
<file>icons/set.png</file>
<file>icons/add.png</file> <file>icons/add.png</file>
<file>icons/del.png</file> <file>icons/del.png</file>
<file>icons/trigger.png</file> <file>icons/trigger.png</file>
...@@ -20,14 +18,22 @@ ...@@ -20,14 +18,22 @@
<file>icons/protocol.png</file> <file>icons/protocol.png</file>
<file>icons/logo_noColor.png</file> <file>icons/logo_noColor.png</file>
<file>icons/logo_color.png</file> <file>icons/logo_color.png</file>
<file>icons/logo_muColor.png</file>
<file>icons/about.png</file> <file>icons/about.png</file>
<file>icons/capture.png</file> <file>icons/capture.png</file>
<file>icons/stop.png</file> <file>icons/stop.png</file>
<file>icons/start.png</file> <file>icons/start.png</file>
<file>icons/dsl_logo.png</file> <file>icons/dsl_logo.png</file>
<file>icons/logo.png</file> <file>icons/logo.png</file>
<file>icons/checkbox.png</file> <file>icons/decoder-hidden.png</file>
<file>icons/radiobutton.png</file> <file>icons/decoder-shown.png</file>
<file>icons/instant.png</file>
<file>icons/trigger_dis.png</file>
<file>icons/file_dis.png</file>
<file>icons/measure_dis.png</file>
<file>icons/protocol_dis.png</file>
<file>icons/search-bar_dis.png</file>
<file>icons/params_dis.png</file>
<file>icons/gear.png</file>
<file>icons/wiki.png</file>
</qresource> </qresource>
</RCC> </RCC>
DSLogic-gui/icons/about.png

1.03 KB | W: | H:

DSLogic-gui/icons/about.png

5.95 KB | W: | H:

DSLogic-gui/icons/about.png
DSLogic-gui/icons/about.png
DSLogic-gui/icons/about.png
DSLogic-gui/icons/about.png
  • 2-up
  • Swipe
  • Onion skin
DSLogic-gui/icons/capture.png

2.01 KB | W: | H:

DSLogic-gui/icons/capture.png

5.87 KB | W: | H:

DSLogic-gui/icons/capture.png
DSLogic-gui/icons/capture.png
DSLogic-gui/icons/capture.png
DSLogic-gui/icons/capture.png
  • 2-up
  • Swipe
  • Onion skin
DSLogic-gui/icons/file.png

450 Bytes | W: | H:

DSLogic-gui/icons/file.png

1.16 KB | W: | H:

DSLogic-gui/icons/file.png
DSLogic-gui/icons/file.png
DSLogic-gui/icons/file.png
DSLogic-gui/icons/file.png
  • 2-up
  • Swipe
  • Onion skin
DSLogic-gui/icons/logo_color.png

364 Bytes | W: | H:

DSLogic-gui/icons/logo_color.png

2.34 KB | W: | H:

DSLogic-gui/icons/logo_color.png
DSLogic-gui/icons/logo_color.png
DSLogic-gui/icons/logo_color.png
DSLogic-gui/icons/logo_color.png
  • 2-up
  • Swipe
  • Onion skin
DSLogic-gui/icons/logo_noColor.png

364 Bytes | W: | H:

DSLogic-gui/icons/logo_noColor.png

1.86 KB | W: | H:

DSLogic-gui/icons/logo_noColor.png
DSLogic-gui/icons/logo_noColor.png
DSLogic-gui/icons/logo_noColor.png
DSLogic-gui/icons/logo_noColor.png
  • 2-up
  • Swipe
  • Onion skin
DSLogic-gui/icons/measure.png

1.84 KB | W: | H:

DSLogic-gui/icons/measure.png

1.26 KB | W: | H:

DSLogic-gui/icons/measure.png
DSLogic-gui/icons/measure.png
DSLogic-gui/icons/measure.png
DSLogic-gui/icons/measure.png
  • 2-up
  • Swipe
  • Onion skin
DSLogic-gui/icons/next.png

632 Bytes | W: | H:

DSLogic-gui/icons/next.png

5.73 KB | W: | H:

DSLogic-gui/icons/next.png
DSLogic-gui/icons/next.png
DSLogic-gui/icons/next.png
DSLogic-gui/icons/next.png
  • 2-up
  • Swipe
  • Onion skin
DSLogic-gui/icons/open.png

1.15 KB | W: | H:

DSLogic-gui/icons/open.png

5.67 KB | W: | H:

DSLogic-gui/icons/open.png
DSLogic-gui/icons/open.png
DSLogic-gui/icons/open.png
DSLogic-gui/icons/open.png
  • 2-up
  • Swipe
  • Onion skin
DSLogic-gui/icons/params.png

1.92 KB | W: | H:

DSLogic-gui/icons/params.png

1.35 KB | W: | H:

DSLogic-gui/icons/params.png
DSLogic-gui/icons/params.png
DSLogic-gui/icons/params.png
DSLogic-gui/icons/params.png
  • 2-up
  • Swipe
  • Onion skin
DSLogic-gui/icons/pre.png

648 Bytes | W: | H:

DSLogic-gui/icons/pre.png

5.71 KB | W: | H:

DSLogic-gui/icons/pre.png
DSLogic-gui/icons/pre.png
DSLogic-gui/icons/pre.png
DSLogic-gui/icons/pre.png
  • 2-up
  • Swipe
  • Onion skin
DSLogic-gui/icons/protocol.png

2.45 KB | W: | H:

DSLogic-gui/icons/protocol.png

1.11 KB | W: | H:

DSLogic-gui/icons/protocol.png
DSLogic-gui/icons/protocol.png
DSLogic-gui/icons/protocol.png
DSLogic-gui/icons/protocol.png
  • 2-up
  • Swipe
  • Onion skin
DSLogic-gui/icons/save.png

1.15 KB | W: | H:

DSLogic-gui/icons/save.png

5.53 KB | W: | H:

DSLogic-gui/icons/save.png
DSLogic-gui/icons/save.png
DSLogic-gui/icons/save.png
DSLogic-gui/icons/save.png
  • 2-up
  • Swipe
  • Onion skin
DSLogic-gui/icons/search-bar.png

1.93 KB | W: | H:

DSLogic-gui/icons/search-bar.png

1.65 KB | W: | H:

DSLogic-gui/icons/search-bar.png
DSLogic-gui/icons/search-bar.png
DSLogic-gui/icons/search-bar.png
DSLogic-gui/icons/search-bar.png
  • 2-up
  • Swipe
  • Onion skin
DSLogic-gui/icons/start.png

1.22 KB | W: | H:

DSLogic-gui/icons/start.png

1.21 KB | W: | H:

DSLogic-gui/icons/start.png
DSLogic-gui/icons/start.png
DSLogic-gui/icons/start.png
DSLogic-gui/icons/start.png
  • 2-up
  • Swipe
  • Onion skin
DSLogic-gui/icons/stop.png

1.08 KB | W: | H:

DSLogic-gui/icons/stop.png

789 Bytes | W: | H:

DSLogic-gui/icons/stop.png
DSLogic-gui/icons/stop.png
DSLogic-gui/icons/stop.png
DSLogic-gui/icons/stop.png
  • 2-up
  • Swipe
  • Onion skin
DSLogic-gui/icons/trigger.png

4.36 KB | W: | H:

DSLogic-gui/icons/trigger.png

1007 Bytes | W: | H:

DSLogic-gui/icons/trigger.png
DSLogic-gui/icons/trigger.png
DSLogic-gui/icons/trigger.png
DSLogic-gui/icons/trigger.png
  • 2-up
  • Swipe
  • Onion skin
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
*/ */
#ifdef ENABLE_SIGROKDECODE #ifdef ENABLE_DECODE
#include <libsigrokdecode/libsigrokdecode.h> /* First, so we avoid a _POSIX_C_SOURCE warning. */ #include <libsigrokdecode/libsigrokdecode.h> /* First, so we avoid a _POSIX_C_SOURCE warning. */
#endif #endif
...@@ -33,12 +33,15 @@ ...@@ -33,12 +33,15 @@
#include <QtGui/QApplication> #include <QtGui/QApplication>
#include <QDebug> #include <QDebug>
#include <QFile> #include <QFile>
#include <QDir>
#include "pv/devicemanager.h" #include "pv/devicemanager.h"
#include "pv/mainwindow.h" #include "pv/mainwindow.h"
#include "config.h" #include "config.h"
char decoders_path[256];
void usage() void usage()
{ {
fprintf(stdout, fprintf(stdout,
...@@ -85,7 +88,7 @@ int main(int argc, char *argv[]) ...@@ -85,7 +88,7 @@ int main(int argc, char *argv[])
const int loglevel = atoi(optarg); const int loglevel = atoi(optarg);
sr_log_loglevel_set(loglevel); sr_log_loglevel_set(loglevel);
#ifdef ENABLE_SIGROKDECODE #ifdef ENABLE_DECODE
srd_log_loglevel_set(loglevel); srd_log_loglevel_set(loglevel);
#endif #endif
...@@ -118,7 +121,12 @@ int main(int argc, char *argv[]) ...@@ -118,7 +121,12 @@ int main(int argc, char *argv[])
do { do {
#ifdef ENABLE_SIGROKDECODE #ifdef ENABLE_DECODE
QDir dir(QCoreApplication::applicationDirPath());
assert(dir.cd("decoders"));
std::string str = dir.absolutePath().toStdString() + "/";
strcpy(decoders_path, str.c_str());
// Initialise libsigrokdecode // Initialise libsigrokdecode
if (srd_init(NULL) != SRD_OK) { if (srd_init(NULL) != SRD_OK) {
qDebug() << "ERROR: libsigrokdecode init failed."; qDebug() << "ERROR: libsigrokdecode init failed.";
...@@ -148,7 +156,7 @@ int main(int argc, char *argv[]) ...@@ -148,7 +156,7 @@ int main(int argc, char *argv[])
qDebug() << e.what(); qDebug() << e.what();
} }
#ifdef ENABLE_SIGROKDECODE #ifdef ENABLE_DECODE
// Destroy libsigrokdecode // Destroy libsigrokdecode
srd_exit(); srd_exit();
#endif #endif
......
...@@ -30,11 +30,17 @@ using namespace std; ...@@ -30,11 +30,17 @@ using namespace std;
namespace pv { namespace pv {
namespace data { namespace data {
Analog::Analog(unsigned int num_probes, uint64_t samplerate) : Analog::Analog(unsigned int num_probes) :
SignalData(num_probes, samplerate) SignalData(),
_num_probes(num_probes)
{ {
} }
int Analog::get_num_probes() const
{
return _num_probes;
}
void Analog::push_snapshot(boost::shared_ptr<AnalogSnapshot> &snapshot) void Analog::push_snapshot(boost::shared_ptr<AnalogSnapshot> &snapshot)
{ {
_snapshots.push_front(snapshot); _snapshots.push_front(snapshot);
...@@ -45,5 +51,10 @@ deque< boost::shared_ptr<AnalogSnapshot> >& Analog::get_snapshots() ...@@ -45,5 +51,10 @@ deque< boost::shared_ptr<AnalogSnapshot> >& Analog::get_snapshots()
return _snapshots; return _snapshots;
} }
void Analog::clear()
{
_snapshots.clear();
}
} // namespace data } // namespace data
} // namespace pv } // namespace pv
...@@ -37,7 +37,9 @@ class AnalogSnapshot; ...@@ -37,7 +37,9 @@ class AnalogSnapshot;
class Analog : public SignalData class Analog : public SignalData
{ {
public: public:
Analog(unsigned int num_probes, uint64_t samplerate); Analog(unsigned int num_probes);
int get_num_probes() const;
void push_snapshot( void push_snapshot(
boost::shared_ptr<AnalogSnapshot> &snapshot); boost::shared_ptr<AnalogSnapshot> &snapshot);
...@@ -45,7 +47,10 @@ public: ...@@ -45,7 +47,10 @@ public:
std::deque< boost::shared_ptr<AnalogSnapshot> >& std::deque< boost::shared_ptr<AnalogSnapshot> >&
get_snapshots(); get_snapshots();
void clear();
private: private:
const unsigned int _num_probes;
std::deque< boost::shared_ptr<AnalogSnapshot> > _snapshots; std::deque< boost::shared_ptr<AnalogSnapshot> > _snapshots;
}; };
......
...@@ -75,6 +75,8 @@ void AnalogSnapshot::append_payload( ...@@ -75,6 +75,8 @@ void AnalogSnapshot::append_payload(
const uint16_t* AnalogSnapshot::get_samples( const uint16_t* AnalogSnapshot::get_samples(
int64_t start_sample, int64_t end_sample) const int64_t start_sample, int64_t end_sample) const
{ {
(void)end_sample;
assert(start_sample >= 0); assert(start_sample >= 0);
assert(start_sample < (int64_t)get_sample_count()); assert(start_sample < (int64_t)get_sample_count());
assert(end_sample >= 0); assert(end_sample >= 0);
......
/*
* This file is part of the PulseView project.
*
* Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
extern "C" {
#include <libsigrokdecode/libsigrokdecode.h>
}
#include <vector>
#include <assert.h>
#include "annotation.h"
namespace pv {
namespace data {
namespace decode {
Annotation::Annotation(const srd_proto_data *const pdata) :
_start_sample(pdata->start_sample),
_end_sample(pdata->end_sample)
{
assert(pdata);
const srd_proto_data_annotation *const pda =
(const srd_proto_data_annotation*)pdata->data;
assert(pda);
_format = pda->ann_format;
const char *const *annotations = (char**)pda->ann_text;
while(*annotations) {
_annotations.push_back(QString::fromUtf8(*annotations));
annotations++;
}
}
uint64_t Annotation::start_sample() const
{
return _start_sample;
}
uint64_t Annotation::end_sample() const
{
return _end_sample;
}
int Annotation::format() const
{
return _format;
}
const std::vector<QString>& Annotation::annotations() const
{
return _annotations;
}
} // namespace decode
} // namespace data
} // namespace pv
/*
* This file is part of the PulseView project.
*
* Copyright (C) 2013 Joel Holdsworth <joel@airwebreathe.org.uk>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef DSLOGIC_PV_VIEW_DECODE_ANNOTATION_H
#define DSLOGIC_PV_VIEW_DECODE_ANNOTATION_H
#include <stdint.h>
#include <QString>
struct srd_proto_data;
namespace pv {
namespace data {
namespace decode {
class Annotation
{
public:
Annotation(const srd_proto_data *const pdata);
uint64_t start_sample() const;
uint64_t end_sample() const;
int format() const;
const std::vector<QString>& annotations() const;
private:
uint64_t _start_sample;
uint64_t _end_sample;
int _format;
std::vector<QString> _annotations;
};
} // namespace decode
} // namespace data
} // namespace pv
#endif // DSLOGIC_PV_VIEW_DECODE_ANNOTATION_H
/*
* This file is part of the PulseView project.
*
* Copyright (C) 2013 Joel Holdsworth <joel@airwebreathe.org.uk>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <libsigrok4DSLogic/libsigrok.h>
#include <libsigrokdecode/libsigrokdecode.h>
#include "decoder.h"
#include <pv/view/logicsignal.h>
using boost::shared_ptr;
using std::set;
using std::map;
using std::string;
namespace pv {
namespace data {
namespace decode {
Decoder::Decoder(const srd_decoder *const dec) :
_decoder(dec),
_shown(true),
_shown_back(true),
_shown_setted(false),
_setted(true)
{
}
Decoder::~Decoder()
{
for (map<string, GVariant*>::const_iterator i = _options.begin();
i != _options.end(); i++)
g_variant_unref((*i).second);
}
const srd_decoder* Decoder::decoder() const
{
return _decoder;
}
bool Decoder::shown() const
{
return _shown;
}
void Decoder::show(bool show)
{
_shown_back = show;
_shown_setted = true;
}
void Decoder::commit_show()
{
if (_shown_setted) {
_shown = _shown_back;
_shown_setted = false;
}
}
const map<const srd_channel*, shared_ptr<view::LogicSignal> >&
Decoder::channels() const
{
return _probes;
}
void Decoder::set_probes(std::map<const srd_channel*,
boost::shared_ptr<view::LogicSignal> > probes)
{
_probes_back = probes;
_setted = true;
}
const std::map<std::string, GVariant*>& Decoder::options() const
{
return _options;
}
void Decoder::set_option(const char *id, GVariant *value)
{
assert(value);
g_variant_ref(value);
_options_back[id] = value;
_setted = true;
}
bool Decoder::commit()
{
if (_setted) {
_probes = _probes_back;
_options = _options_back;
_setted = false;
return true;
} else {
return false;
}
}
bool Decoder::have_required_probes() const
{
for (GSList *l = _decoder->channels; l; l = l->next) {
const srd_channel *const pdch = (const srd_channel*)l->data;
assert(pdch);
if (_probes.find(pdch) == _probes.end())
return false;
}
return true;
}
set< shared_ptr<pv::data::Logic> > Decoder::get_data()
{
set< shared_ptr<pv::data::Logic> > data;
for(map<const srd_channel*, shared_ptr<view::LogicSignal> >::
const_iterator i = _probes.begin();
i != _probes.end(); i++)
{
shared_ptr<view::LogicSignal> signal((*i).second);
assert(signal);
data.insert(signal->logic_data());
}
return data;
}
srd_decoder_inst* Decoder::create_decoder_inst(srd_session *session, int unit_size) const
{
GHashTable *const opt_hash = g_hash_table_new_full(g_str_hash,
g_str_equal, g_free, (GDestroyNotify)g_variant_unref);
for (map<string, GVariant*>::const_iterator i = _options.begin();
i != _options.end(); i++)
{
GVariant *const value = (*i).second;
g_variant_ref(value);
g_hash_table_replace(opt_hash, (void*)g_strdup(
(*i).first.c_str()), value);
}
srd_decoder_inst *const decoder_inst = srd_inst_new(
session, _decoder->id, opt_hash);
g_hash_table_destroy(opt_hash);
if(!decoder_inst)
return NULL;
// Setup the probes
GHashTable *const probes = g_hash_table_new_full(g_str_hash,
g_str_equal, g_free, (GDestroyNotify)g_variant_unref);
for(map<const srd_channel*, shared_ptr<view::LogicSignal> >::
const_iterator i = _probes.begin();
i != _probes.end(); i++)
{
shared_ptr<view::LogicSignal> signal((*i).second);
GVariant *const gvar = g_variant_new_int32(
signal->probe()->index);
g_variant_ref_sink(gvar);
g_hash_table_insert(probes, (*i).first->id, gvar);
}
srd_inst_channel_set_all(decoder_inst, probes, unit_size);
return decoder_inst;
}
} // decode
} // data
} // pv
/*
* This file is part of the PulseView project.
*
* Copyright (C) 2013 Joel Holdsworth <joel@airwebreathe.org.uk>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License