summaryrefslogtreecommitdiff
path: root/DSLogic-gui/pv/data
diff options
context:
space:
mode:
Diffstat (limited to 'DSLogic-gui/pv/data')
-rw-r--r--DSLogic-gui/pv/data/analog.cpp4
-rw-r--r--DSLogic-gui/pv/data/analogsnapshot.cpp10
-rw-r--r--DSLogic-gui/pv/data/dso.cpp48
-rw-r--r--DSLogic-gui/pv/data/dso.h54
-rw-r--r--DSLogic-gui/pv/data/dsosnapshot.cpp232
-rw-r--r--DSLogic-gui/pv/data/dsosnapshot.h97
-rw-r--r--DSLogic-gui/pv/data/group.cpp4
-rw-r--r--DSLogic-gui/pv/data/groupsnapshot.cpp14
-rw-r--r--DSLogic-gui/pv/data/logic.cpp4
-rw-r--r--DSLogic-gui/pv/data/logicsnapshot.cpp14
-rw-r--r--DSLogic-gui/pv/data/snapshot.cpp14
11 files changed, 463 insertions, 32 deletions
diff --git a/DSLogic-gui/pv/data/analog.cpp b/DSLogic-gui/pv/data/analog.cpp
index a62e288..d4e6304 100644
--- a/DSLogic-gui/pv/data/analog.cpp
+++ b/DSLogic-gui/pv/data/analog.cpp
@@ -35,12 +35,12 @@ Analog::Analog(unsigned int num_probes, uint64_t samplerate) :
{
}
-void Analog::push_snapshot(shared_ptr<AnalogSnapshot> &snapshot)
+void Analog::push_snapshot(boost::shared_ptr<AnalogSnapshot> &snapshot)
{
_snapshots.push_front(snapshot);
}
-deque< shared_ptr<AnalogSnapshot> >& Analog::get_snapshots()
+deque< boost::shared_ptr<AnalogSnapshot> >& Analog::get_snapshots()
{
return _snapshots;
}
diff --git a/DSLogic-gui/pv/data/analogsnapshot.cpp b/DSLogic-gui/pv/data/analogsnapshot.cpp
index 3ff8e80..f613983 100644
--- a/DSLogic-gui/pv/data/analogsnapshot.cpp
+++ b/DSLogic-gui/pv/data/analogsnapshot.cpp
@@ -49,7 +49,7 @@ const uint64_t AnalogSnapshot::EnvelopeDataUnit = 64*1024; // bytes
AnalogSnapshot::AnalogSnapshot(const sr_datafeed_analog &analog, uint64_t _total_sample_len, unsigned int channel_num) :
Snapshot(sizeof(uint16_t), _total_sample_len, channel_num)
{
- lock_guard<recursive_mutex> lock(_mutex);
+ boost::lock_guard<boost::recursive_mutex> lock(_mutex);
memset(_envelope_levels, 0, sizeof(_envelope_levels));
init(_total_sample_len * channel_num);
append_payload(analog);
@@ -57,7 +57,7 @@ AnalogSnapshot::AnalogSnapshot(const sr_datafeed_analog &analog, uint64_t _total
AnalogSnapshot::~AnalogSnapshot()
{
- lock_guard<recursive_mutex> lock(_mutex);
+ boost::lock_guard<boost::recursive_mutex> lock(_mutex);
BOOST_FOREACH(Envelope &e, _envelope_levels[0])
free(e.samples);
}
@@ -65,7 +65,7 @@ AnalogSnapshot::~AnalogSnapshot()
void AnalogSnapshot::append_payload(
const sr_datafeed_analog &analog)
{
- lock_guard<recursive_mutex> lock(_mutex);
+ boost::lock_guard<boost::recursive_mutex> lock(_mutex);
append_data(analog.data, analog.num_samples);
// Generate the first mip-map from the data
@@ -81,7 +81,7 @@ const uint16_t* AnalogSnapshot::get_samples(
assert(end_sample < (int64_t)get_sample_count());
assert(start_sample <= end_sample);
- lock_guard<recursive_mutex> lock(_mutex);
+ boost::lock_guard<boost::recursive_mutex> lock(_mutex);
// uint16_t *const data = new uint16_t[end_sample - start_sample];
// memcpy(data, (uint16_t*)_data + start_sample, sizeof(uint16_t) *
@@ -97,7 +97,7 @@ void AnalogSnapshot::get_envelope_section(EnvelopeSection &s,
assert(start <= end);
assert(min_length > 0);
- lock_guard<recursive_mutex> lock(_mutex);
+ boost::lock_guard<boost::recursive_mutex> lock(_mutex);
const unsigned int min_level = max((int)floorf(logf(min_length) /
LogEnvelopeScaleFactor) - 1, 0);
diff --git a/DSLogic-gui/pv/data/dso.cpp b/DSLogic-gui/pv/data/dso.cpp
new file mode 100644
index 0000000..fc967ff
--- /dev/null
+++ b/DSLogic-gui/pv/data/dso.cpp
@@ -0,0 +1,48 @@
+/*
+ * This file is part of the DSLogic-gui project.
+ * DSLogic-gui is based on PulseView.
+ *
+ * Copyright (C) 2013 DreamSourceLab <dreamsourcelab@dreamsourcelab.com>
+ *
+ * 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 "dso.h"
+#include "dsosnapshot.h"
+
+using namespace boost;
+using namespace std;
+
+namespace pv {
+namespace data {
+
+Dso::Dso(unsigned int num_probes, uint64_t samplerate) :
+ SignalData(num_probes, samplerate)
+{
+}
+
+void Dso::push_snapshot(boost::shared_ptr<DsoSnapshot> &snapshot)
+{
+ _snapshots.push_front(snapshot);
+}
+
+deque< boost::shared_ptr<DsoSnapshot> >& Dso::get_snapshots()
+{
+ return _snapshots;
+}
+
+} // namespace data
+} // namespace pv
diff --git a/DSLogic-gui/pv/data/dso.h b/DSLogic-gui/pv/data/dso.h
new file mode 100644
index 0000000..591fa27
--- /dev/null
+++ b/DSLogic-gui/pv/data/dso.h
@@ -0,0 +1,54 @@
+/*
+ * This file is part of the DSLogic-gui project.
+ * DSLogic-gui is based on PulseView.
+ *
+ * Copyright (C) 2013 DreamSourceLab <dreamsourcelab@dreamsourcelab.com>
+ *
+ * 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_DATA_DSO_H
+#define DSLOGIC_PV_DATA_DSO_H
+
+#include "signaldata.h"
+
+#include <boost/shared_ptr.hpp>
+#include <deque>
+
+namespace pv {
+namespace data {
+
+class DsoSnapshot;
+
+class Dso : public SignalData
+{
+public:
+ Dso(unsigned int num_probes, uint64_t samplerate);
+
+ void push_snapshot(
+ boost::shared_ptr<DsoSnapshot> &snapshot);
+
+ std::deque< boost::shared_ptr<DsoSnapshot> >&
+ get_snapshots();
+
+private:
+ std::deque< boost::shared_ptr<DsoSnapshot> > _snapshots;
+};
+
+} // namespace data
+} // namespace pv
+
+#endif // DSLOGIC_PV_DATA_DSO_H
diff --git a/DSLogic-gui/pv/data/dsosnapshot.cpp b/DSLogic-gui/pv/data/dsosnapshot.cpp
new file mode 100644
index 0000000..fb05e5d
--- /dev/null
+++ b/DSLogic-gui/pv/data/dsosnapshot.cpp
@@ -0,0 +1,232 @@
+/*
+ * This file is part of the DSLogic-gui project.
+ * DSLogic-gui is based on PulseView.
+ *
+ * Copyright (C) 2013 DreamSourceLab <dreamsourcelab@dreamsourcelab.com>
+ *
+ * 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 <extdef.h>
+
+#include <assert.h>
+#include <string.h>
+#include <stdlib.h>
+#include <math.h>
+
+#include <algorithm>
+
+#include <boost/foreach.hpp>
+
+#include "dsosnapshot.h"
+
+using namespace boost;
+using namespace std;
+
+namespace pv {
+namespace data {
+
+const int DsoSnapshot::EnvelopeScalePower = 4;
+const int DsoSnapshot::EnvelopeScaleFactor = 1 << EnvelopeScalePower;
+const float DsoSnapshot::LogEnvelopeScaleFactor =
+ logf(EnvelopeScaleFactor);
+const uint64_t DsoSnapshot::EnvelopeDataUnit = 64*1024; // bytes
+
+DsoSnapshot::DsoSnapshot(const sr_datafeed_dso &dso, uint64_t _total_sample_len, unsigned int channel_num) :
+ Snapshot(sizeof(uint16_t), _total_sample_len, channel_num)
+{
+ boost::lock_guard<boost::recursive_mutex> lock(_mutex);
+ memset(_envelope_levels, 0, sizeof(_envelope_levels));
+ init(_total_sample_len * channel_num);
+ append_payload(dso);
+}
+
+DsoSnapshot::~DsoSnapshot()
+{
+ boost::lock_guard<boost::recursive_mutex> lock(_mutex);
+ BOOST_FOREACH(Envelope &e, _envelope_levels[0])
+ free(e.samples);
+}
+
+void DsoSnapshot::append_payload(const sr_datafeed_dso &dso)
+{
+ boost::lock_guard<boost::recursive_mutex> lock(_mutex);
+ append_data(dso.data, dso.num_samples);
+
+ // Generate the first mip-map from the data
+ append_payload_to_envelope_levels();
+}
+
+const uint8_t *DsoSnapshot::get_samples(
+ int64_t start_sample, int64_t end_sample, uint16_t index) const
+{
+ assert(start_sample >= 0);
+ assert(start_sample < (int64_t)get_sample_count());
+ assert(end_sample >= 0);
+ assert(end_sample < (int64_t)get_sample_count());
+ assert(start_sample <= end_sample);
+
+ boost::lock_guard<boost::recursive_mutex> lock(_mutex);
+
+// uint16_t *const data = new uint16_t[end_sample - start_sample];
+// memcpy(data, (uint16_t*)_data + start_sample, sizeof(uint16_t) *
+// (end_sample - start_sample));
+// return data;
+ return (uint8_t*)_data + start_sample * _channel_num + index;
+}
+
+void DsoSnapshot::get_envelope_section(EnvelopeSection &s,
+ uint64_t start, uint64_t end, float min_length, int probe_index) const
+{
+ assert(end <= get_sample_count());
+ assert(start <= end);
+ assert(min_length > 0);
+
+ boost::lock_guard<boost::recursive_mutex> lock(_mutex);
+
+ const unsigned int min_level = max((int)floorf(logf(min_length) /
+ LogEnvelopeScaleFactor) - 1, 0);
+ const unsigned int scale_power = (min_level + 1) *
+ EnvelopeScalePower;
+ start >>= scale_power;
+ end >>= scale_power;
+
+ s.start = start << scale_power;
+ s.scale = 1 << scale_power;
+ s.length = end - start;
+// s.samples = new EnvelopeSample[s.length];
+// memcpy(s.samples, _envelope_levels[min_level].samples + start,
+// s.length * sizeof(EnvelopeSample));
+ s.samples = _envelope_levels[probe_index][min_level].samples + start;
+}
+
+void DsoSnapshot::reallocate_envelope(Envelope &e)
+{
+ const uint64_t new_data_length = ((e.length + EnvelopeDataUnit - 1) /
+ EnvelopeDataUnit) * EnvelopeDataUnit;
+ if (new_data_length > e.data_length)
+ {
+ e.data_length = new_data_length;
+ e.samples = (EnvelopeSample*)realloc(e.samples,
+ new_data_length * sizeof(EnvelopeSample));
+ }
+}
+
+void DsoSnapshot::append_payload_to_envelope_levels()
+{
+ unsigned int i;
+ for (i = 0; i < _channel_num; i++) {
+ Envelope &e0 = _envelope_levels[i][0];
+ uint64_t prev_length;
+ EnvelopeSample *dest_ptr;
+
+ // Expand the data buffer to fit the new samples
+ prev_length = e0.length;
+ e0.length = get_sample_count() / EnvelopeScaleFactor;
+
+ // Break off if there are no new samples to compute
+ // if (e0.length == prev_length)
+ // return;
+ if (e0.length == 0)
+ return;
+ if (e0.length == prev_length)
+ prev_length = 0;
+
+ reallocate_envelope(e0);
+
+ dest_ptr = e0.samples + prev_length;
+
+ // Iterate through the samples to populate the first level mipmap
+ const uint8_t *const stop_src_ptr = (uint8_t*)_data +
+ e0.length * EnvelopeScaleFactor * _channel_num;
+// for (const uint16_t *src_ptr = (uint16_t*)_data +
+// prev_length * EnvelopeScaleFactor;
+// src_ptr < end_src_ptr; src_ptr += EnvelopeScaleFactor)
+// {
+// const EnvelopeSample sub_sample = {
+// *min_element(src_ptr, src_ptr + EnvelopeScaleFactor),
+// *max_element(src_ptr, src_ptr + EnvelopeScaleFactor),
+// };
+
+// *dest_ptr++ = sub_sample;
+// }
+ for (const uint8_t *src_ptr = (uint8_t*)_data +
+ prev_length * EnvelopeScaleFactor * _channel_num + i;
+ src_ptr < stop_src_ptr; src_ptr += EnvelopeScaleFactor * _channel_num)
+ {
+ const uint8_t * begin_src_ptr =
+ src_ptr;
+ const uint8_t *const end_src_ptr =
+ src_ptr + EnvelopeScaleFactor * _channel_num;
+
+ EnvelopeSample sub_sample;
+ sub_sample.min = *begin_src_ptr;
+ sub_sample.max = *begin_src_ptr;
+ begin_src_ptr += _channel_num;
+ while (begin_src_ptr < end_src_ptr)
+ {
+ sub_sample.min = min(sub_sample.min, *begin_src_ptr);
+ sub_sample.max = max(sub_sample.max, *begin_src_ptr);
+ begin_src_ptr += _channel_num;
+ }
+
+ *dest_ptr++ = sub_sample;
+ }
+
+ // Compute higher level mipmaps
+ for (unsigned int level = 1; level < ScaleStepCount; level++)
+ {
+ Envelope &e = _envelope_levels[i][level];
+ const Envelope &el = _envelope_levels[i][level-1];
+
+ // Expand the data buffer to fit the new samples
+ prev_length = e.length;
+ e.length = el.length / EnvelopeScaleFactor;
+
+ // Break off if there are no more samples to computed
+ // if (e.length == prev_length)
+ // break;
+ if (e.length == prev_length)
+ prev_length = 0;
+
+ reallocate_envelope(e);
+
+ // Subsample the level lower level
+ const EnvelopeSample *src_ptr =
+ el.samples + prev_length * EnvelopeScaleFactor;
+ const EnvelopeSample *const end_dest_ptr = e.samples + e.length;
+ for (dest_ptr = e.samples + prev_length;
+ dest_ptr < end_dest_ptr; dest_ptr++)
+ {
+ const EnvelopeSample *const end_src_ptr =
+ src_ptr + EnvelopeScaleFactor;
+
+ EnvelopeSample sub_sample = *src_ptr++;
+ while (src_ptr < end_src_ptr)
+ {
+ sub_sample.min = min(sub_sample.min, src_ptr->min);
+ sub_sample.max = max(sub_sample.max, src_ptr->max);
+ src_ptr++;
+ }
+
+ *dest_ptr = sub_sample;
+ }
+ }
+ }
+}
+
+} // namespace data
+} // namespace pv
diff --git a/DSLogic-gui/pv/data/dsosnapshot.h b/DSLogic-gui/pv/data/dsosnapshot.h
new file mode 100644
index 0000000..155dd72
--- /dev/null
+++ b/DSLogic-gui/pv/data/dsosnapshot.h
@@ -0,0 +1,97 @@
+/*
+ * This file is part of the DSLogic-gui project.
+ * DSLogic-gui is based on PulseView.
+ *
+ * Copyright (C) 2013 DreamSourceLab <dreamsourcelab@dreamsourcelab.com>
+ *
+ * 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_DATA_DSOSNAPSHOT_H
+#define DSLOGIC_PV_DATA_DSOSNAPSHOT_H
+
+#include "snapshot.h"
+
+#include <utility>
+#include <vector>
+
+namespace DsoSnapshotTest {
+class Basic;
+}
+
+namespace pv {
+namespace data {
+
+class DsoSnapshot : public Snapshot
+{
+public:
+ struct EnvelopeSample
+ {
+ uint8_t min;
+ uint8_t max;
+ };
+
+ struct EnvelopeSection
+ {
+ uint64_t start;
+ unsigned int scale;
+ uint64_t length;
+ EnvelopeSample *samples;
+ };
+
+private:
+ struct Envelope
+ {
+ uint64_t length;
+ uint64_t data_length;
+ EnvelopeSample *samples;
+ };
+
+private:
+ static const unsigned int ScaleStepCount = 10;
+ static const int EnvelopeScalePower;
+ static const int EnvelopeScaleFactor;
+ static const float LogEnvelopeScaleFactor;
+ static const uint64_t EnvelopeDataUnit;
+
+public:
+ DsoSnapshot(const sr_datafeed_dso &dso, uint64_t _total_sample_len, unsigned int channel_num);
+
+ virtual ~DsoSnapshot();
+
+ void append_payload(const sr_datafeed_dso &dso);
+
+ const uint8_t* get_samples(int64_t start_sample,
+ int64_t end_sample, uint16_t index) const;
+
+ void get_envelope_section(EnvelopeSection &s,
+ uint64_t start, uint64_t end, float min_length, int probe_index) const;
+
+private:
+ void reallocate_envelope(Envelope &l);
+
+ void append_payload_to_envelope_levels();
+
+private:
+ struct Envelope _envelope_levels[2*DS_MAX_DSO_PROBES_NUM][ScaleStepCount];
+
+ friend class DsoSnapshotTest::Basic;
+};
+
+} // namespace data
+} // namespace pv
+
+#endif // DSLOGIC_PV_DATA_DSOSNAPSHOT_H
diff --git a/DSLogic-gui/pv/data/group.cpp b/DSLogic-gui/pv/data/group.cpp
index 26cccd7..6df3ee8 100644
--- a/DSLogic-gui/pv/data/group.cpp
+++ b/DSLogic-gui/pv/data/group.cpp
@@ -35,12 +35,12 @@ Group::Group(unsigned int num_probes, uint64_t samplerate) :
{
}
-void Group::push_snapshot(shared_ptr<GroupSnapshot> &snapshot)
+void Group::push_snapshot(boost::shared_ptr<GroupSnapshot> &snapshot)
{
_snapshots.push_back(snapshot);
}
-deque< shared_ptr<GroupSnapshot> >& Group::get_snapshots()
+deque< boost::shared_ptr<GroupSnapshot> >& Group::get_snapshots()
{
return _snapshots;
}
diff --git a/DSLogic-gui/pv/data/groupsnapshot.cpp b/DSLogic-gui/pv/data/groupsnapshot.cpp
index d46da5b..939ffca 100644
--- a/DSLogic-gui/pv/data/groupsnapshot.cpp
+++ b/DSLogic-gui/pv/data/groupsnapshot.cpp
@@ -51,11 +51,11 @@ const uint16_t GroupSnapshot::value_mask[16] = {0x1, 0x2, 0x4, 0x8,
0x100, 0x200, 0x400, 0x800,
0x1000, 0x2000, 0x4000, 0x8000};
-GroupSnapshot::GroupSnapshot(const shared_ptr<LogicSnapshot> &_logic_snapshot, std::list<int> index_list)
+GroupSnapshot::GroupSnapshot(const boost::shared_ptr<LogicSnapshot> &_logic_snapshot, std::list<int> index_list)
{
assert(_logic_snapshot);
- lock_guard<recursive_mutex> lock(_mutex);
+ boost::lock_guard<boost::recursive_mutex> lock(_mutex);
memset(_envelope_levels, 0, sizeof(_envelope_levels));
_data = _logic_snapshot->get_data();
_sample_count = _logic_snapshot->get_sample_count();
@@ -66,20 +66,20 @@ GroupSnapshot::GroupSnapshot(const shared_ptr<LogicSnapshot> &_logic_snapshot, s
GroupSnapshot::~GroupSnapshot()
{
- lock_guard<recursive_mutex> lock(_mutex);
+ boost::lock_guard<boost::recursive_mutex> lock(_mutex);
BOOST_FOREACH(Envelope &e, _envelope_levels)
free(e.samples);
}
uint64_t GroupSnapshot::get_sample_count() const
{
- lock_guard<recursive_mutex> lock(_mutex);
+ boost::lock_guard<boost::recursive_mutex> lock(_mutex);
return _sample_count;
}
void GroupSnapshot::append_payload()
{
- lock_guard<recursive_mutex> lock(_mutex);
+ boost::lock_guard<boost::recursive_mutex> lock(_mutex);
// Generate the first mip-map from the data
append_payload_to_envelope_levels();
@@ -96,7 +96,7 @@ const uint16_t* GroupSnapshot::get_samples(
int64_t i;
uint64_t pow;
- lock_guard<recursive_mutex> lock(_mutex);
+ boost::lock_guard<boost::recursive_mutex> lock(_mutex);
uint16_t *const data = new uint16_t[end_sample - start_sample];
// memcpy(data, (uint16_t*)_data + start_sample, sizeof(uint16_t) *
@@ -121,7 +121,7 @@ void GroupSnapshot::get_envelope_section(EnvelopeSection &s,
assert(start <= end);
assert(min_length > 0);
- lock_guard<recursive_mutex> lock(_mutex);
+ boost::lock_guard<boost::recursive_mutex> lock(_mutex);
const unsigned int min_level = max((int)floorf(logf(min_length) /
LogEnvelopeScaleFactor) - 1, 0);
diff --git a/DSLogic-gui/pv/data/logic.cpp b/DSLogic-gui/pv/data/logic.cpp
index 036cc54..4cdfe2a 100644
--- a/DSLogic-gui/pv/data/logic.cpp
+++ b/DSLogic-gui/pv/data/logic.cpp
@@ -37,12 +37,12 @@ Logic::Logic(unsigned int num_probes, uint64_t samplerate) :
}
void Logic::push_snapshot(
- shared_ptr<LogicSnapshot> &snapshot)
+ boost::shared_ptr<LogicSnapshot> &snapshot)
{
_snapshots.push_front(snapshot);
}
-deque< shared_ptr<LogicSnapshot> >& Logic::get_snapshots()
+deque< boost::shared_ptr<LogicSnapshot> >& Logic::get_snapshots()
{
return _snapshots;
}
diff --git a/DSLogic-gui/pv/data/logicsnapshot.cpp b/DSLogic-gui/pv/data/logicsnapshot.cpp
index e01386a..9a6b2d2 100644
--- a/DSLogic-gui/pv/data/logicsnapshot.cpp
+++ b/DSLogic-gui/pv/data/logicsnapshot.cpp
@@ -47,7 +47,7 @@ LogicSnapshot::LogicSnapshot(const sr_datafeed_logic &logic, uint64_t _total_sam
Snapshot(logic.unitsize, _total_sample_len, channel_num),
_last_append_sample(0)
{
- lock_guard<recursive_mutex> lock(_mutex);
+ boost::lock_guard<boost::recursive_mutex> lock(_mutex);
memset(_mip_map, 0, sizeof(_mip_map));
if (init(_total_sample_len * channel_num) == SR_OK)
append_payload(logic);
@@ -55,7 +55,7 @@ LogicSnapshot::LogicSnapshot(const sr_datafeed_logic &logic, uint64_t _total_sam
LogicSnapshot::~LogicSnapshot()
{
- lock_guard<recursive_mutex> lock(_mutex);
+ boost::lock_guard<boost::recursive_mutex> lock(_mutex);
BOOST_FOREACH(MipMapLevel &l, _mip_map)
free(l.data);
}
@@ -66,7 +66,7 @@ void LogicSnapshot::append_payload(
assert(_unit_size == logic.unitsize);
assert((logic.length % _unit_size) == 0);
- lock_guard<recursive_mutex> lock(_mutex);
+ boost::lock_guard<boost::recursive_mutex> lock(_mutex);
append_data(logic.data, logic.length / _unit_size);
@@ -194,7 +194,7 @@ void LogicSnapshot::get_subsampled_edges(
assert(sig_index >= 0);
assert(sig_index < 64);
- lock_guard<recursive_mutex> lock(_mutex);
+ boost::lock_guard<boost::recursive_mutex> lock(_mutex);
const uint64_t block_length = (uint64_t)max(min_length, 1.0f);
const unsigned int min_level = max((int)floorf(logf(min_length) /
@@ -378,7 +378,7 @@ int LogicSnapshot::get_first_edge(
assert(sig_index >= 0);
assert(sig_index < 64);
- lock_guard<recursive_mutex> lock(_mutex);
+ boost::lock_guard<boost::recursive_mutex> lock(_mutex);
const uint64_t block_length = 1;
const unsigned int min_level = 0;
@@ -550,7 +550,7 @@ void LogicSnapshot::get_edges(
assert(sig_index >= 0);
assert(sig_index < 64);
- lock_guard<recursive_mutex> lock(_mutex);
+ boost::lock_guard<boost::recursive_mutex> lock(_mutex);
const uint64_t block_length = 1;
const unsigned int min_level = 0;
@@ -706,7 +706,7 @@ uint64_t LogicSnapshot::get_min_pulse(uint64_t start, uint64_t end, int sig_inde
assert(sig_index >= 0);
assert(sig_index < 64);
- lock_guard<recursive_mutex> lock(_mutex);
+ boost::lock_guard<boost::recursive_mutex> lock(_mutex);
const uint64_t block_length = 1;
const unsigned int min_level = 0;
diff --git a/DSLogic-gui/pv/data/snapshot.cpp b/DSLogic-gui/pv/data/snapshot.cpp
index 8cf4b6f..f05452a 100644
--- a/DSLogic-gui/pv/data/snapshot.cpp
+++ b/DSLogic-gui/pv/data/snapshot.cpp
@@ -40,13 +40,13 @@ Snapshot::Snapshot(int unit_size, uint64_t total_sample_count, unsigned int chan
_ring_sample_count(0),
_unit_size(unit_size)
{
- lock_guard<recursive_mutex> lock(_mutex);
+ boost::lock_guard<boost::recursive_mutex> lock(_mutex);
assert(_unit_size > 0);
}
Snapshot::~Snapshot()
{
- lock_guard<recursive_mutex> lock(_mutex);
+ boost::lock_guard<boost::recursive_mutex> lock(_mutex);
if (_data != NULL)
free(_data);
_data = NULL;
@@ -73,31 +73,31 @@ bool Snapshot::buf_null() const
uint64_t Snapshot::get_sample_count() const
{
- lock_guard<recursive_mutex> lock(_mutex);
+ boost::lock_guard<boost::recursive_mutex> lock(_mutex);
return _sample_count / _channel_num;
}
void* Snapshot::get_data() const
{
- lock_guard<recursive_mutex> lock(_mutex);
+ boost::lock_guard<boost::recursive_mutex> lock(_mutex);
return _data;
}
int Snapshot::get_unit_size() const
{
- lock_guard<recursive_mutex> lock(_mutex);
+ boost::lock_guard<boost::recursive_mutex> lock(_mutex);
return _unit_size;
}
unsigned int Snapshot::get_channel_num() const
{
- lock_guard<recursive_mutex> lock(_mutex);
+ boost::lock_guard<boost::recursive_mutex> lock(_mutex);
return _channel_num;
}
void Snapshot::append_data(void *data, uint64_t samples)
{
-// lock_guard<recursive_mutex> lock(_mutex);
+// boost::lock_guard<boost::recursive_mutex> lock(_mutex);
// _data = realloc(_data, (_sample_count + samples) * _unit_size +
// sizeof(uint64_t));
if (_sample_count + samples < _total_sample_count)