diff options
Diffstat (limited to 'gnuradio-core')
-rw-r--r-- | gnuradio-core/src/lib/general/gr_head.cc | 6 | ||||
-rw-r--r-- | gnuradio-core/src/lib/general/gr_head.h | 10 | ||||
-rw-r--r-- | gnuradio-core/src/lib/general/gr_head.i | 2 | ||||
-rw-r--r-- | gnuradio-core/src/lib/runtime/gr_top_block_impl.cc | 6 | ||||
-rw-r--r-- | gnuradio-core/src/lib/runtime/gr_top_block_impl.h | 7 | ||||
-rw-r--r-- | gnuradio-core/src/python/gnuradio/blks2impl/dbpsk2.py | 22 | ||||
-rw-r--r-- | gnuradio-core/src/python/gnuradio/blks2impl/dqpsk2.py | 14 |
7 files changed, 38 insertions, 29 deletions
diff --git a/gnuradio-core/src/lib/general/gr_head.cc b/gnuradio-core/src/lib/general/gr_head.cc index 01035ffcd..b52735c06 100644 --- a/gnuradio-core/src/lib/general/gr_head.cc +++ b/gnuradio-core/src/lib/general/gr_head.cc @@ -27,7 +27,7 @@ #include <gr_io_signature.h> #include <string.h> -gr_head::gr_head (size_t sizeof_stream_item, int nitems) +gr_head::gr_head (size_t sizeof_stream_item, unsigned long long nitems) : gr_sync_block ("head", gr_make_io_signature (1, 1, sizeof_stream_item), gr_make_io_signature (1, 1, sizeof_stream_item)), @@ -36,7 +36,7 @@ gr_head::gr_head (size_t sizeof_stream_item, int nitems) } gr_head_sptr -gr_make_head (size_t sizeof_stream_item, int nitems) +gr_make_head (size_t sizeof_stream_item, unsigned long long nitems) { return gnuradio::get_initial_sptr(new gr_head (sizeof_stream_item, nitems)); } @@ -49,7 +49,7 @@ gr_head::work (int noutput_items, if (d_ncopied_items >= d_nitems) return -1; // Done! - unsigned n = std::min (d_nitems - d_ncopied_items, noutput_items); + unsigned n = std::min (d_nitems - d_ncopied_items, (unsigned long long) noutput_items); if (n == 0) return 0; diff --git a/gnuradio-core/src/lib/general/gr_head.h b/gnuradio-core/src/lib/general/gr_head.h index 430d5f8b9..f7eee1064 100644 --- a/gnuradio-core/src/lib/general/gr_head.h +++ b/gnuradio-core/src/lib/general/gr_head.h @@ -38,11 +38,11 @@ typedef boost::shared_ptr<gr_head> gr_head_sptr; class gr_head : public gr_sync_block { - friend gr_head_sptr gr_make_head (size_t sizeof_stream_item, int nitems); - gr_head (size_t sizeof_stream_item, int nitems); + friend gr_head_sptr gr_make_head (size_t sizeof_stream_item, unsigned long long nitems); + gr_head (size_t sizeof_stream_item, unsigned long long nitems); - int d_nitems; - int d_ncopied_items; + unsigned long long d_nitems; + unsigned long long d_ncopied_items; public: int work (int noutput_items, @@ -53,7 +53,7 @@ class gr_head : public gr_sync_block }; gr_head_sptr -gr_make_head (size_t sizeof_stream_item, int nitems); +gr_make_head (size_t sizeof_stream_item, unsigned long long nitems); #endif /* INCLUDED_GR_HEAD_H */ diff --git a/gnuradio-core/src/lib/general/gr_head.i b/gnuradio-core/src/lib/general/gr_head.i index 2a88b885f..3aece9601 100644 --- a/gnuradio-core/src/lib/general/gr_head.i +++ b/gnuradio-core/src/lib/general/gr_head.i @@ -22,7 +22,7 @@ GR_SWIG_BLOCK_MAGIC(gr,head); -gr_head_sptr gr_make_head(size_t sizeof_stream_item, int nitems); +gr_head_sptr gr_make_head(size_t sizeof_stream_item, unsigned long long nitems); class gr_head : public gr_block { gr_head(); diff --git a/gnuradio-core/src/lib/runtime/gr_top_block_impl.cc b/gnuradio-core/src/lib/runtime/gr_top_block_impl.cc index 50d480d00..9cad687fb 100644 --- a/gnuradio-core/src/lib/runtime/gr_top_block_impl.cc +++ b/gnuradio-core/src/lib/runtime/gr_top_block_impl.cc @@ -90,7 +90,7 @@ gr_top_block_impl::~gr_top_block_impl() void gr_top_block_impl::start() { - gr_lock_guard l(d_mutex); + gruel::scoped_lock l(d_mutex); if (d_state != IDLE) throw std::runtime_error("top_block::start: top block already running or wait() not called after previous stop()"); @@ -131,14 +131,14 @@ gr_top_block_impl::wait() void gr_top_block_impl::lock() { - gr_lock_guard lock(d_mutex); + gruel::scoped_lock lock(d_mutex); d_lock_count++; } void gr_top_block_impl::unlock() { - gr_lock_guard lock(d_mutex); + gruel::scoped_lock lock(d_mutex); if (d_lock_count <= 0){ d_lock_count = 0; // fix it, then complain diff --git a/gnuradio-core/src/lib/runtime/gr_top_block_impl.h b/gnuradio-core/src/lib/runtime/gr_top_block_impl.h index 35fb44ef9..ef28dd829 100644 --- a/gnuradio-core/src/lib/runtime/gr_top_block_impl.h +++ b/gnuradio-core/src/lib/runtime/gr_top_block_impl.h @@ -24,10 +24,7 @@ #define INCLUDED_GR_TOP_BLOCK_IMPL_H #include <gr_scheduler.h> -#include <boost/thread.hpp> - -typedef boost::mutex gr_mutex; // FIXME move these elsewhere -typedef boost::lock_guard<boost::mutex> gr_lock_guard; +#include <gruel/thread.h> /*! *\brief Abstract implementation details of gr_top_block @@ -69,7 +66,7 @@ protected: gr_flat_flowgraph_sptr d_ffg; gr_scheduler_sptr d_scheduler; - gr_mutex d_mutex; // protects d_state and d_lock_count + gruel::mutex d_mutex; // protects d_state and d_lock_count tb_state d_state; int d_lock_count; diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/dbpsk2.py b/gnuradio-core/src/python/gnuradio/blks2impl/dbpsk2.py index 4541b453b..cd9a207c8 100644 --- a/gnuradio-core/src/python/gnuradio/blks2impl/dbpsk2.py +++ b/gnuradio-core/src/python/gnuradio/blks2impl/dbpsk2.py @@ -187,7 +187,8 @@ class dbpsk2_demod(gr.hier_block2): timing_max_dev=_def_timing_max_dev, gray_code=_def_gray_code, verbose=_def_verbose, - log=_def_log): + log=_def_log, + sync_out=False): """ Hierarchical block for RRC-filtered differential BPSK demodulation @@ -208,14 +209,18 @@ class dbpsk2_demod(gr.hier_block2): @type gray_code: bool @param verbose: Print information about modulator? @type verbose: bool - @param debug: Print modualtion data to files? - @type debug: bool + @param log: Print modualtion data to files? + @type log: bool + @param sync_out: Output a sync signal on :1? + @type sync_out: bool """ - - gr.hier_block2.__init__(self, "dbpsk2_demod", - gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature - gr.io_signature(1, 1, gr.sizeof_char)) # Output signature - + if sync_out: io_sig_out = gr.io_signaturev(2, 2, (gr.sizeof_char, gr.sizeof_gr_complex)) + else: io_sig_out = gr.io_signature(1, 1, gr.sizeof_char) + + gr.hier_block2.__init__(self, "dqpsk2_demod", + gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature + io_sig_out) # Output signature + self._samples_per_symbol = samples_per_symbol self._excess_bw = excess_bw self._costas_alpha = costas_alpha @@ -278,6 +283,7 @@ class dbpsk2_demod(gr.hier_block2): self.clock_recov, self.time_recov, self.diffdec, self.slicer, self.symbol_mapper, self.unpack, self) + if sync_out: self.connect(self.time_recov, (self, 1)) def samples_per_symbol(self): return self._samples_per_symbol diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/dqpsk2.py b/gnuradio-core/src/python/gnuradio/blks2impl/dqpsk2.py index 9704ac98c..fd1e9f0ef 100644 --- a/gnuradio-core/src/python/gnuradio/blks2impl/dqpsk2.py +++ b/gnuradio-core/src/python/gnuradio/blks2impl/dqpsk2.py @@ -187,7 +187,8 @@ class dqpsk2_demod(gr.hier_block2): timing_max_dev=_def_timing_max_dev, gray_code=_def_gray_code, verbose=_def_verbose, - log=_def_log): + log=_def_log, + sync_out=False): """ Hierarchical block for RRC-filtered DQPSK demodulation @@ -208,13 +209,17 @@ class dqpsk2_demod(gr.hier_block2): @type gray_code: bool @param verbose: Print information about modulator? @type verbose: bool - @param debug: Print modualtion data to files? - @type debug: bool + @param log: Print modualtion data to files? + @type log: bool + @param sync_out: Output a sync signal on :1? + @type sync_out: bool """ + if sync_out: io_sig_out = gr.io_signaturev(2, 2, (gr.sizeof_char, gr.sizeof_gr_complex)) + else: io_sig_out = gr.io_signature(1, 1, gr.sizeof_char) gr.hier_block2.__init__(self, "dqpsk2_demod", gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature - gr.io_signature(1, 1, gr.sizeof_char)) # Output signature + io_sig_out) # Output signature self._samples_per_symbol = samples_per_symbol self._excess_bw = excess_bw @@ -278,6 +283,7 @@ class dqpsk2_demod(gr.hier_block2): self.clock_recov, self.time_recov, self.diffdec, self.slicer, self.symbol_mapper, self.unpack, self) + if sync_out: self.connect(self.time_recov, (self, 1)) def samples_per_symbol(self): return self._samples_per_symbol |