diff options
496 files changed, 5434 insertions, 11117 deletions
diff --git a/docs/doxygen/other/main_page.dox b/docs/doxygen/other/main_page.dox index f9e335061c..deb6f8ebf8 100644 --- a/docs/doxygen/other/main_page.dox +++ b/docs/doxygen/other/main_page.dox @@ -80,7 +80,7 @@ them. self.src = analog.noise_source_c(gr.GR_GAUSSIAN, amp) self.flt = filter.fir_filter_ccf(1, taps) - self.snk = gr.null_sink(gr.sizeof_gr_complex) + self.snk = blocks.null_sink(gr.sizeof_gr_complex) self.connect(self.src, self.flt, self.snk) @@ -226,7 +226,7 @@ class mytb(gr.top_block): self.src1 = analog.noise_source_c(analog.GR_GAUSSIAN, 1) self.add = blocks.add_cc() self.sub = blocks.sub_cc() - self.head = gr.head(gr.sizeof_gr_complex, 1000000) + self.head = blocks.head(gr.sizeof_gr_complex, 1000000) self.snk = blocks.file_sink(gr.sizeof_gr_complex, "output.32fc") self.connect(self.src0, (self.add,0)) @@ -281,7 +281,7 @@ class mytb(gr.top_block): self.src1 = analog.noise_source_c(analog.GR_GAUSSIAN, 1) self.add = blocks.add_cc() self.sub = blocks.sub_cc() - self.head = gr.head(gr.sizeof_gr_complex, 1000000) + self.head = blocks.head(gr.sizeof_gr_complex, 1000000) self.snk = blocks.file_sink(gr.sizeof_gr_complex, "output.32fc") self.connect(self.src0, (self.add,0)) diff --git a/docs/sphinx/gnuradio_sphinx.py b/docs/sphinx/gnuradio_sphinx.py index e8ca867f8c..9955bf7317 100644 --- a/docs/sphinx/gnuradio_sphinx.py +++ b/docs/sphinx/gnuradio_sphinx.py @@ -113,8 +113,8 @@ class OldBlockDocumenter(FunctionDocumenter): """ Specialized Documenter subclass for gnuradio blocks. - It merges together the documentation for the generator function (e.g. gr.head) - with the wrapped sptr (e.g. gr.gr_head_sptr) to keep the documentation + It merges together the documentation for the generator function (e.g. blocks.head) + with the wrapped sptr (e.g. gr::blocks::head::sptr) to keep the documentation tidier. """ objtype = 'oldblock' diff --git a/docs/sphinx/source/gr/coding_blk.rst b/docs/sphinx/source/gr/coding_blk.rst deleted file mode 100644 index da8cacf2b4..0000000000 --- a/docs/sphinx/source/gr/coding_blk.rst +++ /dev/null @@ -1,5 +0,0 @@ -gnuradio.gr: Information Coding and Decoding -============================================ - -.. autooldblock:: gnuradio.gr.fake_channel_encoder_pp -.. autooldblock:: gnuradio.gr.fake_channel_decoder_pp diff --git a/docs/sphinx/source/gr/index.rst b/docs/sphinx/source/gr/index.rst index bd43888ec7..64bf9355fd 100644 --- a/docs/sphinx/source/gr/index.rst +++ b/docs/sphinx/source/gr/index.rst @@ -22,12 +22,6 @@ Signal Sources :nosignatures: gnuradio.gr.lfsr_32k_source_s - gnuradio.gr.null_source - gnuradio.gr.vector_source_b - gnuradio.gr.vector_source_c - gnuradio.gr.vector_source_f - gnuradio.gr.vector_source_i - gnuradio.gr.vector_source_s Signal Sinks ^^^^^^^^^^^^ @@ -35,50 +29,11 @@ Signal Sinks .. autosummary:: :nosignatures: - gnuradio.gr.check_counting_s gnuradio.gr.check_lfsr_32k_s - gnuradio.gr.null_sink - gnuradio.gr.vector_sink_b - gnuradio.gr.vector_sink_c - gnuradio.gr.vector_sink_f - gnuradio.gr.vector_sink_i - gnuradio.gr.vector_sink_s gnuradio.gr.histo_sink_f gnuradio.gr.oscope_sink_f -Information Coding and Decoding -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. autosummary:: - :nosignatures: - - gnuradio.gr.fake_channel_encoder_pp - gnuradio.gr.fake_channel_decoder_pp - - - -Miscellaneous Blocks -^^^^^^^^^^^^^^^^^^^^ - -.. autosummary:: - :nosignatures: - - gnuradio.gr.copy - gnuradio.gr.kludge_copy - gnuradio.gr.nop - gnuradio.gr.pa_2x2_phase_combiner - gnuradio.gr.channel_model - -Slicing and Dicing Streams -^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. autosummary:: - :nosignatures: - - gnuradio.gr.head - gnuradio.gr.skiphead - Miscellaneous ------------- diff --git a/docs/sphinx/source/gr/misc_blk.rst b/docs/sphinx/source/gr/misc_blk.rst deleted file mode 100644 index a4dcc58a2d..0000000000 --- a/docs/sphinx/source/gr/misc_blk.rst +++ /dev/null @@ -1,8 +0,0 @@ -gnuradio.gr: Miscellaneous Blocks -================================= - -.. autooldblock:: gnuradio.gr.copy -.. autooldblock:: gnuradio.gr.kludge_copy -.. autooldblock:: gnuradio.gr.nop -.. autooldblock:: gnuradio.gr.pa_2x2_phase_combiner -.. autooldblock:: gnuradio.gr.channel_model diff --git a/docs/sphinx/source/gr/sink_blk.rst b/docs/sphinx/source/gr/sink_blk.rst index 1e82765456..9c2c859765 100644 --- a/docs/sphinx/source/gr/sink_blk.rst +++ b/docs/sphinx/source/gr/sink_blk.rst @@ -1,13 +1,6 @@ gnuradio.gr: Signal Sinks ========================= -.. autooldblock:: gnuradio.gr.check_counting_s .. autooldblock:: gnuradio.gr.check_lfsr_32k_s -.. autooldblock:: gnuradio.gr.null_sink -.. autooldblock:: gnuradio.gr.vector_sink_b -.. autooldblock:: gnuradio.gr.vector_sink_c -.. autooldblock:: gnuradio.gr.vector_sink_f -.. autooldblock:: gnuradio.gr.vector_sink_i -.. autooldblock:: gnuradio.gr.vector_sink_s .. autooldblock:: gnuradio.gr.histo_sink_f .. autooldblock:: gnuradio.gr.oscope_sink_f diff --git a/docs/sphinx/source/gr/slicedice_blk.rst b/docs/sphinx/source/gr/slicedice_blk.rst deleted file mode 100644 index 9ade1667d5..0000000000 --- a/docs/sphinx/source/gr/slicedice_blk.rst +++ /dev/null @@ -1,5 +0,0 @@ -gnuradio.gr: Slicing and Dicing Streams -======================================= - -.. autooldblock:: gnuradio.gr.head -.. autooldblock:: gnuradio.gr.skiphead diff --git a/docs/sphinx/source/gr/source_blk.rst b/docs/sphinx/source/gr/source_blk.rst index 1ef77349f6..18e7e679a9 100644 --- a/docs/sphinx/source/gr/source_blk.rst +++ b/docs/sphinx/source/gr/source_blk.rst @@ -2,10 +2,4 @@ gnuradio.gr: Signal Sources =========================== .. autooldblock:: gnuradio.gr.lfsr_32k_source_s -.. autooldblock:: gnuradio.gr.null_source -.. autooldblock:: gnuradio.gr.vector_source_b -.. autooldblock:: gnuradio.gr.vector_source_c -.. autooldblock:: gnuradio.gr.vector_source_f -.. autooldblock:: gnuradio.gr.vector_source_i -.. autooldblock:: gnuradio.gr.vector_source_s diff --git a/gnuradio-core/CMakeLists.txt b/gnuradio-core/CMakeLists.txt index 60fd11dd31..9e910aa6bb 100644 --- a/gnuradio-core/CMakeLists.txt +++ b/gnuradio-core/CMakeLists.txt @@ -49,8 +49,6 @@ GR_SET_GLOBAL(GNURADIO_CORE_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/src/lib/runtime ${CMAKE_CURRENT_BINARY_DIR}/src/lib/general ${CMAKE_CURRENT_SOURCE_DIR}/src/lib/general - ${CMAKE_CURRENT_BINARY_DIR}/src/lib/gengen - ${CMAKE_CURRENT_SOURCE_DIR}/src/lib/gengen ${CMAKE_CURRENT_BINARY_DIR}/src/lib/filter ${CMAKE_CURRENT_SOURCE_DIR}/src/lib/filter ${CMAKE_CURRENT_SOURCE_DIR}/src/lib/missing diff --git a/gnuradio-core/src/examples/CMakeLists.txt b/gnuradio-core/src/examples/CMakeLists.txt index 532c658083..b90a5542df 100644 --- a/gnuradio-core/src/examples/CMakeLists.txt +++ b/gnuradio-core/src/examples/CMakeLists.txt @@ -20,8 +20,3 @@ add_subdirectory(mp-sched) add_subdirectory(network) add_subdirectory(volk_benchmark) - -if(ENABLE_GR_CTRLPORT) -add_subdirectory(ctrlport) -endif(ENABLE_GR_CTRLPORT) - diff --git a/gnuradio-core/src/examples/mp-sched/affinity_set.py b/gnuradio-core/src/examples/mp-sched/affinity_set.py index 8b032acd83..eee88cd34e 100755 --- a/gnuradio-core/src/examples/mp-sched/affinity_set.py +++ b/gnuradio-core/src/examples/mp-sched/affinity_set.py @@ -7,6 +7,7 @@ from gnuradio import eng_notation from gnuradio import gr from gnuradio import blocks +from gnuradio import filter from gnuradio.eng_option import eng_option from gnuradio.filter import firdes from optparse import OptionParser @@ -27,21 +28,21 @@ class affinity_set(gr.top_block): ################################################## vec_len = 1 self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex*vec_len, samp_rate) - self.gr_null_source_0 = gr.null_source(gr.sizeof_gr_complex*vec_len) - self.gr_null_sink_0 = gr.null_sink(gr.sizeof_gr_complex*vec_len) - self.gr_filt_0 = gr.fir_filter_ccc(1, 40000*[0.2+0.3j,]) - self.gr_filt_1 = gr.fir_filter_ccc(1, 40000*[0.2+0.3j,]) + self.blocks_null_source_0 = blocks.null_source(gr.sizeof_gr_complex*vec_len) + self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_gr_complex*vec_len) + self.filter_filt_0 = filter.fir_filter_ccc(1, 40000*[0.2+0.3j,]) + self.filter_filt_1 = filter.fir_filter_ccc(1, 40000*[0.2+0.3j,]) - self.gr_filt_0.set_processor_affinity([0,]) - self.gr_filt_1.set_processor_affinity([0,1]) + self.filter_filt_0.set_processor_affinity([0,]) + self.filter_filt_1.set_processor_affinity([0,1]) ################################################## # Connections ################################################## - self.connect((self.gr_null_source_0, 0), (self.blocks_throttle_0, 0)) + self.connect((self.blocks_null_source_0, 0), (self.blocks_throttle_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.gr_filt_0, 0)) - self.connect((self.gr_filt_0, 0), (self.gr_filt_1, 0)) - self.connect((self.gr_filt_1, 0), (self.gr_null_sink_0, 0)) + self.connect((self.filter_filt_0, 0), (self.gr_filt_1, 0)) + self.connect((self.filter_filt_1, 0), (self.blocks_null_sink_0, 0)) # QT sink close method reimplementation diff --git a/gnuradio-core/src/examples/mp-sched/synthetic.py b/gnuradio-core/src/examples/mp-sched/synthetic.py index 5ce1b5eb89..4b509af228 100755 --- a/gnuradio-core/src/examples/mp-sched/synthetic.py +++ b/gnuradio-core/src/examples/mp-sched/synthetic.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2008 Free Software Foundation, Inc. +# Copyright 2008,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -20,6 +20,7 @@ # from gnuradio import gr, gru, eng_notation, blks2 +from gnuradio import blocks from gnuradio.eng_option import eng_option from optparse import OptionParser import os @@ -29,7 +30,7 @@ class pipeline(gr.hier_block2): def __init__(self, nstages, ntaps=256): """ Create a pipeline of nstages of gr.fir_filter_fff's connected in serial - terminating in a gr.null_sink. + terminating in a blocks.null_sink. """ gr.hier_block2.__init__(self, "pipeline", gr.io_signature(1, 1, gr.sizeof_float), @@ -41,7 +42,7 @@ class pipeline(gr.hier_block2): self.connect(upstream, op) upstream = op - self.connect(upstream, gr.null_sink(gr.sizeof_float)) + self.connect(upstream, blocks.null_sink(gr.sizeof_float)) class top(gr.top_block): @@ -75,8 +76,8 @@ class top(gr.top_block): # Something vaguely like floating point ops self.flop = 2 * ntaps * options.npipelines * options.nstages * options.nsamples - src = gr.null_source(gr.sizeof_float) - head = gr.head(gr.sizeof_float, int(options.nsamples)) + src = blocks.null_source(gr.sizeof_float) + head = blocks.head(gr.sizeof_float, int(options.nsamples)) self.connect(src, head) for n in range(options.npipelines): diff --git a/gnuradio-core/src/examples/network/vector_source.py b/gnuradio-core/src/examples/network/vector_source.py index b960a6d96a..568425fd50 100755 --- a/gnuradio-core/src/examples/network/vector_source.py +++ b/gnuradio-core/src/examples/network/vector_source.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2006,2010 Free Software Foundation, Inc. +# Copyright 2006,2010,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -29,7 +29,7 @@ class vector_source(gr.top_block): def __init__(self, host, port, pkt_size, eof): gr.top_block.__init__(self, "vector_source") data = [i*0.01 for i in range(1000)] - vec = gr.vector_source_f(data, True) + vec = blocks.vector_source_f(data, True) udp = blocks.udp_sink(gr.sizeof_float, host, port, pkt_size, eof=eof) self.connect(vec, udp) diff --git a/gnuradio-core/src/examples/volk_benchmark/volk_test_funcs.py b/gnuradio-core/src/examples/volk_benchmark/volk_test_funcs.py index 0ce25fcc6a..0f2c84100a 100644 --- a/gnuradio-core/src/examples/volk_benchmark/volk_test_funcs.py +++ b/gnuradio-core/src/examples/volk_benchmark/volk_test_funcs.py @@ -1,6 +1,7 @@ #!/usr/bin/env python from gnuradio import gr +from gnuradio import blocks import math, sys, os, time try: @@ -119,13 +120,13 @@ class helper(gr.top_block): self.op = op self.srcs = [] self.snks = [] - self.head = gr.head(isizeof, N) + self.head = blocks.head(isizeof, N) for n in xrange(nsrcs): - self.srcs.append(gr.null_source(isizeof)) + self.srcs.append(blocks.null_source(isizeof)) for n in xrange(nsnks): - self.snks.append(gr.null_sink(osizeof)) + self.snks.append(blocks.null_sink(osizeof)) self.connect(self.srcs[0], self.head, (self.op,0)) diff --git a/gnuradio-core/src/lib/CMakeLists.txt b/gnuradio-core/src/lib/CMakeLists.txt index 72b9f9bdeb..b5a41ec430 100644 --- a/gnuradio-core/src/lib/CMakeLists.txt +++ b/gnuradio-core/src/lib/CMakeLists.txt @@ -27,9 +27,7 @@ include(${CMAKE_CURRENT_SOURCE_DIR}/ConfigChecks.cmake) ######################################################################## GR_INCLUDE_SUBDIRECTORY(missing) GR_INCLUDE_SUBDIRECTORY(runtime) -GR_INCLUDE_SUBDIRECTORY(filter) GR_INCLUDE_SUBDIRECTORY(general) -GR_INCLUDE_SUBDIRECTORY(gengen) GR_INCLUDE_SUBDIRECTORY(io) list(APPEND gnuradio_core_sources bug_work_around_6.cc) diff --git a/gnuradio-core/src/lib/filter/CMakeLists.txt b/gnuradio-core/src/lib/filter/CMakeLists.txt deleted file mode 100644 index a185b06bd5..0000000000 --- a/gnuradio-core/src/lib/filter/CMakeLists.txt +++ /dev/null @@ -1,39 +0,0 @@ -# Copyright 2010-2011 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio 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 3, or (at your option) -# any later version. -# -# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. - -######################################################################## -# This file included, use CMake directory variables -######################################################################## - -######################################################################## -# Append gnuradio-core library sources -######################################################################## -list(APPEND gnuradio_core_sources - ${CMAKE_CURRENT_SOURCE_DIR}/gr_sincos.c -) - -######################################################################## -# Install runtime headers -######################################################################## -install(FILES - ${CMAKE_CURRENT_SOURCE_DIR}/gr_rotator.h - ${CMAKE_CURRENT_SOURCE_DIR}/gr_sincos.h - DESTINATION ${GR_INCLUDE_DIR}/gnuradio - COMPONENT "core_devel" -) diff --git a/gnuradio-core/src/lib/filter/gr_rotator.h b/gnuradio-core/src/lib/filter/gr_rotator.h deleted file mode 100644 index 77946dd397..0000000000 --- a/gnuradio-core/src/lib/filter/gr_rotator.h +++ /dev/null @@ -1,54 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2003,2008 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio 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 3, or (at your option) - * any later version. - * - * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef _GR_ROTATOR_H_ -#define _GR_ROTATOR_H_ - -#include <gr_core_api.h> -#include <gr_complex.h> - -class /*GR_CORE_API*/ gr_rotator { - gr_complex d_phase; - gr_complex d_phase_incr; - unsigned int d_counter; - - public: - gr_rotator () : d_phase (1), d_phase_incr (1), d_counter(0) { } - - void set_phase (gr_complex phase) { d_phase = phase / abs(phase); } - void set_phase_incr (gr_complex incr) { d_phase_incr = incr / abs(incr); } - - gr_complex rotate (gr_complex in){ - d_counter++; - - gr_complex z = in * d_phase; // rotate in by phase - d_phase *= d_phase_incr; // incr our phase (complex mult == add phases) - - if ((d_counter % 512) == 0) - d_phase /= abs(d_phase); // Normalize to ensure multiplication is rotation - - return z; - } - -}; - -#endif /* _GR_ROTATOR_H_ */ diff --git a/gnuradio-core/src/lib/filter/qa_rotator.cc b/gnuradio-core/src/lib/filter/qa_rotator.cc deleted file mode 100644 index b722f32c43..0000000000 --- a/gnuradio-core/src/lib/filter/qa_rotator.cc +++ /dev/null @@ -1,81 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002,2012 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio 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 3, or (at your option) - * any later version. - * - * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gruel/attributes.h> -#include <cppunit/TestAssert.h> -#include <qa_rotator.h> -#include <analog/rotator.h> -#include <stdio.h> -#include <cmath> -#include <gr_expj.h> - -namespace gr { - namespace analog { - - // error vector magnitude - __GR_ATTR_UNUSED static float - error_vector_mag(gr_complex a, gr_complex b) - { - return abs(a-b); - } - - void - qa_rotator::t1() - { - static const unsigned int N = 100000; - - rotator r; - - double phase_incr = 2*M_PI / 1003; - double phase = 0; - - // Old code: We increment then return the rotated value, thus we - // need to start one tick back - // r.set_phase(gr_complex(1,0) * conj(gr_expj(phase_incr))); - - r.set_phase(gr_complex(1,0)); - r.set_phase_incr(gr_expj(phase_incr)); - - for(unsigned i = 0; i < N; i++) { - gr_complex expected = gr_expj(phase); - gr_complex actual = r.rotate(gr_complex(1, 0)); - -#if 0 - float evm = error_vector_mag(expected, actual); - printf("[%6d] expected: (%8.6f, %8.6f) actual: (%8.6f, %8.6f) evm: %8.6f\n", - i, expected.real(), expected.imag(), actual.real(), actual.imag(), evm); -#endif - - CPPUNIT_ASSERT_COMPLEXES_EQUAL(expected, actual, 0.0001); - - phase += phase_incr; - if(phase >= 2*M_PI) - phase -= 2*M_PI; - } - } - - } /* namespace analog */ -} /* namespace gr */ diff --git a/gnuradio-core/src/lib/general/CMakeLists.txt b/gnuradio-core/src/lib/general/CMakeLists.txt index e3dc18520b..08e5a003c0 100644 --- a/gnuradio-core/src/lib/general/CMakeLists.txt +++ b/gnuradio-core/src/lib/general/CMakeLists.txt @@ -53,6 +53,7 @@ list(APPEND gnuradio_core_sources ${CMAKE_CURRENT_SOURCE_DIR}/gr_misc.cc ${CMAKE_CURRENT_SOURCE_DIR}/gr_random.cc ${CMAKE_CURRENT_SOURCE_DIR}/gr_reverse.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_sincos.c ${CMAKE_CURRENT_SOURCE_DIR}/gri_debugger_hook.cc ${CMAKE_CURRENT_SOURCE_DIR}/malloc16.c ) @@ -64,6 +65,7 @@ list(APPEND test_gnuradio_core_sources ${CMAKE_CURRENT_SOURCE_DIR}/qa_general.cc ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_circular_file.cc ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_math.cc + ${CMAKE_CURRENT_SOURCE_DIR}/qa_sincos.cc ) ######################################################################## @@ -73,11 +75,13 @@ install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/gr_core_api.h ${CMAKE_CURRENT_SOURCE_DIR}/gr_circular_file.h ${CMAKE_CURRENT_SOURCE_DIR}/gr_constants.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_endianness.h ${CMAKE_CURRENT_SOURCE_DIR}/gr_expj.h ${CMAKE_CURRENT_SOURCE_DIR}/gr_math.h ${CMAKE_CURRENT_SOURCE_DIR}/gr_misc.h ${CMAKE_CURRENT_SOURCE_DIR}/gr_random.h ${CMAKE_CURRENT_SOURCE_DIR}/gr_reverse.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_sincos.h ${CMAKE_CURRENT_SOURCE_DIR}/gr_test_types.h ${CMAKE_CURRENT_SOURCE_DIR}/gri_debugger_hook.h ${CMAKE_CURRENT_SOURCE_DIR}/gri_lfsr_15_1_0.h @@ -105,40 +109,14 @@ endif(ENABLE_PYTHON) ######################################################################## set(gr_core_general_triple_threats complex_vec_test - gr_align_on_samplenumbers_ss gr_block_gateway - gr_check_counting_s gr_check_lfsr_32k_s - gr_copy - gr_endian_swap - gr_fake_channel_coder_pp gr_feval - gr_head - gr_iqcomp_cc - gr_kludge_copy gr_lfsr_32k_source_s - gr_nop - gr_null_sink - gr_null_source - gr_pa_2x2_phase_combiner gr_prefs - gr_skiphead gr_test - gr_vector_map - gr_annotator_alltoall - gr_annotator_1to1 - gr_annotator_raw ) -if(ENABLE_GR_CTRLPORT) -ADD_DEFINITIONS(-DGR_CTRLPORT) -list(APPEND gr_core_general_triple_threats - gr_ctrlport_probe_c - gr_ctrlport_probe2_c -) -endif(ENABLE_GR_CTRLPORT) - - foreach(file_tt ${gr_core_general_triple_threats}) list(APPEND gnuradio_core_sources ${CMAKE_CURRENT_SOURCE_DIR}/${file_tt}.cc) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${file_tt}.h DESTINATION ${GR_INCLUDE_DIR}/gnuradio COMPONENT "core_devel") @@ -146,3 +124,11 @@ foreach(file_tt ${gr_core_general_triple_threats}) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${file_tt}.i DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig COMPONENT "core_swig") endif(ENABLE_PYTHON) endforeach(file_tt ${gr_core_general_triple_threats}) + +CHECK_CXX_SOURCE_COMPILES(" + #define _GNU_SOURCE + #include <math.h> + int main(){double x, sin, cos; sincos(x, &sin, &cos); return 0;} + " HAVE_SINCOS +) +GR_ADD_COND_DEF(HAVE_SINCOS) diff --git a/gnuradio-core/src/lib/general/general.i b/gnuradio-core/src/lib/general/general.i index bcf4392bb4..3a32e838ea 100644 --- a/gnuradio-core/src/lib/general/general.i +++ b/gnuradio-core/src/lib/general/general.i @@ -22,69 +22,24 @@ %{ -#include <gr_nop.h> -#include <gr_null_sink.h> -#include <gr_null_source.h> -#include <gr_head.h> -#include <gr_skiphead.h> -#include <gr_check_counting_s.h> #include <gr_lfsr_32k_source_s.h> #include <gr_check_lfsr_32k_s.h> -#include <gr_align_on_samplenumbers_ss.h> -//#include <gr_endianness.h> -#include <gr_endian_swap.h> -#include <gr_fake_channel_coder_pp.h> -#include <gr_pa_2x2_phase_combiner.h> -#include <gr_kludge_copy.h> #include <gr_prefs.h> #include <gr_constants.h> #include <gr_test_types.h> #include <gr_test.h> #include <gr_feval.h> -#include <gr_copy.h> #include <complex_vec_test.h> -#include <gr_annotator_alltoall.h> -#include <gr_annotator_1to1.h> -#include <gr_annotator_raw.h> -#include <gr_vector_map.h> +#include <gr_endianness.h> %} -%include "gr_nop.i" -%include "gr_null_sink.i" -%include "gr_null_source.i" -%include "gr_head.i" -%include "gr_skiphead.i" -%include "gr_check_counting_s.i" %include "gr_lfsr_32k_source_s.i" %include "gr_check_lfsr_32k_s.i" -%include "gr_align_on_samplenumbers_ss.i" -//%include "gr_endianness.i" -%include "gr_endian_swap.i" -%include "gr_fake_channel_coder_pp.i" -%include "gr_pa_2x2_phase_combiner.i" -%include "gr_kludge_copy.i" %include "gr_prefs.i" %include "gr_constants.i" %include "gr_test_types.h" %include "gr_test.i" %include "gr_feval.i" -%include "gr_copy.i" %include "complex_vec_test.i" -%include "gr_annotator_alltoall.i" -%include "gr_annotator_1to1.i" -%include "gr_annotator_raw.i" -%include "gr_vector_map.i" %include "gr_block_gateway.i" - - -#ifdef GR_CTRLPORT - -%{ -#include <gr_ctrlport_probe_c.h> -#include <gr_ctrlport_probe2_c.h> -%} - -%include "gr_ctrlport_probe_c.i" -%include "gr_ctrlport_probe2_c.i" - -#endif /* GR_CTRLPORT */ +%include "gr_endianness.h" diff --git a/gnuradio-core/src/lib/general/general_generated.i b/gnuradio-core/src/lib/general/general_generated.i deleted file mode 100644 index c3f67e0d47..0000000000 --- a/gnuradio-core/src/lib/general/general_generated.i +++ /dev/null @@ -1,26 +0,0 @@ -// -// This file is machine generated. All edits will be overwritten -// -%{ -#include <gr_vector_sink_b.h> -#include <gr_vector_sink_c.h> -#include <gr_vector_sink_f.h> -#include <gr_vector_sink_i.h> -#include <gr_vector_sink_s.h> -#include <gr_vector_source_b.h> -#include <gr_vector_source_c.h> -#include <gr_vector_source_f.h> -#include <gr_vector_source_i.h> -#include <gr_vector_source_s.h> -%} - -%include <gr_vector_sink_b.i> -%include <gr_vector_sink_c.i> -%include <gr_vector_sink_f.i> -%include <gr_vector_sink_i.i> -%include <gr_vector_sink_s.i> -%include <gr_vector_source_b.i> -%include <gr_vector_source_c.i> -%include <gr_vector_source_f.i> -%include <gr_vector_source_i.i> -%include <gr_vector_source_s.i> diff --git a/gnuradio-core/src/lib/general/gr_align_on_samplenumbers_ss.cc b/gnuradio-core/src/lib/general/gr_align_on_samplenumbers_ss.cc deleted file mode 100644 index 4728533964..0000000000 --- a/gnuradio-core/src/lib/general/gr_align_on_samplenumbers_ss.cc +++ /dev/null @@ -1,464 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,2010 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio 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 3, or (at your option) - * any later version. - * - * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_align_on_samplenumbers_ss.h> -#include <gr_io_signature.h> -#include <assert.h> -#include <stdexcept> -#include <string.h> -#include <cstdio> - -//define ALIGN_ADVANCED_IMPLEMENTATION to have an alternative implementation of the align algoritm which exactly follows the align_interval spec. -//It is more resource intensive, less tested and probably not needed -//define ALIGN_ADVANCED_IMPLEMENTATION - -//define DEBUG_TOCONSUME to see debug messages about the synchronisation part of this block -//define DEBUG_TOCONSUME -#ifdef DEBUG_TOCONSUME -#define tcPrintf if(dprint) printf -#else -#define tcPrintf //printf -#endif - -#define ePrintf printf - -gr_align_on_samplenumbers_ss_sptr -gr_make_align_on_samplenumbers_ss (int nchan, int align_interval) -{ - return gnuradio::get_initial_sptr(new gr_align_on_samplenumbers_ss (nchan,align_interval)); -} - -gr_align_on_samplenumbers_ss::gr_align_on_samplenumbers_ss (int nchan,int align_interval) - : gr_block ("align_on_samplenumbers_ss", - gr_make_io_signature (2, -1, sizeof (short)), //2, -1 - gr_make_io_signature (2, -1, sizeof (short))), //2,-1 - d_align_interval (align_interval), - d_nchan(nchan), - d_ninputs(0) -{ - if (d_align_interval<0) - set_output_multiple (d_nchan*2); - else - { - set_output_multiple (d_align_interval*d_nchan*2); - } - -} - -gr_align_on_samplenumbers_ss::~gr_align_on_samplenumbers_ss() -{ - -} -void -gr_align_on_samplenumbers_ss::forecast (int noutput_items, gr_vector_int &ninput_items_required) -{ - //assert (0 == noutput_items % d_align_interval); - unsigned ninputs = ninput_items_required.size(); - for (unsigned int i = 0; i < ninputs; i++) - ninput_items_required[i] = std::max(noutput_items*d_nchan*2+ history() - 1,1024*d_nchan*2+ history() - 1);//TODO include the diffs found in determine input_items_required -} - -bool -gr_align_on_samplenumbers_ss::check_topology (int ninputs, int noutputs) -{ - bool result=true; - if(noutputs!=ninputs) - { - result=false; - ePrintf("gr_align_on_samplenumbers_ss: ERROR noutputs %i != ninputs %i\n",noutputs,ninputs); - } - if(d_nchan<2) - { - result=false; - ePrintf("gr_align_on_samplenumbers_ss: ERROR nchan %i<2 \n",d_nchan); - } - if((int)d_ninputs!=ninputs) - { - //Only resize and reset the status if there really changed something - //Don't reset the status if the user just called stop() and start(), although maybe we should. - d_state.resize(ninputs); - d_ninputs=ninputs; - for(unsigned int i=0;i<d_ninputs;i++) - { - d_state[i].sync_found=false; - d_state[i].sync_end_found=false; - } - d_in_presync=false; - } - return result; -} - -#ifdef ALIGN_ADVANCED_IMPLEMENTATION -int -gr_align_on_samplenumbers_ss::general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ -#ifdef DEBUG_TOCONSUME - static int dcount=0; - bool dprint=false; - dcount++; - if(dcount>200) - { - dcount=0; - dprint=true; - } -#endif - const size_t item_size = output_signature()->sizeof_stream_item (0); - const unsigned ninputs = input_items.size(); - const unsigned noutputs = output_items.size(); - - int align_interval=d_align_interval*2*d_nchan; - if(d_align_interval<0) - { - //align once per noutput_items - align_interval=noutput_items; - align_interval=align_interval/(2*d_nchan); - align_interval=align_interval*(2*d_nchan); - } - - int min_ninput_items=noutput_items;//numeric_limits<int>::max(); - int noutput_items_produced=0; - for(unsigned int i=0;i<ninputs;i++) - { - d_state[i].ninput_items=ninput_items[i]; - d_state[i].ninput_items_used=0; - min_ninput_items=std::min(ninput_items[i],min_ninput_items); - } - for(int j=0;j<noutput_items-align_interval+1;j+=align_interval) - { - int common_end; - if(min_ninput_items>=align_interval) - common_end=align_interval; - else - { - common_end=min_ninput_items/(d_nchan*2); - common_end=common_end*(d_nchan*2); - } - if (common_end<=0) break; - - bool all_diffs_zero=true; - //bool sync_found=false; - int diff_comp_end_max=0; - for(unsigned int i=0;i<ninputs;i++) - { - unsigned short * uin=&(((unsigned short*)input_items[i])[d_state[i].ninput_items_used]); - unsigned int x_high16bits = uin[0]; - unsigned int x_low16bits = uin[1]; - d_state[i].ucounter_begin = x_high16bits<<16 | x_low16bits; - d_state[i].diff=d_state[0].ucounter_begin-d_state[i].ucounter_begin;//Result is a signed value,Will wrap around on 32 bit boundary - int common_last=std::max(common_end-d_nchan*2,0); - x_high16bits = uin[d_nchan*2]; - x_low16bits = uin[d_nchan*2+1]; - unsigned int ucounter_begin2 = x_high16bits<<16 | x_low16bits; -#ifdef DEBUG_TOCONSUME - if((d_state[i].ucounter_begin+1)!=(ucounter_begin2)) - if(ucounter_begin2==0) - ePrintf("SYNC counters are 0\n"); - else - ePrintf("Error: counter not continuous.\n ucounter_begin[%i]=%i +1 != ucounter_begin2=%i\n",i,d_state[i].ucounter_begin,ucounter_begin2); -#endif - x_high16bits = uin[common_last]; - x_low16bits = uin[common_last+1]; - d_state[i].ucounter_end = x_high16bits<<16 | x_low16bits; - d_state[i].diff_end=d_state[0].ucounter_end-d_state[i].ucounter_end;//Result is a signed value,Will wrap around on 32 bit boundary - d_state[i].diff_comp_end=d_state[i].ucounter_end-d_state[0].ucounter_end; - diff_comp_end_max=std::max(d_state[i].diff_comp_end,diff_comp_end_max); -#ifdef DEBUG_TOCONSUME - if(d_state[i].diff>256000000 || d_state[i].diff_end>256000000 || d_state[i].diff_comp_end>256000000) - { - tcPrintf("diff[%i]=%i diff_end=%i diff_comp_end=%i\n",i,d_state[i].diff,d_state[i].diff_end,d_state[i].diff_comp_end); - } -#endif - all_diffs_zero=all_diffs_zero && (0==d_state[i].diff_end); - if(d_state[i].ucounter_end<d_state[i].ucounter_begin+(unsigned)(common_last/(d_nchan*2))) //(unsigned)(common_last/(d_nchan*2))) - { - //printf("sync 1 ");// found ucounter_end[%i]=%i ucounter_begin[%i]=%i \n",i,d_state[i].ucounter_end,i,d_state[i].ucounter_begin); - //sync_found=true;//sync_found or 32 bit counter wraparound (0xffffffff -> 0x00000000) - if(!d_in_presync) - { -#ifdef DEBUG_TOCONSUME - printf("presync START with %i\n",i); -#endif - for(unsigned int k=0;k<ninputs;k++) - { - d_state[k].sync_found=false; - d_state[i].sync_end_found=false; - } - d_in_presync=true; - d_state[i].sync_found=true; - } else - { - //d_in_presync=true; -#ifdef DEBUG_TOCONSUME - if(d_state[i].sync_found) - printf("presync CONTINUE with %i\n",i); - else - printf("presync NEXT with %i\n",i); -#endif - d_state[i].sync_found=true; - d_state[i].sync_end_found=false; - } - } else - { - if(d_in_presync && d_state[i].sync_found) - { - d_state[i].sync_end_found=true; - bool all_syncs_found=true; - for(unsigned int k=0;k<ninputs;k++) - all_syncs_found=all_syncs_found && d_state[k].sync_end_found; - d_in_presync=!all_syncs_found; - if(!d_in_presync) - { - for(unsigned int k=0;k<ninputs;k++) - { - d_state[k].sync_found=false; - d_state[i].sync_end_found=false; - } -#ifdef DEBUG_TOCONSUME - printf("presync END\n"); -#endif - } - } - } - } - if(d_in_presync || all_diffs_zero) - { - for(unsigned int i=0;i<ninputs;i++) - { - memcpy(&(((unsigned short*)output_items[i])[j]),&(((const unsigned short*)input_items[i])[d_state[i].ninput_items_used]),common_end*item_size); - //consume(i,common_end); - d_state[i].ninput_items-=common_end; - d_state[i].ninput_items_used+=common_end; - min_ninput_items=std::min(d_state[i].ninput_items,min_ninput_items); -#ifdef DEBUG_TOCONSUME - if(common_end<256) - tcPrintf("common_end %i\n",common_end); -#endif - } - //min_ninput_items-=common_end; - noutput_items_produced+=common_end; - //return common_end; - } else - { - //printf("sync 2"); - for(unsigned int i=0;i<ninputs;i++) - { - int toconsume=std::min((d_state[i].diff_end+diff_comp_end_max)*d_nchan*2,d_state[i].ninput_items); - toconsume=toconsume/(d_nchan*2); - toconsume=toconsume*(d_nchan*2); - d_state[i].ninput_items-=toconsume; - d_state[i].ninput_items_used+=toconsume; - min_ninput_items=std::min(d_state[i].ninput_items,min_ninput_items); -#ifdef DEBUG_TOCONSUME - static int toconsume_counter=0; - toconsume_counter++; - //if(toconsume_counter>10) - { - tcPrintf("toconsume=%i diff_end[%i]*d_nchan*2=%i diff_comp_end_max*d_nchan*2=%i ninput_items[%i]=%i\n",toconsume,i,d_state[i].diff_end*d_nchan*2,diff_comp_end_max*d_nchan*2,i,ninput_items[i]); - toconsume_counter=0; - } -#endif - //printf("toconsume[%i]=%i\n",i,toconsume); - //consume(i,toconsume);//skip the difference in samplenumber items - } - //return 0; - } - } - for(unsigned int i=0;i<ninputs;i++) - consume(i,d_state[i].ninput_items_used); -#ifdef DEBUG_TOCONSUME - if(noutput_items_produced<256) - tcPrintf("noutput_items_produced %i\n",noutput_items_produced); -#endif - return noutput_items_produced; -} - - -#else /*ALIGN_ADVANCED_IMPLEMENTATION*/ -int -gr_align_on_samplenumbers_ss::general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ -#ifdef DEBUG_TOCONSUME - static int dcount=0; - bool dprint=false; - dcount++; - if(dcount>2000) - { - dcount=0; - dprint=true; - } -#endif - const size_t item_size = output_signature()->sizeof_stream_item (0); - const unsigned ninputs = input_items.size(); - - int common_end=noutput_items; - //int diff_min=INT_MAX; - //int diff_max=INT_MIN; - for(unsigned int i=0;i<ninputs;i++) - { - unsigned short * uin=(unsigned short*)input_items[i]; - unsigned int x_high16bits = uin[0]; - unsigned int x_low16bits = uin[1]; - d_state[i].ucounter_begin = x_high16bits<<16 | x_low16bits; - d_state[i].diff=d_state[0].ucounter_end-d_state[i].ucounter_end;//Result is a signed value,Will wrap around on 32 bit boundary - x_high16bits = uin[d_nchan*2]; - x_low16bits = uin[d_nchan*2+1]; - unsigned int ucounter_begin2 = x_high16bits<<16 | x_low16bits; - if((d_state[i].ucounter_begin+1)!=(ucounter_begin2)){ - if(ucounter_begin2==0) - { -#ifdef DEBUG_TOCONSUME - ePrintf("SYNC counters are 0\n"); -#endif - } - else - { - ePrintf("Error: counter not continuous.\n ucounter_begin[%i]=%i +1 != ucounter_begin2=%i\n",i,d_state[i].ucounter_begin,ucounter_begin2); - } - } - - //diff_comp[i]=ucounter[i]-ucounter[0]; - //diff_min=std::min(diff[i],diff_min); - //diff_max=std::max(diff[i],diff_max); - common_end=std::max(std::min(ninput_items[i],common_end),0); - } - common_end=common_end/(d_nchan*2); - common_end=common_end*(d_nchan*2); -#ifdef DEBUG_TOCONSUME - if(common_end<d_nchan*2) - { - printf(" common_end %i\n",common_end); - for(int j=0;j<ninputs;j++) - printf("ninput_items[%i]=%i\n",j,ninput_items[j]); - } -#endif - bool all_diffs_zero=true; - bool sync_found=false; - int diff_comp_end_max=0; - for(unsigned int i=0;i<ninputs;i++) - { - unsigned short * uin=(unsigned short*)input_items[i]; - int common_last=common_end-(d_nchan*2); - unsigned int x_high16bits = uin[common_last]; - unsigned int x_low16bits = uin[common_last+1]; - d_state[i].ucounter_end = x_high16bits<<16 | x_low16bits; - d_state[i].diff_end=d_state[0].ucounter_end-d_state[i].ucounter_end;//Result is a signed value,Will wrap around on 32 bit boundary - d_state[i].diff_comp_end=d_state[i].ucounter_end-d_state[0].ucounter_end; - //diff_end_min=std::min(diff_end[i],diff_end_min); - //diff_end_max=std::max(diff_end[i],diff_end_max); - diff_comp_end_max=std::max(d_state[i].diff_comp_end,diff_comp_end_max); -#ifdef DEBUG_TOCONSUME - if(d_state[i].diff_end!=d_state[i].diff) - { - //samples_lost_or_syncstart=true; - printf("Us%i %i %i ",i,d_state[i].diff_end,d_state[i].diff); - } -#endif - all_diffs_zero=all_diffs_zero && (0==d_state[i].diff_end); - if((d_state[i].ucounter_end<d_state[i].ucounter_begin+(unsigned)(common_last/(d_nchan*2))) || (0==d_state[i].ucounter_end) || (0==d_state[i].ucounter_begin)) //(unsigned)(common_last/(d_nchan*2))) - { - sync_found=true;//sync_found or 32 bit counter wraparound (0xffffffff -> 0x00000000) -#ifdef DEBUG_TOCONSUME - tcPrintf("SYNC diff_end[%i]=%i ucounter_end[%i]=%i ucounter_begin[%i]=%i \n",i,d_state[i].diff_end,i,d_state[i].ucounter_end,i,d_state[i].ucounter_begin); - tcPrintf("ucounter_end=%i < %i = ucounter_begin+(unsigned)(common_last/(d_nchan*2) \n",d_state[i].ucounter_end,d_state[i].ucounter_begin+(unsigned)(common_last/(d_nchan*2))); - - printf("ucounter_end[%i]=%i ucounter_begin[%i]=%i\n",i,d_state[i].ucounter_end,i,d_state[i].ucounter_begin); - int expected_sync_position=common_last - d_state[i].ucounter_end*(d_nchan*2); - if(0==uin[expected_sync_position] && 0==uin[expected_sync_position+1]) - { - printf("sync found on input %i at position %i \n",i,expected_sync_position); - //sync_start[i]=expected_sync_position; - } else - { - printf("sync found on input %i position unclear, expected at %i value there %i\n",i,expected_sync_position,uin[expected_sync_position]<<16 | uin[expected_sync_position+1]); - //sync_start[i]=-1; - } - } else - { - tcPrintf("NOsync diff_end[%i]=%i ucounter_end[%i]=%i ucounter_begin[%i]=%i \n",i,d_state[i].diff_end,i,d_state[i].ucounter_end,i,d_state[i].ucounter_begin); -#endif - } - } - bool problem=false; - for(unsigned int i=0;i<ninputs;i++) - if((d_state[i].diff_end+diff_comp_end_max) >0x4000000) - { - problem=true; - ePrintf("Warning: counter diff greater as 64 Million\n"); - ePrintf(" You might want to swap master and slave.\n"); - ePrintf(" i=%i,d_state[i].diff_end+diff_comp_end_max=%i,d_state[i].diff_end=%i,diff_comp_end_max=%i,ucounter[i]=%i,ucounter[0]=%i\n", - i,d_state[i].diff_end+diff_comp_end_max,d_state[i].diff_end,diff_comp_end_max,d_state[i].ucounter_end,d_state[0].ucounter_end); - //ePrintf(" toconsume=%i\n",toconsume); - } - if(sync_found || all_diffs_zero || problem) - { -#ifdef DEBUG_TOCONSUME - if(all_diffs_zero) tcPrintf("ZERO\n"); - if(sync_found) tcPrintf("SYNC\n"); -#endif - for(unsigned int i=0;i<ninputs;i++) - { - memcpy(output_items[i],input_items[i],common_end*item_size); - consume(i,common_end); -#ifdef DEBUG_TOCONSUME - if(common_end<256) - tcPrintf("common_end %i\n",common_end); -#endif - } - return common_end; - } else - { - //int minconsume=0;//common_end/(2*d_nchan*2); - //min_consume=min_consume*d_nchan*2; - for(unsigned int i=0;i<ninputs;i++) - { - int toconsume=std::min((d_state[i].diff_end+diff_comp_end_max)*d_nchan*2,ninput_items[i]); - toconsume=toconsume/(d_nchan*2); - toconsume=toconsume*(d_nchan*2); -#ifdef DEBUG_TOCONSUME - //printf("dcount %i\n",dcount); - static int toconsume_counter=0; - toconsume_counter++; - //if(toconsume_counter>10) - { - tcPrintf("toconsume=%i diff_end[[%i]*d_nchan*2=%i diff_comp_end_max)*d_nchan*2=%i ninput_items[%i]=%i\n", - toconsume,i,d_state[i].diff_end*d_nchan*2,diff_comp_end_max*d_nchan*2,i,ninput_items[i]); - toconsume_counter=0; - } -#endif - consume(i,toconsume);//skip the difference in samplenumber items - //printf("toconsume%i %i diff_comp_end_max %i diff_end[[%i] %i\n",i,toconsume,diff_comp_end_max,i,d_state[i].diff_end); - } - return 0; - } - return -1;//Should never come here -} -#endif /*ALIGN_ADVANCED_IMPLEMENTATION*/ diff --git a/gnuradio-core/src/lib/general/gr_align_on_samplenumbers_ss.h b/gnuradio-core/src/lib/general/gr_align_on_samplenumbers_ss.h deleted file mode 100644 index 1b71a3f4bc..0000000000 --- a/gnuradio-core/src/lib/general/gr_align_on_samplenumbers_ss.h +++ /dev/null @@ -1,92 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio 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 3, or (at your option) - * any later version. - * - * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef INCLUDED_GR_ALIGN_ON_SAMPLE_NUMBERS_SS_H -#define INCLUDED_GR_ALIGN_ON_SAMPLE_NUMBERS_SS_H - -#include <gr_core_api.h> -#include <gr_block.h> - -/*! - * \brief align several complex short (interleaved short) input channels with corresponding unsigned 32 bit sample_counters (provided as interleaved 16 bit values) - * \ingroup misc - * \param number of complex_short input channels (including the 32 bit counting channel) - * \param align_interval is after how much samples (minimally) the sample-alignement is refreshed. Default is 128. - * A bigger value means less processing power but also requests more buffer space, which has a maximum. - * Decrease the align_interval if you get an error like: - * "sched: <gr_block align_on_samplenumbers_ss (0)> is requesting more input data than we can provide. - * ninput_items_required = 32768 - * max_possible_items_available = 16383 - * If this is a filter, consider reducing the number of taps." - * \ingroup block - * Pay attention on how you connect this block. - * It expects a minimum of 2 usrp_source_s with nchan number of channels and FPGA_MODE_COUNTING_32BIT enabled. - * This means that the first complex_short channel on every input is an interleaved 32 bit counter. - * The samples are aligned by dropping samples untill the samplenumbers match. - */ -class gr_align_on_samplenumbers_ss; -typedef boost::shared_ptr<gr_align_on_samplenumbers_ss> gr_align_on_samplenumbers_ss_sptr; - -GR_CORE_API gr_align_on_samplenumbers_ss_sptr gr_make_align_on_samplenumbers_ss (int nchan=2, int align_interval=128); - - - - -class GR_CORE_API gr_align_on_samplenumbers_ss : public gr_block -{ - int d_align_interval; - int d_sample_counter; - int d_nchan; - bool d_in_presync; - unsigned int d_ninputs; - class GR_CORE_API align_state { - public: - unsigned int ucounter_end; - unsigned int ucounter_begin; - int diff; - int diff_comp; - int diff_end; - int diff_comp_end; - bool sync_found; - bool sync_end_found; - int ninput_items; - int ninput_items_used; - }; - std::vector<align_state> d_state; - - friend GR_CORE_API gr_align_on_samplenumbers_ss_sptr gr_make_align_on_samplenumbers_ss (int nchan,int align_interval); - gr_align_on_samplenumbers_ss (int nchan,int align_interval); - - public: - ~gr_align_on_samplenumbers_ss(); - bool check_topology (int ninputs, int noutputs); - void forecast (int noutput_items, - gr_vector_int &ninput_items_required); - - int general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - - -#endif /* INCLUDED_GR_ALIGN_ON_SAMPLE_NUMBERS_SS_H */ diff --git a/gnuradio-core/src/lib/general/gr_align_on_samplenumbers_ss.i b/gnuradio-core/src/lib/general/gr_align_on_samplenumbers_ss.i deleted file mode 100644 index 471f743010..0000000000 --- a/gnuradio-core/src/lib/general/gr_align_on_samplenumbers_ss.i +++ /dev/null @@ -1,34 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio 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 3, or (at your option) - * any later version. - * - * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -GR_SWIG_BLOCK_MAGIC(gr,align_on_samplenumbers_ss); - -gr_align_on_samplenumbers_ss_sptr -gr_make_align_on_samplenumbers_ss(int nchan=2, int align_interval=128) throw (std::exception); - -class gr_align_on_samplenumbers_ss : public gr_block -{ - public: - ~gr_align_on_samplenumbers_ss (); - private: - gr_align_on_samplenumbers_ss (int nchan,int align_interval); -}; diff --git a/gnuradio-core/src/lib/general/gr_annotator_1to1.cc b/gnuradio-core/src/lib/general/gr_annotator_1to1.cc deleted file mode 100644 index 1178bdc34f..0000000000 --- a/gnuradio-core/src/lib/general/gr_annotator_1to1.cc +++ /dev/null @@ -1,107 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2010 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio 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 3, or (at your option) - * any later version. - * - * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_annotator_1to1.h> -#include <gr_io_signature.h> -#include <string.h> -#include <iostream> -#include <iomanip> - -gr_annotator_1to1_sptr -gr_make_annotator_1to1 (int when, size_t sizeof_stream_item) -{ - return gnuradio::get_initial_sptr (new gr_annotator_1to1 - (when, sizeof_stream_item)); -} - -gr_annotator_1to1::gr_annotator_1to1 (int when, size_t sizeof_stream_item) - : gr_sync_block ("annotator_1to1", - gr_make_io_signature (1, -1, sizeof_stream_item), - gr_make_io_signature (1, -1, sizeof_stream_item)), - d_itemsize(sizeof_stream_item), d_when((uint64_t)when) -{ - set_tag_propagation_policy(TPP_ONE_TO_ONE); - - d_tag_counter = 0; - set_relative_rate(1.0); -} - -gr_annotator_1to1::~gr_annotator_1to1 () -{ -} - -int -gr_annotator_1to1::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const float *in = (const float*)input_items[0]; - float *out = (float*)output_items[0]; - - std::stringstream str; - str << name() << unique_id(); - - uint64_t abs_N = 0; - int ninputs = input_items.size(); - for(int i = 0; i < ninputs; i++) { - abs_N = nitems_read(i); - - std::vector<gr_tag_t> all_tags; - get_tags_in_range(all_tags, i, abs_N, abs_N + noutput_items); - - std::vector<gr_tag_t>::iterator itr; - for(itr = all_tags.begin(); itr != all_tags.end(); itr++) { - d_stored_tags.push_back(*itr); - } - } - - // Storing the current noutput_items as the value to the "noutput_items" key - pmt::pmt_t srcid = pmt::string_to_symbol(str.str()); - pmt::pmt_t key = pmt::string_to_symbol("seq"); - - // Work does nothing to the data stream; just copy all inputs to outputs - // Adds a new tag when the number of items read is a multiple of d_when - abs_N = nitems_read(0); - int noutputs = output_items.size(); - for(int j = 0; j < noutput_items; j++) { - // the min() is a hack to make sure this doesn't segfault if there are a - // different number of ins and outs. This is specifically designed to test - // the 1-to-1 propagation policy. - for(int i = 0; i < std::min(noutputs, ninputs); i++) { - if(abs_N % d_when == 0) { - pmt::pmt_t value = pmt::from_uint64(d_tag_counter++); - add_item_tag(i, abs_N, key, value, srcid); - } - - in = (const float*)input_items[i]; - out = (float*)output_items[i]; - out[j] = in[j]; - } - abs_N++; - } - - return noutput_items; -} diff --git a/gnuradio-core/src/lib/general/gr_annotator_1to1.h b/gnuradio-core/src/lib/general/gr_annotator_1to1.h deleted file mode 100644 index 57e5720141..0000000000 --- a/gnuradio-core/src/lib/general/gr_annotator_1to1.h +++ /dev/null @@ -1,75 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2010 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio 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 3, or (at your option) - * any later version. - * - * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef INCLUDED_GR_ANNOTATOR_1TO1_H -#define INCLUDED_GR_ANNOTATOR_1TO1_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> - -class gr_annotator_1to1; -typedef boost::shared_ptr<gr_annotator_1to1> gr_annotator_1to1_sptr; - -// public constructor -GR_CORE_API gr_annotator_1to1_sptr -gr_make_annotator_1to1 (int when, size_t sizeof_stream_item); - -/*! - * \brief 1-to-1 stream annotator testing block. FOR TESTING PURPOSES ONLY. - * - * This block creates tags to be sent downstream every 10,000 items it sees. The - * tags contain the name and ID of the instantiated block, use "seq" as a key, - * and have a counter that increments by 1 for every tag produced that is used - * as the tag's value. The tags are propagated using the 1-to-1 policy. - * - * It also stores a copy of all tags it sees flow past it. These tags can be - * recalled externally with the data() member. - * - * This block is only meant for testing and showing how to use the tags. - */ -class GR_CORE_API gr_annotator_1to1 : public gr_sync_block -{ - public: - ~gr_annotator_1to1 (); - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - std::vector<gr_tag_t> data() const - { - return d_stored_tags; - } - -protected: - gr_annotator_1to1 (int when, size_t sizeof_stream_item); - - private: - size_t d_itemsize; - uint64_t d_when; - uint64_t d_tag_counter; - std::vector<gr_tag_t> d_stored_tags; - - friend GR_CORE_API gr_annotator_1to1_sptr - gr_make_annotator_1to1 (int when, size_t sizeof_stream_item); -}; - -#endif diff --git a/gnuradio-core/src/lib/general/gr_annotator_1to1.i b/gnuradio-core/src/lib/general/gr_annotator_1to1.i deleted file mode 100644 index 2637b8d277..0000000000 --- a/gnuradio-core/src/lib/general/gr_annotator_1to1.i +++ /dev/null @@ -1,25 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2010-2011 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio 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 3, or (at your option) - * any later version. - * - * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -GR_SWIG_BLOCK_MAGIC(gr,annotator_1to1); - -%include <gr_annotator_1to1.h> diff --git a/gnuradio-core/src/lib/general/gr_annotator_alltoall.cc b/gnuradio-core/src/lib/general/gr_annotator_alltoall.cc deleted file mode 100644 index d8b7e2db7e..0000000000 --- a/gnuradio-core/src/lib/general/gr_annotator_alltoall.cc +++ /dev/null @@ -1,110 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2010 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio 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 3, or (at your option) - * any later version. - * - * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_annotator_alltoall.h> -#include <gr_io_signature.h> -#include <string.h> -#include <iostream> -#include <iomanip> - -gr_annotator_alltoall_sptr -gr_make_annotator_alltoall (int when, size_t sizeof_stream_item) -{ - return gnuradio::get_initial_sptr (new gr_annotator_alltoall - (when, sizeof_stream_item)); -} - -gr_annotator_alltoall::gr_annotator_alltoall (int when, - size_t sizeof_stream_item) - : gr_sync_block ("annotator_alltoall", - gr_make_io_signature (1, -1, sizeof_stream_item), - gr_make_io_signature (1, -1, sizeof_stream_item)), - d_itemsize(sizeof_stream_item), d_when((uint64_t)when) -{ - set_tag_propagation_policy(TPP_ALL_TO_ALL); - - d_tag_counter = 0; -} - -gr_annotator_alltoall::~gr_annotator_alltoall () -{ -} - -int -gr_annotator_alltoall::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const float *in = (const float *) input_items[0]; - float *out = (float *) output_items[0]; - - std::stringstream str; - str << name() << unique_id(); - - uint64_t abs_N = 0, end_N; - int ninputs = input_items.size(); - for(int i = 0; i < ninputs; i++) { - abs_N = nitems_read(i); - end_N = abs_N + (uint64_t)(noutput_items); - - std::vector<gr_tag_t> all_tags; - get_tags_in_range(all_tags, i, abs_N, end_N); - - std::vector<gr_tag_t>::iterator itr; - for(itr = all_tags.begin(); itr != all_tags.end(); itr++) { - d_stored_tags.push_back(*itr); - } - } - - // Source ID and key for any tag that might get applied from this block - pmt::pmt_t srcid = pmt::string_to_symbol(str.str()); - pmt::pmt_t key = pmt::string_to_symbol("seq"); - - // Work does nothing to the data stream; just copy all inputs to outputs - // Adds a new tag when the number of items read is a multiple of d_when - abs_N = nitems_written(0); - int noutputs = output_items.size(); - - for(int j = 0; j < noutput_items; j++) { - for(int i = 0; i < noutputs; i++) { - if(abs_N % d_when == 0) { - pmt::pmt_t value = pmt::from_uint64(d_tag_counter++); - add_item_tag(i, abs_N, key, value, srcid); - } - - // Sum all of the inputs together for each output. Just 'cause. - out = (float*)output_items[i]; - out[j] = 0; - for(int ins = 0; ins < ninputs; ins++) { - in = (const float*)input_items[ins]; - out[j] += in[j]; - } - } - abs_N++; - } - - return noutput_items; -} diff --git a/gnuradio-core/src/lib/general/gr_annotator_alltoall.h b/gnuradio-core/src/lib/general/gr_annotator_alltoall.h deleted file mode 100644 index deb5874a49..0000000000 --- a/gnuradio-core/src/lib/general/gr_annotator_alltoall.h +++ /dev/null @@ -1,76 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2010 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio 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 3, or (at your option) - * any later version. - * - * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef INCLUDED_GR_ANNOTATOR_ALLTOALL_H -#define INCLUDED_GR_ANNOTATOR_ALLTOALL_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> - -class gr_annotator_alltoall; -typedef boost::shared_ptr<gr_annotator_alltoall> gr_annotator_alltoall_sptr; - -// public constructor -GR_CORE_API gr_annotator_alltoall_sptr -gr_make_annotator_alltoall (int when, size_t sizeof_stream_item); - -/*! - * \brief All-to-all stream annotator testing block. FOR TESTING PURPOSES ONLY. - * - * This block creates tags to be sent downstream every 10,000 items it sees. The - * tags contain the name and ID of the instantiated block, use "seq" as a key, - * and have a counter that increments by 1 for every tag produced that is used - * as the tag's value. The tags are propagated using the all-to-all policy. - * - * It also stores a copy of all tags it sees flow past it. These tags can be - * recalled externally with the data() member. - * - * This block is only meant for testing and showing how to use the tags. - */ -class GR_CORE_API gr_annotator_alltoall : public gr_sync_block -{ - public: - ~gr_annotator_alltoall (); - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - std::vector<gr_tag_t> data() const - { - return d_stored_tags; - } - -protected: - gr_annotator_alltoall (int when, size_t sizeof_stream_item); - - private: - size_t d_itemsize; - uint64_t d_when; - uint64_t d_tag_counter; - std::vector<gr_tag_t> d_stored_tags; - - friend GR_CORE_API gr_annotator_alltoall_sptr - gr_make_annotator_alltoall (int when, size_t sizeof_stream_item); -}; - -#endif diff --git a/gnuradio-core/src/lib/general/gr_annotator_alltoall.i b/gnuradio-core/src/lib/general/gr_annotator_alltoall.i deleted file mode 100644 index 35190a3d1b..0000000000 --- a/gnuradio-core/src/lib/general/gr_annotator_alltoall.i +++ /dev/null @@ -1,25 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2010-2011 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio 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 3, or (at your option) - * any later version. - * - * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -GR_SWIG_BLOCK_MAGIC(gr,annotator_alltoall); - -%include <gr_annotator_alltoall.h> diff --git a/gnuradio-core/src/lib/general/gr_annotator_raw.cc b/gnuradio-core/src/lib/general/gr_annotator_raw.cc deleted file mode 100644 index c3aecdd938..0000000000 --- a/gnuradio-core/src/lib/general/gr_annotator_raw.cc +++ /dev/null @@ -1,106 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2010 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio 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 3, or (at your option) - * any later version. - * - * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_annotator_raw.h> -#include <gr_io_signature.h> -#include <string.h> -#include <iostream> -#include <iomanip> -#include <stdexcept> - -using namespace pmt; - -gr_annotator_raw_sptr -gr_make_annotator_raw(size_t sizeof_stream_item) -{ - return gnuradio::get_initial_sptr(new gr_annotator_raw - (sizeof_stream_item)); -} - -gr_annotator_raw::gr_annotator_raw(size_t sizeof_stream_item) - : gr_sync_block("annotator_raw", - gr_make_io_signature(1, 1, sizeof_stream_item), - gr_make_io_signature(1, 1, sizeof_stream_item)), - d_itemsize(sizeof_stream_item) -{ - set_tag_propagation_policy(TPP_ONE_TO_ONE); - set_relative_rate(1.0); -} - -void gr_annotator_raw::add_tag(uint64_t offset, pmt_t key, pmt_t val) -{ - gruel::scoped_lock l(d_mutex); - - gr_tag_t tag; - tag.srcid = pmt::intern(name()); - tag.key = key; - tag.value = val; - tag.offset = offset; - - // add our new tag - d_queued_tags.push_back(tag); - // make sure our tags are in offset order - std::sort(d_queued_tags.begin(), d_queued_tags.end(), - gr_tag_t::offset_compare); - // make sure we are not adding an item in the past! - if(tag.offset > nitems_read(0)) { - throw std::runtime_error("gr_annotator_raw::add_tag: item added too far in the past\n."); - } -} - -gr_annotator_raw::~gr_annotator_raw() -{ -} - -int -gr_annotator_raw::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - gruel::scoped_lock l(d_mutex); - - const char *in = (const char*)input_items[0]; - char *out = (char*)output_items[0]; - - uint64_t start_N = nitems_read(0); - uint64_t end_N = start_N + (uint64_t)(noutput_items); - - // locate queued tags that fall in this range and insert them when appropriate - std::vector<gr_tag_t>::iterator i = d_queued_tags.begin(); - while( i != d_queued_tags.end() ) { - if( (*i).offset >= start_N && (*i).offset < end_N) { - add_item_tag(0, (*i).offset,(*i).key, (*i).value, (*i).srcid); - i = d_queued_tags.erase(i); - } - else { - break; - } - } - - // copy data across - memcpy(out, in, noutput_items*d_itemsize); - return noutput_items; -} diff --git a/gnuradio-core/src/lib/general/gr_annotator_raw.h b/gnuradio-core/src/lib/general/gr_annotator_raw.h deleted file mode 100644 index 02d0619081..0000000000 --- a/gnuradio-core/src/lib/general/gr_annotator_raw.h +++ /dev/null @@ -1,69 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2010 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio 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 3, or (at your option) - * any later version. - * - * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef INCLUDED_GR_ANNOTATOR_RAW_H -#define INCLUDED_GR_ANNOTATOR_RAW_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> -#include <gr_tags.h> -#include <gruel/thread.h> - -class gr_annotator_raw; -typedef boost::shared_ptr<gr_annotator_raw> gr_annotator_raw_sptr; - -// public constructor -GR_CORE_API gr_annotator_raw_sptr -gr_make_annotator_raw(size_t sizeof_stream_item); - -/*! - * \brief raw stream annotator testing block. - * - * This block creates arbitrary tags to be sent downstream - * blocks to be sent are set manually via accessor methods and are sent only once. - * - * This block is intended for testing of tag related blocks - */ -class GR_CORE_API gr_annotator_raw : public gr_sync_block -{ - public: - ~gr_annotator_raw(); - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - // insert a tag to be added - void add_tag(uint64_t offset, pmt::pmt_t key, pmt::pmt_t val); - -protected: - gr_annotator_raw(size_t sizeof_stream_item); - - private: - size_t d_itemsize; - std::vector<gr_tag_t> d_queued_tags; - gruel::mutex d_mutex; - - friend GR_CORE_API gr_annotator_raw_sptr - gr_make_annotator_raw(size_t sizeof_stream_item); -}; - -#endif diff --git a/gnuradio-core/src/lib/general/gr_annotator_raw.i b/gnuradio-core/src/lib/general/gr_annotator_raw.i deleted file mode 100644 index 4a58fe7c79..0000000000 --- a/gnuradio-core/src/lib/general/gr_annotator_raw.i +++ /dev/null @@ -1,26 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2010-2011 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio 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 3, or (at your option) - * any later version. - * - * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -GR_SWIG_BLOCK_MAGIC(gr,annotator_raw); - -%include <gr_tags.i> -%include <gr_annotator_raw.h> diff --git a/gnuradio-core/src/lib/general/gr_check_counting_s.cc b/gnuradio-core/src/lib/general/gr_check_counting_s.cc deleted file mode 100644 index c3288f4813..0000000000 --- a/gnuradio-core/src/lib/general/gr_check_counting_s.cc +++ /dev/null @@ -1,190 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2010 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio 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 3, or (at your option) - * any later version. - * - * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_check_counting_s.h> -#include <gr_io_signature.h> -#include <stdlib.h> -#include <stdio.h> - -gr_check_counting_s_sptr -gr_make_check_counting_s (bool do_32bit) -{ - return gnuradio::get_initial_sptr(new gr_check_counting_s (do_32bit)); -} - -gr_check_counting_s::gr_check_counting_s (bool do_32bit) - : gr_sync_block ("gr_check_counting", - gr_make_io_signature (1, 1, sizeof (short)), - gr_make_io_signature (0, 0, 0)), - d_state(SEARCHING), d_history (0), d_current_count (0), d_current_count_32bit(0), - d_total_errors (0), d_total_shorts (0), - d_do_32bit(do_32bit) -{ - enter_SEARCHING (); -} - -int -gr_check_counting_s::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - unsigned short *in = (unsigned short *) input_items[0]; - if(d_do_32bit) - return check_32bit(noutput_items,in); - else - return check_16bit(noutput_items,in); -} - -int -gr_check_counting_s::check_16bit (int noutput_items, - unsigned short * in) -{ - for (int i = 0; i < noutput_items; i++){ - unsigned short x = in[i]; - - switch (d_state){ - - case SEARCHING: - if (x == d_current_count){ - right (); - log_error (d_current_count, x); - d_current_count = d_current_count + 1; - if (right_three_times ()) - enter_LOCKED (); - } - else { - wrong (); - log_error (d_current_count, x); - d_current_count = x + 1; - } - break; - - case LOCKED: - if (x == d_current_count){ - right (); - d_current_count = d_current_count + 1; - } - else { - wrong (); - log_error (d_current_count, x); - d_current_count = d_current_count + 1; - if (wrong_three_times ()) - enter_SEARCHING (); - } - break; - - default: - abort (); - } - - d_total_shorts++; - } - - return noutput_items; -} - -int -gr_check_counting_s::check_32bit (int noutput_items, - unsigned short * in) -{ - - for (int i = 0; i < noutput_items-1; i+=2){ - unsigned int x_high16bits = in[i]; - unsigned int x_low16bits = in[i+1]; - unsigned int x = x_high16bits<<16 | x_low16bits; - - switch (d_state){ - - case SEARCHING: - if (x == d_current_count_32bit){ - right (); - log_error_32bit (d_current_count_32bit, x); - d_current_count_32bit = d_current_count_32bit + 1; - if (right_three_times ()) - enter_LOCKED (); - } - else { - wrong (); - log_error_32bit (d_current_count_32bit, x); - d_current_count_32bit = x + 1; - } - break; - - case LOCKED: - if (x == d_current_count_32bit){ - right (); - d_current_count_32bit = d_current_count_32bit + 1; - } - else { - wrong (); - log_error_32bit (d_current_count_32bit, x); - d_current_count_32bit = d_current_count_32bit + 1; - if (wrong_three_times ()) - enter_SEARCHING (); - } - break; - - default: - abort (); - } - - d_total_shorts++; - } - - return noutput_items; -} - -void -gr_check_counting_s::enter_SEARCHING () -{ - d_state = SEARCHING; - fprintf (stdout, "gr_check_counting: enter_SEARCHING at offset %8ld (0x%08lx)\n", - d_total_shorts, d_total_shorts); -} - -void -gr_check_counting_s::enter_LOCKED () -{ - d_state = LOCKED; - fprintf (stdout, "gr_check_counting: enter_LOCKED at offset %8ld (0x%08lx)\n", - d_total_shorts, d_total_shorts); -} - -void -gr_check_counting_s::log_error (unsigned short expected, unsigned short actual) -{ - fprintf (stdout, -"gr_check_counting: expected %5d (0x%04x) got %5d (0x%04x) offset %8ld (0x%08lx)\n", - expected, expected, actual, actual, d_total_shorts, d_total_shorts); -} - -void -gr_check_counting_s::log_error_32bit (unsigned int expected, unsigned int actual) -{ - fprintf (stdout, -"gr_check_counting: expected %10d (0x%08x) got %10d (0x%08x) offset %8ld (0x%08lx)\n", - expected, expected, actual, actual, d_total_shorts, d_total_shorts); -} diff --git a/gnuradio-core/src/lib/general/gr_check_counting_s.h b/gnuradio-core/src/lib/general/gr_check_counting_s.h deleted file mode 100644 index 996fa3259f..0000000000 --- a/gnuradio-core/src/lib/general/gr_check_counting_s.h +++ /dev/null @@ -1,89 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio 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 3, or (at your option) - * any later version. - * - * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ -#ifndef INCLUDED_GR_CHECK_COUNTING_S_H -#define INCLUDED_GR_CHECK_COUNTING_S_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> - -class gr_check_counting_s; -typedef boost::shared_ptr<gr_check_counting_s> gr_check_counting_s_sptr; - -GR_CORE_API gr_check_counting_s_sptr gr_make_check_counting_s (bool do_32bit=false); - -/*! - * \brief sink that checks if its input stream consists of a counting sequence. - * \param do_32bit expect an interleaved 32 bit counter in stead of 16 bit counter (default false) - * \ingroup sink_blk - * - * This sink is typically used to test the USRP "Counting Mode" or "Counting mode 32 bit". - */ -class GR_CORE_API gr_check_counting_s : public gr_sync_block -{ - friend GR_CORE_API gr_check_counting_s_sptr gr_make_check_counting_s (bool do_32bit); - - enum state { - SEARCHING, // searching for synchronization - LOCKED // is locked - }; - - state d_state; - unsigned int d_history; // bitmask of decisions - unsigned short d_current_count; - unsigned int d_current_count_32bit; - - long d_total_errors; - long d_total_shorts; - bool d_do_32bit; - - gr_check_counting_s (bool do_32bit); - - void enter_SEARCHING (); - void enter_LOCKED (); - - void right (){ - d_history = (d_history << 1) | 0x1; - } - - void wrong (){ - d_history = (d_history << 1) | 0x0; - d_total_errors++; - } - - bool right_three_times () { return (d_history & 0x7) == 0x7; } - bool wrong_three_times () { return (d_history & 0x7) == 0x0; } - - void log_error (unsigned short expected, unsigned short actual); - void log_error_32bit (unsigned int expected, unsigned int actual); - - int check_32bit (int noutput_items, unsigned short * in); - int check_16bit (int noutput_items, unsigned short * in); - - public: - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - - -#endif /* INCLUDED_GR_CHECK_COUNTING_S_H */ diff --git a/gnuradio-core/src/lib/general/gr_check_counting_s.i b/gnuradio-core/src/lib/general/gr_check_counting_s.i deleted file mode 100644 index 0275dad9db..0000000000 --- a/gnuradio-core/src/lib/general/gr_check_counting_s.i +++ /dev/null @@ -1,31 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio 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 3, or (at your option) - * any later version. - * - * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -GR_SWIG_BLOCK_MAGIC(gr,check_counting_s) - -gr_check_counting_s_sptr gr_make_check_counting_s (bool do_32bit=false); - -class gr_check_counting_s : public gr_sync_block -{ - private: - gr_check_counting_s (bool do_32bit); -}; diff --git a/gnuradio-core/src/lib/general/gr_copy.cc b/gnuradio-core/src/lib/general/gr_copy.cc deleted file mode 100644 index 0a6f721f94..0000000000 --- a/gnuradio-core/src/lib/general/gr_copy.cc +++ /dev/null @@ -1,71 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,2009 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio 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 3, or (at your option) - * any later version. - * - * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_copy.h> -#include <gr_io_signature.h> -#include <string.h> - -gr_copy_sptr -gr_make_copy(size_t itemsize) -{ - return gnuradio::get_initial_sptr(new gr_copy(itemsize)); -} - -gr_copy::gr_copy(size_t itemsize) - : gr_block ("copy", - gr_make_io_signature (1, 1, itemsize), - gr_make_io_signature (1, 1, itemsize)), - d_itemsize(itemsize), - d_enabled(true) -{ -} - -bool -gr_copy::check_topology(int ninputs, int noutputs) -{ - return ninputs == noutputs; -} - -int -gr_copy::general_work(int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const uint8_t *in = (const uint8_t *) input_items[0]; - uint8_t *out = (uint8_t *) output_items[0]; - - int n = std::min<int>(ninput_items[0], noutput_items); - int j = 0; - - if (d_enabled) { - memcpy(out, in, n*d_itemsize); - j = n; - } - - consume_each(n); - return j; -} diff --git a/gnuradio-core/src/lib/general/gr_copy.h b/gnuradio-core/src/lib/general/gr_copy.h deleted file mode 100644 index b0769fa2b1..0000000000 --- a/gnuradio-core/src/lib/general/gr_copy.h +++ /dev/null @@ -1,63 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,2009 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio 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 3, or (at your option) - * any later version. - * - * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef INCLUDED_GR_COPY_H -#define INCLUDED_GR_COPY_H - -#include <gr_core_api.h> -#include <gr_block.h> - -class gr_copy; -typedef boost::shared_ptr<gr_copy> gr_copy_sptr; - -GR_CORE_API gr_copy_sptr gr_make_copy(size_t itemsize); - -/*! - * \brief output[i] = input[i] - * \ingroup misc_blk - * - * When enabled (default), this block copies its input to its output. - * When disabled, this block drops its input on the floor. - * - */ -class GR_CORE_API gr_copy : public gr_block -{ - size_t d_itemsize; - bool d_enabled; - - friend GR_CORE_API gr_copy_sptr gr_make_copy(size_t itemsize); - gr_copy(size_t itemsize); - - public: - - bool check_topology(int ninputs, int noutputs); - - void set_enabled(bool enable) { d_enabled = enable; } - bool enabled() const { return d_enabled;} - - int general_work(int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gnuradio-core/src/lib/general/gr_copy.i b/gnuradio-core/src/lib/general/gr_copy.i deleted file mode 100644 index 12ddce6aaf..0000000000 --- a/gnuradio-core/src/lib/general/gr_copy.i +++ /dev/null @@ -1,36 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,2009 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio 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 3, or (at your option) - * any later version. - * - * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -GR_SWIG_BLOCK_MAGIC(gr,copy) - -gr_copy_sptr gr_make_copy(size_t itemsize); - -class gr_copy : public gr_block -{ - private: - gr_copy(size_t itemsize); - -public: - - void set_enabled(bool enabled); - bool enabled(); -}; diff --git a/gnuradio-core/src/lib/general/gr_ctrlport_probe2_c.cc b/gnuradio-core/src/lib/general/gr_ctrlport_probe2_c.cc deleted file mode 100644 index ca6667a214..0000000000 --- a/gnuradio-core/src/lib/general/gr_ctrlport_probe2_c.cc +++ /dev/null @@ -1,156 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2012 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio 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 3, or (at your option) - * any later version. - * - * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_ctrlport_probe2_c.h> -#include <gr_io_signature.h> - -gr_ctrlport_probe2_c_sptr -gr_make_ctrlport_probe2_c(const std::string &id, - const std::string &desc, int len) -{ - return gnuradio::get_initial_sptr - (new gr_ctrlport_probe2_c(id, desc, len)); -} - -gr_ctrlport_probe2_c::gr_ctrlport_probe2_c(const std::string &id, - const std::string &desc, int len) - : gr_sync_block("probe2_c", - gr_make_io_signature(1, 1, sizeof(gr_complex)), - gr_make_io_signature(0, 0, 0)), - d_id(id), d_desc(desc), d_len(len) -{ - set_length(len); -} - -gr_ctrlport_probe2_c::~gr_ctrlport_probe2_c() -{ -} - -void -gr_ctrlport_probe2_c::forecast(int noutput_items, gr_vector_int &ninput_items_required) -{ - // make sure all inputs have noutput_items available - unsigned ninputs = ninput_items_required.size(); - for(unsigned i = 0; i < ninputs; i++) - ninput_items_required[i] = d_len; -} - -// boost::shared_mutex mutex_buffer; -// mutable boost::mutex mutex_notify; -// boost::condition_variable condition_buffer_ready; -std::vector<gr_complex> -gr_ctrlport_probe2_c::get() -{ - mutex_buffer.lock(); - d_buffer.clear(); - mutex_buffer.unlock(); - - // wait for condition - boost::mutex::scoped_lock lock(mutex_notify); - condition_buffer_ready.wait(lock); - - mutex_buffer.lock(); - std::vector<gr_complex> buf_copy = d_buffer; - assert(buf_copy.size() == d_len); - mutex_buffer.unlock(); - - return buf_copy; -} - -void -gr_ctrlport_probe2_c::set_length(int len) -{ - if(len > 8191) { - std::cerr << "probe2_c: length " << len - << " exceeds maximum buffer size of 8191" << std::endl; - len = 8191; - } - - d_len = len; - d_buffer.reserve(d_len); -} - -int -gr_ctrlport_probe2_c::length() const -{ - return (int)d_len; -} - -int -gr_ctrlport_probe2_c::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const gr_complex *in = (const gr_complex*)input_items[0]; - - // copy samples to get buffer if we need samples - mutex_buffer.lock(); - if(d_buffer.size() < d_len) { - // copy smaller of remaining buffer space and num inputs to work() - int num_copy = std::min( (int)(d_len - d_buffer.size()), noutput_items ); - - // TODO: convert this to a copy operator for speed... - for(int i = 0; i < num_copy; i++) { - d_buffer.push_back(in[i]); - } - - // notify the waiting get() if we fill up the buffer - if(d_buffer.size() == d_len) { - condition_buffer_ready.notify_one(); - } - } - mutex_buffer.unlock(); - - return noutput_items; -} - -void -gr_ctrlport_probe2_c::setup_rpc() -{ -#ifdef GR_CTRLPORT - int len = static_cast<int>(d_len); - d_rpc_vars.push_back( - rpcbasic_sptr(new rpcbasic_register_get<gr_ctrlport_probe2_c, std::vector<std::complex<float> > >( - alias(), d_id.c_str(), &gr_ctrlport_probe2_c::get, - pmt::make_c32vector(0,-2), - pmt::make_c32vector(0,2), - pmt::make_c32vector(0,0), - "volts", d_desc.c_str(), RPC_PRIVLVL_MIN, - DISPXY | DISPOPTSCATTER))); - - d_rpc_vars.push_back( - rpcbasic_sptr(new rpcbasic_register_get<gr_ctrlport_probe2_c, int>( - alias(), "length", &gr_ctrlport_probe2_c::length, - pmt::mp(1), pmt::mp(10*len), pmt::mp(len), - "samples", "get vector length", RPC_PRIVLVL_MIN, DISPNULL))); - - d_rpc_vars.push_back( - rpcbasic_sptr(new rpcbasic_register_set<gr_ctrlport_probe2_c, int>( - alias(), "length", &gr_ctrlport_probe2_c::set_length, - pmt::mp(1), pmt::mp(10*len), pmt::mp(len), - "samples", "set vector length", RPC_PRIVLVL_MIN, DISPNULL))); -#endif /* GR_CTRLPORT */ -} diff --git a/gnuradio-core/src/lib/general/gr_ctrlport_probe2_c.h b/gnuradio-core/src/lib/general/gr_ctrlport_probe2_c.h deleted file mode 100644 index 0920c0f4e8..0000000000 --- a/gnuradio-core/src/lib/general/gr_ctrlport_probe2_c.h +++ /dev/null @@ -1,72 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2012 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio 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 3, or (at your option) - * any later version. - * - * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef INCLUDED_CTRLPORT_PROBE2_C_H -#define INCLUDED_CTRLPORT_PROBE2_C_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> -#include <rpcregisterhelpers.h> -#include <boost/thread/shared_mutex.hpp> - -class gr_ctrlport_probe2_c; -typedef boost::shared_ptr<gr_ctrlport_probe2_c> gr_ctrlport_probe2_c_sptr; - -GR_CORE_API gr_ctrlport_probe2_c_sptr -gr_make_ctrlport_probe2_c(const std::string &id, const std::string &desc, int len); - -class GR_CORE_API gr_ctrlport_probe2_c : public gr_sync_block -{ - private: - friend GR_CORE_API gr_ctrlport_probe2_c_sptr gr_make_ctrlport_probe2_c - (const std::string &id, const std::string &desc, int len); - - gr_ctrlport_probe2_c(const std::string &id, const std::string &desc, int len); - - std::string d_id; - std::string d_desc; - size_t d_len; - boost::shared_mutex mutex_buffer; - mutable boost::mutex mutex_notify; - boost::condition_variable condition_buffer_ready; - - std::vector<gr_complex> d_buffer; - - public: - ~gr_ctrlport_probe2_c(); - - void setup_rpc(); - - void forecast(int noutput_items, gr_vector_int &ninput_items_required); - - std::vector<gr_complex> get(); - - void set_length(int len); - int length() const; - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_CTRLPORT_PROBE2_C_H */ - diff --git a/gnuradio-core/src/lib/general/gr_ctrlport_probe2_c.i b/gnuradio-core/src/lib/general/gr_ctrlport_probe2_c.i deleted file mode 100644 index 18858595ea..0000000000 --- a/gnuradio-core/src/lib/general/gr_ctrlport_probe2_c.i +++ /dev/null @@ -1,36 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2012 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio 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 3, or (at your option) - * any later version. - * - * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -GR_SWIG_BLOCK_MAGIC(gr,ctrlport_probe2_c) - -gr_ctrlport_probe2_c_sptr -gr_make_ctrlport_probe2_c(const std::string &id, const std::string &desc, int len); - -class gr_ctrlport_probe2_c : public gr_sync_block -{ -public: - ~gr_ctrlport_probe2_c(); - std::vector<gr_complex> get(); - void set_length(int len); - int length() const; -}; - diff --git a/gnuradio-core/src/lib/general/gr_ctrlport_probe_c.cc b/gnuradio-core/src/lib/general/gr_ctrlport_probe_c.cc deleted file mode 100644 index 253d4c380e..0000000000 --- a/gnuradio-core/src/lib/general/gr_ctrlport_probe_c.cc +++ /dev/null @@ -1,96 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2012 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio 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 3, or (at your option) - * any later version. - * - * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_ctrlport_probe_c.h> -#include <gr_io_signature.h> - -gr_ctrlport_probe_c_sptr -gr_make_ctrlport_probe_c(const std::string &id, - const std::string &desc) -{ - return gnuradio::get_initial_sptr - (new gr_ctrlport_probe_c(id, desc)); -} - - -gr_ctrlport_probe_c::gr_ctrlport_probe_c(const std::string &id, - const std::string &desc) - : gr_sync_block("probe_c", - gr_make_io_signature(1, 1, sizeof(gr_complex)), - gr_make_io_signature(0, 0, 0)), - d_id(id), d_desc(desc), d_ptr(NULL), d_ptrLen(0) -{ -} - -gr_ctrlport_probe_c::~gr_ctrlport_probe_c() -{ -} - -std::vector<gr_complex> -gr_ctrlport_probe_c::get() -{ - if(d_ptr != NULL && d_ptrLen > 0) { - ptrlock.lock(); - std::vector<gr_complex> vec(d_ptr, d_ptr+d_ptrLen); - ptrlock.unlock(); - return vec; - } - else { - std::vector<gr_complex> vec; - return vec; - } -} - -int -gr_ctrlport_probe_c::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const gr_complex *in = (const gr_complex*)input_items[0]; - - // keep reference to symbols - ptrlock.lock(); - d_ptr = in; - d_ptrLen = noutput_items; - ptrlock.unlock(); - - return noutput_items; -} - -void -gr_ctrlport_probe_c::setup_rpc() -{ -#ifdef GR_CTRLPORT - d_rpc_vars.push_back( - rpcbasic_sptr(new rpcbasic_register_get<gr_ctrlport_probe_c, std::vector<std::complex<float> > >( - alias(), d_id.c_str(), &gr_ctrlport_probe_c::get, - pmt::make_c32vector(0,-2), - pmt::make_c32vector(0,2), - pmt::make_c32vector(0,0), - "volts", d_desc.c_str(), RPC_PRIVLVL_MIN, - DISPXY | DISPOPTSCATTER))); -#endif /* GR_CTRLPORT */ -} diff --git a/gnuradio-core/src/lib/general/gr_ctrlport_probe_c.i b/gnuradio-core/src/lib/general/gr_ctrlport_probe_c.i deleted file mode 100644 index cd4c521cb0..0000000000 --- a/gnuradio-core/src/lib/general/gr_ctrlport_probe_c.i +++ /dev/null @@ -1,34 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2012 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio 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 3, or (at your option) - * any later version. - * - * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -GR_SWIG_BLOCK_MAGIC(gr,ctrlport_probe_c) - -gr_ctrlport_probe_c_sptr -gr_make_ctrlport_probe_c(const std::string &id, const std::string &desc); - -class gr_ctrlport_probe_c : public gr_sync_block -{ -public: - ~gr_ctrlport_probe_c(); - std::vector<gr_complex> get(); -}; - diff --git a/gnuradio-core/src/lib/general/gr_endian_swap.cc b/gnuradio-core/src/lib/general/gr_endian_swap.cc deleted file mode 100644 index 8bea0ca30d..0000000000 --- a/gnuradio-core/src/lib/general/gr_endian_swap.cc +++ /dev/null @@ -1,101 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2010,2012 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio 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 3, or (at your option) - * any later version. - * - * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_endian_swap.h> -#include <gr_io_signature.h> -#include <volk/volk.h> - -gr_endian_swap_sptr -gr_make_endian_swap (size_t item_size_bytes) -{ - return gnuradio::get_initial_sptr(new gr_endian_swap (item_size_bytes)); -} - -gr_endian_swap::gr_endian_swap (size_t item_size_bytes) - : gr_sync_block ("gr_endian_swap", - gr_make_io_signature (1, 1, item_size_bytes), - gr_make_io_signature (1, 1, item_size_bytes)) -{ - const int alignment_multiple = volk_get_alignment(); - set_alignment(std::max(1,alignment_multiple)); -} - -int -gr_endian_swap::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const char *in = (const char *) input_items[0]; - char *out = (char *) output_items[0]; - - int nbytes( output_signature()->sizeof_stream_item(0) ); - if(is_unaligned()) { - switch(nbytes){ - case 1: - memcpy(out,in,noutput_items); - break; - case 2: - memcpy(out,in,2*noutput_items); - volk_16u_byteswap_u((uint16_t*)out,noutput_items); - break; - case 4: - memcpy(out,in,4*noutput_items); - volk_32u_byteswap_u((uint32_t*)out,noutput_items); - break; - case 8: - memcpy(out,in,8*noutput_items); - volk_64u_byteswap_u((uint64_t*)out,noutput_items); - break; - default: - throw std::runtime_error("itemsize is not valid for gr_endian_swap!"); - } - } else { - switch(nbytes){ - case 1: - memcpy(out,in,noutput_items); - break; - case 2: - memcpy(out,in,2*noutput_items); - volk_16u_byteswap_a((uint16_t*)out,noutput_items); - break; - case 4: - memcpy(out,in,4*noutput_items); - volk_32u_byteswap_a((uint32_t*)out,noutput_items); - break; - case 8: - memcpy(out,in,8*noutput_items); - volk_64u_byteswap_a((uint64_t*)out,noutput_items); - break; - default: - throw std::runtime_error("itemsize is not valid for gr_endian_swap!"); - } - } - - return noutput_items; -} - - - diff --git a/gnuradio-core/src/lib/general/gr_endian_swap.i b/gnuradio-core/src/lib/general/gr_endian_swap.i deleted file mode 100644 index 6058b9de77..0000000000 --- a/gnuradio-core/src/lib/general/gr_endian_swap.i +++ /dev/null @@ -1,31 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2012 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio 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 3, or (at your option) - * any later version. - * - * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -GR_SWIG_BLOCK_MAGIC(gr,endian_swap) - -gr_endian_swap_sptr -gr_make_endian_swap (size_t bytes_per_item=1); - -class gr_endian_swap : public gr_sync_block -{ -public: -}; diff --git a/gnuradio-core/src/lib/gengen/gr_endianness.h b/gnuradio-core/src/lib/general/gr_endianness.h index c4ecb1383e..c4ecb1383e 100644 --- a/gnuradio-core/src/lib/gengen/gr_endianness.h +++ b/gnuradio-core/src/lib/general/gr_endianness.h diff --git a/gnuradio-core/src/lib/general/gr_fake_channel_coder_pp.cc b/gnuradio-core/src/lib/general/gr_fake_channel_coder_pp.cc deleted file mode 100644 index c1c3883c56..0000000000 --- a/gnuradio-core/src/lib/general/gr_fake_channel_coder_pp.cc +++ /dev/null @@ -1,113 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,2010 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio 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 3, or (at your option) - * any later version. - * - * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_fake_channel_coder_pp.h> -#include <gr_io_signature.h> -#include <string.h> -#include <stdexcept> -#include <string.h> - -static const int PAD_VAL = 0xAA; - -gr_fake_channel_encoder_pp_sptr -gr_make_fake_channel_encoder_pp(int input_vlen, int output_vlen) -{ - return gnuradio::get_initial_sptr(new gr_fake_channel_encoder_pp(input_vlen, - output_vlen)); -} - -gr_fake_channel_encoder_pp::gr_fake_channel_encoder_pp(int input_vlen, int output_vlen) - : gr_sync_block("fake_channel_encoder_pp", - gr_make_io_signature(1, 1, input_vlen * sizeof(unsigned char)), - gr_make_io_signature(1, 1, output_vlen * sizeof(unsigned char))), - d_input_vlen(input_vlen), d_output_vlen(output_vlen) -{ - if (input_vlen <= 0 || output_vlen <= 0 || input_vlen > output_vlen) - throw std::invalid_argument("gr_fake_channel_encoder_pp"); -} - -gr_fake_channel_encoder_pp::~gr_fake_channel_encoder_pp() -{ -} - -int -gr_fake_channel_encoder_pp::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const unsigned char *in = (const unsigned char *) input_items[0]; - unsigned char *out = (unsigned char *) output_items[0]; - int npad = d_output_vlen - d_input_vlen; - - for (int i = 0; i < noutput_items; i++){ - memcpy(out, in, d_input_vlen); - memset(out + d_input_vlen, PAD_VAL, npad); - in += d_input_vlen; - out += d_output_vlen; - } - - return noutput_items; -} - -// ------------------------------------------------------------------------ - -gr_fake_channel_decoder_pp_sptr -gr_make_fake_channel_decoder_pp(int input_vlen, int output_vlen) -{ - return gnuradio::get_initial_sptr(new gr_fake_channel_decoder_pp(input_vlen, - output_vlen)); -} - -gr_fake_channel_decoder_pp::gr_fake_channel_decoder_pp(int input_vlen, int output_vlen) - : gr_sync_block("fake_channel_decoder_pp", - gr_make_io_signature(1, 1, input_vlen * sizeof(unsigned char)), - gr_make_io_signature(1, 1, output_vlen * sizeof(unsigned char))), - d_input_vlen(input_vlen), d_output_vlen(output_vlen) -{ - if (input_vlen <= 0 || output_vlen <= 0 || output_vlen > input_vlen) - throw std::invalid_argument("gr_fake_channel_decoder_pp"); -} - -gr_fake_channel_decoder_pp::~gr_fake_channel_decoder_pp() -{ -} - -int -gr_fake_channel_decoder_pp::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const unsigned char *in = (const unsigned char *) input_items[0]; - unsigned char *out = (unsigned char *) output_items[0]; - - for (int i = 0; i < noutput_items; i++){ - memcpy(out, in, d_output_vlen); - in += d_input_vlen; - out += d_output_vlen; - } - - return noutput_items; -} diff --git a/gnuradio-core/src/lib/general/gr_fake_channel_coder_pp.h b/gnuradio-core/src/lib/general/gr_fake_channel_coder_pp.h deleted file mode 100644 index 45808752d3..0000000000 --- a/gnuradio-core/src/lib/general/gr_fake_channel_coder_pp.h +++ /dev/null @@ -1,91 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio 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 3, or (at your option) - * any later version. - * - * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef INCLUDED_GR_FAKE_CHANNEL_CODER_PP_H -#define INCLUDED_GR_FAKE_CHANNEL_CODER_PP_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> - -class gr_fake_channel_encoder_pp; -typedef boost::shared_ptr<gr_fake_channel_encoder_pp> gr_fake_channel_encoder_pp_sptr; - -GR_CORE_API gr_fake_channel_encoder_pp_sptr -gr_make_fake_channel_encoder_pp(int input_vlen, int output_vlen); - -/*! - * \brief pad packet with alternating 1,0 pattern. - * \ingroup coding_blk - * - * input: stream of byte vectors; output: stream of byte vectors - */ -class GR_CORE_API gr_fake_channel_encoder_pp : public gr_sync_block -{ - int d_input_vlen; - int d_output_vlen; - - gr_fake_channel_encoder_pp(int input_vlen, int output_vlen); - - friend GR_CORE_API gr_fake_channel_encoder_pp_sptr - gr_make_fake_channel_encoder_pp(int input_vlen, int output_vlen); - -public: - ~gr_fake_channel_encoder_pp(); - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -// ------------------------------------------------------------------------ - -class gr_fake_channel_decoder_pp; -typedef boost::shared_ptr<gr_fake_channel_decoder_pp> gr_fake_channel_decoder_pp_sptr; - -GR_CORE_API gr_fake_channel_decoder_pp_sptr -gr_make_fake_channel_decoder_pp(int input_vlen, int output_vlen); - -/*! - * \brief remove fake padding from packet - * \ingroup coding_blk - * - * input: stream of byte vectors; output: stream of byte vectors - */ -class GR_CORE_API gr_fake_channel_decoder_pp : public gr_sync_block -{ - int d_input_vlen; - int d_output_vlen; - - gr_fake_channel_decoder_pp(int input_vlen, int output_vlen); - - friend GR_CORE_API gr_fake_channel_decoder_pp_sptr - gr_make_fake_channel_decoder_pp(int input_vlen, int output_vlen); - -public: - ~gr_fake_channel_decoder_pp(); - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_GR_FAKE_CHANNEL_CODER_PP_H */ diff --git a/gnuradio-core/src/lib/general/gr_fake_channel_coder_pp.i b/gnuradio-core/src/lib/general/gr_fake_channel_coder_pp.i deleted file mode 100644 index 123c84e473..0000000000 --- a/gnuradio-core/src/lib/general/gr_fake_channel_coder_pp.i +++ /dev/null @@ -1,53 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio 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 3, or (at your option) - * any later version. - * - * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -GR_SWIG_BLOCK_MAGIC(gr,fake_channel_encoder_pp) - -gr_fake_channel_encoder_pp_sptr -gr_make_fake_channel_encoder_pp(int input_vlen, - int output_vlen - ) throw(std::invalid_argument); - -class gr_fake_channel_encoder_pp : public gr_sync_block -{ - gr_fake_channel_encoder_pp(int input_vlen, int output_vlen); - -public: - ~gr_fake_channel_encoder_pp(); -}; - -// ------------------------------------------------------------------------ - -GR_SWIG_BLOCK_MAGIC(gr,fake_channel_decoder_pp) - -gr_fake_channel_decoder_pp_sptr -gr_make_fake_channel_decoder_pp(int input_vlen, - int output_vlen - ) throw(std::invalid_argument); - -class gr_fake_channel_decoder_pp : public gr_sync_block -{ - gr_fake_channel_decoder_pp(int input_vlen, int output_vlen); - -public: - ~gr_fake_channel_decoder_pp(); -}; diff --git a/gnuradio-core/src/lib/general/gr_head.cc b/gnuradio-core/src/lib/general/gr_head.cc deleted file mode 100644 index 1726888113..0000000000 --- a/gnuradio-core/src/lib/general/gr_head.cc +++ /dev/null @@ -1,62 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2009 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio 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 3, or (at your option) - * any later version. - * - * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include <gr_head.h> -#include <gr_io_signature.h> -#include <string.h> -#include <iostream> - -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)), - d_nitems (nitems), d_ncopied_items (0) -{ -} - -gr_head_sptr -gr_make_head (size_t sizeof_stream_item, unsigned long long nitems) -{ - return gnuradio::get_initial_sptr(new gr_head (sizeof_stream_item, nitems)); -} - -int -gr_head::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - if (d_ncopied_items >= d_nitems) - return -1; // Done! - - unsigned n = std::min (d_nitems - d_ncopied_items, (unsigned long long) noutput_items); - - if (n == 0) - return 0; - - memcpy (output_items[0], input_items[0], n * input_signature()->sizeof_stream_item (0)); - d_ncopied_items += n; - - return n; -} diff --git a/gnuradio-core/src/lib/general/gr_head.i b/gnuradio-core/src/lib/general/gr_head.i deleted file mode 100644 index 11f3331d47..0000000000 --- a/gnuradio-core/src/lib/general/gr_head.i +++ /dev/null @@ -1,33 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2009,2012 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio 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 3, or (at your option) - * any later version. - * - * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -GR_SWIG_BLOCK_MAGIC(gr,head); - -gr_head_sptr gr_make_head(size_t sizeof_stream_item, unsigned long long nitems); - -class gr_head : public gr_block { - gr_head(); -public: - void reset(); - void set_length(int nitems); -}; - diff --git a/gnuradio-core/src/lib/general/gr_iqcomp_cc.cc b/gnuradio-core/src/lib/general/gr_iqcomp_cc.cc deleted file mode 100644 index 599b25b728..0000000000 --- a/gnuradio-core/src/lib/general/gr_iqcomp_cc.cc +++ /dev/null @@ -1,62 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,2010 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio 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 3, or (at your option) - * any later version. - * - * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_iqcomp_cc.h> -#include <gr_io_signature.h> - -gr_iqcomp_cc_sptr -gr_make_iqcomp_cc (float mu) -{ - return gnuradio::get_initial_sptr(new gr_iqcomp_cc (mu)); -} - -gr_iqcomp_cc::gr_iqcomp_cc (float mu) - : gr_sync_block ("iqcomp_cc", - gr_make_io_signature (1, 1, sizeof (gr_complex)), - gr_make_io_signature (1, 1, sizeof (gr_complex))), - d_mu (mu) -{ - d_wi=0.0; - d_wq=0.0; -} - -int -gr_iqcomp_cc::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const gr_complex *iptr = (gr_complex *) input_items[0]; - // gr_complex *optr = (gr_complex *) output_items[0]; - - for(int i = 0 ; i < noutput_items ; i++) { - float i_out = iptr[i].real() - iptr[i].imag() * d_wq; - float q_out = iptr[i].imag() - iptr[i].real() * d_wi; - d_wi += d_mu * q_out * iptr[i].real(); - d_wq += d_mu * i_out * iptr[i].imag(); - } - return noutput_items; -} diff --git a/gnuradio-core/src/lib/general/gr_kludge_copy.cc b/gnuradio-core/src/lib/general/gr_kludge_copy.cc deleted file mode 100644 index f6a8d8af68..0000000000 --- a/gnuradio-core/src/lib/general/gr_kludge_copy.cc +++ /dev/null @@ -1,64 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio 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 3, or (at your option) - * any later version. - * - * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_kludge_copy.h> -#include <gr_io_signature.h> -#include <string.h> - -gr_kludge_copy_sptr -gr_make_kludge_copy(size_t itemsize) -{ - return gnuradio::get_initial_sptr(new gr_kludge_copy(itemsize)); -} - -gr_kludge_copy::gr_kludge_copy(size_t itemsize) - : gr_sync_block ("kludge_copy", - gr_make_io_signature (1, -1, itemsize), - gr_make_io_signature (1, -1, itemsize)), - d_itemsize(itemsize) -{ -} - -bool -gr_kludge_copy::check_topology(int ninputs, int noutputs) -{ - return ninputs == noutputs; -} - -int -gr_kludge_copy::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const float **in = (const float **) &input_items[0]; - float **out = (float **) &output_items[0]; - - int ninputs = input_items.size(); - for (int i = 0; i < ninputs; i++){ - memcpy(out[i], in[i], noutput_items * d_itemsize); - } - return noutput_items; -} diff --git a/gnuradio-core/src/lib/general/gr_kludge_copy.h b/gnuradio-core/src/lib/general/gr_kludge_copy.h deleted file mode 100644 index 0bcf144699..0000000000 --- a/gnuradio-core/src/lib/general/gr_kludge_copy.h +++ /dev/null @@ -1,56 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio 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 3, or (at your option) - * any later version. - * - * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef INCLUDED_GR_KLUDGE_COPY_H -#define INCLUDED_GR_KLUDGE_COPY_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> - -class gr_kludge_copy; -typedef boost::shared_ptr<gr_kludge_copy> gr_kludge_copy_sptr; - -GR_CORE_API gr_kludge_copy_sptr gr_make_kludge_copy(size_t itemsize); - -/*! - * \brief output[i] = input[i] - * \ingroup misc_blk - * - * This is a short term kludge to work around a problem with the hierarchical block impl. - */ -class GR_CORE_API gr_kludge_copy : public gr_sync_block -{ - size_t d_itemsize; - - friend GR_CORE_API gr_kludge_copy_sptr gr_make_kludge_copy(size_t itemsize); - gr_kludge_copy(size_t itemsize); - - public: - - bool check_topology(int ninputs, int noutputs); - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gnuradio-core/src/lib/general/gr_kludge_copy.i b/gnuradio-core/src/lib/general/gr_kludge_copy.i deleted file mode 100644 index 7ff2b57365..0000000000 --- a/gnuradio-core/src/lib/general/gr_kludge_copy.i +++ /dev/null @@ -1,31 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio 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 3, or (at your option) - * any later version. - * - * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -GR_SWIG_BLOCK_MAGIC(gr,kludge_copy) - -gr_kludge_copy_sptr gr_make_kludge_copy(size_t itemsize); - -class gr_kludge_copy : public gr_sync_block -{ - private: - gr_kludge_copy(size_t itemsize); -}; diff --git a/gnuradio-core/src/lib/general/gr_nop.cc b/gnuradio-core/src/lib/general/gr_nop.cc deleted file mode 100644 index 164f3ba8dd..0000000000 --- a/gnuradio-core/src/lib/general/gr_nop.cc +++ /dev/null @@ -1,92 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2010 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio 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 3, or (at your option) - * any later version. - * - * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include <gr_nop.h> -#include <gr_io_signature.h> -#include <boost/bind.hpp> - -#ifdef GR_CTRLPORT -#include <rpcregisterhelpers.h> -#endif - -gr_nop_sptr -gr_make_nop (size_t sizeof_stream_item) -{ - return gnuradio::get_initial_sptr (new gr_nop (sizeof_stream_item)); -} - -gr_nop::gr_nop (size_t sizeof_stream_item) - : gr_block ("nop", - gr_make_io_signature (0, -1, sizeof_stream_item), - gr_make_io_signature (0, -1, sizeof_stream_item)), - d_nmsgs_recvd(0), d_ctrlport_test(0) -{ - // Arrange to have count_received_msgs called when messages are received. - message_port_register_in(pmt::mp("port")); - set_msg_handler(pmt::mp("port"), boost::bind(&gr_nop::count_received_msgs, this, _1)); -} - -// Trivial message handler that just counts them. -// (N.B., This feature is used in qa_set_msg_handler) -void -gr_nop::count_received_msgs(pmt::pmt_t msg) -{ - d_nmsgs_recvd++; -} - -int -gr_nop::general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - // eat any input that's available - for (unsigned i = 0; i < ninput_items.size (); i++) - consume (i, ninput_items[i]); - - return noutput_items; -} - -void -gr_nop::setup_rpc() -{ -#ifdef GR_CTRLPORT - d_rpc_vars.push_back( - rpcbasic_sptr(new rpcbasic_register_get<gr_nop, int>( - alias(), "test", - &gr_nop::ctrlport_test, - pmt::mp(-256), pmt::mp(255), pmt::mp(0), - "", "Simple testing variable", - RPC_PRIVLVL_MIN, DISPNULL))); - - d_rpc_vars.push_back( - rpcbasic_sptr(new rpcbasic_register_set<gr_nop, int>( - alias(), "test", - &gr_nop::set_ctrlport_test, - pmt::mp(-256), pmt::mp(255), pmt::mp(0), - "", "Simple testing variable", - RPC_PRIVLVL_MIN, DISPNULL))); -#endif /* GR_CTRLPORT */ -} diff --git a/gnuradio-core/src/lib/general/gr_nop.h b/gnuradio-core/src/lib/general/gr_nop.h deleted file mode 100644 index 5f1cb13a02..0000000000 --- a/gnuradio-core/src/lib/general/gr_nop.h +++ /dev/null @@ -1,67 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2010 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio 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 3, or (at your option) - * any later version. - * - * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef INCLUDED_GR_NOP_H -#define INCLUDED_GR_NOP_H - -#include <gr_core_api.h> -#include <gr_block.h> -#include <stddef.h> // size_t - -class gr_nop; -typedef boost::shared_ptr<gr_nop> gr_nop_sptr; - -GR_CORE_API gr_nop_sptr -gr_make_nop (size_t sizeof_stream_item); - -/*! - * \brief Does nothing. Used for testing only. - * \ingroup misc_blk - */ -class GR_CORE_API gr_nop : public gr_block -{ - friend GR_CORE_API gr_nop_sptr gr_make_nop (size_t sizeof_stream_item); - gr_nop (size_t sizeof_stream_item); - - std::vector<boost::any> d_rpc_vars; - void setup_rpc(); - -protected: - int d_nmsgs_recvd; - int d_ctrlport_test; - - // Method that just counts any received messages. - void count_received_msgs(pmt::pmt_t msg); - - public: - virtual int general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - int nmsgs_received() const { return d_nmsgs_recvd; } - - int ctrlport_test() { return d_ctrlport_test; } - void set_ctrlport_test(int x) { d_ctrlport_test = x; } -}; - -#endif /* INCLUDED_GR_NOP_H */ diff --git a/gnuradio-core/src/lib/general/gr_nop.i b/gnuradio-core/src/lib/general/gr_nop.i deleted file mode 100644 index 73ffa93630..0000000000 --- a/gnuradio-core/src/lib/general/gr_nop.i +++ /dev/null @@ -1,34 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2010 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio 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 3, or (at your option) - * any later version. - * - * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -GR_SWIG_BLOCK_MAGIC(gr,nop) - -gr_nop_sptr gr_make_nop (size_t sizeof_stream_item); - -class gr_nop : public gr_block { -public: - int ctrlport_test(); - void set_ctrlport_test(int x); -private: - gr_nop (size_t sizeof_stream_item); -}; - diff --git a/gnuradio-core/src/lib/general/gr_null_sink.cc b/gnuradio-core/src/lib/general/gr_null_sink.cc deleted file mode 100644 index 1836655024..0000000000 --- a/gnuradio-core/src/lib/general/gr_null_sink.cc +++ /dev/null @@ -1,49 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2010 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio 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 3, or (at your option) - * any later version. - * - * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_null_sink.h> -#include <gr_io_signature.h> - -gr_null_sink::gr_null_sink (size_t sizeof_stream_item) - : gr_sync_block ("null_sink", - gr_make_io_signature (1, 1, sizeof_stream_item), - gr_make_io_signature (0, 0, 0)) -{ -} - -gr_null_sink_sptr -gr_make_null_sink (size_t sizeof_stream_item) -{ - return gnuradio::get_initial_sptr (new gr_null_sink (sizeof_stream_item)); -} - -int -gr_null_sink::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - return noutput_items; -} diff --git a/gnuradio-core/src/lib/general/gr_null_sink.i b/gnuradio-core/src/lib/general/gr_null_sink.i deleted file mode 100644 index 80411f9b74..0000000000 --- a/gnuradio-core/src/lib/general/gr_null_sink.i +++ /dev/null @@ -1,31 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2010 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio 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 3, or (at your option) - * any later version. - * - * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -GR_SWIG_BLOCK_MAGIC(gr,null_sink) - -gr_null_sink_sptr gr_make_null_sink (size_t sizeof_stream_item); - -class gr_null_sink : public gr_sync_block { -private: - gr_null_sink (size_t sizeof_stream_item); -}; - diff --git a/gnuradio-core/src/lib/general/gr_null_source.i b/gnuradio-core/src/lib/general/gr_null_source.i deleted file mode 100644 index 120a59999c..0000000000 --- a/gnuradio-core/src/lib/general/gr_null_source.i +++ /dev/null @@ -1,31 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2010 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio 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 3, or (at your option) - * any later version. - * - * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -GR_SWIG_BLOCK_MAGIC(gr,null_source) - -gr_null_source_sptr gr_make_null_source (size_t sizeof_stream_item); - -class gr_null_source : public gr_sync_block { -private: - gr_null_source (size_t sizeof_stream_item); -}; - diff --git a/gnuradio-core/src/lib/general/gr_ofdm_bpsk_demapper.cc b/gnuradio-core/src/lib/general/gr_ofdm_bpsk_demapper.cc deleted file mode 100644 index 2b718e5ce2..0000000000 --- a/gnuradio-core/src/lib/general/gr_ofdm_bpsk_demapper.cc +++ /dev/null @@ -1,97 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,2010 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio 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 3, or (at your option) - * any later version. - * - * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_ofdm_bpsk_demapper.h> -#include <gr_io_signature.h> - -gr_ofdm_bpsk_demapper_sptr -gr_make_ofdm_bpsk_demapper (unsigned int occupied_carriers) -{ - return gnuradio::get_initial_sptr(new gr_ofdm_bpsk_demapper (occupied_carriers)); -} - -gr_ofdm_bpsk_demapper::gr_ofdm_bpsk_demapper (unsigned occupied_carriers) - : gr_block ("ofdm_bpsk_demapper", - gr_make_io_signature (1, 1, sizeof(gr_complex)*occupied_carriers), - gr_make_io_signature (1, 1, sizeof(unsigned char))), - d_occupied_carriers(occupied_carriers), - d_byte_offset(0), d_partial_byte(0) -{ -} - -gr_ofdm_bpsk_demapper::~gr_ofdm_bpsk_demapper(void) -{ -} - -unsigned char gr_ofdm_bpsk_demapper::slicer(gr_complex x) -{ - return (unsigned char)(x.real() > 0 ? 1 : 0); -} - -void -gr_ofdm_bpsk_demapper::forecast (int noutput_items, gr_vector_int &ninput_items_required) -{ - unsigned ninputs = ninput_items_required.size (); - for (unsigned i = 0; i < ninputs; i++) - ninput_items_required[i] = 1; -} - -int -gr_ofdm_bpsk_demapper::general_work(int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const gr_complex *in = (const gr_complex *)input_items[0]; - unsigned char *out = (unsigned char *) output_items[0]; - - unsigned int i=0, bytes_produced=0; - - while(i < d_occupied_carriers) { - - while((d_byte_offset < 8) && (i < d_occupied_carriers)) { - //fprintf(stderr, "%f+j%f\n", in[i].real(), in[i].imag()); - d_partial_byte |= slicer(in[i++]) << (d_byte_offset++); - } - - if(d_byte_offset == 8) { - out[bytes_produced++] = d_partial_byte; - d_byte_offset = 0; - d_partial_byte = 0; - } - } - -#if 0 -printf("demod out: "); - for(i = 0; i < bytes_produced; i++) { - printf("%4x", out[i]); - } - printf(" \tlen: %d\n", i); -#endif - - consume_each(1); - return bytes_produced; -} diff --git a/gnuradio-core/src/lib/general/gr_ofdm_bpsk_demapper.h b/gnuradio-core/src/lib/general/gr_ofdm_bpsk_demapper.h deleted file mode 100644 index d69d427edb..0000000000 --- a/gnuradio-core/src/lib/general/gr_ofdm_bpsk_demapper.h +++ /dev/null @@ -1,69 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio 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 3, or (at your option) - * any later version. - * - * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef INCLUDED_GR_OFDM_BPSK_DEMAPPER_H -#define INCLUDED_GR_OFDM_BPSK_DEMAPPER_H - - -#include <gr_core_api.h> -#include <gr_block.h> -#include <vector> - -class gr_ofdm_bpsk_demapper; -typedef boost::shared_ptr<gr_ofdm_bpsk_demapper> gr_ofdm_bpsk_demapper_sptr; - -GR_CORE_API gr_ofdm_bpsk_demapper_sptr -gr_make_ofdm_bpsk_demapper (unsigned int occupied_carriers); - - -/*! - * \brief take a vector of complex constellation points in from an FFT - * and demodulate to a stream of bits. Simple BPSK version. - * \ingroup ofdm_blk - */ -class GR_CORE_API gr_ofdm_bpsk_demapper : public gr_block -{ - friend GR_CORE_API gr_ofdm_bpsk_demapper_sptr - gr_make_ofdm_bpsk_demapper (unsigned int occupied_carriers); - - protected: - gr_ofdm_bpsk_demapper (unsigned int occupied_carriers); - - private: - unsigned char slicer(gr_complex x); - - unsigned int d_occupied_carriers; - unsigned int d_byte_offset; - unsigned char d_partial_byte; - - void forecast(int noutput_items, gr_vector_int &ninput_items_required); - - public: - ~gr_ofdm_bpsk_demapper(void); - int general_work(int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - - -#endif diff --git a/gnuradio-core/src/lib/general/gr_ofdm_bpsk_demapper.i b/gnuradio-core/src/lib/general/gr_ofdm_bpsk_demapper.i deleted file mode 100644 index e58a4e40c5..0000000000 --- a/gnuradio-core/src/lib/general/gr_ofdm_bpsk_demapper.i +++ /dev/null @@ -1,40 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2006 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio 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 3, or (at your option) - * any later version. - * - * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#include <vector> - -GR_SWIG_BLOCK_MAGIC(gr,ofdm_bpsk_demapper) - -gr_ofdm_bpsk_demapper_sptr -gr_make_ofdm_bpsk_demapper (unsigned int occupied_carriers); - -class gr_ofdm_bpsk_demapper : public gr_sync_decimator -{ - protected: - gr_ofdm_bpsk_demapper (unsigned int occupied_carriers); - - public: - int general_work(int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; diff --git a/gnuradio-core/src/lib/general/gr_ofdm_frame_sink2.cc b/gnuradio-core/src/lib/general/gr_ofdm_frame_sink2.cc deleted file mode 100644 index eb12327565..0000000000 --- a/gnuradio-core/src/lib/general/gr_ofdm_frame_sink2.cc +++ /dev/null @@ -1,374 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007,2008,2010,2011 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio 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 3, or (at your option) - * any later version. - * - * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_ofdm_frame_sink2.h> -#include <gr_io_signature.h> -#include <gr_expj.h> -#include <gr_math.h> -#include <math.h> -#include <cstdio> -#include <stdexcept> -#include <iostream> -#include <string.h> -#include <gr_constellation.h> - -#define VERBOSE 0 - -inline void -gr_ofdm_frame_sink2::enter_search() -{ - if (VERBOSE) - fprintf(stderr, "@ enter_search\n"); - - d_state = STATE_SYNC_SEARCH; - -} - -inline void -gr_ofdm_frame_sink2::enter_have_sync() -{ - if (VERBOSE) - fprintf(stderr, "@ enter_have_sync\n"); - - d_state = STATE_HAVE_SYNC; - - // clear state of demapper - d_byte_offset = 0; - d_partial_byte = 0; - - d_header = 0; - d_headerbytelen_cnt = 0; - - // Resetting PLL - d_freq = 0.0; - d_phase = 0.0; - fill(d_dfe.begin(), d_dfe.end(), gr_complex(1.0,0.0)); -} - -inline void -gr_ofdm_frame_sink2::enter_have_header() -{ - d_state = STATE_HAVE_HEADER; - - // header consists of two 16-bit shorts in network byte order - // payload length is lower 12 bits - // whitener offset is upper 4 bits - d_packetlen = (d_header >> 16) & 0x0fff; - d_packet_whitener_offset = (d_header >> 28) & 0x000f; - d_packetlen_cnt = 0; - - if (VERBOSE) - fprintf(stderr, "@ enter_have_header (payload_len = %d) (offset = %d)\n", - d_packetlen, d_packet_whitener_offset); -} - - -unsigned int gr_ofdm_frame_sink2::demapper(const gr_complex *in, - unsigned char *out) -{ - unsigned int i=0, bytes_produced=0; - gr_complex carrier; - - carrier=gr_expj(d_phase); - - gr_complex accum_error = 0.0; - //while(i < d_occupied_carriers) { - while(i < d_subcarrier_map.size()) { - if(d_nresid > 0) { - d_partial_byte |= d_resid; - d_byte_offset += d_nresid; - d_nresid = 0; - d_resid = 0; - } - - //while((d_byte_offset < 8) && (i < d_occupied_carriers)) { - while((d_byte_offset < 8) && (i < d_subcarrier_map.size())) { - //gr_complex sigrot = in[i]*carrier*d_dfe[i]; - gr_complex sigrot = in[d_subcarrier_map[i]]*carrier*d_dfe[i]; - - if(d_derotated_output != NULL){ - d_derotated_output[i] = sigrot; - } - - unsigned char bits = d_constell->decision_maker(&sigrot); - - gr_complex closest_sym = d_constell->points()[bits]; - - accum_error += sigrot * conj(closest_sym); - - // FIX THE FOLLOWING STATEMENT - if (norm(sigrot)> 0.001) d_dfe[i] += d_eq_gain*(closest_sym/sigrot-d_dfe[i]); - - i++; - - if((8 - d_byte_offset) >= d_nbits) { - d_partial_byte |= bits << (d_byte_offset); - d_byte_offset += d_nbits; - } - else { - d_nresid = d_nbits-(8-d_byte_offset); - int mask = ((1<<(8-d_byte_offset))-1); - d_partial_byte |= (bits & mask) << d_byte_offset; - d_resid = bits >> (8-d_byte_offset); - d_byte_offset += (d_nbits - d_nresid); - } - //printf("demod symbol: %.4f + j%.4f bits: %x partial_byte: %x byte_offset: %d resid: %x nresid: %d\n", - // in[i-1].real(), in[i-1].imag(), bits, d_partial_byte, d_byte_offset, d_resid, d_nresid); - } - - if(d_byte_offset == 8) { - //printf("demod byte: %x \n\n", d_partial_byte); - out[bytes_produced++] = d_partial_byte; - d_byte_offset = 0; - d_partial_byte = 0; - } - } - //std::cerr << "accum_error " << accum_error << std::endl; - - float angle = arg(accum_error); - - d_freq = d_freq - d_freq_gain*angle; - d_phase = d_phase + d_freq - d_phase_gain*angle; - if (d_phase >= 2*M_PI) d_phase -= 2*M_PI; - if (d_phase <0) d_phase += 2*M_PI; - - //if(VERBOSE) - // std::cerr << angle << "\t" << d_freq << "\t" << d_phase << "\t" << std::endl; - - return bytes_produced; -} - - -gr_ofdm_frame_sink2_sptr -gr_make_ofdm_frame_sink2(gr_constellation_sptr constell, - gr_msg_queue_sptr target_queue, unsigned int occupied_carriers, - float phase_gain, float freq_gain) -{ - return gnuradio::get_initial_sptr(new gr_ofdm_frame_sink2(constell, - target_queue, occupied_carriers, - phase_gain, freq_gain)); -} - - -gr_ofdm_frame_sink2::gr_ofdm_frame_sink2(gr_constellation_sptr constell, - gr_msg_queue_sptr target_queue, unsigned int occupied_carriers, - float phase_gain, float freq_gain) - : gr_sync_block ("ofdm_frame_sink2", - gr_make_io_signature2 (2, 2, sizeof(gr_complex)*occupied_carriers, sizeof(char)), - gr_make_io_signature (1, 1, sizeof(gr_complex)*occupied_carriers)), - d_constell(constell), - d_target_queue(target_queue), d_occupied_carriers(occupied_carriers), - d_byte_offset(0), d_partial_byte(0), - d_resid(0), d_nresid(0),d_phase(0),d_freq(0),d_phase_gain(phase_gain),d_freq_gain(freq_gain), - d_eq_gain(0.05) -{ - if (d_constell->dimensionality() != 1) - throw std::runtime_error ("This receiver only works with constellations of dimension 1."); - - std::string carriers = "FE7F"; - - // A bit hacky to fill out carriers to occupied_carriers length - int diff = (d_occupied_carriers - 4*carriers.length()); - while(diff > 7) { - carriers.insert(0, "f"); - carriers.insert(carriers.length(), "f"); - diff -= 8; - } - - // if there's extras left to be processed - // divide remaining to put on either side of current map - // all of this is done to stick with the concept of a carrier map string that - // can be later passed by the user, even though it'd be cleaner to just do this - // on the carrier map itself - int diff_left=0; - int diff_right=0; - - // dictionary to convert from integers to ascii hex representation - char abc[16] = {'0', '1', '2', '3', '4', '5', '6', '7', - '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'}; - if(diff > 0) { - char c[2] = {0,0}; - - diff_left = (int)ceil((float)diff/2.0f); // number of carriers to put on the left side - c[0] = abc[(1 << diff_left) - 1]; // convert to bits and move to ASCI integer - carriers.insert(0, c); - - diff_right = diff - diff_left; // number of carriers to put on the right side - c[0] = abc[0xF^((1 << diff_right) - 1)]; // convert to bits and move to ASCI integer - carriers.insert(carriers.length(), c); - } - - // It seemed like such a good idea at the time... - // because we are only dealing with the occupied_carriers - // at this point, the diff_left in the following compensates - // for any offset from the 0th carrier introduced - unsigned int i,j,k; - for(i = 0; i < (d_occupied_carriers/4)+diff_left; i++) { - char c = carriers[i]; - for(j = 0; j < 4; j++) { - k = (strtol(&c, NULL, 16) >> (3-j)) & 0x1; - if(k) { - d_subcarrier_map.push_back(4*i + j - diff_left); - } - } - } - - // make sure we stay in the limit currently imposed by the occupied_carriers - if(d_subcarrier_map.size() > d_occupied_carriers) { - throw std::invalid_argument("gr_ofdm_mapper_bcv: subcarriers allocated exceeds size of occupied carriers"); - } - - d_bytes_out = new unsigned char[d_occupied_carriers]; - d_dfe.resize(occupied_carriers); - fill(d_dfe.begin(), d_dfe.end(), gr_complex(1.0,0.0)); - - d_nbits = d_constell->bits_per_symbol(); - - enter_search(); -} - -gr_ofdm_frame_sink2::~gr_ofdm_frame_sink2 () -{ - delete [] d_bytes_out; -} - - -int -gr_ofdm_frame_sink2::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const gr_complex *in = (const gr_complex *) input_items[0]; - const char *sig = (const char *) input_items[1]; - unsigned int j = 0; - unsigned int bytes=0; - - // If the output is connected, send it the derotated symbols - if(output_items.size() >= 1) - d_derotated_output = (gr_complex *)output_items[0]; - else - d_derotated_output = NULL; - - if (VERBOSE) - fprintf(stderr,">>> Entering state machine\n"); - - switch(d_state) { - - case STATE_SYNC_SEARCH: // Look for flag indicating beginning of pkt - if (VERBOSE) - fprintf(stderr,"SYNC Search, noutput=%d\n", noutput_items); - - if (sig[0]) { // Found it, set up for header decode - enter_have_sync(); - } - break; - - case STATE_HAVE_SYNC: - // only demod after getting the preamble signal; otherwise, the - // equalizer taps will screw with the PLL performance - bytes = demapper(&in[0], d_bytes_out); - - if (VERBOSE) { - if(sig[0]) - printf("ERROR -- Found SYNC in HAVE_SYNC\n"); - fprintf(stderr,"Header Search bitcnt=%d, header=0x%08x\n", - d_headerbytelen_cnt, d_header); - } - - j = 0; - while(j < bytes) { - d_header = (d_header << 8) | (d_bytes_out[j] & 0xFF); - j++; - - if (++d_headerbytelen_cnt == HEADERBYTELEN) { - - if (VERBOSE) - fprintf(stderr, "got header: 0x%08x\n", d_header); - - // we have a full header, check to see if it has been received properly - if (header_ok()){ - enter_have_header(); - - if (VERBOSE) - printf("\nPacket Length: %d\n", d_packetlen); - - while((j < bytes) && (d_packetlen_cnt < d_packetlen)) { - d_packet[d_packetlen_cnt++] = d_bytes_out[j++]; - } - - if(d_packetlen_cnt == d_packetlen) { - gr_message_sptr msg = - gr_make_message(0, d_packet_whitener_offset, 0, d_packetlen); - memcpy(msg->msg(), d_packet, d_packetlen_cnt); - d_target_queue->insert_tail(msg); // send it - msg.reset(); // free it up - - enter_search(); - } - } - else { - enter_search(); // bad header - } - } - } - break; - - case STATE_HAVE_HEADER: - bytes = demapper(&in[0], d_bytes_out); - - if (VERBOSE) { - if(sig[0]) - printf("ERROR -- Found SYNC in HAVE_HEADER at %d, length of %d\n", d_packetlen_cnt, d_packetlen); - fprintf(stderr,"Packet Build\n"); - } - - j = 0; - while(j < bytes) { - d_packet[d_packetlen_cnt++] = d_bytes_out[j++]; - - if (d_packetlen_cnt == d_packetlen){ // packet is filled - // build a message - // NOTE: passing header field as arg1 is not scalable - gr_message_sptr msg = - gr_make_message(0, d_packet_whitener_offset, 0, d_packetlen_cnt); - memcpy(msg->msg(), d_packet, d_packetlen_cnt); - - d_target_queue->insert_tail(msg); // send it - msg.reset(); // free it up - - enter_search(); - break; - } - } - break; - - default: - assert(0); - - } // switch - - return 1; -} diff --git a/gnuradio-core/src/lib/general/gr_ofdm_frame_sink2.h b/gnuradio-core/src/lib/general/gr_ofdm_frame_sink2.h deleted file mode 100644 index a743e8c5a5..0000000000 --- a/gnuradio-core/src/lib/general/gr_ofdm_frame_sink2.h +++ /dev/null @@ -1,121 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007,2011 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio 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 3, or (at your option) - * any later version. - * - * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef INCLUDED_GR_OFDM_FRAME_SINK2_H -#define INCLUDED_GR_OFDM_FRAME_SINK2_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> -#include <gr_msg_queue.h> -#include <gr_constellation.h> - -class gr_ofdm_frame_sink2; -typedef boost::shared_ptr<gr_ofdm_frame_sink2> gr_ofdm_frame_sink2_sptr; - -GR_CORE_API gr_ofdm_frame_sink2_sptr -gr_make_ofdm_frame_sink2 (gr_constellation_sptr constell, - gr_msg_queue_sptr target_queue, unsigned int occupied_tones, - float phase_gain=0.25, float freq_gain=0.25*0.25/4.0); - -/*! - * \brief Takes an OFDM symbol in, demaps it into bits of 0's and 1's, packs - * them into packets, and sends to to a message queue sink. - * \ingroup sink_blk - * \ingroup ofdm_blk - * - * NOTE: The mod input parameter simply chooses a pre-defined demapper/slicer. Eventually, - * we want to be able to pass in a reference to an object to do the demapping and slicing - * for a given modulation type. - */ -class GR_CORE_API gr_ofdm_frame_sink2 : public gr_sync_block -{ - friend GR_CORE_API gr_ofdm_frame_sink2_sptr - gr_make_ofdm_frame_sink2 (gr_constellation_sptr constell, - gr_msg_queue_sptr target_queue, unsigned int occupied_tones, - float phase_gain, float freq_gain); - - private: - enum state_t {STATE_SYNC_SEARCH, STATE_HAVE_SYNC, STATE_HAVE_HEADER}; - - static const int MAX_PKT_LEN = 4096; - static const int HEADERBYTELEN = 4; - - gr_msg_queue_sptr d_target_queue; // where to send the packet when received - state_t d_state; - unsigned int d_header; // header bits - int d_headerbytelen_cnt; // how many so far - - unsigned char *d_bytes_out; // hold the current bytes produced by the demapper - - unsigned int d_occupied_carriers; - unsigned int d_byte_offset; - unsigned int d_partial_byte; - - unsigned char d_packet[MAX_PKT_LEN]; // assembled payload - int d_packetlen; // length of packet - int d_packet_whitener_offset; // offset into whitener string to use - int d_packetlen_cnt; // how many so far - - gr_complex * d_derotated_output; // Pointer to output stream to send deroated symbols out - - gr_constellation_sptr d_constell; - std::vector<gr_complex> d_dfe; - unsigned int d_nbits; - - unsigned char d_resid; - unsigned int d_nresid; - float d_phase; - float d_freq; - float d_phase_gain; - float d_freq_gain; - float d_eq_gain; - - std::vector<int> d_subcarrier_map; - - protected: - gr_ofdm_frame_sink2(gr_constellation_sptr constell, - gr_msg_queue_sptr target_queue, unsigned int occupied_tones, - float phase_gain, float freq_gain); - - void enter_search(); - void enter_have_sync(); - void enter_have_header(); - - bool header_ok() - { - // confirm that two copies of header info are identical - return ((d_header >> 16) ^ (d_header & 0xffff)) == 0; - } - - unsigned char slicer(const gr_complex x); - unsigned int demapper(const gr_complex *in, - unsigned char *out); - - public: - ~gr_ofdm_frame_sink2(); - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_GR_OFDM_FRAME_SINK2_H */ diff --git a/gnuradio-core/src/lib/general/gr_ofdm_frame_sink2.i b/gnuradio-core/src/lib/general/gr_ofdm_frame_sink2.i deleted file mode 100644 index 8c04d1e160..0000000000 --- a/gnuradio-core/src/lib/general/gr_ofdm_frame_sink2.i +++ /dev/null @@ -1,39 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007,2011 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio 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 3, or (at your option) - * any later version. - * - * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -GR_SWIG_BLOCK_MAGIC(gr,ofdm_frame_sink2); - -gr_ofdm_frame_sink2_sptr -gr_make_ofdm_frame_sink2(gr_constellation_sptr constell, - gr_msg_queue_sptr target_queue, unsigned int occupied_tones, - float phase_gain=0.25, float freq_gain=0.25*0.25/4); - -class gr_ofdm_frame_sink2 : public gr_sync_block -{ - protected: - gr_ofdm_frame_sink2(gr_constellation_sptr constell, - gr_msg_queue_sptr target_queue, unsigned int occupied_tones, - float phase_gain, float freq_gain); - - public: - ~gr_ofdm_frame_sink2(); -}; diff --git a/gnuradio-core/src/lib/general/gr_pa_2x2_phase_combiner.cc b/gnuradio-core/src/lib/general/gr_pa_2x2_phase_combiner.cc deleted file mode 100644 index 3187536726..0000000000 --- a/gnuradio-core/src/lib/general/gr_pa_2x2_phase_combiner.cc +++ /dev/null @@ -1,74 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,2010 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio 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 3, or (at your option) - * any later version. - * - * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_pa_2x2_phase_combiner.h> -#include <gr_io_signature.h> - -gr_pa_2x2_phase_combiner_sptr -gr_make_pa_2x2_phase_combiner() -{ - return gnuradio::get_initial_sptr(new gr_pa_2x2_phase_combiner()); -} - -gr_pa_2x2_phase_combiner::gr_pa_2x2_phase_combiner () - : gr_sync_block ("pa_2x2_phase_combiner", - gr_make_io_signature (1, 1, NM * sizeof (gr_complex)), - gr_make_io_signature (1, 1, sizeof (float))) -{ - set_theta(0); -} - -void -gr_pa_2x2_phase_combiner::set_theta(float theta) -{ - d_theta = theta; - gr_complex j = gr_complex(0,1); - d_phase[0] = exp(j * (float) (M_PI * (sin(theta) + cos(theta)))); - d_phase[1] = exp(j * (float) (M_PI * cos(theta))); - d_phase[2] = exp(j * (float) (M_PI * sin(theta))); - d_phase[3] = exp(j * (float) 0.0); -} - -int -gr_pa_2x2_phase_combiner::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const gr_complex *in = (const gr_complex *) input_items[0]; - gr_complex *out = (gr_complex *) output_items[0]; - - for (int i = 0; i < noutput_items; i++){ - gr_complex acc = 0; - acc += in[0] * d_phase[0]; - acc += in[1] * d_phase[1]; - acc += in[2] * d_phase[2]; - acc += in[3] * d_phase[3]; - out[i] = acc; - in += 4; - } - - return noutput_items; -} diff --git a/gnuradio-core/src/lib/general/gr_pa_2x2_phase_combiner.h b/gnuradio-core/src/lib/general/gr_pa_2x2_phase_combiner.h deleted file mode 100644 index d430d154fc..0000000000 --- a/gnuradio-core/src/lib/general/gr_pa_2x2_phase_combiner.h +++ /dev/null @@ -1,63 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio 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 3, or (at your option) - * any later version. - * - * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ -#ifndef INCLUDED_GR_PA_2X2_PHASE_COMBINER_H -#define INCLUDED_GR_PA_2X2_PHASE_COMBINER_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> - -class gr_pa_2x2_phase_combiner; -typedef boost::shared_ptr<gr_pa_2x2_phase_combiner> gr_pa_2x2_phase_combiner_sptr; - -GR_CORE_API gr_pa_2x2_phase_combiner_sptr gr_make_pa_2x2_phase_combiner (); - -/*! - * \brief pa_2x2 phase combiner - * \ingroup misc_blk - * - * Anntenas are arranged like this: - * - * 2 3 - * 0 1 - * - * dx and dy are lambda/2. - */ -class GR_CORE_API gr_pa_2x2_phase_combiner : public gr_sync_block -{ - static const int NM = 4; - - float d_theta; - gr_complex d_phase[NM]; - - gr_pa_2x2_phase_combiner (); - friend GR_CORE_API gr_pa_2x2_phase_combiner_sptr gr_make_pa_2x2_phase_combiner(); - - public: - float theta() const { return d_theta; } - void set_theta(float theta); - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_GR_PA_2X2_PHASE_COMBINER_H */ diff --git a/gnuradio-core/src/lib/general/gr_pa_2x2_phase_combiner.i b/gnuradio-core/src/lib/general/gr_pa_2x2_phase_combiner.i deleted file mode 100644 index 2cd373a5e4..0000000000 --- a/gnuradio-core/src/lib/general/gr_pa_2x2_phase_combiner.i +++ /dev/null @@ -1,34 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio 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 3, or (at your option) - * any later version. - * - * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -GR_SWIG_BLOCK_MAGIC(gr,pa_2x2_phase_combiner) - -gr_pa_2x2_phase_combiner_sptr gr_make_pa_2x2_phase_combiner(); - -class gr_pa_2x2_phase_combiner : public gr_sync_block -{ - gr_pa_2x2_phase_combiner(); - - public: - float theta() const; - void set_theta(float theta); -}; diff --git a/gnuradio-core/src/lib/filter/gr_sincos.c b/gnuradio-core/src/lib/general/gr_sincos.c index a8d01b0da4..a8d01b0da4 100644 --- a/gnuradio-core/src/lib/filter/gr_sincos.c +++ b/gnuradio-core/src/lib/general/gr_sincos.c diff --git a/gnuradio-core/src/lib/filter/gr_sincos.h b/gnuradio-core/src/lib/general/gr_sincos.h index 516f43437a..516f43437a 100644 --- a/gnuradio-core/src/lib/filter/gr_sincos.h +++ b/gnuradio-core/src/lib/general/gr_sincos.h diff --git a/gnuradio-core/src/lib/general/gr_skiphead.cc b/gnuradio-core/src/lib/general/gr_skiphead.cc deleted file mode 100644 index c93478597b..0000000000 --- a/gnuradio-core/src/lib/general/gr_skiphead.cc +++ /dev/null @@ -1,108 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,2007,2010 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio 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 3, or (at your option) - * any later version. - * - * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include <gr_skiphead.h> -#include <gr_io_signature.h> -#include <string.h> - -gr_skiphead::gr_skiphead (size_t itemsize, uint64_t nitems_to_skip) - : gr_block ("skiphead", - gr_make_io_signature(1, 1, itemsize), - gr_make_io_signature(1, 1, itemsize)), - d_nitems_to_skip(nitems_to_skip), d_nitems(0) -{ -} - -gr_skiphead_sptr -gr_make_skiphead (size_t itemsize, uint64_t nitems_to_skip) -{ - return gnuradio::get_initial_sptr(new gr_skiphead (itemsize, nitems_to_skip)); -} - -void -gr_skiphead::set_nitems_to_skip(uint64_t nitems_to_skip) -{ - d_nitems_to_skip = nitems_to_skip; - reset(); -} - -uint64_t -gr_skiphead::nitems_to_skip() const -{ - return d_nitems_to_skip; -} - -uint64_t -gr_skiphead::nitems_skiped() const -{ - return d_nitems; -} - -void -gr_skiphead::reset() -{ - d_nitems = 0; -} - -int -gr_skiphead::general_work(int noutput_items, - gr_vector_int &ninput_items_, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const char *in = (const char *) input_items[0]; - char *out = (char *) output_items[0]; - - int ninput_items = std::min(ninput_items_[0], noutput_items); - int ii = 0; // input index - - while (ii < ninput_items){ - - uint64_t ni_total = ii + d_nitems; // total items processed so far - if (ni_total < d_nitems_to_skip){ // need to skip some more - - int n_to_skip = (int) std::min(d_nitems_to_skip - ni_total, - (uint64_t)(ninput_items - ii)); - ii += n_to_skip; - } - - else { // nothing left to skip. copy away - - int n_to_copy = ninput_items - ii; - if (n_to_copy > 0){ - size_t itemsize = output_signature()->sizeof_stream_item(0); - memcpy(out, in + (ii*itemsize), n_to_copy*itemsize); - } - - d_nitems += ninput_items; - consume_each(ninput_items); - return n_to_copy; - } - } - - d_nitems += ninput_items; - consume_each(ninput_items); - return 0; -} diff --git a/gnuradio-core/src/lib/general/gr_skiphead.h b/gnuradio-core/src/lib/general/gr_skiphead.h deleted file mode 100644 index 710530ff4c..0000000000 --- a/gnuradio-core/src/lib/general/gr_skiphead.h +++ /dev/null @@ -1,80 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio 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 3, or (at your option) - * any later version. - * - * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef INCLUDED_GR_SKIPHEAD_H -#define INCLUDED_GR_SKIPHEAD_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> -#include <stddef.h> // size_t - -class gr_skiphead; -typedef boost::shared_ptr<gr_skiphead> gr_skiphead_sptr; - -GR_CORE_API gr_skiphead_sptr -gr_make_skiphead (size_t itemsize, uint64_t nitems_to_skip); - - -/*! - * \brief skips the first N items, from then on copies items to the output - * \ingroup slicedice_blk - * - * Useful for building test cases and sources which have metadata or junk at the start - */ - -class GR_CORE_API gr_skiphead : public gr_block -{ - friend GR_CORE_API gr_skiphead_sptr gr_make_skiphead (size_t itemsize, uint64_t nitems_to_skip); - gr_skiphead (size_t itemsize, uint64_t nitems_to_skip); - - uint64_t d_nitems_to_skip; - uint64_t d_nitems; // total items seen - - public: - - /*! - * \brief Sets number of items to skip; resets current skip count to 0. - */ - void set_nitems_to_skip(uint64_t nitems_to_skip); - - /*! - * \brief Gets the number of items to skip. - */ - uint64_t nitems_to_skip() const; - - /*! - * \brief Gets the number of items already skipped. - */ - uint64_t nitems_skiped() const; - - /*! - * \brief Resets number of items skipped to 0. - */ - void reset(); - - int general_work(int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_GR_SKIPHEAD_H */ diff --git a/gnuradio-core/src/lib/general/gr_skiphead.i b/gnuradio-core/src/lib/general/gr_skiphead.i deleted file mode 100644 index 8ab23a77a6..0000000000 --- a/gnuradio-core/src/lib/general/gr_skiphead.i +++ /dev/null @@ -1,35 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,2007,2010 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio 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 3, or (at your option) - * any later version. - * - * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -GR_SWIG_BLOCK_MAGIC(gr,skiphead); - -gr_skiphead_sptr gr_make_skiphead(size_t itemsize, - uint64_t nitems_to_skip); - -class gr_skiphead : public gr_block -{ -public: - void set_nitems_to_skip(uint64_t nitems_to_skip); - uint64_t nitems_to_skip() const; - uint64_t nitems_skiped() const; - void reset(); -}; diff --git a/gnuradio-core/src/lib/general/gr_vector_map.cc b/gnuradio-core/src/lib/general/gr_vector_map.cc deleted file mode 100644 index 2a13efb06d..0000000000 --- a/gnuradio-core/src/lib/general/gr_vector_map.cc +++ /dev/null @@ -1,117 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2012 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio 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 3, or (at your option) - * any later version. - * - * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_vector_map.h> -#include <gr_io_signature.h> -#include <string.h> - -std::vector<int> -get_in_sizeofs(size_t item_size, std::vector<size_t> in_vlens) -{ - std::vector<int> in_sizeofs; - for(unsigned int i = 0; i < in_vlens.size(); i++) { - in_sizeofs.push_back(in_vlens[i]*item_size); - } - return in_sizeofs; -} - -std::vector<int> -get_out_sizeofs(size_t item_size, - std::vector< std::vector< std::vector<size_t> > > mapping) -{ - std::vector<int> out_sizeofs; - for(unsigned int i = 0; i < mapping.size(); i++) { - out_sizeofs.push_back(mapping[i].size()*item_size); - } - return out_sizeofs; -} - -gr_vector_map_sptr -gr_make_vector_map (size_t item_size, std::vector<size_t> in_vlens, - std::vector< std::vector< std::vector<size_t> > > mapping) -{ - return gnuradio::get_initial_sptr(new gr_vector_map(item_size, - in_vlens, - mapping)); -} - -gr_vector_map::gr_vector_map(size_t item_size, std::vector<size_t> in_vlens, - std::vector< std::vector< std::vector<size_t> > > mapping) - : gr_sync_block("vector_map", - gr_make_io_signaturev(in_vlens.size(), in_vlens.size(), - get_in_sizeofs(item_size, in_vlens)), - gr_make_io_signaturev(mapping.size(), mapping.size(), - get_out_sizeofs(item_size, mapping))), - d_item_size(item_size), d_in_vlens(in_vlens) -{ - set_mapping(mapping); -} - -void -gr_vector_map::set_mapping(std::vector< std::vector< std::vector<size_t> > > mapping) { - // Make sure the contents of the mapping vectors are possible. - for(unsigned int i=0; i<mapping.size(); i++) { - for(unsigned int j=0; j<mapping[i].size(); j++) { - if(mapping[i][j].size() != 2) { - throw std::runtime_error("Mapping must be of the form (out_mapping_stream1, out_mapping_stream2, ...), where out_mapping_stream1 is of the form (mapping_element1, mapping_element2, ...), where mapping_element1 is of the form (input_stream, input_element). This error is raised because a mapping_element vector does not contain exactly 2 items."); - } - unsigned int s = mapping[i][j][0]; - unsigned int index = mapping[i][j][1]; - if(s >= d_in_vlens.size()) { - throw std::runtime_error("Stream numbers in mapping must be less than the number of input streams."); - } - if((index < 0) || (index >= d_in_vlens[s])) { - throw std::runtime_error ("Indices in mapping must be greater than 0 and less than the input vector lengths."); - } - } - } - gruel::scoped_lock guard(d_mutex); - d_mapping = mapping; -} - -int -gr_vector_map::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const char **inv = (const char **) &input_items[0]; - char **outv = (char **) &output_items[0]; - - for(unsigned int n = 0; n < (unsigned int)(noutput_items); n++) { - for(unsigned int i = 0; i < d_mapping.size(); i++) { - unsigned int out_vlen = d_mapping[i].size(); - for(unsigned int j = 0; j < out_vlen; j++) { - unsigned int s = d_mapping[i][j][0]; - unsigned int k = d_mapping[i][j][1]; - memcpy(outv[i] + out_vlen*d_item_size*n + - d_item_size*j, inv[s] + d_in_vlens[s]*d_item_size*n + - k*d_item_size, d_item_size); - } - } - } - - return noutput_items; -} diff --git a/gnuradio-core/src/lib/general/gr_vector_map.h b/gnuradio-core/src/lib/general/gr_vector_map.h deleted file mode 100644 index f5492b1e3a..0000000000 --- a/gnuradio-core/src/lib/general/gr_vector_map.h +++ /dev/null @@ -1,83 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2012 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio 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 3, or (at your option) - * any later version. - * - * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef INCLUDED_GR_VECTOR_MAP_H -#define INCLUDED_GR_VECTOR_MAP_H - -#include <vector> -#include <gr_core_api.h> -#include <gr_sync_interpolator.h> -#include <gruel/thread.h> - -class gr_vector_map; -typedef boost::shared_ptr<gr_vector_map> gr_vector_map_sptr; - -GR_CORE_API gr_vector_map_sptr -gr_make_vector_map (size_t item_size, std::vector<size_t> in_vlens, - std::vector< std::vector< std::vector<size_t> > > mapping); - -/*! - * \brief Maps elements from a set of input vectors to a set of output vectors. - * - * If in[i] is the input vector in the i'th stream then the output - * vector in the j'th stream is: - * - * out[j][k] = in[mapping[j][k][0]][mapping[j][k][1]] - * - * That is mapping is of the form (out_stream1_mapping, - * out_stream2_mapping, ...) and out_stream1_mapping is of the form - * (element1_mapping, element2_mapping, ...) and element1_mapping is - * of the form (in_stream, in_element). - * - * \param item_size (integer) size of vector elements - * - * \param in_vlens (vector of integers) number of elements in each - * input vector - * - * \param mapping (vector of vectors of vectors of integers) how to - * map elements from input to output vectors - * - * \ingroup slicedice_blk - */ -class GR_CORE_API gr_vector_map : public gr_sync_block -{ - friend GR_CORE_API gr_vector_map_sptr - gr_make_vector_map(size_t item_size, std::vector<size_t> in_vlens, - std::vector< std::vector< std::vector<size_t> > > mapping); - size_t d_item_size; - std::vector<size_t> d_in_vlens; - std::vector< std::vector< std::vector<size_t> > > d_mapping; - gruel::mutex d_mutex; // mutex to protect set/work access - - protected: - gr_vector_map(size_t item_size, std::vector<size_t> in_vlens, - std::vector< std::vector< std::vector<size_t> > > mapping); - - public: - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - void set_mapping(std::vector< std::vector< std::vector<size_t> > > mapping); -}; - -#endif /* INCLUDED_GR_VECTOR_MAP_H */ diff --git a/gnuradio-core/src/lib/general/gr_vector_map.i b/gnuradio-core/src/lib/general/gr_vector_map.i deleted file mode 100644 index e9fa3f27e5..0000000000 --- a/gnuradio-core/src/lib/general/gr_vector_map.i +++ /dev/null @@ -1,28 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2012 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio 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 3, or (at your option) - * any later version. - * - * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -GR_SWIG_BLOCK_MAGIC(gr, vector_map); - -%template() std::vector<size_t>; -%template() std::vector< std::vector< std::vector<size_t> > >; - -%include "gr_vector_map.h" diff --git a/gnuradio-core/src/lib/general/qa_general.cc b/gnuradio-core/src/lib/general/qa_general.cc index e2328c2cb2..0fce7d2379 100644 --- a/gnuradio-core/src/lib/general/qa_general.cc +++ b/gnuradio-core/src/lib/general/qa_general.cc @@ -28,6 +28,7 @@ #include <qa_general.h> #include <qa_gr_circular_file.h> #include <qa_gr_math.h> +#include <qa_sincos.h> CppUnit::TestSuite * qa_general::suite () @@ -36,6 +37,7 @@ qa_general::suite () s->addTest (qa_gr_circular_file::suite ()); s->addTest (qa_gr_math::suite ()); + s->addTest(gr::analog::qa_sincos::suite()); return s; } diff --git a/gr-analog/lib/qa_sincos.cc b/gnuradio-core/src/lib/general/qa_sincos.cc index 62642c1171..0066ff6b92 100644 --- a/gr-analog/lib/qa_sincos.cc +++ b/gnuradio-core/src/lib/general/qa_sincos.cc @@ -25,7 +25,7 @@ #endif #include <qa_sincos.h> -#include <analog/sincos.h> +#include <gr_sincos.h> #include <gruel/attributes.h> #include <cppunit/TestAssert.h> #include <cmath> @@ -45,7 +45,7 @@ namespace gr { c_sin = sin(x); c_cos = cos(x); - analog::sincos(x, &gr_sin, &gr_cos); + gr_sincos(x, &gr_sin, &gr_cos); CPPUNIT_ASSERT_DOUBLES_EQUAL(c_sin, gr_sin, 0.0001); CPPUNIT_ASSERT_DOUBLES_EQUAL(c_cos, gr_cos, 0.0001); @@ -64,7 +64,7 @@ namespace gr { c_sin = sinf(x); c_cos = cosf(x); - analog::sincosf(x, &gr_sin, &gr_cos); + gr_sincosf(x, &gr_sin, &gr_cos); CPPUNIT_ASSERT_DOUBLES_EQUAL(c_sin, gr_sin, 0.0001); CPPUNIT_ASSERT_DOUBLES_EQUAL(c_cos, gr_cos, 0.0001); diff --git a/gr-analog/lib/qa_sincos.h b/gnuradio-core/src/lib/general/qa_sincos.h index f18e879dd8..f18e879dd8 100644 --- a/gr-analog/lib/qa_sincos.h +++ b/gnuradio-core/src/lib/general/qa_sincos.h diff --git a/gnuradio-core/src/lib/gengen/CMakeLists.txt b/gnuradio-core/src/lib/gengen/CMakeLists.txt deleted file mode 100644 index 45834ced5f..0000000000 --- a/gnuradio-core/src/lib/gengen/CMakeLists.txt +++ /dev/null @@ -1,143 +0,0 @@ -# Copyright 2010-2011 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio 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 3, or (at your option) -# any later version. -# -# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. - -######################################################################## -# This file included, use CMake directory variables -######################################################################## -include(GrPython) - -######################################################################## -# generate the python helper script which calls into the build utils -######################################################################## -file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py " -#!${PYTHON_EXECUTABLE} - -import sys, os, re -sys.path.append('${GR_CORE_PYTHONPATH}') -os.environ['srcdir'] = '${CMAKE_CURRENT_SOURCE_DIR}' -os.chdir('${CMAKE_CURRENT_BINARY_DIR}') - -if __name__ == '__main__': - import build_utils - root, inp = sys.argv[1:3] - for sig in sys.argv[3:]: - name = re.sub ('X+', sig, root) - d = build_utils.standard_dict(name, sig) - build_utils.expand_template(d, inp) - -") - -######################################################################## -# generation helper macro to generate various files from template -######################################################################## -macro(expand_h_cc_i root) - - foreach(ext h cc i) - #make a list of all the generated files - unset(expanded_files_${ext}) - foreach(sig ${ARGN}) - string(REGEX REPLACE "X+" ${sig} name ${root}) - list(APPEND expanded_files_${ext} ${CMAKE_CURRENT_BINARY_DIR}/${name}.${ext}) - endforeach(sig) - - #create a command to generate the files - add_custom_command( - OUTPUT ${expanded_files_${ext}} - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${root}.${ext}.t - COMMAND ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B} - ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py - ${root} ${root}.${ext}.t ${ARGN} - ) - endforeach(ext) - - #make source files depends on headers to force generation - set_source_files_properties(${expanded_files_cc} - PROPERTIES OBJECT_DEPENDS "${expanded_files_h}" - ) - - #install rules for the generated cc, h, and i files - list(APPEND generated_gengen_sources ${expanded_files_cc}) - list(APPEND generated_gengen_includes ${expanded_files_h}) - list(APPEND generated_gengen_swigs ${expanded_files_i}) - -endmacro(expand_h_cc_i) - -######################################################################## -# Invoke macro to generate various sources -######################################################################## -expand_h_cc_i(gr_vector_source_X b s i f c) -expand_h_cc_i(gr_vector_insert_X b) -expand_h_cc_i(gr_vector_sink_X b s i f c) - -add_custom_target(gengen_generated DEPENDS - ${generated_gengen_includes} - ${generated_gengen_swigs} -) - -######################################################################## -# Create the master gengen swig include files -######################################################################## -set(generated_index ${CMAKE_CURRENT_BINARY_DIR}/gengen_generated.i.in) -file(WRITE ${generated_index} " -// -// This file is machine generated. All edits will be overwritten -// -") - -file(APPEND ${generated_index} "%{\n") -foreach(swig_file ${generated_gengen_swigs}) - get_filename_component(name ${swig_file} NAME_WE) - file(APPEND ${generated_index} "#include<${name}.h>\n") -endforeach(swig_file) -file(APPEND ${generated_index} "%}\n") - -foreach(swig_file ${generated_gengen_swigs}) - get_filename_component(name ${swig_file} NAME) - file(APPEND ${generated_index} "%include<${name}>\n") -endforeach(swig_file) - -execute_process( - COMMAND ${CMAKE_COMMAND} -E copy_if_different - ${generated_index} ${CMAKE_CURRENT_BINARY_DIR}/gengen_generated.i -) - -######################################################################## -# Handle the generated sources + a few non-generated ones -######################################################################## -list(APPEND gnuradio_core_sources - ${generated_gengen_sources} -) - -install(FILES - ${generated_gengen_includes} - ${CMAKE_CURRENT_SOURCE_DIR}/gr_endianness.h - DESTINATION ${GR_INCLUDE_DIR}/gnuradio - COMPONENT "core_devel" -) - -if(ENABLE_PYTHON) - install(FILES - ${generated_gengen_swigs} - ${CMAKE_CURRENT_SOURCE_DIR}/gr_endianness.i - ${CMAKE_CURRENT_SOURCE_DIR}/gengen.i - ${CMAKE_CURRENT_BINARY_DIR}/gengen_generated.i - DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig - COMPONENT "core_swig" - ) -endif(ENABLE_PYTHON) diff --git a/gnuradio-core/src/lib/gengen/generate_common.py b/gnuradio-core/src/lib/gengen/generate_common.py deleted file mode 100755 index 68913f9a75..0000000000 --- a/gnuradio-core/src/lib/gengen/generate_common.py +++ /dev/null @@ -1,60 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2004,2006,2007,2008,2009 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio 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 3, or (at your option) -# any later version. -# -# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -from build_utils import expand_template, standard_dict -from build_utils_codes import * - -import re - - -# sources and sinks -ss_signatures = ['s', 'i', 'f', 'c'] - -ss_roots = [ - 'gr_vector_source_X', - 'gr_vector_sink_X', - ] - -# regular blocks -reg_signatures = ['ss', 'ii', 'ff', 'cc'] - - -def expand_h_cc_i (root, sig): - # root looks like 'gr_vector_sink_X' - name = re.sub ('X+', sig, root) - d = standard_dict (name, sig) - expand_template (d, root + '.h.t') - expand_template (d, root + '.cc.t') - expand_template (d, root + '.i.t') - - -def generate (): - expand_h_cc_i ('gr_vector_sink_X', 'b') - expand_h_cc_i ('gr_vector_source_X', 'b') - for r in ss_roots: - for s in ss_signatures: - expand_h_cc_i (r, s) - -if __name__ == '__main__': - generate () - - diff --git a/gnuradio-core/src/lib/gengen/gengen.i b/gnuradio-core/src/lib/gengen/gengen.i deleted file mode 100644 index 7d8c27fe68..0000000000 --- a/gnuradio-core/src/lib/gengen/gengen.i +++ /dev/null @@ -1,29 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2009 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio 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 3, or (at your option) - * any later version. - * - * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -%{ -#include "gr_endianness.h" -%} - -%include "gr_endianness.i" - -%include "gengen_generated.i" diff --git a/gnuradio-core/src/lib/gengen/gr_endianness.i b/gnuradio-core/src/lib/gengen/gr_endianness.i deleted file mode 100644 index 572b7a42fb..0000000000 --- a/gnuradio-core/src/lib/gengen/gr_endianness.i +++ /dev/null @@ -1,23 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio 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 3, or (at your option) - * any later version. - * - * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -%include <gr_endianness.h> diff --git a/gnuradio-core/src/lib/gengen/gr_vector_insert_X.cc.t b/gnuradio-core/src/lib/gengen/gr_vector_insert_X.cc.t deleted file mode 100644 index 20968afe22..0000000000 --- a/gnuradio-core/src/lib/gengen/gr_vector_insert_X.cc.t +++ /dev/null @@ -1,100 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2012 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio 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 3, or (at your option) - * any later version. - * - * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -// @WARNING@ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include <@NAME@.h> -#include <algorithm> -#include <gr_io_signature.h> -#include <stdexcept> - -#include <stdio.h> - -@NAME@::@NAME@(const std::vector<@TYPE@> &data, int periodicity, int offset) - : gr_block("@BASE_NAME@", - gr_make_io_signature (1, 1, sizeof(@TYPE@)), - gr_make_io_signature (1, 1, sizeof(@TYPE@))), - d_data(data), - d_offset(offset), - d_periodicity(periodicity) -{ - //printf("INITIAL: periodicity = %d, offset = %d\n", periodicity, offset); - // some sanity checks - assert(offset < periodicity); - assert(offset >= 0); - assert((size_t)periodicity > data.size()); -} - -int -@NAME@::general_work(int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - @TYPE@ *out = (@TYPE@ *)output_items[0]; - const @TYPE@ *in = (const @TYPE@ *)input_items[0]; - - int ii(0), oo(0); - - while((oo < noutput_items) && (ii < ninput_items[0])) { - - //printf("oo = %d, ii = %d, d_offset = %d, noutput_items = %d, ninput_items[0] = %d", oo, ii, d_offset, noutput_items, ninput_items[0]); - //printf(", d_periodicity = %d\n", d_periodicity); - - if(d_offset >= ((int)d_data.size())) { // if we are in the copy region - int max_copy = std::min( std::min( noutput_items - oo, ninput_items[0] - ii ), d_periodicity - d_offset ); - //printf("copy %d from input\n", max_copy); - memcpy( &out[oo], &in[ii], sizeof(@TYPE@)*max_copy ); - //printf(" * memcpy returned.\n"); - ii += max_copy; - oo += max_copy; - d_offset = (d_offset + max_copy)%d_periodicity; - - } - else { // if we are in the insertion region - int max_copy = std::min( noutput_items - oo, ((int)d_data.size()) - d_offset ); - //printf("copy %d from d_data[%d] to out[%d]\n", max_copy, d_offset, oo); - memcpy( &out[oo], &d_data[d_offset], sizeof(@TYPE@)*max_copy ); - //printf(" * memcpy returned.\n"); - oo += max_copy; - d_offset = (d_offset + max_copy)%d_periodicity; - //printf(" ## (inelse) oo = %d, d_offset = %d\n", oo, d_offset); - } - - //printf(" # exit else, on to next loop.\n"); - } - //printf(" # got out of loop\n"); - - //printf("consume = %d, produce = %d\n", ii, oo); - consume_each(ii); - return oo; -} - -@NAME@_sptr -gr_make_@BASE_NAME@ (const std::vector<@TYPE@> &data, int periodicity, int offset) -{ - return gnuradio::get_initial_sptr(new @NAME@ (data, periodicity, offset)); -} - diff --git a/gnuradio-core/src/lib/gengen/gr_vector_insert_X.h.t b/gnuradio-core/src/lib/gengen/gr_vector_insert_X.h.t deleted file mode 100644 index 26f851700d..0000000000 --- a/gnuradio-core/src/lib/gengen/gr_vector_insert_X.h.t +++ /dev/null @@ -1,61 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2012 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio 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 3, or (at your option) - * any later version. - * - * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -// @WARNING@ - -#ifndef @GUARD_NAME@ -#define @GUARD_NAME@ - -#include <gr_core_api.h> -#include <gr_block.h> - -class GR_CORE_API @NAME@; -typedef boost::shared_ptr<@NAME@> @NAME@_sptr; - -/*! - * \brief source of @TYPE@'s that gets its data from a vector - * \ingroup source_blk - */ - -class @NAME@ : public gr_block { - friend GR_CORE_API @NAME@_sptr - gr_make_@BASE_NAME@(const std::vector<@TYPE@> &data, int periodicity, int offset); - - std::vector<@TYPE@> d_data; - int d_offset; - int d_periodicity; - - @NAME@(const std::vector<@TYPE@> &data, int periodicity, int offset); - - public: - void rewind() {d_offset=0;} - virtual int general_work(int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - void set_data(const std::vector<@TYPE@> &data){ d_data = data; rewind(); } -}; - -GR_CORE_API @NAME@_sptr -gr_make_@BASE_NAME@(const std::vector<@TYPE@> &data, int periodicity, int offset=0); - -#endif diff --git a/gnuradio-core/src/lib/gengen/gr_vector_sink_X.cc.t b/gnuradio-core/src/lib/gengen/gr_vector_sink_X.cc.t deleted file mode 100644 index 2b8207c027..0000000000 --- a/gnuradio-core/src/lib/gengen/gr_vector_sink_X.cc.t +++ /dev/null @@ -1,73 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2008,2010 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio 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 3, or (at your option) - * any later version. - * - * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -// @WARNING@ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include <@NAME@.h> -#include <algorithm> -#include <gr_io_signature.h> -#include <iostream> - - -@NAME@::@NAME@ (int vlen) - : gr_sync_block ("@BASE_NAME@", - gr_make_io_signature (1, 1, sizeof (@TYPE@) * vlen), - gr_make_io_signature (0, 0, 0)), - d_vlen(vlen) -{ -} - -int -@NAME@::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - @TYPE@ *iptr = (@TYPE@ *) input_items[0]; - for (int i = 0; i < noutput_items * d_vlen; i++) - d_data.push_back (iptr[i]); - std::vector<gr_tag_t> tags; - get_tags_in_range(tags, 0, nitems_read(0), nitems_read(0) + noutput_items); - d_tags.insert(d_tags.end(), tags.begin(), tags.end()); - return noutput_items; -} - - -@NAME@_sptr -gr_make_@BASE_NAME@ (int vlen) -{ - return gnuradio::get_initial_sptr(new @NAME@ (vlen)); -} - -std::vector<@TYPE@> -@NAME@::data () const -{ - return d_data; -} - -std::vector<gr_tag_t> -@NAME@::tags () const -{ - return d_tags; -} diff --git a/gnuradio-core/src/lib/gengen/gr_vector_source_X.cc.t b/gnuradio-core/src/lib/gengen/gr_vector_source_X.cc.t deleted file mode 100644 index 19272ee24b..0000000000 --- a/gnuradio-core/src/lib/gengen/gr_vector_source_X.cc.t +++ /dev/null @@ -1,124 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2008,2010 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio 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 3, or (at your option) - * any later version. - * - * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -// @WARNING@ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include <@NAME@.h> -#include <algorithm> -#include <gr_io_signature.h> -#include <stdexcept> - -@NAME@::@NAME@ (const std::vector<@TYPE@> &data, bool repeat, int vlen, const std::vector<gr_tag_t> &tags) - : gr_sync_block ("@BASE_NAME@", - gr_make_io_signature (0, 0, 0), - gr_make_io_signature (1, 1, sizeof (@TYPE@) * vlen)), - d_data (data), - d_repeat (repeat), - d_offset (0), - d_vlen (vlen), - d_tags (tags), - d_tagpos (0) -{ - if (tags.size() == 0) { - d_settags = 0; - } else { - d_settags = 1; - set_output_multiple(data.size() / vlen); - } - if ((data.size() % vlen) != 0) - throw std::invalid_argument("data length must be a multiple of vlen"); -} - -void -@NAME@::set_data (const std::vector<@TYPE@> &data, const std::vector<gr_tag_t> &tags){ - d_data = data; - d_tags = tags; - rewind(); - if (tags.size() == 0) { - d_settags = false; - } else { - d_settags = true; - } -} - -int -@NAME@::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - @TYPE@ *optr = (@TYPE@ *) output_items[0]; - - if (d_repeat){ - unsigned int size = d_data.size (); - unsigned int offset = d_offset; - if (size == 0) - return -1; - - if (d_settags) { - int n_outputitems_per_vector = d_data.size() / d_vlen; - for (int i = 0; i < noutput_items; i += n_outputitems_per_vector) { - // FIXME do proper vector copy - memcpy((void *) optr, (const void *) &d_data[0], size * sizeof (@TYPE@)); - optr += size; - for (unsigned t = 0; t < d_tags.size(); t++) { - add_item_tag(0, nitems_written(0)+i+d_tags[t].offset, d_tags[t].key, d_tags[t].value); - } - } - } else { - for (int i = 0; i < noutput_items*d_vlen; i++){ - optr[i] = d_data[offset++]; - if (offset >= size) { - offset = 0; - } - } - } - - - d_offset = offset; - return noutput_items; - } else { - if (d_offset >= d_data.size ()) - return -1; // Done! - - unsigned n = std::min ((unsigned) d_data.size () - d_offset, - (unsigned) noutput_items*d_vlen); - for (unsigned i = 0; i < n; i++) { - optr[i] = d_data[d_offset + i]; - } - for (unsigned t = 0; t < d_tags.size(); t++) { - if ((d_tags[t].offset >= d_offset) && (d_tags[t].offset < d_offset+n)) - add_item_tag(0, d_tags[t].offset, d_tags[t].key, d_tags[t].value); - } - d_offset += n; - return n/d_vlen; - } -} - -@NAME@_sptr -gr_make_@BASE_NAME@ (const std::vector<@TYPE@> &data, bool repeat, int vlen, const std::vector<gr_tag_t> &tags) -{ - return gnuradio::get_initial_sptr(new @NAME@ (data, repeat, vlen, tags)); -} - diff --git a/gnuradio-core/src/lib/gengen/gr_vector_source_X.h.t b/gnuradio-core/src/lib/gengen/gr_vector_source_X.h.t deleted file mode 100644 index 041cc47a45..0000000000 --- a/gnuradio-core/src/lib/gengen/gr_vector_source_X.h.t +++ /dev/null @@ -1,64 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2008,2012 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio 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 3, or (at your option) - * any later version. - * - * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -// @WARNING@ - -#ifndef @GUARD_NAME@ -#define @GUARD_NAME@ - -#include <gr_core_api.h> -#include <gr_sync_block.h> - -class GR_CORE_API @NAME@; -typedef boost::shared_ptr<@NAME@> @NAME@_sptr; - -/*! - * \brief source of @TYPE@'s that gets its data from a vector - * \ingroup source_blk - */ - -class @NAME@ : public gr_sync_block { - friend GR_CORE_API @NAME@_sptr - gr_make_@BASE_NAME@ (const std::vector<@TYPE@> &data, bool repeat, int vlen, const std::vector<gr_tag_t> &tags); - - std::vector<@TYPE@> d_data; - bool d_repeat; - unsigned int d_offset; - int d_vlen; - bool d_settags; - std::vector<gr_tag_t> d_tags; - unsigned int d_tagpos; - - @NAME@ (const std::vector<@TYPE@> &data, bool repeat, int vlen, const std::vector<gr_tag_t> &tags); - - public: - void rewind() {d_offset=0;} - virtual int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - void set_data(const std::vector<@TYPE@> &data, const std::vector<gr_tag_t> &tags = std::vector<gr_tag_t>()); -}; - -GR_CORE_API @NAME@_sptr -gr_make_@BASE_NAME@ (const std::vector<@TYPE@> &data, bool repeat = false, int vlen = 1, const std::vector<gr_tag_t> &tags = std::vector<gr_tag_t>()); - -#endif diff --git a/gnuradio-core/src/lib/gengen/gr_vector_source_X.i.t b/gnuradio-core/src/lib/gengen/gr_vector_source_X.i.t deleted file mode 100644 index 1f1479f947..0000000000 --- a/gnuradio-core/src/lib/gengen/gr_vector_source_X.i.t +++ /dev/null @@ -1,37 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2008,2012 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio 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 3, or (at your option) - * any later version. - * - * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -// @WARNING@ - -GR_SWIG_BLOCK_MAGIC(gr,@BASE_NAME@); - -@NAME@_sptr -gr_make_@BASE_NAME@ (const std::vector<@TYPE@> &data, bool repeat = false, int vlen = 1, const std::vector<gr_tag_t> &tags=std::vector<gr_tag_t>()) - throw(std::invalid_argument); - -class @NAME@ : public gr_sync_block { - public: - void rewind(); - void set_data(const std::vector<@TYPE@> &data, const std::vector<gr_tag_t> &tags = std::vector<gr_tag_t>()); - private: - @NAME@ (const std::vector<@TYPE@> &data, bool repeat, int vlen, const std::vector<gr_tag_t> &tags); -}; diff --git a/gnuradio-core/src/lib/io/CMakeLists.txt b/gnuradio-core/src/lib/io/CMakeLists.txt index 7aeea798cd..ee8e9befa5 100644 --- a/gnuradio-core/src/lib/io/CMakeLists.txt +++ b/gnuradio-core/src/lib/io/CMakeLists.txt @@ -29,14 +29,6 @@ list(APPEND gnuradio_core_sources ${CMAKE_CURRENT_SOURCE_DIR}/gr_oscope_guts.cc ${CMAKE_CURRENT_SOURCE_DIR}/gr_oscope_sink_f.cc ${CMAKE_CURRENT_SOURCE_DIR}/gr_oscope_sink_x.cc - ${CMAKE_CURRENT_SOURCE_DIR}/i2c.cc - ${CMAKE_CURRENT_SOURCE_DIR}/i2c_bitbang.cc - ${CMAKE_CURRENT_SOURCE_DIR}/i2c_bbio.cc - ${CMAKE_CURRENT_SOURCE_DIR}/i2c_bbio_pp.cc - ${CMAKE_CURRENT_SOURCE_DIR}/microtune_4702.cc - ${CMAKE_CURRENT_SOURCE_DIR}/microtune_4937.cc - ${CMAKE_CURRENT_SOURCE_DIR}/microtune_xxxx.cc - ${CMAKE_CURRENT_SOURCE_DIR}/ppio_ppdev.cc ) ######################################################################## @@ -48,15 +40,6 @@ install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/gr_oscope_sink_f.h ${CMAKE_CURRENT_SOURCE_DIR}/gr_oscope_sink_x.h ${CMAKE_CURRENT_SOURCE_DIR}/gr_trigger_mode.h - ${CMAKE_CURRENT_SOURCE_DIR}/i2c.h - ${CMAKE_CURRENT_SOURCE_DIR}/i2c_bitbang.h - ${CMAKE_CURRENT_SOURCE_DIR}/i2c_bbio.h - ${CMAKE_CURRENT_SOURCE_DIR}/i2c_bbio_pp.h - ${CMAKE_CURRENT_SOURCE_DIR}/microtune_4702.h - ${CMAKE_CURRENT_SOURCE_DIR}/microtune_4937.h - ${CMAKE_CURRENT_SOURCE_DIR}/microtune_eval_board_defs.h - ${CMAKE_CURRENT_SOURCE_DIR}/microtune_xxxx.h - ${CMAKE_CURRENT_SOURCE_DIR}/ppio_ppdev.h DESTINATION ${GR_INCLUDE_DIR}/gnuradio COMPONENT "core_devel" ) @@ -73,22 +56,3 @@ install(FILES COMPONENT "core_swig" ) endif(ENABLE_PYTHON) - -######################################################################## -# Handle triple-threat files that have cc, h, and i -######################################################################## -set(gr_core_io_triple_threats - microtune_xxxx_eval_board - microtune_4702_eval_board - microtune_4937_eval_board - ppio - sdr_1000 -) - -foreach(file_tt ${gr_core_io_triple_threats}) - list(APPEND gnuradio_core_sources ${CMAKE_CURRENT_SOURCE_DIR}/${file_tt}.cc) - install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${file_tt}.h DESTINATION ${GR_INCLUDE_DIR}/gnuradio COMPONENT "core_devel") - if(ENABLE_PYTHON) - install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${file_tt}.i DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig COMPONENT "core_swig") - endif(ENABLE_PYTHON) -endforeach(file_tt ${gr_core_io_triple_threats}) diff --git a/gnuradio-core/src/lib/io/i2c.cc b/gnuradio-core/src/lib/io/i2c.cc deleted file mode 100644 index 02dd47b53e..0000000000 --- a/gnuradio-core/src/lib/io/i2c.cc +++ /dev/null @@ -1,28 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2001,2004 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio 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 3, or (at your option) - * any later version. - * - * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#include "i2c.h" - -i2c::~i2c () -{ - // NOP -} diff --git a/gnuradio-core/src/lib/io/i2c_bbio.cc b/gnuradio-core/src/lib/io/i2c_bbio.cc deleted file mode 100644 index ddd00290d0..0000000000 --- a/gnuradio-core/src/lib/io/i2c_bbio.cc +++ /dev/null @@ -1,29 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2001,2004 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio 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 3, or (at your option) - * any later version. - * - * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#include "i2c_bbio.h" - -i2c_bbio::~i2c_bbio () -{ - // NOP -} - diff --git a/gnuradio-core/src/lib/io/i2c_bbio_pp.cc b/gnuradio-core/src/lib/io/i2c_bbio_pp.cc deleted file mode 100644 index 382bb6b378..0000000000 --- a/gnuradio-core/src/lib/io/i2c_bbio_pp.cc +++ /dev/null @@ -1,87 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2001,2004 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio 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 3, or (at your option) - * any later version. - * - * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#include "i2c_bbio_pp.h" -#include "microtune_eval_board_defs.h" - -i2c_bbio_pp::i2c_bbio_pp (ppio_sptr pp) -{ - d_pp = pp; - d_pp->lock (); - d_pp->write_control (d_pp->read_control () & ~UT_CP_MUST_BE_ZERO); // output, no interrupts - d_pp->unlock (); -} - -i2c_bbio_sptr -make_i2c_bbio_pp (ppio_sptr pp) -{ - return i2c_bbio_sptr (new i2c_bbio_pp (pp)); -} - -void -i2c_bbio_pp::set_scl (bool state) -{ - int r = d_pp->read_control(); - - if (!state){ // active low - d_pp->write_control (r | UT_CP_TUNER_SCL); - } - else { - d_pp->write_control (r & ~UT_CP_TUNER_SCL); - } - d_pp->read_control (); // use for 1us delay - d_pp->read_control (); // use for 1us delay -} - -void -i2c_bbio_pp::set_sda (bool state) -{ - int r = d_pp->read_data (); - - if (!state){ // active low - d_pp->write_data (r | UT_DP_TUNER_SDA_OUT); - } - else { - d_pp->write_data (r & ~UT_DP_TUNER_SDA_OUT); - } - d_pp->read_data (); // use for 1us delay - d_pp->read_data (); // use for 1us delay -} - -bool -i2c_bbio_pp::get_sda () -{ - int r = d_pp->read_status (); - return (r & UT_SP_TUNER_SDA_IN) == 0; // eval board has an inverter on it -} - -void -i2c_bbio_pp::lock () -{ - d_pp->lock (); -} - -void -i2c_bbio_pp::unlock () -{ - d_pp->unlock (); -} diff --git a/gnuradio-core/src/lib/io/i2c_bbio_pp.h b/gnuradio-core/src/lib/io/i2c_bbio_pp.h deleted file mode 100644 index 2391bc1fc0..0000000000 --- a/gnuradio-core/src/lib/io/i2c_bbio_pp.h +++ /dev/null @@ -1,57 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2001,2004 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio 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 3, or (at your option) - * any later version. - * - * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef INCLUDED_I2C_BBIO_PP_H -#define INCLUDED_I2C_BBIO_PP_H - -#include <gr_core_api.h> -#include "i2c_bbio.h" -#include "ppio.h" - -/*! - * \brief concrete class that bit bangs eval board i2c bus using parallel port - * - * \ingroup base - * This class talks to the i2c bus on the microtune eval board using - * the parallel port. This works for both the 4937 and 4702 boards. - */ -class GR_CORE_API i2c_bbio_pp : public i2c_bbio { - friend GR_CORE_API i2c_bbio_sptr make_i2c_bbio_pp (ppio_sptr pp); - i2c_bbio_pp (ppio_sptr pp); - - public: - - virtual void set_scl (bool state); - virtual void set_sda (bool state); - virtual bool get_sda (); - - virtual void lock (); - virtual void unlock (); - - private: - ppio_sptr d_pp; -}; - -GR_CORE_API i2c_bbio_sptr make_i2c_bbio_pp (ppio_sptr pp); - - -#endif /* INCLUDED_I2C_BBIO_PP_H */ diff --git a/gnuradio-core/src/lib/io/i2c_bitbang.cc b/gnuradio-core/src/lib/io/i2c_bitbang.cc deleted file mode 100644 index eb801c68f5..0000000000 --- a/gnuradio-core/src/lib/io/i2c_bitbang.cc +++ /dev/null @@ -1,144 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2001,2004 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio 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 3, or (at your option) - * any later version. - * - * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#include "i2c_bitbang.h" - -i2c_bitbang::i2c_bitbang (i2c_bbio_sptr io) -{ - d_io = io; - d_io->lock (); - - stop (); // get bus in known state - - d_io->unlock (); -} - -i2c_sptr -make_i2c_bitbang (i2c_bbio_sptr io) -{ - return i2c_sptr (new i2c_bitbang (io)); -} - - -// start: -// entry: SCL = 1, SDA = 1 -// exit: SCL = 0, SDA = 0 - -void -i2c_bitbang::start () -{ - set_sda (1); - set_scl (1); - set_sda (0); // SDA high -> low while SCL high - set_scl (0); -} - - -// stop: -// entry: SCL = X, SDA = X -// exit: SCL = 1, SDA = 1 - -void -i2c_bitbang::stop () -{ - set_scl (0); - set_sda (0); - set_scl (1); - set_sda (1); // SDA low -> high while SCL high -} - - -// write_bit: -// entry: SCL = 0, SDA = X -// exit: SCL = 0, SDA = X - -void -i2c_bitbang::write_bit (bool bit) -{ - set_sda (bit); - set_scl (1); - set_scl (0); -} - - -// write_byte: -// entry: SCL = 0, SDA = X -// exit: SCL = 0, SDA = 1 - -bool -i2c_bitbang::write_byte (char t) -{ - int i; - bool ack_bit; - - for (i = 0; i < 8; i++){ - write_bit (t & 0x80); - t <<= 1; - } - - // clock #9. This is the ACK bit. - - set_sda (1); // tristate SDA - set_scl (1); - ack_bit = get_sda (); // slave should pull SDA line low - set_scl (0); - - return ack_bit == 0; -} - - -// write: the high level entry point... -// entry: SCL = 1, SDA = 1 -// exit: SCL = 1, SDA = 1 - -bool -i2c_bitbang::write (int addr, const unsigned char *buf, int nbytes) -{ - bool ok = true; - - d_io->lock (); - start (); - ok = write_byte ((addr << 1) | 0); // addr plus "read opcode" - - for (int i = 0; i < nbytes; i++) - ok &= write_byte (buf[i]); - - stop (); - d_io->unlock (); - return ok; -} - - -// read: the high level entry point... -// entry: SCL = 1, SDA = 1 -// exit: SCL = 1, SDA = 1 - -int -i2c_bitbang::read (int addr, unsigned char *buf, int max_bytes) -{ - d_io->lock (); - - // FIXME - - d_io->unlock (); - return -1; -} diff --git a/gnuradio-core/src/lib/io/i2c_bitbang.h b/gnuradio-core/src/lib/io/i2c_bitbang.h deleted file mode 100644 index 1d6fe5044e..0000000000 --- a/gnuradio-core/src/lib/io/i2c_bitbang.h +++ /dev/null @@ -1,65 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2001,2004 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio 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 3, or (at your option) - * any later version. - * - * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef INCLUDED_I2C_BITBANG_H -#define INCLUDED_I2C_BITBANG_H - -#include <gr_core_api.h> -#include <i2c.h> -#include <i2c_bbio.h> - -/*! - * \brief class for controlling i2c bus - * \ingroup base - */ -class GR_CORE_API i2c_bitbang : public i2c { - friend GR_CORE_API i2c_sptr make_i2c_bitbang (i2c_bbio_sptr io); - i2c_bitbang (i2c_bbio_sptr io); - - public: - ~i2c_bitbang () {} - - //! \returns true iff successful - bool write (int addr, const unsigned char *buf, int nbytes); - - //! \returns number of bytes read or -1 if error - int read (int addr, unsigned char *buf, int max_bytes); - - -private: - void start (); - void stop (); - void write_bit (bool bit); - bool write_byte (char byte); - - void set_sda (bool bit) { d_io->set_sda (bit); } - void set_scl (bool bit) { d_io->set_scl (bit); } - bool get_sda () { return d_io->get_sda (); } - - i2c_bbio_sptr d_io; -}; - -GR_CORE_API i2c_sptr make_i2c_bitbang (i2c_bbio_sptr io); - -#endif /* INCLUDED_I2C_BITBANG_H */ - - diff --git a/gnuradio-core/src/lib/io/io.i b/gnuradio-core/src/lib/io/io.i index 6cd3e06f47..2c8def973c 100644 --- a/gnuradio-core/src/lib/io/io.i +++ b/gnuradio-core/src/lib/io/io.i @@ -27,20 +27,11 @@ #endif #include <gr_histo_sink_f.h> -#include <microtune_4702_eval_board.h> -#include <microtune_4937_eval_board.h> -#include <sdr_1000.h> #include <gr_oscope_sink_x.h> #include <gr_oscope_sink_f.h> -#include <ppio.h> %} %include "gr_histo_sink.i" -%include "microtune_xxxx_eval_board.i" -%include "microtune_4702_eval_board.i" -%include "microtune_4937_eval_board.i" -%include "sdr_1000.i" %include "gr_oscope_sink.i" -%include "ppio.i" diff --git a/gnuradio-core/src/lib/io/microtune_4702.cc b/gnuradio-core/src/lib/io/microtune_4702.cc deleted file mode 100644 index 3ec072d51b..0000000000 --- a/gnuradio-core/src/lib/io/microtune_4702.cc +++ /dev/null @@ -1,183 +0,0 @@ -/* -*- c++-*- */ -/* - * Copyright 2001,2003,2004 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio 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 3, or (at your option) - * any later version. - * - * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#include "microtune_4702.h" -#include <stdlib.h> -#include <stdio.h> -#include "i2c.h" - -static const double FIRST_IF = 36.00e6; - -// The tuner internally has 3 bands: VHF Low, VHF High & UHF. -// These are the recommened boundaries -static const double VHF_High_takeover = 174e6; -static const double UHF_takeover = 470e6; - -static int PLL_I2C_ADDR = 0x60; - -static unsigned char -control_byte_1 (bool prescaler, int reference_divisor) -{ - int c = 0x80; - //Note: Last two divider bits (bits 2 and 3 of this byte) determined later - if (prescaler) - c |= 0x10; - - switch (reference_divisor){ - case 2: - c |= 0x00; break; - case 4: - c |= 0x01; break; - case 8: - c |= 0x02; break; - case 16: - c |= 0x03; break; - case 32: - c |= 0x04; break; - case 64: - c |= 0x05; break; - case 128: - c |= 0x06; break; - case 256: - c |= 0x07; break; - case 24: - c |= 0x08; break; - case 5: - c |= 0x09; break; - case 10: - c |= 0x0A; break; - case 20: - c |= 0x0B; break; - case 40: - c |= 0x0C; break; - case 80: - c |= 0x0D; break; - case 160: - c |= 0x0E; break; - case 320: - c |= 0x0F; break; - default: - abort (); - } - return c; -} - -static unsigned char -control_byte_2 (double target_freq) -{ - int c; - - if (target_freq < VHF_High_takeover) // VHF low - c = 0x8E; - - else if (target_freq < UHF_takeover){ // VHF high - c = 0x05; - if (target_freq < 390e6) - c |= 0x40; - else - c |= 0x80; - } - else { // UHF - c = 0x03; - if (target_freq < 750e6) - c |= 0x80; - else - c |= 0xC0; - } - - return c; -} - - -microtune_4702::microtune_4702 (i2c_sptr i2c, int i2c_addr) -{ - d_i2c = i2c; - d_i2c_addr = i2c_addr; - d_reference_divider = 320; - d_prescaler = false; -} - -microtune_4702::~microtune_4702 () -{ - // nop -} - -/*! - * \brief select RF frequency to be tuned to output frequency. - * \p target_freq is the requested frequency in Hz, \p actual_freq - * is set to the actual frequency tuned. It takes about 100 ms - * for the PLL to settle. - * - * \returns true iff sucessful. - */ -bool -microtune_4702::set_RF_freq (double target_freq, double *p_actual_freq) -{ - unsigned char buf[4]; - - double target_f_osc = target_freq + FIRST_IF; - - double f_ref = 4e6 / d_reference_divider; - - //int divisor = (int) ((target_f_osc + (f_ref * 4)) / (f_ref * 8)); - - long int divisor = (long int) (target_f_osc / f_ref); - double actual_freq = (f_ref * divisor) - FIRST_IF; - if (p_actual_freq != 0) - *p_actual_freq = actual_freq; - - if ((divisor & ~0x1ffff) != 0) // >17 bit divisor - return false; - - buf[0] = ((divisor & 0x07f00) >> 8) & 0xff; // DB1 - buf[1] = divisor & 0xff; // DB2 - buf[2] = control_byte_1 (d_prescaler, d_reference_divider); - buf[2] = buf[2] | (((divisor & 0x18000) >> 10) & 0xff); - buf[3] = control_byte_2 (target_freq); - - printf ("%x\n", PLL_I2C_ADDR); -//#if 0 - printf ("set_RF_freq: target: %g MHz actual: %g MHz %02x %02x %02x %02x\n", - target_freq/1e6, actual_freq/1e6, buf[0], buf[1], buf[2], buf[3]); -//#endif - - return d_i2c->write (d_i2c_addr, buf, sizeof (buf)); -} - -/*! - * \returns true iff PLL is locked - */ -bool -microtune_4702::pll_locked_p () -{ - // FIXME - return true; -} - -/*! - * \returns the output frequency of the tuner in Hz. - */ -double -microtune_4702::get_output_freq () -{ - return FIRST_IF; -} diff --git a/gnuradio-core/src/lib/io/microtune_4702.h b/gnuradio-core/src/lib/io/microtune_4702.h deleted file mode 100644 index ccc66db71e..0000000000 --- a/gnuradio-core/src/lib/io/microtune_4702.h +++ /dev/null @@ -1,71 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2001,2003 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio 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 3, or (at your option) - * any later version. - * - * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef INCLUDED_MICROTUNE_4702_H -#define INCLUDED_MICROTUNE_4702_H - -#include <gr_core_api.h> -#include <microtune_xxxx.h> - -/*! - * \brief class for controlling microtune 4702 tuner module - * \ingroup hardware - */ - -class GR_CORE_API microtune_4702 : public microtune_xxxx { -public: - microtune_4702 (i2c_sptr i2c, int i2c_addr); - - virtual ~microtune_4702 (); - - /*! - * \brief select RF frequency to be tuned to output frequency. - * \p freq is the requested frequency in Hz, \p actual_freq - * is set to the actual frequency tuned. It takes about 100 ms - * for the PLL to settle. - * - * \returns true iff sucessful. - */ - bool set_RF_freq (double freq, double *actual_freq); - - /*! - * \returns true iff PLL is locked - */ - bool pll_locked_p (); - - /*! - * \returns the output frequency of the tuner in Hz. - */ - double get_output_freq (); - - private: - - i2c_sptr d_i2c; - int d_i2c_addr; - int d_reference_divider; - bool d_prescaler; /* if set, higher charge pump current: - faster tuning, worse phase noise - for distance < 10kHz to the carrier */ -}; - -#endif /* INCLUDED_MICROTUNE_4702_H */ - diff --git a/gnuradio-core/src/lib/io/microtune_4702_eval_board.cc b/gnuradio-core/src/lib/io/microtune_4702_eval_board.cc deleted file mode 100644 index f6c68726b5..0000000000 --- a/gnuradio-core/src/lib/io/microtune_4702_eval_board.cc +++ /dev/null @@ -1,88 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2001,2004 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio 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 3, or (at your option) - * any later version. - * - * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#include "microtune_4702_eval_board.h" -#include "microtune_eval_board_defs.h" -#include "ppio.h" -#include "microtune_4702.h" - -static const int TUNER_I2C_ADDR = 0x60; - -microtune_4702_eval_board::microtune_4702_eval_board (int which_pp) - : microtune_xxxx_eval_board (which_pp) -{ - d_tuner = new microtune_4702 (d_i2c, TUNER_I2C_ADDR); -} - -microtune_4702_eval_board::~microtune_4702_eval_board () -{ - // default is OK -} - -static const float RF_MIN_V = 1.0; // RF AGC control voltages -static const float RF_MAX_V = 4.0; -static const float IF_MIN_V = 2.0; // IF AGC control voltages -static const float IF_MAX_V = 4.0; - -static const float MIN_AGC = 0; // bottom of synthetic range -static const float MAX_AGC = 1000; // top of synthetic range - -static const float CUTOVER_POINT = 667; - - -// linear is in the range MIN_AGC to MAX_AGC - -static float -linear_to_RF_AGC_voltage (float linear) -{ - if (linear >= CUTOVER_POINT) - return RF_MAX_V; - - float slope = (RF_MAX_V - RF_MIN_V) / CUTOVER_POINT; - return RF_MIN_V + linear * slope; -} - -static float -linear_to_IF_AGC_voltage (float linear) -{ - if (linear < CUTOVER_POINT) - return IF_MIN_V; - - float slope = (IF_MAX_V - IF_MIN_V) / (MAX_AGC - CUTOVER_POINT); - return IF_MIN_V + (linear - CUTOVER_POINT) * slope; -} - -void -microtune_4702_eval_board::set_AGC (float v) -{ - if (v < MIN_AGC) - v = MIN_AGC; - - if (v > MAX_AGC) - v = MAX_AGC; - - float rf_agc_voltage = linear_to_RF_AGC_voltage (v); - float if_agc_voltage = linear_to_IF_AGC_voltage (v); - - set_RF_AGC_voltage (rf_agc_voltage); - set_IF_AGC_voltage (if_agc_voltage); -} diff --git a/gnuradio-core/src/lib/io/microtune_4702_eval_board.h b/gnuradio-core/src/lib/io/microtune_4702_eval_board.h deleted file mode 100644 index d866a4b943..0000000000 --- a/gnuradio-core/src/lib/io/microtune_4702_eval_board.h +++ /dev/null @@ -1,49 +0,0 @@ -/* -*- C++ -*- */ -/* - * Copyright 2001,2004 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio 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 3, or (at your option) - * any later version. - * - * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef INCLUDED_MICROTUNE_4702_EVAL_BOARD_H -#define INCLUDED_MICROTUNE_4702_EVAL_BOARD_H - -#include <gr_core_api.h> -#include "microtune_xxxx_eval_board.h" - -/*! - * \brief control microtune 4702 eval board - * \ingroup hardware - */ - -class GR_CORE_API microtune_4702_eval_board : public microtune_xxxx_eval_board { -public: - microtune_4702_eval_board (int which_pp = 0); - ~microtune_4702_eval_board (); - - /*! - * \brief set RF and IF AGC levels together (scale [0, 1000]) - * - * This provides a simple linear interface for adjusting both - * the RF and IF gain in consort. This is the easy to use interface. - * 0 corresponds to minimum gain. 1000 corresponds to maximum gain. - */ - virtual void set_AGC (float value_0_1000); -}; - -#endif /* INCLUDED_MICROTUNE_4702_EVAL_BOARD_H */ diff --git a/gnuradio-core/src/lib/io/microtune_4702_eval_board.i b/gnuradio-core/src/lib/io/microtune_4702_eval_board.i deleted file mode 100644 index fc085a9756..0000000000 --- a/gnuradio-core/src/lib/io/microtune_4702_eval_board.i +++ /dev/null @@ -1,36 +0,0 @@ -/* -*- C++ -*- */ -/* - * Copyright 2001,2004 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio 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 3, or (at your option) - * any later version. - * - * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -class microtune_4702_eval_board : public microtune_xxxx_eval_board { -public: - microtune_4702_eval_board (int which_pp = 0); - ~microtune_4702_eval_board (); - - /*! - * \brief set RF and IF AGC levels together (scale [0, 1000]) - * - * This provides a simple linear interface for adjusting both - * the RF and IF gain in consort. This is the easy to use interface. - * 0 corresponds to minimum gain. 1000 corresponds to maximum gain. - */ - virtual void set_AGC (float value_0_1000); -}; diff --git a/gnuradio-core/src/lib/io/microtune_4937.cc b/gnuradio-core/src/lib/io/microtune_4937.cc deleted file mode 100644 index 72ddd4bb62..0000000000 --- a/gnuradio-core/src/lib/io/microtune_4937.cc +++ /dev/null @@ -1,146 +0,0 @@ -/* -*- c++-*- */ -/* - * Copyright 2001,2003 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio 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 3, or (at your option) - * any later version. - * - * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#include "microtune_4937.h" -#include <stdlib.h> -#include <stdio.h> -#include <i2c.h> - -static const double first_IF = 43.75e6; - -// The tuner internally has 3 bands: VHF Low, VHF High & UHF. -// These are the recommened boundaries -static const double VHF_High_takeover = 158e6; -static const double UHF_takeover = 464e6; - - -static unsigned char -control_byte_1 (bool fast_tuning_p, int reference_divisor) -{ - int c = 0x88; - - if (fast_tuning_p) - c |= 0x40; - - switch (reference_divisor){ - case 512: - c |= 0x3 << 1; break; - case 640: - c |= 0x0 << 1; break; - case 1024: - c |= 0x1 << 1; break; - default: - abort (); - } - return c; -} - -static unsigned char -control_byte_2 (double target_freq, bool shutdown_tx_PGA) -{ - int c; - - if (target_freq < VHF_High_takeover) // VHF low - c = 0xa0; - else if (target_freq < UHF_takeover) // VHF high - c = 0x90; - else // UHF - c = 0x30; - - if (shutdown_tx_PGA) - c |= 0x08; - - return c; -} - -microtune_4937::microtune_4937 (i2c_sptr i2c, int i2c_addr) -{ - d_i2c = i2c; - d_i2c_addr = i2c_addr; - d_reference_divider = 640; - d_fast_tuning_p = false; -} - -microtune_4937::~microtune_4937 () -{ - // nop -} - -/*! - * \brief select RF frequency to be tuned to output frequency. - * \p target_freq is the requested frequency in Hz, \p actual_freq - * is set to the actual frequency tuned. It takes about 100 ms - * for the PLL to settle. - * - * \returns true iff sucessful. - */ -bool -microtune_4937::set_RF_freq (double target_freq, double *p_actual_freq) -{ - unsigned char buf[4]; - - double target_f_osc = target_freq + first_IF; - - double f_ref = 4e6 / d_reference_divider; - - // f_osc = f_ref * 8 * divisor - // divisor = f_osc / (f_ref * 8) - - int divisor = (int) ((target_f_osc + (f_ref * 4)) / (f_ref * 8)); - double actual_freq = (f_ref * 8 * divisor) - first_IF; - if (p_actual_freq != 0) - *p_actual_freq = actual_freq; - - if ((divisor & ~0x7fff) != 0) // 15 bit divisor - return false; - - buf[0] = (divisor >> 8) & 0xff; // DB1 - buf[1] = divisor & 0xff; // DB2 - buf[2] = control_byte_1 (d_fast_tuning_p, d_reference_divider); - buf[3] = control_byte_2 (target_freq, true); - -#if 0 - printf ("set_RF_freq: target: %g MHz actual: %g MHz %02x %02x %02x %02x\n", - target_freq/1e6, actual_freq/1e6, buf[0], buf[1], buf[2], buf[3]); -#endif - - return d_i2c->write (d_i2c_addr, buf, 4); -} - -/*! - * \returns true iff PLL is locked - */ -bool -microtune_4937::pll_locked_p () -{ - // FIXME - return true; -} - -/*! - * \returns the output frequency of the tuner in Hz. - */ -double -microtune_4937::get_output_freq () -{ - return 5.75e6; // 3x7702 -} diff --git a/gnuradio-core/src/lib/io/microtune_4937.h b/gnuradio-core/src/lib/io/microtune_4937.h deleted file mode 100644 index be8657c950..0000000000 --- a/gnuradio-core/src/lib/io/microtune_4937.h +++ /dev/null @@ -1,68 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2001,2003 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio 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 3, or (at your option) - * any later version. - * - * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef INCLUDED_MICROTUNE_4937_H -#define INCLUDED_MICROTUNE_4937_H - -#include <gr_core_api.h> -#include <microtune_xxxx.h> - -/*! - * \brief class for controlling microtune 4937 tuner module - * \ingroup hardware - */ -class GR_CORE_API microtune_4937 : public microtune_xxxx { -public: - microtune_4937 (i2c_sptr i2c, int i2c_addr = 0x61); - virtual ~microtune_4937 (); - - /*! - * \brief select RF frequency to be tuned to output frequency. - * \p freq is the requested frequency in Hz, \p actual_freq - * is set to the actual frequency tuned. It takes about 100 ms - * for the PLL to settle. - * - * \returns true iff sucessful. - */ - bool set_RF_freq (double freq, double *actual_freq); - - /*! - * \returns true iff PLL is locked - */ - bool pll_locked_p (); - - /*! - * \returns the output frequency (IF center freq) of the tuner in Hz. - */ - double get_output_freq (); - - private: - - i2c_sptr d_i2c; - int d_i2c_addr; - int d_reference_divider; - bool d_fast_tuning_p; /* if set, higher charge pump current: - faster tuning, worse phase noise - for distance < 10kHz to the carrier */ -}; - -#endif /* INCLUDED_MICROTUNE_4937_H */ diff --git a/gnuradio-core/src/lib/io/microtune_4937_eval_board.cc b/gnuradio-core/src/lib/io/microtune_4937_eval_board.cc deleted file mode 100644 index a25b8addfb..0000000000 --- a/gnuradio-core/src/lib/io/microtune_4937_eval_board.cc +++ /dev/null @@ -1,97 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2001,2004 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio 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 3, or (at your option) - * any later version. - * - * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#include "microtune_4937_eval_board.h" -#include "microtune_eval_board_defs.h" -#include "ppio.h" -#include "microtune_4937.h" - -static const int TUNER_I2C_ADDR = 0x61; - -microtune_4937_eval_board::microtune_4937_eval_board (int which_pp) - : microtune_xxxx_eval_board (which_pp) -{ - d_tuner = new microtune_4937 (d_i2c, TUNER_I2C_ADDR); - - // disable upstream amplifier - d_ppio->lock (); - int t = d_ppio->read_data (); - t &= ~(UT_DP_TX_ENABLE | UT_DP_TX_SDA | UT_DP_TX_SCL); - t |= UT_DP_TX_AS; - d_ppio->write_data (t); - d_ppio->unlock (); -} - -microtune_4937_eval_board::~microtune_4937_eval_board () -{ - // Default action is OK -} - - -static const float RF_MIN_V = 1.5; // RF AGC control voltages -static const float RF_MAX_V = 4.0; -static const float IF_MIN_V = 2.0; // IF AGC control voltages -static const float IF_MAX_V = 4.0; - -static const float MIN_AGC = 0; // bottom of synthetic range -static const float MAX_AGC = 1000; // top of synthetic range - -static const float CUTOVER_POINT = 667; - - -// linear is in the range MIN_AGC to MAX_AGC - -static float -linear_to_RF_AGC_voltage (float linear) -{ - if (linear >= CUTOVER_POINT) - return RF_MAX_V; - - float slope = (RF_MAX_V - RF_MIN_V) / CUTOVER_POINT; - return RF_MIN_V + linear * slope; -} - -static float -linear_to_IF_AGC_voltage (float linear) -{ - if (linear < CUTOVER_POINT) - return IF_MIN_V; - - float slope = (IF_MAX_V - IF_MIN_V) / (MAX_AGC - CUTOVER_POINT); - return IF_MIN_V + (linear - CUTOVER_POINT) * slope; -} - -void -microtune_4937_eval_board::set_AGC (float v) -{ - if (v < MIN_AGC) - v = MIN_AGC; - - if (v > MAX_AGC) - v = MAX_AGC; - - float rf_agc_voltage = linear_to_RF_AGC_voltage (v); - float if_agc_voltage = linear_to_IF_AGC_voltage (v); - - set_RF_AGC_voltage (rf_agc_voltage); - set_IF_AGC_voltage (if_agc_voltage); -} diff --git a/gnuradio-core/src/lib/io/microtune_4937_eval_board.h b/gnuradio-core/src/lib/io/microtune_4937_eval_board.h deleted file mode 100644 index 3abd9084ef..0000000000 --- a/gnuradio-core/src/lib/io/microtune_4937_eval_board.h +++ /dev/null @@ -1,50 +0,0 @@ -/* -*- C++ -*- */ -/* - * Copyright 2001,2004 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio 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 3, or (at your option) - * any later version. - * - * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef INCLUDED_MICROTUNE_4937_EVAL_BOARD_H -#define INCLUDED_MICROTUNE_4937_EVAL_BOARD_H - -#include <gr_core_api.h> -#include "microtune_xxxx_eval_board.h" - -/*! - * \brief control microtune 4937 eval board - * \ingroup hardware - */ - -class GR_CORE_API microtune_4937_eval_board : public microtune_xxxx_eval_board { -public: - microtune_4937_eval_board (int which_pp = 0); - ~microtune_4937_eval_board (); - - /*! - * \brief set RF and IF AGC levels together (scale [0, 1000]) - * - * This provides a simple linear interface for adjusting both - * the RF and IF gain in consort. This is the easy to use interface. - * 0 corresponds to minimum gain. 1000 corresponds to maximum gain. - */ - virtual void set_AGC (float value_0_1000); -}; - - -#endif /* INCLUDED_MICROTUNE_4937_EVAL_BOARD_H */ diff --git a/gnuradio-core/src/lib/io/microtune_4937_eval_board.i b/gnuradio-core/src/lib/io/microtune_4937_eval_board.i deleted file mode 100644 index e261416f78..0000000000 --- a/gnuradio-core/src/lib/io/microtune_4937_eval_board.i +++ /dev/null @@ -1,36 +0,0 @@ -/* -*- C++ -*- */ -/* - * Copyright 2001,2004 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio 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 3, or (at your option) - * any later version. - * - * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -class microtune_4937_eval_board : public microtune_xxxx_eval_board { -public: - microtune_4937_eval_board (int which_pp = 0); - ~microtune_4937_eval_board (); - - /*! - * \brief set RF and IF AGC levels together (scale [0, 1000]) - * - * This provides a simple linear interface for adjusting both - * the RF and IF gain in consort. This is the easy to use interface. - * 0 corresponds to minimum gain. 1000 corresponds to maximum gain. - */ - virtual void set_AGC (float value_0_1000); -}; diff --git a/gnuradio-core/src/lib/io/microtune_eval_board.i b/gnuradio-core/src/lib/io/microtune_eval_board.i deleted file mode 100644 index f77ef47b4b..0000000000 --- a/gnuradio-core/src/lib/io/microtune_eval_board.i +++ /dev/null @@ -1,95 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2003 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio 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 3, or (at your option) - * any later version. - * - * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -/* - * SWIG interface defs for Microtune 4937 and eval board with Eric's daughterboard - */ - -/*! - * \brief abstract class for controlling microtune 4937 tuner module - */ -class microtune_4937 { -public: - microtune_4937 (); - - virtual ~microtune_4937 (); - - // returns actual freq or 0 if error (easier interface for SWIG) - double set_RF_freq (double freq); - - /*! - * \returns true iff PLL is locked - */ - bool pll_locked_p (); - - /*! - * \returns the output frequency (IF center freq) of the tuner in Hz. - */ - double get_output_freq (); - - - private: - //! \returns true iff successful - virtual bool i2c_write (int addr, const unsigned char *buf, int nbytes) = 0; - - //! \returns number of bytes read or -1 if error - virtual int i2c_read (int addr, unsigned char *buf, int max_bytes) = 0; - - int d_reference_divider; - bool d_fast_tuning_p; /* if set, higher charge pump current: - faster tuning, worse phase noise - for distance < 10kHz to the carrier */ -}; - -/*! - * \brief concrete class for controlling microtune 4937 eval board attached to parallel port - */ -class microtune_eval_board : public microtune_4937 { -public: - microtune_eval_board (int which_pp = 0); - ~microtune_eval_board (); - - //! is the eval board present? - bool board_present_p (); - - /*! - * \brief set RF and IF AGC control voltages ([0, 5] volts) - */ - void set_RF_AGC_voltage (float volts); - void set_IF_AGC_voltage (float volts); - - /*! - * \brief set RF and IF AGC levels together (scale [0, 1000]) - * - * This provides a simple linear interface for adjusting both - * the RF and IF gain in consort. This is the easy to use interface. - * 0 corresponds to minimum gain. 1000 corresponds to maximum gain. - */ - void set_AGC (float value_0_1000); - -private: - //! \returns true iff successful - virtual bool i2c_write (int addr, const unsigned char *buf, int nbytes); - - //! \returns number of bytes read or -1 if error - virtual int i2c_read (int addr, unsigned char *buf, int max_bytes); -}; diff --git a/gnuradio-core/src/lib/io/microtune_eval_board_defs.h b/gnuradio-core/src/lib/io/microtune_eval_board_defs.h deleted file mode 100644 index 61c52364f3..0000000000 --- a/gnuradio-core/src/lib/io/microtune_eval_board_defs.h +++ /dev/null @@ -1,71 +0,0 @@ -/* -*-C-*- -******************************************************************************* -* -* File: microtune_eval_board_defs.h -* Description: defines for parallel port control of eval board -* -******************************************************************************* -*/ - -/* - * Copyright 2001 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio 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 3, or (at your option) - * any later version. - * - * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef _MICROTUNE_EVAL_BOARD_DEFS_H_ -#define _MICROTUNE_EVAL_BOARD_DEFS_H_ - -/* - * The Microtune 4937DI5 cable modem tuner eval board is controlled - * by bit banging the PC parallel port. This file defines the relevant - * bits. - * - * The parallel port has an 8 bit data port (output), - * an 8 bit control port (output) and - * an 8 bit status port (input). - * - * Not all bits of the control and status ports may be arbitrarily used. - */ - - -// parallel port data port constants (output) - -static const int UT_DP_TX_SDA = 0x01; // upstream control bus -static const int UT_DP_TX_SCL = 0x02; // upstream control bus -static const int UT_DP_TX_AS = 0x04; // upstream control bus -static const int UT_DP_TX_ENABLE = 0x08; // upstream h/w enable -// bits 4,5,6 not used -static const int UT_DP_TUNER_SDA_OUT = 0x80; // tuner i2c bus data - -// parallel port control port constants (output) - -static const int UT_CP_TUNER_SCL = 0x08; // tuner i2c bus clock -static const int UT_CP_MUST_BE_ZERO = 0xf0; // must be zero - -// parallel port status port constants (input) - -// bits 0,1,2 not used -static const int UT_SP_TUNER_SCL_LOOP_BACK= 0x08; // inverted SCL loop back -static const int UT_SP_SHOULD_BE_ZERO = 0x10; // reads as zero -static const int UT_SP_SHOULD_BE_ONE = 0x20; // reads as one -// bit 6 not used -static const int UT_SP_TUNER_SDA_IN = 0x80; - - -#endif /* _MICROTUNE_EVAL_BOARD_DEFS_H_ */ diff --git a/gnuradio-core/src/lib/io/microtune_xxxx.cc b/gnuradio-core/src/lib/io/microtune_xxxx.cc deleted file mode 100644 index 3d55f534a0..0000000000 --- a/gnuradio-core/src/lib/io/microtune_xxxx.cc +++ /dev/null @@ -1,41 +0,0 @@ -/* -*- c++-*- */ -/* - * Copyright 2001,2003,2004 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio 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 3, or (at your option) - * any later version. - * - * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#include "microtune_xxxx.h" - -microtune_xxxx::~microtune_xxxx () -{ - // nop -} - -double -microtune_xxxx::set_RF_freq (double target_freq) -{ - double actual_freq = 0.0; - - if (set_RF_freq (target_freq, &actual_freq)) - return actual_freq; - - return 0.0; -} - - diff --git a/gnuradio-core/src/lib/io/microtune_xxxx.h b/gnuradio-core/src/lib/io/microtune_xxxx.h deleted file mode 100644 index b2646d39f9..0000000000 --- a/gnuradio-core/src/lib/io/microtune_xxxx.h +++ /dev/null @@ -1,66 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2001,2003,2004 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio 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 3, or (at your option) - * any later version. - * - * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef INCLUDED_MICROTUNE_XXXX_H -#define INCLUDED_MICROTUNE_XXXX_H - -#include <gr_core_api.h> -#include <boost/shared_ptr.hpp> - -class i2c; -typedef boost::shared_ptr<i2c> i2c_sptr; - -/*! - * \brief abstract class for controlling microtune {4937,4702} tuner modules - * \ingroup base - */ -class GR_CORE_API microtune_xxxx { -public: - microtune_xxxx () {} - virtual ~microtune_xxxx (); - - /*! - * \brief select RF frequency to be tuned to output frequency. - * \p freq is the requested frequency in Hz, \p actual_freq - * is set to the actual frequency tuned. It takes about 100 ms - * for the PLL to settle. - * - * \returns true iff sucessful. - */ - virtual bool set_RF_freq (double freq, double *actual_freq) = 0; - - // returns actual freq or 0 if error (easier interface for SWIG) - double set_RF_freq (double freq); - - /*! - * \returns true iff PLL is locked - */ - virtual bool pll_locked_p () = 0; - - /*! - * \returns the output frequency (IF center freq) of the tuner in Hz. - */ - virtual double get_output_freq () = 0; - -}; - -#endif /* INCLUDED_MICROTUNE_XXXX_H */ diff --git a/gnuradio-core/src/lib/io/microtune_xxxx_eval_board.cc b/gnuradio-core/src/lib/io/microtune_xxxx_eval_board.cc deleted file mode 100644 index 35600ff066..0000000000 --- a/gnuradio-core/src/lib/io/microtune_xxxx_eval_board.cc +++ /dev/null @@ -1,144 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2001,2004 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio 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 3, or (at your option) - * any later version. - * - * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include "microtune_xxxx_eval_board.h" -#include "microtune_eval_board_defs.h" -#include "microtune_xxxx.h" -#include "ppio.h" -#include "i2c_bitbang.h" -#include "i2c_bbio_pp.h" -#include <cmath> - -static int AGC_DAC_I2C_ADDR = 0x2C; - -microtune_xxxx_eval_board::microtune_xxxx_eval_board (int which_pp) -{ - d_ppio = make_ppio (which_pp); - d_i2c = make_i2c_bitbang (make_i2c_bbio_pp (d_ppio)); - d_tuner = 0; -} - -microtune_xxxx_eval_board::~microtune_xxxx_eval_board () -{ - delete d_tuner; - d_tuner = 0; -} - - -//! is the eval board present? -bool -microtune_xxxx_eval_board::board_present_p () -{ - bool result = true; - d_ppio->lock (); - - int t = d_ppio->read_status (); - if ((t & UT_SP_SHOULD_BE_ZERO) != 0 - || (t & UT_SP_SHOULD_BE_ONE) != UT_SP_SHOULD_BE_ONE) - result = false; - - // could also see if SCL is looped back or not, but that seems like overkill - - d_ppio->unlock (); - return result; -} - -/* - * ---------------------------------------------------------------- - * AGC stuff - * - * We're using a MAX518 8-bit 5V dual dac for setting the AGC's - * ---------------------------------------------------------------- - */ -void -microtune_xxxx_eval_board::write_dac (int which, int value) -{ - unsigned char cmd[2]; - cmd[0] = which & 1; - cmd[1] = value; - d_i2c->write (AGC_DAC_I2C_ADDR, cmd, sizeof (cmd)); -} - -void -microtune_xxxx_eval_board::write_both_dacs (int value0, int value1) -{ - unsigned char cmd[4]; - cmd[0] = 0; - cmd[1] = value0; - cmd[2] = 1; - cmd[3] = value1; - d_i2c->write (AGC_DAC_I2C_ADDR, cmd, sizeof (cmd)); -} - -static int scale_volts (float volts) -{ - int n; - n = (int) rint (volts * (256 / 5.0)); - if (n < 0) - n = 0; - if (n > 255) - n = 255; - - return n; -} - -void -microtune_xxxx_eval_board::set_RF_AGC_voltage (float volts) -{ - write_dac (0, scale_volts (volts)); -} - -void -microtune_xxxx_eval_board::set_IF_AGC_voltage (float volts) -{ - write_dac (1, scale_volts (volts)); -} - -// delegate to tuner - -bool -microtune_xxxx_eval_board::set_RF_freq (double freq, double *actual_freq) -{ - return d_tuner->set_RF_freq (freq, actual_freq); -} - -double -microtune_xxxx_eval_board::set_RF_freq (double freq) -{ - return d_tuner->set_RF_freq (freq); -} - -bool -microtune_xxxx_eval_board::pll_locked_p () -{ - return d_tuner->pll_locked_p (); -} - -double -microtune_xxxx_eval_board::get_output_freq () -{ - return d_tuner->get_output_freq (); -} diff --git a/gnuradio-core/src/lib/io/microtune_xxxx_eval_board.h b/gnuradio-core/src/lib/io/microtune_xxxx_eval_board.h deleted file mode 100644 index 7fd784ade3..0000000000 --- a/gnuradio-core/src/lib/io/microtune_xxxx_eval_board.h +++ /dev/null @@ -1,98 +0,0 @@ -/* -*- C++ -*- */ -/* - * Copyright 2001,2004 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio 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 3, or (at your option) - * any later version. - * - * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef INCLUDED_MICROTUNE_XXXX_EVAL_BOARD_H -#define INCLUDED_MICROTUNE_XXXX_EVAL_BOARD_H - -#include <gr_core_api.h> -#include <boost/shared_ptr.hpp> - -class microtune_xxxx; - -class ppio; -typedef boost::shared_ptr<ppio> ppio_sptr; - -class i2c; -typedef boost::shared_ptr<i2c> i2c_sptr; - -/*! - * \brief abstract class for controlling microtune xxxx eval board - * \ingroup hardware - */ -class GR_CORE_API microtune_xxxx_eval_board { -public: - microtune_xxxx_eval_board (int which_pp = 0); - virtual ~microtune_xxxx_eval_board (); - - //! is the eval board present? - bool board_present_p (); - - /*! - * \brief set RF and IF AGC control voltages ([0, 5] volts) - */ - void set_RF_AGC_voltage (float volts); - void set_IF_AGC_voltage (float volts); - - /*! - * \brief set RF and IF AGC levels together (scale [0, 1000]) - * - * This provides a simple linear interface for adjusting both - * the RF and IF gain in consort. This is the easy to use interface. - * 0 corresponds to minimum gain. 1000 corresponds to maximum gain. - */ - virtual void set_AGC (float value_0_1000) = 0; - - /*! - * \brief select RF frequency to be tuned to output frequency. - * \p freq is the requested frequency in Hz, \p actual_freq - * is set to the actual frequency tuned. It takes about 100 ms - * for the PLL to settle. - * - * \returns true iff sucessful. - */ - bool set_RF_freq (double freq, double *actual_freq); - - // returns actual freq or 0 if error (easier interface for SWIG) - double set_RF_freq (double freq); - - /*! - * \returns true iff PLL is locked - */ - bool pll_locked_p (); - - /*! - * \returns the output frequency (IF center freq) of the tuner in Hz. - */ - double get_output_freq (); - - -private: - void write_dac (int which, int value); - void write_both_dacs (int val0, int val1); - -protected: - ppio_sptr d_ppio; - i2c_sptr d_i2c; - microtune_xxxx *d_tuner; -}; - -#endif /* INCLUDED_MICROTUNE_XXXX_EVAL_BOARD_H */ diff --git a/gnuradio-core/src/lib/io/microtune_xxxx_eval_board.i b/gnuradio-core/src/lib/io/microtune_xxxx_eval_board.i deleted file mode 100644 index 8a8a597427..0000000000 --- a/gnuradio-core/src/lib/io/microtune_xxxx_eval_board.i +++ /dev/null @@ -1,58 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio 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 3, or (at your option) - * any later version. - * - * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -class microtune_xxxx_eval_board { -public: - microtune_xxxx_eval_board (int which_pp = 0); - virtual ~microtune_xxxx_eval_board (); - - //! is the eval board present? - bool board_present_p (); - - /*! - * \brief set RF and IF AGC control voltages ([0, 5] volts) - */ - void set_RF_AGC_voltage (float volts); - void set_IF_AGC_voltage (float volts); - - /*! - * \brief set RF and IF AGC levels together (scale [0, 1000]) - * - * This provides a simple linear interface for adjusting both - * the RF and IF gain in consort. This is the easy to use interface. - * 0 corresponds to minimum gain. 1000 corresponds to maximum gain. - */ - virtual void set_AGC (float value_0_1000) = 0; - - // returns actual freq or 0 if error (easier interface for SWIG) - double set_RF_freq (double freq); - - /*! - * \returns true iff PLL is locked - */ - bool pll_locked_p (); - - /*! - * \returns the output frequency (IF center freq) of the tuner in Hz. - */ - double get_output_freq (); -}; diff --git a/gnuradio-core/src/lib/io/ppio.cc b/gnuradio-core/src/lib/io/ppio.cc deleted file mode 100644 index a5edc539ca..0000000000 --- a/gnuradio-core/src/lib/io/ppio.cc +++ /dev/null @@ -1,39 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2003 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio 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 3, or (at your option) - * any later version. - * - * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#include <ppio.h> -#include <ppio_ppdev.h> - -ppio::~ppio () -{ -} - -// Factory method. -// -// Right now, we've only got one subclass we like. If there were more, -// we'd instantiate the "right one" here. - -ppio_sptr -make_ppio (int which_pp) -{ - return make_ppio_ppdev (which_pp); -} diff --git a/gnuradio-core/src/lib/io/ppio.h b/gnuradio-core/src/lib/io/ppio.h deleted file mode 100644 index d99f7bf79a..0000000000 --- a/gnuradio-core/src/lib/io/ppio.h +++ /dev/null @@ -1,63 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2001,2003 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio 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 3, or (at your option) - * any later version. - * - * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef INCLUDED_PPIO_H -#define INCLUDED_PPIO_H - -#include <gr_core_api.h> -#include <boost/shared_ptr.hpp> - -class ppio; -typedef boost::shared_ptr<ppio> ppio_sptr; - - -/*! - * \brief abstract class that provides low level access to parallel port bits - * \ingroup hardware - */ - -class GR_CORE_API ppio { - public: - ppio () {} - virtual ~ppio (); - - virtual void write_data (unsigned char v) = 0; - virtual unsigned char read_data () = 0; - virtual void write_control (unsigned char v) = 0; - virtual unsigned char read_control () = 0; - virtual unsigned char read_status () = 0; - - virtual void lock () = 0; - virtual void unlock () = 0; -}; - -/*! - * \brief Factory method. - * - * Split out from class to make life easier for SWIG - */ - -GR_CORE_API ppio_sptr make_ppio (int which_pp); - - -#endif /* INCLUDED_PPIO_H */ - diff --git a/gnuradio-core/src/lib/io/ppio.i b/gnuradio-core/src/lib/io/ppio.i deleted file mode 100644 index 6b95dcf888..0000000000 --- a/gnuradio-core/src/lib/io/ppio.i +++ /dev/null @@ -1,48 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio 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 3, or (at your option) - * any later version. - * - * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -class ppio; -typedef boost::shared_ptr<ppio> ppio_sptr; - -%template(ppio_sptr) boost::shared_ptr<ppio>; - -/*! - * \brief abstract class that provides low level access to parallel port bits - */ - -class ppio { - public: - ppio () {} - virtual ~ppio (); - - virtual void write_data (unsigned char v) = 0; - virtual unsigned char read_data () = 0; - virtual void write_control (unsigned char v) = 0; - virtual unsigned char read_control () = 0; - virtual unsigned char read_status () = 0; - - virtual void lock () = 0; - virtual void unlock () = 0; -}; - - -ppio_sptr make_ppio (int which_pp); diff --git a/gnuradio-core/src/lib/io/ppio_ppdev.cc b/gnuradio-core/src/lib/io/ppio_ppdev.cc deleted file mode 100644 index f528459585..0000000000 --- a/gnuradio-core/src/lib/io/ppio_ppdev.cc +++ /dev/null @@ -1,321 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2001,2003,2004,2008 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio 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 3, or (at your option) - * any later version. - * - * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include <ppio_ppdev.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> -#include <stdlib.h> -#include <iostream> -#include <errno.h> -#include <stdio.h> -#include <stdexcept> -#if defined(HAVE_LINUX_PPDEV_H) -#include <sys/ioctl.h> -#include <linux/ppdev.h> -#include <linux/parport.h> -#include <sstream> -#elif defined(HAVE_DEV_PPBUS_PPI_H) -#include <sys/ioctl.h> -#include <dev/ppbus/ppi.h> -#include <dev/ppbus/ppbconf.h> -#include <sstream> -#else -// #warn "ppio_ppdev is not functional on this platform" -#endif - -// These control port bits are active low. -// We toggle them so that this weirdness doesn't get get propagated -// through our interface. - -static int CP_ACTIVE_LOW_BITS = 0x0B; - -// These status port bits are active low. -// We toggle them so that this weirdness doesn't get get propagated -// through our interface. - -static int SP_ACTIVE_LOW_BITS = 0x80; - -#if defined(HAVE_LINUX_PPDEV_H) - -// The real Linux code... - -ppio_ppdev::ppio_ppdev (int which) -{ - std::ostringstream filename; - filename << "/dev/parport" << which; - const char *c_filename = filename.str().c_str(); - - if ((d_fd = open (c_filename, O_RDWR)) < 0){ - int my_errno = errno; - perror (c_filename); - if (my_errno == ENOENT){ - std::cerr << "Does the device file " << c_filename << " exist?\n"; - std::cerr << "If not, as root execute: \n"; - std::cerr << " # mknod " << c_filename << " c 99 0\n"; - std::cerr << " # chmod 666 " << c_filename << std::endl; - } - throw std::runtime_error ("open"); - } - - int mode = IEEE1284_MODE_COMPAT; - if (ioctl (d_fd, PPSETMODE, &mode) != 0){ - perror ("ppio_ppdev: PPSETMODE"); - close (d_fd); - throw std::runtime_error ("PPSETMODE"); - } -} - -ppio_ppdev::~ppio_ppdev () -{ - close (d_fd); -} - - -void -ppio_ppdev::write_data (unsigned char v) -{ - if (ioctl (d_fd, PPWDATA, &v) != 0){ - perror ("ppio_ppdev: PPWDATA"); - throw std::runtime_error ("PPWDATA"); - } -} - -unsigned char -ppio_ppdev::read_data () -{ - unsigned char v; - - if (ioctl (d_fd, PPRDATA, &v) != 0){ - perror ("ppio_ppdev: PPRDATA"); - throw std::runtime_error ("PPRDATA"); - } - return v; -} - -void -ppio_ppdev::write_control (unsigned char v) -{ - unsigned char ctrl = v ^ CP_ACTIVE_LOW_BITS; - if (ioctl (d_fd, PPWCONTROL, &ctrl) != 0){ - perror ("ppio_ppdev: PPWCONTROL"); - throw std::runtime_error ("PPWCONTROL"); - } -} - -unsigned char -ppio_ppdev::read_control () -{ - unsigned char ctrl; - if (ioctl (d_fd, PPRCONTROL, &ctrl) != 0){ - perror ("ppio_ppdev: PPRCONTROL"); - throw std::runtime_error ("PPRCONTROL"); - } - - return ctrl ^ CP_ACTIVE_LOW_BITS; -} - -unsigned char -ppio_ppdev::read_status () -{ - unsigned char status; - if (ioctl (d_fd, PPRSTATUS, &status) != 0){ - perror ("ppio_ppdev: PPRSTATUS"); - throw std::runtime_error ("PPRSTATUS"); - } - - return status ^ SP_ACTIVE_LOW_BITS; -} - -void -ppio_ppdev::lock () -{ - if (ioctl (d_fd, PPCLAIM) != 0){ - perror ("ppio_ppdev: PPCLAIM"); - throw std::runtime_error ("PPCLAIM"); - } -} - -void -ppio_ppdev::unlock () -{ - if (ioctl (d_fd, PPRELEASE) != 0){ - perror ("ppio_ppdev: PPRELEASE"); - throw std::runtime_error ("PPRELEASE"); - } -} - -#elif defined(HAVE_DEV_PPBUS_PPI_H) - -// The real FreeBSD code... (Could work on other BSDs as well) - -ppio_ppdev::ppio_ppdev (int which) -{ - std::ostringstream filename; - filename << "/dev/ppi" << which; - const char *c_filename = filename.str().c_str(); - if ((d_fd = open (c_filename, O_RDWR)) < 0){ - int my_errno = errno; - perror (c_filename); - throw std::runtime_error ("open"); - } - -#if 0 - int mode = IEEE1284_MODE_COMPAT; - if (ioctl (d_fd, PPSETMODE, &mode) != 0){ - perror ("ppio_ppdev: PPSETMODE"); - close (d_fd); - throw std::runtime_error ("PPSETMODE"); - } -#endif -} - -ppio_ppdev::~ppio_ppdev () -{ - close (d_fd); -} - - -void -ppio_ppdev::write_data (unsigned char v) -{ - if (ioctl (d_fd, PPISDATA, &v) != 0){ - perror ("ppio_ppdev: PPISDATA"); - throw std::runtime_error ("PPISDATA"); - } -} - -unsigned char -ppio_ppdev::read_data () -{ - unsigned char v; - - if (ioctl (d_fd, PPIGDATA, &v) != 0){ - perror ("ppio_ppdev: PPIGDATA"); - throw std::runtime_error ("PPIGDATA"); - } - return v; -} - -void -ppio_ppdev::write_control (unsigned char v) -{ - unsigned char ctrl = v ^ CP_ACTIVE_LOW_BITS; - if (ioctl (d_fd, PPISCTRL, &ctrl) != 0){ - perror ("ppio_ppdev: PPISCTRL"); - throw std::runtime_error ("PPISCTRL"); - } -} - -unsigned char -ppio_ppdev::read_control () -{ - unsigned char ctrl; - if (ioctl (d_fd, PPIGCTRL, &ctrl) != 0){ - perror ("ppio_ppdev: PPIGCTRL"); - throw std::runtime_error ("PPIGCTRL"); - } - - return ctrl ^ CP_ACTIVE_LOW_BITS; -} - -unsigned char -ppio_ppdev::read_status () -{ - unsigned char status; - if (ioctl (d_fd, PPIGSTATUS, &status) != 0){ - perror ("ppio_ppdev: PPIGSTATUS"); - throw std::runtime_error ("PPIGSTATUS"); - } - return status ^ SP_ACTIVE_LOW_BITS; -} - -void -ppio_ppdev::lock () -{ -} - -void -ppio_ppdev::unlock () -{ -} -#else -/* Apparently, non real code */ - -ppio_ppdev::ppio_ppdev (int which) -{ - std::cerr << "ppio_ppdev: Not implemented on this platform\n"; - throw std::runtime_error ("not implmeneted"); -} - -ppio_ppdev::~ppio_ppdev () -{ -} - -void -ppio_ppdev::write_data (unsigned char v) -{ -} - -unsigned char -ppio_ppdev::read_data () -{ - return 0; -} - -void -ppio_ppdev::write_control (unsigned char v) -{ -} - -unsigned char -ppio_ppdev::read_control () -{ - return 0; -} - -unsigned char -ppio_ppdev::read_status () -{ - return 0; -} - -void -ppio_ppdev::lock () -{ -} - -void -ppio_ppdev::unlock () -{ -} - -#endif - -ppio_ppdev_sptr -make_ppio_ppdev (int which) -{ - return ppio_ppdev_sptr (new ppio_ppdev (which)); -} diff --git a/gnuradio-core/src/lib/io/ppio_ppdev.h b/gnuradio-core/src/lib/io/ppio_ppdev.h deleted file mode 100644 index 1f86d7e047..0000000000 --- a/gnuradio-core/src/lib/io/ppio_ppdev.h +++ /dev/null @@ -1,62 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2001,2003 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio 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 3, or (at your option) - * any later version. - * - * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef INCLUDED_PPIO_PPDEV_H -#define INCLUDED_PPIO_PPDEV_H - -#include <gr_core_api.h> -#include <ppio.h> - -class ppio_ppdev; -typedef boost::shared_ptr<ppio_ppdev> ppio_ppdev_sptr; - -/*! - * \brief access to parallel port bits using the linux ppdev interface - * \ingroup hardware - */ - -class GR_CORE_API ppio_ppdev : public ppio { - friend GR_CORE_API ppio_ppdev_sptr make_ppio_ppdev (int which = 0); - ppio_ppdev (int which = 0); - - public: - virtual ~ppio_ppdev (); - - virtual void write_data (unsigned char v); - virtual unsigned char read_data (); - virtual void write_control (unsigned char v); - virtual unsigned char read_control (); - virtual unsigned char read_status (); - - virtual void lock (); - virtual void unlock (); - - private: - int d_fd; -}; - -ppio_ppdev_sptr -make_ppio_ppdev (int which); - - -#endif /* INCLUDED_PPIO_PPDEV_H */ - diff --git a/gnuradio-core/src/lib/io/sdr_1000.cc b/gnuradio-core/src/lib/io/sdr_1000.cc deleted file mode 100644 index a8c2555e0e..0000000000 --- a/gnuradio-core/src/lib/io/sdr_1000.cc +++ /dev/null @@ -1,65 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2003 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio 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 3, or (at your option) - * any later version. - * - * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#include <sdr_1000.h> -#include <ppio.h> - -sdr_1000_base::sdr_1000_base (int which_pp) -{ - d_ppio = make_ppio (which_pp); - d_shadow[0] = 0; - d_shadow[1] = 0; - d_shadow[2] = 0; - d_shadow[3] = 0; - reset (); -} - -sdr_1000_base::~sdr_1000_base () -{ -} - -void -sdr_1000_base::reset () -{ - d_ppio->lock (); - d_ppio->write_control (0x0F); - d_ppio->unlock (); - write_latch (L_EXT, 0x00, 0xff); - write_latch (L_BAND, 0x00, 0xff); - write_latch (L_DDS0, 0x80, 0xff); // hold DDS in reset - write_latch (L_DDS1, 0x00, 0xff); -} - - -void -sdr_1000_base::write_latch (int which, int value, int mask) -{ - if (!(0 <= which && which <= 3)) - return; - - d_ppio->lock (); - d_shadow[which] = (d_shadow[which] & ~mask) | (value & mask); - d_ppio->write_data (d_shadow[which]); - d_ppio->write_control (0x0F ^ (1 << which)); - d_ppio->write_control (0x0F); - d_ppio->unlock (); -} diff --git a/gnuradio-core/src/lib/io/sdr_1000.h b/gnuradio-core/src/lib/io/sdr_1000.h deleted file mode 100644 index c00608a3a9..0000000000 --- a/gnuradio-core/src/lib/io/sdr_1000.h +++ /dev/null @@ -1,53 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2003,2004 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio 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 3, or (at your option) - * any later version. - * - * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef INCLUDED_SDR_1000_H -#define INCLUDED_SDR_1000_H - -#include <gr_core_api.h> -#include <boost/shared_ptr.hpp> - -class ppio; -typedef boost::shared_ptr<ppio> ppio_sptr; - - -enum { L_EXT = 0, L_BAND = 1, L_DDS0 = 2, L_DDS1 = 3 }; - -/*! - * \brief Very low level interface to SDR 1000 xcvr hardware - * \sa sdr_1000.py for a higher level interface. - * \ingroup hardware - */ -class GR_CORE_API sdr_1000_base { - ppio_sptr d_ppio; - int d_shadow[4]; // shadow latches - -public: - - sdr_1000_base (int which_pp); - ~sdr_1000_base (); - - void reset (); - void write_latch (int which, int value, int mask); -}; - -#endif /* INCLUDED_SDR_1000_H */ diff --git a/gnuradio-core/src/lib/io/sdr_1000.i b/gnuradio-core/src/lib/io/sdr_1000.i deleted file mode 100644 index c9b1ef5609..0000000000 --- a/gnuradio-core/src/lib/io/sdr_1000.i +++ /dev/null @@ -1,36 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio 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 3, or (at your option) - * any later version. - * - * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -const int L_EXT = 0; -const int L_BAND = 1; -const int L_DDS0 = 2; -const int L_DDS1 = 3; - -class sdr_1000_base { -public: - - sdr_1000_base (int which_pp); - ~sdr_1000_base (); - - void reset (); - void write_latch (int which, int value, int mask); -}; diff --git a/gnuradio-core/src/lib/runtime/CMakeLists.txt b/gnuradio-core/src/lib/runtime/CMakeLists.txt index a322d1b998..f3982f53cd 100644 --- a/gnuradio-core/src/lib/runtime/CMakeLists.txt +++ b/gnuradio-core/src/lib/runtime/CMakeLists.txt @@ -110,17 +110,9 @@ endif(ENABLE_GR_CTRLPORT) # Append gnuradio-core test sources ######################################################################## list(APPEND test_gnuradio_core_sources - ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_block.cc - ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_hier_block2.cc - ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_hier_block2_derived.cc ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_buffer.cc - ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_flowgraph.cc - ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_top_block.cc ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_io_signature.cc ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_vmcircbuf.cc - ${CMAKE_CURRENT_SOURCE_DIR}/qa_block_tags.cc - ${CMAKE_CURRENT_SOURCE_DIR}/qa_runtime.cc - ${CMAKE_CURRENT_SOURCE_DIR}/qa_set_msg_handler.cc ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_logger.cc ) diff --git a/gnuradio-core/src/lib/runtime/gr_basic_block.h b/gnuradio-core/src/lib/runtime/gr_basic_block.h index 31081698c7..66fb72d87e 100644 --- a/gnuradio-core/src/lib/runtime/gr_basic_block.h +++ b/gnuradio-core/src/lib/runtime/gr_basic_block.h @@ -301,9 +301,9 @@ class GR_CORE_API gr_basic_block : public gr_msg_accepter, public boost::enable_ * void msg_handler(pmt::pmt msg); * </pre> * - * (You may want to use boost::bind to massage your callable into the - * correct form. See gr_nop.{h,cc} for an example that sets up a class - * method as the callback.) + * (You may want to use boost::bind to massage your callable into + * the correct form. See gr::blocks::nop for an example that sets + * up a class method as the callback.) * * Blocks that desire to handle messages must call this method in their * constructors to register the handler that will be invoked when messages diff --git a/gnuradio-core/src/lib/runtime/gr_top_block.h b/gnuradio-core/src/lib/runtime/gr_top_block.h index 694e9575b4..9634b53f3c 100644 --- a/gnuradio-core/src/lib/runtime/gr_top_block.h +++ b/gnuradio-core/src/lib/runtime/gr_top_block.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2007,2008,2009 Free Software Foundation, Inc. + * Copyright 2007-2009 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -83,7 +83,7 @@ public: /*! * Wait for a flowgraph to complete. Flowgraphs complete when * either (1) all blocks indicate that they are done (typically only - * when using blocks.file_source, or gr.head, or (2) after stop() has been + * when using blocks.file_source, or blocks.head, or (2) after stop() has been * called to request shutdown. Calling wait on a top_block that is * not running IS NOT an error (wait returns w/o blocking). */ diff --git a/gnuradio-core/src/lib/runtime/qa_runtime.cc b/gnuradio-core/src/lib/runtime/qa_runtime.cc index 62c95ef5c4..f02fbd7d66 100644 --- a/gnuradio-core/src/lib/runtime/qa_runtime.cc +++ b/gnuradio-core/src/lib/runtime/qa_runtime.cc @@ -32,14 +32,8 @@ #include <qa_runtime.h> #include <qa_gr_vmcircbuf.h> #include <qa_gr_io_signature.h> -#include <qa_gr_block.h> -#include <qa_gr_flowgraph.h> #include <qa_gr_logger.h> -#include <qa_gr_top_block.h> -#include <qa_gr_hier_block2.h> -#include <qa_gr_hier_block2_derived.h> #include <qa_gr_buffer.h> -#include <qa_block_tags.h> #include <qa_set_msg_handler.h> CppUnit::TestSuite * diff --git a/gnuradio-core/src/lib/runtime/test_shared_block_ptr.cc b/gnuradio-core/src/lib/runtime/test_shared_block_ptr.cc index bb4e863222..0a391c1354 100644 --- a/gnuradio-core/src/lib/runtime/test_shared_block_ptr.cc +++ b/gnuradio-core/src/lib/runtime/test_shared_block_ptr.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2004 Free Software Foundation, Inc. + * Copyright 2004,2013 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -21,16 +21,16 @@ */ #include <gr_shared_block_sptr.h> -#include <gr_vector_source_i.h> +#include <blocks/vector_source_i.h> gr_block_sptr -foo (gr_vector_source_i_sptr s) +foo (gr::blocks::vector_source_i::sptr s) { return gr_block_sptr (s); } -typedef gr_shared_block_sptr<gr_vector_source_i> gr_vector_source_i_ptrX; -//typedef boost::shared_ptr<gr_vector_source_i> gr_vector_source_i_ptrX; +typedef gr_shared_block_sptr<gr::blocks::vector_source_i> gr_vector_source_i_ptrX; +//typedef boost::shared_ptr<gr::blocks::vector_source_i> gr_vector_source_i_ptrX; gr_vector_source_i_ptrX bar (gr_vector_source_i *s) diff --git a/gnuradio-core/src/lib/swig/CMakeLists.txt b/gnuradio-core/src/lib/swig/CMakeLists.txt index 2132e2ca09..a397339eeb 100644 --- a/gnuradio-core/src/lib/swig/CMakeLists.txt +++ b/gnuradio-core/src/lib/swig/CMakeLists.txt @@ -58,9 +58,9 @@ link_directories(${Boost_LIBRARY_DIRS}) # ---------------------------------------------------------------- set(GR_SWIG_TARGET_DEPS gnuradio_core_generated_sources - general_generated gengen_generated filter_generated pmt_swig) + general_generated filter_generated pmt_swig) -foreach(what runtime general gengen io) +foreach(what runtime general io) SET(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/${what}_swig_doc.i) SET(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../${what} ${CMAKE_CURRENT_BINARY_DIR}/../${what}) GR_SWIG_MAKE(gnuradio_core_${what} gnuradio_core_${what}.i) diff --git a/gnuradio-core/src/lib/swig/gnuradio_core.py b/gnuradio-core/src/lib/swig/gnuradio_core.py index 1fd558a11b..98e415f31a 100644 --- a/gnuradio-core/src/lib/swig/gnuradio_core.py +++ b/gnuradio-core/src/lib/swig/gnuradio_core.py @@ -22,5 +22,4 @@ from gnuradio_core_runtime import * from gnuradio_core_general import * -from gnuradio_core_gengen import * from gnuradio_core_io import * diff --git a/gnuradio-core/src/lib/swig/gnuradio_core_gengen.i b/gnuradio-core/src/lib/swig/gnuradio_core_gengen.i deleted file mode 100644 index b90a5bab3e..0000000000 --- a/gnuradio-core/src/lib/swig/gnuradio_core_gengen.i +++ /dev/null @@ -1,32 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,2009,2010 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio 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 3, or (at your option) - * any later version. - * - * GNU Radio 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 Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -%include "gengen_swig_doc.i" - -#ifndef SWIGIMPORTED -%module(directors="1") gnuradio_core_gengen -#endif - - //%feature("autodoc", "1"); // generate python docstrings - -%include "gnuradio.i" // the common stuff - -%include "gengen.i" diff --git a/gnuradio-core/src/python/bin/microtune.py b/gnuradio-core/src/python/bin/microtune.py deleted file mode 100755 index fbe743f396..0000000000 --- a/gnuradio-core/src/python/bin/microtune.py +++ /dev/null @@ -1,42 +0,0 @@ -#!/usr/bin/env python -# -*- Python -*- - -from gnuradio import gr -from gnuradio.eng_option import eng_option -from gnuradio.wxgui import stdgui, fftsink -from optparse import OptionParser -from gnuradio import eng_notation - - -def main (): - parser = OptionParser (option_class=eng_option) - parser.add_option ("-g", "--gain", type="eng_float", default=-1, - help="set front end gain to GAIN [0,1000]") - parser.add_option ("-f", "--freq", type="eng_float", default=-1, - help="set front end center frequency to FREQ") - parser.add_option ("-t", "--type", type="string", default="4937", - help="select eval board type {4937 or 4702}") - parser.add_option ("-p", "--port", type="int", default=0, - help="parallel port eval board is attached to") - (options, args) = parser.parse_args () - - if options.type == "4937": - front_end = gr.microtune_4937_eval_board (options.port) - elif options.type == "4702": - front_end = gr.microtune_4702_eval_board (options.port) - else: - raise RuntimeError, "Invalid board type. Must be either -t 4937 or -t 4702" - - if options.gain != -1: - front_end.set_AGC (options.gain) - - if options.freq != -1: - if options.freq < 1e6: - options.freq = options.freq * 1e6 - - actual = front_end.set_RF_freq (options.freq) - print "microtune: actual freq = %s" % (eng_notation.num_to_str (actual),) - - -if __name__ == '__main__': - main () diff --git a/gnuradio-core/src/python/gnuradio/ctrlport/GrDataPlotter.py b/gnuradio-core/src/python/gnuradio/ctrlport/GrDataPlotter.py index dfa67feffe..8597ca6497 100644 --- a/gnuradio-core/src/python/gnuradio/ctrlport/GrDataPlotter.py +++ b/gnuradio-core/src/python/gnuradio/ctrlport/GrDataPlotter.py @@ -206,7 +206,7 @@ class GrDataPlotterC(GrDataPlotParent): return snk def get_vecsource(self): - return gr.vector_source_c([]) + return blocks.vector_source_c([]) def get_npts(self): self._npts = self.snk.nsamps() @@ -237,7 +237,7 @@ class GrDataPlotterF(GrDataPlotParent): return snk def get_vecsource(self): - return gr.vector_source_f([]) + return blocks.vector_source_f([]) def get_npts(self): self._npts = self.snk.nsamps() @@ -265,7 +265,7 @@ class GrDataPlotterConst(GrDataPlotParent): return snk def get_vecsource(self): - return gr.vector_source_c([]) + return blocks.vector_source_c([]) def get_npts(self): self._npts = self.snk.nsamps() @@ -304,7 +304,7 @@ class GrDataPlotterPsdC(GrDataPlotParent): return snk def get_vecsource(self): - return gr.vector_source_c([]) + return blocks.vector_source_c([]) def get_npts(self): self._npts = self.snk.fft_size() @@ -337,7 +337,7 @@ class GrDataPlotterPsdF(GrDataPlotParent): return snk def get_vecsource(self): - return gr.vector_source_f([]) + return blocks.vector_source_f([]) def get_npts(self): self._npts = self.snk.fft_size() @@ -367,7 +367,7 @@ class GrTimeRasterF(GrDataPlotParent): return snk def get_vecsource(self): - return gr.vector_source_f([]) + return blocks.vector_source_f([]) def get_npts(self): self._npts = self.snk.num_cols() @@ -396,7 +396,7 @@ class GrTimeRasterB(GrDataPlotParent): return snk def get_vecsource(self): - return gr.vector_source_b([]) + return blocks.vector_source_b([]) def get_npts(self): self._npts = self.snk.num_cols() diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_kludge_copy.py b/gnuradio-core/src/python/gnuradio/gr/qa_kludge_copy.py deleted file mode 100755 index 2a3aa44b1b..0000000000 --- a/gnuradio-core/src/python/gnuradio/gr/qa_kludge_copy.py +++ /dev/null @@ -1,91 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2006,2010 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio 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 3, or (at your option) -# any later version. -# -# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -from gnuradio import gr, gr_unittest -import math -import random - - -class test_kludge_copy(gr_unittest.TestCase): - - def setUp(self): - self.tb = gr.top_block() - self.rng = random.Random() - self.rng.seed(0) - - def tearDown(self): - del self.tb - del self.rng - - def make_random_int_tuple(self, L): - result = [] - for x in range(L): - result.append(self.rng.randint(int(-1e9), int(+1e9))) - return tuple(result) - - - def test_001(self): - # 1 input stream; 1 output stream - src0_data = self.make_random_int_tuple(16000) - src0 = gr.vector_source_i(src0_data) - op = gr.kludge_copy(gr.sizeof_int) - dst0 = gr.vector_sink_i() - self.tb.connect(src0, op, dst0) - self.tb.run() - dst0_data = dst0.data() - self.assertEqual(src0_data, dst0_data) - - def test_002(self): - # 2 input streams; 2 output streams - src0_data = self.make_random_int_tuple(16000) - src1_data = self.make_random_int_tuple(16000) - src0 = gr.vector_source_i(src0_data) - src1 = gr.vector_source_i(src1_data) - op = gr.kludge_copy(gr.sizeof_int) - dst0 = gr.vector_sink_i() - dst1 = gr.vector_sink_i() - self.tb.connect(src0, (op, 0), dst0) - self.tb.connect(src1, (op, 1), dst1) - self.tb.run() - dst0_data = dst0.data() - dst1_data = dst1.data() - self.assertEqual(src0_data, dst0_data) - self.assertEqual(src1_data, dst1_data) - - # Note: this is disabled due to triggering bug in ticket:181 - # It only occurs with new top block code - def xtest_003(self): - # number of input streams != number of output streams - src0_data = self.make_random_int_tuple(16000) - src1_data = self.make_random_int_tuple(16000) - src0 = gr.vector_source_i(src0_data) - src1 = gr.vector_source_i(src1_data) - op = gr.kludge_copy(gr.sizeof_int) - dst0 = gr.vector_sink_i() - dst1 = gr.vector_sink_i() - self.tb.connect(src0, (op, 0), dst0) - self.tb.connect(src1, (op, 1)) - self.assertRaises(ValueError, self.tb.run) - -if __name__ == '__main__': - gr_unittest.run(test_kludge_copy, "test_kludge_copy.xml") - diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_skiphead.py b/gnuradio-core/src/python/gnuradio/gr/qa_skiphead.py deleted file mode 100755 index 1e730398c7..0000000000 --- a/gnuradio-core/src/python/gnuradio/gr/qa_skiphead.py +++ /dev/null @@ -1,102 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2007,2010 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio 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 3, or (at your option) -# any later version. -# -# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -from gnuradio import gr, gr_unittest - -class test_skiphead (gr_unittest.TestCase): - - def setUp(self): - self.tb = gr.top_block () - self.src_data = [int(x) for x in range(65536)] - - def tearDown(self): - self.tb = None - - def test_skip_0(self): - skip_cnt = 0 - expected_result = tuple(self.src_data[skip_cnt:]) - src1 = gr.vector_source_i (self.src_data) - op = gr.skiphead (gr.sizeof_int, skip_cnt) - dst1 = gr.vector_sink_i () - self.tb.connect (src1, op, dst1) - self.tb.run () - dst_data = dst1.data () - self.assertEqual (expected_result, dst_data) - - def test_skip_1(self): - skip_cnt = 1 - expected_result = tuple(self.src_data[skip_cnt:]) - src1 = gr.vector_source_i (self.src_data) - op = gr.skiphead (gr.sizeof_int, skip_cnt) - dst1 = gr.vector_sink_i () - self.tb.connect (src1, op, dst1) - self.tb.run () - dst_data = dst1.data () - self.assertEqual (expected_result, dst_data) - - def test_skip_1023(self): - skip_cnt = 1023 - expected_result = tuple(self.src_data[skip_cnt:]) - src1 = gr.vector_source_i (self.src_data) - op = gr.skiphead (gr.sizeof_int, skip_cnt) - dst1 = gr.vector_sink_i () - self.tb.connect (src1, op, dst1) - self.tb.run () - dst_data = dst1.data () - self.assertEqual (expected_result, dst_data) - - def test_skip_6339(self): - skip_cnt = 6339 - expected_result = tuple(self.src_data[skip_cnt:]) - src1 = gr.vector_source_i (self.src_data) - op = gr.skiphead (gr.sizeof_int, skip_cnt) - dst1 = gr.vector_sink_i () - self.tb.connect (src1, op, dst1) - self.tb.run () - dst_data = dst1.data () - self.assertEqual (expected_result, dst_data) - - def test_skip_12678(self): - skip_cnt = 12678 - expected_result = tuple(self.src_data[skip_cnt:]) - src1 = gr.vector_source_i (self.src_data) - op = gr.skiphead (gr.sizeof_int, skip_cnt) - dst1 = gr.vector_sink_i () - self.tb.connect (src1, op, dst1) - self.tb.run () - dst_data = dst1.data () - self.assertEqual (expected_result, dst_data) - - def test_skip_all(self): - skip_cnt = len(self.src_data) - expected_result = tuple(self.src_data[skip_cnt:]) - src1 = gr.vector_source_i (self.src_data) - op = gr.skiphead (gr.sizeof_int, skip_cnt) - dst1 = gr.vector_sink_i () - self.tb.connect (src1, op, dst1) - self.tb.run () - dst_data = dst1.data () - self.assertEqual (expected_result, dst_data) - - -if __name__ == '__main__': - gr_unittest.run(test_skiphead, "test_skiphead.xml") diff --git a/gnuradio-core/src/python/gnuradio/gruimpl/CMakeLists.txt b/gnuradio-core/src/python/gnuradio/gruimpl/CMakeLists.txt index 7d48f35121..d77da24073 100644 --- a/gnuradio-core/src/python/gnuradio/gruimpl/CMakeLists.txt +++ b/gnuradio-core/src/python/gnuradio/gruimpl/CMakeLists.txt @@ -26,10 +26,8 @@ GR_PYTHON_INSTALL(FILES hexint.py listmisc.py mathmisc.py - lmx2306.py msgq_runner.py os_read_exactly.py - sdr_1000.py seq_with_cursor.py socket_stuff.py daemon.py diff --git a/gnuradio-core/src/python/gnuradio/gruimpl/lmx2306.py b/gnuradio-core/src/python/gnuradio/gruimpl/lmx2306.py deleted file mode 100755 index aa4efc3e9c..0000000000 --- a/gnuradio-core/src/python/gnuradio/gruimpl/lmx2306.py +++ /dev/null @@ -1,186 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2004 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio 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 3, or (at your option) -# any later version. -# -# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -'''Control National LMX2306 based frequency synthesizer''' - -from gnuradio import gr -from gnuradio import eng_notation -from gnuradio.eng_option import eng_option -from optparse import OptionParser - -# bottom two bits of 21 bit word select which register to program - -R_REG = 0x0 -AB_REG = 0x1 -F_REG = 0x2 - -F_counter_reset = (1 << 2) -F_phase_detector_polarity = (1 << 7) - -F_LD_tri_state = (0 << 4) -F_LD_R_divider_output = (4 << 4) -F_LD_N_divider_output = (2 << 4) -F_LD_serial_data_output = (6 << 4) -F_LD_digital_lock_detect = (1 << 4) -F_LD_open_drain = (5 << 4) -F_LD_high = (3 << 4) -F_LD_low = (7 << 4) - -# F_default = F_LD_digital_lock_detect | F_phase_detector_polarity -F_default = F_LD_open_drain | F_phase_detector_polarity - -# -# 4 control pins: -# CE always high -# LE load enable. When LE goes high, data stored in the shift register -# is loaded into one of the three registers -# CLK data is clocked in on the rising edge -# DATA single data bit. Entered MSB first - -DB_CLK = (1 << 0) -DB_DATA = (1 << 1) -DB_LE = (1 << 2) -DB_CE = (1 << 3) - -class lmx2306 (object): - '''Control the National LMX2306 PLL''' - __slots__ = ['pp', 'shadow', 'fosc', 'r', 'step_size', 'verbose'] - def __init__ (self, fosc, step_size, which_pp = 0): - '''FOSC is the frequency of the reference oscillator, - STEP_SIZE is the step between valid frequencies, - WHICH_PP specifies which parallel port to use - ''' - self.pp = gr.make_ppio (which_pp) - self.shadow = DB_CE - self.pp.lock () - self.pp.write_data (self.shadow) - self.pp.unlock () - self.verbose = False - self._set_fosc (fosc) - self._set_step (step_size) - - - def program (self, r, a, b): - if self.verbose: - print "lmx2306: r = %d a = %d b = %d" % (r, a, b) - self.pp.lock () - self._write_word (F_REG | F_default | F_counter_reset) - self._write_word (R_REG | ((r & 0x3fff) << 2)) - self._write_word (AB_REG | ((a & 0x1f) << 2) | ((b & 0x1fff) << 7)) - self._write_word (F_REG | F_default) - self.pp.unlock () - - def set_freq (self, freq): - '''Set the PLL frequency to FREQ - - Return the actual freq value set. It will be rounded down to a - multiple of step_size - ''' - divisor = int (freq / self.step_size) - actual = divisor * self.step_size - (a, b) = self._compute_ab (divisor) - self.program (self.r, a, b) - return actual - - # ---------------------------------------------------------------- - - def _set_fosc (self, ref_oscillator_freq): - self.fosc = ref_oscillator_freq - - def _set_step (self, step_size): - r = int (self.fosc / step_size) - if r * step_size != self.fosc: - raise ValueError, "step_size is not a factor of self.fosc" - if r < 3 or r > 16383: - raise ValueError, "r is out of range" - self.r = r - self.step_size = step_size - - def _compute_ab (self, divisor): - b = divisor / 8 - a = divisor - (b * 8) - if b < 3 or b > 8191 or a > b: - raise ValueError, "Invalid divisor" - return (a, b) - - def _write_word (self, w): - for i in range(21): - if w & (1 << 20): - self._set_DATA_1 () - else: - self._set_DATA_0 () - w = (w << 1) & 0x0ffffff - self._set_CLK_1 () - self._set_CLK_0 () - self._set_LE_1 () - self._set_LE_0 () - - def _set_LE_0 (self): - self.shadow = self.shadow & ~DB_LE - self.pp.write_data (self.shadow) - - def _set_LE_1 (self): - self.shadow = self.shadow | DB_LE - self.pp.write_data (self.shadow) - - def _set_CLK_0 (self): - self.shadow = self.shadow & ~DB_CLK - self.pp.write_data (self.shadow) - - def _set_CLK_1 (self): - self.shadow = self.shadow | DB_CLK - self.pp.write_data (self.shadow) - - def _set_DATA_0 (self): - self.shadow = self.shadow & ~DB_DATA - self.pp.write_data (self.shadow) - - def _set_DATA_1 (self): - self.shadow = self.shadow | DB_DATA - self.pp.write_data (self.shadow) - -if __name__ == '__main__': - parser = OptionParser (option_class=eng_option) - parser.add_option ("-o", "--fosc", type="eng_float", default=32e6, - help="set reference oscillator freq to FREQ", metavar="FREQ") - parser.add_option ("-s", "--step-size", type="eng_float", default=10e3, - help="set the frequency step size to STEP_SIZE") - parser.add_option ("-f", "--freq", type="eng_float", default=430e6, - help="set VCO frequency to FREQ") - parser.add_option ("-v", "--verbose", action="store_true", default=False) - (options, args) = parser.parse_args () - - if options.verbose: - print "fosc = %s step = %s fvco = %s" % ( - eng_notation.num_to_str (options.fosc), - eng_notation.num_to_str (options.step_size), - eng_notation.num_to_str (options.freq)) - - lmx = lmx2306 (options.fosc, options.step_size) - lmx.verbose = options.verbose - - actual = lmx.set_freq (options.freq) - - if options.verbose: - print "fvco_actual = %s delta = %s" % ( - eng_notation.num_to_str (actual), - eng_notation.num_to_str (options.freq - actual)) diff --git a/gnuradio-core/src/python/gnuradio/gruimpl/sdr_1000.py b/gnuradio-core/src/python/gnuradio/gruimpl/sdr_1000.py deleted file mode 100644 index 5192a71554..0000000000 --- a/gnuradio-core/src/python/gnuradio/gruimpl/sdr_1000.py +++ /dev/null @@ -1,84 +0,0 @@ -# -# Copyright 2003,2004 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio 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 3, or (at your option) -# any later version. -# -# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -from gnuradio import gr - -class sdr_1000 (gr.sdr_1000_base): - "Control the DDS on the SDR-1000" - def __init__(self, pport = 0): - gr.sdr_1000_base.__init__(self, pport) - self.write_latch (3, 0x00, 0xC0) # Reset low, WRS/ low - self.write_reg (0x20, 0x40) - - def write_reg(self, addr, data): - self.write_latch (3, addr & 0x3f, 0x3f) - self.write_latch (2, data, 0xff) - self.write_latch (3, 0x40, 0x40) - self.write_latch (3, 0x00, 0x40) - - def set_freq(self, freq): - self.set_band (freq) - ftw = freq / 200e6; - for i in xrange(6): - word = int(ftw * 256) - ftw = ftw*256 - word - # print (('%d [%02x]') % (i, word)) - self.write_reg (4+i, word) - - def set_band (self, freq): - if freq <= 2.25e6: - band = 0 - elif freq <= 5.5e6: - band = 1 - elif freq <= 11e6: - band = 3 # due to wiring mistake on board - elif freq <= 22e6: - band = 2 # due to wiring mistake on board - elif freq <= 37.5e6: - band = 4 - else: - band = 5 - - self.write_latch (1, 1 << band, 0x3f) - - def set_bit (self, reg, bit, state): - val = 0x00 - if state: val = 1<<bit - self.write_latch (reg, val, 1<<bit) - - def set_tx (self, on = 1): - self.set_bit(1, 6, on) - - def set_rx (self): - self.set_bit(1, 6, 0) - - def set_gain (self, high): - self.set_bit(0, 7, high) - - def set_mute (self, mute = 1): - self.set_bit(1, 7, mute) - - def set_unmute (self): - self.set_bit(1, 7, 0) - - def set_external_pin (self, pin, on = 1): - assert (pin < 8 and pin > 0), "Out of range 1..7" - self.set_bit(0, pin-1, on) diff --git a/gnuradio-core/src/tests/CMakeLists.txt b/gnuradio-core/src/tests/CMakeLists.txt index ef58cf9ef5..0c30b15a1d 100644 --- a/gnuradio-core/src/tests/CMakeLists.txt +++ b/gnuradio-core/src/tests/CMakeLists.txt @@ -43,7 +43,6 @@ link_directories(${LOG4CPP_LIBRARY_DIRS}) # Build benchmarks and non-registered tests ######################################################################## set(tests_not_run #single source per test - test_runtime.cc test_general.cc test_vmcircbuf.cc ) diff --git a/gnuradio-core/src/tests/test_all.cc b/gnuradio-core/src/tests/test_all.cc index fb45cbf8f4..f1fbce4e05 100644 --- a/gnuradio-core/src/tests/test_all.cc +++ b/gnuradio-core/src/tests/test_all.cc @@ -24,7 +24,6 @@ #include <cppunit/XmlOutputter.h> #include <gr_unittests.h> -#include <qa_runtime.h> #include <qa_general.h> // FIXME add atsc back in. @@ -36,7 +35,6 @@ main (int argc, char **argv) std::ofstream xmlfile(get_unittest_path("gnuradio_core_all.xml").c_str()); CppUnit::XmlOutputter *xmlout = new CppUnit::XmlOutputter(&runner.result(), xmlfile); - runner.addTest (qa_runtime::suite ()); runner.addTest (qa_general::suite ()); runner.setOutputter(xmlout); diff --git a/gnuradio-core/src/tests/test_buffers.py b/gnuradio-core/src/tests/test_buffers.py index 2664c136c6..e0abb8b304 100755 --- a/gnuradio-core/src/tests/test_buffers.py +++ b/gnuradio-core/src/tests/test_buffers.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2006 Free Software Foundation, Inc. +# Copyright 2006,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -22,6 +22,7 @@ from gnuradio import gr, gru from gnuradio import audio +from gnuradio import blocks from gnuradio.eng_option import eng_option from optparse import OptionParser @@ -68,7 +69,7 @@ class my_graph(gr.top_block): nsamples=int(sample_rate * seconds) #1 seconds data = sig_source_f(sample_rate, 350, ampl, nsamples) - src0 = gr.vector_source_f(data) + src0 = blocks.vector_source_f(data) # gr.test (const std::string &name=std::string("gr_test"), # int min_inputs=1, int max_inputs=1, unsigned int sizeof_input_item=1, diff --git a/gnuradio-core/src/tests/test_runtime.cc b/gnuradio-core/src/tests/test_runtime.cc deleted file mode 100644 index bd5378332e..0000000000 --- a/gnuradio-core/src/tests/test_runtime.cc +++ /dev/null @@ -1,42 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002,2010,2011 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio 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 3, or (at your option) - * any later version. - * - * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#include <cppunit/TextTestRunner.h> -#include <cppunit/XmlOutputter.h> - -#include <gr_unittests.h> -#include <qa_runtime.h> - -int -main (int argc, char **argv) -{ - CppUnit::TextTestRunner runner; - std::ofstream xmlfile(get_unittest_path("gnuradio_core_runtime.xml").c_str()); - CppUnit::XmlOutputter *xmlout = new CppUnit::XmlOutputter(&runner.result(), xmlfile); - - runner.addTest (qa_runtime::suite ()); - runner.setOutputter(xmlout); - - bool was_successful = runner.run ("", false); - - return was_successful ? 0 : 1; -} diff --git a/gr-analog/examples/fmtest.py b/gr-analog/examples/fmtest.py index 294fa0d425..359b05ba04 100755 --- a/gr-analog/examples/fmtest.py +++ b/gr-analog/examples/fmtest.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2009,2012 Free Software Foundation, Inc. +# Copyright 2009,2012,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -84,8 +84,8 @@ class fmtest(gr.top_block): self.connect(sig, fm) self.connect(fm, (self.sum, n)) - self.head = gr.head(gr.sizeof_gr_complex, self._nsamples) - self.snk_tx = gr.vector_sink_c() + self.head = blocks.head(gr.sizeof_gr_complex, self._nsamples) + self.snk_tx = blocks.vector_sink_c() self.channel = filter.channel_model(0.1) self.connect(self.sum, self.head, self.channel, self.snk_tx) @@ -116,7 +116,7 @@ class fmtest(gr.top_block): for i in xrange(self._M): self.fmdet.append(analog.nbfm_rx(self._audio_rate, self._chan_rate)) self.squelch.append(analog.standard_squelch(self._audio_rate*10)) - self.snks.append(gr.vector_sink_f()) + self.snks.append(blocks.vector_sink_f()) self.connect((self.pfb, i), self.fmdet[i], self.squelch[i], self.snks[i]) def num_tx_channels(self): diff --git a/gr-analog/examples/tags/uhd_burst_detector.py b/gr-analog/examples/tags/uhd_burst_detector.py index c0a8d955c2..b1bb15b974 100755 --- a/gr-analog/examples/tags/uhd_burst_detector.py +++ b/gr-analog/examples/tags/uhd_burst_detector.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2012 Free Software Foundation, Inc. +# Copyright 2012,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -55,7 +55,7 @@ class uhd_burst_detector(gr.top_block): # Dummy signaler to collect a burst on known periods data = 1000*[0,] + 1000*[1,] - self.signal = gr.vector_source_s(data, True) + self.signal = blocks.vector_source_s(data, True) # Energy detector to get signal burst ## use squelch to detect energy diff --git a/gr-analog/lib/CMakeLists.txt b/gr-analog/lib/CMakeLists.txt index 53cbb00a51..a1d03da653 100644 --- a/gr-analog/lib/CMakeLists.txt +++ b/gr-analog/lib/CMakeLists.txt @@ -140,7 +140,6 @@ list(APPEND analog_sources quadrature_demod_cf_impl.cc rail_ff_impl.cc simple_squelch_cc_impl.cc - sincos.cc ) #Add Windows DLL resource file if using MSVC @@ -184,7 +183,6 @@ if(ENABLE_TESTING) list(APPEND test_gr_analog_sources ${CMAKE_CURRENT_SOURCE_DIR}/test_gr_analog.cc ${CMAKE_CURRENT_SOURCE_DIR}/qa_analog.cc - ${CMAKE_CURRENT_SOURCE_DIR}/qa_sincos.cc ) add_executable(test-gr-analog ${test_gr_analog_sources}) @@ -201,11 +199,3 @@ if(ENABLE_TESTING) GR_ADD_TEST(test_gr_analog test-gr-analog) endif(ENABLE_TESTING) - -CHECK_CXX_SOURCE_COMPILES(" - #define _GNU_SOURCE - #include <math.h> - int main(){double x, sin, cos; sincos(x, &sin, &cos); return 0;} - " HAVE_SINCOS -) -GR_ADD_COND_DEF(HAVE_SINCOS) diff --git a/gr-analog/lib/qa_analog.cc b/gr-analog/lib/qa_analog.cc index f1e3a45e27..c7c975a3e5 100644 --- a/gr-analog/lib/qa_analog.cc +++ b/gr-analog/lib/qa_analog.cc @@ -26,15 +26,11 @@ */ #include <qa_analog.h> -#include <qa_sincos.h> -#include <qa_rotator.h> CppUnit::TestSuite * qa_gr_analog::suite() { CppUnit::TestSuite *s = new CppUnit::TestSuite("gr-analog"); - s->addTest(gr::analog::qa_sincos::suite()); - return s; } diff --git a/gr-analog/lib/sincos.cc b/gr-analog/lib/sincos.cc deleted file mode 100644 index 14ceeb3a29..0000000000 --- a/gr-analog/lib/sincos.cc +++ /dev/null @@ -1,89 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2010,2012 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio 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 3, or (at your option) - * any later version. - * - * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE // ask for GNU extensions if available -#endif - -#include <analog/sincos.h> -#include <math.h> - -namespace gr { - namespace analog { - -// ---------------------------------------------------------------- - -#if defined (HAVE_SINCOS) - - void - sincos(double x, double *sinx, double *cosx) - { - ::sincos(x, sinx, cosx); - } - -#else - - void - sincos(double x, double *sinx, double *cosx) - { - *sinx = sin(x); - *cosx = cos(x); - } - -#endif - -// ---------------------------------------------------------------- - -#if defined (HAVE_SINCOSF) - - void - sincosf(float x, float *sinx, float *cosx) - { - sincosf(x, sinx, cosx); - } - -#elif defined (HAVE_SINF) && defined (HAVE_COSF) - - void - sincosf(float x, float *sinx, float *cosx) - { - *sinx = sinf(x); - *cosx = cosf(x); - } - -#else - - void - sincosf(float x, float *sinx, float *cosx) - { - *sinx = sin(x); - *cosx = cos(x); - } - -#endif - - } /* namespace analog */ -} /* namespace gr */ diff --git a/gr-analog/python/CMakeLists.txt b/gr-analog/python/CMakeLists.txt index 44e38621a2..e4d1d0aa74 100644 --- a/gr-analog/python/CMakeLists.txt +++ b/gr-analog/python/CMakeLists.txt @@ -47,6 +47,8 @@ if(ENABLE_TESTING) list(APPEND GR_TEST_PYTHON_DIRS ${CMAKE_BINARY_DIR}/gr-analog/python ${CMAKE_BINARY_DIR}/gr-analog/swig + ${CMAKE_BINARY_DIR}/gr-blocks/python + ${CMAKE_BINARY_DIR}/gr-blocks/swig ${CMAKE_BINARY_DIR}/gr-filter/python ${CMAKE_BINARY_DIR}/gr-filter/swig ) diff --git a/gr-analog/python/qa_agc.py b/gr-analog/python/qa_agc.py index 263f9a647e..0d8a7bfb5d 100755 --- a/gr-analog/python/qa_agc.py +++ b/gr-analog/python/qa_agc.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2004,2007,2010,2012 Free Software Foundation, Inc. +# Copyright 2004,2007,2010,2012,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -22,6 +22,7 @@ from gnuradio import gr, gr_unittest import analog_swig as analog +import blocks_swig as blocks import math class test_agc(gr_unittest.TestCase): @@ -105,8 +106,8 @@ class test_agc(gr_unittest.TestCase): sampling_freq = 100 src1 = analog.sig_source_c(sampling_freq, analog.GR_SIN_WAVE, sampling_freq * 0.10, 100.0) - dst1 = gr.vector_sink_c() - head = gr.head(gr.sizeof_gr_complex, int (5*sampling_freq * 0.10)) + dst1 = blocks.vector_sink_c() + head = blocks.head(gr.sizeof_gr_complex, int (5*sampling_freq * 0.10)) agc = analog.agc_cc(1e-3, 1, 1, 1000) @@ -190,8 +191,8 @@ class test_agc(gr_unittest.TestCase): sampling_freq = 100 src1 = analog.sig_source_f(sampling_freq, analog.GR_SIN_WAVE, sampling_freq * 0.10, 100.0) - dst1 = gr.vector_sink_f () - head = gr.head (gr.sizeof_float, int (5*sampling_freq * 0.10)) + dst1 = blocks.vector_sink_f () + head = blocks.head (gr.sizeof_float, int (5*sampling_freq * 0.10)) agc = analog.agc_ff(1e-3, 1, 1, 1000) @@ -277,8 +278,8 @@ class test_agc(gr_unittest.TestCase): sampling_freq = 100 src1 = analog.sig_source_c(sampling_freq, analog.GR_SIN_WAVE, sampling_freq * 0.10, 100) - dst1 = gr.vector_sink_c() - head = gr.head(gr.sizeof_gr_complex, int(5*sampling_freq * 0.10)) + dst1 = blocks.vector_sink_c() + head = blocks.head(gr.sizeof_gr_complex, int(5*sampling_freq * 0.10)) agc = analog.agc2_cc(1e-2, 1e-3, 1, 1, 1000) @@ -364,8 +365,8 @@ class test_agc(gr_unittest.TestCase): sampling_freq = 100 src1 = analog.sig_source_f(sampling_freq, analog.GR_SIN_WAVE, sampling_freq * 0.10, 100) - dst1 = gr.vector_sink_f() - head = gr.head(gr.sizeof_float, int(5*sampling_freq * 0.10)) + dst1 = blocks.vector_sink_f() + head = blocks.head(gr.sizeof_float, int(5*sampling_freq * 0.10)) agc = analog.agc2_ff(1e-2, 1e-3, 1, 1, 1000) @@ -437,8 +438,8 @@ class test_agc(gr_unittest.TestCase): sampling_freq = 100 src1 = analog.sig_source_c(sampling_freq, analog.GR_SIN_WAVE, sampling_freq * 0.10, 100) - dst1 = gr.vector_sink_c() - head = gr.head(gr.sizeof_gr_complex, int(5*sampling_freq * 0.10)) + dst1 = blocks.vector_sink_c() + head = blocks.head(gr.sizeof_gr_complex, int(5*sampling_freq * 0.10)) agc = analog.agc2_cc(1e-2, 1e-3, 1, 1, 1000) @@ -459,9 +460,9 @@ class test_agc(gr_unittest.TestCase): input_data = 8*(0.0,) + 24*(1.0,) + 24*(0.0,) expected_result = (8+length-1)*(0.0,) + 24*(gain*1.0,) + (0,) - src = gr.vector_source_c(input_data) + src = blocks.vector_source_c(input_data) agc = analog.feedforward_agc_cc(8, 2.0) - dst = gr.vector_sink_c() + dst = blocks.vector_sink_c() self.tb.connect(src, agc, dst) self.tb.run() diff --git a/gr-analog/python/qa_cpfsk.py b/gr-analog/python/qa_cpfsk.py index decf94ea3f..7998d8079d 100755 --- a/gr-analog/python/qa_cpfsk.py +++ b/gr-analog/python/qa_cpfsk.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2012 Free Software Foundation, Inc. +# Copyright 2012,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -22,6 +22,7 @@ from gnuradio import gr, gr_unittest import analog_swig as analog +import blocks_swig as blocks import math class test_cpfsk_bc(gr_unittest.TestCase): @@ -52,9 +53,9 @@ class test_cpfsk_bc(gr_unittest.TestCase): src_data = 10*[0, 1] expected_result = map(lambda x: complex(2*x-1,0), src_data) - src = gr.vector_source_b(src_data) + src = blocks.vector_source_b(src_data) op = analog.cpfsk_bc(2, 1, 2) - dst = gr.vector_sink_c() + dst = blocks.vector_sink_c() self.tb.connect(src, op) self.tb.connect(op, dst) diff --git a/gr-analog/python/qa_ctcss_squelch.py b/gr-analog/python/qa_ctcss_squelch.py index 08d3dbfef8..622cca234f 100755 --- a/gr-analog/python/qa_ctcss_squelch.py +++ b/gr-analog/python/qa_ctcss_squelch.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2012 Free Software Foundation, Inc. +# Copyright 2012,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -22,6 +22,7 @@ from gnuradio import gr, gr_unittest import analog_swig as analog +import blocks_swig as blocks class test_ctcss_squelch(gr_unittest.TestCase): @@ -68,10 +69,10 @@ class test_ctcss_squelch(gr_unittest.TestCase): expected_result = src_data expected_result[0] = 0 - src = gr.vector_source_f(src_data) + src = blocks.vector_source_f(src_data) op = analog.ctcss_squelch_ff(rate, freq, level, length, ramp, gate) - dst = gr.vector_sink_f() + dst = blocks.vector_sink_f() self.tb.connect(src, op) self.tb.connect(op, dst) @@ -90,10 +91,10 @@ class test_ctcss_squelch(gr_unittest.TestCase): gate = False src_data = map(lambda x: float(x)/10.0, range(1, 40)) - src = gr.vector_source_f(src_data) + src = blocks.vector_source_f(src_data) op = analog.ctcss_squelch_ff(rate, freq, level, length, ramp, gate) - dst = gr.vector_sink_f() + dst = blocks.vector_sink_f() self.tb.connect(src, op) self.tb.connect(op, dst) diff --git a/gr-analog/python/qa_dpll.py b/gr-analog/python/qa_dpll.py index 3ef8a6e285..98ddf83eff 100755 --- a/gr-analog/python/qa_dpll.py +++ b/gr-analog/python/qa_dpll.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2012 Free Software Foundation, Inc. +# Copyright 2012,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -22,6 +22,7 @@ from gnuradio import gr, gr_unittest import analog_swig as analog +import blocks_swig as blocks import math class test_dpll_bb(gr_unittest.TestCase): @@ -60,9 +61,9 @@ class test_dpll_bb(gr_unittest.TestCase): src_data = 10*((period-1)*[0,] + [1,]) expected_result = src_data - src = gr.vector_source_b(src_data) + src = blocks.vector_source_b(src_data) op = analog.dpll_bb(period, gain) - dst = gr.vector_sink_b() + dst = blocks.vector_sink_b() self.tb.connect(src, op) self.tb.connect(op, dst) diff --git a/gr-analog/python/qa_fmdet.py b/gr-analog/python/qa_fmdet.py index a76ac1d247..6c99b08803 100755 --- a/gr-analog/python/qa_fmdet.py +++ b/gr-analog/python/qa_fmdet.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2012 Free Software Foundation, Inc. +# Copyright 2012,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -22,6 +22,7 @@ from gnuradio import gr, gr_unittest import analog_swig as analog +import blocks_swig as blocks import math class test_fmdet_cf(gr_unittest.TestCase): @@ -63,9 +64,9 @@ class test_fmdet_cf(gr_unittest.TestCase): def est_fmdet_cf_002(self): N = 100 src = analog.sig_source_c(1, analog.GR_SIN_WAVE, 0.2, 1) - head = gr.head(gr.sizeof_gr_complex, N) + head = blocks.head(gr.sizeof_gr_complex, N) op = analog.fmdet_cf(1, 0.1, 0.3, 0.1) - dst = gr.vector_sink_f() + dst = blocks.vector_sink_f() self.tb.connect(src, head, op) self.tb.connect(op, dst) diff --git a/gr-analog/python/qa_frequency_modulator.py b/gr-analog/python/qa_frequency_modulator.py index b673b3275c..7d6cff3fea 100755 --- a/gr-analog/python/qa_frequency_modulator.py +++ b/gr-analog/python/qa_frequency_modulator.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2004,2007,2010,2012 Free Software Foundation, Inc. +# Copyright 2004,2007,2010,2012,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -22,6 +22,7 @@ from gnuradio import gr, gr_unittest import analog_swig as analog +import blocks_swig as blocks import math def sincos(x): @@ -42,9 +43,9 @@ class test_frequency_modulator(gr_unittest.TestCase): src_data = (1.0/4, 1.0/2, 1.0/4, -1.0/4, -1.0/2, -1/4.0) running_sum = (pi/16, 3*pi/16, pi/4, 3*pi/16, pi/16, 0) expected_result = tuple([sincos(x) for x in running_sum]) - src = gr.vector_source_f(src_data) + src = blocks.vector_source_f(src_data) op = analog.frequency_modulator_fc(sensitivity) - dst = gr.vector_sink_c() + dst = blocks.vector_sink_c() self.tb.connect(src, op) self.tb.connect(op, dst) self.tb.run() diff --git a/gr-analog/python/qa_phase_modulator.py b/gr-analog/python/qa_phase_modulator.py index a9c8c84597..81334177db 100755 --- a/gr-analog/python/qa_phase_modulator.py +++ b/gr-analog/python/qa_phase_modulator.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2012 Free Software Foundation, Inc. +# Copyright 2012,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -22,6 +22,7 @@ from gnuradio import gr, gr_unittest import analog_swig as analog +import blocks_swig as blocks import math def sincos(x): @@ -42,9 +43,9 @@ class test_phase_modulator(gr_unittest.TestCase): src_data = (1.0/4, 1.0/2, 1.0/4, -1.0/4, -1.0/2, -1/4.0) expected_result = tuple([sincos(sensitivity*x) for x in src_data]) - src = gr.vector_source_f(src_data) + src = blocks.vector_source_f(src_data) op = analog.phase_modulator_fc(sensitivity) - dst = gr.vector_sink_c() + dst = blocks.vector_sink_c() self.tb.connect(src, op) self.tb.connect(op, dst) diff --git a/gr-analog/python/qa_plateau_detector_fb.py b/gr-analog/python/qa_plateau_detector_fb.py index 5f8abc74ec..6f330440ef 100755 --- a/gr-analog/python/qa_plateau_detector_fb.py +++ b/gr-analog/python/qa_plateau_detector_fb.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2012 Free Software Foundation, Inc. +# Copyright 2012,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -22,6 +22,7 @@ from gnuradio import gr, gr_unittest import analog_swig as analog +import blocks_swig as blocks class qa_plateau_detector_fb (gr_unittest.TestCase): @@ -36,8 +37,8 @@ class qa_plateau_detector_fb (gr_unittest.TestCase): test_signal = (0, 1, .2, .4, .6, .8, 1, 1, 1, 1, 1, .8, .6, .4, 1, 0) expected_sig = (0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0) # | Center of Plateau - sink = gr.vector_sink_b() - self.tb.connect(gr.vector_source_f(test_signal), analog.plateau_detector_fb(5), sink) + sink = blocks.vector_sink_b() + self.tb.connect(blocks.vector_source_f(test_signal), analog.plateau_detector_fb(5), sink) self.tb.run () self.assertEqual(expected_sig, sink.data()) diff --git a/gr-analog/python/qa_pll_carriertracking.py b/gr-analog/python/qa_pll_carriertracking.py index e383639d49..2a6bb9f0b3 100755 --- a/gr-analog/python/qa_pll_carriertracking.py +++ b/gr-analog/python/qa_pll_carriertracking.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2004,2007,2010-2012 Free Software Foundation, Inc. +# Copyright 2004,2007,2010-2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -22,6 +22,7 @@ from gnuradio import gr, gr_unittest import analog_swig as analog +import blocks_swig as blocks import math class test_pll_carriertracking(gr_unittest.TestCase): @@ -143,8 +144,8 @@ class test_pll_carriertracking(gr_unittest.TestCase): src = analog.sig_source_c(sampling_freq, analog.GR_COS_WAVE, freq, 1.0) pll = analog.pll_carriertracking_cc(loop_bw, maxf, minf) - head = gr.head(gr.sizeof_gr_complex, int (freq)) - dst = gr.vector_sink_c() + head = blocks.head(gr.sizeof_gr_complex, int (freq)) + dst = blocks.vector_sink_c() self.tb.connect(src, pll, head) self.tb.connect(head, dst) diff --git a/gr-analog/python/qa_pll_freqdet.py b/gr-analog/python/qa_pll_freqdet.py index cc8757c965..11f2a9b959 100755 --- a/gr-analog/python/qa_pll_freqdet.py +++ b/gr-analog/python/qa_pll_freqdet.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2004,2007,2010-2012 Free Software Foundation, Inc. +# Copyright 2004,2007,2010-2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -22,6 +22,7 @@ from gnuradio import gr, gr_unittest import analog_swig as analog +import blocks_swig as blocks import math class test_pll_freqdet(gr_unittest.TestCase): @@ -143,8 +144,8 @@ class test_pll_freqdet(gr_unittest.TestCase): src = analog.sig_source_c(sampling_freq, analog.GR_COS_WAVE, freq, 1.0) pll = analog.pll_freqdet_cf(loop_bw, maxf, minf) - head = gr.head(gr.sizeof_float, int (freq)) - dst = gr.vector_sink_f() + head = blocks.head(gr.sizeof_float, int (freq)) + dst = blocks.vector_sink_f() self.tb.connect(src, pll, head) self.tb.connect(head, dst) diff --git a/gr-analog/python/qa_pll_refout.py b/gr-analog/python/qa_pll_refout.py index c63136bc0c..f90e7c3ada 100755 --- a/gr-analog/python/qa_pll_refout.py +++ b/gr-analog/python/qa_pll_refout.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2004,2010,2012 Free Software Foundation, Inc. +# Copyright 2004,2010,2012,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -22,6 +22,7 @@ from gnuradio import gr, gr_unittest import analog_swig as analog +import blocks_swig as blocks import math class test_pll_refout(gr_unittest.TestCase): @@ -143,8 +144,8 @@ class test_pll_refout(gr_unittest.TestCase): src = analog.sig_source_c(sampling_freq, analog.GR_COS_WAVE, freq, 1.0) pll = analog.pll_refout_cc(loop_bw, maxf, minf) - head = gr.head(gr.sizeof_gr_complex, int (freq)) - dst = gr.vector_sink_c() + head = blocks.head(gr.sizeof_gr_complex, int (freq)) + dst = blocks.vector_sink_c() self.tb.connect(src, pll, head) self.tb.connect(head, dst) diff --git a/gr-analog/python/qa_probe_avg_mag_sqrd.py b/gr-analog/python/qa_probe_avg_mag_sqrd.py index 5c6c97e450..930077c9c0 100755 --- a/gr-analog/python/qa_probe_avg_mag_sqrd.py +++ b/gr-analog/python/qa_probe_avg_mag_sqrd.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2012 Free Software Foundation, Inc. +# Copyright 2012,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -22,6 +22,7 @@ from gnuradio import gr, gr_unittest import analog_swig as analog +import blocks_swig as blocks import math def avg_mag_sqrd_c(x, alpha): @@ -52,7 +53,7 @@ class test_probe_avg_mag_sqrd(gr_unittest.TestCase): 6.0+6.0j, 7.0+7.0j, 8.0+8.0j, 9.0+9.0j, 10.0+10.0j] expected_result = avg_mag_sqrd_c(src_data, alpha)[-1] - src = gr.vector_source_c(src_data) + src = blocks.vector_source_c(src_data) op = analog.probe_avg_mag_sqrd_c(0, alpha) self.tb.connect(src, op) @@ -67,9 +68,9 @@ class test_probe_avg_mag_sqrd(gr_unittest.TestCase): 6.0+6.0j, 7.0+7.0j, 8.0+8.0j, 9.0+9.0j, 10.0+10.0j] expected_result = avg_mag_sqrd_c(src_data, alpha)[0:-1] - src = gr.vector_source_c(src_data) + src = blocks.vector_source_c(src_data) op = analog.probe_avg_mag_sqrd_cf(0, alpha) - dst = gr.vector_sink_f() + dst = blocks.vector_sink_f() self.tb.connect(src, op) self.tb.connect(op, dst) @@ -84,7 +85,7 @@ class test_probe_avg_mag_sqrd(gr_unittest.TestCase): 6.0, 7.0, 8.0, 9.0, 10.0] expected_result = avg_mag_sqrd_f(src_data, alpha)[-1] - src = gr.vector_source_f(src_data) + src = blocks.vector_source_f(src_data) op = analog.probe_avg_mag_sqrd_f(0, alpha) self.tb.connect(src, op) diff --git a/gr-analog/python/qa_pwr_squelch.py b/gr-analog/python/qa_pwr_squelch.py index dd42c7fb90..238723ba3c 100755 --- a/gr-analog/python/qa_pwr_squelch.py +++ b/gr-analog/python/qa_pwr_squelch.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2012 Free Software Foundation, Inc. +# Copyright 2012,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -22,6 +22,7 @@ from gnuradio import gr, gr_unittest import analog_swig as analog +import blocks_swig as blocks class test_pwr_squelch(gr_unittest.TestCase): @@ -63,9 +64,9 @@ class test_pwr_squelch(gr_unittest.TestCase): thr = -25 src_data = map(lambda x: float(x)/10.0, range(1, 40)) - src = gr.vector_source_c(src_data) + src = blocks.vector_source_c(src_data) op = analog.pwr_squelch_cc(thr, alpha) - dst = gr.vector_sink_c() + dst = blocks.vector_sink_c() self.tb.connect(src, op) self.tb.connect(op, dst) @@ -109,9 +110,9 @@ class test_pwr_squelch(gr_unittest.TestCase): thr = -25 src_data = map(lambda x: float(x)/10.0, range(1, 40)) - src = gr.vector_source_f(src_data) + src = blocks.vector_source_f(src_data) op = analog.pwr_squelch_ff(thr, alpha) - dst = gr.vector_sink_f() + dst = blocks.vector_sink_f() self.tb.connect(src, op) self.tb.connect(op, dst) diff --git a/gr-analog/python/qa_quadrature_demod.py b/gr-analog/python/qa_quadrature_demod.py index e38ea72a7d..0a92bb12a5 100755 --- a/gr-analog/python/qa_quadrature_demod.py +++ b/gr-analog/python/qa_quadrature_demod.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2012 Free Software Foundation, Inc. +# Copyright 2012,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -22,6 +22,7 @@ from gnuradio import gr, gr_unittest import analog_swig as analog +import blocks_swig as blocks import cmath class test_quadrature_demod(gr_unittest.TestCase): @@ -47,9 +48,9 @@ class test_quadrature_demod(gr_unittest.TestCase): expected_result = [0,] + 199*[1.0] - src = gr.vector_source_c(src_data) + src = blocks.vector_source_c(src_data) op = analog.quadrature_demod_cf(gain) - dst = gr.vector_sink_f() + dst = blocks.vector_sink_f() self.tb.connect(src, op) self.tb.connect(op, dst) diff --git a/gr-analog/python/qa_rail_ff.py b/gr-analog/python/qa_rail_ff.py index 5bcf01c6b7..58ac01d7a6 100755 --- a/gr-analog/python/qa_rail_ff.py +++ b/gr-analog/python/qa_rail_ff.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2012 Free Software Foundation, Inc. +# Copyright 2012,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -22,6 +22,7 @@ from gnuradio import gr, gr_unittest import analog_swig as analog +import blocks_swig as blocks def clip(x, lo, hi): if(x < lo): @@ -63,9 +64,9 @@ class test_rail(gr_unittest.TestCase): src_data = [-2, -1, -0.5, -0.25, 0, 0.25, 0.5, 1, 2] expected_result = map(lambda x: clip(x, lo, hi), src_data) - src = gr.vector_source_f(src_data) + src = blocks.vector_source_f(src_data) op = analog.rail_ff(lo, hi) - dst = gr.vector_sink_f() + dst = blocks.vector_sink_f() self.tb.connect(src, op) self.tb.connect(op, dst) diff --git a/gr-analog/python/qa_sig_source.py b/gr-analog/python/qa_sig_source.py index bc48333ed1..0aa03c7402 100755 --- a/gr-analog/python/qa_sig_source.py +++ b/gr-analog/python/qa_sig_source.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2004,2007,2010,2012 Free Software Foundation, Inc. +# Copyright 2004,2007,2010,2012,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -22,6 +22,7 @@ from gnuradio import gr, gr_unittest import analog_swig as analog +import blocks_swig as blocks import math class test_sig_source(gr_unittest.TestCase): @@ -36,8 +37,8 @@ class test_sig_source(gr_unittest.TestCase): tb = self.tb expected_result = (1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5) src1 = analog.sig_source_f(1e6, analog.GR_CONST_WAVE, 0, 1.5) - op = gr.head(gr.sizeof_float, 10) - dst1 = gr.vector_sink_f() + op = blocks.head(gr.sizeof_float, 10) + dst1 = blocks.vector_sink_f() tb.connect(src1, op) tb.connect(op, dst1) tb.run() @@ -48,8 +49,8 @@ class test_sig_source(gr_unittest.TestCase): tb = self.tb expected_result = (1, 1, 1, 1) src1 = analog.sig_source_i(1e6, analog.GR_CONST_WAVE, 0, 1) - op = gr.head(gr.sizeof_int, 4) - dst1 = gr.vector_sink_i() + op = blocks.head(gr.sizeof_int, 4) + dst1 = blocks.vector_sink_i() tb.connect(src1, op) tb.connect(op, dst1) tb.run() @@ -61,8 +62,8 @@ class test_sig_source(gr_unittest.TestCase): sqrt2 = math.sqrt(2) / 2 expected_result = (0, sqrt2, 1, sqrt2, 0, -sqrt2, -1, -sqrt2, 0) src1 = analog.sig_source_f(8, analog.GR_SIN_WAVE, 1.0, 1.0) - op = gr.head(gr.sizeof_float, 9) - dst1 = gr.vector_sink_f() + op = blocks.head(gr.sizeof_float, 9) + dst1 = blocks.vector_sink_f() tb.connect(src1, op) tb.connect(op, dst1) tb.run() @@ -74,8 +75,8 @@ class test_sig_source(gr_unittest.TestCase): sqrt2 = math.sqrt(2) / 2 expected_result = (1, sqrt2, 0, -sqrt2, -1, -sqrt2, 0, sqrt2, 1) src1 = analog.sig_source_f(8, analog.GR_COS_WAVE, 1.0, 1.0) - op = gr.head(gr.sizeof_float, 9) - dst1 = gr.vector_sink_f() + op = blocks.head(gr.sizeof_float, 9) + dst1 = blocks.vector_sink_f() tb.connect(src1, op) tb.connect(op, dst1) tb.run() @@ -86,8 +87,8 @@ class test_sig_source(gr_unittest.TestCase): tb = self.tb #arg6 is a bit before -PI/2 expected_result = (1j, 1j, 0, 0, 1, 1, 1+0j, 1+1j, 1j) src1 = analog.sig_source_c(8, analog.GR_SQR_WAVE, 1.0, 1.0) - op = gr.head(gr.sizeof_gr_complex, 9) - dst1 = gr.vector_sink_c() + op = blocks.head(gr.sizeof_gr_complex, 9) + dst1 = blocks.vector_sink_c() tb.connect(src1, op) tb.connect(op, dst1) tb.run() @@ -99,8 +100,8 @@ class test_sig_source(gr_unittest.TestCase): expected_result = (1+.5j, .75+.75j, .5+1j, .25+.75j, 0+.5j, .25+.25j, .5+0j, .75+.25j, 1+.5j) src1 = analog.sig_source_c(8, analog.GR_TRI_WAVE, 1.0, 1.0) - op = gr.head(gr.sizeof_gr_complex, 9) - dst1 = gr.vector_sink_c() + op = blocks.head(gr.sizeof_gr_complex, 9) + dst1 = blocks.vector_sink_c() tb.connect(src1, op) tb.connect(op, dst1) tb.run() @@ -112,8 +113,8 @@ class test_sig_source(gr_unittest.TestCase): expected_result = (.5+.25j, .625+.375j, .75+.5j, .875+.625j, 0+.75j, .125+.875j, .25+1j, .375+.125j, .5+.25j) src1 = analog.sig_source_c(8, analog.GR_SAW_WAVE, 1.0, 1.0) - op = gr.head(gr.sizeof_gr_complex, 9) - dst1 = gr.vector_sink_c() + op = blocks.head(gr.sizeof_gr_complex, 9) + dst1 = blocks.vector_sink_c() tb.connect(src1, op) tb.connect(op, dst1) tb.run() @@ -124,8 +125,8 @@ class test_sig_source(gr_unittest.TestCase): tb = self.tb expected_result = (0, 0, 0, 0, 1, 1, 1, 1, 0) src1 = analog.sig_source_f(8, analog.GR_SQR_WAVE, 1.0, 1.0) - op = gr.head(gr.sizeof_float, 9) - dst1 = gr.vector_sink_f() + op = blocks.head(gr.sizeof_float, 9) + dst1 = blocks.vector_sink_f() tb.connect(src1, op) tb.connect(op, dst1) tb.run() @@ -136,8 +137,8 @@ class test_sig_source(gr_unittest.TestCase): tb = self.tb expected_result = (1, .75, .5, .25, 0, .25, .5, .75, 1) src1 = analog.sig_source_f(8, analog.GR_TRI_WAVE, 1.0, 1.0) - op = gr.head(gr.sizeof_float, 9) - dst1 = gr.vector_sink_f() + op = blocks.head(gr.sizeof_float, 9) + dst1 = blocks.vector_sink_f() tb.connect(src1, op) tb.connect(op, dst1) tb.run() @@ -148,8 +149,8 @@ class test_sig_source(gr_unittest.TestCase): tb = self.tb expected_result = (.5, .625, .75, .875, 0, .125, .25, .375, .5) src1 = analog.sig_source_f(8, analog.GR_SAW_WAVE, 1.0, 1.0) - op = gr.head(gr.sizeof_float, 9) - dst1 = gr.vector_sink_f() + op = blocks.head(gr.sizeof_float, 9) + dst1 = blocks.vector_sink_f() tb.connect(src1, op) tb.connect(op, dst1) tb.run() diff --git a/gr-analog/python/qa_simple_squelch.py b/gr-analog/python/qa_simple_squelch.py index 9fa112864f..2bd88e1489 100755 --- a/gr-analog/python/qa_simple_squelch.py +++ b/gr-analog/python/qa_simple_squelch.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2012 Free Software Foundation, Inc. +# Copyright 2012,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -22,6 +22,7 @@ from gnuradio import gr, gr_unittest import analog_swig as analog +import blocks_swig as blocks class test_simple_squelch(gr_unittest.TestCase): @@ -50,9 +51,9 @@ class test_simple_squelch(gr_unittest.TestCase): thr = -25 src_data = map(lambda x: float(x)/10.0, range(1, 40)) - src = gr.vector_source_c(src_data) + src = blocks.vector_source_c(src_data) op = analog.simple_squelch_cc(thr, alpha) - dst = gr.vector_sink_c() + dst = blocks.vector_sink_c() self.tb.connect(src, op) self.tb.connect(op, dst) diff --git a/gr-analog/python/wfm_rcv_fmdet.py b/gr-analog/python/wfm_rcv_fmdet.py index f3627d378d..b7cd1458fb 100644 --- a/gr-analog/python/wfm_rcv_fmdet.py +++ b/gr-analog/python/wfm_rcv_fmdet.py @@ -1,5 +1,5 @@ # -# Copyright 2005,2006,2012 Free Software Foundation, Inc. +# Copyright 2005,2006,2012-2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -132,7 +132,7 @@ class wfm_rcv_fmdet(gr.hier_block2): stereo_rds_filter_coeffs) self.rds_carrier_generator = blocks.multiply_cc(); self.rds_signal_generator = blocks.multiply_cc(); - self_rds_signal_processor = gr.null_sink(gr.sizeof_gr_complex); + self_rds_signal_processor = blocks.null_sink(gr.sizeof_gr_complex); loop_bw = 2*math.pi/100.0 max_freq = -2.0*math.pi*18990/audio_rate; diff --git a/gr-analog/python/wfm_rcv_pll.py b/gr-analog/python/wfm_rcv_pll.py index 7452de731f..282e2b14be 100644 --- a/gr-analog/python/wfm_rcv_pll.py +++ b/gr-analog/python/wfm_rcv_pll.py @@ -1,5 +1,5 @@ # -# Copyright 2005,2006,2012 Free Software Foundation, Inc. +# Copyright 2005,2006,2012-2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -125,7 +125,7 @@ class wfm_rcv_pll(gr.hier_block2): self.rds_carrier_generator = blocks.multiply_cc(); self.rds_signal_generator = blocks.multiply_cc(); - self_rds_signal_processor = gr.null_sink(gr.sizeof_gr_complex); + self_rds_signal_processor = blocks.null_sink(gr.sizeof_gr_complex); loop_bw = 2*math.pi/100.0 max_freq = -2.0*math.pi*18990/audio_rate; diff --git a/gr-analog/swig/analog_swig.i b/gr-analog/swig/analog_swig.i index 2c6f5a66cb..a9bd6feff5 100644 --- a/gr-analog/swig/analog_swig.i +++ b/gr-analog/swig/analog_swig.i @@ -60,7 +60,6 @@ #include "analog/pwr_squelch_ff.h" #include "analog/quadrature_demod_cf.h" #include "analog/rail_ff.h" -#include "analog/sincos.h" #include "analog/sig_source_s.h" #include "analog/sig_source_i.h" #include "analog/sig_source_f.h" @@ -103,7 +102,6 @@ %include "analog/pwr_squelch_ff.h" %include "analog/quadrature_demod_cf.h" %include "analog/rail_ff.h" -%include "analog/sincos.h" %include "analog/sig_source_s.h" %include "analog/sig_source_i.h" %include "analog/sig_source_f.h" diff --git a/gr-atsc/python/CMakeLists.txt b/gr-atsc/python/CMakeLists.txt index aaa5bd93c4..ea3524ae18 100644 --- a/gr-atsc/python/CMakeLists.txt +++ b/gr-atsc/python/CMakeLists.txt @@ -45,7 +45,8 @@ install( if(ENABLE_TESTING) list(APPEND GR_TEST_PYTHON_DIRS - ${CMAKE_BINARY_DIR}/gr-atsc/src/lib + ${CMAKE_BINARY_DIR}/gr-atsc/python + ${CMAKE_BINARY_DIR}/gr-atsc/swig ${CMAKE_BINARY_DIR}/gr-blocks/python ${CMAKE_BINARY_DIR}/gr-blocks/swig ) diff --git a/gr-atsc/python/qa_atsc.py b/gr-atsc/python/qa_atsc.py index 507bc8aa47..d17a200cf6 100755 --- a/gr-atsc/python/qa_atsc.py +++ b/gr-atsc/python/qa_atsc.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2004,2006,2007 Free Software Foundation, Inc. +# Copyright 2004,2006,2007,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -21,8 +21,7 @@ # from gnuradio import gr, gr_unittest -import atsc # qa code needs to run without being installed -#from gnuradio import atsc +import atsc_swig as atsc from atsc_utils import * import sys import blocks_swig as blocks @@ -80,7 +79,7 @@ class vector_source_ts(gr.hier_block2): ts: MPEG transport stream. (sequence of ints in [0,255]; len(ts) % 188 == 0) """ - src = gr.vector_source_b(pad_transport_stream(ts)) + src = blocks.vector_source_b(pad_transport_stream(ts)) s2v = blocks.stream_to_vector(gr.sizeof_char, atsc.sizeof_atsc_mpeg_packet) gr.hier_block2.__init__(self, "vector_source_ts", @@ -98,7 +97,7 @@ class vector_sink_ts(gr.hier_block2): """ v2s = blocks.vector_to_stream(gr.sizeof_char, atsc.sizeof_atsc_mpeg_packet) - self.sink = gr.vector_sink_b() + self.sink = blocks.vector_sink_b() gr.hier_block2.__init__(self, "vector_sink_ts", v2s.input_signature(), gr.io_signature(0, 0, 0)) diff --git a/gr-audio/examples/python/audio_to_file.py b/gr-audio/examples/python/audio_to_file.py index 201ec90bf1..6a2cbcb12e 100755 --- a/gr-audio/examples/python/audio_to_file.py +++ b/gr-audio/examples/python/audio_to_file.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2004,2007 Free Software Foundation, Inc. +# Copyright 2004,2007,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -53,7 +53,7 @@ class my_top_block(gr.top_block): if options.nsamples is None: self.connect((src, 0), dst) else: - head = gr.head(gr.sizeof_float, int(options.nsamples)) + head = blocks.head(gr.sizeof_float, int(options.nsamples)) self.connect((src, 0), head, dst) diff --git a/gr-audio/examples/python/dial_tone_wav.py b/gr-audio/examples/python/dial_tone_wav.py index 91bf744c95..82f8cf331d 100755 --- a/gr-audio/examples/python/dial_tone_wav.py +++ b/gr-audio/examples/python/dial_tone_wav.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2004,2005,2007,2008,2012 Free Software Foundation, Inc. +# Copyright 2004,2005,2007,2008,2012,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -54,8 +54,8 @@ class my_top_block(gr.top_block): src0 = analog.sig_source_f(sample_rate, analog.GR_SIN_WAVE, 350, ampl) src1 = analog.sig_source_f(sample_rate, analog.GR_SIN_WAVE, 440, ampl) - head0 = gr.head(gr.sizeof_float, int(options.samples)) - head1 = gr.head(gr.sizeof_float, int(options.samples)) + head0 = blocks.head(gr.sizeof_float, int(options.samples)) + head1 = blocks.head(gr.sizeof_float, int(options.samples)) dst = blocks.wavfile_sink(args[0], 2, int(options.sample_rate), 16) self.connect(src0, head0, (dst, 0)) diff --git a/gr-audio/examples/python/spectrum_inversion.py b/gr-audio/examples/python/spectrum_inversion.py index 63d0c8cc8d..a02d6c5821 100755 --- a/gr-audio/examples/python/spectrum_inversion.py +++ b/gr-audio/examples/python/spectrum_inversion.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2004,2005,2007 Free Software Foundation, Inc. +# Copyright 2004,2005,2007,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -54,7 +54,7 @@ class my_top_block(gr.top_block): dst = audio.sink (sample_rate, options.audio_output) vec1 = [1, -1] - vsource = gr.vector_source_f(vec1, True) + vsource = blocks.vector_source_f(vec1, True) multiply = blocks.multiply_ff() self.connect(src, (multiply, 0)) diff --git a/gr-blocks/examples/CMakeLists.txt b/gr-blocks/examples/CMakeLists.txt index 0f9db57b63..c9829661b6 100644 --- a/gr-blocks/examples/CMakeLists.txt +++ b/gr-blocks/examples/CMakeLists.txt @@ -19,3 +19,7 @@ add_subdirectory(metadata) add_subdirectory(tags) + +if(ENABLE_GR_CTRLPORT) +add_subdirectory(ctrlport) +endif(ENABLE_GR_CTRLPORT) diff --git a/gnuradio-core/src/examples/ctrlport/CMakeLists.txt b/gr-blocks/examples/ctrlport/CMakeLists.txt index 47ef4c225e..47ef4c225e 100644 --- a/gnuradio-core/src/examples/ctrlport/CMakeLists.txt +++ b/gr-blocks/examples/ctrlport/CMakeLists.txt diff --git a/gnuradio-core/src/examples/ctrlport/comparing_resamplers.grc b/gr-blocks/examples/ctrlport/comparing_resamplers.grc index 4ac4af247f..7b90a2066c 100644 --- a/gnuradio-core/src/examples/ctrlport/comparing_resamplers.grc +++ b/gr-blocks/examples/ctrlport/comparing_resamplers.grc @@ -33,7 +33,7 @@ </param> </block> <block> - <key>gr_ctrlport_probe2_c</key> + <key>blocks_ctrlport_probe2_c</key> <param> <key>id</key> <value>probe_arc_resamp</value> @@ -126,7 +126,7 @@ </param> </block> <block> - <key>gr_ctrlport_probe2_c</key> + <key>blocks_ctrlport_probe2_c</key> <param> <key>id</key> <value>probe_frac_interp</value> diff --git a/gnuradio-core/src/examples/ctrlport/pfb_sync_test-qt.grc b/gr-blocks/examples/ctrlport/pfb_sync_test-qt.grc index 31914412bc..0d245089a5 100644 --- a/gnuradio-core/src/examples/ctrlport/pfb_sync_test-qt.grc +++ b/gr-blocks/examples/ctrlport/pfb_sync_test-qt.grc @@ -1,23 +1,59 @@ <?xml version='1.0' encoding='ASCII'?> <flow_graph> - <timestamp>Fri Mar 15 17:32:55 2013</timestamp> + <timestamp>Sun Mar 17 17:11:21 2013</timestamp> <block> - <key>variable</key> + <key>options</key> <param> <key>id</key> - <value>sps</value> + <value>pfb_sync_test_qt</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>value</key> - <value>2</value> + <key>title</key> + <value></value> + </param> + <param> + <key>author</key> + <value></value> + </param> + <param> + <key>description</key> + <value></value> + </param> + <param> + <key>window_size</key> + <value>1280,1024</value> + </param> + <param> + <key>generate_options</key> + <value>qt_gui</value> + </param> + <param> + <key>category</key> + <value>Custom</value> + </param> + <param> + <key>run_options</key> + <value>prompt</value> + </param> + <param> + <key>run</key> + <value>True</value> + </param> + <param> + <key>max_nouts</key> + <value>0</value> + </param> + <param> + <key>realtime_scheduling</key> + <value></value> </param> <param> <key>_coordinate</key> - <value>(105, 126)</value> + <value>(10, 10)</value> </param> <param> <key>_rotation</key> @@ -28,7 +64,7 @@ <key>variable</key> <param> <key>id</key> - <value>samp_rate</value> + <value>sps</value> </param> <param> <key>_enabled</key> @@ -36,11 +72,11 @@ </param> <param> <key>value</key> - <value>300000</value> + <value>2</value> </param> <param> <key>_coordinate</key> - <value>(14, 124)</value> + <value>(105, 126)</value> </param> <param> <key>_rotation</key> @@ -48,22 +84,22 @@ </param> </block> <block> - <key>import</key> + <key>variable</key> <param> <key>id</key> - <value>import_0</value> + <value>samp_rate</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>import</key> - <value>import random, math, cmath</value> + <key>value</key> + <value>300000</value> </param> <param> <key>_coordinate</key> - <value>(14, 77)</value> + <value>(14, 124)</value> </param> <param> <key>_rotation</key> @@ -71,22 +107,22 @@ </param> </block> <block> - <key>ctrlport_monitor</key> + <key>import</key> <param> <key>id</key> - <value>ctrlport_monitor_0</value> + <value>import_0</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>en</key> - <value>True</value> + <key>import</key> + <value>import random, math, cmath</value> </param> <param> <key>_coordinate</key> - <value>(175, 10)</value> + <value>(14, 77)</value> </param> <param> <key>_rotation</key> @@ -94,10 +130,10 @@ </param> </block> <block> - <key>gr_vector_source_x</key> + <key>blocks_vector_source_x</key> <param> <key>id</key> - <value>gr_vector_source_x_0</value> + <value>blocks_vector_source_x_0</value> </param> <param> <key>_enabled</key> @@ -112,6 +148,10 @@ <value>0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50</value> </param> <param> + <key>tags</key> + <value>[]</value> + </param> + <param> <key>repeat</key> <value>True</value> </param> @@ -460,7 +500,7 @@ </param> </block> <block> - <key>gr_ctrlport_probe2_c</key> + <key>blocks_ctrlport_probe2_c</key> <param> <key>id</key> <value>received_probe2</value> @@ -546,7 +586,7 @@ </param> </block> <block> - <key>gr_ctrlport_probe2_c</key> + <key>blocks_ctrlport_probe2_c</key> <param> <key>id</key> <value>time_probe2</value> @@ -659,10 +699,10 @@ </param> </block> <block> - <key>gr_null_sink</key> + <key>blocks_null_sink</key> <param> <key>id</key> - <value>gr_null_sink_0</value> + <value>blocks_null_sink_0</value> </param> <param> <key>_enabled</key> @@ -686,7 +726,7 @@ </param> </block> <block> - <key>gr_ctrlport_probe2_c</key> + <key>blocks_ctrlport_probe2_c</key> <param> <key>id</key> <value>phase_probe2</value> @@ -716,65 +756,6 @@ <value>0</value> </param> </block> - <block> - <key>options</key> - <param> - <key>id</key> - <value>pfb_sync_test_qt</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>title</key> - <value></value> - </param> - <param> - <key>author</key> - <value></value> - </param> - <param> - <key>description</key> - <value></value> - </param> - <param> - <key>window_size</key> - <value>1280,1024</value> - </param> - <param> - <key>generate_options</key> - <value>qt_gui</value> - </param> - <param> - <key>category</key> - <value>Custom</value> - </param> - <param> - <key>run_options</key> - <value>prompt</value> - </param> - <param> - <key>run</key> - <value>True</value> - </param> - <param> - <key>max_nouts</key> - <value>0</value> - </param> - <param> - <key>realtime_scheduling</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(10, 10)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> <connection> <source_block_id>blocks_throttle_0</source_block_id> <sink_block_id>digital_psk_mod_0</sink_block_id> @@ -795,7 +776,7 @@ </connection> <connection> <source_block_id>digital_costas_loop_cc_0</source_block_id> - <sink_block_id>gr_null_sink_0</sink_block_id> + <sink_block_id>blocks_null_sink_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> @@ -824,7 +805,7 @@ <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_vector_source_x_0</source_block_id> + <source_block_id>blocks_vector_source_x_0</source_block_id> <sink_block_id>blocks_packed_to_unpacked_xx_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> diff --git a/gnuradio-core/src/examples/ctrlport/pfb_sync_test.grc b/gr-blocks/examples/ctrlport/pfb_sync_test.grc index 5b0bfeb793..da63b4f5b3 100644 --- a/gnuradio-core/src/examples/ctrlport/pfb_sync_test.grc +++ b/gr-blocks/examples/ctrlport/pfb_sync_test.grc @@ -226,10 +226,10 @@ </param> </block> <block> - <key>gr_null_sink</key> + <key>blocks_null_sink</key> <param> <key>id</key> - <value>gr_null_sink_0</value> + <value>blocks_null_sink_0</value> </param> <param> <key>_enabled</key> @@ -637,7 +637,7 @@ </connection> <connection> <source_block_id>digital_costas_loop_cc_0</source_block_id> - <sink_block_id>gr_null_sink_0</sink_block_id> + <sink_block_id>blocks_null_sink_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> diff --git a/gr-blocks/examples/metadata/file_metadata_sink.grc b/gr-blocks/examples/metadata/file_metadata_sink.grc index 198b0725f9..1328fb7978 100644 --- a/gr-blocks/examples/metadata/file_metadata_sink.grc +++ b/gr-blocks/examples/metadata/file_metadata_sink.grc @@ -845,10 +845,10 @@ </param> </block> <block> - <key>gr_head</key> + <key>blocks_head</key> <param> <key>id</key> - <value>gr_head_0</value> + <value>blocks_head_0</value> </param> <param> <key>_enabled</key> @@ -932,18 +932,18 @@ </block> <connection> <source_block_id>gr_sig_source_x_0</source_block_id> - <sink_block_id>gr_head_0</sink_block_id> + <sink_block_id>blocks_head_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> <source_block_id>uhd_usrp_source_0</source_block_id> - <sink_block_id>gr_head_0</sink_block_id> + <sink_block_id>blocks_head_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_head_0</source_block_id> + <source_block_id>blocks_head_0</source_block_id> <sink_block_id>blocks_file_meta_sink_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> diff --git a/gr-blocks/examples/metadata/file_metadata_vector_sink.grc b/gr-blocks/examples/metadata/file_metadata_vector_sink.grc index 05b7cbc922..ebc4812e56 100644 --- a/gr-blocks/examples/metadata/file_metadata_vector_sink.grc +++ b/gr-blocks/examples/metadata/file_metadata_vector_sink.grc @@ -84,10 +84,10 @@ </param> </block> <block> - <key>gr_vector_source_x</key> + <key>blocks_vector_source_x</key> <param> <key>id</key> - <value>gr_vector_source_x_0</value> + <value>blocks_vector_source_x_0</value> </param> <param> <key>_enabled</key> @@ -119,10 +119,10 @@ </param> </block> <block> - <key>gr_head</key> + <key>blocks_head</key> <param> <key>id</key> - <value>gr_head_0</value> + <value>blocks_head_0</value> </param> <param> <key>_enabled</key> @@ -205,13 +205,13 @@ </param> </block> <connection> - <source_block_id>gr_vector_source_x_0</source_block_id> - <sink_block_id>gr_head_0</sink_block_id> + <source_block_id>blocks_vector_source_x_0</source_block_id> + <sink_block_id>blocks_head_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_head_0</source_block_id> + <source_block_id>blocks_head_0</source_block_id> <sink_block_id>blocks_file_meta_sink_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> diff --git a/gr-blocks/examples/msg_passing/strobe.grc b/gr-blocks/examples/msg_passing/strobe.grc index d9d4ce43cb..a918332ce8 100644 --- a/gr-blocks/examples/msg_passing/strobe.grc +++ b/gr-blocks/examples/msg_passing/strobe.grc @@ -90,10 +90,10 @@ </param> </block> <block> - <key>gr_kludge_copy</key> + <key>blocks_copy</key> <param> <key>id</key> - <value>gr_kludge_copy_0</value> + <value>blocks_copy_0</value> </param> <param> <key>_enabled</key> @@ -252,14 +252,14 @@ <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_kludge_copy_0</source_block_id> + <source_block_id>blocks_copy_0</source_block_id> <sink_block_id>gr_tagged_stream_to_pdu_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> <source_block_id>gr_pdu_to_tagged_stream_0</source_block_id> - <sink_block_id>gr_kludge_copy_0</sink_block_id> + <sink_block_id>blocks_copy_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> diff --git a/gr-blocks/examples/tags/test_file_tags.py b/gr-blocks/examples/tags/test_file_tags.py index 92112325b2..758623de98 100755 --- a/gr-blocks/examples/tags/test_file_tags.py +++ b/gr-blocks/examples/tags/test_file_tags.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2011 Free Software Foundation, Inc. +# Copyright 2011,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -34,11 +34,11 @@ def main(): data = scipy.arange(0, 32000, 1).tolist() trig = 100*[0,] + 100*[1,] - src = gr.vector_source_s(data, True) - trigger = gr.vector_source_s(trig, True) + src = blocks.vector_source_s(data, True) + trigger = blocks.vector_source_s(trig, True) thr = blocks.throttle(gr.sizeof_short, 10e3) - ann = gr.annotator_alltoall(1000000, gr.sizeof_short) + ann = blocks.annotator_alltoall(1000000, gr.sizeof_short) tagger = blocks..burst_tagger(gr.sizeof_short) fsnk = blocks.tagged_file_sink(gr.sizeof_short, 1) diff --git a/gr-blocks/grc/CMakeLists.txt b/gr-blocks/grc/CMakeLists.txt index ed66d9e3b2..48cdd5859a 100644 --- a/gr-blocks/grc/CMakeLists.txt +++ b/gr-blocks/grc/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright 2012 Free Software Foundation, Inc. +# Copyright 2012-2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -19,4 +19,14 @@ ######################################################################## file(GLOB xml_files "*.xml") + +# Force out the controlport GRC blocks if we've disabled it. +if(NOT ENABLE_GR_CTRLPORT) + list(REMOVE_ITEM xml_files + ${CMAKE_CURRENT_SOURCE_DIR}/ctrlport_viewer.xml + ${CMAKE_CURRENT_SOURCE_DIR}/ctrlport_probe_c.xml + ${CMAKE_CURRENT_SOURCE_DIR}/ctrlport_probe2_c.xml + ) +endif(NOT ENABLE_GR_CTRLPORT) + install(FILES ${xml_files} DESTINATION ${GRC_BLOCKS_DIR} COMPONENT "blocks_python") diff --git a/gr-blocks/grc/blocks_block_tree.xml b/gr-blocks/grc/blocks_block_tree.xml index 90d94bdb29..face908df0 100644 --- a/gr-blocks/grc/blocks_block_tree.xml +++ b/gr-blocks/grc/blocks_block_tree.xml @@ -39,6 +39,8 @@ <block>blocks_message_burst_source</block> <block>blocks_udp_source</block> <block>blocks_wavfile_source</block> + <block>blocks_vector_source_x</block> + <block>blocks_null_source</block> </cat> <cat> <name>Sinks (New)</name> @@ -51,6 +53,8 @@ <block>blocks_tagged_file_sink</block> <block>blocks_udp_sink</block> <block>blocks_wavfile_sink</block> + <block>blocks_vector_sink_x</block> + <block>blocks_null_sink</block> </cat> <cat> <name>Math Operations (New) </name> @@ -123,6 +127,8 @@ <block>blocks_stretch_ff</block> <block>blocks_threshold_ff</block> <block>blocks_burst_tagger</block> + <block>blocks_endian_swap</block> + <block>blocks_vector_insert_x</block> </cat> <cat> <name>Misc Conversions (New) </name> @@ -135,6 +141,10 @@ <name>Misc (New) </name> <block>blocks_throttle</block> <block>blocks_probe_rate</block> + <block>blocks_head</block> + <block>blocks_skiphead</block> + <block>blocks_copy</block> + <block>blocks_nop</block> </cat> <cat> <name>Networking</name> diff --git a/grc/blocks/gr_copy.xml b/gr-blocks/grc/blocks_copy.xml index 8b12eaca78..55c4b343d3 100644 --- a/grc/blocks/gr_copy.xml +++ b/gr-blocks/grc/blocks_copy.xml @@ -6,9 +6,9 @@ --> <block> <name>Copy</name> - <key>gr_copy</key> - <import>from gnuradio import gr</import> - <make>gr.copy($type.size*$vlen) + <key>blocks_copy</key> + <import>from gnuradio import blocks</import> + <make>blocks.copy($type.size*$vlen) self.$(id).set_enabled($enabled)</make> <callback>set_enabled($enabled)</callback> <param> diff --git a/grc/blocks/gr_ctrlport_probe2_c.xml b/gr-blocks/grc/blocks_ctrlport_probe2_c.xml index bdf77084dd..34f6dc0f50 100644 --- a/grc/blocks/gr_ctrlport_probe2_c.xml +++ b/gr-blocks/grc/blocks_ctrlport_probe2_c.xml @@ -23,10 +23,10 @@ <block> <name>Ctrlport Complex Probe (fixed len)</name> - <key>gr_ctrlport_probe2_c</key> + <key>blocks_ctrlport_probe2_c</key> <category>Control Port</category> - <import>from gnuradio import gr</import> - <make>gr.ctrlport_probe2_c($name, $desc, $len)</make> + <import>from gnuradio import blocks</import> + <make>blocks.ctrlport_probe2_c($name, $desc, $len)</make> <callback>set_length($len)</callback> <param> diff --git a/grc/blocks/gr_ctrlport_probe_c.xml b/gr-blocks/grc/blocks_ctrlport_probe_c.xml index 17cfdd1466..3b17823931 100644 --- a/grc/blocks/gr_ctrlport_probe_c.xml +++ b/gr-blocks/grc/blocks_ctrlport_probe_c.xml @@ -23,10 +23,10 @@ <block> <name>Ctrlport Complex Probe</name> - <key>gr_ctrlport_probe_c</key> + <key>blocks_ctrlport_probe_c</key> <category>Control Port</category> - <import>from gnuradio import gr</import> - <make>gr.ctrlport_probe_c($name, $desc)</make> + <import>from gnuradio import blocks</import> + <make>blocks.ctrlport_probe_c($name, $desc)</make> <param> <name>Name</name> diff --git a/grc/blocks/gr_ctrlport_viewer.xml b/gr-blocks/grc/blocks_ctrlport_viewer.xml index e7d8d4c2d4..99abd6d4bd 100644 --- a/grc/blocks/gr_ctrlport_viewer.xml +++ b/gr-blocks/grc/blocks_ctrlport_viewer.xml @@ -23,7 +23,7 @@ <block> <name>CtrlPort Monitor</name> - <key>ctrlport_monitor</key> + <key>blocks_ctrlport_monitor</key> <category>Control Port</category> <import>from gnuradio.ctrlport.monitor import *</import> <make>not $en or monitor()</make> diff --git a/grc/blocks/gr_endian_swap.xml b/gr-blocks/grc/blocks_endian_swap.xml index aa564026cd..5fea420664 100644 --- a/grc/blocks/gr_endian_swap.xml +++ b/gr-blocks/grc/blocks_endian_swap.xml @@ -7,9 +7,9 @@ --> <block> <name>Endian Swap</name> - <key>gr_endian_swap</key> - <import>from gnuradio import gr</import> - <make>gr.endian_swap($type.size)</make> + <key>blocks_endian_swap</key> + <import>from gnuradio import blocks</import> + <make>blocks.endian_swap($type.size)</make> <param> <name>IO Type</name> <key>type</key> diff --git a/grc/blocks/gr_head.xml b/gr-blocks/grc/blocks_head.xml index e5ff7f6aad..8b6e67820c 100644 --- a/grc/blocks/gr_head.xml +++ b/gr-blocks/grc/blocks_head.xml @@ -6,9 +6,9 @@ --> <block> <name>Head</name> - <key>gr_head</key> - <import>from gnuradio import gr</import> - <make>gr.head($type.size*$vlen, $num_items)</make> + <key>blocks_head</key> + <import>from gnuradio import blocks</import> + <make>blocks.head($type.size*$vlen, $num_items)</make> <param> <name>Type</name> <key>type</key> diff --git a/grc/blocks/gr_nop.xml b/gr-blocks/grc/blocks_nop.xml index bd884d6b8b..d38c23839d 100644 --- a/grc/blocks/gr_nop.xml +++ b/gr-blocks/grc/blocks_nop.xml @@ -6,9 +6,9 @@ --> <block> <name>Nop</name> - <key>gr_nop</key> - <import>from gnuradio import gr</import> - <make>gr.nop($type.size*$vlen)</make> + <key>blocks_nop</key> + <import>from gnuradio import blocks</import> + <make>blocks.nop($type.size*$vlen)</make> <param> <name>Type</name> <key>type</key> diff --git a/grc/blocks/gr_null_sink.xml b/gr-blocks/grc/blocks_null_sink.xml index ed106b4950..2ae20e619a 100644 --- a/grc/blocks/gr_null_sink.xml +++ b/gr-blocks/grc/blocks_null_sink.xml @@ -6,9 +6,9 @@ --> <block> <name>Null Sink</name> - <key>gr_null_sink</key> - <import>from gnuradio import gr</import> - <make>gr.null_sink($type.size*$vlen)</make> + <key>blocks_null_sink</key> + <import>from gnuradio import blocks</import> + <make>blocks.null_sink($type.size*$vlen)</make> <param> <name>Input Type</name> <key>type</key> diff --git a/grc/blocks/gr_null_source.xml b/gr-blocks/grc/blocks_null_source.xml index 6132eae3cb..01d3905cab 100644 --- a/grc/blocks/gr_null_source.xml +++ b/gr-blocks/grc/blocks_null_source.xml @@ -6,9 +6,9 @@ --> <block> <name>Null Source</name> - <key>gr_null_source</key> - <import>from gnuradio import gr</import> - <make>gr.null_source($type.size*$vlen)</make> + <key>blocks_null_source</key> + <import>from gnuradio import blocks</import> + <make>blocks.null_source($type.size*$vlen)</make> <param> <name>Output Type</name> <key>type</key> diff --git a/grc/blocks/gr_skiphead.xml b/gr-blocks/grc/blocks_skiphead.xml index 0849ad2981..7d90862830 100644 --- a/grc/blocks/gr_skiphead.xml +++ b/gr-blocks/grc/blocks_skiphead.xml @@ -6,9 +6,9 @@ --> <block> <name>Skip Head</name> - <key>gr_skiphead</key> - <import>from gnuradio import gr</import> - <make>gr.skiphead($type.size*$vlen, $num_items)</make> + <key>blocks_skiphead</key> + <import>from gnuradio import blocks</import> + <make>blocks.skiphead($type.size*$vlen, $num_items)</make> <param> <name>Type</name> <key>type</key> diff --git a/grc/blocks/gr_vector_insert_x.xml b/gr-blocks/grc/blocks_vector_insert_x.xml index f9ce1f6544..2bc7ada2e6 100644 --- a/grc/blocks/gr_vector_insert_x.xml +++ b/gr-blocks/grc/blocks_vector_insert_x.xml @@ -6,9 +6,9 @@ --> <block> <name>Vector Insert</name> - <key>gr_vector_insert_x</key> - <import>from gnuradio import gr</import> - <make>gr.vector_insert_$(type.fcn)($vector, $period, $offset)</make> + <key>blocks_vector_insert_x</key> + <import>from gnuradio import blocks</import> + <make>blocks.vector_insert_$(type.fcn)($vector, $period, $offset)</make> <param> <name>Output Type</name> <key>type</key> diff --git a/grc/blocks/gr_vector_sink_x.xml b/gr-blocks/grc/blocks_vector_sink_x.xml index 3bd998698f..7f51731975 100644 --- a/grc/blocks/gr_vector_sink_x.xml +++ b/gr-blocks/grc/blocks_vector_sink_x.xml @@ -6,9 +6,9 @@ --> <block> <name>Vector Sink</name> - <key>gr_vector_sink_x</key> - <import>from gnuradio import gr</import> - <make>gr.vector_sink_$(type.fcn)($vlen)</make> + <key>blocks_vector_sink_x</key> + <import>from gnuradio import blocks</import> + <make>blocks.vector_sink_$(type.fcn)($vlen)</make> <param> <name>Input Type</name> <key>type</key> diff --git a/grc/blocks/gr_vector_source_x.xml b/gr-blocks/grc/blocks_vector_source_x.xml index 992a6a787d..5221c4f3eb 100644 --- a/grc/blocks/gr_vector_source_x.xml +++ b/gr-blocks/grc/blocks_vector_source_x.xml @@ -6,10 +6,9 @@ --> <block> <name>Vector Source</name> - <key>gr_vector_source_x</key> - <import>from gnuradio import gr</import> - <make>gr.vector_source_$(type.fcn)($vector, $repeat, $vlen, $tags) - </make> + <key>blocks_vector_source_x</key> + <import>from gnuradio import blocks</import> + <make>blocks.vector_source_$(type.fcn)($vector, $repeat, $vlen, $tags)</make> <param> <name>Output Type</name> <key>type</key> @@ -48,7 +47,7 @@ <param> <name>Vector</name> <key>vector</key> - <value>0, 0, 0</value> + <value>[0, 0, 0]</value> <type>raw</type> </param> <param> diff --git a/gr-blocks/include/blocks/CMakeLists.txt b/gr-blocks/include/blocks/CMakeLists.txt index 0f158ff473..e551468463 100644 --- a/gr-blocks/include/blocks/CMakeLists.txt +++ b/gr-blocks/include/blocks/CMakeLists.txt @@ -88,6 +88,9 @@ expand_h(sub_XX ss ii ff cc) expand_h(xor_XX bb ss ii) expand_h(packed_to_unpacked_XX bb ss ii) expand_h(unpacked_to_packed_XX bb ss ii) +expand_h(vector_insert_X b s i f c) +expand_h(vector_sink_X b s i f c) +expand_h(vector_source_X b s i f c) add_custom_target(blocks_generated_includes DEPENDS ${generated_includes} @@ -106,10 +109,14 @@ install(FILES fxpt_nco.h fxpt_vco.h log2_const.h + rotator.h nco.h vco.h wavfile.h add_ff.h + annotator_1to1.h + annotator_alltoall.h + annotator_raw.h bin_statistics_f.h burst_tagger.h char_to_float.h @@ -122,8 +129,10 @@ install(FILES complex_to_mag_squared.h complex_to_arg.h conjugate_cc.h + copy.h deinterleave.h delay.h + endian_swap.h file_source.h file_meta_sink.h file_meta_source.h @@ -132,6 +141,7 @@ install(FILES float_to_int.h float_to_short.h float_to_uchar.h + head.h int_to_float.h interleave.h interleaved_short_to_complex.h @@ -148,6 +158,9 @@ install(FILES multiply_const_cc.h multiply_const_ff.h nlog10_ff.h + nop.h + null_sink.h + null_source.h pack_k_bits_bb.h patterned_interleaver.h pdu.h @@ -162,6 +175,7 @@ install(FILES rms_ff.h short_to_char.h short_to_float.h + skiphead.h socket_pdu.h stream_mux.h stream_to_streams.h @@ -182,6 +196,7 @@ install(FILES udp_source.h unpack_k_bits_bb.h vco_f.h + vector_map.h vector_to_stream.h vector_to_streams.h wavfile_sink.h @@ -189,3 +204,12 @@ install(FILES DESTINATION ${GR_INCLUDE_DIR}/gnuradio/blocks COMPONENT "blocks_devel" ) + +if(ENABLE_GR_CTRLPORT) +install(FILES + ctrlport_probe_c.h + ctrlport_probe2_c.h + DESTINATION ${GR_INCLUDE_DIR}/gnuradio/blocks + COMPONENT "blocks_devel" +) +endif(ENABLE_GR_CTRLPORT) diff --git a/gr-blocks/include/blocks/annotator_1to1.h b/gr-blocks/include/blocks/annotator_1to1.h new file mode 100644 index 0000000000..6cc8db6eef --- /dev/null +++ b/gr-blocks/include/blocks/annotator_1to1.h @@ -0,0 +1,60 @@ +/* -*- c++ -*- */ +/* + * Copyright 2010,2013 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio 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 3, or (at your option) + * any later version. + * + * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_GR_ANNOTATOR_1TO1_H +#define INCLUDED_GR_ANNOTATOR_1TO1_H + +#include <blocks/api.h> +#include <gr_sync_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief 1-to-1 stream annotator testing block. FOR TESTING PURPOSES ONLY. + * + * This block creates tags to be sent downstream every 10,000 + * items it sees. The tags contain the name and ID of the + * instantiated block, use "seq" as a key, and have a counter that + * increments by 1 for every tag produced that is used as the + * tag's value. The tags are propagated using the 1-to-1 policy. + * + * It also stores a copy of all tags it sees flow past it. These + * tags can be recalled externally with the data() member. + * + * This block is only meant for testing and showing how to use the tags. + */ + class BLOCKS_API annotator_1to1 : virtual public gr_sync_block + { + public: + // gr::blocks::annotator_1to1::sptr + typedef boost::shared_ptr<annotator_1to1> sptr; + + static sptr make(int when, size_t sizeof_stream_item); + + virtual std::vector<gr_tag_t> data() const = 0; + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_GR_ANNOTATOR_1TO1_H */ diff --git a/gr-blocks/include/blocks/annotator_alltoall.h b/gr-blocks/include/blocks/annotator_alltoall.h new file mode 100644 index 0000000000..558aea69ca --- /dev/null +++ b/gr-blocks/include/blocks/annotator_alltoall.h @@ -0,0 +1,61 @@ +/* -*- c++ -*- */ +/* + * Copyright 2010,2013 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio 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 3, or (at your option) + * any later version. + * + * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_GR_ANNOTATOR_ALLTOALL_H +#define INCLUDED_GR_ANNOTATOR_ALLTOALL_H + +#include <blocks/api.h> +#include <gr_sync_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief All-to-all stream annotator testing block. FOR TESTING PURPOSES ONLY. + * + * This block creates tags to be sent downstream every 10,000 + * items it sees. The tags contain the name and ID of the + * instantiated block, use "seq" as a key, and have a counter that + * increments by 1 for every tag produced that is used as the + * tag's value. The tags are propagated using the all-to-all + * policy. + * + * It also stores a copy of all tags it sees flow past it. These + * tags can be recalled externally with the data() member. + * + * This block is only meant for testing and showing how to use the tags. + */ + class BLOCKS_API annotator_alltoall : virtual public gr_sync_block + { + public: + // gr::blocks::annotator_alltoall::sptr + typedef boost::shared_ptr<annotator_alltoall> sptr; + + static sptr make(int when, size_t sizeof_stream_item); + + virtual std::vector<gr_tag_t> data() const = 0; + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_GR_ANNOTATOR_ALLTOALL_H */ diff --git a/gr-blocks/include/blocks/annotator_raw.h b/gr-blocks/include/blocks/annotator_raw.h new file mode 100644 index 0000000000..e835f0bd8d --- /dev/null +++ b/gr-blocks/include/blocks/annotator_raw.h @@ -0,0 +1,57 @@ +/* -*- c++ -*- */ +/* + * Copyright 2010,2013 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio 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 3, or (at your option) + * any later version. + * + * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_GR_ANNOTATOR_RAW_H +#define INCLUDED_GR_ANNOTATOR_RAW_H + +#include <blocks/api.h> +#include <gr_sync_block.h> +#include <gr_tags.h> + +namespace gr { + namespace blocks { + + /*! + * \brief raw stream annotator testing block. + * + * This block creates arbitrary tags to be sent downstream blocks + * to be sent are set manually via accessor methods and are sent + * only once. + * + * This block is intended for testing of tag related blocks + */ + class BLOCKS_API annotator_raw : virtual public gr_sync_block + { + public: + // gr::blocks::annotator_raw::sptr + typedef boost::shared_ptr<annotator_raw> sptr; + + static sptr make(size_t sizeof_stream_item); + + // insert a tag to be added + void add_tag(uint64_t offset, pmt::pmt_t key, pmt::pmt_t val); + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_GR_ANNOTATOR_RAW_H */ diff --git a/gr-blocks/include/blocks/copy.h b/gr-blocks/include/blocks/copy.h new file mode 100644 index 0000000000..5ed0ea0e92 --- /dev/null +++ b/gr-blocks/include/blocks/copy.h @@ -0,0 +1,54 @@ +/* -*- c++ -*- */ +/* + * Copyright 2006,2009,2013 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio 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 3, or (at your option) + * any later version. + * + * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_GR_COPY_H +#define INCLUDED_GR_COPY_H + +#include <blocks/api.h> +#include <gr_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief output[i] = input[i] + * \ingroup misc_blk + * + * When enabled (default), this block copies its input to its + * output. When disabled, this block drops its input on the floor. + */ + class BLOCKS_API copy : virtual public gr_block + { + public: + // gr::blocks::copy::sptr + typedef boost::shared_ptr<copy> sptr; + + static sptr make(size_t itemsize); + + virtual void set_enabled(bool enable) = 0; + virtual bool enabled() const = 0; + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_GR_COPY_H */ diff --git a/gr-blocks/include/blocks/ctrlport_probe2_c.h b/gr-blocks/include/blocks/ctrlport_probe2_c.h new file mode 100644 index 0000000000..9a6034fcca --- /dev/null +++ b/gr-blocks/include/blocks/ctrlport_probe2_c.h @@ -0,0 +1,64 @@ +/* -*- c++ -*- */ +/* + * Copyright 2012-2013 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio 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 3, or (at your option) + * any later version. + * + * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_CTRLPORT_PROBE2_C_H +#define INCLUDED_CTRLPORT_PROBE2_C_H + +#include <blocks/api.h> +#include <gr_sync_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief A ControlPort probe to export vectors of signals. + * + * This block acts as a sink in the flowgraph but also exports + * vectors of complex samples over ControlPort. This block holds + * the latest \p len number of complex samples so that every query + * by a ControlPort client will get the same length vector. + */ + class BLOCKS_API ctrlport_probe2_c : virtual public gr_sync_block + { + public: + // gr::blocks::ctrlport_probe2_c::sptr + typedef boost::shared_ptr<ctrlport_probe2_c> sptr; + + /*! + * \brief Make a ControlPort probe block. + * \param id A string ID to name the probe over ControlPort. + * \param desc A string describing the probe. + * \param len Number of samples to transmit. + */ + static sptr make(const std::string &id, const std::string &desc, int len); + + virtual std::vector<gr_complex> get() = 0; + + virtual void set_length(int len) = 0; + virtual int length() const = 0; + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_CTRLPORT_PROBE2_C_H */ + diff --git a/gnuradio-core/src/lib/general/gr_ctrlport_probe_c.h b/gr-blocks/include/blocks/ctrlport_probe_c.h index 27666ab597..92fe8c5600 100644 --- a/gnuradio-core/src/lib/general/gr_ctrlport_probe_c.h +++ b/gr-blocks/include/blocks/ctrlport_probe_c.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2012 Free Software Foundation, Inc. + * Copyright 2012-2013 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -23,43 +23,40 @@ #ifndef INCLUDED_CTRLPORT_PROBE_C_H #define INCLUDED_CTRLPORT_PROBE_C_H -#include <gr_core_api.h> +#include <blocks/api.h> #include <gr_sync_block.h> #include <rpcregisterhelpers.h> #include <boost/thread/shared_mutex.hpp> -class gr_ctrlport_probe_c; -typedef boost::shared_ptr<gr_ctrlport_probe_c> gr_ctrlport_probe_c_sptr; - -GR_CORE_API gr_ctrlport_probe_c_sptr -gr_make_ctrlport_probe_c(const std::string &id, const std::string &desc); - -class GR_CORE_API gr_ctrlport_probe_c : public gr_sync_block -{ - private: - friend GR_CORE_API gr_ctrlport_probe_c_sptr gr_make_ctrlport_probe_c - (const std::string &id, const std::string &desc); - - gr_ctrlport_probe_c(const std::string &id, const std::string &desc); - - boost::shared_mutex ptrlock; - - std::string d_id; - std::string d_desc; - const gr_complex* d_ptr; - size_t d_ptrLen; - - public: - ~gr_ctrlport_probe_c(); - - void setup_rpc(); - - std::vector<gr_complex> get(); - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; +namespace gr { + namespace blocks { + + /*! + * \brief A ControlPort probe to export vectors of signals. + * + * This block acts as a sink in the flowgraph but also exports + * vectors of complex samples over ControlPort. This block simply + * sends the current vector held in the work function when the + * queried by a ControlPort client. + */ + class BLOCKS_API ctrlport_probe_c : virtual public gr_sync_block + { + public: + // gr::blocks::ctrlport_probe_c::sptr + typedef boost::shared_ptr<ctrlport_probe_c> sptr; + + /*! + * \brief Make a ControlPort probe block. + * \param id A string ID to name the probe over ControlPort. + * \param desc A string describing the probe. + */ + static sptr make(const std::string &id, const std::string &desc); + + virtual std::vector<gr_complex> get() = 0; + }; + + } /* namespace blocks */ +} /* namespace gr */ #endif /* INCLUDED_CTRLPORT_GR_CTRLPORT_PROBE_C_H */ diff --git a/gnuradio-core/src/lib/general/gr_endian_swap.h b/gr-blocks/include/blocks/endian_swap.h index 0baa3f3389..4b5a76218e 100644 --- a/gnuradio-core/src/lib/general/gr_endian_swap.h +++ b/gr-blocks/include/blocks/endian_swap.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2004,2012 Free Software Foundation, Inc. + * Copyright 2004,2012,2013 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -23,35 +23,28 @@ #ifndef INCLUDED_GR_ENDIAN_SWAP_H #define INCLUDED_GR_ENDIAN_SWAP_H -#include <gr_core_api.h> +#include <blocks/api.h> #include <gr_sync_block.h> -class gr_endian_swap; -typedef boost::shared_ptr<gr_endian_swap> gr_endian_swap_sptr; - -GR_CORE_API gr_endian_swap_sptr -gr_make_endian_swap (size_t item_size_bytes=1); - -/*! - * \brief Convert stream of items into thier byte swapped version - * - * \param item_size_bytes number of bytes per item, 1=no-op,2=uint16_t,4=uint32_t,8=uint64_t - */ - -class GR_CORE_API gr_endian_swap : public gr_sync_block -{ - private: - friend GR_CORE_API gr_endian_swap_sptr - gr_make_endian_swap (size_t item_size_bytes); - gr_endian_swap (size_t item_size_bytes); - - size_t item_size_bytes; - - public: - virtual int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - +namespace gr { + namespace blocks { + + /*! + * \brief Convert stream of items into thier byte swapped version + * + * \param item_size_bytes number of bytes per item, 1=no-op, + * 2=uint16_t, 4=uint32_t, 8=uint64_t + */ + class BLOCKS_API endian_swap : virtual public gr_sync_block + { + public: + // gr::blocks::endian_swap::sptr + typedef boost::shared_ptr<endian_swap> sptr; + + static sptr make(size_t item_size_bytes=1); + }; + + } /* namespace blocks */ +} /* namespace gr */ #endif /* INCLUDED_GR_ENDIAN_SWAP_H */ diff --git a/gnuradio-core/src/lib/general/gr_head.h b/gr-blocks/include/blocks/head.h index 48415892dd..cc7d3808e5 100644 --- a/gnuradio-core/src/lib/general/gr_head.h +++ b/gr-blocks/include/blocks/head.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2004,2009,2012 Free Software Foundation, Inc. + * Copyright 2004,2009,2012,2013 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -23,39 +23,33 @@ #ifndef INCLUDED_GR_HEAD_H #define INCLUDED_GR_HEAD_H -#include <gr_core_api.h> +#include <blocks/api.h> #include <gr_sync_block.h> #include <stddef.h> // size_t -class gr_head; -typedef boost::shared_ptr<gr_head> gr_head_sptr; - -/*! - * \brief copies the first N items to the output then signals done - * \ingroup slicedice_blk - * - * Useful for building test cases - */ - -class GR_CORE_API gr_head : public gr_sync_block -{ - friend GR_CORE_API 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); - - unsigned long long d_nitems; - unsigned long long d_ncopied_items; - - public: - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - void reset() { d_ncopied_items = 0; } - void set_length(int nitems) { d_nitems = nitems; } -}; - -GR_CORE_API gr_head_sptr -gr_make_head (size_t sizeof_stream_item, unsigned long long nitems); - +namespace gr { + namespace blocks { + + /*! + * \brief copies the first N items to the output then signals done + * \ingroup slicedice_blk + * + * Useful for building test cases + */ + class BLOCKS_API head : virtual public gr_sync_block + { + public: + // gr::blocks::head::sptr + typedef boost::shared_ptr<head> sptr; + + static sptr make(size_t sizeof_stream_item, + uint64_t nitems); + + virtual void reset() = 0; + virtual void set_length(int nitems) = 0; + }; + + } /* namespace blocks */ +} /* namespace gr */ #endif /* INCLUDED_GR_HEAD_H */ diff --git a/gr-blocks/include/blocks/nop.h b/gr-blocks/include/blocks/nop.h new file mode 100644 index 0000000000..a75adad621 --- /dev/null +++ b/gr-blocks/include/blocks/nop.h @@ -0,0 +1,59 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2010,2013 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio 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 3, or (at your option) + * any later version. + * + * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_GR_NOP_H +#define INCLUDED_GR_NOP_H + +#include <blocks/api.h> +#include <gr_block.h> +#include <stddef.h> // size_t + +namespace gr { + namespace blocks { + + /*! + * \brief Does nothing. Used for testing only. + * \ingroup misc_blk + */ + class BLOCKS_API nop : virtual public gr_block + { + public: + // gr::blocks::nop::sptr + typedef boost::shared_ptr<nop> sptr; + + /*! + * Build a nop block. + * + * \param sizeof_stream_item size of the stream items in bytes. + */ + static sptr make(size_t sizeof_stream_item); + + virtual int nmsgs_received() const = 0; + + virtual int ctrlport_test() const = 0; + virtual void set_ctrlport_test(int x) = 0; + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_GR_NOP_H */ diff --git a/gnuradio-core/src/lib/general/gr_null_sink.h b/gr-blocks/include/blocks/null_sink.h index 7374293295..c13a7552c6 100644 --- a/gnuradio-core/src/lib/general/gr_null_sink.h +++ b/gr-blocks/include/blocks/null_sink.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2004,2010 Free Software Foundation, Inc. + * Copyright 2004,2010,2013 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -23,31 +23,33 @@ #ifndef INCLUDED_GR_NULL_SINK_H #define INCLUDED_GR_NULL_SINK_H -#include <gr_core_api.h> +#include <blocks/api.h> #include <gr_sync_block.h> #include <stddef.h> // size_t -class gr_null_sink; -typedef boost::shared_ptr<gr_null_sink> gr_null_sink_sptr; - -GR_CORE_API gr_null_sink_sptr -gr_make_null_sink (size_t sizeof_stream_item); - -/*! - * \brief Bit bucket - * \ingroup sink_blk - */ -class GR_CORE_API gr_null_sink : public gr_sync_block -{ - friend GR_CORE_API gr_null_sink_sptr gr_make_null_sink (size_t sizeof_stream_item); - gr_null_sink (size_t sizeof_stream_item); - - public: - - virtual int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - -}; +namespace gr { + namespace blocks { + + /*! + * \brief Bit bucket. Use as a termination point when a sink is + * required and we don't want to do anything real. + * \ingroup sink_blk + */ + class BLOCKS_API null_sink : virtual public gr_sync_block + { + public: + // gr::blocks::null_sink::sptr + typedef boost::shared_ptr<null_sink> sptr; + + /*! + * Build a null sink block. + * + * \param sizeof_stream_item size of the stream items in bytes. + */ + static sptr make(size_t sizeof_stream_item); + }; + + } /* namespace blocks */ +} /* namespace gr */ #endif /* INCLUDED_GR_NULL_SINK_H */ diff --git a/gnuradio-core/src/lib/general/gr_null_source.h b/gr-blocks/include/blocks/null_source.h index 1c64e8bd98..904a0c1ba3 100644 --- a/gnuradio-core/src/lib/general/gr_null_source.h +++ b/gr-blocks/include/blocks/null_source.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2004,2010 Free Software Foundation, Inc. + * Copyright 2004,2010,2013 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -23,30 +23,31 @@ #ifndef INCLUDED_GR_NULL_SOURCE_H #define INCLUDED_GR_NULL_SOURCE_H -#include <gr_core_api.h> +#include <blocks/api.h> #include <gr_sync_block.h> -class gr_null_source; -typedef boost::shared_ptr<gr_null_source> gr_null_source_sptr; - -GR_CORE_API gr_null_source_sptr -gr_make_null_source (size_t sizeof_stream_item); - -/*! - * \brief A source of zeros. - * \ingroup source_blk - */ -class GR_CORE_API gr_null_source : public gr_sync_block -{ - friend GR_CORE_API gr_null_source_sptr gr_make_null_source (size_t sizeof_stream_item); - - gr_null_source (size_t sizeof_stream_item); - - public: - virtual int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - -}; +namespace gr { + namespace blocks { + + /*! + * \brief A source of zeros used mainly for testing. + * \ingroup source_blk + */ + class BLOCKS_API null_source : virtual public gr_sync_block + { + public: + // gr::blocks::null_source::sptr + typedef boost::shared_ptr<null_source> sptr; + + /*! + * Build a null source block. + * + * \param sizeof_stream_item size of the stream items in bytes. + */ + static sptr make(size_t sizeof_stream_item); + }; + + } /* namespace blocks */ +} /* namespace gr */ #endif /* INCLUDED_GR_NULL_SOURCE_H */ diff --git a/gr-blocks/include/blocks/rotator.h b/gr-blocks/include/blocks/rotator.h new file mode 100644 index 0000000000..96ece63574 --- /dev/null +++ b/gr-blocks/include/blocks/rotator.h @@ -0,0 +1,63 @@ +/* -*- c++ -*- */ +/* + * Copyright 2003,2008,2013 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio 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 3, or (at your option) + * any later version. + * + * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef _GR_ROTATOR_H_ +#define _GR_ROTATOR_H_ + +#include <blocks/api.h> +#include <gr_complex.h> + +namespace gr { + namespace blocks { + + class BLOCKS_API rotator + { + private: + gr_complex d_phase; + gr_complex d_phase_incr; + unsigned int d_counter; + + public: + rotator() : d_phase(1), d_phase_incr(1), d_counter(0) + { } + + void set_phase(gr_complex phase) { d_phase = phase / abs(phase); } + void set_phase_incr(gr_complex incr) { d_phase_incr = incr / abs(incr); } + + gr_complex rotate(gr_complex in) + { + d_counter++; + + gr_complex z = in * d_phase; // rotate in by phase + d_phase *= d_phase_incr; // incr our phase (complex mult == add phases) + + if((d_counter % 512) == 0) + d_phase /= abs(d_phase); // Normalize to ensure multiplication is rotation + + return z; + } + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* _GR_ROTATOR_H_ */ diff --git a/gr-blocks/include/blocks/skiphead.h b/gr-blocks/include/blocks/skiphead.h new file mode 100644 index 0000000000..e6745af8ea --- /dev/null +++ b/gr-blocks/include/blocks/skiphead.h @@ -0,0 +1,53 @@ +/* -*- c++ -*- */ +/* + * Copyright 2005,2013 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio 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 3, or (at your option) + * any later version. + * + * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_GR_SKIPHEAD_H +#define INCLUDED_GR_SKIPHEAD_H + +#include <blocks/api.h> +#include <gr_sync_block.h> +#include <stddef.h> // size_t + +namespace gr { + namespace blocks { + + /*! + * \brief skips the first N items, from then on copies items to the output + * \ingroup slicedice_blk + * + * Useful for building test cases and sources which have metadata + * or junk at the start + */ + class BLOCKS_API skiphead : virtual public gr_block + { + public: + // gr::blocks::skiphead::sptr + typedef boost::shared_ptr<skiphead> sptr; + + static sptr make(size_t itemsize, + uint64_t nitems_to_skip); + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_GR_SKIPHEAD_H */ diff --git a/gnuradio-core/src/lib/gengen/gr_vector_insert_X.i.t b/gr-blocks/include/blocks/vector_insert_X.h.t index f3341eec4f..aeb4a5248a 100644 --- a/gnuradio-core/src/lib/gengen/gr_vector_insert_X.i.t +++ b/gr-blocks/include/blocks/vector_insert_X.h.t @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2012 Free Software Foundation, Inc. + * Copyright 2012-2013 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -22,16 +22,33 @@ // @WARNING@ -GR_SWIG_BLOCK_MAGIC(gr,@BASE_NAME@); +#ifndef @GUARD_NAME@ +#define @GUARD_NAME@ -@NAME@_sptr -gr_make_@BASE_NAME@ (const std::vector<@TYPE@> &data, int periodicity, int offset = 0) - throw(std::invalid_argument); +#include <blocks/api.h> +#include <gr_block.h> -class @NAME@ : public gr_block { - public: - void rewind(); - void set_data(const std::vector<@TYPE@> &data); - private: - @NAME@ (const std::vector<@TYPE@> &data, int periodicity, int offset = 0); -}; +namespace gr { + namespace blocks { + + /*! + * \brief source of @TYPE@'s that gets its data from a vector + * \ingroup source_blk + */ + class BLOCKS_API @NAME@ : virtual public gr_block + { + public: + // gr::blocks::@NAME@::sptr + typedef boost::shared_ptr<@NAME@> sptr; + + static sptr make(const std::vector<@TYPE@> &data, + int periodicity, int offset=0); + + virtual void rewind() = 0; + virtual void set_data(const std::vector<@TYPE@> &data) = 0; + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* @GUARD_NAME@ */ diff --git a/gr-blocks/include/blocks/vector_map.h b/gr-blocks/include/blocks/vector_map.h new file mode 100644 index 0000000000..64c8744975 --- /dev/null +++ b/gr-blocks/include/blocks/vector_map.h @@ -0,0 +1,71 @@ +/* -*- c++ -*- */ +/* + * Copyright 2012,2013 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio 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 3, or (at your option) + * any later version. + * + * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_GR_VECTOR_MAP_H +#define INCLUDED_GR_VECTOR_MAP_H + +#include <blocks/api.h> +#include <vector> +#include <gr_sync_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief Maps elements from a set of input vectors to a set of output vectors. + * \ingroup slicedice_blk + * + * If in[i] is the input vector in the i'th stream then the output + * vector in the j'th stream is: + * + * out[j][k] = in[mapping[j][k][0]][mapping[j][k][1]] + * + * That is mapping is of the form (out_stream1_mapping, + * out_stream2_mapping, ...) and out_stream1_mapping is of the + * form (element1_mapping, element2_mapping, ...) and + * element1_mapping is of the form (in_stream, in_element). + */ + class BLOCKS_API vector_map : virtual public gr_sync_block + { + public: + // gr::blocks::vector_map::sptr + typedef boost::shared_ptr<vector_map> sptr; + + /*! + * Build a vector map block. + * + * \param item_size (integer) size of vector elements + * \param in_vlens (vector of integers) number of elements in each + * input vector + * \param mapping (vector of vectors of vectors of integers) how to + * map elements from input to output vectors + */ + static sptr make(size_t item_size, std::vector<size_t> in_vlens, + std::vector< std::vector< std::vector<size_t> > > mapping); + + virtual void set_mapping(std::vector< std::vector< std::vector<size_t> > > mapping) = 0; + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_GR_VECTOR_MAP_H */ diff --git a/gnuradio-core/src/lib/general/gr_iqcomp_cc.h b/gr-blocks/include/blocks/vector_sink_X.h.t index 2f5a44ebfb..d15c795721 100644 --- a/gnuradio-core/src/lib/general/gr_iqcomp_cc.h +++ b/gr-blocks/include/blocks/vector_sink_X.h.t @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2004 Free Software Foundation, Inc. + * Copyright 2004,2008,2009,2013 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -20,36 +20,35 @@ * Boston, MA 02110-1301, USA. */ +// @WARNING@ -#ifndef INCLUDED_GR_IQCOMP_CC_H -#define INCLUDED_GR_IQCOMP_CC_H +#ifndef @GUARD_NAME@ +#define @GUARD_NAME@ -#include <gr_core_api.h> +#include <blocks/api.h> #include <gr_sync_block.h> -class gr_iqcomp_cc; -typedef boost::shared_ptr<gr_iqcomp_cc> gr_iqcomp_cc_sptr; +namespace gr { + namespace blocks { -GR_CORE_API gr_iqcomp_cc_sptr gr_make_iqcomp_cc (float mu); + /*! + * \brief @TYPE@ sink that writes to a vector + * \ingroup sink_blk + */ + class BLOCKS_API @NAME@ : virtual public gr_sync_block + { + public: + // gr::blocks::@NAME@::sptr + typedef boost::shared_ptr<@NAME@> sptr; -/*! - * \brief - * \ingroup misc_blk - */ -class GR_CORE_API gr_iqcomp_cc : public gr_sync_block -{ - friend GR_CORE_API gr_iqcomp_cc_sptr gr_make_iqcomp_cc (float mu); - - float d_mu, d_wi, d_wq; - gr_iqcomp_cc (float mu); + static sptr make(int vlen = 1); - public: - float mu () const { return d_mu; } - void set_mu (float mu) { d_mu = mu; } + virtual void reset() = 0; + virtual std::vector<@TYPE@> data() const = 0; + virtual std::vector<gr_tag_t> tags() const = 0; + }; - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; + } /* namespace blocks */ +} /* namespace gr */ -#endif +#endif /* @GUARD_NAME@ */ diff --git a/gnuradio-core/src/lib/gengen/gr_vector_sink_X.h.t b/gr-blocks/include/blocks/vector_source_X.h.t index b7de1d101c..c68b638e62 100644 --- a/gnuradio-core/src/lib/gengen/gr_vector_sink_X.h.t +++ b/gr-blocks/include/blocks/vector_source_X.h.t @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2004,2008,2009 Free Software Foundation, Inc. + * Copyright 2004,2008,2012-2013 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -25,37 +25,32 @@ #ifndef @GUARD_NAME@ #define @GUARD_NAME@ -#include <gr_core_api.h> +#include <blocks/api.h> #include <gr_sync_block.h> -class @NAME@; -typedef boost::shared_ptr<@NAME@> @NAME@_sptr; +namespace gr { + namespace blocks { -GR_CORE_API @NAME@_sptr -gr_make_@BASE_NAME@ (int vlen = 1); + /*! + * \brief source of @TYPE@'s that gets its data from a vector + * \ingroup source_blk + */ + class BLOCKS_API @NAME@ : virtual public gr_sync_block + { + public: + // gr::blocks::@NAME@::sptr + typedef boost::shared_ptr<@NAME@> sptr; + static sptr make(const std::vector<@TYPE@> &data, + bool repeat=false, int vlen=1, + const std::vector<gr_tag_t> &tags=std::vector<gr_tag_t>()); -/*! - * \brief @TYPE@ sink that writes to a vector - * \ingroup sink_blk - */ + virtual void rewind() = 0; + virtual void set_data(const std::vector<@TYPE@> &data, + const std::vector<gr_tag_t> &tags=std::vector<gr_tag_t>()) = 0; + }; + + } /* namespace blocks */ +} /* namespace gr */ -class GR_CORE_API @NAME@ : public gr_sync_block { - friend GR_CORE_API @NAME@_sptr gr_make_@BASE_NAME@ (int vlen); - std::vector<@TYPE@> d_data; - std::vector<gr_tag_t> d_tags; - int d_vlen; - @NAME@ (int vlen); - - public: - virtual int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - void reset() {d_data.clear();} - void clear() {reset(); } // deprecated - std::vector<@TYPE@> data () const; - std::vector<gr_tag_t> tags () const; -}; - -#endif +#endif /* @GUARD_NAME@ */ diff --git a/gr-blocks/lib/CMakeLists.txt b/gr-blocks/lib/CMakeLists.txt index de73a8a308..50c842398e 100644 --- a/gr-blocks/lib/CMakeLists.txt +++ b/gr-blocks/lib/CMakeLists.txt @@ -114,6 +114,9 @@ expand_cc_h_impl(sub_XX ss ii ff cc) expand_cc_h_impl(xor_XX bb ss ii) expand_cc_h_impl(packed_to_unpacked_XX bb ss ii) expand_cc_h_impl(unpacked_to_packed_XX bb ss ii) +expand_cc_h_impl(vector_insert_X b s i f c) +expand_cc_h_impl(vector_sink_X b s i f c) +expand_cc_h_impl(vector_source_X b s i f c) ######################################################################## # Setup the include and linker paths @@ -147,6 +150,9 @@ list(APPEND gr_blocks_sources fxpt.cc wavfile.cc add_ff_impl.cc + annotator_1to1_impl.cc + annotator_alltoall_impl.cc + annotator_raw_impl.cc bin_statistics_f_impl.cc burst_tagger_impl.cc char_to_float_impl.cc @@ -159,8 +165,10 @@ list(APPEND gr_blocks_sources complex_to_mag_squared_impl.cc complex_to_arg_impl.cc conjugate_cc_impl.cc + copy_impl.cc deinterleave_impl.cc delay_impl.cc + endian_swap_impl.cc file_descriptor_sink_impl.cc file_descriptor_source_impl.cc file_sink_impl.cc @@ -174,6 +182,7 @@ list(APPEND gr_blocks_sources float_to_short_impl.cc float_array_to_uchar.cc float_to_uchar_impl.cc + head_impl.cc int_to_float_impl.cc interleave_impl.cc interleaved_short_array_to_complex.cc @@ -191,6 +200,9 @@ list(APPEND gr_blocks_sources multiply_const_cc_impl.cc multiply_const_ff_impl.cc nlog10_ff_impl.cc + nop_impl.cc + null_sink_impl.cc + null_source_impl.cc pack_k_bits_bb_impl.cc patterned_interleaver_impl.cc pdu.cc @@ -206,6 +218,7 @@ list(APPEND gr_blocks_sources rms_ff_impl.cc short_to_char_impl.cc short_to_float_impl.cc + skiphead_impl.cc socket_pdu_impl.cc stream_mux_impl.cc stream_pdu_base.cc @@ -228,12 +241,20 @@ list(APPEND gr_blocks_sources udp_source_impl.cc unpack_k_bits_bb_impl.cc vco_f_impl.cc + vector_map_impl.cc vector_to_stream_impl.cc vector_to_streams_impl.cc wavfile_sink_impl.cc wavfile_source_impl.cc ) +if(ENABLE_GR_CTRLPORT) +list(APPEND gr_blocks_sources + ctrlport_probe_c_impl.cc + ctrlport_probe2_c_impl.cc +) +endif(ENABLE_GR_CTRLPORT) + #Add Windows DLL resource file if using MSVC IF(MSVC) include(${CMAKE_SOURCE_DIR}/cmake/Modules/GrVersion.cmake) @@ -268,15 +289,23 @@ GR_LIBRARY_FOO(gnuradio-blocks RUNTIME_COMPONENT "blocks_runtime" DEVEL_COMPONEN if(ENABLE_TESTING) include(GrTest) - include_directories(${CPPUNIT_INCLUDE_DIRS}) + include_directories( + ${GR_FILTER_INCLUDE_DIRS} + ${CPPUNIT_INCLUDE_DIRS}) link_directories(${CPPUNIT_LIBRARY_DIRS}) list(APPEND test_gr_blocks_sources ${CMAKE_CURRENT_SOURCE_DIR}/test_gr_blocks.cc + ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_block.cc + ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_top_block.cc + ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_hier_block2.cc + ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_hier_block2_derived.cc ${CMAKE_CURRENT_SOURCE_DIR}/qa_blocks.cc + ${CMAKE_CURRENT_SOURCE_DIR}/qa_block_tags.cc ${CMAKE_CURRENT_SOURCE_DIR}/qa_fxpt.cc ${CMAKE_CURRENT_SOURCE_DIR}/qa_fxpt_nco.cc ${CMAKE_CURRENT_SOURCE_DIR}/qa_fxpt_vco.cc + ${CMAKE_CURRENT_SOURCE_DIR}/qa_rotator.cc ) add_executable(test-gr-blocks ${test_gr_blocks_sources}) @@ -287,6 +316,7 @@ if(ENABLE_TESTING) test-gr-blocks gnuradio-core gnuradio-blocks + gnuradio-filter ${Boost_LIBRARIES} ${CPPUNIT_LIBRARIES} ) diff --git a/gr-blocks/lib/annotator_1to1_impl.cc b/gr-blocks/lib/annotator_1to1_impl.cc new file mode 100644 index 0000000000..e7f105fc02 --- /dev/null +++ b/gr-blocks/lib/annotator_1to1_impl.cc @@ -0,0 +1,113 @@ +/* -*- c++ -*- */ +/* + * Copyright 2010,2013 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio 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 3, or (at your option) + * any later version. + * + * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "annotator_1to1_impl.h" +#include <gr_io_signature.h> +#include <string.h> +#include <iostream> +#include <iomanip> + +namespace gr { + namespace blocks { + + annotator_1to1::sptr + annotator_1to1::make(int when, size_t sizeof_stream_item) + { + return gnuradio::get_initial_sptr + (new annotator_1to1_impl(when, sizeof_stream_item)); + } + + annotator_1to1_impl::annotator_1to1_impl(int when, size_t sizeof_stream_item) + : gr_sync_block("annotator_1to1", + gr_make_io_signature(1, -1, sizeof_stream_item), + gr_make_io_signature(1, -1, sizeof_stream_item)), + d_itemsize(sizeof_stream_item), d_when((uint64_t)when) + { + set_tag_propagation_policy(TPP_ONE_TO_ONE); + + d_tag_counter = 0; + set_relative_rate(1.0); + } + + annotator_1to1_impl::~annotator_1to1_impl() + { + } + + int + annotator_1to1_impl::work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) + { + const float *in = (const float*)input_items[0]; + float *out = (float*)output_items[0]; + + std::stringstream str; + str << name() << unique_id(); + + uint64_t abs_N = 0; + int ninputs = input_items.size(); + for(int i = 0; i < ninputs; i++) { + abs_N = nitems_read(i); + + std::vector<gr_tag_t> all_tags; + get_tags_in_range(all_tags, i, abs_N, abs_N + noutput_items); + + std::vector<gr_tag_t>::iterator itr; + for(itr = all_tags.begin(); itr != all_tags.end(); itr++) { + d_stored_tags.push_back(*itr); + } + } + + // Storing the current noutput_items as the value to the "noutput_items" key + pmt::pmt_t srcid = pmt::string_to_symbol(str.str()); + pmt::pmt_t key = pmt::string_to_symbol("seq"); + + // Work does nothing to the data stream; just copy all inputs to outputs + // Adds a new tag when the number of items read is a multiple of d_when + abs_N = nitems_read(0); + int noutputs = output_items.size(); + for(int j = 0; j < noutput_items; j++) { + // the min() is a hack to make sure this doesn't segfault if + // there are a different number of ins and outs. This is + // specifically designed to test the 1-to-1 propagation policy. + for(int i = 0; i < std::min(noutputs, ninputs); i++) { + if(abs_N % d_when == 0) { + pmt::pmt_t value = pmt::from_uint64(d_tag_counter++); + add_item_tag(i, abs_N, key, value, srcid); + } + + in = (const float*)input_items[i]; + out = (float*)output_items[i]; + out[j] = in[j]; + } + abs_N++; + } + + return noutput_items; + } + + } /* namespace blocks */ +} /* namespace gr */ diff --git a/gr-blocks/lib/annotator_1to1_impl.h b/gr-blocks/lib/annotator_1to1_impl.h new file mode 100644 index 0000000000..3306602e2c --- /dev/null +++ b/gr-blocks/lib/annotator_1to1_impl.h @@ -0,0 +1,56 @@ +/* -*- c++ -*- */ +/* + * Copyright 2010,2013 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio 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 3, or (at your option) + * any later version. + * + * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_GR_ANNOTATOR_1TO1_IMPL_H +#define INCLUDED_GR_ANNOTATOR_1TO1_IMPL_H + +#include <blocks/annotator_1to1.h> + +namespace gr { + namespace blocks { + + class annotator_1to1_impl : public annotator_1to1 + { + private: + size_t d_itemsize; + uint64_t d_when; + uint64_t d_tag_counter; + std::vector<gr_tag_t> d_stored_tags; + + public: + annotator_1to1_impl(int when, size_t sizeof_stream_item); + ~annotator_1to1_impl(); + + std::vector<gr_tag_t> data() const + { + return d_stored_tags; + } + + int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_GR_ANNOTATOR_1TO1_IMPL_H */ diff --git a/gr-blocks/lib/annotator_alltoall_impl.cc b/gr-blocks/lib/annotator_alltoall_impl.cc new file mode 100644 index 0000000000..4909f7f820 --- /dev/null +++ b/gr-blocks/lib/annotator_alltoall_impl.cc @@ -0,0 +1,117 @@ +/* -*- c++ -*- */ +/* + * Copyright 2010,2013 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio 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 3, or (at your option) + * any later version. + * + * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "annotator_alltoall_impl.h" +#include <gr_io_signature.h> +#include <string.h> +#include <iostream> +#include <iomanip> + +namespace gr { + namespace blocks { + + annotator_alltoall::sptr + annotator_alltoall::make(int when, size_t sizeof_stream_item) + { + return gnuradio::get_initial_sptr + (new annotator_alltoall_impl(when, sizeof_stream_item)); + } + + annotator_alltoall_impl::annotator_alltoall_impl(int when, + size_t sizeof_stream_item) + : gr_sync_block("annotator_alltoall", + gr_make_io_signature(1, -1, sizeof_stream_item), + gr_make_io_signature(1, -1, sizeof_stream_item)), + d_itemsize(sizeof_stream_item), d_when((uint64_t)when) + { + set_tag_propagation_policy(TPP_ALL_TO_ALL); + + d_tag_counter = 0; + } + + annotator_alltoall_impl::~annotator_alltoall_impl() + { + } + + int + annotator_alltoall_impl::work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) + { + const float *in = (const float*)input_items[0]; + float *out = (float*)output_items[0]; + + std::stringstream str; + str << name() << unique_id(); + + uint64_t abs_N = 0, end_N; + int ninputs = input_items.size(); + for(int i = 0; i < ninputs; i++) { + abs_N = nitems_read(i); + end_N = abs_N + (uint64_t)(noutput_items); + + std::vector<gr_tag_t> all_tags; + get_tags_in_range(all_tags, i, abs_N, end_N); + + std::vector<gr_tag_t>::iterator itr; + for(itr = all_tags.begin(); itr != all_tags.end(); itr++) { + d_stored_tags.push_back(*itr); + } + } + + // Source ID and key for any tag that might get applied from this block + pmt::pmt_t srcid = pmt::string_to_symbol(str.str()); + pmt::pmt_t key = pmt::string_to_symbol("seq"); + + // Work does nothing to the data stream; just copy all inputs to + // outputs Adds a new tag when the number of items read is a + // multiple of d_when + abs_N = nitems_written(0); + int noutputs = output_items.size(); + + for(int j = 0; j < noutput_items; j++) { + for(int i = 0; i < noutputs; i++) { + if(abs_N % d_when == 0) { + pmt::pmt_t value = pmt::from_uint64(d_tag_counter++); + add_item_tag(i, abs_N, key, value, srcid); + } + + // Sum all of the inputs together for each output. Just 'cause. + out = (float*)output_items[i]; + out[j] = 0; + for(int ins = 0; ins < ninputs; ins++) { + in = (const float*)input_items[ins]; + out[j] += in[j]; + } + } + abs_N++; + } + + return noutput_items; + } + + } /* namespace blocks */ +} /* namespace gr */ diff --git a/gr-blocks/lib/annotator_alltoall_impl.h b/gr-blocks/lib/annotator_alltoall_impl.h new file mode 100644 index 0000000000..24c21948bc --- /dev/null +++ b/gr-blocks/lib/annotator_alltoall_impl.h @@ -0,0 +1,56 @@ +/* -*- c++ -*- */ +/* + * Copyright 2010,2013 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio 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 3, or (at your option) + * any later version. + * + * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_GR_ANNOTATOR_ALLTOALL_IMPL_H +#define INCLUDED_GR_ANNOTATOR_ALLTOALL_IMPL_H + +#include <blocks/annotator_alltoall.h> + +namespace gr { + namespace blocks { + + class annotator_alltoall_impl : public annotator_alltoall + { + private: + size_t d_itemsize; + uint64_t d_when; + uint64_t d_tag_counter; + std::vector<gr_tag_t> d_stored_tags; + + public: + annotator_alltoall_impl(int when, size_t sizeof_stream_item); + ~annotator_alltoall_impl(); + + std::vector<gr_tag_t> data() const + { + return d_stored_tags; + } + + int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_GR_ANNOTATOR_ALLTOALL_IMPL_H */ diff --git a/gr-blocks/lib/annotator_raw_impl.cc b/gr-blocks/lib/annotator_raw_impl.cc new file mode 100644 index 0000000000..8d30ba16de --- /dev/null +++ b/gr-blocks/lib/annotator_raw_impl.cc @@ -0,0 +1,112 @@ +/* -*- c++ -*- */ +/* + * Copyright 2010,2013 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio 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 3, or (at your option) + * any later version. + * + * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "annotator_raw_impl.h" +#include <gr_io_signature.h> +#include <string.h> +#include <iostream> +#include <iomanip> +#include <stdexcept> + +using namespace pmt; + +namespace gr { + namespace blocks { + + annotator_raw::sptr + annotator_raw::make(size_t sizeof_stream_item) + { + return gnuradio::get_initial_sptr + (new annotator_raw_impl(sizeof_stream_item)); + } + + annotator_raw_impl::annotator_raw_impl(size_t sizeof_stream_item) + : gr_sync_block("annotator_raw", + gr_make_io_signature(1, 1, sizeof_stream_item), + gr_make_io_signature(1, 1, sizeof_stream_item)), + d_itemsize(sizeof_stream_item) + { + set_tag_propagation_policy(TPP_ONE_TO_ONE); + set_relative_rate(1.0); + } + + void annotator_raw_impl::add_tag(uint64_t offset, pmt_t key, pmt_t val) + { + gruel::scoped_lock l(d_mutex); + + gr_tag_t tag; + tag.srcid = pmt::intern(name()); + tag.key = key; + tag.value = val; + tag.offset = offset; + + // add our new tag + d_queued_tags.push_back(tag); + // make sure our tags are in offset order + std::sort(d_queued_tags.begin(), d_queued_tags.end(), + gr_tag_t::offset_compare); + // make sure we are not adding an item in the past! + if(tag.offset > nitems_read(0)) { + throw std::runtime_error("annotator_raw::add_tag: item added too far in the past\n."); + } + } + + annotator_raw_impl::~annotator_raw_impl() + { + } + + int + annotator_raw_impl::work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) + { + gruel::scoped_lock l(d_mutex); + + const char *in = (const char*)input_items[0]; + char *out = (char*)output_items[0]; + + uint64_t start_N = nitems_read(0); + uint64_t end_N = start_N + (uint64_t)(noutput_items); + + // locate queued tags that fall in this range and insert them when appropriate + std::vector<gr_tag_t>::iterator i = d_queued_tags.begin(); + while( i != d_queued_tags.end() ) { + if( (*i).offset >= start_N && (*i).offset < end_N) { + add_item_tag(0, (*i).offset,(*i).key, (*i).value, (*i).srcid); + i = d_queued_tags.erase(i); + } + else { + break; + } + } + + // copy data across + memcpy(out, in, noutput_items*d_itemsize); + return noutput_items; + } + + } /* namespace blocks */ +} /* namespace gr */ diff --git a/gr-blocks/lib/annotator_raw_impl.h b/gr-blocks/lib/annotator_raw_impl.h new file mode 100644 index 0000000000..2e349bfe33 --- /dev/null +++ b/gr-blocks/lib/annotator_raw_impl.h @@ -0,0 +1,54 @@ +/* -*- c++ -*- */ +/* + * Copyright 2010,2013 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio 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 3, or (at your option) + * any later version. + * + * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_GR_ANNOTATOR_RAW_IMPL_H +#define INCLUDED_GR_ANNOTATOR_RAW_IMPL_H + +#include <blocks/annotator_raw.h> +#include <gruel/thread.h> + +namespace gr { + namespace blocks { + + class annotator_raw_impl : public annotator_raw + { + private: + size_t d_itemsize; + std::vector<gr_tag_t> d_queued_tags; + gruel::mutex d_mutex; + + public: + annotator_raw_impl(size_t sizeof_stream_item); + ~annotator_raw_impl(); + + // insert a tag to be added + void add_tag(uint64_t offset, pmt::pmt_t key, pmt::pmt_t val); + + int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_GR_ANNOTATOR_RAW_IMPL_H */ diff --git a/gr-blocks/lib/copy_impl.cc b/gr-blocks/lib/copy_impl.cc new file mode 100644 index 0000000000..929f22b7d3 --- /dev/null +++ b/gr-blocks/lib/copy_impl.cc @@ -0,0 +1,91 @@ +/* -*- c++ -*- */ +/* + * Copyright 2006,2009,2013 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio 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 3, or (at your option) + * any later version. + * + * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "copy_impl.h" +#include <gr_io_signature.h> +#include <string.h> + +namespace gr { + namespace blocks { + + copy::sptr + copy::make(size_t itemsize) + { + return gnuradio::get_initial_sptr + (new copy_impl(itemsize)); + } + + copy_impl::copy_impl(size_t itemsize) + : gr_block("copy", + gr_make_io_signature(1, -1, itemsize), + gr_make_io_signature(1, -1, itemsize)), + d_itemsize(itemsize), + d_enabled(true) + { + } + + copy_impl::~copy_impl() + { + } + + void + copy_impl::forecast(int noutput_items, gr_vector_int &ninput_items_required) + { + unsigned ninputs = ninput_items_required.size(); + for (unsigned i = 0; i < ninputs; i++) + ninput_items_required[i] = noutput_items; + } + + bool + copy_impl::check_topology(int ninputs, int noutputs) + { + return ninputs == noutputs; + } + + int + copy_impl::general_work(int noutput_items, + gr_vector_int &ninput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) + { + const uint8_t **in = (const uint8_t**)&input_items[0]; + uint8_t **out = (uint8_t**)&output_items[0]; + + int n = 0; + if(d_enabled) { + int ninputs = input_items.size(); + for(int i = 0; i < ninputs; i++) { + memcpy(out[i], in[i], noutput_items*d_itemsize); + } + n = noutput_items; + } + + consume_each(noutput_items); + return n; + } + + } /* namespace blocks */ +} /* namespace gr */ diff --git a/gr-blocks/lib/copy_impl.h b/gr-blocks/lib/copy_impl.h new file mode 100644 index 0000000000..1f0f1a655e --- /dev/null +++ b/gr-blocks/lib/copy_impl.h @@ -0,0 +1,56 @@ +/* -*- c++ -*- */ +/* + * Copyright 2006,2009,2013 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio 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 3, or (at your option) + * any later version. + * + * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_GR_COPY_IMPL_H +#define INCLUDED_GR_COPY_IMPL_H + +#include <blocks/copy.h> + +namespace gr { + namespace blocks { + + class copy_impl : public copy + { + private: + size_t d_itemsize; + bool d_enabled; + + public: + copy_impl(size_t itemsize); + ~copy_impl(); + + void forecast(int noutput_items, gr_vector_int &ninput_items_required); + bool check_topology(int ninputs, int noutputs); + + void set_enabled(bool enable) { d_enabled = enable; } + bool enabled() const { return d_enabled;} + + int general_work(int noutput_items, + gr_vector_int &ninput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_GR_COPY_IMPL_H */ diff --git a/gr-blocks/lib/ctrlport_probe2_c_impl.cc b/gr-blocks/lib/ctrlport_probe2_c_impl.cc new file mode 100644 index 0000000000..f52e605a0d --- /dev/null +++ b/gr-blocks/lib/ctrlport_probe2_c_impl.cc @@ -0,0 +1,163 @@ +/* -*- c++ -*- */ +/* + * Copyright 2012-2013 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio 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 3, or (at your option) + * any later version. + * + * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "ctrlport_probe2_c_impl.h" +#include <gr_io_signature.h> + +namespace gr { + namespace blocks { + + ctrlport_probe2_c::sptr + ctrlport_probe2_c::make(const std::string &id, + const std::string &desc, int len) + { + return gnuradio::get_initial_sptr + (new ctrlport_probe2_c_impl(id, desc, len)); + } + + ctrlport_probe2_c_impl::ctrlport_probe2_c_impl(const std::string &id, + const std::string &desc, int len) + : gr_sync_block("probe2_c", + gr_make_io_signature(1, 1, sizeof(gr_complex)), + gr_make_io_signature(0, 0, 0)), + d_id(id), d_desc(desc), d_len(len) + { + set_length(len); + } + + ctrlport_probe2_c_impl::~ctrlport_probe2_c_impl() + { + } + + void + ctrlport_probe2_c_impl::forecast(int noutput_items, + gr_vector_int &ninput_items_required) + { + // make sure all inputs have noutput_items available + unsigned ninputs = ninput_items_required.size(); + for(unsigned i = 0; i < ninputs; i++) + ninput_items_required[i] = d_len; + } + + // boost::shared_mutex mutex_buffer; + // mutable boost::mutex mutex_notify; + // boost::condition_variable condition_buffer_ready; + std::vector<gr_complex> + ctrlport_probe2_c_impl::get() + { + mutex_buffer.lock(); + d_buffer.clear(); + mutex_buffer.unlock(); + + // wait for condition + boost::mutex::scoped_lock lock(mutex_notify); + condition_buffer_ready.wait(lock); + + mutex_buffer.lock(); + std::vector<gr_complex> buf_copy = d_buffer; + assert(buf_copy.size() == d_len); + mutex_buffer.unlock(); + + return buf_copy; + } + + void + ctrlport_probe2_c_impl::set_length(int len) + { + if(len > 8191) { + std::cerr << "probe2_c: length " << len + << " exceeds maximum buffer size of 8191" << std::endl; + len = 8191; + } + + d_len = len; + d_buffer.reserve(d_len); + } + + int + ctrlport_probe2_c_impl::length() const + { + return (int)d_len; + } + + int + ctrlport_probe2_c_impl::work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) + { + const gr_complex *in = (const gr_complex*)input_items[0]; + + // copy samples to get buffer if we need samples + mutex_buffer.lock(); + if(d_buffer.size() < d_len) { + // copy smaller of remaining buffer space and num inputs to work() + int num_copy = std::min( (int)(d_len - d_buffer.size()), noutput_items ); + + // TODO: convert this to a copy operator for speed... + for(int i = 0; i < num_copy; i++) { + d_buffer.push_back(in[i]); + } + + // notify the waiting get() if we fill up the buffer + if(d_buffer.size() == d_len) { + condition_buffer_ready.notify_one(); + } + } + mutex_buffer.unlock(); + + return noutput_items; + } + + void + ctrlport_probe2_c_impl::setup_rpc() + { +#ifdef GR_CTRLPORT + int len = static_cast<int>(d_len); + d_rpc_vars.push_back( + rpcbasic_sptr(new rpcbasic_register_get<ctrlport_probe2_c, std::vector<std::complex<float> > >( + alias(), d_id.c_str(), &ctrlport_probe2_c::get, + pmt::make_c32vector(0,-2), + pmt::make_c32vector(0,2), + pmt::make_c32vector(0,0), + "volts", d_desc.c_str(), RPC_PRIVLVL_MIN, + DISPXY | DISPOPTSCATTER))); + + d_rpc_vars.push_back( + rpcbasic_sptr(new rpcbasic_register_get<ctrlport_probe2_c, int>( + alias(), "length", &ctrlport_probe2_c::length, + pmt::mp(1), pmt::mp(10*len), pmt::mp(len), + "samples", "get vector length", RPC_PRIVLVL_MIN, DISPNULL))); + + d_rpc_vars.push_back( + rpcbasic_sptr(new rpcbasic_register_set<ctrlport_probe2_c, int>( + alias(), "length", &ctrlport_probe2_c::set_length, + pmt::mp(1), pmt::mp(10*len), pmt::mp(len), + "samples", "set vector length", RPC_PRIVLVL_MIN, DISPNULL))); +#endif /* GR_CTRLPORT */ + } + + } /* namespace blocks */ +} /* namespace gr */ diff --git a/gr-blocks/lib/ctrlport_probe2_c_impl.h b/gr-blocks/lib/ctrlport_probe2_c_impl.h new file mode 100644 index 0000000000..4d290a4e8f --- /dev/null +++ b/gr-blocks/lib/ctrlport_probe2_c_impl.h @@ -0,0 +1,67 @@ +/* -*- c++ -*- */ +/* + * Copyright 2012-2013 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio 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 3, or (at your option) + * any later version. + * + * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_CTRLPORT_PROBE2_C_IMPL_H +#define INCLUDED_CTRLPORT_PROBE2_C_IMPL_H + +#include <blocks/ctrlport_probe2_c.h> +#include <rpcregisterhelpers.h> +#include <boost/thread/shared_mutex.hpp> + +namespace gr { + namespace blocks { + + class ctrlport_probe2_c_impl : public ctrlport_probe2_c + { + private: + std::string d_id; + std::string d_desc; + size_t d_len; + boost::shared_mutex mutex_buffer; + mutable boost::mutex mutex_notify; + boost::condition_variable condition_buffer_ready; + + std::vector<gr_complex> d_buffer; + + public: + ctrlport_probe2_c_impl(const std::string &id, const std::string &desc, int len); + ~ctrlport_probe2_c_impl(); + + void setup_rpc(); + + void forecast(int noutput_items, gr_vector_int &ninput_items_required); + + std::vector<gr_complex> get(); + + void set_length(int len); + int length() const; + + int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_CTRLPORT_PROBE2_C_IMPL_H */ + diff --git a/gr-blocks/lib/ctrlport_probe_c_impl.cc b/gr-blocks/lib/ctrlport_probe_c_impl.cc new file mode 100644 index 0000000000..e11bd0496e --- /dev/null +++ b/gr-blocks/lib/ctrlport_probe_c_impl.cc @@ -0,0 +1,101 @@ +/* -*- c++ -*- */ +/* + * Copyright 2012-2013 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio 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 3, or (at your option) + * any later version. + * + * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "ctrlport_probe_c_impl.h" +#include <gr_io_signature.h> + +namespace gr { + namespace blocks { + + ctrlport_probe_c::sptr + ctrlport_probe_c::make(const std::string &id, + const std::string &desc) + { + return gnuradio::get_initial_sptr + (new ctrlport_probe_c_impl(id, desc)); + } + + ctrlport_probe_c_impl::ctrlport_probe_c_impl(const std::string &id, + const std::string &desc) + : gr_sync_block("probe_c", + gr_make_io_signature(1, 1, sizeof(gr_complex)), + gr_make_io_signature(0, 0, 0)), + d_id(id), d_desc(desc), d_ptr(NULL), d_ptrLen(0) + { + } + + ctrlport_probe_c_impl::~ctrlport_probe_c_impl() + { + } + + std::vector<gr_complex> + ctrlport_probe_c_impl::get() + { + if(d_ptr != NULL && d_ptrLen > 0) { + ptrlock.lock(); + std::vector<gr_complex> vec(d_ptr, d_ptr+d_ptrLen); + ptrlock.unlock(); + return vec; + } + else { + std::vector<gr_complex> vec; + return vec; + } + } + + int + ctrlport_probe_c_impl::work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) + { + const gr_complex *in = (const gr_complex*)input_items[0]; + + // keep reference to symbols + ptrlock.lock(); + d_ptr = in; + d_ptrLen = noutput_items; + ptrlock.unlock(); + + return noutput_items; + } + + void + ctrlport_probe_c_impl::setup_rpc() + { +#ifdef GR_CTRLPORT + d_rpc_vars.push_back( + rpcbasic_sptr(new rpcbasic_register_get<ctrlport_probe_c, std::vector<std::complex<float> > >( + alias(), d_id.c_str(), &ctrlport_probe_c::get, + pmt::make_c32vector(0,-2), + pmt::make_c32vector(0,2), + pmt::make_c32vector(0,0), + "volts", d_desc.c_str(), RPC_PRIVLVL_MIN, + DISPXY | DISPOPTSCATTER))); +#endif /* GR_CTRLPORT */ + } + + } /* namespace blocks */ +} /* namespace gr */ diff --git a/gr-blocks/lib/ctrlport_probe_c_impl.h b/gr-blocks/lib/ctrlport_probe_c_impl.h new file mode 100644 index 0000000000..5d9073ac10 --- /dev/null +++ b/gr-blocks/lib/ctrlport_probe_c_impl.h @@ -0,0 +1,60 @@ +/* -*- c++ -*- */ +/* + * Copyright 2012-2013 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio 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 3, or (at your option) + * any later version. + * + * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_CTRLPORT_PROBE_C_IMPL_H +#define INCLUDED_CTRLPORT_PROBE_C_IMPL_H + +#include <blocks/ctrlport_probe_c.h> +#include <rpcregisterhelpers.h> +#include <boost/thread/shared_mutex.hpp> + +namespace gr { + namespace blocks { + + class ctrlport_probe_c_impl : public ctrlport_probe_c + { + private: + boost::shared_mutex ptrlock; + + std::string d_id; + std::string d_desc; + const gr_complex* d_ptr; + size_t d_ptrLen; + + public: + ctrlport_probe_c_impl(const std::string &id, const std::string &desc); + ~ctrlport_probe_c_impl(); + + void setup_rpc(); + + std::vector<gr_complex> get(); + + int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_CTRLPORT_GR_CTRLPORT_PROBE_C_IMPL_H */ + diff --git a/gr-blocks/lib/endian_swap_impl.cc b/gr-blocks/lib/endian_swap_impl.cc new file mode 100644 index 0000000000..7e67c30147 --- /dev/null +++ b/gr-blocks/lib/endian_swap_impl.cc @@ -0,0 +1,110 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2010,2012,2013 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio 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 3, or (at your option) + * any later version. + * + * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "endian_swap_impl.h" +#include <gr_io_signature.h> +#include <volk/volk.h> + +namespace gr { + namespace blocks { + + endian_swap::sptr + endian_swap::make(size_t item_size_bytes) + { + return gnuradio::get_initial_sptr + (new endian_swap_impl(item_size_bytes)); + } + + endian_swap_impl::endian_swap_impl (size_t item_size_bytes) + : gr_sync_block("endian_swap_impl", + gr_make_io_signature(1, 1, item_size_bytes), + gr_make_io_signature(1, 1, item_size_bytes)) + { + const int alignment_multiple = volk_get_alignment(); + set_alignment(std::max(1, alignment_multiple)); + } + + endian_swap_impl::~endian_swap_impl() + { + } + + int + endian_swap_impl::work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) + { + const char *in = (const char*)input_items[0]; + char *out = (char*)output_items[0]; + + int nbytes(output_signature()->sizeof_stream_item(0)); + if(is_unaligned()) { + switch(nbytes){ + case 1: + memcpy(out,in,noutput_items); + break; + case 2: + memcpy(out,in,2*noutput_items); + volk_16u_byteswap_u((uint16_t*)out,noutput_items); + break; + case 4: + memcpy(out,in,4*noutput_items); + volk_32u_byteswap_u((uint32_t*)out,noutput_items); + break; + case 8: + memcpy(out,in,8*noutput_items); + volk_64u_byteswap_u((uint64_t*)out,noutput_items); + break; + default: + throw std::runtime_error("itemsize is not valid for endian_swap!"); + } + } + else { + switch(nbytes) { + case 1: + memcpy(out,in,noutput_items); + break; + case 2: + memcpy(out,in,2*noutput_items); + volk_16u_byteswap_a((uint16_t*)out,noutput_items); + break; + case 4: + memcpy(out,in,4*noutput_items); + volk_32u_byteswap_a((uint32_t*)out,noutput_items); + break; + case 8: + memcpy(out,in,8*noutput_items); + volk_64u_byteswap_a((uint64_t*)out,noutput_items); + break; + default: + throw std::runtime_error("itemsize is not valid for endian_swap!"); + } + } + + return noutput_items; + } + + } /* namespace blocks */ +} /* namespace gr */ diff --git a/gnuradio-core/src/lib/io/i2c.h b/gr-blocks/lib/endian_swap_impl.h index 6b7f25a293..517df44f17 100644 --- a/gnuradio-core/src/lib/io/i2c.h +++ b/gr-blocks/lib/endian_swap_impl.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2001,2004 Free Software Foundation, Inc. + * Copyright 2004,2012,2013 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -20,30 +20,29 @@ * Boston, MA 02110-1301, USA. */ -#ifndef INCLUDED_I2C_H -#define INCLUDED_I2C_H +#ifndef INCLUDED_GR_ENDIAN_SWAP_IMPL_H +#define INCLUDED_GR_ENDIAN_SWAP_IMPL_H -#include <gr_core_api.h> -#include <boost/shared_ptr.hpp> +#include <blocks/endian_swap.h> -class i2c; -typedef boost::shared_ptr<i2c> i2c_sptr; +namespace gr { + namespace blocks { -/*! - * \brief abstract class for controlling i2c bus - */ -class GR_CORE_API i2c { - public: - - i2c () {} - virtual ~i2c (); + class endian_swap_impl : public endian_swap + { + private: + size_t item_size_bytes; - //! \returns true iff successful - virtual bool write (int addr, const unsigned char *buf, int nbytes) = 0; + public: + endian_swap_impl(size_t item_size_bytes); + ~endian_swap_impl(); - //! \returns number of bytes read or -1 if error - virtual int read (int addr, unsigned char *buf, int max_bytes) = 0; -}; + int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + }; -#endif /* INCLUDED_I2C_H */ + } /* namespace blocks */ +} /* namespace gr */ +#endif /* INCLUDED_GR_ENDIAN_SWAP_IMPL_H */ diff --git a/gr-blocks/lib/head_impl.cc b/gr-blocks/lib/head_impl.cc new file mode 100644 index 0000000000..7dfa36607c --- /dev/null +++ b/gr-blocks/lib/head_impl.cc @@ -0,0 +1,75 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2009,2013 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio 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 3, or (at your option) + * any later version. + * + * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include "head_impl.h" +#include <gr_io_signature.h> +#include <string.h> + +namespace gr { + namespace blocks { + + head::sptr + head::make(size_t sizeof_stream_item, uint64_t nitems) + { + return gnuradio::get_initial_sptr + (new head_impl(sizeof_stream_item, nitems)); + } + + head_impl::head_impl(size_t sizeof_stream_item, uint64_t nitems) + : gr_sync_block("head", + gr_make_io_signature(1, 1, sizeof_stream_item), + gr_make_io_signature(1, 1, sizeof_stream_item)), + d_nitems(nitems), d_ncopied_items(0) + { + } + + head_impl::~head_impl() + { + } + + int + head_impl::work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) + { + if(d_ncopied_items >= d_nitems) + return -1; // Done! + + unsigned n = std::min(d_nitems - d_ncopied_items, + (uint64_t)noutput_items); + + if(n == 0) + return 0; + + memcpy(output_items[0], input_items[0], + n * input_signature()->sizeof_stream_item (0)); + d_ncopied_items += n; + + return n; + } + + } /* namespace blocks */ +} /* namespace gr */ diff --git a/gnuradio-core/src/lib/io/i2c_bbio.h b/gr-blocks/lib/head_impl.h index 6bf47b9cd0..a56acfbb27 100644 --- a/gnuradio-core/src/lib/io/i2c_bbio.h +++ b/gr-blocks/lib/head_impl.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2001,2004 Free Software Foundation, Inc. + * Copyright 2004,2009,2012,2013 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -20,32 +20,33 @@ * Boston, MA 02110-1301, USA. */ -#ifndef INCLUDED_I2C_BBIO_H -#define INCLUDED_I2C_BBIO_H +#ifndef INCLUDED_GR_HEAD_IMPL_H +#define INCLUDED_GR_HEAD_IMPL_H -#include <gr_core_api.h> -#include <boost/shared_ptr.hpp> +#include <blocks/head.h> -class i2c_bbio; -typedef boost::shared_ptr<i2c_bbio> i2c_bbio_sptr; +namespace gr { + namespace blocks { + class head_impl : public head + { + private: + uint64_t d_nitems; + uint64_t d_ncopied_items; -/*! - * \brief abstract class that implements bit banging i/o for i2c bus. - * \ingroup base - */ -class GR_CORE_API i2c_bbio { - public: + public: + head_impl(size_t sizeof_stream_item, uint64_t nitems); + ~head_impl(); - i2c_bbio () {} - virtual ~i2c_bbio (); + void reset() { d_ncopied_items = 0; } + void set_length(int nitems) { d_nitems = nitems; } - virtual void set_scl (bool state) = 0; - virtual void set_sda (bool state) = 0; - virtual bool get_sda () = 0; + int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + }; - virtual void lock () = 0; - virtual void unlock () = 0; -}; + } /* namespace blocks */ +} /* namespace gr */ -#endif /* INCLUDED_I2C_BBIO_H */ +#endif /* INCLUDED_GR_HEAD_IMPL_H */ diff --git a/gr-blocks/lib/nop_impl.cc b/gr-blocks/lib/nop_impl.cc new file mode 100644 index 0000000000..387eda0baf --- /dev/null +++ b/gr-blocks/lib/nop_impl.cc @@ -0,0 +1,100 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2010,2013 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio 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 3, or (at your option) + * any later version. + * + * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include "nop_impl.h" +#include <gr_io_signature.h> +#include <boost/bind.hpp> + +namespace gr { + namespace blocks { + + nop::sptr + nop::make(size_t sizeof_stream_item) + { + return gnuradio::get_initial_sptr + (new nop_impl(sizeof_stream_item)); + } + + nop_impl::nop_impl (size_t sizeof_stream_item) + : gr_block("nop", + gr_make_io_signature(0, -1, sizeof_stream_item), + gr_make_io_signature(0, -1, sizeof_stream_item)), + d_nmsgs_recvd(0) + { + // Arrange to have count_received_msgs called when messages are received. + message_port_register_in(pmt::mp("port")); + set_msg_handler(pmt::mp("port"), boost::bind(&nop_impl::count_received_msgs, this, _1)); + } + + nop_impl::~nop_impl() + { + } + + // Trivial message handler that just counts them. + // (N.B., This feature is used in qa_set_msg_handler) + void + nop_impl::count_received_msgs(pmt::pmt_t msg) + { + d_nmsgs_recvd++; + } + + int + nop_impl::general_work(int noutput_items, + gr_vector_int &ninput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) + { + // eat any input that's available + for(unsigned i = 0; i < ninput_items.size (); i++) + consume(i, ninput_items[i]); + + return noutput_items; + } + + void + nop_impl::setup_rpc() + { +#ifdef GR_CTRLPORT + d_rpc_vars.push_back( + rpcbasic_sptr(new rpcbasic_register_get<nop, int>( + alias(), "test", + &nop::ctrlport_test, + pmt::mp(-256), pmt::mp(255), pmt::mp(0), + "", "Simple testing variable", + RPC_PRIVLVL_MIN, DISPNULL))); + + d_rpc_vars.push_back( + rpcbasic_sptr(new rpcbasic_register_set<nop, int>( + alias(), "test", + &nop::set_ctrlport_test, + pmt::mp(-256), pmt::mp(255), pmt::mp(0), + "", "Simple testing variable", + RPC_PRIVLVL_MIN, DISPNULL))); +#endif /* GR_CTRLPORT */ + } + + } /* namespace blocks */ +} /* namespace gr */ diff --git a/gr-blocks/lib/nop_impl.h b/gr-blocks/lib/nop_impl.h new file mode 100644 index 0000000000..e01e8fc9d9 --- /dev/null +++ b/gr-blocks/lib/nop_impl.h @@ -0,0 +1,60 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2010,2013 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio 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 3, or (at your option) + * any later version. + * + * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_GR_NOP_IMPL_H +#define INCLUDED_GR_NOP_IMPL_H + +#include <blocks/nop.h> + +namespace gr { + namespace blocks { + + class nop_impl : public nop + { + protected: + int d_nmsgs_recvd; + int d_ctrlport_test; + + // Method that just counts any received messages. + void count_received_msgs(pmt::pmt_t msg); + + public: + nop_impl(size_t sizeof_stream_item); + ~nop_impl(); + + void setup_rpc(); + + int nmsgs_received() const { return d_nmsgs_recvd; } + + int ctrlport_test() const { return d_ctrlport_test; } + void set_ctrlport_test(int x) { d_ctrlport_test = x; } + + int general_work(int noutput_items, + gr_vector_int &ninput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_GR_NOP_IMPL_H */ diff --git a/gnuradio-core/src/lib/general/gr_null_source.cc b/gr-blocks/lib/null_sink_impl.cc index 1ad5c351d6..b780a2405a 100644 --- a/gnuradio-core/src/lib/general/gr_null_source.cc +++ b/gr-blocks/lib/null_sink_impl.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2004,2010 Free Software Foundation, Inc. + * Copyright 2004,2010,2013 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -24,29 +24,37 @@ #include "config.h" #endif -#include <gr_null_source.h> +#include "null_sink_impl.h" #include <gr_io_signature.h> -#include <string.h> - -gr_null_source::gr_null_source (size_t sizeof_stream_item) - : gr_sync_block ("null_source", - gr_make_io_signature (0, 0, 0), - gr_make_io_signature (1, 1, sizeof_stream_item)) -{ -} - -gr_null_source_sptr -gr_make_null_source (size_t sizeof_stream_item) -{ - return gnuradio::get_initial_sptr (new gr_null_source (sizeof_stream_item)); -} - -int -gr_null_source::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - void *optr = (void *) output_items[0]; - memset (optr, 0, noutput_items * output_signature()->sizeof_stream_item (0)); - return noutput_items; -} + +namespace gr { + namespace blocks { + + null_sink::sptr + null_sink::make(size_t sizeof_stream_item) + { + return gnuradio::get_initial_sptr + (new null_sink_impl(sizeof_stream_item)); + } + + null_sink_impl::null_sink_impl(size_t sizeof_stream_item) + : gr_sync_block("null_sink", + gr_make_io_signature(1, 1, sizeof_stream_item), + gr_make_io_signature(0, 0, 0)) + { + } + + null_sink_impl::~null_sink_impl() + { + } + + int + null_sink_impl::work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) + { + return noutput_items; + } + + } /* namespace blocks */ +} /* namespace gr */ diff --git a/gnuradio-core/src/lib/filter/qa_rotator.h b/gr-blocks/lib/null_sink_impl.h index a22e41ec26..bb4c695c23 100644 --- a/gnuradio-core/src/lib/filter/qa_rotator.h +++ b/gr-blocks/lib/null_sink_impl.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2008,2012 Free Software Foundation, Inc. + * Copyright 2004,2010,2013 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -20,26 +20,26 @@ * Boston, MA 02110-1301, USA. */ -#ifndef _QA_ANALOG_ROTATOR_H_ -#define _QA_ANALOG_ROTATOR_H_ +#ifndef INCLUDED_GR_NULL_SINK_IMPL_H +#define INCLUDED_GR_NULL_SINK_IMPL_H -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/TestCase.h> +#include <blocks/null_sink.h> namespace gr { - namespace analog { + namespace blocks { - class qa_rotator : public CppUnit::TestCase + class null_sink_impl : public null_sink { - CPPUNIT_TEST_SUITE(qa_rotator); - CPPUNIT_TEST(t1); - CPPUNIT_TEST_SUITE_END(); + public: + null_sink_impl(size_t sizeof_stream_item); + ~null_sink_impl(); - private: - void t1(); + int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); }; - } /* namespace analog */ + } /* namespace blocks */ } /* namespace gr */ -#endif /* _QA_ANALOG_ROTATOR_H_ */ +#endif /* INCLUDED_GR_NULL_SINK_IMPL_H */ diff --git a/gr-blocks/lib/null_source_impl.cc b/gr-blocks/lib/null_source_impl.cc new file mode 100644 index 0000000000..81999d0501 --- /dev/null +++ b/gr-blocks/lib/null_source_impl.cc @@ -0,0 +1,63 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2010,2013 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio 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 3, or (at your option) + * any later version. + * + * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "null_source_impl.h" +#include <gr_io_signature.h> +#include <string.h> + +namespace gr { + namespace blocks { + + null_source::sptr + null_source::make(size_t sizeof_stream_item) + { + return gnuradio::get_initial_sptr + (new null_source_impl(sizeof_stream_item)); + } + + null_source_impl::null_source_impl (size_t sizeof_stream_item) + : gr_sync_block("null_source", + gr_make_io_signature(0, 0, 0), + gr_make_io_signature(1, 1, sizeof_stream_item)) + { + } + + null_source_impl::~null_source_impl() + { + } + + int + null_source_impl::work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) + { + void *optr = (void*)output_items[0]; + memset(optr, 0, noutput_items * output_signature()->sizeof_stream_item(0)); + return noutput_items; + } + + } /* namespace blocks */ +} /* namespace gr */ diff --git a/gr-analog/include/analog/sincos.h b/gr-blocks/lib/null_source_impl.h index a71164c885..36201d54b6 100644 --- a/gr-analog/include/analog/sincos.h +++ b/gr-blocks/lib/null_source_impl.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2002,2004,2012 Free Software Foundation, Inc. + * Copyright 2004,2010,2013 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -20,21 +20,26 @@ * Boston, MA 02110-1301, USA. */ -#ifndef INCLUDED_ANALOG_SINCOS_H -#define INCLUDED_ANALOG_SINCOS_H +#ifndef INCLUDED_GR_NULL_SOURCE_IMPL_H +#define INCLUDED_GR_NULL_SOURCE_IMPL_H -#include <analog/api.h> +#include <blocks/null_source.h> namespace gr { - namespace analog { + namespace blocks { - //! compute double sine and cosine at the same time - ANALOG_API void sincos(double x, double *sin, double *cos); + class null_source_impl : public null_source + { + public: + null_source_impl(size_t sizeof_stream_item); + ~null_source_impl(); - //! compute floating point sine and cosine at the same time - ANALOG_API void sincosf(float x, float *sin, float *cos); + int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + }; - } /* namespace analog */ + } /* namespace blocks */ } /* namespace gr */ -#endif /* INCLUDED_ANALOG_SINCOS_H */ +#endif /* INCLUDED_GR_NULL_SOURCE_IMPL_H */ diff --git a/gnuradio-core/src/lib/runtime/qa_block_tags.cc b/gr-blocks/lib/qa_block_tags.cc index c3c18cac01..f3139245d8 100644 --- a/gnuradio-core/src/lib/runtime/qa_block_tags.cc +++ b/gr-blocks/lib/qa_block_tags.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2010 Free Software Foundation, Inc. + * Copyright 2010,2013 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -27,16 +27,19 @@ #include <qa_block_tags.h> #include <gr_block.h> #include <gr_top_block.h> -#include <gr_null_source.h> -#include <gr_null_sink.h> -#include <gr_head.h> -#include <gr_annotator_alltoall.h> -#include <gr_annotator_1to1.h> +#include <blocks/null_source.h> +#include <blocks/null_sink.h> +#include <blocks/head.h> +#include <blocks/annotator_alltoall.h> +#include <blocks/annotator_1to1.h> +#include <blocks/keep_one_in_n.h> #include <gr_tags.h> // ---------------------------------------------------------------- +using namespace pmt; + // set to 1 to turn on debug output // The debug output fully checks that the tags seen are what are expected. While // this behavior currently works with our implementation, there is no guarentee @@ -47,13 +50,13 @@ #define QA_TAGS_DEBUG 0 void -qa_block_tags::t0 () +qa_block_tags::t0() { unsigned int N = 1000; gr_top_block_sptr tb = gr_make_top_block("top"); - gr_block_sptr src (gr_make_null_source(sizeof(int))); - gr_block_sptr head (gr_make_head(sizeof(int), N)); - gr_block_sptr snk (gr_make_null_sink(sizeof(int))); + gr_block_sptr src (gr::blocks::null_source::make(sizeof(int))); + gr_block_sptr head (gr::blocks::head::make(sizeof(int), N)); + gr_block_sptr snk (gr::blocks::null_sink::make(sizeof(int))); tb->connect(src, 0, head, 0); tb->connect(head, 0, snk, 0); @@ -73,19 +76,19 @@ qa_block_tags::t0 () void -qa_block_tags::t1 () +qa_block_tags::t1() { int N = 40000; gr_top_block_sptr tb = gr_make_top_block("top"); - gr_block_sptr src (gr_make_null_source(sizeof(int))); - gr_block_sptr head (gr_make_head(sizeof(int), N)); - gr_annotator_alltoall_sptr ann0 (gr_make_annotator_alltoall(10000, sizeof(int))); - gr_annotator_alltoall_sptr ann1 (gr_make_annotator_alltoall(10000, sizeof(int))); - gr_annotator_alltoall_sptr ann2 (gr_make_annotator_alltoall(10000, sizeof(int))); - gr_annotator_alltoall_sptr ann3 (gr_make_annotator_alltoall(10000, sizeof(int))); - gr_annotator_alltoall_sptr ann4 (gr_make_annotator_alltoall(10000, sizeof(int))); - gr_block_sptr snk0 (gr_make_null_sink(sizeof(int))); - gr_block_sptr snk1 (gr_make_null_sink(sizeof(int))); + gr_block_sptr src (gr::blocks::null_source::make(sizeof(int))); + gr_block_sptr head (gr::blocks::head::make(sizeof(int), N)); + gr::blocks::annotator_alltoall::sptr ann0(gr::blocks::annotator_alltoall::make(10000, sizeof(int))); + gr::blocks::annotator_alltoall::sptr ann1(gr::blocks::annotator_alltoall::make(10000, sizeof(int))); + gr::blocks::annotator_alltoall::sptr ann2(gr::blocks::annotator_alltoall::make(10000, sizeof(int))); + gr::blocks::annotator_alltoall::sptr ann3(gr::blocks::annotator_alltoall::make(10000, sizeof(int))); + gr::blocks::annotator_alltoall::sptr ann4(gr::blocks::annotator_alltoall::make(10000, sizeof(int))); + gr_block_sptr snk0 (gr::blocks::null_sink::make(sizeof(int))); + gr_block_sptr snk1 (gr::blocks::null_sink::make(sizeof(int))); tb->connect(src, 0, head, 0); tb->connect(head, 0, ann0, 0); @@ -116,7 +119,7 @@ qa_block_tags::t1 () str1 << ann1->name() << ann1->unique_id(); str2 << ann2->name() << ann2->unique_id(); - pmt::pmt_t expected_tags3[8]; + pmt_t expected_tags3[8]; expected_tags3[0] = mp(pmt::from_uint64(0), mp(str1.str()), mp("seq"), mp(0)); expected_tags3[1] = mp(pmt::from_uint64(0), mp(str0.str()), mp("seq"), mp(0)); expected_tags3[2] = mp(pmt::from_uint64(10000), mp(str1.str()), mp("seq"), mp(1)); @@ -126,7 +129,7 @@ qa_block_tags::t1 () expected_tags3[6] = mp(pmt::from_uint64(30000), mp(str1.str()), mp("seq"), mp(3)); expected_tags3[7] = mp(pmt::from_uint64(30000), mp(str0.str()), mp("seq"), mp(6)); - pmt::pmt_t expected_tags4[8]; + pmt_t expected_tags4[8]; expected_tags4[0] = mp(pmt::from_uint64(0), mp(str2.str()), mp("seq"), mp(0)); expected_tags4[1] = mp(pmt::from_uint64(0), mp(str0.str()), mp("seq"), mp(1)); expected_tags4[2] = mp(pmt::from_uint64(10000), mp(str2.str()), mp("seq"), mp(1)); @@ -158,16 +161,16 @@ qa_block_tags::t2 () { int N = 40000; gr_top_block_sptr tb = gr_make_top_block("top"); - gr_block_sptr src (gr_make_null_source(sizeof(int))); - gr_block_sptr head (gr_make_head(sizeof(int), N)); - gr_annotator_alltoall_sptr ann0 (gr_make_annotator_alltoall(10000, sizeof(int))); - gr_annotator_alltoall_sptr ann1 (gr_make_annotator_alltoall(10000, sizeof(int))); - gr_annotator_alltoall_sptr ann2 (gr_make_annotator_alltoall(10000, sizeof(int))); - gr_annotator_alltoall_sptr ann3 (gr_make_annotator_alltoall(10000, sizeof(int))); - gr_annotator_alltoall_sptr ann4 (gr_make_annotator_alltoall(10000, sizeof(int))); - gr_block_sptr snk0 (gr_make_null_sink(sizeof(int))); - gr_block_sptr snk1 (gr_make_null_sink(sizeof(int))); - gr_block_sptr snk2 (gr_make_null_sink(sizeof(int))); + gr_block_sptr src (gr::blocks::null_source::make(sizeof(int))); + gr_block_sptr head (gr::blocks::head::make(sizeof(int), N)); + gr::blocks::annotator_alltoall::sptr ann0(gr::blocks::annotator_alltoall::make(10000, sizeof(int))); + gr::blocks::annotator_alltoall::sptr ann1(gr::blocks::annotator_alltoall::make(10000, sizeof(int))); + gr::blocks::annotator_alltoall::sptr ann2(gr::blocks::annotator_alltoall::make(10000, sizeof(int))); + gr::blocks::annotator_alltoall::sptr ann3(gr::blocks::annotator_alltoall::make(10000, sizeof(int))); + gr::blocks::annotator_alltoall::sptr ann4(gr::blocks::annotator_alltoall::make(10000, sizeof(int))); + gr_block_sptr snk0 (gr::blocks::null_sink::make(sizeof(int))); + gr_block_sptr snk1 (gr::blocks::null_sink::make(sizeof(int))); + gr_block_sptr snk2 (gr::blocks::null_sink::make(sizeof(int))); tb->connect(src, 0, head, 0); tb->connect(head, 0, ann0, 0); @@ -206,7 +209,7 @@ qa_block_tags::t2 () str0 << ann0->name() << ann0->unique_id(); str1 << ann1->name() << ann1->unique_id(); - pmt::pmt_t expected_tags2[12]; + pmt_t expected_tags2[12]; expected_tags2[0] = mp(pmt::from_uint64(0), mp(str1.str()), mp("seq"), mp(0)); expected_tags2[1] = mp(pmt::from_uint64(0), mp(str0.str()), mp("seq"), mp(0)); expected_tags2[2] = mp(pmt::from_uint64(0), mp(str0.str()), mp("seq"), mp(1)); @@ -220,7 +223,7 @@ qa_block_tags::t2 () expected_tags2[10] = mp(pmt::from_uint64(30000), mp(str0.str()), mp("seq"), mp(6)); expected_tags2[11] = mp(pmt::from_uint64(30000), mp(str0.str()), mp("seq"), mp(7)); - pmt::pmt_t expected_tags4[12]; + pmt_t expected_tags4[12]; expected_tags4[0] = mp(pmt::from_uint64(0), mp(str1.str()), mp("seq"), mp(2)); expected_tags4[1] = mp(pmt::from_uint64(0), mp(str0.str()), mp("seq"), mp(0)); expected_tags4[2] = mp(pmt::from_uint64(0), mp(str0.str()), mp("seq"), mp(1)); @@ -255,19 +258,19 @@ qa_block_tags::t2 () void -qa_block_tags::t3 () +qa_block_tags::t3() { int N = 40000; gr_top_block_sptr tb = gr_make_top_block("top"); - gr_block_sptr src (gr_make_null_source(sizeof(int))); - gr_block_sptr head (gr_make_head(sizeof(int), N)); - gr_annotator_1to1_sptr ann0 (gr_make_annotator_1to1(10000, sizeof(int))); - gr_annotator_alltoall_sptr ann1 (gr_make_annotator_alltoall(10000, sizeof(int))); - gr_annotator_alltoall_sptr ann2 (gr_make_annotator_alltoall(10000, sizeof(int))); - gr_annotator_1to1_sptr ann3 (gr_make_annotator_1to1(10000, sizeof(int))); - gr_annotator_1to1_sptr ann4 (gr_make_annotator_1to1(10000, sizeof(int))); - gr_block_sptr snk0 (gr_make_null_sink(sizeof(int))); - gr_block_sptr snk1 (gr_make_null_sink(sizeof(int))); + gr_block_sptr src (gr::blocks::null_source::make(sizeof(int))); + gr_block_sptr head (gr::blocks::head::make(sizeof(int), N)); + gr::blocks::annotator_1to1::sptr ann0 (gr::blocks::annotator_1to1::make(10000, sizeof(int))); + gr::blocks::annotator_alltoall::sptr ann1 (gr::blocks::annotator_alltoall::make(10000, sizeof(int))); + gr::blocks::annotator_alltoall::sptr ann2 (gr::blocks::annotator_alltoall::make(10000, sizeof(int))); + gr::blocks::annotator_1to1::sptr ann3 (gr::blocks::annotator_1to1::make(10000, sizeof(int))); + gr::blocks::annotator_1to1::sptr ann4 (gr::blocks::annotator_1to1::make(10000, sizeof(int))); + gr_block_sptr snk0 (gr::blocks::null_sink::make(sizeof(int))); + gr_block_sptr snk1 (gr::blocks::null_sink::make(sizeof(int))); tb->connect(src, 0, head, 0); tb->connect(head, 0, ann0, 0); @@ -300,7 +303,7 @@ qa_block_tags::t3 () str1 << ann1->name() << ann1->unique_id(); str2 << ann2->name() << ann2->unique_id(); - pmt::pmt_t expected_tags3[8]; + pmt_t expected_tags3[8]; expected_tags3[0] = mp(pmt::from_uint64(0), mp(str1.str()), mp("seq"), mp(0)); expected_tags3[1] = mp(pmt::from_uint64(0), mp(str0.str()), mp("seq"), mp(0)); expected_tags3[2] = mp(pmt::from_uint64(10000), mp(str1.str()), mp("seq"), mp(1)); @@ -310,7 +313,7 @@ qa_block_tags::t3 () expected_tags3[6] = mp(pmt::from_uint64(30000), mp(str1.str()), mp("seq"), mp(3)); expected_tags3[7] = mp(pmt::from_uint64(30000), mp(str0.str()), mp("seq"), mp(6)); - pmt::pmt_t expected_tags4[8]; + pmt_t expected_tags4[8]; expected_tags4[0] = mp(pmt::from_uint64(0), mp(str2.str()), mp("seq"), mp(0)); expected_tags4[1] = mp(pmt::from_uint64(0), mp(str0.str()), mp("seq"), mp(1)); expected_tags4[2] = mp(pmt::from_uint64(10000), mp(str2.str()), mp("seq"), mp(1)); @@ -339,17 +342,17 @@ qa_block_tags::t3 () void -qa_block_tags::t4 () +qa_block_tags::t4() { int N = 40000; gr_top_block_sptr tb = gr_make_top_block("top"); - gr_block_sptr src (gr_make_null_source(sizeof(int))); - gr_block_sptr head (gr_make_head(sizeof(int), N)); - gr_annotator_1to1_sptr ann0 (gr_make_annotator_1to1(10000, sizeof(int))); - gr_annotator_1to1_sptr ann1 (gr_make_annotator_1to1(10000, sizeof(int))); - gr_annotator_1to1_sptr ann2 (gr_make_annotator_1to1(10000, sizeof(int))); - gr_block_sptr snk0 (gr_make_null_sink(sizeof(int))); - gr_block_sptr snk1 (gr_make_null_sink(sizeof(int))); + gr_block_sptr src (gr::blocks::null_source::make(sizeof(int))); + gr_block_sptr head (gr::blocks::head::make(sizeof(int), N)); + gr::blocks::annotator_1to1::sptr ann0(gr::blocks::annotator_1to1::make(10000, sizeof(int))); + gr::blocks::annotator_1to1::sptr ann1(gr::blocks::annotator_1to1::make(10000, sizeof(int))); + gr::blocks::annotator_1to1::sptr ann2(gr::blocks::annotator_1to1::make(10000, sizeof(int))); + gr_block_sptr snk0 (gr::blocks::null_sink::make(sizeof(int))); + gr_block_sptr snk1 (gr::blocks::null_sink::make(sizeof(int))); // using 1-to-1 tag propagation without having equal number of // ins and outs. Make sure this works; will just exit run early. @@ -367,21 +370,20 @@ qa_block_tags::t4 () } -/* void -qa_block_tags::t5 () +qa_block_tags::t5() { int N = 40000; gr_top_block_sptr tb = gr_make_top_block("top"); - gr_block_sptr src (gr_make_null_source(sizeof(float))); - gr_block_sptr head (gr_make_head(sizeof(float), N)); - gr_annotator_alltoall_sptr ann0 (gr_make_annotator_alltoall(10000, sizeof(float))); - gr_annotator_alltoall_sptr ann1 (gr_make_annotator_alltoall(10000, sizeof(float))); - gr_annotator_alltoall_sptr ann2 (gr_make_annotator_alltoall(1000, sizeof(float))); - gr_block_sptr snk0 (gr_make_null_sink(sizeof(float))); + gr_block_sptr src (gr::blocks::null_source::make(sizeof(float))); + gr_block_sptr head (gr::blocks::head::make(sizeof(float), N)); + gr::blocks::annotator_alltoall::sptr ann0(gr::blocks::annotator_alltoall::make(10000, sizeof(float))); + gr::blocks::annotator_alltoall::sptr ann1(gr::blocks::annotator_alltoall::make(10000, sizeof(float))); + gr::blocks::annotator_alltoall::sptr ann2(gr::blocks::annotator_alltoall::make(1000, sizeof(float))); + gr_block_sptr snk0 (gr::blocks::null_sink::make(sizeof(float))); // Rate change blocks - gr_keep_one_in_n_sptr dec10 (gr_make_keep_one_in_n(sizeof(float), 10)); + gr::blocks::keep_one_in_n::sptr dec10(gr::blocks::keep_one_in_n::make(sizeof(float), 10)); tb->connect(src, 0, head, 0); tb->connect(head, 0, ann0, 0); @@ -409,13 +411,13 @@ qa_block_tags::t5 () str1 << ann1->name() << ann1->unique_id(); str2 << ann2->name() << ann2->unique_id(); - pmt::pmt_t expected_tags1[5]; + pmt_t expected_tags1[5]; expected_tags1[0] = mp(pmt::from_uint64(0), mp(str0.str()), mp("seq"), mp(0)); expected_tags1[1] = mp(pmt::from_uint64(10000), mp(str0.str()), mp("seq"), mp(1)); expected_tags1[2] = mp(pmt::from_uint64(20000), mp(str0.str()), mp("seq"), mp(2)); expected_tags1[3] = mp(pmt::from_uint64(30000), mp(str0.str()), mp("seq"), mp(3)); - pmt::pmt_t expected_tags2[10]; + pmt_t expected_tags2[10]; expected_tags2[0] = mp(pmt::from_uint64(0), mp(str1.str()), mp("seq"), mp(0)); expected_tags2[1] = mp(pmt::from_uint64(0), mp(str0.str()), mp("seq"), mp(0)); expected_tags2[2] = mp(pmt::from_uint64(1000), mp(str1.str()), mp("seq"), mp(1)); @@ -445,4 +447,4 @@ qa_block_tags::t5 () } #endif } -*/ + diff --git a/gnuradio-core/src/lib/runtime/qa_block_tags.h b/gr-blocks/lib/qa_block_tags.h index 039d345cdf..83bebe23f6 100644 --- a/gnuradio-core/src/lib/runtime/qa_block_tags.h +++ b/gr-blocks/lib/qa_block_tags.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2010 Free Software Foundation, Inc. + * Copyright 2010,2013 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -27,26 +27,24 @@ #include <cppunit/TestCase.h> #include <stdexcept> -class qa_block_tags : public CppUnit::TestCase { - - CPPUNIT_TEST_SUITE (qa_block_tags); - CPPUNIT_TEST (t0); - CPPUNIT_TEST (t1); - CPPUNIT_TEST (t2); - CPPUNIT_TEST (t3); - CPPUNIT_TEST (t4); - //CPPUNIT_TEST (t5); - CPPUNIT_TEST_SUITE_END (); +class qa_block_tags : public CppUnit::TestCase +{ + CPPUNIT_TEST_SUITE(qa_block_tags); + CPPUNIT_TEST(t0); + CPPUNIT_TEST(t1); + CPPUNIT_TEST(t2); + CPPUNIT_TEST(t3); + CPPUNIT_TEST(t4); + CPPUNIT_TEST(t5); + CPPUNIT_TEST_SUITE_END(); private: - void t0 (); - void t1 (); - void t2 (); - void t3 (); - void t4 (); - //void t5 (); - + void t0(); + void t1(); + void t2(); + void t3(); + void t4(); + void t5(); }; - #endif /* INCLUDED_QA_BLOCK_TAGS_H */ diff --git a/gr-blocks/lib/qa_blocks.cc b/gr-blocks/lib/qa_blocks.cc index fbae11d264..ebf5d3c349 100644 --- a/gr-blocks/lib/qa_blocks.cc +++ b/gr-blocks/lib/qa_blocks.cc @@ -26,18 +26,22 @@ */ #include <qa_blocks.h> +#include <qa_block_tags.h> #include <qa_fxpt.h> #include <qa_fxpt_nco.h> #include <qa_fxpt_vco.h> +#include <qa_rotator.h> CppUnit::TestSuite * qa_gr_blocks::suite() { CppUnit::TestSuite *s = new CppUnit::TestSuite("gr-blocks"); + s->addTest(qa_block_tags::suite()); s->addTest(qa_fxpt::suite()); s->addTest(qa_fxpt_nco::suite()); s->addTest(qa_fxpt_vco::suite()); + s->addTest(qa_rotator::suite()); return s; } diff --git a/gnuradio-core/src/lib/runtime/qa_gr_block.cc b/gr-blocks/lib/qa_gr_block.cc index aeab5b74a8..7f4a01bbd0 100644 --- a/gnuradio-core/src/lib/runtime/qa_gr_block.cc +++ b/gr-blocks/lib/qa_gr_block.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2004 Free Software Foundation, Inc. + * Copyright 2004.2013 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -23,11 +23,12 @@ #ifdef HAVE_CONFIG_H #include <config.h> #endif + #include <qa_gr_block.h> #include <gr_block.h> #include <gr_io_signature.h> -#include <gr_null_sink.h> -#include <gr_null_source.h> +#include <blocks/null_sink.h> +#include <blocks/null_source.h> // ---------------------------------------------------------------- @@ -37,21 +38,21 @@ void qa_gr_block::t0 () { // test creation of sources - gr_block_sptr src1 (gr_make_null_source (sizeof (int))); - CPPUNIT_ASSERT_EQUAL (std::string ("null_source"), src1->name ()); - CPPUNIT_ASSERT_EQUAL (0, src1->input_signature()->max_streams ()); - CPPUNIT_ASSERT_EQUAL (1, src1->output_signature()->min_streams ()); - CPPUNIT_ASSERT_EQUAL (1, src1->output_signature()->max_streams ()); - CPPUNIT_ASSERT_EQUAL ((int) sizeof(int), - src1->output_signature()->sizeof_stream_item (0)); + gr_block_sptr src1(gr::blocks::null_source::make(sizeof (int))); + CPPUNIT_ASSERT_EQUAL(std::string("null_source"), src1->name ()); + CPPUNIT_ASSERT_EQUAL(0, src1->input_signature()->max_streams ()); + CPPUNIT_ASSERT_EQUAL(1, src1->output_signature()->min_streams ()); + CPPUNIT_ASSERT_EQUAL(1, src1->output_signature()->max_streams ()); + CPPUNIT_ASSERT_EQUAL((int) sizeof(int), + src1->output_signature()->sizeof_stream_item (0)); - gr_block_sptr src2 (gr_make_null_source (sizeof (short))); - CPPUNIT_ASSERT_EQUAL (std::string ("null_source"), src2->name ()); - CPPUNIT_ASSERT_EQUAL (0, src2->input_signature()->max_streams ()); - CPPUNIT_ASSERT_EQUAL (1, src2->output_signature()->min_streams ()); - CPPUNIT_ASSERT_EQUAL (1, src2->output_signature()->max_streams ()); - CPPUNIT_ASSERT_EQUAL ((int) sizeof (short), - src2->output_signature()->sizeof_stream_item (0)); + gr_block_sptr src2(gr::blocks::null_source::make(sizeof(short))); + CPPUNIT_ASSERT_EQUAL(std::string ("null_source"), src2->name ()); + CPPUNIT_ASSERT_EQUAL(0, src2->input_signature()->max_streams ()); + CPPUNIT_ASSERT_EQUAL(1, src2->output_signature()->min_streams ()); + CPPUNIT_ASSERT_EQUAL(1, src2->output_signature()->max_streams ()); + CPPUNIT_ASSERT_EQUAL((int)sizeof (short), + src2->output_signature()->sizeof_stream_item (0)); } @@ -59,7 +60,7 @@ void qa_gr_block::t1 () { // test creation of sinks - gr_block_sptr dst1 (gr_make_null_sink (sizeof (int))); + gr_block_sptr dst1 (gr::blocks::null_sink::make (sizeof (int))); CPPUNIT_ASSERT_EQUAL (std::string ("null_sink"), dst1->name ()); CPPUNIT_ASSERT_EQUAL (1, dst1->input_signature()->min_streams ()); CPPUNIT_ASSERT_EQUAL (1, dst1->input_signature()->max_streams ()); @@ -68,7 +69,7 @@ qa_gr_block::t1 () CPPUNIT_ASSERT_EQUAL (0, dst1->output_signature()->max_streams ()); - gr_block_sptr dst2 (gr_make_null_sink (sizeof (short))); + gr_block_sptr dst2 (gr::blocks::null_sink::make (sizeof (short))); CPPUNIT_ASSERT_EQUAL (std::string ("null_sink"), dst2->name ()); CPPUNIT_ASSERT_EQUAL (1, dst2->input_signature()->min_streams ()); CPPUNIT_ASSERT_EQUAL (1, dst2->input_signature()->max_streams ()); diff --git a/gnuradio-core/src/lib/runtime/qa_gr_block.h b/gr-blocks/lib/qa_gr_block.h index 14c7c40d1f..14c7c40d1f 100644 --- a/gnuradio-core/src/lib/runtime/qa_gr_block.h +++ b/gr-blocks/lib/qa_gr_block.h diff --git a/gnuradio-core/src/lib/runtime/qa_gr_flowgraph.cc b/gr-blocks/lib/qa_gr_flowgraph.cc index cce83cb0a0..1a3006039b 100644 --- a/gnuradio-core/src/lib/runtime/qa_gr_flowgraph.cc +++ b/gr-blocks/lib/qa_gr_flowgraph.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2007 Free Software Foundation, Inc. + * Copyright 2007,2013 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -26,9 +26,9 @@ #include <qa_gr_flowgraph.h> #include <gr_flowgraph.h> -#include <gr_nop.h> -#include <gr_null_source.h> -#include <gr_null_sink.h> +#include <blocks/nop.h> +#include <blocks/null_source.h> +#include <blocks/null_sink.h> void qa_gr_flowgraph::t0() { @@ -41,8 +41,8 @@ void qa_gr_flowgraph::t1_connect() { gr_flowgraph_sptr fg = gr_make_flowgraph(); - gr_block_sptr nop1 = gr_make_nop(sizeof(int)); - gr_block_sptr nop2 = gr_make_nop(sizeof(int)); + gr_block_sptr nop1 = gr::blocks::nop::make(sizeof(int)); + gr_block_sptr nop2 = gr::blocks::nop::make(sizeof(int)); fg->connect(nop1, 0, nop2, 0); } @@ -51,8 +51,8 @@ void qa_gr_flowgraph::t2_connect_invalid_src_port_neg() { gr_flowgraph_sptr fg = gr_make_flowgraph(); - gr_block_sptr nop1 = gr_make_nop(sizeof(int)); - gr_block_sptr nop2 = gr_make_nop(sizeof(int)); + gr_block_sptr nop1 = gr::blocks::nop::make(sizeof(int)); + gr_block_sptr nop2 = gr::blocks::nop::make(sizeof(int)); CPPUNIT_ASSERT_THROW(fg->connect(nop1, -1, nop2, 0), std::invalid_argument); } @@ -61,8 +61,8 @@ void qa_gr_flowgraph::t3_connect_src_port_exceeds() { gr_flowgraph_sptr fg = gr_make_flowgraph(); - gr_block_sptr src = gr_make_null_source(sizeof(int)); - gr_block_sptr dst = gr_make_null_sink(sizeof(int)); + gr_block_sptr src = gr::blocks::null_source::make(sizeof(int)); + gr_block_sptr dst = gr::blocks::null_sink::make(sizeof(int)); CPPUNIT_ASSERT_THROW(fg->connect(src, 1, dst, 0), std::invalid_argument); } @@ -71,8 +71,8 @@ void qa_gr_flowgraph::t4_connect_invalid_dst_port_neg() { gr_flowgraph_sptr fg = gr_make_flowgraph(); - gr_block_sptr nop1 = gr_make_nop(sizeof(int)); - gr_block_sptr nop2 = gr_make_nop(sizeof(int)); + gr_block_sptr nop1 = gr::blocks::nop::make(sizeof(int)); + gr_block_sptr nop2 = gr::blocks::nop::make(sizeof(int)); CPPUNIT_ASSERT_THROW(fg->connect(nop1, 0, nop2, -1), std::invalid_argument); } @@ -81,8 +81,8 @@ void qa_gr_flowgraph::t5_connect_dst_port_exceeds() { gr_flowgraph_sptr fg = gr_make_flowgraph(); - gr_block_sptr src = gr_make_null_source(sizeof(int)); - gr_block_sptr dst = gr_make_null_sink(sizeof(int)); + gr_block_sptr src = gr::blocks::null_source::make(sizeof(int)); + gr_block_sptr dst = gr::blocks::null_sink::make(sizeof(int)); CPPUNIT_ASSERT_THROW(fg->connect(src, 0, dst, 1), std::invalid_argument); } @@ -91,9 +91,9 @@ void qa_gr_flowgraph::t6_connect_dst_in_use() { gr_flowgraph_sptr fg = gr_make_flowgraph(); - gr_block_sptr src1 = gr_make_null_source(sizeof(int)); - gr_block_sptr src2 = gr_make_null_source(sizeof(int)); - gr_block_sptr dst = gr_make_null_sink(sizeof(int)); + gr_block_sptr src1 = gr::blocks::null_source::make(sizeof(int)); + gr_block_sptr src2 = gr::blocks::null_source::make(sizeof(int)); + gr_block_sptr dst = gr::blocks::null_sink::make(sizeof(int)); fg->connect(src1, 0, dst, 0); CPPUNIT_ASSERT_THROW(fg->connect(src2, 0, dst, 0), std::invalid_argument); @@ -103,9 +103,9 @@ void qa_gr_flowgraph::t7_connect_one_src_two_dst() { gr_flowgraph_sptr fg = gr_make_flowgraph(); - gr_block_sptr src = gr_make_null_source(sizeof(int)); - gr_block_sptr dst1 = gr_make_null_sink(sizeof(int)); - gr_block_sptr dst2 = gr_make_null_sink(sizeof(int)); + gr_block_sptr src = gr::blocks::null_source::make(sizeof(int)); + gr_block_sptr dst1 = gr::blocks::null_sink::make(sizeof(int)); + gr_block_sptr dst2 = gr::blocks::null_sink::make(sizeof(int)); fg->connect(src, 0, dst1, 0); fg->connect(src, 0, dst2, 0); @@ -115,8 +115,8 @@ void qa_gr_flowgraph::t8_connect_type_mismatch() { gr_flowgraph_sptr fg = gr_make_flowgraph(); - gr_block_sptr nop1 = gr_make_nop(sizeof(char)); - gr_block_sptr nop2 = gr_make_nop(sizeof(int)); + gr_block_sptr nop1 = gr::blocks::nop::make(sizeof(char)); + gr_block_sptr nop2 = gr::blocks::nop::make(sizeof(int)); CPPUNIT_ASSERT_THROW(fg->connect(nop1, 0, nop2, 0), std::invalid_argument); } @@ -125,8 +125,8 @@ void qa_gr_flowgraph::t9_disconnect() { gr_flowgraph_sptr fg = gr_make_flowgraph(); - gr_block_sptr nop1 = gr_make_nop(sizeof(int)); - gr_block_sptr nop2 = gr_make_nop(sizeof(int)); + gr_block_sptr nop1 = gr::blocks::nop::make(sizeof(int)); + gr_block_sptr nop2 = gr::blocks::nop::make(sizeof(int)); fg->connect(nop1, 0, nop2, 0); fg->disconnect(nop1, 0, nop2, 0); @@ -136,9 +136,9 @@ void qa_gr_flowgraph::t10_disconnect_unconnected_block() { gr_flowgraph_sptr fg = gr_make_flowgraph(); - gr_block_sptr nop1 = gr_make_nop(sizeof(int)); - gr_block_sptr nop2 = gr_make_nop(sizeof(int)); - gr_block_sptr nop3 = gr_make_nop(sizeof(int)); + gr_block_sptr nop1 = gr::blocks::nop::make(sizeof(int)); + gr_block_sptr nop2 = gr::blocks::nop::make(sizeof(int)); + gr_block_sptr nop3 = gr::blocks::nop::make(sizeof(int)); fg->connect(nop1, 0, nop2, 0); CPPUNIT_ASSERT_THROW(fg->disconnect(nop1, 0, nop3, 0), std::invalid_argument); @@ -148,8 +148,8 @@ void qa_gr_flowgraph::t11_disconnect_unconnected_port() { gr_flowgraph_sptr fg = gr_make_flowgraph(); - gr_block_sptr nop1 = gr_make_nop(sizeof(int)); - gr_block_sptr nop2 = gr_make_nop(sizeof(int)); + gr_block_sptr nop1 = gr::blocks::nop::make(sizeof(int)); + gr_block_sptr nop2 = gr::blocks::nop::make(sizeof(int)); fg->connect(nop1, 0, nop2, 0); CPPUNIT_ASSERT_THROW(fg->disconnect(nop1, 0, nop2, 1), std::invalid_argument); @@ -159,8 +159,8 @@ void qa_gr_flowgraph::t12_validate() { gr_flowgraph_sptr fg = gr_make_flowgraph(); - gr_block_sptr nop1 = gr_make_nop(sizeof(int)); - gr_block_sptr nop2 = gr_make_nop(sizeof(int)); + gr_block_sptr nop1 = gr::blocks::nop::make(sizeof(int)); + gr_block_sptr nop2 = gr::blocks::nop::make(sizeof(int)); fg->connect(nop1, 0, nop2, 0); fg->validate(); @@ -170,8 +170,8 @@ void qa_gr_flowgraph::t13_validate_missing_input_assignment() { gr_flowgraph_sptr fg = gr_make_flowgraph(); - gr_block_sptr nop1 = gr_make_nop(sizeof(int)); - gr_block_sptr nop2 = gr_make_nop(sizeof(int)); + gr_block_sptr nop1 = gr::blocks::nop::make(sizeof(int)); + gr_block_sptr nop2 = gr::blocks::nop::make(sizeof(int)); fg->connect(nop1, 0, nop2, 0); fg->connect(nop1, 0, nop2, 2); @@ -182,8 +182,8 @@ void qa_gr_flowgraph::t14_validate_missing_output_assignment() { gr_flowgraph_sptr fg = gr_make_flowgraph(); - gr_block_sptr nop1 = gr_make_nop(sizeof(int)); - gr_block_sptr nop2 = gr_make_nop(sizeof(int)); + gr_block_sptr nop1 = gr::blocks::nop::make(sizeof(int)); + gr_block_sptr nop2 = gr::blocks::nop::make(sizeof(int)); fg->connect(nop1, 0, nop2, 0); fg->connect(nop1, 2, nop2, 1); @@ -194,8 +194,8 @@ void qa_gr_flowgraph::t15_clear() { gr_flowgraph_sptr fg = gr_make_flowgraph(); - gr_block_sptr nop1 = gr_make_nop(sizeof(int)); - gr_block_sptr nop2 = gr_make_nop(sizeof(int)); + gr_block_sptr nop1 = gr::blocks::nop::make(sizeof(int)); + gr_block_sptr nop2 = gr::blocks::nop::make(sizeof(int)); fg->connect(nop1, 0, nop2, 0); @@ -212,17 +212,17 @@ void qa_gr_flowgraph::t16_partition() { gr_flowgraph_sptr fg = gr_make_flowgraph(); - gr_block_sptr nop11 = gr_make_nop(sizeof(int)); - gr_block_sptr nop12 = gr_make_nop(sizeof(int)); - gr_block_sptr nop13 = gr_make_nop(sizeof(int)); - gr_block_sptr nop14 = gr_make_nop(sizeof(int)); + gr_block_sptr nop11 = gr::blocks::nop::make(sizeof(int)); + gr_block_sptr nop12 = gr::blocks::nop::make(sizeof(int)); + gr_block_sptr nop13 = gr::blocks::nop::make(sizeof(int)); + gr_block_sptr nop14 = gr::blocks::nop::make(sizeof(int)); - gr_block_sptr nop21 = gr_make_nop(sizeof(int)); - gr_block_sptr nop22 = gr_make_nop(sizeof(int)); - gr_block_sptr nop23 = gr_make_nop(sizeof(int)); + gr_block_sptr nop21 = gr::blocks::nop::make(sizeof(int)); + gr_block_sptr nop22 = gr::blocks::nop::make(sizeof(int)); + gr_block_sptr nop23 = gr::blocks::nop::make(sizeof(int)); - gr_block_sptr nop31 = gr_make_nop(sizeof(int)); - gr_block_sptr nop32 = gr_make_nop(sizeof(int)); + gr_block_sptr nop31 = gr::blocks::nop::make(sizeof(int)); + gr_block_sptr nop32 = gr::blocks::nop::make(sizeof(int)); // Build disjoint graph #1 fg->connect(nop11, 0, nop12, 0); diff --git a/gnuradio-core/src/lib/runtime/qa_gr_flowgraph.h b/gr-blocks/lib/qa_gr_flowgraph.h index 2c2686f71b..2c2686f71b 100644 --- a/gnuradio-core/src/lib/runtime/qa_gr_flowgraph.h +++ b/gr-blocks/lib/qa_gr_flowgraph.h diff --git a/gnuradio-core/src/lib/runtime/qa_gr_hier_block2.cc b/gr-blocks/lib/qa_gr_hier_block2.cc index 9844d33814..a3d599039c 100644 --- a/gnuradio-core/src/lib/runtime/qa_gr_hier_block2.cc +++ b/gr-blocks/lib/qa_gr_hier_block2.cc @@ -27,8 +27,6 @@ #include <qa_gr_hier_block2.h> #include <gr_hier_block2.h> #include <gr_io_signature.h> -#include <gr_null_source.h> -#include <gr_null_sink.h> void qa_gr_hier_block2::test_make() { diff --git a/gnuradio-core/src/lib/runtime/qa_gr_hier_block2.h b/gr-blocks/lib/qa_gr_hier_block2.h index 653cd27251..653cd27251 100644 --- a/gnuradio-core/src/lib/runtime/qa_gr_hier_block2.h +++ b/gr-blocks/lib/qa_gr_hier_block2.h diff --git a/gnuradio-core/src/lib/runtime/qa_gr_hier_block2_derived.cc b/gr-blocks/lib/qa_gr_hier_block2_derived.cc index 060c4e2447..eb747d32cc 100644 --- a/gnuradio-core/src/lib/runtime/qa_gr_hier_block2_derived.cc +++ b/gr-blocks/lib/qa_gr_hier_block2_derived.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2006,2008 Free Software Foundation, Inc. + * Copyright 2006,2008,2013 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -27,10 +27,10 @@ #include <qa_gr_hier_block2_derived.h> #include <gr_top_block.h> #include <gr_io_signature.h> -#include <gr_null_source.h> -#include <gr_null_sink.h> -#include <gr_head.h> -#include <gr_kludge_copy.h> +#include <blocks/null_source.h> +#include <blocks/null_sink.h> +#include <blocks/head.h> +#include <blocks/copy.h> // Declare a test C++ hierarchical block @@ -60,7 +60,7 @@ gr_derived_block::gr_derived_block() gr_make_io_signature(1, 1, sizeof(int)), // Input signature gr_make_io_signature(1, 1, sizeof(int))) // Output signature { - gr_block_sptr copy(gr_make_kludge_copy(sizeof(int))); + gr_block_sptr copy(gr::blocks::copy::make(sizeof(int))); connect(self(), 0, copy, 0); connect(copy, 0, self(), 0); @@ -74,10 +74,10 @@ void qa_gr_hier_block2_derived::test_1() { gr_top_block_sptr tb(gr_make_top_block("test")); - gr_block_sptr src(gr_make_null_source(sizeof(int))); - gr_block_sptr head(gr_make_head(sizeof(int), 1000)); + gr_block_sptr src(gr::blocks::null_source::make(sizeof(int))); + gr_block_sptr head(gr::blocks::head::make(sizeof(int), 1000)); gr_derived_block_sptr blk(gr_make_derived_block()); - gr_block_sptr dst(gr_make_null_sink(sizeof(int))); + gr_block_sptr dst(gr::blocks::null_sink::make(sizeof(int))); tb->connect(src, 0, head, 0); tb->connect(head, 0, blk, 0); diff --git a/gnuradio-core/src/lib/runtime/qa_gr_hier_block2_derived.h b/gr-blocks/lib/qa_gr_hier_block2_derived.h index 8e0a1880ce..8e0a1880ce 100644 --- a/gnuradio-core/src/lib/runtime/qa_gr_hier_block2_derived.h +++ b/gr-blocks/lib/qa_gr_hier_block2_derived.h diff --git a/gnuradio-core/src/lib/runtime/qa_gr_top_block.cc b/gr-blocks/lib/qa_gr_top_block.cc index 1d3dafadf8..9833ed7f8b 100644 --- a/gnuradio-core/src/lib/runtime/qa_gr_top_block.cc +++ b/gr-blocks/lib/qa_gr_top_block.cc @@ -26,10 +26,10 @@ #include <qa_gr_top_block.h> #include <gr_top_block.h> -#include <gr_head.h> -#include <gr_nop.h> -#include <gr_null_source.h> -#include <gr_null_sink.h> +#include <blocks/head.h> +#include <blocks/nop.h> +#include <blocks/null_source.h> +#include <blocks/null_sink.h> #include <iostream> #define VERBOSE 0 @@ -49,9 +49,9 @@ void qa_gr_top_block::t1_run() gr_top_block_sptr tb = gr_make_top_block("top"); - gr_block_sptr src = gr_make_null_source(sizeof(int)); - gr_block_sptr head = gr_make_head(sizeof(int), 100000); - gr_block_sptr dst = gr_make_null_sink(sizeof(int)); + gr_block_sptr src = gr::blocks::null_source::make(sizeof(int)); + gr_block_sptr head = gr::blocks::head::make(sizeof(int), 100000); + gr_block_sptr dst = gr::blocks::null_sink::make(sizeof(int)); tb->connect(src, 0, head, 0); tb->connect(head, 0, dst, 0); @@ -64,9 +64,9 @@ void qa_gr_top_block::t2_start_stop_wait() gr_top_block_sptr tb = gr_make_top_block("top"); - gr_block_sptr src = gr_make_null_source(sizeof(int)); - gr_block_sptr head = gr_make_head(sizeof(int), 100000); - gr_block_sptr dst = gr_make_null_sink(sizeof(int)); + gr_block_sptr src = gr::blocks::null_source::make(sizeof(int)); + gr_block_sptr head = gr::blocks::head::make(sizeof(int), 100000); + gr_block_sptr dst = gr::blocks::null_sink::make(sizeof(int)); tb->connect(src, 0, head, 0); tb->connect(head, 0, dst, 0); @@ -82,8 +82,8 @@ void qa_gr_top_block::t3_lock_unlock() gr_top_block_sptr tb = gr_make_top_block("top"); - gr_block_sptr src = gr_make_null_source(sizeof(int)); - gr_block_sptr dst = gr_make_null_sink(sizeof(int)); + gr_block_sptr src = gr::blocks::null_source::make(sizeof(int)); + gr_block_sptr dst = gr::blocks::null_sink::make(sizeof(int)); tb->connect(src, 0, dst, 0); @@ -102,9 +102,9 @@ void qa_gr_top_block::t4_reconfigure() gr_top_block_sptr tb = gr_make_top_block("top"); - gr_block_sptr src = gr_make_null_source(sizeof(int)); - gr_block_sptr head = gr_make_head(sizeof(int), 100000); - gr_block_sptr dst = gr_make_null_sink(sizeof(int)); + gr_block_sptr src = gr::blocks::null_source::make(sizeof(int)); + gr_block_sptr head = gr::blocks::head::make(sizeof(int), 100000); + gr_block_sptr dst = gr::blocks::null_sink::make(sizeof(int)); // Start infinite flowgraph tb->connect(src, 0, dst, 0); @@ -128,9 +128,9 @@ void qa_gr_top_block::t5_max_noutputs() gr_top_block_sptr tb = gr_make_top_block("top"); - gr_block_sptr src = gr_make_null_source(sizeof(int)); - gr_block_sptr head = gr_make_head(sizeof(int), 100000); - gr_block_sptr dst = gr_make_null_sink(sizeof(int)); + gr_block_sptr src = gr::blocks::null_source::make(sizeof(int)); + gr_block_sptr head = gr::blocks::head::make(sizeof(int), 100000); + gr_block_sptr dst = gr::blocks::null_sink::make(sizeof(int)); // Start infinite flowgraph tb->connect(src, 0, head, 0); @@ -145,9 +145,9 @@ void qa_gr_top_block::t6_reconfig_max_noutputs() gr_top_block_sptr tb = gr_make_top_block("top"); - gr_block_sptr src = gr_make_null_source(sizeof(int)); - gr_block_sptr head = gr_make_head(sizeof(int), 100000); - gr_block_sptr dst = gr_make_null_sink(sizeof(int)); + gr_block_sptr src = gr::blocks::null_source::make(sizeof(int)); + gr_block_sptr head = gr::blocks::head::make(sizeof(int), 100000); + gr_block_sptr dst = gr::blocks::null_sink::make(sizeof(int)); // Start infinite flowgraph tb->connect(src, 0, dst, 0); @@ -172,9 +172,9 @@ void qa_gr_top_block::t7_max_noutputs_per_block() gr_top_block_sptr tb = gr_make_top_block("top"); - gr_block_sptr src = gr_make_null_source(sizeof(int)); - gr_block_sptr head = gr_make_head(sizeof(int), 100000); - gr_block_sptr dst = gr_make_null_sink(sizeof(int)); + gr_block_sptr src = gr::blocks::null_source::make(sizeof(int)); + gr_block_sptr head = gr::blocks::head::make(sizeof(int), 100000); + gr_block_sptr dst = gr::blocks::null_sink::make(sizeof(int)); head->set_max_noutput_items(100); @@ -191,9 +191,9 @@ void qa_gr_top_block::t8_reconfig_max_noutputs_per_block() gr_top_block_sptr tb = gr_make_top_block("top"); - gr_block_sptr src = gr_make_null_source(sizeof(int)); - gr_block_sptr head = gr_make_head(sizeof(int), 100000); - gr_block_sptr dst = gr_make_null_sink(sizeof(int)); + gr_block_sptr src = gr::blocks::null_source::make(sizeof(int)); + gr_block_sptr head = gr::blocks::head::make(sizeof(int), 100000); + gr_block_sptr dst = gr::blocks::null_sink::make(sizeof(int)); head->set_max_noutput_items(99); @@ -220,9 +220,9 @@ void qa_gr_top_block::t9_max_output_buffer() gr_top_block_sptr tb = gr_make_top_block("top"); - gr_block_sptr src = gr_make_null_source(sizeof(int)); - gr_block_sptr head = gr_make_head(sizeof(int), 100000); - gr_block_sptr dst = gr_make_null_sink(sizeof(int)); + gr_block_sptr src = gr::blocks::null_source::make(sizeof(int)); + gr_block_sptr head = gr::blocks::head::make(sizeof(int), 100000); + gr_block_sptr dst = gr::blocks::null_sink::make(sizeof(int)); head->set_max_output_buffer(1024); @@ -239,9 +239,9 @@ void qa_gr_top_block::t10_reconfig_max_output_buffer() gr_top_block_sptr tb = gr_make_top_block("top"); - gr_block_sptr src = gr_make_null_source(sizeof(int)); - gr_block_sptr head = gr_make_head(sizeof(int), 100000); - gr_block_sptr dst = gr_make_null_sink(sizeof(int)); + gr_block_sptr src = gr::blocks::null_source::make(sizeof(int)); + gr_block_sptr head = gr::blocks::head::make(sizeof(int), 100000); + gr_block_sptr dst = gr::blocks::null_sink::make(sizeof(int)); head->set_max_output_buffer(1000); @@ -251,7 +251,7 @@ void qa_gr_top_block::t10_reconfig_max_output_buffer() // Reconfigure with gr_head in the middle tb->lock(); - gr_block_sptr nop = gr_make_nop(sizeof(int)); + gr_block_sptr nop = gr::blocks::nop::make(sizeof(int)); nop->set_max_output_buffer(4000); tb->disconnect(src, 0, dst, 0); tb->connect(src, 0, head, 0); @@ -266,8 +266,8 @@ void qa_gr_top_block::t10_reconfig_max_output_buffer() void qa_gr_top_block::t11_set_block_affinity() { gr_top_block_sptr tb = gr_make_top_block("top"); - gr_block_sptr src (gr_make_null_source(sizeof(float))); - gr_block_sptr snk (gr_make_null_sink(sizeof(float))); + gr_block_sptr src (gr::blocks::null_source::make(sizeof(float))); + gr_block_sptr snk (gr::blocks::null_sink::make(sizeof(float))); std::vector<unsigned int> set(1, 0), ret; src->set_processor_affinity(set); diff --git a/gnuradio-core/src/lib/runtime/qa_gr_top_block.h b/gr-blocks/lib/qa_gr_top_block.h index 634eeab1f8..634eeab1f8 100644 --- a/gnuradio-core/src/lib/runtime/qa_gr_top_block.h +++ b/gr-blocks/lib/qa_gr_top_block.h diff --git a/gr-blocks/lib/qa_rotator.cc b/gr-blocks/lib/qa_rotator.cc new file mode 100644 index 0000000000..86bbdd5282 --- /dev/null +++ b/gr-blocks/lib/qa_rotator.cc @@ -0,0 +1,75 @@ +/* -*- c++ -*- */ +/* + * Copyright 2002,2013 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio 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 3, or (at your option) + * any later version. + * + * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <gruel/attributes.h> +#include <cppunit/TestAssert.h> +#include <qa_rotator.h> +#include <blocks/rotator.h> +#include <stdio.h> +#include <cmath> +#include <gr_expj.h> + +// error vector magnitude +__GR_ATTR_UNUSED static float +error_vector_mag(gr_complex a, gr_complex b) +{ + return abs(a-b); +} + +void +qa_rotator::t1() +{ + static const unsigned int N = 100000; + + gr::blocks::rotator r; + + double phase_incr = 2*M_PI / 1003; + double phase = 0; + + // Old code: We increment then return the rotated value, thus we + // need to start one tick back r.set_phase(gr_complex(1,0) * + // conj(gr_expj(phase_incr))); + + r.set_phase(gr_complex(1,0)); + r.set_phase_incr(gr_expj(phase_incr)); + + for(unsigned i = 0; i < N; i++) { + gr_complex expected = gr_expj(phase); + gr_complex actual = r.rotate(gr_complex(1, 0)); + +#if 0 + float evm = error_vector_mag(expected, actual); + printf("[%6d] expected: (%8.6f, %8.6f) actual: (%8.6f, %8.6f) evm: %8.6f\n", + i, expected.real(), expected.imag(), actual.real(), actual.imag(), evm); +#endif + + CPPUNIT_ASSERT_COMPLEXES_EQUAL(expected, actual, 0.0001); + + phase += phase_incr; + if(phase >= 2*M_PI) + phase -= 2*M_PI; + } +} diff --git a/gnuradio-core/src/lib/general/gr_iqcomp_cc.i b/gr-blocks/lib/qa_rotator.h index 5cca59dd5d..575ea506c7 100644 --- a/gnuradio-core/src/lib/general/gr_iqcomp_cc.i +++ b/gr-blocks/lib/qa_rotator.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2008 Free Software Foundation, Inc. + * Copyright 2008,2013 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -20,17 +20,20 @@ * Boston, MA 02110-1301, USA. */ +#ifndef _QA_GR_ROTATOR_H_ +#define _QA_GR_ROTATOR_H_ -GR_SWIG_BLOCK_MAGIC(gr,iqcomp_cc) +#include <cppunit/extensions/HelperMacros.h> +#include <cppunit/TestCase.h> -gr_iqcomp_cc_sptr gr_make_iqcomp_cc (float mu); - -class gr_iqcomp_cc : public gr_sync_block +class qa_rotator : public CppUnit::TestCase { - private: - gr_iqcomp_cc (float mu); + CPPUNIT_TEST_SUITE(qa_rotator); + CPPUNIT_TEST(t1); + CPPUNIT_TEST_SUITE_END(); - public: - float mu () const { return d_mu; } - void set_mu (float mu) { d_mu = mu; } + private: + void t1(); }; + +#endif /* _QA_GR_ROTATOR_H_ */ diff --git a/gnuradio-core/src/lib/runtime/qa_set_msg_handler.cc b/gr-blocks/lib/qa_set_msg_handler.cc index ac06a3f8bc..cfb990f0c4 100644 --- a/gnuradio-core/src/lib/runtime/qa_set_msg_handler.cc +++ b/gr-blocks/lib/qa_set_msg_handler.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2007,2011 Free Software Foundation, Inc. + * Copyright 2007,2011,2013 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -26,10 +26,10 @@ #include <qa_set_msg_handler.h> #include <gr_top_block.h> -#include <gr_head.h> -#include <gr_null_source.h> -#include <gr_null_sink.h> -#include <gr_nop.h> +#include <blocks/head.h> +#include <blocks/null_source.h> +#include <blocks/null_sink.h> +#include <blocks/nop.h> #include <gruel/msg_passing.h> #include <iostream> #include <boost/thread/thread.hpp> @@ -38,10 +38,9 @@ #define VERBOSE 0 /* - * The gr_nop block has been instrumented so that it counts - * the number of messages sent to it. We use this feature - * to confirm that gr_nop's call to set_msg_handler is working - * correctly. + * The gr::block::nop block has been instrumented so that it counts + * the number of messages sent to it. We use this feature to confirm + * that gr::blocks::nop's call to set_msg_handler is working correctly. */ void qa_set_msg_handler::t0() @@ -52,9 +51,9 @@ void qa_set_msg_handler::t0() gr_top_block_sptr tb = gr_make_top_block("top"); - gr_block_sptr src = gr_make_null_source(sizeof(int)); - gr_nop_sptr nop = gr_make_nop(sizeof(int)); - gr_block_sptr dst = gr_make_null_sink(sizeof(int)); + gr_block_sptr src = gr::blocks::null_source::make(sizeof(int)); + gr::blocks::nop::sptr nop = gr::blocks::nop::make(sizeof(int)); + gr_block_sptr dst = gr::blocks::null_sink::make(sizeof(int)); tb->connect(src, 0, nop, 0); tb->connect(nop, 0, dst, 0); diff --git a/gnuradio-core/src/lib/runtime/qa_set_msg_handler.h b/gr-blocks/lib/qa_set_msg_handler.h index 60277a12cc..60277a12cc 100644 --- a/gnuradio-core/src/lib/runtime/qa_set_msg_handler.h +++ b/gr-blocks/lib/qa_set_msg_handler.h diff --git a/gr-blocks/lib/skiphead_impl.cc b/gr-blocks/lib/skiphead_impl.cc new file mode 100644 index 0000000000..feb39eb8f4 --- /dev/null +++ b/gr-blocks/lib/skiphead_impl.cc @@ -0,0 +1,93 @@ +/* -*- c++ -*- */ +/* + * Copyright 2005,2007,2010,2013 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio 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 3, or (at your option) + * any later version. + * + * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include "skiphead_impl.h" +#include <gr_io_signature.h> +#include <string.h> + +namespace gr { + namespace blocks { + + skiphead::sptr + skiphead::make(size_t itemsize, uint64_t nitems_to_skip) + { + return gnuradio::get_initial_sptr + (new skiphead_impl(itemsize, nitems_to_skip)); + } + + skiphead_impl::skiphead_impl(size_t itemsize, uint64_t nitems_to_skip) + : gr_block("skiphead", + gr_make_io_signature(1, 1, itemsize), + gr_make_io_signature(1, 1, itemsize)), + d_nitems_to_skip(nitems_to_skip), d_nitems(0) + { + } + + skiphead_impl::~skiphead_impl() + { + } + + int + skiphead_impl::general_work(int noutput_items, + gr_vector_int &ninput_items_, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) + { + const char *in = (const char*)input_items[0]; + char *out = (char*)output_items[0]; + + int ninput_items = std::min(ninput_items_[0], noutput_items); + int ii = 0; // input index + + while (ii < ninput_items) { + uint64_t ni_total = ii + d_nitems; // total items processed so far + if(ni_total < d_nitems_to_skip) { // need to skip some more + + int n_to_skip = (int)std::min(d_nitems_to_skip - ni_total, + (uint64_t)(ninput_items - ii)); + ii += n_to_skip; + } + + else { // nothing left to skip. copy away + int n_to_copy = ninput_items - ii; + if(n_to_copy > 0) { + size_t itemsize = output_signature()->sizeof_stream_item(0); + memcpy(out, in + (ii*itemsize), n_to_copy*itemsize); + } + + d_nitems += ninput_items; + consume_each(ninput_items); + return n_to_copy; + } + } + + d_nitems += ninput_items; + consume_each(ninput_items); + return 0; + } + + } /* namespace blocks */ +} /* namespace gr */ diff --git a/gr-blocks/lib/skiphead_impl.h b/gr-blocks/lib/skiphead_impl.h new file mode 100644 index 0000000000..d8e0870cb1 --- /dev/null +++ b/gr-blocks/lib/skiphead_impl.h @@ -0,0 +1,50 @@ +/* -*- c++ -*- */ +/* + * Copyright 2005,2013 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio 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 3, or (at your option) + * any later version. + * + * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_GR_SKIPHEAD_IMPL_H +#define INCLUDED_GR_SKIPHEAD_IMPL_H + +#include <blocks/skiphead.h> + +namespace gr { + namespace blocks { + + class skiphead_impl : public skiphead + { + private: + uint64_t d_nitems_to_skip; + uint64_t d_nitems; // total items seen + + public: + skiphead_impl(size_t itemsize, uint64_t nitems_to_skip); + ~skiphead_impl(); + + int general_work(int noutput_items, + gr_vector_int &ninput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_GR_SKIPHEAD_IMPL_H */ diff --git a/gr-blocks/lib/vector_insert_X_impl.cc.t b/gr-blocks/lib/vector_insert_X_impl.cc.t new file mode 100644 index 0000000000..adf31fe05a --- /dev/null +++ b/gr-blocks/lib/vector_insert_X_impl.cc.t @@ -0,0 +1,109 @@ +/* -*- c++ -*- */ +/* + * Copyright 2012 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio 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 3, or (at your option) + * any later version. + * + * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +// @WARNING@ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <@NAME_IMPL@.h> +#include <algorithm> +#include <gr_io_signature.h> +#include <stdexcept> +#include <stdio.h> + +namespace gr { + namespace blocks { + + @NAME@::sptr + @NAME@::make(const std::vector<@TYPE@> &data, int periodicity, int offset) + { + return gnuradio::get_initial_sptr + (new @NAME_IMPL@(data, periodicity, offset)); + } + + @NAME_IMPL@::@NAME_IMPL@(const std::vector<@TYPE@> &data, + int periodicity, int offset) + : gr_block("@BASE_NAME@", + gr_make_io_signature(1, 1, sizeof(@TYPE@)), + gr_make_io_signature(1, 1, sizeof(@TYPE@))), + d_data(data), + d_offset(offset), + d_periodicity(periodicity) + { + //printf("INITIAL: periodicity = %d, offset = %d\n", periodicity, offset); + // some sanity checks + assert(offset < periodicity); + assert(offset >= 0); + assert((size_t)periodicity > data.size()); + } + + @NAME_IMPL@::~@NAME_IMPL@() + {} + + int + @NAME_IMPL@::general_work(int noutput_items, + gr_vector_int &ninput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) + { + @TYPE@ *out = (@TYPE@ *)output_items[0]; + const @TYPE@ *in = (const @TYPE@ *)input_items[0]; + + int ii(0), oo(0); + + while((oo < noutput_items) && (ii < ninput_items[0])) { + //printf("oo = %d, ii = %d, d_offset = %d, noutput_items = %d, ninput_items[0] = %d", oo, ii, d_offset, noutput_items, ninput_items[0]); + //printf(", d_periodicity = %d\n", d_periodicity); + + if(d_offset >= ((int)d_data.size())) { // if we are in the copy region + int max_copy = std::min(std::min(noutput_items - oo, ninput_items[0] - ii), + d_periodicity - d_offset); + //printf("copy %d from input\n", max_copy); + memcpy( &out[oo], &in[ii], sizeof(@TYPE@)*max_copy ); + //printf(" * memcpy returned.\n"); + ii += max_copy; + oo += max_copy; + d_offset = (d_offset + max_copy)%d_periodicity; + } + else { // if we are in the insertion region + int max_copy = std::min(noutput_items - oo, ((int)d_data.size()) - d_offset); + //printf("copy %d from d_data[%d] to out[%d]\n", max_copy, d_offset, oo); + memcpy(&out[oo], &d_data[d_offset], sizeof(@TYPE@)*max_copy); + //printf(" * memcpy returned.\n"); + oo += max_copy; + d_offset = (d_offset + max_copy)%d_periodicity; + //printf(" ## (inelse) oo = %d, d_offset = %d\n", oo, d_offset); + } + + //printf(" # exit else, on to next loop.\n"); + } + //printf(" # got out of loop\n"); + + //printf("consume = %d, produce = %d\n", ii, oo); + consume_each(ii); + return oo; + } + + } /* namespace blocks */ +} /* namespace gr */ diff --git a/gr-blocks/lib/vector_insert_X_impl.h.t b/gr-blocks/lib/vector_insert_X_impl.h.t new file mode 100644 index 0000000000..f447ef1e80 --- /dev/null +++ b/gr-blocks/lib/vector_insert_X_impl.h.t @@ -0,0 +1,58 @@ +/* -*- c++ -*- */ +/* + * Copyright 2012,2013 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio 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 3, or (at your option) + * any later version. + * + * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +// @WARNING@ + +#ifndef @GUARD_NAME_IMPL@ +#define @GUARD_NAME_IMPL@ + +#include <blocks/@NAME@.h> + +namespace gr { + namespace blocks { + + class @NAME_IMPL@ : public @NAME@ + { + private: + std::vector<@TYPE@> d_data; + int d_offset; + int d_periodicity; + + public: + @NAME_IMPL@(const std::vector<@TYPE@> &data, + int periodicity, int offset); + ~@NAME_IMPL@(); + + void rewind() { d_offset=0; } + void set_data(const std::vector<@TYPE@> &data) { + d_data = data; rewind(); } + + int general_work(int noutput_items, + gr_vector_int &ninput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* @GUARD_NAME_IMPL@ */ diff --git a/gr-blocks/lib/vector_map_impl.cc b/gr-blocks/lib/vector_map_impl.cc new file mode 100644 index 0000000000..cefaaeea35 --- /dev/null +++ b/gr-blocks/lib/vector_map_impl.cc @@ -0,0 +1,127 @@ +/* -*- c++ -*- */ +/* + * Copyright 2012,2013 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio 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 3, or (at your option) + * any later version. + * + * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "vector_map_impl.h" +#include <gr_io_signature.h> +#include <string.h> + +namespace gr { + namespace blocks { + + std::vector<int> + get_in_sizeofs(size_t item_size, std::vector<size_t> in_vlens) + { + std::vector<int> in_sizeofs; + for(unsigned int i = 0; i < in_vlens.size(); i++) { + in_sizeofs.push_back(in_vlens[i]*item_size); + } + return in_sizeofs; + } + + std::vector<int> + get_out_sizeofs(size_t item_size, + std::vector< std::vector< std::vector<size_t> > > mapping) + { + std::vector<int> out_sizeofs; + for(unsigned int i = 0; i < mapping.size(); i++) { + out_sizeofs.push_back(mapping[i].size()*item_size); + } + return out_sizeofs; + } + + vector_map::sptr + vector_map::make(size_t item_size, std::vector<size_t> in_vlens, + std::vector< std::vector< std::vector<size_t> > > mapping) + { + return gnuradio::get_initial_sptr + (new vector_map_impl(item_size, in_vlens, mapping)); + } + + vector_map_impl::vector_map_impl(size_t item_size, std::vector<size_t> in_vlens, + std::vector< std::vector< std::vector<size_t> > > mapping) + : gr_sync_block("vector_map", + gr_make_io_signaturev(in_vlens.size(), in_vlens.size(), + get_in_sizeofs(item_size, in_vlens)), + gr_make_io_signaturev(mapping.size(), mapping.size(), + get_out_sizeofs(item_size, mapping))), + d_item_size(item_size), d_in_vlens(in_vlens) + { + set_mapping(mapping); + } + + vector_map_impl::~vector_map_impl() + { + } + + void + vector_map_impl::set_mapping(std::vector< std::vector< std::vector<size_t> > > mapping) + { + // Make sure the contents of the mapping vectors are possible. + for(unsigned int i=0; i<mapping.size(); i++) { + for(unsigned int j=0; j<mapping[i].size(); j++) { + if(mapping[i][j].size() != 2) { + throw std::runtime_error("Mapping must be of the form (out_mapping_stream1, out_mapping_stream2, ...), where out_mapping_stream1 is of the form (mapping_element1, mapping_element2, ...), where mapping_element1 is of the form (input_stream, input_element). This error is raised because a mapping_element vector does not contain exactly 2 items."); + } + unsigned int s = mapping[i][j][0]; + unsigned int index = mapping[i][j][1]; + if(s >= d_in_vlens.size()) { + throw std::runtime_error("Stream numbers in mapping must be less than the number of input streams."); + } + if((index < 0) || (index >= d_in_vlens[s])) { + throw std::runtime_error ("Indices in mapping must be greater than 0 and less than the input vector lengths."); + } + } + } + gruel::scoped_lock guard(d_mutex); + d_mapping = mapping; + } + + int + vector_map_impl::work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) + { + const char **inv = (const char**)&input_items[0]; + char **outv = (char**)&output_items[0]; + + for(unsigned int n = 0; n < (unsigned int)(noutput_items); n++) { + for(unsigned int i = 0; i < d_mapping.size(); i++) { + unsigned int out_vlen = d_mapping[i].size(); + for(unsigned int j = 0; j < out_vlen; j++) { + unsigned int s = d_mapping[i][j][0]; + unsigned int k = d_mapping[i][j][1]; + memcpy(outv[i] + out_vlen*d_item_size*n + + d_item_size*j, inv[s] + d_in_vlens[s]*d_item_size*n + + k*d_item_size, d_item_size); + } + } + } + + return noutput_items; + } + + } /* namespace blocks */ +} /* namespace gr */ diff --git a/gr-blocks/lib/vector_map_impl.h b/gr-blocks/lib/vector_map_impl.h new file mode 100644 index 0000000000..e27b3b9cec --- /dev/null +++ b/gr-blocks/lib/vector_map_impl.h @@ -0,0 +1,55 @@ +/* -*- c++ -*- */ +/* + * Copyright 2012,2013 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio 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 3, or (at your option) + * any later version. + * + * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_GR_VECTOR_MAP_IMPL_H +#define INCLUDED_GR_VECTOR_MAP_IMPL_H + +#include <blocks/vector_map.h> +#include <gruel/thread.h> + +namespace gr { + namespace blocks { + + class vector_map_impl : public vector_map + { + private: + size_t d_item_size; + std::vector<size_t> d_in_vlens; + std::vector< std::vector< std::vector<size_t> > > d_mapping; + gruel::mutex d_mutex; // mutex to protect set/work access + + public: + vector_map_impl(size_t item_size, std::vector<size_t> in_vlens, + std::vector< std::vector< std::vector<size_t> > > mapping); + ~vector_map_impl(); + + void set_mapping(std::vector< std::vector< std::vector<size_t> > > mapping); + + int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_GR_VECTOR_MAP_IMPL_H */ diff --git a/gr-blocks/lib/vector_sink_X_impl.cc.t b/gr-blocks/lib/vector_sink_X_impl.cc.t new file mode 100644 index 0000000000..3be2861025 --- /dev/null +++ b/gr-blocks/lib/vector_sink_X_impl.cc.t @@ -0,0 +1,83 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2008,2010,2013 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio 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 3, or (at your option) + * any later version. + * + * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +// @WARNING@ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <@NAME_IMPL@.h> +#include <gr_io_signature.h> +#include <algorithm> +#include <iostream> + +namespace gr { + namespace blocks { + + @NAME@::sptr + @BASE_NAME@::make(int vlen) + { + return gnuradio::get_initial_sptr + (new @NAME_IMPL@(vlen)); + } + + @NAME_IMPL@::@NAME_IMPL@(int vlen) + : gr_sync_block("@NAME@", + gr_make_io_signature(1, 1, sizeof(@TYPE@) * vlen), + gr_make_io_signature(0, 0, 0)), + d_vlen(vlen) + { + } + + @NAME_IMPL@::~@NAME_IMPL@() + {} + + std::vector<@TYPE@> + @NAME_IMPL@::data() const + { + return d_data; + } + + std::vector<gr_tag_t> + @NAME_IMPL@::tags() const + { + return d_tags; + } + + int + @NAME_IMPL@::work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) + { + @TYPE@ *iptr = (@TYPE@*)input_items[0]; + + for(int i = 0; i < noutput_items * d_vlen; i++) + d_data.push_back (iptr[i]); + std::vector<gr_tag_t> tags; + get_tags_in_range(tags, 0, nitems_read(0), nitems_read(0) + noutput_items); + d_tags.insert(d_tags.end(), tags.begin(), tags.end()); + return noutput_items; + } + + } /* namespace blocks */ +} /* namespace gr */ diff --git a/gnuradio-core/src/lib/gengen/gr_vector_sink_X.i.t b/gr-blocks/lib/vector_sink_X_impl.h.t index ee0ebf378b..60d21e0c8c 100644 --- a/gnuradio-core/src/lib/gengen/gr_vector_sink_X.i.t +++ b/gr-blocks/lib/vector_sink_X_impl.h.t @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2004,2008,2009 Free Software Foundation, Inc. + * Copyright 2004,2008,2009,2013 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -22,19 +22,35 @@ // @WARNING@ +#ifndef @GUARD_NAME_IMPL@ +#define @GUARD_NAME_IMPL@ -GR_SWIG_BLOCK_MAGIC(gr,@BASE_NAME@); +#include <blocks/@NAME@.h> -@SPTR_NAME@ gr_make_@BASE_NAME@ (int vlen = 1); +namespace gr { + namespace blocks { -class @NAME@ : public gr_sync_block { - private: - @NAME@ (int vlen); + class @NAME_IMPL@ : public @NAME@ + { + private: + std::vector<@TYPE@> d_data; + std::vector<gr_tag_t> d_tags; + int d_vlen; - public: - void clear(); // deprecated - void reset(); - std::vector<@TYPE@> data () const; - std::vector<gr_tag_t> tags () const; -}; + public: + @NAME_IMPL@(int vlen); + ~@NAME_IMPL@(); + void reset() { d_data.clear(); } + std::vector<@TYPE@> data() const; + std::vector<gr_tag_t> tags() const; + + int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* @GUARD_NAME_IMPL@ */ diff --git a/gr-blocks/lib/vector_source_X_impl.cc.t b/gr-blocks/lib/vector_source_X_impl.cc.t new file mode 100644 index 0000000000..9c1c63a213 --- /dev/null +++ b/gr-blocks/lib/vector_source_X_impl.cc.t @@ -0,0 +1,144 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2008,2010,2013 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio 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 3, or (at your option) + * any later version. + * + * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +// @WARNING@ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <@NAME_IMPL@.h> +#include <algorithm> +#include <gr_io_signature.h> +#include <stdexcept> + +namespace gr { + namespace blocks { + + @NAME@::sptr + @NAME@::make(const std::vector<@TYPE@> &data, + bool repeat, int vlen, + const std::vector<gr_tag_t> &tags) + { + return gnuradio::get_initial_sptr + (new @NAME_IMPL@(data, repeat, vlen, tags)); + } + + @NAME_IMPL@::@NAME_IMPL@(const std::vector<@TYPE@> &data, + bool repeat, int vlen, + const std::vector<gr_tag_t> &tags) + : gr_sync_block("@BASE_NAME@", + gr_make_io_signature(0, 0, 0), + gr_make_io_signature(1, 1, sizeof(@TYPE@) * vlen)), + d_data(data), + d_repeat(repeat), + d_offset(0), + d_vlen(vlen), + d_tags(tags), + d_tagpos(0) + { + if(tags.size() == 0) { + d_settags = 0; + } + else { + d_settags = 1; + set_output_multiple(data.size() / vlen); + } + if((data.size() % vlen) != 0) + throw std::invalid_argument("data length must be a multiple of vlen"); + } + + @NAME_IMPL@::~@NAME_IMPL@() + {} + + void + @NAME_IMPL@::set_data (const std::vector<@TYPE@> &data, + const std::vector<gr_tag_t> &tags) + { + d_data = data; + d_tags = tags; + rewind(); + if(tags.size() == 0) { + d_settags = false; + } + else { + d_settags = true; + } + } + + int + @NAME_IMPL@::work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) + { + @TYPE@ *optr = (@TYPE@ *) output_items[0]; + + if(d_repeat) { + unsigned int size = d_data.size (); + unsigned int offset = d_offset; + if(size == 0) + return -1; + + if(d_settags) { + int n_outputitems_per_vector = d_data.size() / d_vlen; + for(int i = 0; i < noutput_items; i += n_outputitems_per_vector) { + // FIXME do proper vector copy + memcpy((void *) optr, (const void*)&d_data[0], size*sizeof (@TYPE@)); + optr += size; + for(unsigned t = 0; t < d_tags.size(); t++) { + add_item_tag(0, nitems_written(0)+i+d_tags[t].offset, + d_tags[t].key, d_tags[t].value); + } + } + } + else { + for(int i = 0; i < noutput_items*d_vlen; i++) { + optr[i] = d_data[offset++]; + if(offset >= size) { + offset = 0; + } + } + } + + d_offset = offset; + return noutput_items; + } + else { + if(d_offset >= d_data.size ()) + return -1; // Done! + + unsigned n = std::min((unsigned)d_data.size() - d_offset, + (unsigned)noutput_items*d_vlen); + for(unsigned i = 0; i < n; i++) { + optr[i] = d_data[d_offset + i]; + } + for(unsigned t = 0; t < d_tags.size(); t++) { + if((d_tags[t].offset >= d_offset) && (d_tags[t].offset < d_offset+n)) + add_item_tag(0, d_tags[t].offset, d_tags[t].key, d_tags[t].value); + } + d_offset += n; + return n/d_vlen; + } + } + + } /* namespace blocks */ +} /* namespace gr */ diff --git a/gr-blocks/lib/vector_source_X_impl.h.t b/gr-blocks/lib/vector_source_X_impl.h.t new file mode 100644 index 0000000000..78ec52bacf --- /dev/null +++ b/gr-blocks/lib/vector_source_X_impl.h.t @@ -0,0 +1,62 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2008,2012-2013 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio 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 3, or (at your option) + * any later version. + * + * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +// @WARNING@ + +#ifndef @GUARD_NAME_IMPL@ +#define @GUARD_NAME_IMPL@ + +#include <blocks/@NAME@.h> + +namespace gr { + namespace blocks { + + class @NAME_IMPL@ : public @NAME@ + { + private: + std::vector<@TYPE@> d_data; + bool d_repeat; + unsigned int d_offset; + int d_vlen; + bool d_settags; + std::vector<gr_tag_t> d_tags; + unsigned int d_tagpos; + + public: + @NAME_IMPL@(const std::vector<@TYPE@> &data, + bool repeat, int vlen, + const std::vector<gr_tag_t> &tags); + ~@NAME_IMPL@(); + + void rewind() { d_offset=0; } + void set_data(const std::vector<@TYPE@> &data, + const std::vector<gr_tag_t> &tags); + + int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* @GUARD_NAME_IMPL@ */ diff --git a/gr-blocks/python/qa_add_mult_div_sub.py b/gr-blocks/python/qa_add_mult_div_sub.py index 0aca03d3fd..6d48a6c389 100755 --- a/gr-blocks/python/qa_add_mult_div_sub.py +++ b/gr-blocks/python/qa_add_mult_div_sub.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2004,2007,2010,2012 Free Software Foundation, Inc. +# Copyright 2004,2007,2010,2012,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -21,7 +21,7 @@ # from gnuradio import gr, gr_unittest -import blocks_swig +import blocks_swig as blocks class test_add_mult_div_sub(gr_unittest.TestCase): @@ -33,9 +33,9 @@ class test_add_mult_div_sub(gr_unittest.TestCase): def help_ii(self, src_data, exp_data, op): for s in zip(range(len(src_data)), src_data): - src = gr.vector_source_i(s[1]) + src = blocks.vector_source_i(s[1]) self.tb.connect(src, (op, s[0])) - dst = gr.vector_sink_i() + dst = blocks.vector_sink_i() self.tb.connect(op, dst) self.tb.run() result_data = dst.data() @@ -43,9 +43,9 @@ class test_add_mult_div_sub(gr_unittest.TestCase): def help_ss(self, src_data, exp_data, op): for s in zip(range(len(src_data)), src_data): - src = gr.vector_source_s(s[1]) + src = blocks.vector_source_s(s[1]) self.tb.connect(src, (op, s[0])) - dst = gr.vector_sink_s() + dst = blocks.vector_sink_s() self.tb.connect(op, dst) self.tb.run() result_data = dst.data() @@ -53,9 +53,9 @@ class test_add_mult_div_sub(gr_unittest.TestCase): def help_ff(self, src_data, exp_data, op): for s in zip(range(len(src_data)), src_data): - src = gr.vector_source_f(s[1]) + src = blocks.vector_source_f(s[1]) self.tb.connect(src, (op, s[0])) - dst = gr.vector_sink_f() + dst = blocks.vector_sink_f() self.tb.connect(op, dst) self.tb.run() result_data = dst.data() @@ -63,9 +63,9 @@ class test_add_mult_div_sub(gr_unittest.TestCase): def help_cc(self, src_data, exp_data, op): for s in zip(range(len(src_data)), src_data): - src = gr.vector_source_c(s[1]) + src = blocks.vector_source_c(s[1]) self.tb.connect(src, (op, s[0])) - dst = gr.vector_sink_c() + dst = blocks.vector_sink_c() self.tb.connect(op, dst) self.tb.run() result_data = dst.data() @@ -77,28 +77,28 @@ class test_add_mult_div_sub(gr_unittest.TestCase): src1_data = (1, 2, 3, 4, 5) src2_data = (8, -3, 4, 8, 2) expected_result = (9, -1, 7, 12, 7) - op = blocks_swig.add_ss() + op = blocks.add_ss() self.help_ss((src1_data, src2_data), expected_result, op) def test_add_ii(self): src1_data = (1, 2, 3, 4, 5) src2_data = (8, -3, 4, 8, 2) expected_result = (9, -1, 7, 12, 7) - op = blocks_swig.add_ii() + op = blocks.add_ii() self.help_ii((src1_data, src2_data), expected_result, op) def test_add_ff(self): src1_data = (1.0, 2.0, 3.0, 4.0, 5.0) src2_data = (8.0, -3.0, 4.0, 8.0, 2.0) expected_result = (9.0, -1.0, 7.0, 12.0, 7.0) - op = blocks_swig.add_ff() + op = blocks.add_ff() self.help_ff((src1_data, src2_data), expected_result, op) def test_add_cc(self): src1_data = (1+1j, 2+2j, 3+3j, 4+4j, 5+5j) src2_data = (8+8j, -3-3j, 4+4j, 8+8j, 2+2j) expected_result = (9+9j, -1-1j, 7+7j, 12+12j, 7+7j) - op = blocks_swig.add_cc() + op = blocks.add_cc() self.help_cc((src1_data, src2_data), expected_result, op) # add_const_XX @@ -106,25 +106,25 @@ class test_add_mult_div_sub(gr_unittest.TestCase): def test_add_const_ss(self): src_data = (1, 2, 3, 4, 5) expected_result = (6, 7, 8, 9, 10) - op = blocks_swig.add_const_ss(5) + op = blocks.add_const_ss(5) self.help_ss((src_data,), expected_result, op) def test_add_const_ii(self): src_data = (1, 2, 3, 4, 5) expected_result = (6, 7, 8, 9, 10) - op = blocks_swig.add_const_ii(5) + op = blocks.add_const_ii(5) self.help_ii((src_data,), expected_result, op) def test_add_const_ff(self): src_data = (1, 2, 3, 4, 5) expected_result = (6, 7, 8, 9, 10) - op = blocks_swig.add_const_ff(5) + op = blocks.add_const_ff(5) self.help_ff((src_data,), expected_result, op) def test_add_const_cc(self): src_data = (1, 2, 3, 4, 5) expected_result = (1+5j, 2+5j, 3+5j, 4+5j, 5+5j) - op = blocks_swig.add_const_cc(5j) + op = blocks.add_const_cc(5j) self.help_cc((src_data,), expected_result, op) # multiply_XX @@ -133,7 +133,7 @@ class test_add_mult_div_sub(gr_unittest.TestCase): src1_data = (1, 2, 3, 4, 5) src2_data = (8, -3, 4, 8, 2) expected_result = (8, -6, 12, 32, 10) - op = blocks_swig.multiply_ss() + op = blocks.multiply_ss() self.help_ss((src1_data, src2_data), expected_result, op) @@ -141,7 +141,7 @@ class test_add_mult_div_sub(gr_unittest.TestCase): src1_data = (1, 2, 3, 4, 5) src2_data = (8, -3, 4, 8, 2) expected_result = (8, -6, 12, 32, 10) - op = blocks_swig.multiply_ii() + op = blocks.multiply_ii() self.help_ii((src1_data, src2_data), expected_result, op) @@ -149,7 +149,7 @@ class test_add_mult_div_sub(gr_unittest.TestCase): src1_data = (1, 2, 3, 4, 5) src2_data = (8, -3, 4, 8, 2) expected_result = (8, -6, 12, 32, 10) - op = blocks_swig.multiply_ff() + op = blocks.multiply_ff() self.help_ff((src1_data, src2_data), expected_result, op) @@ -157,7 +157,7 @@ class test_add_mult_div_sub(gr_unittest.TestCase): src1_data = (1+1j, 2+2j, 3+3j, 4+4j, 5+5j) src2_data = (8, -3, 4, 8, 2) expected_result = (8+8j, -6-6j, 12+12j, 32+32j, 10+10j) - op = blocks_swig.multiply_cc() + op = blocks.multiply_cc() self.help_cc((src1_data, src2_data), expected_result, op) @@ -166,38 +166,38 @@ class test_add_mult_div_sub(gr_unittest.TestCase): def test_multiply_const_ss(self): src_data = (-1, 0, 1, 2, 3) expected_result = (-5, 0, 5, 10, 15) - op = blocks_swig.multiply_const_ss(5) + op = blocks.multiply_const_ss(5) self.help_ss((src_data,), expected_result, op) def test_multiply_const_ii(self): src_data = (-1, 0, 1, 2, 3) expected_result = (-5, 0, 5, 10, 15) - op = blocks_swig.multiply_const_ii(5) + op = blocks.multiply_const_ii(5) self.help_ii((src_data,), expected_result, op) def test_multiply_const_ff(self): src_data = (-1, 0, 1, 2, 3) expected_result = (-5, 0, 5, 10, 15) - op = blocks_swig.multiply_const_ff(5) + op = blocks.multiply_const_ff(5) self.help_ff((src_data,), expected_result, op) def test_multiply_const_cc(self): src_data = (-1-1j, 0+0j, 1+1j, 2+2j, 3+3j) expected_result = (-5-5j, 0+0j, 5+5j, 10+10j, 15+15j) - op = blocks_swig.multiply_const_cc(5) + op = blocks.multiply_const_cc(5) self.help_cc((src_data,), expected_result, op) def test_multiply_const_cc2(self): src_data = (-1-1j, 0+0j, 1+1j, 2+2j, 3+3j) expected_result = (-3-7j, 0+0j, 3+7j, 6+14j, 9+21j) - op = blocks_swig.multiply_const_cc(5+2j) + op = blocks.multiply_const_cc(5+2j) self.help_cc((src_data,), expected_result, op) def test_sub_ii(self): src1_data = (1, 2, 3, 4, 5) src2_data = (8, -3, 4, 8, 2) expected_result = (-7, 5, -1, -4, 3) - op = blocks_swig.sub_ii() + op = blocks.sub_ii() self.help_ii((src1_data, src2_data), expected_result, op) @@ -205,7 +205,7 @@ class test_add_mult_div_sub(gr_unittest.TestCase): src1_data = ( 5, 9, -15, 1024) src2_data = (10, 3, -5, 64) expected_result = (0.5, 3, 3, 16) - op = blocks_swig.divide_ff() + op = blocks.divide_ff() self.help_ff((src1_data, src2_data), expected_result, op) if __name__ == '__main__': diff --git a/gr-blocks/python/qa_add_mult_v.py b/gr-blocks/python/qa_add_mult_v.py index 13cb71df2c..39040b159a 100755 --- a/gr-blocks/python/qa_add_mult_v.py +++ b/gr-blocks/python/qa_add_mult_v.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2004,2007,2010,2012 Free Software Foundation, Inc. +# Copyright 2004,2007,2010,2012,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -33,12 +33,12 @@ class test_add_mult_v(gr_unittest.TestCase): def help_ss(self, size, src_data, exp_data, op): for s in zip(range (len (src_data)), src_data): - src = gr.vector_source_s(s[1]) + src = blocks.vector_source_s(s[1]) srcv = blocks.stream_to_vector(gr.sizeof_short, size) self.tb.connect(src, srcv) self.tb.connect(srcv, (op, s[0])) rhs = blocks.vector_to_stream(gr.sizeof_short, size) - dst = gr.vector_sink_s() + dst = blocks.vector_sink_s() self.tb.connect(op, rhs, dst) self.tb.run() result_data = dst.data() @@ -46,12 +46,12 @@ class test_add_mult_v(gr_unittest.TestCase): def help_ii(self, size, src_data, exp_data, op): for s in zip(range (len (src_data)), src_data): - src = gr.vector_source_i(s[1]) + src = blocks.vector_source_i(s[1]) srcv = blocks.stream_to_vector(gr.sizeof_int, size) self.tb.connect(src, srcv) self.tb.connect(srcv, (op, s[0])) rhs = blocks.vector_to_stream(gr.sizeof_int, size) - dst = gr.vector_sink_i() + dst = blocks.vector_sink_i() self.tb.connect(op, rhs, dst) self.tb.run() result_data = dst.data() @@ -59,12 +59,12 @@ class test_add_mult_v(gr_unittest.TestCase): def help_ff(self, size, src_data, exp_data, op): for s in zip(range (len (src_data)), src_data): - src = gr.vector_source_f(s[1]) + src = blocks.vector_source_f(s[1]) srcv = blocks.stream_to_vector(gr.sizeof_float, size) self.tb.connect(src, srcv) self.tb.connect(srcv, (op, s[0])) rhs = blocks.vector_to_stream(gr.sizeof_float, size) - dst = gr.vector_sink_f() + dst = blocks.vector_sink_f() self.tb.connect(op, rhs, dst) self.tb.run() result_data = dst.data() @@ -72,52 +72,52 @@ class test_add_mult_v(gr_unittest.TestCase): def help_cc(self, size, src_data, exp_data, op): for s in zip(range (len (src_data)), src_data): - src = gr.vector_source_c(s[1]) + src = blocks.vector_source_c(s[1]) srcv = blocks.stream_to_vector(gr.sizeof_gr_complex, size) self.tb.connect(src, srcv) self.tb.connect(srcv, (op, s[0])) rhs = blocks.vector_to_stream(gr.sizeof_gr_complex, size) - dst = gr.vector_sink_c() + dst = blocks.vector_sink_c() self.tb.connect(op, rhs, dst) self.tb.run() result_data = dst.data() self.assertEqual(exp_data, result_data) def help_const_ss(self, src_data, exp_data, op): - src = gr.vector_source_s(src_data) + src = blocks.vector_source_s(src_data) srcv = blocks.stream_to_vector(gr.sizeof_short, len(src_data)) rhs = blocks.vector_to_stream(gr.sizeof_short, len(src_data)) - dst = gr.vector_sink_s() + dst = blocks.vector_sink_s() self.tb.connect(src, srcv, op, rhs, dst) self.tb.run() result_data = dst.data() self.assertEqual(exp_data, result_data) def help_const_ii(self, src_data, exp_data, op): - src = gr.vector_source_i(src_data) + src = blocks.vector_source_i(src_data) srcv = blocks.stream_to_vector(gr.sizeof_int, len(src_data)) rhs = blocks.vector_to_stream(gr.sizeof_int, len(src_data)) - dst = gr.vector_sink_i() + dst = blocks.vector_sink_i() self.tb.connect(src, srcv, op, rhs, dst) self.tb.run() result_data = dst.data() self.assertEqual(exp_data, result_data) def help_const_ff(self, src_data, exp_data, op): - src = gr.vector_source_f(src_data) + src = blocks.vector_source_f(src_data) srcv = blocks.stream_to_vector(gr.sizeof_float, len(src_data)) rhs = blocks.vector_to_stream(gr.sizeof_float, len(src_data)) - dst = gr.vector_sink_f() + dst = blocks.vector_sink_f() self.tb.connect(src, srcv, op, rhs, dst) self.tb.run() result_data = dst.data() self.assertEqual(exp_data, result_data) def help_const_cc(self, src_data, exp_data, op): - src = gr.vector_source_c(src_data) + src = blocks.vector_source_c(src_data) srcv = blocks.stream_to_vector(gr.sizeof_gr_complex, len(src_data)) rhs = blocks.vector_to_stream(gr.sizeof_gr_complex, len(src_data)) - dst = gr.vector_sink_c() + dst = blocks.vector_sink_c() self.tb.connect(src, srcv, op, rhs, dst) self.tb.run() result_data = dst.data() diff --git a/gr-blocks/python/qa_argmax.py b/gr-blocks/python/qa_argmax.py index ec82b71cd4..2fc8641d16 100644 --- a/gr-blocks/python/qa_argmax.py +++ b/gr-blocks/python/qa_argmax.py @@ -39,20 +39,20 @@ class test_arg_max(gr_unittest.TestCase): src2_data = (0,0.0,3.0,0,10,0) src3_data = (0,0.0,3.0,0,1,0) - src1 = gr.vector_source_f(src1_data) + src1 = blocks.vector_source_f(src1_data) s2v1 = blocks.stream_to_vector(gr.sizeof_float, len(src1_data)) tb.connect(src1, s2v1) - src2 = gr.vector_source_f(src2_data) + src2 = blocks.vector_source_f(src2_data) s2v2 = blocks.stream_to_vector(gr.sizeof_float, len(src1_data)) tb.connect(src2, s2v2) - src3 = gr.vector_source_f(src3_data) + src3 = blocks.vector_source_f(src3_data) s2v3 = blocks.stream_to_vector(gr.sizeof_float, len(src1_data)) tb.connect(src3, s2v3) - dst1 = gr.vector_sink_s() - dst2 = gr.vector_sink_s() + dst1 = blocks.vector_sink_s() + dst2 = blocks.vector_sink_s() argmax = blocks.argmax_fs(len(src1_data)) tb.connect(s2v1, (argmax, 0)) diff --git a/gr-blocks/python/qa_bin_statistics.py b/gr-blocks/python/qa_bin_statistics.py index 666f7c0d68..45d5105eb2 100755 --- a/gr-blocks/python/qa_bin_statistics.py +++ b/gr-blocks/python/qa_bin_statistics.py @@ -120,7 +120,7 @@ class test_bin_statistics(gr_unittest.TestCase): 13, 14, 15, 16 )]) - src = gr.vector_source_f(src_data, False) + src = blocks.vector_source_f(src_data, False) s2v = blocks.stream_to_vector(gr.sizeof_float, vlen) stats = blocks.bin_statistics_f(vlen, msgq, tune, tune_delay, dwell_delay) self.tb.connect(src, s2v, stats) @@ -148,7 +148,7 @@ class test_bin_statistics(gr_unittest.TestCase): expected_results = tuple([float(x) for x in ( 9, 10, 11, 12)]) - src = gr.vector_source_f(src_data, False) + src = blocks.vector_source_f(src_data, False) s2v = blocks.stream_to_vector(gr.sizeof_float, vlen) stats = blocks.bin_statistics_f(vlen, msgq, tune, tune_delay, dwell_delay) self.tb.connect(src, s2v, stats) @@ -178,7 +178,7 @@ class test_bin_statistics(gr_unittest.TestCase): expected_results = tuple([float(x) for x in ( 9, 10, 11, 12)]) - src = gr.vector_source_f(src_data, False) + src = blocks.vector_source_f(src_data, False) s2v = blocks.stream_to_vector(gr.sizeof_float, vlen) stats = blocks.bin_statistics_f(vlen, msgq, tune, tune_delay, dwell_delay) self.tb.connect(src, s2v, stats) @@ -210,7 +210,7 @@ class test_bin_statistics(gr_unittest.TestCase): expected_results = tuple([float(x) for x in ( 9, 10, 11, 12)]) - src = gr.vector_source_f(src_data, False) + src = blocks.vector_source_f(src_data, False) s2v = blocks.stream_to_vector(gr.sizeof_float, vlen) stats = blocks.bin_statistics_f(vlen, msgq, tune, tune_delay, dwell_delay) self.tb.connect(src, s2v, stats) diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_block_gateway.py b/gr-blocks/python/qa_block_gateway.py index 2c8cba5439..20a2660cba 100644 --- a/gnuradio-core/src/python/gnuradio/gr/qa_block_gateway.py +++ b/gr-blocks/python/qa_block_gateway.py @@ -1,5 +1,5 @@ # -# Copyright 2011-2012 Free Software Foundation, Inc. +# Copyright 2011-2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -22,6 +22,7 @@ from gnuradio import gr, gr_unittest import pmt import numpy +import blocks_swig as blocks class add_2_f32_1_f32(gr.sync_block): def __init__(self): @@ -182,10 +183,10 @@ class test_block_gateway(gr_unittest.TestCase): def test_add_f32(self): tb = gr.top_block() - src0 = gr.vector_source_f([1, 3, 5, 7, 9], False) - src1 = gr.vector_source_f([0, 2, 4, 6, 8], False) + src0 = blocks.vector_source_f([1, 3, 5, 7, 9], False) + src1 = blocks.vector_source_f([0, 2, 4, 6, 8], False) adder = add_2_f32_1_f32() - sink = gr.vector_sink_f() + sink = blocks.vector_sink_f() tb.connect((src0, 0), (adder, 0)) tb.connect((src1, 0), (adder, 1)) tb.connect(adder, sink) @@ -194,10 +195,10 @@ class test_block_gateway(gr_unittest.TestCase): def test_add_fc32(self): tb = gr.top_block() - src0 = gr.vector_source_c([1, 3j, 5, 7j, 9], False) - src1 = gr.vector_source_c([0, 2j, 4, 6j, 8], False) + src0 = blocks.vector_source_c([1, 3j, 5, 7j, 9], False) + src1 = blocks.vector_source_c([0, 2j, 4, 6j, 8], False) adder = add_2_fc32_1_fc32() - sink = gr.vector_sink_c() + sink = blocks.vector_sink_c() tb.connect((src0, 0), (adder, 0)) tb.connect((src1, 0), (adder, 1)) tb.connect(adder, sink) @@ -206,27 +207,27 @@ class test_block_gateway(gr_unittest.TestCase): def test_convolve(self): tb = gr.top_block() - src = gr.vector_source_f([1, 2, 3, 4, 5, 6, 7, 8], False) + src = blocks.vector_source_f([1, 2, 3, 4, 5, 6, 7, 8], False) cv = convolve() - sink = gr.vector_sink_f() + sink = blocks.vector_sink_f() tb.connect(src, cv, sink) tb.run() self.assertEqual(sink.data(), (1, 2, 3, 4, 5, 6, 7, 8)) def test_decim2x(self): tb = gr.top_block() - src = gr.vector_source_f([1, 2, 3, 4, 5, 6, 7, 8], False) + src = blocks.vector_source_f([1, 2, 3, 4, 5, 6, 7, 8], False) d2x = decim2x() - sink = gr.vector_sink_f() + sink = blocks.vector_sink_f() tb.connect(src, d2x, sink) tb.run() self.assertEqual(sink.data(), (1, 3, 5, 7)) def test_interp2x(self): tb = gr.top_block() - src = gr.vector_source_f([1, 3, 5, 7, 9], False) + src = blocks.vector_source_f([1, 3, 5, 7, 9], False) i2x = interp2x() - sink = gr.vector_sink_f() + sink = blocks.vector_sink_f() tb.connect(src, i2x, sink) tb.run() self.assertEqual(sink.data(), (1, 1, 3, 3, 5, 5, 7, 7, 9, 9)) @@ -234,7 +235,7 @@ class test_block_gateway(gr_unittest.TestCase): def test_tags(self): src = tag_source() sink = tag_sink() - head = gr.head(gr.sizeof_float, 50000) #should be enough items to get a tag through + head = blocks.head(gr.sizeof_float, 50000) #should be enough items to get a tag through tb = gr.top_block() tb.connect(src, head, sink) tb.run() @@ -242,10 +243,10 @@ class test_block_gateway(gr_unittest.TestCase): def test_fc32_to_f32_2(self): tb = gr.top_block() - src = gr.vector_source_c([1+2j, 3+4j, 5+6j, 7+8j, 9+10j], False) + src = blocks.vector_source_c([1+2j, 3+4j, 5+6j, 7+8j, 9+10j], False) convert = fc32_to_f32_2() v2s = vector_to_stream(numpy.float32, 2) - sink = gr.vector_sink_f() + sink = blocks.vector_sink_f() tb.connect(src, convert, v2s, sink) tb.run() self.assertEqual(sink.data(), (1, 2, 3, 4, 5, 6, 7, 8, 9, 10)) diff --git a/gr-blocks/python/qa_boolean_operators.py b/gr-blocks/python/qa_boolean_operators.py index 5572f60acb..8755dad2fc 100755 --- a/gr-blocks/python/qa_boolean_operators.py +++ b/gr-blocks/python/qa_boolean_operators.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2004,2007,2008,2010 Free Software Foundation, Inc. +# Copyright 2004,2007,2008,2010,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -21,7 +21,7 @@ # from gnuradio import gr, gr_unittest -import blocks_swig +import blocks_swig as blocks class test_boolean_operators (gr_unittest.TestCase): @@ -33,9 +33,9 @@ class test_boolean_operators (gr_unittest.TestCase): def help_ss (self, src_data, exp_data, op): for s in zip (range (len (src_data)), src_data): - src = gr.vector_source_s (s[1]) + src = blocks.vector_source_s (s[1]) self.tb.connect (src, (op, s[0])) - dst = gr.vector_sink_s () + dst = blocks.vector_sink_s () self.tb.connect (op, dst) self.tb.run () result_data = dst.data () @@ -43,9 +43,9 @@ class test_boolean_operators (gr_unittest.TestCase): def help_bb (self, src_data, exp_data, op): for s in zip (range (len (src_data)), src_data): - src = gr.vector_source_b (s[1]) + src = blocks.vector_source_b (s[1]) self.tb.connect (src, (op, s[0])) - dst = gr.vector_sink_b () + dst = blocks.vector_sink_b () self.tb.connect (op, dst) self.tb.run () result_data = dst.data () @@ -53,9 +53,9 @@ class test_boolean_operators (gr_unittest.TestCase): def help_ii (self, src_data, exp_data, op): for s in zip (range (len (src_data)), src_data): - src = gr.vector_source_i (s[1]) + src = blocks.vector_source_i (s[1]) self.tb.connect (src, (op, s[0])) - dst = gr.vector_sink_i () + dst = blocks.vector_sink_i () self.tb.connect (op, dst) self.tb.run () result_data = dst.data () @@ -65,7 +65,7 @@ class test_boolean_operators (gr_unittest.TestCase): src1_data = (1, 2, 3, 0x5004, 0x1150) src2_data = (8, 2, 1 , 0x0508, 0x1105) expected_result = (9, 0, 2, 0x550C, 0x0055) - op = blocks_swig.xor_ss () + op = blocks.xor_ss () self.help_ss ((src1_data, src2_data), expected_result, op) @@ -73,7 +73,7 @@ class test_boolean_operators (gr_unittest.TestCase): src1_data = (1, 2, 3, 4, 0x50) src2_data = (8, 2, 1 , 8, 0x05) expected_result = (9, 0, 2, 0xC, 0x55) - op = blocks_swig.xor_bb () + op = blocks.xor_bb () self.help_bb ((src1_data, src2_data), expected_result, op) @@ -82,7 +82,7 @@ class test_boolean_operators (gr_unittest.TestCase): src1_data = (1, 2, 3, 0x5000004, 0x11000050) src2_data = (8, 2, 1 , 0x0500008, 0x11000005) expected_result = (9, 0, 2, 0x550000C, 0x00000055) - op = blocks_swig.xor_ii () + op = blocks.xor_ii () self.help_ii ((src1_data, src2_data), expected_result, op) @@ -91,7 +91,7 @@ class test_boolean_operators (gr_unittest.TestCase): src1_data = (1, 2, 3, 0x5004, 0x1150) src2_data = (8, 2, 1 , 0x0508, 0x1105) expected_result = (0, 2, 1, 0x0000, 0x1100) - op = blocks_swig.and_ss () + op = blocks.and_ss () self.help_ss ((src1_data, src2_data), expected_result, op) @@ -100,7 +100,7 @@ class test_boolean_operators (gr_unittest.TestCase): src2_data = (8, 2, 2, 1, 0x08, 0x05) src3_data = (8, 2, 1, 1, 0x08, 0x05) expected_result = (0, 2, 0, 1, 0x00, 0x00) - op = blocks_swig.and_bb () + op = blocks.and_bb () self.help_bb ((src1_data, src2_data, src3_data), expected_result, op) @@ -108,16 +108,16 @@ class test_boolean_operators (gr_unittest.TestCase): src1_data = (1, 2, 3, 0x50005004, 0x11001150) src2_data = (8, 2, 1 , 0x05000508, 0x11001105) expected_result = (0, 2, 1, 0x00000000, 0x11001100) - op = blocks_swig.and_ii () + op = blocks.and_ii () self.help_ii ((src1_data, src2_data), expected_result, op) def test_and_const_ss (self): src_data = (1, 2, 3, 0x5004, 0x1150) expected_result = (0, 2, 2, 0x5000, 0x1100) - src = gr.vector_source_s(src_data) - op = blocks_swig.and_const_ss (0x55AA) - dst = gr.vector_sink_s() + src = blocks.vector_source_s(src_data) + op = blocks.and_const_ss (0x55AA) + dst = blocks.vector_sink_s() self.tb.connect(src, op, dst) self.tb.run() self.assertEqual(dst.data(), expected_result) @@ -125,9 +125,9 @@ class test_boolean_operators (gr_unittest.TestCase): def test_and_const_bb (self): src_data = (1, 2, 3, 0x50, 0x11) expected_result = (0, 2, 2, 0x00, 0x00) - src = gr.vector_source_b(src_data) - op = blocks_swig.and_const_bb (0xAA) - dst = gr.vector_sink_b() + src = blocks.vector_source_b(src_data) + op = blocks.and_const_bb (0xAA) + dst = blocks.vector_sink_b() self.tb.connect(src, op, dst) self.tb.run() self.assertEqual(dst.data(), expected_result) @@ -136,9 +136,9 @@ class test_boolean_operators (gr_unittest.TestCase): def test_and_const_ii (self): src_data = (1, 2, 3, 0x5004, 0x1150) expected_result = (0, 2, 2, 0x5000, 0x1100) - src = gr.vector_source_i(src_data) - op = blocks_swig.and_const_ii (0x55AA) - dst = gr.vector_sink_i() + src = blocks.vector_source_i(src_data) + op = blocks.and_const_ii (0x55AA) + dst = blocks.vector_sink_i() self.tb.connect(src, op, dst) self.tb.run() self.assertEqual(dst.data(), expected_result) @@ -148,7 +148,7 @@ class test_boolean_operators (gr_unittest.TestCase): src1_data = (1, 2, 3, 0x5004, 0x1150) src2_data = (8, 2, 1 , 0x0508, 0x1105) expected_result = (9, 2, 3, 0x550C, 0x1155) - op = blocks_swig.or_ss () + op = blocks.or_ss () self.help_ss ((src1_data, src2_data), expected_result, op) @@ -157,7 +157,7 @@ class test_boolean_operators (gr_unittest.TestCase): src2_data = (8, 2, 2, 1 , 0x08, 0x05) src3_data = (8, 2, 1, 1 , 0x08, 0x05) expected_result = (9, 2, 3, 3, 0x0C, 0x55) - op = blocks_swig.or_bb () + op = blocks.or_bb () self.help_bb ((src1_data, src2_data, src3_data), expected_result, op) @@ -165,28 +165,28 @@ class test_boolean_operators (gr_unittest.TestCase): src1_data = (1, 2, 3, 0x50005004, 0x11001150) src2_data = (8, 2, 1 , 0x05000508, 0x11001105) expected_result = (9, 2, 3, 0x5500550C, 0x11001155) - op = blocks_swig.or_ii () + op = blocks.or_ii () self.help_ii ((src1_data, src2_data), expected_result, op) def test_not_ss (self): src1_data = (1, 2, 3, 0x5004, 0x1150) expected_result = (~1, ~2, ~3, ~0x5004, ~0x1150) - op = blocks_swig.not_ss () + op = blocks.not_ss () self.help_ss ((((src1_data),)), expected_result, op) def test_not_bb (self): src1_data = (1, 2, 2, 3, 0x04, 0x50) expected_result = (0xFE, 0xFD, 0xFD, 0xFC, 0xFB, 0xAF) - op = blocks_swig.not_bb () + op = blocks.not_bb () self.help_bb (((src1_data), ), expected_result, op) def test_not_ii (self): src1_data = (1, 2, 3, 0x50005004, 0x11001150) expected_result = (~1 , ~2, ~3, ~0x50005004, ~0x11001150) - op = blocks_swig.not_ii () + op = blocks.not_ii () self.help_ii (((src1_data),), expected_result, op) diff --git a/gr-blocks/python/qa_burst_tagger.py b/gr-blocks/python/qa_burst_tagger.py index 52d688d103..9923d2a368 100644 --- a/gr-blocks/python/qa_burst_tagger.py +++ b/gr-blocks/python/qa_burst_tagger.py @@ -35,8 +35,8 @@ class test_burst_tagger(gr_unittest.TestCase): def test_001(self): src_data = ( 1, 2, 3, 4, 5, 6, 7, 8, 9, 10) trg_data = (-1, -1, 1, 1, -1, -1, 1, 1, -1, -1) - src = gr.vector_source_i(src_data) - trg = gr.vector_source_s(trg_data) + src = blocks.vector_source_i(src_data) + trg = blocks.vector_source_s(trg_data) op = blocks.burst_tagger(gr.sizeof_int) snk = blocks.tag_debug(gr.sizeof_int, "burst tagger QA") self.tb.connect(src, (op,0)) diff --git a/gr-blocks/python/qa_conjugate.py b/gr-blocks/python/qa_conjugate.py index 1808aa9c0b..7aab2e70a7 100644 --- a/gr-blocks/python/qa_conjugate.py +++ b/gr-blocks/python/qa_conjugate.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2012 Free Software Foundation, Inc. +# Copyright 2012,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -21,7 +21,7 @@ # from gnuradio import gr, gr_unittest -import blocks_swig +import blocks_swig as blocks class test_conjugate (gr_unittest.TestCase): @@ -40,9 +40,9 @@ class test_conjugate (gr_unittest.TestCase): 2+2j, 1+1j, 2-2j, 1-1j, 0-0j) - src = gr.vector_source_c(src_data) - op = blocks_swig.conjugate_cc () - dst = gr.vector_sink_c () + src = blocks.vector_source_c(src_data) + op = blocks.conjugate_cc () + dst = blocks.vector_sink_c () self.tb.connect(src, op) self.tb.connect(op, dst) diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_copy.py b/gr-blocks/python/qa_copy.py index 68c8e451f3..04f6454231 100755 --- a/gnuradio-core/src/python/gnuradio/gr/qa_copy.py +++ b/gr-blocks/python/qa_copy.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2009,2010 Free Software Foundation, Inc. +# Copyright 2009,2010,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -21,21 +21,22 @@ # from gnuradio import gr, gr_unittest +import blocks_swig as blocks class test_copy(gr_unittest.TestCase): - def setUp (self): - self.tb = gr.top_block () + def setUp(self): + self.tb = gr.top_block() - def tearDown (self): + def tearDown(self): self.tb = None - def test_copy (self): + def test_copy(self): src_data = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10) expected_result = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10) - src = gr.vector_source_b(src_data) - op = gr.copy(gr.sizeof_char) - dst = gr.vector_sink_b() + src = blocks.vector_source_b(src_data) + op = blocks.copy(gr.sizeof_char) + dst = blocks.vector_sink_b() self.tb.connect(src, op, dst) self.tb.run() dst_data = dst.data() @@ -44,15 +45,14 @@ class test_copy(gr_unittest.TestCase): def test_copy_drop (self): src_data = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10) expected_result = () - src = gr.vector_source_b(src_data) - op = gr.copy(gr.sizeof_char) + src = blocks.vector_source_b(src_data) + op = blocks.copy(gr.sizeof_char) op.set_enabled(False) - dst = gr.vector_sink_b() + dst = blocks.vector_sink_b() self.tb.connect(src, op, dst) self.tb.run() dst_data = dst.data() self.assertEqual(expected_result, dst_data) - if __name__ == '__main__': gr_unittest.run(test_copy, "test_copy.xml") diff --git a/gnuradio-core/src/python/gnuradio/ctrlport/qa_cpp_py_binding.py b/gr-blocks/python/qa_cpp_py_binding.py index 6de5d5fc9f..c3d6a3f3bc 100755 --- a/gnuradio-core/src/python/gnuradio/ctrlport/qa_cpp_py_binding.py +++ b/gr-blocks/python/qa_cpp_py_binding.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2012 Free Software Foundation, Inc. +# Copyright 2012,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -32,6 +32,8 @@ from gnuradio.ctrlport import GNURadio from gnuradio import ctrlport import os +import blocks_swig as blocks + def get1(): return "success" @@ -134,9 +136,9 @@ class test_cpp_py_binding(gr_unittest.TestCase): def test_002(self): data = range(1,9) - self.src = gr.vector_source_c(data) - self.p1 = gr.ctrlport_probe_c("aaa","C++ exported variable") - self.p2 = gr.ctrlport_probe_c("bbb","C++ exported variable") + self.src = blocks.vector_source_c(data) + self.p1 = blocks.ctrlport_probe_c("aaa","C++ exported variable") + self.p2 = blocks.ctrlport_probe_c("bbb","C++ exported variable") probe_name = self.p2.alias() self.tb.connect(self.src, self.p1) diff --git a/gnuradio-core/src/python/gnuradio/ctrlport/qa_cpp_py_binding_set.py b/gr-blocks/python/qa_cpp_py_binding_set.py index 4ca120099c..28ddc48b2f 100755 --- a/gnuradio-core/src/python/gnuradio/ctrlport/qa_cpp_py_binding_set.py +++ b/gr-blocks/python/qa_cpp_py_binding_set.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2012 Free Software Foundation, Inc. +# Copyright 2012,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -32,6 +32,8 @@ from gnuradio.ctrlport import GNURadio from gnuradio import ctrlport import os +import blocks_swig as blocks + class inc_class: def __init__(self,val): self.val = val; @@ -111,8 +113,8 @@ class test_cpp_py_binding_set(gr_unittest.TestCase): def test_002(self): data = range(1, 10) - self.src = gr.vector_source_c(data, True) - self.p = gr.nop(gr.sizeof_gr_complex) + self.src = blocks.vector_source_c(data, True) + self.p = blocks.nop(gr.sizeof_gr_complex) self.p.set_ctrlport_test(0); probe_info = self.p.alias() diff --git a/gr-blocks/python/qa_delay.py b/gr-blocks/python/qa_delay.py index 031cadb2d7..44b87c14ae 100755 --- a/gr-blocks/python/qa_delay.py +++ b/gr-blocks/python/qa_delay.py @@ -37,9 +37,9 @@ class test_delay(gr_unittest.TestCase): src_data = [float(x) for x in range(0, 100)] expected_result = tuple(delta_t*[0.0] + src_data) - src = gr.vector_source_f(src_data) + src = blocks.vector_source_f(src_data) op = blocks.delay(gr.sizeof_float, delta_t) - dst = gr.vector_sink_f() + dst = blocks.vector_sink_f() tb.connect(src, op, dst) tb.run() @@ -52,9 +52,9 @@ class test_delay(gr_unittest.TestCase): src_data = [float(x) for x in range(0, 100)] expected_result = tuple(delta_t*[0.0] + src_data) - src = gr.vector_source_f(src_data) + src = blocks.vector_source_f(src_data) op = blocks.delay(gr.sizeof_float, delta_t) - dst = gr.vector_sink_f() + dst = blocks.vector_sink_f() tb.connect(src, op, dst) tb.run() diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_endian_swap.py b/gr-blocks/python/qa_endian_swap.py index 4d2555cc4d..5180293052 100644 --- a/gnuradio-core/src/python/gnuradio/gr/qa_endian_swap.py +++ b/gr-blocks/python/qa_endian_swap.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2011,2012 Free Software Foundation, Inc. +# Copyright 2011-2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -21,24 +21,24 @@ # from gnuradio import gr, gr_unittest +import blocks_swig as blocks import ctypes -class test_endian_swap (gr_unittest.TestCase): +class test_endian_swap(gr_unittest.TestCase): - def setUp (self): - self.tb = gr.top_block () + def setUp(self): + self.tb = gr.top_block() - def tearDown (self): + def tearDown(self): self.tb = None def test_001(self): - src_data = [1,2,3,4] expected_result = [256, 512, 768, 1024]; - src = gr.vector_source_s(src_data) - op = gr.endian_swap(2) - dst = gr.vector_sink_s() + src = blocks.vector_source_s(src_data) + op = blocks.endian_swap(2) + dst = blocks.vector_sink_s() self.tb.connect(src, op, dst) self.tb.run() @@ -51,9 +51,9 @@ class test_endian_swap (gr_unittest.TestCase): src_data = [1,2,3,4] expected_result = [16777216, 33554432, 50331648, 67108864]; - src = gr.vector_source_i(src_data) - op = gr.endian_swap(4) - dst = gr.vector_sink_i() + src = blocks.vector_source_i(src_data) + op = blocks.endian_swap(4) + dst = blocks.vector_sink_i() self.tb.connect(src, op, dst) self.tb.run() diff --git a/gr-blocks/python/qa_file_metadata.py b/gr-blocks/python/qa_file_metadata.py index cf7a075f42..3112ea69b0 100644 --- a/gr-blocks/python/qa_file_metadata.py +++ b/gr-blocks/python/qa_file_metadata.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2012 Free Software Foundation, Inc. +# Copyright 2012,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -54,7 +54,7 @@ class test_file_metadata(gr_unittest.TestCase): extras_str = pmt.serialize_str(extras) data = sig_source_c(samp_rate, 1000, 1, N) - src = gr.vector_source_c(data) + src = blocks.vector_source_c(data) fsnk = blocks.file_meta_sink(gr.sizeof_gr_complex, outfile, samp_rate, 1, blocks.GR_FILE_FLOAT, True, @@ -96,9 +96,9 @@ class test_file_metadata(gr_unittest.TestCase): # Test file metadata source src.rewind() fsrc = blocks.file_meta_source(outfile, False) - vsnk = gr.vector_sink_c() + vsnk = blocks.vector_sink_c() tsnk = blocks.tag_debug(gr.sizeof_gr_complex, "QA") - ssnk = gr.vector_sink_c() + ssnk = blocks.vector_sink_c() self.tb.disconnect(src, fsnk) self.tb.connect(fsrc, vsnk) self.tb.connect(fsrc, tsnk) @@ -133,7 +133,7 @@ class test_file_metadata(gr_unittest.TestCase): extras_str = pmt.serialize_str(extras) data = sig_source_c(samp_rate, 1000, 1, N) - src = gr.vector_source_c(data) + src = blocks.vector_source_c(data) fsnk = blocks.file_meta_sink(gr.sizeof_gr_complex, outfile, samp_rate, 1, blocks.GR_FILE_FLOAT, True, @@ -175,9 +175,9 @@ class test_file_metadata(gr_unittest.TestCase): # Test file metadata source src.rewind() fsrc = blocks.file_meta_source(outfile, False, detached, outfile_hdr) - vsnk = gr.vector_sink_c() + vsnk = blocks.vector_sink_c() tsnk = blocks.tag_debug(gr.sizeof_gr_complex, "QA") - ssnk = gr.vector_sink_c() + ssnk = blocks.vector_sink_c() self.tb.disconnect(src, fsnk) self.tb.connect(fsrc, vsnk) self.tb.connect(fsrc, tsnk) diff --git a/gr-blocks/python/qa_file_source_sink.py b/gr-blocks/python/qa_file_source_sink.py index 2898f760ec..cf3b512db0 100644 --- a/gr-blocks/python/qa_file_source_sink.py +++ b/gr-blocks/python/qa_file_source_sink.py @@ -38,12 +38,12 @@ class test_file_source_sink(gr_unittest.TestCase): expected_result = range(1000) filename = "tmp.32f" - src = gr.vector_source_f(src_data) + src = blocks.vector_source_f(src_data) snk = blocks.file_sink(gr.sizeof_float, filename) snk.set_unbuffered(True) src2 = blocks.file_source(gr.sizeof_float, filename) - snk2 = gr.vector_sink_f() + snk2 = blocks.vector_sink_f() self.tb.connect(src, snk) self.tb.run() @@ -65,7 +65,7 @@ class test_file_source_sink(gr_unittest.TestCase): fhandle0 = open(filename, "wb") fd0 = fhandle0.fileno() - src = gr.vector_source_f(src_data) + src = blocks.vector_source_f(src_data) snk = blocks.file_descriptor_sink(gr.sizeof_float, fd0) self.tb.connect(src, snk) @@ -76,7 +76,7 @@ class test_file_source_sink(gr_unittest.TestCase): fhandle1 = open(filename, "rb") fd1 = fhandle1.fileno() src2 = blocks.file_descriptor_source(gr.sizeof_float, fd1, False) - snk2 = gr.vector_sink_f() + snk2 = blocks.vector_sink_f() self.tb.disconnect(src, snk) self.tb.connect(src2, snk2) diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_head.py b/gr-blocks/python/qa_head.py index d7cb354dcb..39b1255978 100755 --- a/gnuradio-core/src/python/gnuradio/gr/qa_head.py +++ b/gr-blocks/python/qa_head.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2004,2007,2010 Free Software Foundation, Inc. +# Copyright 2004,2007,2010,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -21,27 +21,27 @@ # from gnuradio import gr, gr_unittest +import blocks_swig as blocks -class test_head (gr_unittest.TestCase): +class test_head(gr_unittest.TestCase): - def setUp (self): - self.tb = gr.top_block () + def setUp(self): + self.tb = gr.top_block() - def tearDown (self): + def tearDown(self): self.tb = None - def test_head (self): + def test_head(self): src_data = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10) expected_result = (1, 2, 3, 4) - src1 = gr.vector_source_i (src_data) - op = gr.head (gr.sizeof_int, 4) - dst1 = gr.vector_sink_i () - self.tb.connect (src1, op) - self.tb.connect (op, dst1) - self.tb.run () - dst_data = dst1.data () - self.assertEqual (expected_result, dst_data) - + src1 = blocks.vector_source_i(src_data) + op = blocks.head(gr.sizeof_int, 4) + dst1 = blocks.vector_sink_i() + self.tb.connect(src1, op) + self.tb.connect(op, dst1) + self.tb.run() + dst_data = dst1.data() + self.assertEqual(expected_result, dst_data) if __name__ == '__main__': gr_unittest.run(test_head, "test_head.xml") diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_hier_block2.py b/gr-blocks/python/qa_hier_block2.py index 9ba48599af..f482fda8cf 100755 --- a/gnuradio-core/src/python/gnuradio/gr/qa_hier_block2.py +++ b/gr-blocks/python/qa_hier_block2.py @@ -1,6 +1,7 @@ #!/usr/bin/env python from gnuradio import gr, gr_unittest +import blocks_swig as blocks import numpy class add_ff(gr.sync_block): @@ -52,22 +53,22 @@ class test_hier_block2(gr_unittest.TestCase): hblock = gr.hier_block2("test_block", gr.io_signature(1,1,gr.sizeof_int), gr.io_signature(1,1,gr.sizeof_int)) - nop1 = gr.nop(gr.sizeof_int) + nop1 = blocks.nop(gr.sizeof_int) hblock.connect(hblock, nop1) def test_004_connect_output(self): hblock = gr.hier_block2("test_block", gr.io_signature(1,1,gr.sizeof_int), gr.io_signature(1,1,gr.sizeof_int)) - nop1 = gr.nop(gr.sizeof_int) + nop1 = blocks.nop(gr.sizeof_int) hblock.connect(nop1, hblock) def test_005_connect_output_in_use(self): hblock = gr.hier_block2("test_block", gr.io_signature(1,1,gr.sizeof_int), gr.io_signature(1,1,gr.sizeof_int)) - nop1 = gr.nop(gr.sizeof_int) - nop2 = gr.nop(gr.sizeof_int) + nop1 = blocks.nop(gr.sizeof_int) + nop2 = blocks.nop(gr.sizeof_int) hblock.connect(nop1, hblock) self.assertRaises(ValueError, lambda: hblock.connect(nop2, hblock)) @@ -76,7 +77,7 @@ class test_hier_block2(gr_unittest.TestCase): hblock = gr.hier_block2("test_block", gr.io_signature(1,1,gr.sizeof_int), gr.io_signature(1,1,gr.sizeof_int)) - nop1 = gr.nop(gr.sizeof_int) + nop1 = blocks.nop(gr.sizeof_int) self.assertRaises(ValueError, lambda: hblock.connect((hblock, -1), nop1)) @@ -84,7 +85,7 @@ class test_hier_block2(gr_unittest.TestCase): hblock = gr.hier_block2("test_block", gr.io_signature(1,1,gr.sizeof_int), gr.io_signature(1,1,gr.sizeof_int)) - nop1 = gr.nop(gr.sizeof_int) + nop1 = blocks.nop(gr.sizeof_int) self.assertRaises(ValueError, lambda: hblock.connect((hblock, 1), nop1)) @@ -92,8 +93,8 @@ class test_hier_block2(gr_unittest.TestCase): hblock = gr.hier_block2("test_block", gr.io_signature(1,1,gr.sizeof_int), gr.io_signature(1,1,gr.sizeof_int)) - nop1 = gr.nop(gr.sizeof_int) - nop2 = gr.nop(gr.sizeof_int) + nop1 = blocks.nop(gr.sizeof_int) + nop2 = blocks.nop(gr.sizeof_int) self.assertRaises(ValueError, lambda: hblock.connect(nop1, (nop2, -1))) @@ -101,8 +102,8 @@ class test_hier_block2(gr_unittest.TestCase): hblock = gr.hier_block2("test_block", gr.io_signature(1,1,gr.sizeof_int), gr.io_signature(1,1,gr.sizeof_int)) - nop1 = gr.null_sink(gr.sizeof_int) - nop2 = gr.null_sink(gr.sizeof_int) + nop1 = blocks.null_sink(gr.sizeof_int) + nop2 = blocks.null_sink(gr.sizeof_int) self.assertRaises(ValueError, lambda: hblock.connect(nop1, (nop2, 1))) @@ -113,9 +114,9 @@ class test_hier_block2(gr_unittest.TestCase): def test_010_run(self): expected = (1.0, 2.0, 3.0, 4.0) hblock = gr.top_block("test_block") - src = gr.vector_source_f(expected, False) - sink1 = gr.vector_sink_f() - sink2 = gr.vector_sink_f() + src = blocks.vector_source_f(expected, False) + sink1 = blocks.vector_sink_f() + sink2 = blocks.vector_sink_f() hblock.connect(src, sink1) hblock.connect(src, sink2) hblock.run() @@ -128,7 +129,7 @@ class test_hier_block2(gr_unittest.TestCase): hblock = gr.hier_block2("test_block", gr.io_signature(1,1,gr.sizeof_int), gr.io_signature(1,1,gr.sizeof_int)) - nop1 = gr.nop(gr.sizeof_int) + nop1 = blocks.nop(gr.sizeof_int) hblock.connect(hblock, nop1) hblock.disconnect(hblock, nop1) @@ -136,8 +137,8 @@ class test_hier_block2(gr_unittest.TestCase): hblock = gr.hier_block2("test_block", gr.io_signature(1,1,gr.sizeof_int), gr.io_signature(1,1,gr.sizeof_int)) - nop1 = gr.nop(gr.sizeof_int) - nop2 = gr.nop(gr.sizeof_int) + nop1 = blocks.nop(gr.sizeof_int) + nop2 = blocks.nop(gr.sizeof_int) hblock.connect(hblock, nop1) self.assertRaises(ValueError, lambda: hblock.disconnect(hblock, nop2)) @@ -146,7 +147,7 @@ class test_hier_block2(gr_unittest.TestCase): hblock = gr.hier_block2("test_block", gr.io_signature(1,1,gr.sizeof_int), gr.io_signature(1,1,gr.sizeof_int)) - nop1 = gr.nop(gr.sizeof_int) + nop1 = blocks.nop(gr.sizeof_int) hblock.connect(hblock, nop1) self.assertRaises(ValueError, lambda: hblock.disconnect((hblock, -1), nop1)) @@ -155,7 +156,7 @@ class test_hier_block2(gr_unittest.TestCase): hblock = gr.hier_block2("test_block", gr.io_signature(1,1,gr.sizeof_int), gr.io_signature(1,1,gr.sizeof_int)) - nop1 = gr.nop(gr.sizeof_int) + nop1 = blocks.nop(gr.sizeof_int) hblock.connect(hblock, nop1) self.assertRaises(ValueError, lambda: hblock.disconnect((hblock, 1), nop1)) @@ -164,7 +165,7 @@ class test_hier_block2(gr_unittest.TestCase): hblock = gr.hier_block2("test_block", gr.io_signature(1,1,gr.sizeof_int), gr.io_signature(1,1,gr.sizeof_int)) - nop1 = gr.nop(gr.sizeof_int) + nop1 = blocks.nop(gr.sizeof_int) hblock.connect(nop1, hblock) hblock.disconnect(nop1, hblock) @@ -172,8 +173,8 @@ class test_hier_block2(gr_unittest.TestCase): hblock = gr.hier_block2("test_block", gr.io_signature(1,1,gr.sizeof_int), gr.io_signature(1,1,gr.sizeof_int)) - nop1 = gr.nop(gr.sizeof_int) - nop2 = gr.nop(gr.sizeof_int) + nop1 = blocks.nop(gr.sizeof_int) + nop2 = blocks.nop(gr.sizeof_int) hblock.connect(nop1, hblock) self.assertRaises(ValueError, lambda: hblock.disconnect(nop2, hblock)) @@ -182,7 +183,7 @@ class test_hier_block2(gr_unittest.TestCase): hblock = gr.hier_block2("test_block", gr.io_signature(1,1,gr.sizeof_int), gr.io_signature(1,1,gr.sizeof_int)) - nop1 = gr.nop(gr.sizeof_int) + nop1 = blocks.nop(gr.sizeof_int) hblock.connect(hblock, nop1) self.assertRaises(ValueError, lambda: hblock.disconnect(nop1, (hblock, -1))) @@ -191,7 +192,7 @@ class test_hier_block2(gr_unittest.TestCase): hblock = gr.hier_block2("test_block", gr.io_signature(1,1,gr.sizeof_int), gr.io_signature(1,1,gr.sizeof_int)) - nop1 = gr.nop(gr.sizeof_int) + nop1 = blocks.nop(gr.sizeof_int) hblock.connect(nop1, hblock) self.assertRaises(ValueError, lambda: hblock.disconnect(nop1, (hblock, 1))) @@ -199,8 +200,8 @@ class test_hier_block2(gr_unittest.TestCase): def test_020_run(self): hblock = gr.top_block("test_block") data = (1.0, 2.0, 3.0, 4.0) - src = gr.vector_source_f(data, False) - dst = gr.vector_sink_f() + src = blocks.vector_source_f(data, False) + dst = blocks.vector_sink_f() hblock.connect(src, dst) hblock.run() self.assertEquals(data, dst.data()) @@ -251,8 +252,8 @@ class test_hier_block2(gr_unittest.TestCase): hb = gr.hier_block2("block", gr.io_signature(0, 0, 0), gr.io_signature(0, 0, 0)) - src = gr.vector_source_f(expected_data) - dst = gr.vector_sink_f() + src = blocks.vector_source_f(expected_data) + dst = blocks.vector_sink_f() hb.connect(src, dst) tb.connect(hb) tb.run() @@ -263,10 +264,10 @@ class test_hier_block2(gr_unittest.TestCase): hb = gr.hier_block2("block", gr.io_signature(1, 1, 1), gr.io_signature(1, 1, 1)) - hsrc = gr.vector_source_b([1,]) + hsrc = blocks.vector_source_b([1,]) hb.connect(hsrc, hb) # wire output internally - src = gr.vector_source_b([1, ]) - dst = gr.vector_sink_b() + src = blocks.vector_source_b([1, ]) + dst = blocks.vector_sink_b() tb.connect(src, hb, dst) # hb's input is not connected internally self.assertRaises(RuntimeError, lambda: tb.run()) @@ -277,10 +278,10 @@ class test_hier_block2(gr_unittest.TestCase): hb = gr.hier_block2("block", gr.io_signature(1, 1, 1), gr.io_signature(1, 1, 1)) - hdst = gr.vector_sink_b() + hdst = blocks.vector_sink_b() hb.connect(hb, hdst) # wire input internally - src = gr.vector_source_b([1, ]) - dst = gr.vector_sink_b() + src = blocks.vector_source_b([1, ]) + dst = blocks.vector_sink_b() tb.connect(src, hb, dst) # hb's output is not connected internally self.assertRaises(RuntimeError, lambda: tb.run()) @@ -290,10 +291,10 @@ class test_hier_block2(gr_unittest.TestCase): hb = gr.hier_block2("block", gr.io_signature(1, 1, 1), gr.io_signature(1, 1, 1)) - hsrc = gr.vector_sink_b() + hsrc = blocks.vector_sink_b() hb.connect(hb, hsrc) # wire input internally - src = gr.vector_source_b([1, ]) - dst = gr.vector_sink_b() + src = blocks.vector_source_b([1, ]) + dst = blocks.vector_sink_b() tb.connect(src, hb) # hb's output is not connected internally or externally self.assertRaises(RuntimeError, lambda: tb.run()) @@ -303,9 +304,9 @@ class test_hier_block2(gr_unittest.TestCase): hb = gr.hier_block2("block", gr.io_signature(1, 1, 1), gr.io_signature(1, 1, 1)) - hdst = gr.vector_source_b([1,]) + hdst = blocks.vector_source_b([1,]) hb.connect(hdst, hb) # wire output internally - dst = gr.vector_sink_b() + dst = blocks.vector_sink_b() tb.connect(hb, dst) # hb's input is not connected internally or externally self.assertRaises(RuntimeError, lambda: tb.run()) @@ -314,8 +315,8 @@ class test_hier_block2(gr_unittest.TestCase): tb = gr.top_block() hb = gr.hier_block2("block", gr.io_signature(0, 0, 0), gr.io_signature(0, 0, 0)) - src = gr.vector_source_b([1, ]) - dst = gr.vector_sink_b() + src = blocks.vector_source_b([1, ]) + dst = blocks.vector_sink_b() hb.connect(src, dst) tb.connect(hb) # Singleton connect tb.lock() @@ -325,8 +326,8 @@ class test_hier_block2(gr_unittest.TestCase): def test_029_singleton_disconnect(self): tb = gr.top_block() - src = gr.vector_source_b([1, ]) - dst = gr.vector_sink_b() + src = blocks.vector_source_b([1, ]) + dst = blocks.vector_sink_b() tb.connect(src, dst) tb.disconnect(src) # Singleton disconnect tb.connect(src, dst) @@ -335,23 +336,23 @@ class test_hier_block2(gr_unittest.TestCase): def test_030_nested_input(self): tb = gr.top_block() - src = gr.vector_source_b([1,]) + src = blocks.vector_source_b([1,]) hb1 = gr.hier_block2("hb1", gr.io_signature(1, 1, gr.sizeof_char), gr.io_signature(0, 0, 0)) hb2 = gr.hier_block2("hb2", gr.io_signature(1, 1, gr.sizeof_char), gr.io_signature(0, 0, 0)) - dst = gr.vector_sink_b() + dst = blocks.vector_sink_b() tb.connect(src, hb1) hb1.connect(hb1, hb2) - hb2.connect(hb2, gr.kludge_copy(gr.sizeof_char), dst) + hb2.connect(hb2, blocks.copy(gr.sizeof_char), dst) tb.run() self.assertEquals(dst.data(), (1,)) def test_031_multiple_internal_inputs(self): tb = gr.top_block() - src = gr.vector_source_f([1.0,]) + src = blocks.vector_source_f([1.0,]) hb = gr.hier_block2("hb", gr.io_signature(1, 1, gr.sizeof_float), gr.io_signature(1, 1, gr.sizeof_float)) @@ -363,14 +364,14 @@ class test_hier_block2(gr_unittest.TestCase): hb.connect(m1, (add, 0)) hb.connect(m2, (add, 1)) hb.connect(add, hb) # add is connected to hb external output #0 - dst = gr.vector_sink_f() + dst = blocks.vector_sink_f() tb.connect(src, hb, dst) tb.run() self.assertEquals(dst.data(), (3.0,)) def test_032_nested_multiple_internal_inputs(self): tb = gr.top_block() - src = gr.vector_source_f([1.0,]) + src = blocks.vector_source_f([1.0,]) hb = gr.hier_block2("hb", gr.io_signature(1, 1, gr.sizeof_float), gr.io_signature(1, 1, gr.sizeof_float)) @@ -387,7 +388,7 @@ class test_hier_block2(gr_unittest.TestCase): hb2.connect(m2, (add, 1)) hb2.connect(add, hb2) # add is connected to hb2 external output #0 hb.connect(hb, hb2, hb) # hb as hb2 as nested internal block - dst = gr.vector_sink_f() + dst = blocks.vector_sink_f() tb.connect(src, hb, dst) tb.run() self.assertEquals(dst.data(), (3.0,)) diff --git a/gr-blocks/python/qa_integrate.py b/gr-blocks/python/qa_integrate.py index c404f1b309..9d9d9345f4 100755 --- a/gr-blocks/python/qa_integrate.py +++ b/gr-blocks/python/qa_integrate.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2008,2010 Free Software Foundation, Inc. +# Copyright 2008,2010,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -21,7 +21,7 @@ # from gnuradio import gr, gr_unittest -import blocks_swig +import blocks_swig as blocks import math class test_integrate (gr_unittest.TestCase): @@ -35,9 +35,9 @@ class test_integrate (gr_unittest.TestCase): def test_000_ss(self): src_data = (1, 2, 3, 4, 5, 6) dst_data = (6, 15) - src = gr.vector_source_s(src_data) - itg = blocks_swig.integrate_ss(3) - dst = gr.vector_sink_s() + src = blocks.vector_source_s(src_data) + itg = blocks.integrate_ss(3) + dst = blocks.vector_sink_s() self.tb.connect(src, itg, dst) self.tb.run() self.assertEqual(dst_data, dst.data()) @@ -45,9 +45,9 @@ class test_integrate (gr_unittest.TestCase): def test_001_ii(self): src_data = (1, 2, 3, 4, 5, 6) dst_data = (6, 15) - src = gr.vector_source_i(src_data) - itg = blocks_swig.integrate_ii(3) - dst = gr.vector_sink_i() + src = blocks.vector_source_i(src_data) + itg = blocks.integrate_ii(3) + dst = blocks.vector_sink_i() self.tb.connect(src, itg, dst) self.tb.run() self.assertEqual(dst_data, dst.data()) @@ -55,9 +55,9 @@ class test_integrate (gr_unittest.TestCase): def test_002_ff(self): src_data = [1.0, 2.0, 3.0, 4.0, 5.0, 6.0] dst_data = [6.0, 15.0] - src = gr.vector_source_f(src_data) - itg = blocks_swig.integrate_ff(3) - dst = gr.vector_sink_f() + src = blocks.vector_source_f(src_data) + itg = blocks.integrate_ff(3) + dst = blocks.vector_sink_f() self.tb.connect(src, itg, dst) self.tb.run() self.assertFloatTuplesAlmostEqual(dst_data, dst.data(), 6) @@ -65,9 +65,9 @@ class test_integrate (gr_unittest.TestCase): def test_003_cc(self): src_data = [1.0+1.0j, 2.0+2.0j, 3.0+3.0j, 4.0+4.0j, 5.0+5.0j, 6.0+6.0j] dst_data = [6.0+6.0j, 15.0+15.0j] - src = gr.vector_source_c(src_data) - itg = blocks_swig.integrate_cc(3) - dst = gr.vector_sink_c() + src = blocks.vector_source_c(src_data) + itg = blocks.integrate_cc(3) + dst = blocks.vector_sink_c() self.tb.connect(src, itg, dst) self.tb.run() self.assertComplexTuplesAlmostEqual(dst_data, dst.data(), 6) diff --git a/gr-blocks/python/qa_interleave.py b/gr-blocks/python/qa_interleave.py index 376d487b10..a65824ec33 100755 --- a/gr-blocks/python/qa_interleave.py +++ b/gr-blocks/python/qa_interleave.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2004,2007,2010,2012 Free Software Foundation, Inc. +# Copyright 2004,2007,2010,2012,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -21,7 +21,7 @@ # from gnuradio import gr, gr_unittest -import blocks_swig +import blocks_swig as blocks import math class test_interleave (gr_unittest.TestCase): @@ -34,12 +34,12 @@ class test_interleave (gr_unittest.TestCase): def test_int_001 (self): lenx = 64 - src0 = gr.vector_source_f (range (0, lenx, 4)) - src1 = gr.vector_source_f (range (1, lenx, 4)) - src2 = gr.vector_source_f (range (2, lenx, 4)) - src3 = gr.vector_source_f (range (3, lenx, 4)) - op = blocks_swig.interleave (gr.sizeof_float) - dst = gr.vector_sink_f () + src0 = blocks.vector_source_f (range (0, lenx, 4)) + src1 = blocks.vector_source_f (range (1, lenx, 4)) + src2 = blocks.vector_source_f (range (2, lenx, 4)) + src3 = blocks.vector_source_f (range (3, lenx, 4)) + op = blocks.interleave (gr.sizeof_float) + dst = blocks.vector_sink_f () self.tb.connect (src0, (op, 0)) self.tb.connect (src1, (op, 1)) @@ -53,12 +53,12 @@ class test_interleave (gr_unittest.TestCase): def test_deint_001 (self): lenx = 64 - src = gr.vector_source_f (range (lenx)) - op = blocks_swig.deinterleave (gr.sizeof_float) - dst0 = gr.vector_sink_f () - dst1 = gr.vector_sink_f () - dst2 = gr.vector_sink_f () - dst3 = gr.vector_sink_f () + src = blocks.vector_source_f (range (lenx)) + op = blocks.deinterleave (gr.sizeof_float) + dst0 = blocks.vector_sink_f () + dst1 = blocks.vector_sink_f () + dst2 = blocks.vector_sink_f () + dst3 = blocks.vector_sink_f () self.tb.connect (src, op) self.tb.connect ((op, 0), dst0) diff --git a/gr-blocks/python/qa_keep_m_in_n.py b/gr-blocks/python/qa_keep_m_in_n.py index 0898217ba9..22e8c45138 100755 --- a/gr-blocks/python/qa_keep_m_in_n.py +++ b/gr-blocks/python/qa_keep_m_in_n.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2008,2010,2012 Free Software Foundation, Inc. +# Copyright 2008,2010,2012,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -20,7 +20,7 @@ # from gnuradio import gr, gr_unittest -import blocks_swig +import blocks_swig as blocks import sys import random @@ -35,15 +35,15 @@ class test_keep_m_in_n(gr_unittest.TestCase): def test_001(self): self.maxDiff = None; tb = gr.top_block() - src = gr.vector_source_b( range(0,100) ) + src = blocks.vector_source_b( range(0,100) ) # itemsize, M, N, offset - km2 = blocks_swig.keep_m_in_n( 1, 1, 2, 0 ); - km3 = blocks_swig.keep_m_in_n( 1, 1, 3, 1 ); - km7 = blocks_swig.keep_m_in_n( 1, 1, 7, 2 ); - snk2 = gr.vector_sink_b(); - snk3 = gr.vector_sink_b(); - snk7 = gr.vector_sink_b(); + km2 = blocks.keep_m_in_n( 1, 1, 2, 0 ); + km3 = blocks.keep_m_in_n( 1, 1, 3, 1 ); + km7 = blocks.keep_m_in_n( 1, 1, 7, 2 ); + snk2 = blocks.vector_sink_b(); + snk3 = blocks.vector_sink_b(); + snk7 = blocks.vector_sink_b(); tb.connect(src,km2,snk2); tb.connect(src,km3,snk3); tb.connect(src,km7,snk7); diff --git a/gr-blocks/python/qa_keep_one_in_n.py b/gr-blocks/python/qa_keep_one_in_n.py index 8c5f44b84b..f06ed33d6b 100755 --- a/gr-blocks/python/qa_keep_one_in_n.py +++ b/gr-blocks/python/qa_keep_one_in_n.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2012 Free Software Foundation, Inc. +# Copyright 2012,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -21,7 +21,7 @@ # from gnuradio import gr, gr_unittest -import blocks_swig +import blocks_swig as blocks class test_keep_one_in_n(gr_unittest.TestCase): @@ -34,9 +34,9 @@ class test_keep_one_in_n(gr_unittest.TestCase): def test_001(self): src_data = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10) expected_data = (5, 10) - src = gr.vector_source_b(src_data); - op = blocks_swig.keep_one_in_n(gr.sizeof_char, 5) - dst = gr.vector_sink_b() + src = blocks.vector_source_b(src_data); + op = blocks.keep_one_in_n(gr.sizeof_char, 5) + dst = blocks.vector_sink_b() self.tb.connect(src, op, dst) self.tb.run() self.assertEqual(dst.data(), expected_data) diff --git a/gr-blocks/python/qa_max.py b/gr-blocks/python/qa_max.py index 4af70bd4be..982f4b5590 100755 --- a/gr-blocks/python/qa_max.py +++ b/gr-blocks/python/qa_max.py @@ -36,10 +36,10 @@ class test_max(gr_unittest.TestCase): src_data = (0,0.2,-0.3,0,12,0) expected_result = (float(max(src_data)),) - src = gr.vector_source_f(src_data) + src = blocks.vector_source_f(src_data) s2v = blocks.stream_to_vector(gr.sizeof_float, len(src_data)) op = blocks.max_ff(len(src_data)) - dst = gr.vector_sink_f() + dst = blocks.vector_sink_f() self.tb.connect(src, s2v, op, dst) self.tb.run() @@ -50,10 +50,10 @@ class test_max(gr_unittest.TestCase): src_data=(-100,-99,-98,-97,-96,-1) expected_result = (float(max(src_data)),) - src = gr.vector_source_f(src_data) + src = blocks.vector_source_f(src_data) s2v = blocks.stream_to_vector(gr.sizeof_float, len(src_data)) op = blocks.max_ff(len(src_data)) - dst = gr.vector_sink_f() + dst = blocks.vector_sink_f() self.tb.connect(src, s2v, op, dst) self.tb.run() diff --git a/gr-blocks/python/qa_message.py b/gr-blocks/python/qa_message.py index a556f65cee..27cf186ed3 100755 --- a/gr-blocks/python/qa_message.py +++ b/gr-blocks/python/qa_message.py @@ -93,8 +93,8 @@ class test_message(gr_unittest.TestCase): def test_300(self): input_data = (0,1,2,3,4,5,6,7,8,9) - src = gr.vector_source_b(input_data) - dst = gr.vector_sink_b() + src = blocks.vector_source_b(input_data) + dst = blocks.vector_sink_b() tb = gr.top_block() tb.connect(src, dst) tb.run() @@ -103,7 +103,7 @@ class test_message(gr_unittest.TestCase): def test_301(self): # Use itemsize, limit constructor src = blocks.message_source(gr.sizeof_char) - dst = gr.vector_sink_b() + dst = blocks.vector_sink_b() tb = gr.top_block() tb.connect(src, dst) src.msgq().insert_tail(gr.message_from_string('01234')) @@ -118,7 +118,7 @@ class test_message(gr_unittest.TestCase): # Use itemsize, msgq constructor msgq = gr.msg_queue() src = blocks.message_source(gr.sizeof_char, msgq) - dst = gr.vector_sink_b() + dst = blocks.vector_sink_b() tb = gr.top_block() tb.connect(src, dst) src.msgq().insert_tail(gr.message_from_string('01234')) diff --git a/gr-blocks/python/qa_moving_average.py b/gr-blocks/python/qa_moving_average.py index 169b4746c2..d3fbdbbfdf 100644 --- a/gr-blocks/python/qa_moving_average.py +++ b/gr-blocks/python/qa_moving_average.py @@ -53,9 +53,9 @@ class test_moving_average(gr_unittest.TestCase): data = make_random_float_tuple(N, 1) expected_result = N*[0,] - src = gr.vector_source_f(data, False) + src = blocks.vector_source_f(data, False) op = blocks.moving_average_ff(100, 0.001) - dst = gr.vector_sink_f() + dst = blocks.vector_sink_f() tb.connect(src, op) tb.connect(op, dst) @@ -74,9 +74,9 @@ class test_moving_average(gr_unittest.TestCase): data = make_random_complex_tuple(N, 1) expected_result = N*[0,] - src = gr.vector_source_c(data, False) + src = blocks.vector_source_c(data, False) op = blocks.moving_average_cc(100, 0.001) - dst = gr.vector_sink_c() + dst = blocks.vector_sink_c() tb.connect(src, op) tb.connect(op, dst) diff --git a/gr-blocks/python/qa_multiply_conjugate.py b/gr-blocks/python/qa_multiply_conjugate.py index f51563f854..a18d80324c 100644 --- a/gr-blocks/python/qa_multiply_conjugate.py +++ b/gr-blocks/python/qa_multiply_conjugate.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2012 Free Software Foundation, Inc. +# Copyright 2012,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -21,7 +21,7 @@ # from gnuradio import gr, gr_unittest -import blocks_swig +import blocks_swig as blocks class test_multiply_conjugate (gr_unittest.TestCase): @@ -42,10 +42,10 @@ class test_multiply_conjugate (gr_unittest.TestCase): exp_data = (12+0j, 8+0j, 12+0j, 8+0j, 12+0j, 8+0j, 12+0j, 8+0j, 0+0j) - src0 = gr.vector_source_c(src_data0) - src1 = gr.vector_source_c(src_data1) - op = blocks_swig.multiply_conjugate_cc () - dst = gr.vector_sink_c () + src0 = blocks.vector_source_c(src_data0) + src1 = blocks.vector_source_c(src_data1) + op = blocks.multiply_conjugate_cc () + dst = blocks.vector_sink_c () self.tb.connect(src0, (op,0)) self.tb.connect(src1, (op,1)) diff --git a/gr-blocks/python/qa_mute.py b/gr-blocks/python/qa_mute.py index 96c57b2ed1..0c10846333 100755 --- a/gr-blocks/python/qa_mute.py +++ b/gr-blocks/python/qa_mute.py @@ -33,9 +33,9 @@ class test_mute(gr_unittest.TestCase): def help_ii(self, src_data, exp_data, op): for s in zip(range(len(src_data)), src_data): - src = gr.vector_source_i(s[1]) + src = blocks.vector_source_i(s[1]) self.tb.connect(src, (op, s[0])) - dst = gr.vector_sink_i() + dst = blocks.vector_sink_i() self.tb.connect(op, dst) self.tb.run() result_data = dst.data() @@ -43,9 +43,9 @@ class test_mute(gr_unittest.TestCase): def help_ff(self, src_data, exp_data, op): for s in zip(range(len(src_data)), src_data): - src = gr.vector_source_f(s[1]) + src = blocks.vector_source_f(s[1]) self.tb.connect(src, (op, s[0])) - dst = gr.vector_sink_f() + dst = blocks.vector_sink_f() self.tb.connect(op, dst) self.tb.run() result_data = dst.data() @@ -53,9 +53,9 @@ class test_mute(gr_unittest.TestCase): def help_cc(self, src_data, exp_data, op): for s in zip(range(len(src_data)), src_data): - src = gr.vector_source_c(s[1]) + src = blocks.vector_source_c(s[1]) self.tb.connect(src, (op, s[0])) - dst = gr.vector_sink_c() + dst = blocks.vector_sink_c() self.tb.connect(op, dst) self.tb.run() result_data = dst.data() diff --git a/gr-blocks/python/qa_nlog10.py b/gr-blocks/python/qa_nlog10.py index cc2a3e8cc5..a61313cacc 100755 --- a/gr-blocks/python/qa_nlog10.py +++ b/gr-blocks/python/qa_nlog10.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2005,2007,2010,2012 Free Software Foundation, Inc. +# Copyright 2005,2007,2010,2012,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -21,7 +21,7 @@ # from gnuradio import gr, gr_unittest -import blocks_swig +import blocks_swig as blocks class test_nlog10(gr_unittest.TestCase): @@ -34,9 +34,9 @@ class test_nlog10(gr_unittest.TestCase): def test_001(self): src_data = (-10, 0, 10, 100, 1000, 10000, 100000) expected_result = (-180, -180, 10, 20, 30, 40, 50) - src = gr.vector_source_f(src_data) - op = blocks_swig.nlog10_ff(10) - dst = gr.vector_sink_f() + src = blocks.vector_source_f(src_data) + op = blocks.nlog10_ff(10) + dst = blocks.vector_sink_f() self.tb.connect (src, op, dst) self.tb.run() result_data = dst.data() diff --git a/gnuradio-core/src/lib/gengen/generate_all.py b/gr-blocks/python/qa_null_sink_source.py index 6b0f20f058..60552cb207 100755..100644 --- a/gnuradio-core/src/lib/gengen/generate_all.py +++ b/gr-blocks/python/qa_null_sink_source.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2004 Free Software Foundation, Inc. +# Copyright 2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -20,14 +20,27 @@ # Boston, MA 02110-1301, USA. # -from build_utils import output_glue +from gnuradio import gr, gr_unittest +import blocks_swig as blocks +import math -import generate_common +class test_null_sink_source(gr_unittest.TestCase): -def generate_all (): - generate_common.generate () - output_glue ('gengen') + def setUp(self): + self.tb = gr.top_block() + def tearDown(self): + self.tb = None + + def test_001(self): + # Just running some data through null source/sink + src = blocks.null_source(gr.sizeof_float) + hed = blocks.head(gr.sizeof_float, 100) + dst = blocks.null_sink(gr.sizeof_float) + + self.tb.connect(src, hed, dst) + self.tb.run() if __name__ == '__main__': - generate_all () + gr_unittest.run(test_null_sink_source, "test_null_sink_source.xml") + diff --git a/gr-blocks/python/qa_pack_k_bits.py b/gr-blocks/python/qa_pack_k_bits.py index cd55d2f200..51152889f6 100755 --- a/gr-blocks/python/qa_pack_k_bits.py +++ b/gr-blocks/python/qa_pack_k_bits.py @@ -35,9 +35,9 @@ class test_pack(gr_unittest.TestCase): def test_001(self): src_data = (1,0,1,1,0,1,1,0) expected_results = (1,0,1,1,0,1,1,0) - src = gr.vector_source_b(src_data,False) + src = blocks.vector_source_b(src_data,False) op = blocks.pack_k_bits_bb(1) - dst = gr.vector_sink_b() + dst = blocks.vector_sink_b() self.tb.connect(src, op, dst) self.tb.run() self.assertEqual(expected_results, dst.data()) @@ -45,9 +45,9 @@ class test_pack(gr_unittest.TestCase): def test_002(self): src_data = (1,0,1,1,0,0,0,1) expected_results = ( 2, 3, 0, 1) - src = gr.vector_source_b(src_data,False) + src = blocks.vector_source_b(src_data,False) op = blocks.pack_k_bits_bb(2) - dst = gr.vector_sink_b() + dst = blocks.vector_sink_b() self.tb.connect(src, op, dst) self.tb.run() #self.assertEqual(expected_results, dst.data()) @@ -55,10 +55,10 @@ class test_pack(gr_unittest.TestCase): def test_003(self): src_data = expected_results = map(lambda x: random.randint(0,3), range(10)); - src = gr.vector_source_b( src_data ); + src = blocks.vector_source_b( src_data ); pack = blocks.pack_k_bits_bb(2); unpack = blocks.unpack_k_bits_bb(2); - snk = gr.vector_sink_b(); + snk = blocks.vector_sink_b(); self.tb.connect(src,unpack,pack,snk); self.tb.run() self.assertEqual(list(expected_results), list(snk.data())); diff --git a/gr-blocks/python/qa_packed_to_unpacked.py b/gr-blocks/python/qa_packed_to_unpacked.py index d84f5dbd37..23745d3859 100755 --- a/gr-blocks/python/qa_packed_to_unpacked.py +++ b/gr-blocks/python/qa_packed_to_unpacked.py @@ -35,9 +35,9 @@ class test_packing(gr_unittest.TestCase): def test_001(self): src_data = (0x80,) expected_results = (1,0,0,0,0,0,0,0) - src = gr.vector_source_b(src_data, False) + src = blocks.vector_source_b(src_data, False) op = blocks.packed_to_unpacked_bb(1, gr.GR_MSB_FIRST) - dst = gr.vector_sink_b() + dst = blocks.vector_sink_b() self.tb.connect(src, op) self.tb.connect(op, dst) @@ -48,9 +48,9 @@ class test_packing(gr_unittest.TestCase): def test_002(self): src_data = (0x80,) expected_results = (0,0,0,0,0,0,0,1) - src = gr.vector_source_b(src_data, False) + src = blocks.vector_source_b(src_data, False) op = blocks.packed_to_unpacked_bb(1, gr.GR_LSB_FIRST) - dst = gr.vector_sink_b() + dst = blocks.vector_sink_b() self.tb.connect(src, op) self.tb.connect(op, dst) @@ -61,9 +61,9 @@ class test_packing(gr_unittest.TestCase): def test_003(self): src_data = (0x11,) expected_results = (4, 2) - src = gr.vector_source_b(src_data, False) + src = blocks.vector_source_b(src_data, False) op = blocks.packed_to_unpacked_bb(3, gr.GR_LSB_FIRST) - dst = gr.vector_sink_b() + dst = blocks.vector_sink_b() self.tb.connect(src, op) self.tb.connect(op, dst) @@ -74,9 +74,9 @@ class test_packing(gr_unittest.TestCase): def test_004(self): src_data = (0x11,) expected_results = (0, 4) - src = gr.vector_source_b(src_data, False) + src = blocks.vector_source_b(src_data, False) op = blocks.packed_to_unpacked_bb(3, gr.GR_MSB_FIRST) - dst = gr.vector_sink_b() + dst = blocks.vector_sink_b() self.tb.connect(src, op) self.tb.connect(op, dst) @@ -87,9 +87,9 @@ class test_packing(gr_unittest.TestCase): def test_005(self): src_data = (1,0,0,0,0,0,1,0,0,1,0,1,1,0,1,0) expected_results = (0x82, 0x5a) - src = gr.vector_source_b(src_data, False) + src = blocks.vector_source_b(src_data, False) op = blocks.unpacked_to_packed_bb(1, gr.GR_MSB_FIRST) - dst = gr.vector_sink_b() + dst = blocks.vector_sink_b() self.tb.connect(src, op) self.tb.connect(op, dst) @@ -100,9 +100,9 @@ class test_packing(gr_unittest.TestCase): def test_006(self): src_data = (0,1,0,0,0,0,0,1,0,1,0,1,1,0,1,0) expected_results = (0x82, 0x5a) - src = gr.vector_source_b(src_data, False) + src = blocks.vector_source_b(src_data, False) op = blocks.unpacked_to_packed_bb(1, gr.GR_LSB_FIRST) - dst = gr.vector_sink_b() + dst = blocks.vector_sink_b() self.tb.connect(src, op) self.tb.connect(op, dst) @@ -113,9 +113,9 @@ class test_packing(gr_unittest.TestCase): def test_007(self): src_data = (4, 2, 0,0,0) expected_results = (0x11,) - src = gr.vector_source_b(src_data, False) + src = blocks.vector_source_b(src_data, False) op = blocks.unpacked_to_packed_bb(3, gr.GR_LSB_FIRST) - dst = gr.vector_sink_b() + dst = blocks.vector_sink_b() self.tb.connect(src, op) self.tb.connect(op, dst) @@ -126,9 +126,9 @@ class test_packing(gr_unittest.TestCase): def test_008(self): src_data = (0, 4, 2,0,0) expected_results = (0x11,) - src = gr.vector_source_b(src_data,False) + src = blocks.vector_source_b(src_data,False) op = blocks.unpacked_to_packed_bb(3, gr.GR_MSB_FIRST) - dst = gr.vector_sink_b() + dst = blocks.vector_sink_b() self.tb.connect(src, op) self.tb.connect(op, dst) @@ -144,10 +144,10 @@ class test_packing(gr_unittest.TestCase): src_data = tuple(src_data) expected_results = src_data - src = gr.vector_source_b(tuple(src_data), False) + src = blocks.vector_source_b(tuple(src_data), False) op1 = blocks.packed_to_unpacked_bb(3, gr.GR_MSB_FIRST) op2 = blocks.unpacked_to_packed_bb(3, gr.GR_MSB_FIRST) - dst = gr.vector_sink_b() + dst = blocks.vector_sink_b() self.tb.connect(src, op1, op2) self.tb.connect(op2, dst) @@ -162,10 +162,10 @@ class test_packing(gr_unittest.TestCase): src_data.append((random.randint(0,255))) src_data = tuple(src_data) expected_results = src_data - src = gr.vector_source_b(tuple(src_data), False) + src = blocks.vector_source_b(tuple(src_data), False) op1 = blocks.packed_to_unpacked_bb(7, gr.GR_MSB_FIRST) op2 = blocks.unpacked_to_packed_bb(7, gr.GR_MSB_FIRST) - dst = gr.vector_sink_b() + dst = blocks.vector_sink_b() self.tb.connect(src, op1, op2) self.tb.connect(op2, dst) @@ -180,10 +180,10 @@ class test_packing(gr_unittest.TestCase): src_data.append((random.randint(0,255))) src_data = tuple(src_data) expected_results = src_data - src = gr.vector_source_b(tuple(src_data),False) + src = blocks.vector_source_b(tuple(src_data),False) op1 = blocks.packed_to_unpacked_bb(7, gr.GR_LSB_FIRST) op2 = blocks.unpacked_to_packed_bb(7, gr.GR_LSB_FIRST) - dst = gr.vector_sink_b() + dst = blocks.vector_sink_b() self.tb.connect(src, op1, op2) self.tb.connect(op2, dst) @@ -200,10 +200,10 @@ class test_packing(gr_unittest.TestCase): src_data.append((random.randint(-2**15,2**15-1))) src_data = tuple(src_data) expected_results = src_data - src = gr.vector_source_s(tuple(src_data), False) + src = blocks.vector_source_s(tuple(src_data), False) op1 = blocks.packed_to_unpacked_ss(1, gr.GR_MSB_FIRST) op2 = blocks.unpacked_to_packed_ss(1, gr.GR_MSB_FIRST) - dst = gr.vector_sink_s() + dst = blocks.vector_sink_s() self.tb.connect(src, op1, op2) self.tb.connect(op2, dst) @@ -218,10 +218,10 @@ class test_packing(gr_unittest.TestCase): src_data.append((random.randint(-2**15,2**15-1))) src_data = tuple(src_data) expected_results = src_data - src = gr.vector_source_s(tuple(src_data), False) + src = blocks.vector_source_s(tuple(src_data), False) op1 = blocks.packed_to_unpacked_ss(1, gr.GR_LSB_FIRST) op2 = blocks.unpacked_to_packed_ss(1, gr.GR_LSB_FIRST) - dst = gr.vector_sink_s() + dst = blocks.vector_sink_s() self.tb.connect(src, op1, op2) self.tb.connect(op2, dst) @@ -236,10 +236,10 @@ class test_packing(gr_unittest.TestCase): src_data.append((random.randint(-2**15,2**15-1))) src_data = tuple(src_data) expected_results = src_data - src = gr.vector_source_s(tuple(src_data), False) + src = blocks.vector_source_s(tuple(src_data), False) op1 = blocks.packed_to_unpacked_ss(8, gr.GR_MSB_FIRST) op2 = blocks.unpacked_to_packed_ss(8, gr.GR_MSB_FIRST) - dst = gr.vector_sink_s() + dst = blocks.vector_sink_s() self.tb.connect(src, op1, op2) self.tb.connect(op2, dst) @@ -254,10 +254,10 @@ class test_packing(gr_unittest.TestCase): src_data.append((random.randint(-2**15,2**15-1))) src_data = tuple(src_data) expected_results = src_data - src = gr.vector_source_s(tuple(src_data), False) + src = blocks.vector_source_s(tuple(src_data), False) op1 = blocks.packed_to_unpacked_ss(8, gr.GR_LSB_FIRST) op2 = blocks.unpacked_to_packed_ss(8, gr.GR_LSB_FIRST) - dst = gr.vector_sink_s() + dst = blocks.vector_sink_s() self.tb.connect(src, op1, op2) self.tb.connect(op2, dst) @@ -274,10 +274,10 @@ class test_packing(gr_unittest.TestCase): src_data.append((random.randint(-2**31,2**31-1))) src_data = tuple(src_data) expected_results = src_data - src = gr.vector_source_i(tuple(src_data), False) + src = blocks.vector_source_i(tuple(src_data), False) op1 = blocks.packed_to_unpacked_ii(1, gr.GR_MSB_FIRST) op2 = blocks.unpacked_to_packed_ii(1, gr.GR_MSB_FIRST) - dst = gr.vector_sink_i() + dst = blocks.vector_sink_i() self.tb.connect(src, op1, op2) self.tb.connect(op2, dst) @@ -292,10 +292,10 @@ class test_packing(gr_unittest.TestCase): src_data.append((random.randint(-2**31,2**31-1))) src_data = tuple(src_data) expected_results = src_data - src = gr.vector_source_i(tuple(src_data), False) + src = blocks.vector_source_i(tuple(src_data), False) op1 = blocks.packed_to_unpacked_ii(1, gr.GR_LSB_FIRST) op2 = blocks.unpacked_to_packed_ii(1, gr.GR_LSB_FIRST) - dst = gr.vector_sink_i() + dst = blocks.vector_sink_i() self.tb.connect(src, op1, op2) self.tb.connect(op2, dst) @@ -310,10 +310,10 @@ class test_packing(gr_unittest.TestCase): src_data.append((random.randint(-2**31,2**31-1))) src_data = tuple(src_data) expected_results = src_data - src = gr.vector_source_i(tuple(src_data), False) + src = blocks.vector_source_i(tuple(src_data), False) op1 = blocks.packed_to_unpacked_ii(8, gr.GR_MSB_FIRST) op2 = blocks.unpacked_to_packed_ii(8, gr.GR_MSB_FIRST) - dst = gr.vector_sink_i() + dst = blocks.vector_sink_i() self.tb.connect(src, op1, op2) self.tb.connect(op2, dst) @@ -328,10 +328,10 @@ class test_packing(gr_unittest.TestCase): src_data.append((random.randint(-2**31,2**31-1))) src_data = tuple(src_data) expected_results = src_data - src = gr.vector_source_i(tuple(src_data), False) + src = blocks.vector_source_i(tuple(src_data), False) op1 = blocks.packed_to_unpacked_ii(8, gr.GR_LSB_FIRST) op2 = blocks.unpacked_to_packed_ii(8, gr.GR_LSB_FIRST) - dst = gr.vector_sink_i() + dst = blocks.vector_sink_i() self.tb.connect(src, op1, op2) self.tb.connect(op2, dst) diff --git a/gr-blocks/python/qa_patterned_interleaver.py b/gr-blocks/python/qa_patterned_interleaver.py index 3cf29c9178..c960ac2e66 100755 --- a/gr-blocks/python/qa_patterned_interleaver.py +++ b/gr-blocks/python/qa_patterned_interleaver.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2008,2010 Free Software Foundation, Inc. +# Copyright 2008,2010,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -37,12 +37,12 @@ class test_patterned_interleaver (gr_unittest.TestCase): def test_000(self): dst_data = [0,0,1,2,0,2,1,0]; - src0 = gr.vector_source_f(200*[0]) - src1 = gr.vector_source_f(200*[1]) - src2 = gr.vector_source_f(200*[2]) + src0 = blocks.vector_source_f(200*[0]) + src1 = blocks.vector_source_f(200*[1]) + src2 = blocks.vector_source_f(200*[2]) itg = blocks.patterned_interleaver(gr.sizeof_float, dst_data) - dst = gr.vector_sink_f() - head = gr.head(gr.sizeof_float, 8); + dst = blocks.vector_sink_f() + head = blocks.head(gr.sizeof_float, 8); self.tb.connect( src0, (itg,0) ); self.tb.connect( src1, (itg,1) ); diff --git a/gr-blocks/python/qa_pdu.py b/gr-blocks/python/qa_pdu.py index c8fc0e5a91..a9d8ea86f3 100755 --- a/gr-blocks/python/qa_pdu.py +++ b/gr-blocks/python/qa_pdu.py @@ -39,7 +39,7 @@ class test_pdu(gr_unittest.TestCase): src = blocks.pdu_to_tagged_stream(blocks.byte_t) snk3 = blocks.tagged_stream_to_pdu(blocks.byte_t) - snk2 = gr.vector_sink_b() + snk2 = blocks.vector_sink_b() snk = blocks.tag_debug(1, "test") snk.set_display(False) diff --git a/gr-blocks/python/qa_peak_detector.py b/gr-blocks/python/qa_peak_detector.py index c3ff2548c4..4b28518410 100644 --- a/gr-blocks/python/qa_peak_detector.py +++ b/gr-blocks/python/qa_peak_detector.py @@ -40,9 +40,9 @@ class test_peak_detector(gr_unittest.TestCase): expected_result = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) - src = gr.vector_source_f(data, False) + src = blocks.vector_source_f(data, False) regen = blocks.peak_detector_fb() - dst = gr.vector_sink_b() + dst = blocks.vector_sink_b() tb.connect(src, regen) tb.connect(regen, dst) @@ -61,9 +61,9 @@ class test_peak_detector(gr_unittest.TestCase): expected_result = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) - src = gr.vector_source_i(data, False) + src = blocks.vector_source_i(data, False) regen = blocks.peak_detector_ib() - dst = gr.vector_sink_b() + dst = blocks.vector_sink_b() tb.connect(src, regen) tb.connect(regen, dst) @@ -82,9 +82,9 @@ class test_peak_detector(gr_unittest.TestCase): expected_result = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) - src = gr.vector_source_s(data, False) + src = blocks.vector_source_s(data, False) regen = blocks.peak_detector_sb() - dst = gr.vector_sink_b() + dst = blocks.vector_sink_b() tb.connect(src, regen) tb.connect(regen, dst) diff --git a/gr-blocks/python/qa_peak_detector2.py b/gr-blocks/python/qa_peak_detector2.py index b2d8e318dd..5fcda9be08 100644 --- a/gr-blocks/python/qa_peak_detector2.py +++ b/gr-blocks/python/qa_peak_detector2.py @@ -41,9 +41,9 @@ class test_peak_detector2(gr_unittest.TestCase): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) - src = gr.vector_source_f(data, False) + src = blocks.vector_source_f(data, False) regen = blocks.peak_detector2_fb() - dst = gr.vector_sink_b() + dst = blocks.vector_sink_b() tb.connect(src, regen) tb.connect(regen, dst) diff --git a/gr-blocks/python/qa_pipe_fittings.py b/gr-blocks/python/qa_pipe_fittings.py index 9894a5c211..634638dcdd 100755 --- a/gr-blocks/python/qa_pipe_fittings.py +++ b/gr-blocks/python/qa_pipe_fittings.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2005,2007,2010,2012 Free Software Foundation, Inc. +# Copyright 2005,2007,2010,2012,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -50,13 +50,13 @@ class test_pipe_fittings(gr_unittest.TestCase): expected_results = calc_expected_result(src_data, n) #print "expected results: ", expected_results - src = gr.vector_source_i(src_data) + src = blocks.vector_source_i(src_data) op = blocks.stream_to_streams(gr.sizeof_int, n) self.tb.connect(src, op) dsts = [] for i in range(n): - dst = gr.vector_sink_i() + dst = blocks.vector_sink_i() self.tb.connect((op, i), (dst, 0)) dsts.append(dst) @@ -74,10 +74,10 @@ class test_pipe_fittings(gr_unittest.TestCase): src_data = tuple(range(src_len)) expected_results = src_data - src = gr.vector_source_i(src_data) + src = blocks.vector_source_i(src_data) op1 = blocks.stream_to_streams(gr.sizeof_int, n) op2 = blocks.streams_to_stream(gr.sizeof_int, n) - dst = gr.vector_sink_i() + dst = blocks.vector_sink_i() self.tb.connect(src, op1) for i in range(n): @@ -96,11 +96,11 @@ class test_pipe_fittings(gr_unittest.TestCase): src_data = tuple(range(src_len)) expected_results = src_data - src = gr.vector_source_i(src_data) + src = blocks.vector_source_i(src_data) op1 = blocks.stream_to_streams(gr.sizeof_int, n) op2 = blocks.streams_to_vector(gr.sizeof_int, n) op3 = blocks.vector_to_stream(gr.sizeof_int, n) - dst = gr.vector_sink_i() + dst = blocks.vector_sink_i() self.tb.connect(src, op1) for i in range(n): @@ -119,11 +119,11 @@ class test_pipe_fittings(gr_unittest.TestCase): src_data = tuple(range(src_len)) expected_results = src_data - src = gr.vector_source_i(src_data) + src = blocks.vector_source_i(src_data) op1 = blocks.stream_to_vector(gr.sizeof_int, n) op2 = blocks.vector_to_streams(gr.sizeof_int, n) op3 = blocks.streams_to_stream(gr.sizeof_int, n) - dst = gr.vector_sink_i() + dst = blocks.vector_sink_i() self.tb.connect(src, op1, op2) for i in range(n): diff --git a/gr-blocks/python/qa_probe_signal.py b/gr-blocks/python/qa_probe_signal.py index 6d25a25087..1cb151bfc0 100644 --- a/gr-blocks/python/qa_probe_signal.py +++ b/gr-blocks/python/qa_probe_signal.py @@ -36,7 +36,7 @@ class test_probe_signal(gr_unittest.TestCase): repeats = 100 src_data = [value] * repeats - src = gr.vector_source_f(src_data) + src = blocks.vector_source_f(src_data) dst = blocks.probe_signal_f() self.tb.connect(src, dst) @@ -50,7 +50,7 @@ class test_probe_signal(gr_unittest.TestCase): value = [0.5+i for i in range(0, vector_length)] src_data = value * repeats - src = gr.vector_source_f(src_data) + src = blocks.vector_source_f(src_data) s2v = blocks.stream_to_vector(gr.sizeof_float, vector_length) dst = blocks.probe_signal_vf(vector_length) diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_python_message_passing.py b/gr-blocks/python/qa_python_message_passing.py index 51f8ede4db..f199d5470f 100644 --- a/gnuradio-core/src/python/gnuradio/gr/qa_python_message_passing.py +++ b/gr-blocks/python/qa_python_message_passing.py @@ -25,6 +25,7 @@ try: import pmt except: from gruel import pmt import numpy import time +import blocks_swig as blocks # Simple block to generate messages class message_generator(gr.sync_block): @@ -88,7 +89,7 @@ class test_python_message_passing(gr_unittest.TestCase): src_data = [] for i in range(num_msgs*msg_interval): src_data.append(float(i)) - src = gr.vector_source_f(src_data, False) + src = blocks.vector_source_f(src_data, False) msg_gen = message_generator(msg_list, msg_interval) msg_cons = message_consumer() diff --git a/gr-blocks/python/qa_regenerate.py b/gr-blocks/python/qa_regenerate.py index a57eeba2bb..0be68d001c 100755 --- a/gr-blocks/python/qa_regenerate.py +++ b/gr-blocks/python/qa_regenerate.py @@ -43,9 +43,9 @@ class test_regenerate(gr_unittest.TestCase): 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) - src = gr.vector_source_b(data, False) + src = blocks.vector_source_b(data, False) regen = blocks.regenerate_bb(5, 2) - dst = gr.vector_sink_b() + dst = blocks.vector_sink_b() tb.connect(src, regen) tb.connect(regen, dst) @@ -73,9 +73,9 @@ class test_regenerate(gr_unittest.TestCase): expected_result[119] = 1 expected_result[129] = 1 - src = gr.vector_source_b(data, False) + src = blocks.vector_source_b(data, False) regen = blocks.regenerate_bb(10, 3) - dst = gr.vector_sink_b() + dst = blocks.vector_sink_b() tb.connect(src, regen) tb.connect(regen, dst) diff --git a/gr-blocks/python/qa_repack_bits_bb.py b/gr-blocks/python/qa_repack_bits_bb.py index 3f88df4a68..9da6cf26c6 100755 --- a/gr-blocks/python/qa_repack_bits_bb.py +++ b/gr-blocks/python/qa_repack_bits_bb.py @@ -39,9 +39,9 @@ class qa_repack_bits_bb (gr_unittest.TestCase): expected_data = (0b1, 0b1, 0b1, 0b0, 0b0, 0b1) k = 2 l = 1 - src = gr.vector_source_b(src_data, False, 1) + src = blocks.vector_source_b(src_data, False, 1) repack = blocks.repack_bits_bb(k, l) - sink = gr.vector_sink_b() + sink = blocks.vector_sink_b() self.tb.connect(src, repack, sink) self.tb.run () self.assertEqual(sink.data(), expected_data) @@ -52,9 +52,9 @@ class qa_repack_bits_bb (gr_unittest.TestCase): expected_data = (0b101,) + (0b111,) * 7 k = 8 l = 3 - src = gr.vector_source_b(src_data, False, 1) + src = blocks.vector_source_b(src_data, False, 1) repack = blocks.repack_bits_bb(k, l) - sink = gr.vector_sink_b() + sink = blocks.vector_sink_b() self.tb.connect(src, repack, sink) self.tb.run () self.assertEqual(sink.data(), expected_data) @@ -62,12 +62,12 @@ class qa_repack_bits_bb (gr_unittest.TestCase): def test_003_lots_of_bytes (self): """ Lots and lots of bytes, multiple packer stages """ src_data = tuple([random.randint(0, 255) for x in range(3*5*7*8 * 10)]) - src = gr.vector_source_b(src_data, False, 1) + src = blocks.vector_source_b(src_data, False, 1) repack1 = blocks.repack_bits_bb(8, 3) repack2 = blocks.repack_bits_bb(3, 5) repack3 = blocks.repack_bits_bb(5, 7) repack4 = blocks.repack_bits_bb(7, 8) - sink = gr.vector_sink_b() + sink = blocks.vector_sink_b() self.tb.connect(src, repack1, repack2, repack3, repack4, sink) self.tb.run () self.assertEqual(sink.data(), src_data) @@ -83,9 +83,9 @@ class qa_repack_bits_bb (gr_unittest.TestCase): tag.offset = 0 tag.key = pmt.string_to_symbol(tag_name) tag.value = pmt.from_long(len(src_data)) - src = gr.vector_source_b(src_data, False, 1, (tag,)) + src = blocks.vector_source_b(src_data, False, 1, (tag,)) repack = blocks.repack_bits_bb(k, l, tag_name) - sink = gr.vector_sink_b() + sink = blocks.vector_sink_b() self.tb.connect(src, repack, sink) self.tb.run () self.assertEqual(sink.data(), expected_data) @@ -108,9 +108,9 @@ class qa_repack_bits_bb (gr_unittest.TestCase): tag.offset = 0 tag.key = pmt.string_to_symbol(tag_name) tag.value = pmt.from_long(len(src_data)) - src = gr.vector_source_b(src_data, False, 1, (tag,)) + src = blocks.vector_source_b(src_data, False, 1, (tag,)) repack = blocks.repack_bits_bb(k, l, tag_name, True) - sink = gr.vector_sink_b() + sink = blocks.vector_sink_b() self.tb.connect(src, repack, sink) self.tb.run () self.assertEqual(sink.data(), expected_data) diff --git a/gr-blocks/python/qa_repeat.py b/gr-blocks/python/qa_repeat.py index 69fb3ef72d..aa1b1f45f1 100755 --- a/gr-blocks/python/qa_repeat.py +++ b/gr-blocks/python/qa_repeat.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2008,2010,2012 Free Software Foundation, Inc. +# Copyright 2008,2010,2012,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -21,7 +21,7 @@ # from gnuradio import gr, gr_unittest -import blocks_swig +import blocks_swig as blocks import math class test_repeat (gr_unittest.TestCase): @@ -38,9 +38,9 @@ class test_repeat (gr_unittest.TestCase): for n in range(100): dst_data += [1.0*n, 1.0*n, 1.0*n] - src = gr.vector_source_f(src_data) - rpt = blocks_swig.repeat(gr.sizeof_float, 3) - dst = gr.vector_sink_f() + src = blocks.vector_source_f(src_data) + rpt = blocks.repeat(gr.sizeof_float, 3) + dst = blocks.vector_sink_f() self.tb.connect(src, rpt, dst) self.tb.run() self.assertFloatTuplesAlmostEqual(dst_data, dst.data(), 6) diff --git a/gr-blocks/python/qa_rms.py b/gr-blocks/python/qa_rms.py index f3386668af..3dac70c1ec 100644 --- a/gr-blocks/python/qa_rms.py +++ b/gr-blocks/python/qa_rms.py @@ -50,10 +50,10 @@ class test_rms(gr_unittest.TestCase): expected_data = amp/math.sqrt(2.0) - src = gr.vector_source_f(src_data, True) - head = gr.head(gr.sizeof_float, N) + src = blocks.vector_source_f(src_data, True) + head = blocks.head(gr.sizeof_float, N) op = blocks.rms_ff(0.0001) - dst = gr.vector_sink_f() + dst = blocks.vector_sink_f() self.tb.connect(src, head, op, dst) self.tb.run() @@ -68,10 +68,10 @@ class test_rms(gr_unittest.TestCase): expected_data = amp - src = gr.vector_source_c(src_data, True) - head = gr.head(gr.sizeof_gr_complex, N) + src = blocks.vector_source_c(src_data, True) + head = blocks.head(gr.sizeof_gr_complex, N) op = blocks.rms_cf(0.0001) - dst = gr.vector_sink_f() + dst = blocks.vector_sink_f() self.tb.connect(src, head, op, dst) self.tb.run() diff --git a/gr-blocks/python/qa_sample_and_hold.py b/gr-blocks/python/qa_sample_and_hold.py index 59628090d1..87d472a038 100644 --- a/gr-blocks/python/qa_sample_and_hold.py +++ b/gr-blocks/python/qa_sample_and_hold.py @@ -37,10 +37,10 @@ class test_sample_and_hold(gr_unittest.TestCase): ctrl_data = 10*[1,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0] expected_result = 10*(0,0,0,0,4,5,6,7,8,9,9,9,9,9,9,9,9,9) - src = gr.vector_source_f(src_data) - ctrl = gr.vector_source_b(ctrl_data) + src = blocks.vector_source_f(src_data) + ctrl = blocks.vector_source_b(ctrl_data) op = blocks.sample_and_hold_ff() - dst = gr.vector_sink_f() + dst = blocks.vector_sink_f() self.tb.connect(src, (op,0)) self.tb.connect(ctrl, (op,1)) diff --git a/gr-blocks/python/qa_skiphead.py b/gr-blocks/python/qa_skiphead.py new file mode 100755 index 0000000000..50a9bbc639 --- /dev/null +++ b/gr-blocks/python/qa_skiphead.py @@ -0,0 +1,103 @@ +#!/usr/bin/env python +# +# Copyright 2007,2010,2013 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio 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 3, or (at your option) +# any later version. +# +# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. +# + +from gnuradio import gr, gr_unittest +import blocks_swig as blocks + +class test_skiphead(gr_unittest.TestCase): + + def setUp(self): + self.tb = gr.top_block() + self.src_data = [int(x) for x in range(65536)] + + def tearDown(self): + self.tb = None + + def test_skip_0(self): + skip_cnt = 0 + expected_result = tuple(self.src_data[skip_cnt:]) + src1 = blocks.vector_source_i(self.src_data) + op = blocks.skiphead(gr.sizeof_int, skip_cnt) + dst1 = blocks.vector_sink_i() + self.tb.connect(src1, op, dst1) + self.tb.run() + dst_data = dst1.data() + self.assertEqual(expected_result, dst_data) + + def test_skip_1(self): + skip_cnt = 1 + expected_result = tuple(self.src_data[skip_cnt:]) + src1 = blocks.vector_source_i(self.src_data) + op = blocks.skiphead(gr.sizeof_int, skip_cnt) + dst1 = blocks.vector_sink_i() + self.tb.connect(src1, op, dst1) + self.tb.run() + dst_data = dst1.data() + self.assertEqual(expected_result, dst_data) + + def test_skip_1023(self): + skip_cnt = 1023 + expected_result = tuple(self.src_data[skip_cnt:]) + src1 = blocks.vector_source_i(self.src_data) + op = blocks.skiphead(gr.sizeof_int, skip_cnt) + dst1 = blocks.vector_sink_i() + self.tb.connect(src1, op, dst1) + self.tb.run() + dst_data = dst1.data() + self.assertEqual(expected_result, dst_data) + + def test_skip_6339(self): + skip_cnt = 6339 + expected_result = tuple(self.src_data[skip_cnt:]) + src1 = blocks.vector_source_i(self.src_data) + op = blocks.skiphead(gr.sizeof_int, skip_cnt) + dst1 = blocks.vector_sink_i() + self.tb.connect(src1, op, dst1) + self.tb.run() + dst_data = dst1.data() + self.assertEqual(expected_result, dst_data) + + def test_skip_12678(self): + skip_cnt = 12678 + expected_result = tuple(self.src_data[skip_cnt:]) + src1 = blocks.vector_source_i(self.src_data) + op = blocks.skiphead(gr.sizeof_int, skip_cnt) + dst1 = blocks.vector_sink_i() + self.tb.connect(src1, op, dst1) + self.tb.run() + dst_data = dst1.data() + self.assertEqual(expected_result, dst_data) + + def test_skip_all(self): + skip_cnt = len(self.src_data) + expected_result = tuple(self.src_data[skip_cnt:]) + src1 = blocks.vector_source_i(self.src_data) + op = blocks.skiphead(gr.sizeof_int, skip_cnt) + dst1 = blocks.vector_sink_i() + self.tb.connect(src1, op, dst1) + self.tb.run() + dst_data = dst1.data() + self.assertEqual(expected_result, dst_data) + + +if __name__ == '__main__': + gr_unittest.run(test_skiphead, "test_skiphead.xml") diff --git a/gr-blocks/python/qa_stream_mux.py b/gr-blocks/python/qa_stream_mux.py index 657bd3d63f..a5004dd8da 100755 --- a/gr-blocks/python/qa_stream_mux.py +++ b/gr-blocks/python/qa_stream_mux.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2004,2005,2007,2010,2012 Free Software Foundation, Inc. +# Copyright 2004,2005,2007,2010,2012,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -21,7 +21,7 @@ # from gnuradio import gr, gr_unittest -import blocks_swig +import blocks_swig as blocks import os class test_stream_mux (gr_unittest.TestCase): @@ -34,12 +34,12 @@ class test_stream_mux (gr_unittest.TestCase): self.tb = None def help_stream_2ff(self, N, stream_sizes): - v0 = gr.vector_source_f(N*[1,], False) - v1 = gr.vector_source_f(N*[2,], False) + v0 = blocks.vector_source_f(N*[1,], False) + v1 = blocks.vector_source_f(N*[2,], False) - mux = blocks_swig.stream_mux(gr.sizeof_float, stream_sizes) + mux = blocks.stream_mux(gr.sizeof_float, stream_sizes) - dst = gr.vector_sink_f () + dst = blocks.vector_sink_f () self.tb.connect (v0, (mux,0)) self.tb.connect (v1, (mux,1)) @@ -53,12 +53,12 @@ class test_stream_mux (gr_unittest.TestCase): r2 = range(N) r2.reverse() - v0 = gr.vector_source_f(r1, False) - v1 = gr.vector_source_f(r2, False) + v0 = blocks.vector_source_f(r1, False) + v1 = blocks.vector_source_f(r2, False) - mux = blocks_swig.stream_mux(gr.sizeof_float, stream_sizes) + mux = blocks.stream_mux(gr.sizeof_float, stream_sizes) - dst = gr.vector_sink_f () + dst = blocks.vector_sink_f () self.tb.connect (v0, (mux,0)) self.tb.connect (v1, (mux,1)) diff --git a/gr-blocks/python/qa_stretch.py b/gr-blocks/python/qa_stretch.py index 078b404dbf..94bb6e0353 100755 --- a/gr-blocks/python/qa_stretch.py +++ b/gr-blocks/python/qa_stretch.py @@ -41,13 +41,13 @@ class test_stretch(gr_unittest.TestCase): expected_result0 = 10*[0.05,] expected_result1 = 10*[0.1,] - src0 = gr.vector_source_f(data0, False) - src1 = gr.vector_source_f(data1, False) + src0 = blocks.vector_source_f(data0, False) + src1 = blocks.vector_source_f(data1, False) inter = blocks.streams_to_vector(gr.sizeof_float, 2) op = blocks.stretch_ff(0.1, 2) deinter = blocks.vector_to_streams(gr.sizeof_float, 2) - dst0 = gr.vector_sink_f() - dst1 = gr.vector_sink_f() + dst0 = blocks.vector_sink_f() + dst1 = blocks.vector_sink_f() tb.connect(src0, (inter,0)) tb.connect(src1, (inter,1)) diff --git a/gr-blocks/python/qa_tag_debug.py b/gr-blocks/python/qa_tag_debug.py index ad85daebcc..52864d34fb 100755 --- a/gr-blocks/python/qa_tag_debug.py +++ b/gr-blocks/python/qa_tag_debug.py @@ -34,7 +34,7 @@ class test_tag_debug(gr_unittest.TestCase): def test_001(self): # Just run some data through and make sure it doesn't puke. src_data = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10) - src = gr.vector_source_i(src_data) + src = blocks.vector_source_i(src_data) op = blocks.tag_debug(gr.sizeof_int, "tag QA") self.tb.connect(src, op) self.tb.run() diff --git a/gr-blocks/python/qa_tag_file_sink.py b/gr-blocks/python/qa_tag_file_sink.py index 80e41a7dd0..e41e6544fd 100644 --- a/gr-blocks/python/qa_tag_file_sink.py +++ b/gr-blocks/python/qa_tag_file_sink.py @@ -35,8 +35,8 @@ class test_tag_file_sink(gr_unittest.TestCase): def test_001(self): src_data = ( 1, 2, 3, 4, 5, 6, 7, 8, 9, 10) trg_data = (-1, -1, 1, 1, -1, -1, 1, 1, -1, -1) - src = gr.vector_source_i(src_data) - trg = gr.vector_source_s(trg_data) + src = blocks.vector_source_i(src_data) + trg = blocks.vector_source_s(trg_data) op = blocks.burst_tagger(gr.sizeof_int) snk = blocks.tagged_file_sink(gr.sizeof_int, 1) self.tb.connect(src, (op,0)) diff --git a/gr-blocks/python/qa_tagged_stream_mux.py b/gr-blocks/python/qa_tagged_stream_mux.py index e39f8cac29..1759c44623 100755 --- a/gr-blocks/python/qa_tagged_stream_mux.py +++ b/gr-blocks/python/qa_tagged_stream_mux.py @@ -82,10 +82,10 @@ class qa_tagged_stream_mux (gr_unittest.TestCase): test_tag_1.offset = 3 # On the first '3' of the 2nd stream test_tag_1.value = pmt.to_pmt(23) - src0 = gr.vector_source_b(datas[0:9], False, 1, len_tags_0 + (test_tag_0,)) - src1 = gr.vector_source_b(datas[9:], False, 1, len_tags_1 + (test_tag_1,)) + src0 = blocks.vector_source_b(datas[0:9], False, 1, len_tags_0 + (test_tag_0,)) + src1 = blocks.vector_source_b(datas[9:], False, 1, len_tags_1 + (test_tag_1,)) tagged_stream_mux = blocks.tagged_stream_mux(gr.sizeof_char, tagname) - snk = gr.vector_sink_b() + snk = blocks.vector_sink_b() self.tb.connect(src0, (tagged_stream_mux, 0)) self.tb.connect(src1, (tagged_stream_mux, 1)) self.tb.connect(tagged_stream_mux, snk) diff --git a/gr-blocks/python/qa_threshold.py b/gr-blocks/python/qa_threshold.py index f91af739ad..352a14da9e 100644 --- a/gr-blocks/python/qa_threshold.py +++ b/gr-blocks/python/qa_threshold.py @@ -38,9 +38,9 @@ class test_threshold(gr_unittest.TestCase): expected_result = (0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1) - src = gr.vector_source_f(data, False) + src = blocks.vector_source_f(data, False) op = blocks.threshold_ff(1, 1) - dst = gr.vector_sink_f() + dst = blocks.vector_sink_f() tb.connect(src, op) tb.connect(op, dst) diff --git a/gr-blocks/python/qa_transcendental.py b/gr-blocks/python/qa_transcendental.py index 8174f79630..b57b0b4430 100644 --- a/gr-blocks/python/qa_transcendental.py +++ b/gr-blocks/python/qa_transcendental.py @@ -38,9 +38,9 @@ class test_transcendental(gr_unittest.TestCase): data = 100*[0,] expected_result = 100*[1,] - src = gr.vector_source_f(data, False) + src = blocks.vector_source_f(data, False) op = blocks.transcendental("cos", "float") - dst = gr.vector_sink_f() + dst = blocks.vector_sink_f() tb.connect(src, op) tb.connect(op, dst) @@ -56,9 +56,9 @@ class test_transcendental(gr_unittest.TestCase): data = 100*[3,] expected_result = 100*[math.log10(3),] - src = gr.vector_source_f(data, False) + src = blocks.vector_source_f(data, False) op = blocks.transcendental("log10", "float") - dst = gr.vector_sink_f() + dst = blocks.vector_sink_f() tb.connect(src, op) tb.connect(op, dst) @@ -74,9 +74,9 @@ class test_transcendental(gr_unittest.TestCase): data = 100*[3,] expected_result = 100*[math.tanh(3),] - src = gr.vector_source_f(data, False) + src = blocks.vector_source_f(data, False) op = blocks.transcendental("tanh", "float") - dst = gr.vector_sink_f() + dst = blocks.vector_sink_f() tb.connect(src, op) tb.connect(op, dst) diff --git a/gr-blocks/python/qa_type_conversions.py b/gr-blocks/python/qa_type_conversions.py index eb1b42b636..548ab33926 100755 --- a/gr-blocks/python/qa_type_conversions.py +++ b/gr-blocks/python/qa_type_conversions.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2012 Free Software Foundation, Inc. +# Copyright 2012,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -21,7 +21,7 @@ # from gnuradio import gr, gr_unittest -import blocks_swig +import blocks_swig as blocks from math import sqrt, atan2 class test_type_conversions(gr_unittest.TestCase): @@ -35,9 +35,9 @@ class test_type_conversions(gr_unittest.TestCase): def test_char_to_float_identity(self): src_data = (1, 2, 3, 4, 5) expected_data = (1.0, 2.0, 3.0, 4.0, 5.0) - src = gr.vector_source_b(src_data) - op = blocks_swig.char_to_float() - dst = gr.vector_sink_f() + src = blocks.vector_source_b(src_data) + op = blocks.char_to_float() + dst = blocks.vector_sink_f() self.tb.connect(src, op, dst) self.tb.run() self.assertFloatTuplesAlmostEqual(expected_data, dst.data()) @@ -45,9 +45,9 @@ class test_type_conversions(gr_unittest.TestCase): def test_char_to_float_scale(self): src_data = (1, 2, 3, 4, 5) expected_data = (0.5, 1.0, 1.5, 2.0, 2.5) - src = gr.vector_source_b(src_data) - op = blocks_swig.char_to_float(scale=2.0) - dst = gr.vector_sink_f() + src = blocks.vector_source_b(src_data) + op = blocks.char_to_float(scale=2.0) + dst = blocks.vector_sink_f() self.tb.connect(src, op, dst) self.tb.run() self.assertFloatTuplesAlmostEqual(expected_data, dst.data()) @@ -55,9 +55,9 @@ class test_type_conversions(gr_unittest.TestCase): def test_char_to_short(self): src_data = (1, 2, 3, 4, 5) expected_data = (256, 512, 768, 1024, 1280) - src = gr.vector_source_b(src_data) - op = blocks_swig.char_to_short() - dst = gr.vector_sink_s() + src = blocks.vector_source_b(src_data) + op = blocks.char_to_short() + dst = blocks.vector_sink_s() self.tb.connect(src, op, dst) self.tb.run() self.assertEqual(expected_data, dst.data()) @@ -65,9 +65,9 @@ class test_type_conversions(gr_unittest.TestCase): def test_complex_to_interleaved_short(self): src_data = (1+2j, 3+4j, 5+6j, 7+8j, 9+10j) expected_data = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10) - src = gr.vector_source_c(src_data) - op = blocks_swig.complex_to_interleaved_short() - dst = gr.vector_sink_s() + src = blocks.vector_source_c(src_data) + op = blocks.complex_to_interleaved_short() + dst = blocks.vector_sink_s() self.tb.connect(src, op, dst) self.tb.run() self.assertEqual(expected_data, dst.data()) @@ -75,9 +75,9 @@ class test_type_conversions(gr_unittest.TestCase): def test_complex_to_float_1(self): src_data = (1+2j, 3+4j, 5+6j, 7+8j, 9+10j) expected_data = (1.0, 3.0, 5.0, 7.0, 9.0) - src = gr.vector_source_c(src_data) - op = blocks_swig.complex_to_float() - dst = gr.vector_sink_f() + src = blocks.vector_source_c(src_data) + op = blocks.complex_to_float() + dst = blocks.vector_sink_f() self.tb.connect(src, op, dst) self.tb.run() self.assertFloatTuplesAlmostEqual(expected_data, dst.data()) @@ -86,10 +86,10 @@ class test_type_conversions(gr_unittest.TestCase): src_data = (1+2j, 3+4j, 5+6j, 7+8j, 9+10j) expected_data1 = (1.0, 3.0, 5.0, 7.0, 9.0) expected_data2 = (2.0, 4.0, 6.0, 8.0, 10.0) - src = gr.vector_source_c(src_data) - op = blocks_swig.complex_to_float() - dst1 = gr.vector_sink_f() - dst2 = gr.vector_sink_f() + src = blocks.vector_source_c(src_data) + op = blocks.complex_to_float() + dst1 = blocks.vector_sink_f() + dst2 = blocks.vector_sink_f() self.tb.connect(src, op) self.tb.connect((op, 0), dst1) self.tb.connect((op, 1), dst2) @@ -100,9 +100,9 @@ class test_type_conversions(gr_unittest.TestCase): def test_complex_to_real(self): src_data = (1+2j, 3+4j, 5+6j, 7+8j, 9+10j) expected_data = (1.0, 3.0, 5.0, 7.0, 9.0) - src = gr.vector_source_c(src_data) - op = blocks_swig.complex_to_real() - dst = gr.vector_sink_f() + src = blocks.vector_source_c(src_data) + op = blocks.complex_to_real() + dst = blocks.vector_sink_f() self.tb.connect(src, op, dst) self.tb.run() self.assertFloatTuplesAlmostEqual(expected_data, dst.data()) @@ -110,9 +110,9 @@ class test_type_conversions(gr_unittest.TestCase): def test_complex_to_imag(self): src_data = (1+2j, 3+4j, 5+6j, 7+8j, 9+10j) expected_data = (2.0, 4.0, 6.0, 8.0, 10.0) - src = gr.vector_source_c(src_data) - op = blocks_swig.complex_to_imag() - dst = gr.vector_sink_f() + src = blocks.vector_source_c(src_data) + op = blocks.complex_to_imag() + dst = blocks.vector_sink_f() self.tb.connect(src, op, dst) self.tb.run() self.assertFloatTuplesAlmostEqual(expected_data, dst.data()) @@ -120,9 +120,9 @@ class test_type_conversions(gr_unittest.TestCase): def test_complex_to_mag(self): src_data = (1+2j, 3-4j, 5+6j, 7-8j, -9+10j) expected_data = (sqrt(5), sqrt(25), sqrt(61), sqrt(113), sqrt(181)) - src = gr.vector_source_c(src_data) - op = blocks_swig.complex_to_mag() - dst = gr.vector_sink_f() + src = blocks.vector_source_c(src_data) + op = blocks.complex_to_mag() + dst = blocks.vector_sink_f() self.tb.connect(src, op, dst) self.tb.run() self.assertFloatTuplesAlmostEqual(expected_data, dst.data(), 5) @@ -130,9 +130,9 @@ class test_type_conversions(gr_unittest.TestCase): def test_complex_to_mag_squared(self): src_data = (1+2j, 3-4j, 5+6j, 7-8j, -9+10j) expected_data = (5.0, 25.0, 61.0, 113.0, 181.0) - src = gr.vector_source_c(src_data) - op = blocks_swig.complex_to_mag_squared() - dst = gr.vector_sink_f() + src = blocks.vector_source_c(src_data) + op = blocks.complex_to_mag_squared() + dst = blocks.vector_sink_f() self.tb.connect(src, op, dst) self.tb.run() self.assertFloatTuplesAlmostEqual(expected_data, dst.data()) @@ -140,9 +140,9 @@ class test_type_conversions(gr_unittest.TestCase): def test_complex_to_arg(self): src_data = (1+2j, 3-4j, 5+6j, 7-8j, -9+10j) expected_data = (atan2(2, 1), atan2(-4,3), atan2(6, 5), atan2(-8, 7), atan2(10,-9)) - src = gr.vector_source_c(src_data) - op = blocks_swig.complex_to_arg() - dst = gr.vector_sink_f() + src = blocks.vector_source_c(src_data) + op = blocks.complex_to_arg() + dst = blocks.vector_sink_f() self.tb.connect(src, op, dst) self.tb.run() self.assertFloatTuplesAlmostEqual(expected_data, dst.data(), 2) @@ -150,9 +150,9 @@ class test_type_conversions(gr_unittest.TestCase): def test_float_to_char_identity(self): src_data = (1.0, 2.0, 3.0, 4.0, 5.0) expected_data = (1, 2, 3, 4, 5) - src = gr.vector_source_f(src_data) - op = blocks_swig.float_to_char() - dst = gr.vector_sink_b() + src = blocks.vector_source_f(src_data) + op = blocks.float_to_char() + dst = blocks.vector_sink_b() self.tb.connect(src, op, dst) self.tb.run() self.assertEqual(expected_data, dst.data()) @@ -160,9 +160,9 @@ class test_type_conversions(gr_unittest.TestCase): def test_float_to_char_scale(self): src_data = (1.0, 2.0, 3.0, 4.0, 5.0) expected_data = (5, 10, 15, 20, 25) - src = gr.vector_source_f(src_data) - op = blocks_swig.float_to_char(1, 5) - dst = gr.vector_sink_b() + src = blocks.vector_source_f(src_data) + op = blocks.float_to_char(1, 5) + dst = blocks.vector_sink_b() self.tb.connect(src, op, dst) self.tb.run() self.assertEqual(expected_data, dst.data()) @@ -170,9 +170,9 @@ class test_type_conversions(gr_unittest.TestCase): def test_float_to_complex_1(self): src_data = (1.0, 3.0, 5.0, 7.0, 9.0) expected_data = (1+0j, 3+0j, 5+0j, 7+0j, 9+0j) - src = gr.vector_source_f(src_data) - op = blocks_swig.float_to_complex() - dst = gr.vector_sink_c() + src = blocks.vector_source_f(src_data) + op = blocks.float_to_complex() + dst = blocks.vector_sink_c() self.tb.connect(src, op, dst) self.tb.run() self.assertFloatTuplesAlmostEqual(expected_data, dst.data()) @@ -181,10 +181,10 @@ class test_type_conversions(gr_unittest.TestCase): src1_data = (1.0, 3.0, 5.0, 7.0, 9.0) src2_data = (2.0, 4.0, 6.0, 8.0, 10.0) expected_data = (1+2j, 3+4j, 5+6j, 7+8j, 9+10j) - src1 = gr.vector_source_f(src1_data) - src2 = gr.vector_source_f(src2_data) - op = blocks_swig.float_to_complex() - dst = gr.vector_sink_c() + src1 = blocks.vector_source_f(src1_data) + src2 = blocks.vector_source_f(src2_data) + op = blocks.float_to_complex() + dst = blocks.vector_sink_c() self.tb.connect(src1, (op, 0)) self.tb.connect(src2, (op, 1)) self.tb.connect(op, dst) @@ -194,9 +194,9 @@ class test_type_conversions(gr_unittest.TestCase): def test_float_to_int_identity(self): src_data = (1.0, 2.0, 3.0, 4.0, 5.0) expected_data = (1, 2, 3, 4, 5) - src = gr.vector_source_f(src_data) - op = blocks_swig.float_to_int() - dst = gr.vector_sink_i() + src = blocks.vector_source_f(src_data) + op = blocks.float_to_int() + dst = blocks.vector_sink_i() self.tb.connect(src, op, dst) self.tb.run() self.assertEqual(expected_data, dst.data()) @@ -204,9 +204,9 @@ class test_type_conversions(gr_unittest.TestCase): def test_float_to_int_scale(self): src_data = (1.0, 2.0, 3.0, 4.0, 5.0) expected_data = (5, 10, 15, 20, 25) - src = gr.vector_source_f(src_data) - op = blocks_swig.float_to_int(1, 5) - dst = gr.vector_sink_i() + src = blocks.vector_source_f(src_data) + op = blocks.float_to_int(1, 5) + dst = blocks.vector_sink_i() self.tb.connect(src, op, dst) self.tb.run() self.assertEqual(expected_data, dst.data()) @@ -214,9 +214,9 @@ class test_type_conversions(gr_unittest.TestCase): def test_float_to_short_identity(self): src_data = (1.0, 2.0, 3.0, 4.0, 5.0) expected_data = (1, 2, 3, 4, 5) - src = gr.vector_source_f(src_data) - op = blocks_swig.float_to_short() - dst = gr.vector_sink_s() + src = blocks.vector_source_f(src_data) + op = blocks.float_to_short() + dst = blocks.vector_sink_s() self.tb.connect(src, op, dst) self.tb.run() self.assertEqual(expected_data, dst.data()) @@ -224,9 +224,9 @@ class test_type_conversions(gr_unittest.TestCase): def test_float_to_short_scale(self): src_data = (1.0, 2.0, 3.0, 4.0, 5.0) expected_data = (5, 10, 15, 20, 25) - src = gr.vector_source_f(src_data) - op = blocks_swig.float_to_short(1, 5) - dst = gr.vector_sink_s() + src = blocks.vector_source_f(src_data) + op = blocks.float_to_short(1, 5) + dst = blocks.vector_sink_s() self.tb.connect(src, op, dst) self.tb.run() self.assertEqual(expected_data, dst.data()) @@ -234,9 +234,9 @@ class test_type_conversions(gr_unittest.TestCase): def test_float_to_uchar(self): src_data = (1.0, -2.0, 3.0, -4.0, 256.0) expected_data = (1, 0, 3, 0, 255) - src = gr.vector_source_f(src_data) - op = blocks_swig.float_to_uchar() - dst = gr.vector_sink_b() + src = blocks.vector_source_f(src_data) + op = blocks.float_to_uchar() + dst = blocks.vector_sink_b() self.tb.connect(src, op, dst) self.tb.run() self.assertEqual(expected_data, dst.data()) @@ -244,9 +244,9 @@ class test_type_conversions(gr_unittest.TestCase): def test_int_to_float_identity(self): src_data = (1, 2, 3, 4, 5) expected_data = (1.0, 2.0, 3.0, 4.0, 5.0) - src = gr.vector_source_i(src_data) - op = blocks_swig.int_to_float() - dst = gr.vector_sink_f() + src = blocks.vector_source_i(src_data) + op = blocks.int_to_float() + dst = blocks.vector_sink_f() self.tb.connect(src, op, dst) self.tb.run() self.assertFloatTuplesAlmostEqual(expected_data, dst.data()) @@ -254,9 +254,9 @@ class test_type_conversions(gr_unittest.TestCase): def test_int_to_float_scale(self): src_data = (1, 2, 3, 4, 5) expected_data = (0.2, 0.4, 0.6, 0.8, 1.0) - src = gr.vector_source_i(src_data) - op = blocks_swig.int_to_float(1, 5) - dst = gr.vector_sink_f() + src = blocks.vector_source_i(src_data) + op = blocks.int_to_float(1, 5) + dst = blocks.vector_sink_f() self.tb.connect(src, op, dst) self.tb.run() self.assertFloatTuplesAlmostEqual(expected_data, dst.data()) @@ -264,9 +264,9 @@ class test_type_conversions(gr_unittest.TestCase): def test_interleaved_short_to_complex(self): src_data = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10) expected_data = (1+2j, 3+4j, 5+6j, 7+8j, 9+10j) - src = gr.vector_source_s(src_data) - op = blocks_swig.interleaved_short_to_complex() - dst = gr.vector_sink_c() + src = blocks.vector_source_s(src_data) + op = blocks.interleaved_short_to_complex() + dst = blocks.vector_sink_c() self.tb.connect(src, op, dst) self.tb.run() self.assertEqual(expected_data, dst.data()) @@ -274,9 +274,9 @@ class test_type_conversions(gr_unittest.TestCase): def test_short_to_char(self): src_data = (256, 512, 768, 1024, 1280) expected_data = (1, 2, 3, 4, 5) - src = gr.vector_source_s(src_data) - op = blocks_swig.short_to_char() - dst = gr.vector_sink_b() + src = blocks.vector_source_s(src_data) + op = blocks.short_to_char() + dst = blocks.vector_sink_b() self.tb.connect(src, op, dst) self.tb.run() self.assertEqual(expected_data, dst.data()) @@ -284,9 +284,9 @@ class test_type_conversions(gr_unittest.TestCase): def test_short_to_float_identity(self): src_data = (1, 2, 3, 4, 5) expected_data = (1.0, 2.0, 3.0, 4.0, 5.0) - src = gr.vector_source_s(src_data) - op = blocks_swig.short_to_float() - dst = gr.vector_sink_f() + src = blocks.vector_source_s(src_data) + op = blocks.short_to_float() + dst = blocks.vector_sink_f() self.tb.connect(src, op, dst) self.tb.run() self.assertEqual(expected_data, dst.data()) @@ -294,9 +294,9 @@ class test_type_conversions(gr_unittest.TestCase): def test_short_to_float_scale(self): src_data = (5, 10, 15, 20, 25) expected_data = (1.0, 2.0, 3.0, 4.0, 5.0) - src = gr.vector_source_s(src_data) - op = blocks_swig.short_to_float(1, 5) - dst = gr.vector_sink_f() + src = blocks.vector_source_s(src_data) + op = blocks.short_to_float(1, 5) + dst = blocks.vector_sink_f() self.tb.connect(src, op, dst) self.tb.run() self.assertEqual(expected_data, dst.data()) @@ -304,9 +304,9 @@ class test_type_conversions(gr_unittest.TestCase): def test_uchar_to_float(self): src_data = (1, 2, 3, 4, 5) expected_data = (1.0, 2.0, 3.0, 4.0, 5.0) - src = gr.vector_source_b(src_data) - op = blocks_swig.uchar_to_float() - dst = gr.vector_sink_f() + src = blocks.vector_source_b(src_data) + op = blocks.uchar_to_float() + dst = blocks.vector_sink_f() self.tb.connect(src, op, dst) self.tb.run() self.assertEqual(expected_data, dst.data()) diff --git a/gr-blocks/python/qa_udp_source_sink.py b/gr-blocks/python/qa_udp_source_sink.py index 8c5fa28217..ac8a9d0eb1 100644 --- a/gr-blocks/python/qa_udp_source_sink.py +++ b/gr-blocks/python/qa_udp_source_sink.py @@ -45,7 +45,7 @@ class test_udp_sink_source(gr_unittest.TestCase): n_data = 16 src_data = [x for x in range(n_data)] expected_result = tuple(src_data) - src = gr.vector_source_s(src_data, False) + src = blocks.vector_source_s(src_data, False) udp_snd = blocks.udp_sink(gr.sizeof_short, 'localhost', port) self.tb_snd.connect(src, udp_snd) @@ -62,12 +62,12 @@ class test_udp_sink_source(gr_unittest.TestCase): n_data = 100 src_data = [float(x) for x in range(n_data)] expected_result = tuple(src_data) - src = gr.vector_source_f(src_data, False) + src = blocks.vector_source_f(src_data, False) udp_snd = blocks.udp_sink(gr.sizeof_float, 'localhost', port) self.tb_snd.connect(src, udp_snd) udp_rcv = blocks.udp_source(gr.sizeof_float, 'localhost', port) - dst = gr.vector_sink_f() + dst = blocks.vector_sink_f() self.tb_rcv.connect(udp_rcv, dst) self.tb_rcv.start() @@ -93,8 +93,8 @@ class test_udp_sink_source(gr_unittest.TestCase): n_data = 16 src_data = [float(x) for x in range(n_data)] expected_result = tuple(src_data) - src = gr.vector_source_f(src_data) - dst = gr.vector_sink_f() + src = blocks.vector_source_f(src_data) + dst = blocks.vector_sink_f() self.tb_snd.connect(src, udp_snd) self.tb_rcv.connect(udp_rcv, dst) diff --git a/gr-blocks/python/qa_unpack_k_bits.py b/gr-blocks/python/qa_unpack_k_bits.py index e038d5a03a..dd7024f74c 100755 --- a/gr-blocks/python/qa_unpack_k_bits.py +++ b/gr-blocks/python/qa_unpack_k_bits.py @@ -35,9 +35,9 @@ class test_unpack(gr_unittest.TestCase): def test_001(self): src_data = (1,0,1,1,0,1,1,0) expected_results = (1,0,1,1,0,1,1,0) - src = gr.vector_source_b(src_data,False) + src = blocks.vector_source_b(src_data,False) op = blocks.unpack_k_bits_bb(1) - dst = gr.vector_sink_b() + dst = blocks.vector_sink_b() self.tb.connect(src, op, dst) self.tb.run() self.assertEqual(expected_results, dst.data()) @@ -45,9 +45,9 @@ class test_unpack(gr_unittest.TestCase): def test_002(self): src_data = ( 2, 3, 0, 1) expected_results = (1,0,1,1,0,0,0,1) - src = gr.vector_source_b(src_data,False) + src = blocks.vector_source_b(src_data,False) op = blocks.unpack_k_bits_bb(2) - dst = gr.vector_sink_b() + dst = blocks.vector_sink_b() self.tb.connect(src, op, dst) self.tb.run() self.assertEqual(expected_results, dst.data()) diff --git a/gr-blocks/python/qa_vco.py b/gr-blocks/python/qa_vco.py index 721eb9471b..23ff636d86 100644 --- a/gr-blocks/python/qa_vco.py +++ b/gr-blocks/python/qa_vco.py @@ -21,7 +21,7 @@ # from gnuradio import gr, gr_unittest -import blocks_swig +import blocks_swig as blocks import math def sig_source_f(samp_rate, freq, amp, N): @@ -43,9 +43,9 @@ class test_vco(gr_unittest.TestCase): sig_source_f(1, 0.125, 1, 200) + \ sig_source_f(1, 0.25, 1, 200) - src = gr.vector_source_f(src_data) - op = blocks_swig.vco_f(1, math.pi/2.0, 1) - dst = gr.vector_sink_f() + src = blocks.vector_source_f(src_data) + op = blocks.vco_f(1, math.pi/2.0, 1) + dst = blocks.vector_sink_f() self.tb.connect(src, op, dst) self.tb.run() diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_vector_insert.py b/gr-blocks/python/qa_vector_insert.py index acc06dfded..e3c0d3102f 100755 --- a/gnuradio-core/src/python/gnuradio/gr/qa_vector_insert.py +++ b/gr-blocks/python/qa_vector_insert.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2012 Free Software Foundation, Inc. +# Copyright 2012-2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -21,14 +21,15 @@ # from gnuradio import gr, gr_unittest +import blocks_swig as blocks import math class test_vector_insert(gr_unittest.TestCase): - def setUp (self): - self.tb = gr.top_block () + def setUp(self): + self.tb = gr.top_block() - def tearDown (self): + def tearDown(self): self.tb = None def test_001(self): @@ -38,10 +39,10 @@ class test_vector_insert(gr_unittest.TestCase): period = 9177; offset = 0; - src = gr.null_source(1) - head = gr.head(1, 10000000); - ins = gr.vector_insert_b([1], period, offset); - dst = gr.vector_sink_b() + src = blocks.null_source(1) + head = blocks.head(1, 10000000); + ins = blocks.vector_insert_b([1], period, offset); + dst = blocks.vector_sink_b() self.tb.connect(src, head, ins, dst) self.tb.run() diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_vector_map.py b/gr-blocks/python/qa_vector_map.py index 12f4be5898..54565fe443 100644 --- a/gnuradio-core/src/python/gnuradio/gr/qa_vector_map.py +++ b/gr-blocks/python/qa_vector_map.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2012 Free Software Foundation, Inc. +# Copyright 2012,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -21,14 +21,15 @@ # from gnuradio import gr, gr_unittest +import blocks_swig as blocks import math class test_vector_map(gr_unittest.TestCase): - def setUp (self): + def setUp(self): self.tb = gr.top_block() - def tearDown (self): + def tearDown(self): self.tb = None def test_reversing(self): @@ -40,9 +41,9 @@ class test_vector_map(gr_unittest.TestCase): for j in range(0, N): expected_result.append(1.0*(i-j)) mapping = [list(reversed([(0, i) for i in range(0, N)]))] - src = gr.vector_source_f(src_data, False, N) - vmap = gr.vector_map(gr.sizeof_float, (N, ), mapping) - dst = gr.vector_sink_f(N) + src = blocks.vector_source_f(src_data, False, N) + vmap = blocks.vector_map(gr.sizeof_float, (N, ), mapping) + dst = blocks.vector_sink_f(N) self.tb.connect(src, vmap, dst) self.tb.run() result_data = list(dst.data()) @@ -57,9 +58,9 @@ class test_vector_map(gr_unittest.TestCase): for n in range(0, N): expected_results.append(range(n, M, N)) mapping = [[(0, n)] for n in range(0, N)] - src = gr.vector_source_f(src_data, False, N) - vmap = gr.vector_map(gr.sizeof_float, (N, ), mapping) - dsts = [gr.vector_sink_f(1) for n in range(0, N)] + src = blocks.vector_source_f(src_data, False, N) + vmap = blocks.vector_map(gr.sizeof_float, (N, ), mapping) + dsts = [blocks.vector_sink_f(1) for n in range(0, N)] self.tb.connect(src, vmap) for n in range(0, N): self.tb.connect((vmap, n), dsts[n]) @@ -83,12 +84,12 @@ class test_vector_map(gr_unittest.TestCase): mapping = [[(0, 0), (1, 0)], # mapping to produce D [(0, 0), (1, 0), (2, 1), (2, 0)], # mapping to produce E ] - srcA = gr.vector_source_f(A, False, 1) - srcB = gr.vector_source_f(B, False, 1) - srcC = gr.vector_source_f(C, False, 2) - vmap = gr.vector_map(gr.sizeof_int, (1, 1, 2), mapping) - dstD = gr.vector_sink_f(2) - dstE = gr.vector_sink_f(4) + srcA = blocks.vector_source_f(A, False, 1) + srcB = blocks.vector_source_f(B, False, 1) + srcC = blocks.vector_source_f(C, False, 2) + vmap = blocks.vector_map(gr.sizeof_int, (1, 1, 2), mapping) + dstD = blocks.vector_sink_f(2) + dstE = blocks.vector_sink_f(4) self.tb.connect(srcA, (vmap, 0)) self.tb.connect(srcB, (vmap, 1)) self.tb.connect(srcC, (vmap, 2)) @@ -97,8 +98,6 @@ class test_vector_map(gr_unittest.TestCase): self.tb.run() self.assertEqual(expected_D, dstD.data()) self.assertEqual(expected_E, dstE.data()) - - if __name__ == '__main__': gr_unittest.run(test_vector_map, "test_vector_map.xml") diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_vector_sink_source.py b/gr-blocks/python/qa_vector_sink_source.py index 64cbbe72a3..169e6a4450 100755 --- a/gnuradio-core/src/python/gnuradio/gr/qa_vector_sink_source.py +++ b/gr-blocks/python/qa_vector_sink_source.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2008,2010 Free Software Foundation, Inc. +# Copyright 2008,2010,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -21,22 +21,23 @@ # from gnuradio import gr, gr_unittest +import blocks_swig as blocks import math class test_vector_sink_source(gr_unittest.TestCase): - def setUp (self): - self.tb = gr.top_block () + def setUp(self): + self.tb = gr.top_block() - def tearDown (self): + def tearDown(self): self.tb = None def test_001(self): src_data = [float(x) for x in range(16)] expected_result = tuple(src_data) - src = gr.vector_source_f(src_data) - dst = gr.vector_sink_f() + src = blocks.vector_source_f(src_data) + dst = blocks.vector_sink_f() self.tb.connect(src, dst) self.tb.run() @@ -47,8 +48,8 @@ class test_vector_sink_source(gr_unittest.TestCase): src_data = [float(x) for x in range(16)] expected_result = tuple(src_data) - src = gr.vector_source_f(src_data, False, 2) - dst = gr.vector_sink_f(2) + src = blocks.vector_source_f(src_data, False, 2) + dst = blocks.vector_sink_f(2) self.tb.connect(src, dst) self.tb.run() @@ -58,7 +59,7 @@ class test_vector_sink_source(gr_unittest.TestCase): def test_003(self): src_data = [float(x) for x in range(16)] expected_result = tuple(src_data) - self.assertRaises(ValueError, lambda : gr.vector_source_f(src_data, False, 3)) + self.assertRaises(RuntimeError, lambda : blocks.vector_source_f(src_data, False, 3)) if __name__ == '__main__': gr_unittest.run(test_vector_sink_source, "test_vector_sink_source.xml") diff --git a/gr-blocks/swig/CMakeLists.txt b/gr-blocks/swig/CMakeLists.txt index 84ab5b660f..1e4213fdc2 100644 --- a/gr-blocks/swig/CMakeLists.txt +++ b/gr-blocks/swig/CMakeLists.txt @@ -31,6 +31,10 @@ set(GR_SWIG_INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ) +if(ENABLE_GR_CTRLPORT) + SET(GR_SWIG_FLAGS "-DGR_CTRLPORT") +endif(ENABLE_GR_CTRLPORT) + set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/blocks_swig_doc.i) set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../lib) set(GR_SWIG_TARGET_DEPS blocks_generated_includes) diff --git a/gr-blocks/swig/blocks_swig.i b/gr-blocks/swig/blocks_swig.i index 5245721b68..51861de8be 100644 --- a/gr-blocks/swig/blocks_swig.i +++ b/gr-blocks/swig/blocks_swig.i @@ -30,6 +30,9 @@ %include <gr_endianness.h> +%template() std::vector<size_t>; +%template() std::vector< std::vector< std::vector<size_t> > >; + %{ #include "blocks/add_ff.h" #include "blocks/add_ss.h" @@ -67,12 +70,14 @@ #include "blocks/complex_to_arg.h" #include "blocks/conjugate_cc.h" #include "blocks/control_loop.h" +#include "blocks/copy.h" #include "blocks/deinterleave.h" #include "blocks/delay.h" #include "blocks/divide_ff.h" #include "blocks/divide_ss.h" #include "blocks/divide_ii.h" #include "blocks/divide_cc.h" +#include "blocks/endian_swap.h" #include "blocks/file_descriptor_sink.h" #include "blocks/file_descriptor_source.h" #include "blocks/file_sink_base.h" @@ -85,6 +90,7 @@ #include "blocks/float_to_int.h" #include "blocks/float_to_short.h" #include "blocks/float_to_uchar.h" +#include "blocks/head.h" #include "blocks/int_to_float.h" #include "blocks/integrate_ss.h" #include "blocks/integrate_ii.h" @@ -124,9 +130,12 @@ #include "blocks/mute_ff.h" #include "blocks/mute_cc.h" #include "blocks/nlog10_ff.h" +#include "blocks/nop.h" #include "blocks/not_bb.h" #include "blocks/not_ss.h" #include "blocks/not_ii.h" +#include "blocks/null_sink.h" +#include "blocks/null_source.h" #include "blocks/patterned_interleaver.h" #include "blocks/pack_k_bits_bb.h" #include "blocks/packed_to_unpacked_bb.h" @@ -163,6 +172,7 @@ #include "blocks/sample_and_hold_ff.h" #include "blocks/short_to_char.h" #include "blocks/short_to_float.h" +#include "blocks/skiphead.h" #include "blocks/socket_pdu.h" #include "blocks/stream_mux.h" #include "blocks/stream_to_streams.h" @@ -190,8 +200,24 @@ #include "blocks/unpacked_to_packed_ss.h" #include "blocks/unpacked_to_packed_ii.h" #include "blocks/vco_f.h" +#include "blocks/vector_map.h" #include "blocks/vector_to_stream.h" #include "blocks/vector_to_streams.h" +#include "blocks/vector_insert_b.h" +#include "blocks/vector_insert_s.h" +#include "blocks/vector_insert_i.h" +#include "blocks/vector_insert_f.h" +#include "blocks/vector_insert_c.h" +#include "blocks/vector_sink_b.h" +#include "blocks/vector_sink_s.h" +#include "blocks/vector_sink_i.h" +#include "blocks/vector_sink_f.h" +#include "blocks/vector_sink_c.h" +#include "blocks/vector_source_b.h" +#include "blocks/vector_source_s.h" +#include "blocks/vector_source_i.h" +#include "blocks/vector_source_f.h" +#include "blocks/vector_source_c.h" #include "blocks/wavfile_sink.h" #include "blocks/wavfile_source.h" #include "blocks/xor_bb.h" @@ -235,6 +261,7 @@ %include "blocks/complex_to_arg.h" %include "blocks/conjugate_cc.h" %include "blocks/control_loop.h" +%include "blocks/copy.h" %include "blocks/deinterleave.h" %include "blocks/delay.h" %include "blocks/file_descriptor_sink.h" @@ -248,11 +275,13 @@ %include "blocks/divide_ss.h" %include "blocks/divide_ii.h" %include "blocks/divide_cc.h" +%include "blocks/endian_swap.h" %include "blocks/float_to_char.h" %include "blocks/float_to_complex.h" %include "blocks/float_to_int.h" %include "blocks/float_to_short.h" %include "blocks/float_to_uchar.h" +%include "blocks/head.h" %include "blocks/int_to_float.h" %include "blocks/integrate_ss.h" %include "blocks/integrate_ii.h" @@ -292,9 +321,12 @@ %include "blocks/mute_ff.h" %include "blocks/mute_cc.h" %include "blocks/nlog10_ff.h" +%include "blocks/nop.h" %include "blocks/not_bb.h" %include "blocks/not_ss.h" %include "blocks/not_ii.h" +%include "blocks/null_sink.h" +%include "blocks/null_source.h" %include "blocks/probe_signal_b.h" %include "blocks/probe_signal_s.h" %include "blocks/probe_signal_i.h" @@ -332,6 +364,7 @@ %include "blocks/sample_and_hold_ff.h" %include "blocks/short_to_char.h" %include "blocks/short_to_float.h" +%include "blocks/skiphead.h" %include "blocks/socket_pdu.h" %include "blocks/stream_mux.h" %include "blocks/stream_to_streams.h" @@ -358,8 +391,24 @@ %include "blocks/unpacked_to_packed_ss.h" %include "blocks/unpacked_to_packed_ii.h" %include "blocks/vco_f.h" +%include "blocks/vector_map.h" %include "blocks/vector_to_stream.h" %include "blocks/vector_to_streams.h" +%include "blocks/vector_insert_b.h" +%include "blocks/vector_insert_s.h" +%include "blocks/vector_insert_i.h" +%include "blocks/vector_insert_f.h" +%include "blocks/vector_insert_c.h" +%include "blocks/vector_sink_b.h" +%include "blocks/vector_sink_s.h" +%include "blocks/vector_sink_i.h" +%include "blocks/vector_sink_f.h" +%include "blocks/vector_sink_c.h" +%include "blocks/vector_source_b.h" +%include "blocks/vector_source_s.h" +%include "blocks/vector_source_i.h" +%include "blocks/vector_source_f.h" +%include "blocks/vector_source_c.h" %include "blocks/wavfile_sink.h" %include "blocks/wavfile_source.h" %include "blocks/xor_bb.h" @@ -401,8 +450,10 @@ GR_SWIG_BLOCK_MAGIC2(blocks, complex_to_mag); GR_SWIG_BLOCK_MAGIC2(blocks, complex_to_mag_squared); GR_SWIG_BLOCK_MAGIC2(blocks, complex_to_arg); GR_SWIG_BLOCK_MAGIC2(blocks, conjugate_cc); +GR_SWIG_BLOCK_MAGIC2(blocks, copy); GR_SWIG_BLOCK_MAGIC2(blocks, deinterleave); GR_SWIG_BLOCK_MAGIC2(blocks, delay); +GR_SWIG_BLOCK_MAGIC2(blocks, endian_swap); GR_SWIG_BLOCK_MAGIC2(blocks, divide_ff); GR_SWIG_BLOCK_MAGIC2(blocks, divide_ss); GR_SWIG_BLOCK_MAGIC2(blocks, divide_ii); @@ -418,6 +469,7 @@ GR_SWIG_BLOCK_MAGIC2(blocks, float_to_complex); GR_SWIG_BLOCK_MAGIC2(blocks, float_to_int); GR_SWIG_BLOCK_MAGIC2(blocks, float_to_short); GR_SWIG_BLOCK_MAGIC2(blocks, float_to_uchar); +GR_SWIG_BLOCK_MAGIC2(blocks, head); GR_SWIG_BLOCK_MAGIC2(blocks, int_to_float); GR_SWIG_BLOCK_MAGIC2(blocks, integrate_ss); GR_SWIG_BLOCK_MAGIC2(blocks, integrate_ii); @@ -457,9 +509,12 @@ GR_SWIG_BLOCK_MAGIC2(blocks, mute_ii); GR_SWIG_BLOCK_MAGIC2(blocks, mute_ff); GR_SWIG_BLOCK_MAGIC2(blocks, mute_cc); GR_SWIG_BLOCK_MAGIC2(blocks, nlog10_ff); +GR_SWIG_BLOCK_MAGIC2(blocks, nop); GR_SWIG_BLOCK_MAGIC2(blocks, not_bb); GR_SWIG_BLOCK_MAGIC2(blocks, not_ss); GR_SWIG_BLOCK_MAGIC2(blocks, not_ii); +GR_SWIG_BLOCK_MAGIC2(blocks, null_sink); +GR_SWIG_BLOCK_MAGIC2(blocks, null_source); GR_SWIG_BLOCK_MAGIC2(blocks, patterned_interleaver); GR_SWIG_BLOCK_MAGIC2(blocks, pack_k_bits_bb); GR_SWIG_BLOCK_MAGIC2(blocks, packed_to_unpacked_bb); @@ -496,6 +551,7 @@ GR_SWIG_BLOCK_MAGIC2(blocks, sample_and_hold_ii); GR_SWIG_BLOCK_MAGIC2(blocks, sample_and_hold_ff); GR_SWIG_BLOCK_MAGIC2(blocks, short_to_char); GR_SWIG_BLOCK_MAGIC2(blocks, short_to_float); +GR_SWIG_BLOCK_MAGIC2(blocks, skiphead); GR_SWIG_BLOCK_MAGIC2(blocks, socket_pdu); GR_SWIG_BLOCK_MAGIC2(blocks, stream_mux); GR_SWIG_BLOCK_MAGIC2(blocks, stream_to_streams); @@ -523,10 +579,42 @@ GR_SWIG_BLOCK_MAGIC2(blocks, unpacked_to_packed_bb); GR_SWIG_BLOCK_MAGIC2(blocks, unpacked_to_packed_ss); GR_SWIG_BLOCK_MAGIC2(blocks, unpacked_to_packed_ii); GR_SWIG_BLOCK_MAGIC2(blocks, vco_f); +GR_SWIG_BLOCK_MAGIC2(blocks, vector_map); GR_SWIG_BLOCK_MAGIC2(blocks, vector_to_stream); GR_SWIG_BLOCK_MAGIC2(blocks, vector_to_streams); +GR_SWIG_BLOCK_MAGIC2(blocks, vector_insert_b); +GR_SWIG_BLOCK_MAGIC2(blocks, vector_insert_s); +GR_SWIG_BLOCK_MAGIC2(blocks, vector_insert_i); +GR_SWIG_BLOCK_MAGIC2(blocks, vector_insert_f); +GR_SWIG_BLOCK_MAGIC2(blocks, vector_insert_c); +GR_SWIG_BLOCK_MAGIC2(blocks, vector_sink_b); +GR_SWIG_BLOCK_MAGIC2(blocks, vector_sink_s); +GR_SWIG_BLOCK_MAGIC2(blocks, vector_sink_i); +GR_SWIG_BLOCK_MAGIC2(blocks, vector_sink_f); +GR_SWIG_BLOCK_MAGIC2(blocks, vector_sink_c); +GR_SWIG_BLOCK_MAGIC2(blocks, vector_source_b); +GR_SWIG_BLOCK_MAGIC2(blocks, vector_source_s); +GR_SWIG_BLOCK_MAGIC2(blocks, vector_source_i); +GR_SWIG_BLOCK_MAGIC2(blocks, vector_source_f); +GR_SWIG_BLOCK_MAGIC2(blocks, vector_source_c); GR_SWIG_BLOCK_MAGIC2(blocks, wavfile_sink); GR_SWIG_BLOCK_MAGIC2(blocks, wavfile_source); GR_SWIG_BLOCK_MAGIC2(blocks, xor_bb); GR_SWIG_BLOCK_MAGIC2(blocks, xor_ss); GR_SWIG_BLOCK_MAGIC2(blocks, xor_ii); + + +#ifdef GR_CTRLPORT + +%{ +#include "blocks/ctrlport_probe_c.h" +#include "blocks/ctrlport_probe2_c.h" +%} + +%include "blocks/ctrlport_probe_c.h" +%include "blocks/ctrlport_probe2_c.h" + +GR_SWIG_BLOCK_MAGIC2(blocks, ctrlport_probe_c); +GR_SWIG_BLOCK_MAGIC2(blocks, ctrlport_probe2_c); + +#endif /* GR_CTRLPORT */ diff --git a/gr-channels/python/CMakeLists.txt b/gr-channels/python/CMakeLists.txt index ee58d5b164..92fe0ef220 100644 --- a/gr-channels/python/CMakeLists.txt +++ b/gr-channels/python/CMakeLists.txt @@ -37,6 +37,8 @@ list(APPEND GR_TEST_PYTHON_DIRS ${CMAKE_BINARY_DIR}/gr-channels/swig ${CMAKE_BINARY_DIR}/gr-analog/python ${CMAKE_BINARY_DIR}/gr-analog/swig + ${CMAKE_BINARY_DIR}/gr-blocks/python + ${CMAKE_BINARY_DIR}/gr-blocks/swig ) list(APPEND GR_TEST_TARGET_DEPS gnuradio-channels gnuradio-analog gnuradio-blocks) diff --git a/gr-channels/python/qa_channel_model.py b/gr-channels/python/qa_channel_model.py index 0a99477097..473650f1d7 100755 --- a/gr-channels/python/qa_channel_model.py +++ b/gr-channels/python/qa_channel_model.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2012 Free Software Foundation, Inc. +# Copyright 2012,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -22,6 +22,7 @@ from gnuradio import gr, gr_unittest import analog_swig as analog +import blocks_swig as blocks import channels_swig as channels import math @@ -39,10 +40,10 @@ class test_channel_model(gr_unittest.TestCase): freq = 100 signal = analog.sig_source_c(fs, analog.GR_SIN_WAVE, freq, 1) - head = gr.head(gr.sizeof_gr_complex, N) + head = blocks.head(gr.sizeof_gr_complex, N) op = channels.channel_model(0.0, 0.0, 1.0, [1,], 0) - snk = gr.vector_sink_c() - snk1 = gr.vector_sink_c() + snk = blocks.vector_sink_c() + snk1 = blocks.vector_sink_c() op.set_noise_voltage(0.0) op.set_frequency_offset(0.0) diff --git a/gr-channels/python/qa_fading_model.py b/gr-channels/python/qa_fading_model.py index e8a066ccb5..5ad378075a 100644 --- a/gr-channels/python/qa_fading_model.py +++ b/gr-channels/python/qa_fading_model.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2012 Free Software Foundation, Inc. +# Copyright 2012,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -22,6 +22,7 @@ from gnuradio import gr, gr_unittest import analog_swig as analog +import blocks_swig as blocks import channels_swig as channels import math @@ -41,11 +42,11 @@ class test_fading_model(gr_unittest.TestCase): fDTs = 0.01 K = 4 signal = analog.sig_source_c(fs, analog.GR_SIN_WAVE, freq, 1) - head = gr.head(gr.sizeof_gr_complex, N) + head = blocks.head(gr.sizeof_gr_complex, N) op = channels.fading_model(8, fDTs=fDTs, LOS=True, K=K, seed=0) - snk = gr.vector_sink_c() - snk1 = gr.vector_sink_c() + snk = blocks.vector_sink_c() + snk1 = blocks.vector_sink_c() self.assertAlmostEqual(K, op.K(), 4) self.assertAlmostEqual(fDTs, op.fDTs(), 4) diff --git a/gr-digital/examples/berawgn.py b/gr-digital/examples/berawgn.py index 6f9679d555..7fd1a2337d 100755 --- a/gr-digital/examples/berawgn.py +++ b/gr-digital/examples/berawgn.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2012 Free Software Foundation, Inc. +# Copyright 2012,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -91,7 +91,7 @@ class BERAWGNSimu(gr.top_block): self.const = digital.qpsk_constellation() # Source is N_BITS bits, non-repeated data = map(int, numpy.random.randint(0, self.const.arity(), N_BITS/self.const.bits_per_symbol())) - src = gr.vector_source_b(data, False) + src = blocks.vector_source_b(data, False) mod = digital.chunks_to_symbols_bc((self.const.points()), 1) add = blocks.add_vcc() noise = analog.noise_source_c(analog.GR_GAUSSIAN, @@ -99,7 +99,7 @@ class BERAWGNSimu(gr.top_block): RAND_SEED) demod = digital.constellation_decoder_cb(self.const.base()) ber = BitErrors(self.const.bits_per_symbol()) - self.sink = gr.vector_sink_f() + self.sink = blocks.vector_sink_f() self.connect(src, mod, add, demod, ber, self.sink) self.connect(noise, (add, 1)) self.connect(src, (ber, 1)) diff --git a/gr-digital/examples/example_costas.py b/gr-digital/examples/example_costas.py index 726e0756d8..ec33727799 100755 --- a/gr-digital/examples/example_costas.py +++ b/gr-digital/examples/example_costas.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2011,2012 Free Software Foundation, Inc. +# Copyright 2011-2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -21,6 +21,7 @@ # from gnuradio import gr, digital, filter +from gnuradio import blocks from gnuradio import eng_notation from gnuradio.eng_option import eng_option from optparse import OptionParser @@ -47,14 +48,14 @@ class example_costas(gr.top_block): data = 2.0*scipy.random.randint(0, 2, N) - 1.0 data = scipy.exp(1j*poffset) * data - self.src = gr.vector_source_c(data.tolist(), False) + self.src = blocks.vector_source_c(data.tolist(), False) self.rrc = filter.interp_fir_filter_ccf(sps, rrc_taps) self.chn = filter.channel_model(noise, foffset, toffset) self.cst = digital.costas_loop_cc(bw, 2) - self.vsnk_src = gr.vector_sink_c() - self.vsnk_cst = gr.vector_sink_c() - self.vsnk_frq = gr.vector_sink_f() + self.vsnk_src = blocks.vector_sink_c() + self.vsnk_cst = blocks.vector_sink_c() + self.vsnk_frq = blocks.vector_sink_f() self.connect(self.src, self.rrc, self.chn, self.cst, self.vsnk_cst) self.connect(self.rrc, self.vsnk_src) diff --git a/gr-digital/examples/example_fll.py b/gr-digital/examples/example_fll.py index ef6e1b1658..8d52ec4be6 100755 --- a/gr-digital/examples/example_fll.py +++ b/gr-digital/examples/example_fll.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2011,2012 Free Software Foundation, Inc. +# Copyright 2011-2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -21,6 +21,7 @@ # from gnuradio import gr, digital, filter +from gnuradio import blocks from gnuradio import eng_notation from gnuradio.eng_option import eng_option from optparse import OptionParser @@ -47,16 +48,16 @@ class example_fll(gr.top_block): data = 2.0*scipy.random.randint(0, 2, N) - 1.0 data = scipy.exp(1j*poffset) * data - self.src = gr.vector_source_c(data.tolist(), False) + self.src = blocks.vector_source_c(data.tolist(), False) self.rrc = filter.interp_fir_filter_ccf(sps, rrc_taps) self.chn = filter.channel_model(noise, foffset, toffset) self.fll = digital.fll_band_edge_cc(sps, rolloff, ntaps, bw) - self.vsnk_src = gr.vector_sink_c() - self.vsnk_fll = gr.vector_sink_c() - self.vsnk_frq = gr.vector_sink_f() - self.vsnk_phs = gr.vector_sink_f() - self.vsnk_err = gr.vector_sink_f() + self.vsnk_src = blocks.vector_sink_c() + self.vsnk_fll = blocks.vector_sink_c() + self.vsnk_frq = blocks.vector_sink_f() + self.vsnk_phs = blocks.vector_sink_f() + self.vsnk_err = blocks.vector_sink_f() self.connect(self.src, self.rrc, self.chn, self.fll, self.vsnk_fll) self.connect(self.rrc, self.vsnk_src) diff --git a/gr-digital/examples/example_timing.py b/gr-digital/examples/example_timing.py index d51aebb31d..5f5b458497 100755 --- a/gr-digital/examples/example_timing.py +++ b/gr-digital/examples/example_timing.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2011,2012 Free Software Foundation, Inc. +# Copyright 2011-2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -21,6 +21,7 @@ # from gnuradio import gr, digital, filter +from gnuradio import blocks from gnuradio import eng_notation from gnuradio.eng_option import eng_option from optparse import OptionParser @@ -55,7 +56,7 @@ class example_timing(gr.top_block): data = 2.0*scipy.random.randint(0, 2, N) - 1.0 data = scipy.exp(1j*poffset) * data - self.src = gr.vector_source_c(data.tolist(), False) + self.src = blocks.vector_source_c(data.tolist(), False) self.rrc = filter.interp_fir_filter_ccf(sps, rrc_taps) self.chn = filter.channel_model(noise, foffset, toffset) self.off = filter.fractional_interpolator_cc(0.20, 1.0) @@ -66,9 +67,9 @@ class example_timing(gr.top_block): self.taps = self.clk.taps() self.dtaps = self.clk.diff_taps() - self.vsnk_err = gr.vector_sink_f() - self.vsnk_rat = gr.vector_sink_f() - self.vsnk_phs = gr.vector_sink_f() + self.vsnk_err = blocks.vector_sink_f() + self.vsnk_rat = blocks.vector_sink_f() + self.vsnk_phs = blocks.vector_sink_f() self.connect((self.clk,1), self.vsnk_err) self.connect((self.clk,2), self.vsnk_rat) @@ -83,12 +84,12 @@ class example_timing(gr.top_block): mu, gain_mu, omega_rel_lim) - self.vsnk_err = gr.vector_sink_f() + self.vsnk_err = blocks.vector_sink_f() self.connect((self.clk,1), self.vsnk_err) - self.vsnk_src = gr.vector_sink_c() - self.vsnk_clk = gr.vector_sink_c() + self.vsnk_src = blocks.vector_sink_c() + self.vsnk_clk = blocks.vector_sink_c() self.connect(self.src, self.rrc, self.chn, self.off, self.clk, self.vsnk_clk) self.connect(self.off, self.vsnk_src) diff --git a/gr-digital/examples/gen_whitener.py b/gr-digital/examples/gen_whitener.py index 0b1591c3ab..0e8a97bf2b 100755 --- a/gr-digital/examples/gen_whitener.py +++ b/gr-digital/examples/gen_whitener.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2011 Free Software Foundation, Inc. +# Copyright 2011,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -21,6 +21,7 @@ # from gnuradio import gr, gru +from gnuradio import blocks from gnuradio.eng_option import eng_option from optparse import OptionParser import sys @@ -37,8 +38,8 @@ class my_graph(gr.top_block): raise SystemExit, 1 src = gr.lfsr_32k_source_s() - head = gr.head(gr.sizeof_short, 2048) - self.dst = gr.vector_sink_s() + head = blocks.head(gr.sizeof_short, 2048) + self.dst = blocks.vector_sink_s() self.connect(src, head, self.dst) if __name__ == '__main__': diff --git a/gr-digital/examples/narrowband/benchmark_rx.py b/gr-digital/examples/narrowband/benchmark_rx.py index ce47bf87b8..622773aac5 100755 --- a/gr-digital/examples/narrowband/benchmark_rx.py +++ b/gr-digital/examples/narrowband/benchmark_rx.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2010,2011 Free Software Foundation, Inc. +# Copyright 2010,2011,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -61,7 +61,7 @@ class my_top_block(gr.top_block): self.source = blocks.file_source(gr.sizeof_gr_complex, options.from_file) else: sys.stderr.write("No source defined, pulling samples from null source.\n\n") - self.source = gr.null_source(gr.sizeof_gr_complex) + self.source = blocks.null_source(gr.sizeof_gr_complex) # Set up receive path # do this after for any adjustments to the options that may diff --git a/gr-digital/examples/narrowband/benchmark_tx.py b/gr-digital/examples/narrowband/benchmark_tx.py index 593abb3cae..11ad7ea26e 100755 --- a/gr-digital/examples/narrowband/benchmark_tx.py +++ b/gr-digital/examples/narrowband/benchmark_tx.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2010,2011 Free Software Foundation, Inc. +# Copyright 2010,2011,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -60,7 +60,7 @@ class my_top_block(gr.top_block): self.sink = blocks.file_sink(gr.sizeof_gr_complex, options.to_file) else: sys.stderr.write("No sink defined, dumping samples to null sink.\n\n") - self.sink = gr.null_sink(gr.sizeof_gr_complex) + self.sink = blocks.null_sink(gr.sizeof_gr_complex) # do this after for any adjustments to the options that may # occur in the sinks (specifically the UHD sink) diff --git a/gr-digital/examples/narrowband/digital_bert_rx.py b/gr-digital/examples/narrowband/digital_bert_rx.py index cf42742736..c04c76762f 100755 --- a/gr-digital/examples/narrowband/digital_bert_rx.py +++ b/gr-digital/examples/narrowband/digital_bert_rx.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2008,2011 Free Software Foundation, Inc. +# Copyright 2008,2011,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -127,7 +127,7 @@ class rx_psk_block(gr.top_block): elif(options.from_file is not None): self._source = blocks.file_source(gr.sizeof_gr_complex, options.from_file) else: - self._source = gr.null_source(gr.sizeof_gr_complex) + self._source = blocks.null_source(gr.sizeof_gr_complex) # Create the BERT receiver self._receiver = bert_receiver(options.bitrate, diff --git a/gr-digital/examples/narrowband/digital_bert_tx.py b/gr-digital/examples/narrowband/digital_bert_tx.py index 2a99137704..6859d2e7af 100755 --- a/gr-digital/examples/narrowband/digital_bert_tx.py +++ b/gr-digital/examples/narrowband/digital_bert_tx.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2008,2011 Free Software Foundation, Inc. +# Copyright 2008,2011,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -43,7 +43,7 @@ class bert_transmit(gr.hier_block2): gr.io_signature(1, 1, gr.sizeof_gr_complex)) # Input signature # Create BERT data bit stream - self._bits = gr.vector_source_b([1,], True) # Infinite stream of ones + self._bits = blocks.vector_source_b([1,], True) # Infinite stream of ones self._scrambler = digital.scrambler_bb(0x8A, 0x7F, 7) # CCSDS 7-bit scrambler self._mod = digital.generic_mod(constellation, differential, @@ -80,7 +80,7 @@ class tx_psk_block(gr.top_block): elif(options.to_file is not None): self._sink = blocks.file_sink(gr.sizeof_gr_complex, options.to_file) else: - self._sink = gr.null_sink(gr.sizeof_gr_complex) + self._sink = blocks.null_sink(gr.sizeof_gr_complex) self._transmitter = bert_transmit(self._modulator._constellation, diff --git a/gr-digital/examples/narrowband/rx_voice.py b/gr-digital/examples/narrowband/rx_voice.py index b2b4174cc4..8a0e9844be 100755 --- a/gr-digital/examples/narrowband/rx_voice.py +++ b/gr-digital/examples/narrowband/rx_voice.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2005,2006,2009,2011 Free Software Foundation, Inc. +# Copyright 2005,2006,2009,2011,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -89,7 +89,7 @@ class my_top_block(gr.top_block): else: self.thr = blocks.throttle(gr.sizeof_gr_complex, 1e6) - self.source = gr.null_source(gr.sizeof_gr_complex) + self.source = blocks.null_source(gr.sizeof_gr_complex) self.connect(self.source, self.thr, self.rxpath) self.connect(self.audio_tx) diff --git a/gr-digital/examples/narrowband/tx_voice.py b/gr-digital/examples/narrowband/tx_voice.py index d3df9d788f..afdb4406e6 100755 --- a/gr-digital/examples/narrowband/tx_voice.py +++ b/gr-digital/examples/narrowband/tx_voice.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2005-2007,2009,2011 Free Software Foundation, Inc. +# Copyright 2005-2007,2009,2011,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -83,7 +83,7 @@ class my_top_block(gr.top_block): self.sink = blocks.file_sink(gr.sizeof_gr_complex, options.to_file) rrate = 1 else: - self.sink = gr.null_sink(gr.sizeof_gr_complex) + self.sink = blocks.null_sink(gr.sizeof_gr_complex) rrate = 1 self.resampler = filter.pfb.arb_resampler_ccf(rrate) diff --git a/gr-digital/examples/ofdm/benchmark_rx.py b/gr-digital/examples/ofdm/benchmark_rx.py index 740e0aed0e..dbcd866ad2 100755 --- a/gr-digital/examples/ofdm/benchmark_rx.py +++ b/gr-digital/examples/ofdm/benchmark_rx.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2006,2007,2011 Free Software Foundation, Inc. +# Copyright 2006,2007,2011,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -47,7 +47,7 @@ class my_top_block(gr.top_block): elif(options.from_file is not None): self.source = blocks.file_source(gr.sizeof_gr_complex, options.from_file) else: - self.source = gr.null_source(gr.sizeof_gr_complex) + self.source = blocks.null_source(gr.sizeof_gr_complex) # Set up receive path # do this after for any adjustments to the options that may diff --git a/gr-digital/examples/ofdm/benchmark_tx.py b/gr-digital/examples/ofdm/benchmark_tx.py index 44b127e0cc..2942178ccf 100755 --- a/gr-digital/examples/ofdm/benchmark_tx.py +++ b/gr-digital/examples/ofdm/benchmark_tx.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2005,2006,2011 Free Software Foundation, Inc. +# Copyright 2005,2006,2011,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -46,7 +46,7 @@ class my_top_block(gr.top_block): elif(options.to_file is not None): self.sink = blocks.file_sink(gr.sizeof_gr_complex, options.to_file) else: - self.sink = gr.null_sink(gr.sizeof_gr_complex) + self.sink = blocks.null_sink(gr.sizeof_gr_complex) # do this after for any adjustments to the options that may # occur in the sinks (specifically the UHD sink) diff --git a/gr-digital/examples/ofdm/ofdm_bugsquatch.py b/gr-digital/examples/ofdm/ofdm_bugsquatch.py index 3b900fb46b..25c062a772 100644 --- a/gr-digital/examples/ofdm/ofdm_bugsquatch.py +++ b/gr-digital/examples/ofdm/ofdm_bugsquatch.py @@ -1,6 +1,6 @@ #!/usr/bin/env python -from gnuradio import gr, digital +from gnuradio import gr, digital, blocks from gnuradio.digital.utils import tagged_streams import random @@ -9,12 +9,12 @@ if __name__ == '__main__': fft_len = 64 cp_len = 16 length_tag_name = "length" - src = gr.vector_source_c( + src = blocks.vector_source_c( [random.randint(0, 1)*2-1 for i in range(10*fft_len)], True, fft_len, tagged_streams.make_lengthtags((10,), (0,), length_tag_name)) cyclic_prefixer = digital.ofdm_cyclic_prefixer( fft_len, fft_len+cp_len, 0, length_tag_name) - sink = gr.null_sink(gr.sizeof_gr_complex) + sink = blocks.null_sink(gr.sizeof_gr_complex) checker = digital.tagged_stream_check(gr.sizeof_gr_complex*fft_len, length_tag_name) checker2 = digital.tagged_stream_check(gr.sizeof_gr_complex*fft_len, length_tag_name) tb.connect(src, checker, cyclic_prefixer, sink) diff --git a/gr-digital/examples/ofdm/rx_ofdm.grc b/gr-digital/examples/ofdm/rx_ofdm.grc index 1541e8dedf..47e165508c 100644 --- a/gr-digital/examples/ofdm/rx_ofdm.grc +++ b/gr-digital/examples/ofdm/rx_ofdm.grc @@ -689,10 +689,10 @@ </param> </block> <block> - <key>gr_null_sink</key> + <key>blocks_null_sink</key> <param> <key>id</key> - <value>gr_null_sink_0</value> + <value>blocks_null_sink_0</value> </param> <param> <key>_enabled</key> @@ -1067,7 +1067,7 @@ </connection> <connection> <source_block_id>digital_constellation_decoder_cb_0</source_block_id> - <sink_block_id>gr_null_sink_0</sink_block_id> + <sink_block_id>blocks_null_sink_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> diff --git a/gr-digital/examples/ofdm/tx_ofdm.grc b/gr-digital/examples/ofdm/tx_ofdm.grc index 6c4f9797d1..a2deb05f9f 100644 --- a/gr-digital/examples/ofdm/tx_ofdm.grc +++ b/gr-digital/examples/ofdm/tx_ofdm.grc @@ -414,10 +414,10 @@ </param> </block> <block> - <key>gr_vector_source_x</key> + <key>blocks_vector_source_x</key> <param> <key>id</key> - <value>gr_vector_source_x_1</value> + <value>blocks_vector_source_x_1</value> </param> <param> <key>_enabled</key> @@ -709,7 +709,7 @@ </param> </block> <block> - <key>gr_vector_source_x</key> + <key>blocks_vector_source_x</key> <param> <key>id</key> <value>sync_word_source</value> @@ -952,10 +952,10 @@ </param> </block> <block> - <key>gr_null_sink</key> + <key>blocks_null_sink</key> <param> <key>id</key> - <value>gr_null_sink_0</value> + <value>blocks_null_sink_0</value> </param> <param> <key>_enabled</key> @@ -1045,7 +1045,7 @@ </param> </block> <connection> - <source_block_id>gr_vector_source_x_1</source_block_id> + <source_block_id>blocks_vector_source_x_1</source_block_id> <sink_block_id>blocks_throttle_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> @@ -1130,7 +1130,7 @@ </connection> <connection> <source_block_id>digital_ofdm_cyclic_prefixer_0</source_block_id> - <sink_block_id>gr_null_sink_0</sink_block_id> + <sink_block_id>blocks_null_sink_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> diff --git a/gr-digital/examples/snr_estimators.py b/gr-digital/examples/snr_estimators.py index e310ec2937..73ae538865 100755 --- a/gr-digital/examples/snr_estimators.py +++ b/gr-digital/examples/snr_estimators.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2011,2012 Free Software Foundation, Inc. +# Copyright 2011-2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -36,6 +36,7 @@ except ImportError: sys.exit(1) from gnuradio import gr, digital, filter +from gnuradio import blocks from optparse import OptionParser from gnuradio.eng_option import eng_option @@ -165,10 +166,10 @@ def main(): snrdB, snr = py_est(yy) snr_python.append(snrdB) - gr_src = gr.vector_source_c(bits.tolist(), False) + gr_src = blocks.vector_source_c(bits.tolist(), False) gr_snr = digital.mpsk_snr_est_cc(gr_est, ntag, 0.001) gr_chn = filter.channel_model(1.0/scale) - gr_snk = gr.null_sink(gr.sizeof_gr_complex) + gr_snk = blocks.null_sink(gr.sizeof_gr_complex) tb = gr.top_block() tb.connect(gr_src, gr_chn, gr_snr, gr_snk) tb.run() diff --git a/gr-digital/python/digital_voice.py.real b/gr-digital/python/digital_voice.py.real index 4a2ef7721f..241a4a3dc2 100644 --- a/gr-digital/python/digital_voice.py.real +++ b/gr-digital/python/digital_voice.py.real @@ -23,8 +23,7 @@ """ Digital voice Tx and Rx using GSM 13kbit vocoder and GMSK. -Runs channel at 32kbit/sec. Currently uses fake channel coding, -but there's room for a rate 1/2 coder. +Runs channel at 32kbit/sec. """ from gnuradio import gr, gru @@ -66,7 +65,7 @@ class digital_voice_tx(gr.hier_block): f2s = blocks.float_to_short() voice_coder = gsm_full_rate.encode_sp() - channel_coder = gr.fake_channel_encoder_pp(GSM_FRAME_SIZE, AIR_FRAME_SIZE) + channel_coder = gr.multiply_const_b(1) p2s = gr.parallel_to_serial(gr.sizeof_char, AIR_FRAME_SIZE) mod = gmsk_mod(fg, sps=samples_per_symbol, @@ -93,7 +92,7 @@ class digital_voice_rx(gr.hier_block): p_size=AIR_FRAME_SIZE) s2p = gr.serial_to_parallel(gr.sizeof_char, AIR_FRAME_SIZE) - channel_decoder = gr.fake_channel_decoder_pp(AIR_FRAME_SIZE, GSM_FRAME_SIZE) + channel_decoder = gr.multiply_const_b(1) voice_decoder = gsm_full_rate.decode_ps() s2f = blocks.short_to_float () diff --git a/gr-digital/python/ofdm.py b/gr-digital/python/ofdm.py index bf129675ab..fdb23703f9 100644 --- a/gr-digital/python/ofdm.py +++ b/gr-digital/python/ofdm.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2006,2007,2008 Free Software Foundation, Inc. +# Copyright 2006-2008,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -260,7 +260,7 @@ class ofdm_demod(gr.hier_block2): "ofdm_frame_sink_c.dat")) else: self.connect(self.ofdm_demod, - gr.null_sink(gr.sizeof_gr_complex*self._occupied_tones)) + blocks.null_sink(gr.sizeof_gr_complex*self._occupied_tones)) if options.verbose: self._print_verbage() diff --git a/gr-digital/python/ofdm_sync_fixed.py b/gr-digital/python/ofdm_sync_fixed.py index bd64964651..9cbd59b943 100644 --- a/gr-digital/python/ofdm_sync_fixed.py +++ b/gr-digital/python/ofdm_sync_fixed.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2007 Free Software Foundation, Inc. +# Copyright 2007,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -36,13 +36,13 @@ class ofdm_sync_fixed(gr.hier_block2): pkt_length = nsymbols*symbol_length data = (pkt_length)*[0,] data[(symbol_length)-1] = 1 - self.peak_trigger = gr.vector_source_b(data, True) + self.peak_trigger = blocks.vector_source_b(data, True) # Use a pre-defined frequency offset foffset = (pkt_length)*[math.pi*freq_offset,] - self.frequency_offset = gr.vector_source_f(foffset, True) + self.frequency_offset = blocks.vector_source_f(foffset, True) - self.connect(self, gr.null_sink(gr.sizeof_gr_complex)) + self.connect(self, blocks.null_sink(gr.sizeof_gr_complex)) self.connect(self.frequency_offset, (self,0)) self.connect(self.peak_trigger, (self,1)) diff --git a/gr-digital/python/ofdm_txrx.py b/gr-digital/python/ofdm_txrx.py index 2734e9cc1c..c403ef6cbf 100644 --- a/gr-digital/python/ofdm_txrx.py +++ b/gr-digital/python/ofdm_txrx.py @@ -1,5 +1,5 @@ # -# Copyright 2005,2006,2007 Free Software Foundation, Inc. +# Copyright 2005-2007,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -143,7 +143,7 @@ class ofdm_tx(gr.hier_block2): (header_payload_mux, 1) ) self.connect(payload_mod, gr.tag_debug(gr.sizeof_gr_complex, "pmod")) - sync_word_gen = gr.vector_source_c( + sync_word_gen = blocks.vector_source_c( total_sync_word, True, self.fft_len, tagged_streams.make_lengthtags((n_sync_words,), (0,), self.frame_length_tag_key) ) diff --git a/gr-digital/python/qa_binary_slicer_fb.py b/gr-digital/python/qa_binary_slicer_fb.py index 22f7da73ff..40213d7e33 100755 --- a/gr-digital/python/qa_binary_slicer_fb.py +++ b/gr-digital/python/qa_binary_slicer_fb.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2011,2012 Free Software Foundation, Inc. +# Copyright 2011-2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -22,6 +22,7 @@ from gnuradio import gr, gr_unittest import digital_swig as digital +import blocks_swig as blocks import math, random class test_binary_slicer_fb(gr_unittest.TestCase): @@ -36,9 +37,9 @@ class test_binary_slicer_fb(gr_unittest.TestCase): expected_result = ( 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1) src_data = (-1, 1, -1, -1, 1, 1, -1, -1, -1, 1, 1, 1, -1, 1, 1, 1, 1) src_data = [s + (1 - random.random()) for s in src_data] # add some noise - src = gr.vector_source_f(src_data) + src = blocks.vector_source_f(src_data) op = digital.binary_slicer_fb() - dst = gr.vector_sink_b() + dst = blocks.vector_sink_b() self.tb.connect(src, op) self.tb.connect(op, dst) diff --git a/gr-digital/python/qa_chunks_to_symbols.py b/gr-digital/python/qa_chunks_to_symbols.py index 5ffe425132..cbc29b83a9 100755 --- a/gr-digital/python/qa_chunks_to_symbols.py +++ b/gr-digital/python/qa_chunks_to_symbols.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2012 Free Software Foundation, Inc. +# Copyright 2012,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -22,6 +22,7 @@ from gnuradio import gr, gr_unittest import digital_swig as digital +import blocks_swig as blocks class test_chunks_to_symbols(gr_unittest.TestCase): @@ -38,10 +39,10 @@ class test_chunks_to_symbols(gr_unittest.TestCase): expected_result = (1+0j, 0+1j, -1+0j, 0-1j, 0-1j, -1+0j, 0+1j, 1+0j) - src = gr.vector_source_b(src_data) + src = blocks.vector_source_b(src_data) op = digital.chunks_to_symbols_bc(const) - dst = gr.vector_sink_c() + dst = blocks.vector_sink_c() self.tb.connect(src, op) self.tb.connect(op, dst) self.tb.run() @@ -55,10 +56,10 @@ class test_chunks_to_symbols(gr_unittest.TestCase): expected_result = (-3, -1, 1, 3, 3, 1, -1, -3) - src = gr.vector_source_b(src_data) + src = blocks.vector_source_b(src_data) op = digital.chunks_to_symbols_bf(const) - dst = gr.vector_sink_f() + dst = blocks.vector_sink_f() self.tb.connect(src, op) self.tb.connect(op, dst) self.tb.run() @@ -73,10 +74,10 @@ class test_chunks_to_symbols(gr_unittest.TestCase): expected_result = (1+0j, 0+1j, -1+0j, 0-1j, 0-1j, -1+0j, 0+1j, 1+0j) - src = gr.vector_source_i(src_data) + src = blocks.vector_source_i(src_data) op = digital.chunks_to_symbols_ic(const) - dst = gr.vector_sink_c() + dst = blocks.vector_sink_c() self.tb.connect(src, op) self.tb.connect(op, dst) self.tb.run() @@ -90,10 +91,10 @@ class test_chunks_to_symbols(gr_unittest.TestCase): expected_result = (-3, -1, 1, 3, 3, 1, -1, -3) - src = gr.vector_source_i(src_data) + src = blocks.vector_source_i(src_data) op = digital.chunks_to_symbols_if(const) - dst = gr.vector_sink_f() + dst = blocks.vector_sink_f() self.tb.connect(src, op) self.tb.connect(op, dst) self.tb.run() @@ -108,10 +109,10 @@ class test_chunks_to_symbols(gr_unittest.TestCase): expected_result = (1+0j, 0+1j, -1+0j, 0-1j, 0-1j, -1+0j, 0+1j, 1+0j) - src = gr.vector_source_s(src_data) + src = blocks.vector_source_s(src_data) op = digital.chunks_to_symbols_sc(const) - dst = gr.vector_sink_c() + dst = blocks.vector_sink_c() self.tb.connect(src, op) self.tb.connect(op, dst) self.tb.run() @@ -125,10 +126,10 @@ class test_chunks_to_symbols(gr_unittest.TestCase): expected_result = (-3, -1, 1, 3, 3, 1, -1, -3) - src = gr.vector_source_s(src_data) + src = blocks.vector_source_s(src_data) op = digital.chunks_to_symbols_sf(const) - dst = gr.vector_sink_f() + dst = blocks.vector_sink_f() self.tb.connect(src, op) self.tb.connect(op, dst) self.tb.run() diff --git a/gr-digital/python/qa_clock_recovery_mm.py b/gr-digital/python/qa_clock_recovery_mm.py index e904cf4c21..f696c9f124 100755 --- a/gr-digital/python/qa_clock_recovery_mm.py +++ b/gr-digital/python/qa_clock_recovery_mm.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2011,2012 Free Software Foundation, Inc. +# Copyright 2011-2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -22,6 +22,7 @@ from gnuradio import gr, gr_unittest import digital_swig as digital +import blocks_swig as blocks import random, cmath class test_clock_recovery_mm(gr_unittest.TestCase): @@ -45,8 +46,8 @@ class test_clock_recovery_mm(gr_unittest.TestCase): omega_rel_lim) data = 100*[complex(1, 1),] - self.src = gr.vector_source_c(data, False) - self.snk = gr.vector_sink_c() + self.src = blocks.vector_source_c(data, False) + self.snk = blocks.vector_sink_c() self.tb.connect(self.src, self.test, self.snk) self.tb.run() @@ -80,8 +81,8 @@ class test_clock_recovery_mm(gr_unittest.TestCase): omega_rel_lim) data = 100*[1,] - self.src = gr.vector_source_f(data, False) - self.snk = gr.vector_sink_f() + self.src = blocks.vector_source_f(data, False) + self.snk = blocks.vector_sink_f() self.tb.connect(self.src, self.test, self.snk) self.tb.run() @@ -115,8 +116,8 @@ class test_clock_recovery_mm(gr_unittest.TestCase): omega_rel_lim) data = 1000*[complex(1, 1), complex(1, 1), complex(-1, -1), complex(-1, -1)] - self.src = gr.vector_source_c(data, False) - self.snk = gr.vector_sink_c() + self.src = blocks.vector_source_c(data, False) + self.snk = blocks.vector_sink_c() self.tb.connect(self.src, self.test, self.snk) self.tb.run() @@ -150,8 +151,8 @@ class test_clock_recovery_mm(gr_unittest.TestCase): omega_rel_lim) data = 1000*[1, 1, -1, -1] - self.src = gr.vector_source_f(data, False) - self.snk = gr.vector_sink_f() + self.src = blocks.vector_source_f(data, False) + self.snk = blocks.vector_sink_f() self.tb.connect(self.src, self.test, self.snk) self.tb.run() diff --git a/gr-digital/python/qa_cma_equalizer.py b/gr-digital/python/qa_cma_equalizer.py index f71e199189..183ba4f4e7 100755 --- a/gr-digital/python/qa_cma_equalizer.py +++ b/gr-digital/python/qa_cma_equalizer.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2006,2007,2010,2011 Free Software Foundation, Inc. +# Copyright 2006,2007,2010,2011,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -22,6 +22,7 @@ from gnuradio import gr, gr_unittest import digital_swig as digital +import blocks_swig as blocks class test_cma_equalizer_fir(gr_unittest.TestCase): @@ -32,9 +33,9 @@ class test_cma_equalizer_fir(gr_unittest.TestCase): self.tb = None def transform(self, src_data): - SRC = gr.vector_source_c(src_data, False) + SRC = blocks.vector_source_c(src_data, False) EQU = digital.cma_equalizer_cc(4, 1.0, .001, 1) - DST = gr.vector_sink_c() + DST = blocks.vector_sink_c() self.tb.connect(SRC, EQU, DST) self.tb.run() return DST.data() diff --git a/gr-digital/python/qa_constellation.py b/gr-digital/python/qa_constellation.py index a593c3ea3e..77fb88031c 100755 --- a/gr-digital/python/qa_constellation.py +++ b/gr-digital/python/qa_constellation.py @@ -180,9 +180,9 @@ class test_constellation(gr_unittest.TestCase): else: rotations = [None] for rotation in rotations: - src = gr.vector_source_b(self.src_data) + src = blocks.vector_source_b(self.src_data) content = mod_demod(constellation, differential, rotation) - dst = gr.vector_sink_b() + dst = blocks.vector_sink_b() self.tb = gr.top_block() self.tb.connect(src, content, dst) self.tb.run() diff --git a/gr-digital/python/qa_constellation_decoder_cb.py b/gr-digital/python/qa_constellation_decoder_cb.py index 6a93b6e743..12fef4345f 100755 --- a/gr-digital/python/qa_constellation_decoder_cb.py +++ b/gr-digital/python/qa_constellation_decoder_cb.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2004,2007,2010-2012 Free Software Foundation, Inc. +# Copyright 2004,2007,2010-2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -22,6 +22,7 @@ from gnuradio import gr, gr_unittest import digital_swig as digital +import blocks_swig as blocks import math class test_constellation_decoder(gr_unittest.TestCase): @@ -38,9 +39,9 @@ class test_constellation_decoder(gr_unittest.TestCase): 0.8 + 1.0j, -0.5 + 0.1j, 0.1 - 1.2j) expected_result = ( 1, 1, 0, 0, 1, 0, 1) - src = gr.vector_source_c(src_data) + src = blocks.vector_source_c(src_data) op = digital.constellation_decoder_cb(cnst.base()) - dst = gr.vector_sink_b() + dst = blocks.vector_sink_b() self.tb.connect(src, op) self.tb.connect(op, dst) @@ -57,9 +58,9 @@ class test_constellation_decoder(gr_unittest.TestCase): 0.8 + 1.0j, -0.5 + 0.1j, 0.1 - 1.2j) expected_result = ( 3, 1, 0, 2, 3, 2, 1) - src = gr.vector_source_c(src_data) + src = blocks.vector_source_c(src_data) op = digital_swig.constellation_decoder_cb(cnst.base()) - dst = gr.vector_sink_b() + dst = blocks.vector_sink_b() self.tb.connect(src, op) self.tb.connect(op, dst) diff --git a/gr-digital/python/qa_constellation_receiver.py b/gr-digital/python/qa_constellation_receiver.py index bc44220ea9..73a78d0f8e 100755 --- a/gr-digital/python/qa_constellation_receiver.py +++ b/gr-digital/python/qa_constellation_receiver.py @@ -156,7 +156,7 @@ class rec_test_tb(gr.top_block): else: self.src_data = src_data packer = blocks.unpacked_to_packed_bb(1, gr.GR_MSB_FIRST) - src = gr.vector_source_b(self.src_data) + src = blocks.vector_source_b(self.src_data) mod = generic_mod(constellation, differential=differential) # Channel if freq_offset: @@ -171,7 +171,7 @@ class rec_test_tb(gr.top_block): else: demod = generic_demod(constellation, differential=differential, freq_bw=0, phase_bw=0) - self.dst = gr.vector_sink_b() + self.dst = blocks.vector_sink_b() self.connect(src, packer, mod, channel, demod, self.dst) if __name__ == '__main__': diff --git a/gr-digital/python/qa_correlate_access_code.py b/gr-digital/python/qa_correlate_access_code.py index 5a5f2209f7..ccddc0f113 100755 --- a/gr-digital/python/qa_correlate_access_code.py +++ b/gr-digital/python/qa_correlate_access_code.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2006,2007,2010,2011 Free Software Foundation, Inc. +# Copyright 2006,2007,2010,2011,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -22,6 +22,7 @@ from gnuradio import gr, gr_unittest import digital_swig as digital +import blocks_swig as blocks import math default_access_code = '\xAC\xDD\xA4\xE2\xF2\x8C\x20\xFC' @@ -52,9 +53,9 @@ class test_correlate_access_code(gr_unittest.TestCase): # 0 0 0 1 0 0 0 1 src_data = (1, 0, 1, 1, 1, 1, 0, 1, 1) + pad + (0,) * 7 expected_result = pad + (1, 0, 1, 1, 3, 1, 0, 1, 1, 2) + (0,) * 6 - src = gr.vector_source_b(src_data) + src = blocks.vector_source_b(src_data) op = digital.correlate_access_code_bb("1011", 0) - dst = gr.vector_sink_b() + dst = blocks.vector_sink_b() self.tb.connect(src, op, dst) self.tb.run() result_data = dst.data() @@ -69,9 +70,9 @@ class test_correlate_access_code(gr_unittest.TestCase): #print access_code src_data = code + (1, 0, 1, 1) + pad expected_result = pad + code + (3, 0, 1, 1) - src = gr.vector_source_b(src_data) + src = blocks.vector_source_b(src_data) op = digital.correlate_access_code_bb(access_code, 0) - dst = gr.vector_sink_b() + dst = blocks.vector_sink_b() self.tb.connect(src, op, dst) self.tb.run() result_data = dst.data() @@ -85,9 +86,9 @@ class test_correlate_access_code(gr_unittest.TestCase): #print access_code src_data = code + (1, 0, 1, 1) + pad expected_result = code + (1, 0, 1, 1) + pad - src = gr.vector_source_b(src_data) + src = blocks.vector_source_b(src_data) op = digital.correlate_access_code_tag_bb(access_code, 0, "test") - dst = gr.vector_sink_b() + dst = blocks.vector_sink_b() self.tb.connect(src, op, dst) self.tb.run() result_data = dst.data() diff --git a/gr-digital/python/qa_costas_loop_cc.py b/gr-digital/python/qa_costas_loop_cc.py index 365eda736a..9be96101e3 100755 --- a/gr-digital/python/qa_costas_loop_cc.py +++ b/gr-digital/python/qa_costas_loop_cc.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2011 Free Software Foundation, Inc. +# Copyright 2011,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -22,6 +22,7 @@ from gnuradio import gr, gr_unittest import digital_swig as digital +import blocks_swig as blocks import psk import random, cmath @@ -40,8 +41,8 @@ class test_costas_loop_cc(gr_unittest.TestCase): self.test = digital.costas_loop_cc(natfreq, order) data = 100*[complex(1,0),] - self.src = gr.vector_source_c(data, False) - self.snk = gr.vector_sink_c() + self.src = blocks.vector_source_c(data, False) + self.snk = blocks.vector_sink_c() self.tb.connect(self.src, self.test, self.snk) self.tb.run() @@ -57,8 +58,8 @@ class test_costas_loop_cc(gr_unittest.TestCase): self.test = digital.costas_loop_cc(natfreq, order) data = [complex(2*random.randint(0,1)-1, 0) for i in xrange(100)] - self.src = gr.vector_source_c(data, False) - self.snk = gr.vector_sink_c() + self.src = blocks.vector_source_c(data, False) + self.snk = blocks.vector_sink_c() self.tb.connect(self.src, self.test, self.snk) self.tb.run() @@ -81,8 +82,8 @@ class test_costas_loop_cc(gr_unittest.TestCase): expected_result = data[N:] data = [rot*d for d in data] - self.src = gr.vector_source_c(data, False) - self.snk = gr.vector_sink_c() + self.src = blocks.vector_source_c(data, False) + self.snk = blocks.vector_sink_c() self.tb.connect(self.src, self.test, self.snk) self.tb.run() @@ -107,8 +108,8 @@ class test_costas_loop_cc(gr_unittest.TestCase): expected_result = data[N:] data = [rot*d for d in data] - self.src = gr.vector_source_c(data, False) - self.snk = gr.vector_sink_c() + self.src = blocks.vector_source_c(data, False) + self.snk = blocks.vector_sink_c() self.tb.connect(self.src, self.test, self.snk) self.tb.run() @@ -136,8 +137,8 @@ class test_costas_loop_cc(gr_unittest.TestCase): rot = cmath.exp(0.1j) # some small rotation data = [rot*d for d in data] - self.src = gr.vector_source_c(data, False) - self.snk = gr.vector_sink_c() + self.src = blocks.vector_source_c(data, False) + self.snk = blocks.vector_sink_c() self.tb.connect(self.src, self.test, self.snk) self.tb.run() diff --git a/gr-digital/python/qa_cpm.py b/gr-digital/python/qa_cpm.py index 070e69a982..c87f7c34d6 100755 --- a/gr-digital/python/qa_cpm.py +++ b/gr-digital/python/qa_cpm.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2010 Free Software Foundation, Inc. +# Copyright 2010,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -38,10 +38,10 @@ class test_cpm(gr_unittest.TestCase): sps = 2 L = 1 in_bits = (1,) * 20 - src = gr.vector_source_b(in_bits, False) + src = blocks.vector_source_b(in_bits, False) cpm = digital.cpmmod_bc(type, 0.5, sps, L) arg = blocks.complex_to_arg() - sink = gr.vector_sink_f() + sink = blocks.vector_sink_f() self.tb.connect(src, cpm, arg, sink) self.tb.run() @@ -69,10 +69,10 @@ class test_cpm(gr_unittest.TestCase): L = 5 bt = 0.3 in_bits = (1,) * 20 - src = gr.vector_source_b(in_bits, False) + src = blocks.vector_source_b(in_bits, False) gmsk = digital.gmskmod_bc(sps, L, bt) arg = blocks.complex_to_arg() - sink = gr.vector_sink_f() + sink = blocks.vector_sink_f() self.tb.connect(src, gmsk, arg, sink) self.tb.run() diff --git a/gr-digital/python/qa_crc32_bb.py b/gr-digital/python/qa_crc32_bb.py index 4574b9dca7..6ee7ca1bcf 100755 --- a/gr-digital/python/qa_crc32_bb.py +++ b/gr-digital/python/qa_crc32_bb.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -# Copyright 2012 Free Software Foundation, Inc. +# Copyright 2012,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -41,9 +41,9 @@ class qa_crc32_bb (gr_unittest.TestCase): tag.offset = 0 tag.key = pmt.string_to_symbol(tag_name) tag.value = pmt.from_long(len(data)) - src = gr.vector_source_b(data, False, 1, (tag,)) + src = blocks.vector_source_b(data, False, 1, (tag,)) crc = digital.crc32_bb(False, tag_name) - sink = gr.vector_sink_b() + sink = blocks.vector_sink_b() self.tb.connect(src, crc, sink) self.tb.run() # Check that the packets before crc_check are 4 bytes longer that the input. @@ -58,10 +58,10 @@ class qa_crc32_bb (gr_unittest.TestCase): tag.offset = 0 tag.key = pmt.string_to_symbol(tag_name) tag.value = pmt.from_long(len(data)) - src = gr.vector_source_b(data, False, 1, (tag,)) + src = blocks.vector_source_b(data, False, 1, (tag,)) crc = digital.crc32_bb(False, tag_name) crc_check = digital.crc32_bb(True, tag_name) - sink = gr.vector_sink_b() + sink = blocks.vector_sink_b() self.tb.connect(src, crc, crc_check, sink) self.tb.run() # Check that the packets after crc_check are the same as input. @@ -91,9 +91,9 @@ class qa_crc32_bb (gr_unittest.TestCase): testtag3.offset = len(packets)-1 testtag3.key = pmt.string_to_symbol("tag3") testtag3.value = pmt.from_long(0) - src = gr.vector_source_b(packets, False, 1, (tag1, tag2, testtag1, testtag2, testtag3)) + src = blocks.vector_source_b(packets, False, 1, (tag1, tag2, testtag1, testtag2, testtag3)) crc = digital.crc32_bb(False, tag_name) - sink = gr.vector_sink_b() + sink = blocks.vector_sink_b() self.tb.connect(src, crc, sink) self.tb.run() self.assertEqual(len(sink.data()), 2*(pack_len+4)) @@ -117,11 +117,11 @@ class qa_crc32_bb (gr_unittest.TestCase): tag.offset = 0 tag.key = pmt.string_to_symbol(tag_name) tag.value = pmt.from_long(len(data)) - src = gr.vector_source_b(data, False, 1, (tag,)) + src = blocks.vector_source_b(data, False, 1, (tag,)) crc = digital.crc32_bb(False, tag_name) crc_check = digital.crc32_bb(True, tag_name) corruptor = blocks.add_const_bb(1) - sink = gr.vector_sink_b() + sink = blocks.vector_sink_b() self.tb.connect(src, crc, corruptor, crc_check, sink) self.tb.run() # crc_check will drop invalid packets @@ -139,9 +139,9 @@ class qa_crc32_bb (gr_unittest.TestCase): testtag.offset = len(data)-1 testtag.key = pmt.string_to_symbol('tag1') testtag.value = pmt.from_long(0) - src = gr.vector_source_b(data, False, 1, (tag, testtag)) + src = blocks.vector_source_b(data, False, 1, (tag, testtag)) crc_check = digital.crc32_bb(True, tag_name) - sink = gr.vector_sink_b() + sink = blocks.vector_sink_b() self.tb.connect(src, crc_check, sink) self.tb.run() self.assertEqual([len(data)-5,], [tag.offset for tag in sink.tags() if pmt.symbol_to_string(tag.key) == 'tag1']) diff --git a/gr-digital/python/qa_diff_encoder.py b/gr-digital/python/qa_diff_encoder.py index c28f4dbdf8..06efdf7189 100755 --- a/gr-digital/python/qa_diff_encoder.py +++ b/gr-digital/python/qa_diff_encoder.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2006,2007,2010,2012 Free Software Foundation, Inc. +# Copyright 2006,2007,2010,2012,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -22,6 +22,7 @@ from gnuradio import gr, gr_unittest import digital_swig as digital +import blocks_swig as blocks import math import random @@ -45,10 +46,10 @@ class test_diff_encoder(gr_unittest.TestCase): modulus = 2 src_data = make_random_int_tuple(1000, 0, modulus-1) expected_result = src_data - src = gr.vector_source_b(src_data) + src = blocks.vector_source_b(src_data) enc = digital.diff_encoder_bb(modulus) dec = digital.diff_decoder_bb(modulus) - dst = gr.vector_sink_b() + dst = blocks.vector_sink_b() self.tb.connect(src, enc, dec, dst) self.tb.run() # run the graph and wait for it to finish actual_result = dst.data() # fetch the contents of the sink @@ -59,10 +60,10 @@ class test_diff_encoder(gr_unittest.TestCase): modulus = 4 src_data = make_random_int_tuple(1000, 0, modulus-1) expected_result = src_data - src = gr.vector_source_b(src_data) + src = blocks.vector_source_b(src_data) enc = digital.diff_encoder_bb(modulus) dec = digital.diff_decoder_bb(modulus) - dst = gr.vector_sink_b() + dst = blocks.vector_sink_b() self.tb.connect(src, enc, dec, dst) self.tb.run() # run the graph and wait for it to finish actual_result = dst.data() # fetch the contents of the sink @@ -73,10 +74,10 @@ class test_diff_encoder(gr_unittest.TestCase): modulus = 8 src_data = make_random_int_tuple(40000, 0, modulus-1) expected_result = src_data - src = gr.vector_source_b(src_data) + src = blocks.vector_source_b(src_data) enc = digital.diff_encoder_bb(modulus) dec = digital.diff_decoder_bb(modulus) - dst = gr.vector_sink_b() + dst = blocks.vector_sink_b() self.tb.connect(src, enc, dec, dst) self.tb.run() # run the graph and wait for it to finish actual_result = dst.data() # fetch the contents of the sink diff --git a/gr-digital/python/qa_diff_phasor_cc.py b/gr-digital/python/qa_diff_phasor_cc.py index 833158d0a8..87ff59a2c4 100755 --- a/gr-digital/python/qa_diff_phasor_cc.py +++ b/gr-digital/python/qa_diff_phasor_cc.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2004,2007,2010 Free Software Foundation, Inc. +# Copyright 2004,2007,2010,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -22,6 +22,7 @@ from gnuradio import gr, gr_unittest import digital_swig as digital +import blocks_swig as blocks import math class test_diff_phasor(gr_unittest.TestCase): @@ -35,9 +36,9 @@ class test_diff_phasor(gr_unittest.TestCase): def test_diff_phasor_cc(self): src_data = (0+0j, 1+0j, -1+0j, 3+4j, -3-4j, -3+4j) expected_result = (0+0j, 0+0j, -1+0j, -3-4j, -25+0j, -7-24j) - src = gr.vector_source_c(src_data) + src = blocks.vector_source_c(src_data) op = digital.diff_phasor_cc() - dst = gr.vector_sink_c() + dst = blocks.vector_sink_c() self.tb.connect(src, op) self.tb.connect(op, dst) self.tb.run() # run the graph and wait for it to finish diff --git a/gr-digital/python/qa_fll_band_edge.py b/gr-digital/python/qa_fll_band_edge.py index 0f6bad984e..050bf888d5 100755 --- a/gr-digital/python/qa_fll_band_edge.py +++ b/gr-digital/python/qa_fll_band_edge.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2011,2012 Free Software Foundation, Inc. +# Copyright 2011-2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -51,7 +51,7 @@ class test_fll_band_edge_cc(gr_unittest.TestCase): # Create a set of 1's and -1's, pulse shape and interpolate to sps random.seed(0) data = [2.0*random.randint(0, 2) - 1.0 for i in xrange(200)] - self.src = gr.vector_source_c(data, False) + self.src = blocks.vector_source_c(data, False) self.rrc = filter.interp_fir_filter_ccf(sps, rrc_taps) # Mix symbols with a complex sinusoid to spin them @@ -63,10 +63,10 @@ class test_fll_band_edge_cc(gr_unittest.TestCase): # Create sinks for all outputs of the FLL # we will only care about the freq and error outputs - self.vsnk_frq = gr.vector_sink_f() - self.nsnk_fll = gr.null_sink(gr.sizeof_gr_complex) - self.nsnk_phs = gr.null_sink(gr.sizeof_float) - self.nsnk_err = gr.null_sink(gr.sizeof_float) + self.vsnk_frq = blocks.vector_sink_f() + self.nsnk_fll = blocks.null_sink(gr.sizeof_gr_complex) + self.nsnk_phs = blocks.null_sink(gr.sizeof_float) + self.nsnk_err = blocks.null_sink(gr.sizeof_float) # Connect the blocks self.tb.connect(self.nco, (self.mix,1)) diff --git a/gr-digital/python/qa_framer_sink.py b/gr-digital/python/qa_framer_sink.py index e717e6ae05..bf6c5cc96d 100755 --- a/gr-digital/python/qa_framer_sink.py +++ b/gr-digital/python/qa_framer_sink.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2012 Free Software Foundation, Inc. +# Copyright 2012,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -22,6 +22,7 @@ from gnuradio import gr, gr_unittest import digital_swig as digital +import blocks_swig as blocks default_access_code = '\xAC\xDD\xA4\xE2\xF2\x8C\x20\xFC' @@ -56,10 +57,10 @@ class test_framker_sink(gr_unittest.TestCase): rcvd_pktq = gr.msg_queue() - src = gr.vector_source_b(src_data) + src = blocks.vector_source_b(src_data) correlator = digital.correlate_access_code_bb(access_code, 0) framer_sink = digital.framer_sink_1(rcvd_pktq) - vsnk = gr.vector_sink_b() + vsnk = blocks.vector_sink_b() self.tb.connect(src, correlator, framer_sink) self.tb.connect(correlator, vsnk) @@ -80,10 +81,10 @@ class test_framker_sink(gr_unittest.TestCase): rcvd_pktq = gr.msg_queue() - src = gr.vector_source_b(src_data) + src = blocks.vector_source_b(src_data) correlator = digital.correlate_access_code_bb(access_code, 0) framer_sink = digital.framer_sink_1(rcvd_pktq) - vsnk = gr.vector_sink_b() + vsnk = blocks.vector_sink_b() self.tb.connect(src, correlator, framer_sink) self.tb.connect(correlator, vsnk) diff --git a/gr-digital/python/qa_glfsr_source.py b/gr-digital/python/qa_glfsr_source.py index c5adab3023..227801c07e 100755 --- a/gr-digital/python/qa_glfsr_source.py +++ b/gr-digital/python/qa_glfsr_source.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2007,2010,2012 Free Software Foundation, Inc. +# Copyright 2007,2010,2012,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -22,6 +22,7 @@ from gnuradio import gr, gr_unittest import digital_swig as digital +import blocks_swig as blocks class test_glfsr_source(gr_unittest.TestCase): @@ -46,7 +47,7 @@ class test_glfsr_source(gr_unittest.TestCase): for degree in range(1,11): # Higher degrees take too long to correlate src = digital.glfsr_source_b(degree, False) b2f = digital.chunks_to_symbols_bf((-1.0,1.0), 1) - dst = gr.vector_sink_f() + dst = blocks.vector_sink_f() del self.tb # Discard existing top block self.tb = gr.top_block() self.tb.connect(src, b2f, dst) @@ -71,7 +72,7 @@ class test_glfsr_source(gr_unittest.TestCase): def test_005_correlation_f(self): for degree in range(1,11): # Higher degrees take too long to correlate src = digital.glfsr_source_f(degree, False) - dst = gr.vector_sink_f() + dst = blocks.vector_sink_f() del self.tb # Discard existing top block self.tb = gr.top_block() self.tb.connect(src, dst) diff --git a/gr-digital/python/qa_header_payload_demux.py b/gr-digital/python/qa_header_payload_demux.py index 4073f24ace..7595409ef8 100755 --- a/gr-digital/python/qa_header_payload_demux.py +++ b/gr-digital/python/qa_header_payload_demux.py @@ -23,6 +23,7 @@ from gnuradio import gr, gr_unittest try: import pmt except: from gruel import pmt import digital_swig as digital +import blocks_swig as blocks import time class qa_header_payload_demux (gr_unittest.TestCase): @@ -45,14 +46,14 @@ class qa_header_payload_demux (gr_unittest.TestCase): trigger_signal = [0,] * len(data_signal) trigger_signal[n_zeros] = 1 - data_src = gr.vector_source_f(data_signal, False) - trigger_src = gr.vector_source_b(trigger_signal, False) + data_src = blocks.vector_source_f(data_signal, False) + trigger_src = blocks.vector_source_b(trigger_signal, False) hpd = digital.header_payload_demux( len(header), 1, 0, "frame_len", "detect", False, gr.sizeof_float ) self.assertEqual(pmt.length(hpd.message_ports_in()), 1) - header_sink = gr.vector_sink_f() - payload_sink = gr.vector_sink_f() + header_sink = blocks.vector_sink_f() + payload_sink = blocks.vector_sink_f() self.tb.connect(data_src, (hpd, 0)) self.tb.connect(trigger_src, (hpd, 1)) diff --git a/gr-digital/python/qa_lms_equalizer.py b/gr-digital/python/qa_lms_equalizer.py index 9ba90a89ab..749cce2075 100755 --- a/gr-digital/python/qa_lms_equalizer.py +++ b/gr-digital/python/qa_lms_equalizer.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2006,2007,2010,2011 Free Software Foundation, Inc. +# Copyright 2006,2007,2010,2011,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -22,6 +22,7 @@ from gnuradio import gr, gr_unittest import digital_swig as digital +import blocks_swig as blocks class test_lms_dd_equalizer(gr_unittest.TestCase): @@ -32,9 +33,9 @@ class test_lms_dd_equalizer(gr_unittest.TestCase): self.tb = None def transform(self, src_data, gain, const): - SRC = gr.vector_source_c(src_data, False) + SRC = blocks.vector_source_c(src_data, False) EQU = digital.lms_dd_equalizer_cc(4, gain, 1, const.base()) - DST = gr.vector_sink_c() + DST = blocks.vector_sink_c() self.tb.connect(SRC, EQU, DST) self.tb.run() return DST.data() diff --git a/gr-digital/python/qa_map.py b/gr-digital/python/qa_map.py index 0fd7c479a1..2083d4a849 100755 --- a/gr-digital/python/qa_map.py +++ b/gr-digital/python/qa_map.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2012 Free Software Foundation, Inc. +# Copyright 2012,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -22,6 +22,7 @@ from gnuradio import gr, gr_unittest import digital_swig as digital +import blocks_swig as blocks class test_map(gr_unittest.TestCase): @@ -34,9 +35,9 @@ class test_map(gr_unittest.TestCase): def helper(self, symbols): src_data = [0, 1, 2, 3, 0, 1, 2, 3] expected_data = map(lambda x: symbols[x], src_data) - src = gr.vector_source_b(src_data) + src = blocks.vector_source_b(src_data) op = digital.map_bb(symbols) - dst = gr.vector_sink_b() + dst = blocks.vector_sink_b() self.tb.connect(src, op, dst) self.tb.run() diff --git a/gr-digital/python/qa_mpsk_receiver.py b/gr-digital/python/qa_mpsk_receiver.py index bde8895e76..9590df1f72 100755 --- a/gr-digital/python/qa_mpsk_receiver.py +++ b/gr-digital/python/qa_mpsk_receiver.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2011,2012 Free Software Foundation, Inc. +# Copyright 2011-2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -23,6 +23,7 @@ from gnuradio import gr, gr_unittest import digital_swig as digital import filter_swig as filter +import blocks_swig as blocks import random, cmath, time class test_mpsk_receiver(gr_unittest.TestCase): @@ -53,8 +54,8 @@ class test_mpsk_receiver(gr_unittest.TestCase): data = 10000*[complex(1,0), complex(-1,0)] #data = [2*random.randint(0,1)-1 for x in xrange(10000)] - self.src = gr.vector_source_c(data, False) - self.snk = gr.vector_sink_c() + self.src = blocks.vector_source_c(data, False) + self.snk = blocks.vector_sink_c() # pulse shaping interpolation filter nfilts = 32 @@ -109,8 +110,8 @@ class test_mpsk_receiver(gr_unittest.TestCase): complex(-0.707, -0.707), complex( 0.707, -0.707)] data = [0.5*d for d in data] - self.src = gr.vector_source_c(data, False) - self.snk = gr.vector_sink_c() + self.src = blocks.vector_source_c(data, False) + self.snk = blocks.vector_sink_c() # pulse shaping interpolation filter nfilts = 32 diff --git a/gr-digital/python/qa_mpsk_snr_est.py b/gr-digital/python/qa_mpsk_snr_est.py index c976bf21a8..f500f0eb16 100755 --- a/gr-digital/python/qa_mpsk_snr_est.py +++ b/gr-digital/python/qa_mpsk_snr_est.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2011,2012 Free Software Foundation, Inc. +# Copyright 2011-2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -22,6 +22,7 @@ from gnuradio import gr, gr_unittest import digital_swig as digital +import blocks_swig as blocks import math, random def get_cplx(): @@ -46,8 +47,8 @@ class test_mpsk_snr_est(gr_unittest.TestCase): for i in xrange(1,6): src_data = [b+(i*n) for b,n in zip(self._bits, self._noise)] - src = gr.vector_source_c(src_data) - dst = gr.null_sink(gr.sizeof_gr_complex) + src = blocks.vector_source_c(src_data) + dst = blocks.null_sink(gr.sizeof_gr_complex) tb = gr.top_block() tb.connect(src, op) @@ -104,7 +105,7 @@ class test_mpsk_snr_est(gr_unittest.TestCase): for i in xrange(1,6): src_data = [b+(i*n) for b,n in zip(self._bits, self._noise)] - src = gr.vector_source_c(src_data) + src = blocks.vector_source_c(src_data) N = 10000 alpha = 0.001 diff --git a/gr-digital/python/qa_ofdm_carrier_allocator_cvc.py b/gr-digital/python/qa_ofdm_carrier_allocator_cvc.py index 2105727e04..0f5803a270 100755 --- a/gr-digital/python/qa_ofdm_carrier_allocator_cvc.py +++ b/gr-digital/python/qa_ofdm_carrier_allocator_cvc.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -# Copyright 2012 Free Software Foundation, Inc. +# Copyright 2012,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -23,6 +23,7 @@ from gnuradio import gr, gr_unittest try: import pmt except: from gruel import pmt import digital_swig as digital +import blocks_swig as blocks class qa_digital_carrier_allocator_cvc (gr_unittest.TestCase): @@ -47,13 +48,13 @@ class qa_digital_carrier_allocator_cvc (gr_unittest.TestCase): tag.offset = 0 tag.key = pmt.string_to_symbol(tag_name) tag.value = pmt.from_long(len(tx_symbols)) - src = gr.vector_source_c(tx_symbols, False, 1, (tag,)) + src = blocks.vector_source_c(tx_symbols, False, 1, (tag,)) alloc = digital.ofdm_carrier_allocator_cvc(fft_len, occupied_carriers, pilot_carriers, pilot_symbols, tag_name) - sink = gr.vector_sink_c(fft_len) + sink = blocks.vector_sink_c(fft_len) self.tb.connect(src, alloc, sink) self.tb.run () self.assertEqual(sink.data(), expected_result) @@ -73,13 +74,13 @@ class qa_digital_carrier_allocator_cvc (gr_unittest.TestCase): tag.offset = 0 tag.key = pmt.string_to_symbol(tag_name) tag.value = pmt.from_long(len(tx_symbols)) - src = gr.vector_source_c(tx_symbols, False, 1, (tag,)) + src = blocks.vector_source_c(tx_symbols, False, 1, (tag,)) alloc = digital.ofdm_carrier_allocator_cvc(fft_len, occupied_carriers, pilot_carriers, pilot_symbols, tag_name) - sink = gr.vector_sink_c(fft_len) + sink = blocks.vector_sink_c(fft_len) self.tb.connect(src, alloc, sink) self.tb.run () self.assertEqual(sink.data(), expected_result) @@ -126,13 +127,14 @@ class qa_digital_carrier_allocator_cvc (gr_unittest.TestCase): testtag4.offset = 2*len(tx_symbols)-1 # Last OFDM symbol of packet 2 testtag4.key = pmt.string_to_symbol('tag4') testtag4.value = pmt.from_long(0) - src = gr.vector_source_c(tx_symbols * 2, False, 1, (tag1, tag2, testtag1, testtag2, testtag3, testtag4)) + src = blocks.vector_source_c(tx_symbols * 2, False, 1, + (tag1, tag2, testtag1, testtag2, testtag3, testtag4)) alloc = digital.ofdm_carrier_allocator_cvc(fft_len, occupied_carriers, pilot_carriers, pilot_symbols, tag_name) - sink = gr.vector_sink_c(fft_len) + sink = blocks.vector_sink_c(fft_len) self.tb.connect(src, alloc, sink) self.tb.run () self.assertEqual(sink.data(), expected_result * 2) diff --git a/gr-digital/python/qa_ofdm_chanest_vcvc.py b/gr-digital/python/qa_ofdm_chanest_vcvc.py index c7c0d83a84..c45e39988b 100755 --- a/gr-digital/python/qa_ofdm_chanest_vcvc.py +++ b/gr-digital/python/qa_ofdm_chanest_vcvc.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -# Copyright 2012 Free Software Foundation, Inc. +# Copyright 2012,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -70,9 +70,9 @@ class qa_ofdm_sync_eqinit_vcvc (gr_unittest.TestCase): tag2.offset = 2 tag2.key = pmt.string_to_symbol("test_tag_2") tag2.value = pmt.from_long(42) - src = gr.vector_source_c(tx_data, False, fft_len, (tag1, tag2)) + src = blocks.vector_source_c(tx_data, False, fft_len, (tag1, tag2)) chanest = digital.ofdm_chanest_vcvc(sync_symbol1, sync_symbol2, 1) - sink = gr.vector_sink_c(fft_len) + sink = blocks.vector_sink_c(fft_len) self.tb.connect(src, chanest, sink) self.tb.run() self.assertEqual(shift_tuple(sink.data(), -carr_offset), data_symbol) @@ -104,10 +104,10 @@ class qa_ofdm_sync_eqinit_vcvc (gr_unittest.TestCase): data_symbol = (0, 0, 0, 1, -1, 1, -1, 1, 0, 1, -1, -1, -1, 1, 0, 0) tx_data = shift_tuple(sync_symbol, carr_offset) + \ shift_tuple(data_symbol, carr_offset) - src = gr.vector_source_c(tx_data, False, fft_len) + src = blocks.vector_source_c(tx_data, False, fft_len) # 17 is out of bounds! chanest = digital.ofdm_chanest_vcvc(sync_symbol, (), 1, 0, 17) - sink = gr.vector_sink_c(fft_len) + sink = blocks.vector_sink_c(fft_len) self.tb.connect(src, chanest, sink) self.tb.run() self.assertEqual(shift_tuple(sink.data(), -carr_offset), data_symbol) @@ -126,10 +126,10 @@ class qa_ofdm_sync_eqinit_vcvc (gr_unittest.TestCase): data_symbol = (0, 0, 0, 1, -1, 1, -1, 1, 0, 1, -1, -1, -1, 1, 0, 0) tx_data = sync_symbol1 + sync_symbol2 + data_symbol channel = (0, 0, 0, 2, -2, 2, 3j, 2, 0, 2, 2, 2, 2, 3, 0, 0) - src = gr.vector_source_c(tx_data, False, fft_len) + src = blocks.vector_source_c(tx_data, False, fft_len) chan = blocks.multiply_const_vcc(channel) chanest = digital.ofdm_chanest_vcvc(sync_symbol1, sync_symbol2, 1) - sink = gr.vector_sink_c(fft_len) + sink = blocks.vector_sink_c(fft_len) self.tb.connect(src, chan, chanest, sink) self.tb.run() tags = sink.tags() @@ -149,10 +149,10 @@ class qa_ofdm_sync_eqinit_vcvc (gr_unittest.TestCase): data_symbol = (0, 0, 0, 1, -1, 1, -1, 1, 0, 1, -1, -1, -1, 1, 0, 0) tx_data = sync_symbol + data_symbol channel = (0, 0, 0, 2, 2, 2, 2.5, 3, 2.5, 2, 2.5, 3, 2, 1, 1, 0) - src = gr.vector_source_c(tx_data, False, fft_len) + src = blocks.vector_source_c(tx_data, False, fft_len) chan = blocks.multiply_const_vcc(channel) chanest = digital.ofdm_chanest_vcvc(sync_symbol, (), 1) - sink = gr.vector_sink_c(fft_len) + sink = blocks.vector_sink_c(fft_len) self.tb.connect(src, chan, chanest, sink) self.tb.run() tags = sink.tags() @@ -172,10 +172,10 @@ class qa_ofdm_sync_eqinit_vcvc (gr_unittest.TestCase): data_symbol = (0, 0, 0, 1, -1, 1, -1, 1, 0, 1, -1, -1, -1, 1, 0, 0) tx_data = sync_symbol + data_symbol channel = (0, 0, 0, 2, 2, 2, 2.5, 3, 2.5, 2, 2.5, 3, 2, 1, 1, 0) - src = gr.vector_source_c(tx_data, False, fft_len) + src = blocks.vector_source_c(tx_data, False, fft_len) chan = blocks.multiply_const_vcc(channel) chanest = digital.ofdm_chanest_vcvc(sync_symbol, ref_symbol, 1) - sink = gr.vector_sink_c(fft_len) + sink = blocks.vector_sink_c(fft_len) self.tb.connect(src, chan, chanest, sink) self.tb.run() tags = sink.tags() @@ -199,10 +199,10 @@ class qa_ofdm_sync_eqinit_vcvc (gr_unittest.TestCase): shift_tuple(sync_symbol2, carr_offset) + \ shift_tuple(data_symbol, carr_offset) channel = range(fft_len) - src = gr.vector_source_c(tx_data, False, fft_len) + src = blocks.vector_source_c(tx_data, False, fft_len) chan = blocks.multiply_const_vcc(channel) chanest = digital.ofdm_chanest_vcvc(sync_symbol1, sync_symbol2, 1) - sink = gr.vector_sink_c(fft_len) + sink = blocks.vector_sink_c(fft_len) self.tb.connect(src, chan, chanest, sink) self.tb.run() tags = sink.tags() @@ -236,12 +236,12 @@ class qa_ofdm_sync_eqinit_vcvc (gr_unittest.TestCase): shift_tuple(sync_sym2, carr_offset) + \ shift_tuple(data_sym, carr_offset) channel = [rand_range(min_chan_ampl, max_chan_ampl) * numpy.exp(1j * rand_range(0, 2 * numpy.pi)) for x in range(fft_len)] - src = gr.vector_source_c(tx_data, False, fft_len) + src = blocks.vector_source_c(tx_data, False, fft_len) chan = blocks.multiply_const_vcc(channel) noise = analog.noise_source_c(analog.GR_GAUSSIAN, wgn_amplitude) add = blocks.add_cc(fft_len) chanest = digital.ofdm_chanest_vcvc(sync_sym1, sync_sym2, 1) - sink = gr.vector_sink_c(fft_len) + sink = blocks.vector_sink_c(fft_len) top_block.connect(src, chan, (add, 0), chanest, sink) top_block.connect(noise, blocks.stream_to_vector(gr.sizeof_gr_complex, fft_len), (add, 1)) top_block.run() diff --git a/gr-digital/python/qa_ofdm_cyclic_prefixer.py b/gr-digital/python/qa_ofdm_cyclic_prefixer.py index 003e987e95..355742ab07 100755 --- a/gr-digital/python/qa_ofdm_cyclic_prefixer.py +++ b/gr-digital/python/qa_ofdm_cyclic_prefixer.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2007,2010,2011 Free Software Foundation, Inc. +# Copyright 2007,2010,2011,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -24,6 +24,7 @@ from gnuradio import gr, gr_unittest try: import pmt except: from gruel import pmt import digital_swig as digital +import blocks_swig as blocks class test_ofdm_cyclic_prefixer (gr_unittest.TestCase): @@ -39,9 +40,9 @@ class test_ofdm_cyclic_prefixer (gr_unittest.TestCase): cp_len = 2 expected_result = (6, 7, 0, 1, 2, 3, 4, 5, 6, 7, 6, 7, 0, 1, 2, 3, 4, 5, 6, 7) - src = gr.vector_source_c(range(fft_len) * 2, False, fft_len) + src = blocks.vector_source_c(range(fft_len) * 2, False, fft_len) cp = digital.ofdm_cyclic_prefixer(fft_len, fft_len + cp_len) - sink = gr.vector_sink_c() + sink = blocks.vector_sink_c() self.tb.connect(src, cp, sink) self.tb.run() self.assertEqual(sink.data(), expected_result) @@ -53,9 +54,9 @@ class test_ofdm_cyclic_prefixer (gr_unittest.TestCase): rolloff = 2 expected_result = (7.0/2, 8, 1, 2, 3, 4, 5, 6, 7, 8, # 1.0/2 7.0/2+1.0/2, 8, 1, 2, 3, 4, 5, 6, 7, 8) - src = gr.vector_source_c(range(1, fft_len+1) * 2, False, fft_len) + src = blocks.vector_source_c(range(1, fft_len+1) * 2, False, fft_len) cp = digital.ofdm_cyclic_prefixer(fft_len, fft_len + cp_len, rolloff) - sink = gr.vector_sink_c() + sink = blocks.vector_sink_c() self.tb.connect(src, cp, sink) self.tb.run() self.assertEqual(sink.data(), expected_result) @@ -75,9 +76,9 @@ class test_ofdm_cyclic_prefixer (gr_unittest.TestCase): tag2.offset = 1 tag2.key = pmt.string_to_symbol("random_tag") tag2.value = pmt.from_long(42) - src = gr.vector_source_c(range(1, fft_len+1) * 2, False, fft_len, (tag, tag2)) + src = blocks.vector_source_c(range(1, fft_len+1) * 2, False, fft_len, (tag, tag2)) cp = digital.ofdm_cyclic_prefixer(fft_len, fft_len + cp_len, 2, tag_name) - sink = gr.vector_sink_c() + sink = blocks.vector_sink_c() self.tb.connect(src, cp, sink) self.tb.run() self.assertEqual(sink.data(), expected_result) diff --git a/gr-digital/python/qa_ofdm_frame_equalizer_vcvc.py b/gr-digital/python/qa_ofdm_frame_equalizer_vcvc.py index 9faface03f..6df9ecbecf 100755 --- a/gr-digital/python/qa_ofdm_frame_equalizer_vcvc.py +++ b/gr-digital/python/qa_ofdm_frame_equalizer_vcvc.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -# Copyright 2012 Free Software Foundation, Inc. +# Copyright 2012,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -24,6 +24,7 @@ from gnuradio import gr, gr_unittest try: import pmt except: from gruel import pmt import digital_swig as digital +import blocks_swig as blocks class qa_ofdm_frame_equalizer_vcvc (gr_unittest.TestCase): @@ -48,9 +49,9 @@ class qa_ofdm_frame_equalizer_vcvc (gr_unittest.TestCase): chan_tag.offset = 0 chan_tag.key = pmt.string_to_symbol("ofdm_sync_chan_taps") chan_tag.value = pmt.init_c32vector(fft_len, (1,) * fft_len) - src = gr.vector_source_c(tx_data, False, fft_len, (len_tag, chan_tag)) + src = blocks.vector_source_c(tx_data, False, fft_len, (len_tag, chan_tag)) eq = digital.ofdm_frame_equalizer_vcvc(equalizer.base(), len_tag_key) - sink = gr.vector_sink_c(fft_len) + sink = blocks.vector_sink_c(fft_len) self.tb.connect(src, eq, sink) self.tb.run () # Check data @@ -93,9 +94,9 @@ class qa_ofdm_frame_equalizer_vcvc (gr_unittest.TestCase): chan_tag.offset = 0 chan_tag.key = pmt.string_to_symbol("ofdm_sync_chan_taps") chan_tag.value = pmt.init_c32vector(fft_len, channel[:fft_len]) - src = gr.vector_source_c(numpy.multiply(tx_signal, channel), False, fft_len, (len_tag, chan_tag)) + src = blocks.vector_source_c(numpy.multiply(tx_signal, channel), False, fft_len, (len_tag, chan_tag)) eq = digital.ofdm_frame_equalizer_vcvc(equalizer.base(), len_tag_key, True) - sink = gr.vector_sink_c(fft_len) + sink = blocks.vector_sink_c(fft_len) self.tb.connect(src, eq, sink) self.tb.run () rx_data = [cnst.decision_maker_v((x,)) if x != 0 else -1 for x in sink.data()] @@ -142,9 +143,9 @@ class qa_ofdm_frame_equalizer_vcvc (gr_unittest.TestCase): chan_tag.offset = 0 chan_tag.key = pmt.string_to_symbol("ofdm_sync_chan_taps") chan_tag.value = pmt.init_c32vector(fft_len, channel[:fft_len]) - src = gr.vector_source_c(numpy.multiply(tx_signal, channel), False, fft_len, (len_tag, chan_tag)) + src = blocks.vector_source_c(numpy.multiply(tx_signal, channel), False, fft_len, (len_tag, chan_tag)) eq = digital.ofdm_frame_equalizer_vcvc(equalizer.base(), len_tag_key, True) - sink = gr.vector_sink_c(fft_len) + sink = blocks.vector_sink_c(fft_len) self.tb.connect(src, eq, sink) self.tb.run () rx_data = [cnst.decision_maker_v((x,)) if x != 0 else -1 for x in sink.data()] diff --git a/gr-digital/python/qa_ofdm_insert_preamble.py b/gr-digital/python/qa_ofdm_insert_preamble.py index 60902edc14..ec7ace8905 100755 --- a/gr-digital/python/qa_ofdm_insert_preamble.py +++ b/gr-digital/python/qa_ofdm_insert_preamble.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2007,2010-2012 Free Software Foundation, Inc. +# Copyright 2007,2010-2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -35,8 +35,8 @@ class test_ofdm_insert_preamble(gr_unittest.TestCase): def helper(self, v0, v1, fft_length, preamble): tb = self.tb - src0 = gr.vector_source_c(v0) - src1 = gr.vector_source_b(v1) + src0 = blocks.vector_source_c(v0) + src1 = blocks.vector_source_b(v1) s2v = blocks.stream_to_vector(gr.sizeof_gr_complex, fft_length) @@ -45,8 +45,8 @@ class test_ofdm_insert_preamble(gr_unittest.TestCase): op = digital.ofdm_insert_preamble(fft_length, preamble) v2s = blocks.vector_to_stream(gr.sizeof_gr_complex, fft_length) - dst0 = gr.vector_sink_c() - dst1 = gr.vector_sink_b() + dst0 = blocks.vector_sink_c() + dst1 = blocks.vector_sink_b() tb.connect(src0, s2v, (op, 0)) tb.connect(src1, (op, 1)) diff --git a/gr-digital/python/qa_ofdm_serializer_vcc.py b/gr-digital/python/qa_ofdm_serializer_vcc.py index 107d6076c5..684cfe341f 100755 --- a/gr-digital/python/qa_ofdm_serializer_vcc.py +++ b/gr-digital/python/qa_ofdm_serializer_vcc.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2012 Free Software Foundation, Inc. +# Copyright 2012,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -52,9 +52,9 @@ class qa_ofdm_serializer_vcc (gr_unittest.TestCase): tag.offset = 0 tag.key = pmt.string_to_symbol(tag_name) tag.value = pmt.from_long(n_syms) - src = gr.vector_source_c(tx_symbols, False, fft_len, (tag,)) + src = blocks.vector_source_c(tx_symbols, False, fft_len, (tag,)) serializer = digital.ofdm_serializer_vcc(fft_len, occupied_carriers, tag_name, "", 0, False) - sink = gr.vector_sink_c() + sink = blocks.vector_sink_c() self.tb.connect(src, serializer, sink) self.tb.run () self.assertEqual(sink.data(), expected_result) @@ -83,9 +83,9 @@ class qa_ofdm_serializer_vcc (gr_unittest.TestCase): offsettag.offset = 0 offsettag.key = pmt.string_to_symbol("ofdm_sync_carr_offset") offsettag.value = pmt.from_long(carr_offset) - src = gr.vector_source_c(tx_symbols, False, fft_len, (tag, offsettag)) + src = blocks.vector_source_c(tx_symbols, False, fft_len, (tag, offsettag)) serializer = digital.ofdm_serializer_vcc(fft_len, occupied_carriers, tag_name, "", 0, False) - sink = gr.vector_sink_c() + sink = blocks.vector_sink_c() self.tb.connect(src, serializer, sink) self.tb.run () self.assertEqual(sink.data(), expected_result) @@ -108,14 +108,14 @@ class qa_ofdm_serializer_vcc (gr_unittest.TestCase): tag.offset = 0 tag.key = pmt.string_to_symbol(tag_name) tag.value = pmt.from_long(len(tx_data)) - src = gr.vector_source_c(tx_data, False, 1, (tag,)) + src = blocks.vector_source_c(tx_data, False, 1, (tag,)) alloc = digital.ofdm_carrier_allocator_cvc(fft_len, occupied_carriers, pilot_carriers, pilot_symbols, tag_name) serializer = digital.ofdm_serializer_vcc(alloc) - sink = gr.vector_sink_c() + sink = blocks.vector_sink_c() self.tb.connect(src, alloc, serializer, sink) self.tb.run () self.assertEqual(sink.data(), tx_data) @@ -146,7 +146,7 @@ class qa_ofdm_serializer_vcc (gr_unittest.TestCase): offsettag.offset = 0 offsettag.key = pmt.string_to_symbol("ofdm_sync_carr_offset") offsettag.value = pmt.from_long(carr_offset) - src = gr.vector_source_c(tx_data, False, 1, (tag, offsettag)) + src = blocks.vector_source_c(tx_data, False, 1, (tag, offsettag)) alloc = digital.ofdm_carrier_allocator_cvc(fft_len, occupied_carriers, pilot_carriers, @@ -157,7 +157,7 @@ class qa_ofdm_serializer_vcc (gr_unittest.TestCase): mixer = blocks.multiply_cc() rx_fft = fft.fft_vcc(fft_len, True, (), True) serializer = digital.ofdm_serializer_vcc(alloc) - sink = gr.vector_sink_c() + sink = blocks.vector_sink_c() self.tb.connect( src, alloc, tx_ifft, blocks.vector_to_stream(gr.sizeof_gr_complex, fft_len), @@ -189,9 +189,9 @@ class qa_ofdm_serializer_vcc (gr_unittest.TestCase): tag2.offset = 0 tag2.key = pmt.string_to_symbol("packet_len") tag2.value = pmt.from_long(len(expected_result)) - src = gr.vector_source_c(tx_symbols, False, fft_len, (tag, tag2)) + src = blocks.vector_source_c(tx_symbols, False, fft_len, (tag, tag2)) serializer = digital.ofdm_serializer_vcc(fft_len, occupied_carriers, tag_name, "packet_len", 0, False) - sink = gr.vector_sink_c() + sink = blocks.vector_sink_c() self.tb.connect(src, serializer, sink) self.tb.run () self.assertEqual(sink.data(), expected_result) diff --git a/gr-digital/python/qa_ofdm_sync_sc_cfb.py b/gr-digital/python/qa_ofdm_sync_sc_cfb.py index 806ef931de..d8b5465564 100755 --- a/gr-digital/python/qa_ofdm_sync_sc_cfb.py +++ b/gr-digital/python/qa_ofdm_sync_sc_cfb.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2012 Free Software Foundation, Inc. +# Copyright 2012,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -63,9 +63,9 @@ class qa_ofdm_sync_sc_cfb (gr_unittest.TestCase): tx_signal = tx_signal * 2 add = blocks.add_cc() sync = digital.ofdm_sync_sc_cfb(fft_len, cp_len) - sink_freq = gr.vector_sink_f() - sink_detect = gr.vector_sink_b() - self.tb.connect(gr.vector_source_c(tx_signal), (add, 0)) + sink_freq = blocks.vector_sink_f() + sink_detect = blocks.vector_sink_b() + self.tb.connect(blocks.vector_source_c(tx_signal), (add, 0)) self.tb.connect(analog.noise_source_c(analog.GR_GAUSSIAN, .01), (add, 1)) self.tb.connect(add, sync) self.tb.connect((sync, 0), sink_freq) @@ -92,9 +92,9 @@ class qa_ofdm_sync_sc_cfb (gr_unittest.TestCase): mult = blocks.multiply_cc() add = blocks.add_cc() sync = digital.ofdm_sync_sc_cfb(fft_len, cp_len) - sink_freq = gr.vector_sink_f() - sink_detect = gr.vector_sink_b() - self.tb.connect(gr.vector_source_c(tx_signal), (mult, 0), (add, 0)) + sink_freq = blocks.vector_sink_f() + sink_detect = blocks.vector_sink_b() + self.tb.connect(blocks.vector_source_c(tx_signal), (mult, 0), (add, 0)) self.tb.connect(analog.sig_source_c(2 * numpy.pi, analog.GR_SIN_WAVE, freq_offset, 1.0), (mult, 1)) self.tb.connect(analog.noise_source_c(analog.GR_GAUSSIAN, .01), (add, 1)) self.tb.connect(add, sync) @@ -122,9 +122,9 @@ class qa_ofdm_sync_sc_cfb (gr_unittest.TestCase): [(random.randint(0, 1)*2)-1 for x in range(fft_len * random.randint(5,23))] add = blocks.add_cc() sync = digital.ofdm_sync_sc_cfb(fft_len, cp_len) - sink_freq = gr.vector_sink_f() - sink_detect = gr.vector_sink_b() - self.tb.connect(gr.vector_source_c(tx_signal), (add, 0)) + sink_freq = blocks.vector_sink_f() + sink_detect = blocks.vector_sink_b() + self.tb.connect(blocks.vector_source_c(tx_signal), (add, 0)) self.tb.connect(analog.noise_source_c(analog.GR_GAUSSIAN, .005), (add, 1)) self.tb.connect(add, sync) self.tb.connect((sync, 0), sink_freq) @@ -161,7 +161,7 @@ Detection error was: %d """ % (numpy.sum(sink_detect.data()) - n_bursts) #packets, tagname, vlen=1) #total_length = len(data) - #src = gr.vector_source_b(data, False, 1, tags) + #src = blocks.vector_source_b(data, False, 1, tags) #mod = ofdm_tx( #fft_len=fft_len, #cp_len=cp_len, @@ -176,15 +176,15 @@ Detection error was: %d """ % (numpy.sum(sink_detect.data()) - n_bursts) #throttle1 = gr.throttle(gr.sizeof_gr_complex, rate_in) #insert_zeros = digital.ts_insert_zeros_cc(tagname) #throttle2 = gr.throttle(gr.sizeof_gr_complex, rate_out) - #sink_countbursts = gr.vector_sink_c() - #head = gr.head(gr.sizeof_gr_complex, int(total_length * ratio*2)) + #sink_countbursts = blocks.vector_sink_c() + #head = blocks.head(gr.sizeof_gr_complex, int(total_length * ratio*2)) #add = gr.add_cc() #sync = digital.ofdm_sync_sc_cfb(fft_len, cp_len) - #sink_freq = gr.vector_sink_f() - #sink_detect = gr.vector_sink_b() + #sink_freq = blocks.vector_sink_f() + #sink_detect = blocks.vector_sink_b() #noise_level = 0.01 #noise = gr.noise_source_c(gr.GR_GAUSSIAN, noise_level) - #self.tb.connect(src, mod, gr.null_sink(gr.sizeof_gr_complex)) + #self.tb.connect(src, mod, blocks.null_sink(gr.sizeof_gr_complex)) #self.tb.connect(insert_zeros, sink_countbursts) #self.tb.connect(noise, (add, 1)) #self.tb.connect(add, sync) diff --git a/gr-digital/python/qa_ofdm_txrx.py b/gr-digital/python/qa_ofdm_txrx.py index 778f03f515..963fca850c 100755 --- a/gr-digital/python/qa_ofdm_txrx.py +++ b/gr-digital/python/qa_ofdm_txrx.py @@ -22,7 +22,8 @@ import numpy from gnuradio import gr, gr_unittest -import digital_swig +import digital_swig as digital +import blocks_swig as blocks class test_ofdm_txrx (gr_unittest.TestCase): @@ -38,18 +39,18 @@ class test_ofdm_txrx (gr_unittest.TestCase): #n_bytes = 100 #test_data = [random.randint(0, 255) for x in range(n_bytes)] #tx_data, tags = tagged_streams.packets_to_vectors((test_data,), len_tag_key) - #src = gr.vector_source_b(test_data, False, 1, tags) + #src = blocks.vector_source_b(test_data, False, 1, tags) #tx = ofdm_tx(frame_length_tag_key=len_tag_key) #rx = ofdm_rx(frame_length_tag_key=len_tag_key) #self.assertEqual(tx.sync_word1, rx.sync_word1) #self.assertEqual(tx.sync_word2, rx.sync_word2) - #delay = gr.delay(gr.sizeof_gr_complex, 100) - #noise = gr.noise_source_c(gr.GR_GAUSSIAN, 0.05) - #add = gr.add_cc() - #sink = gr.vector_sink_b() + #delay = blocks.delay(gr.sizeof_gr_complex, 100) + #noise = analog.noise_source_c(analog.GR_GAUSSIAN, 0.05) + #add = blocks.add_cc() + #sink = blocks.vector_sink_b() ##self.tb.connect(src, tx, add, rx, sink) ##self.tb.connect(noise, (add, 1)) - #self.tb.connect(src, tx, gr.null_sink(gr.sizeof_gr_complex)) + #self.tb.connect(src, tx, blocks.null_sink(gr.sizeof_gr_complex)) #self.tb.run() diff --git a/gr-digital/python/qa_packet_headergenerator_bb.py b/gr-digital/python/qa_packet_headergenerator_bb.py index 2e6e401566..43659c604d 100755 --- a/gr-digital/python/qa_packet_headergenerator_bb.py +++ b/gr-digital/python/qa_packet_headergenerator_bb.py @@ -21,6 +21,7 @@ from gnuradio import gr, gr_unittest import digital_swig as digital +import blocks_swig as blocks try: import pmt except: from gruel import pmt @@ -48,9 +49,9 @@ class qa_packet_headergenerator_bb (gr_unittest.TestCase): tag3.offset = 6 tag3.key = pmt.string_to_symbol(tagname) tag3.value = pmt.from_long(4) - src = gr.vector_source_b(data, False, 1, (tag1, tag2, tag3)) + src = blocks.vector_source_b(data, False, 1, (tag1, tag2, tag3)) header = digital.packet_headergenerator_bb(12, tagname) - sink = gr.vector_sink_b() + sink = blocks.vector_sink_b() self.tb.connect(src, header, sink) self.tb.run() expected_data = ( @@ -77,9 +78,9 @@ class qa_packet_headergenerator_bb (gr_unittest.TestCase): tag3.offset = 6 tag3.key = pmt.string_to_symbol(tagname) tag3.value = pmt.from_long(4) - src = gr.vector_source_b(data, False, 1, (tag1, tag2, tag3)) + src = blocks.vector_source_b(data, False, 1, (tag1, tag2, tag3)) header = digital.packet_headergenerator_bb(32, tagname) - sink = gr.vector_sink_b() + sink = blocks.vector_sink_b() self.tb.connect(src, header, sink) self.tb.run() expected_data = ( @@ -107,10 +108,10 @@ class qa_packet_headergenerator_bb (gr_unittest.TestCase): tag3.offset = 6 tag3.key = pmt.string_to_symbol(tagname) tag3.value = pmt.from_long(4) - src = gr.vector_source_b(data, False, 1, (tag1, tag2, tag3)) + src = blocks.vector_source_b(data, False, 1, (tag1, tag2, tag3)) formatter_object = digital.packet_header_default(12, tagname) header = digital.packet_headergenerator_bb(formatter_object.formatter()) - sink = gr.vector_sink_b() + sink = blocks.vector_sink_b() self.tb.connect(src, header, sink) self.tb.run() expected_data = ( @@ -137,12 +138,12 @@ class qa_packet_headergenerator_bb (gr_unittest.TestCase): tag3.offset = 6 tag3.key = pmt.string_to_symbol(tagname) tag3.value = pmt.from_long(4) - src = gr.vector_source_b(data, False, 1, (tag1, tag2, tag3)) + src = blocks.vector_source_b(data, False, 1, (tag1, tag2, tag3)) formatter_object = digital.packet_header_ofdm(occupied_carriers, 1, tagname) self.assertEqual(formatter_object.header_len(), 6) self.assertEqual(pmt.symbol_to_string(formatter_object.len_tag_key()), tagname) header = digital.packet_headergenerator_bb(formatter_object.formatter()) - sink = gr.vector_sink_b() + sink = blocks.vector_sink_b() self.tb.connect(src, header, sink) self.tb.run() expected_data = ( diff --git a/gr-digital/python/qa_packet_headerparser_b.py b/gr-digital/python/qa_packet_headerparser_b.py index aec2f96b57..da7aef69d3 100755 --- a/gr-digital/python/qa_packet_headerparser_b.py +++ b/gr-digital/python/qa_packet_headerparser_b.py @@ -43,7 +43,7 @@ class qa_packet_headerparser_b (gr_unittest.TestCase): ) tagname = "packet_len" - src = gr.vector_source_b(expected_data) + src = blocks.vector_source_b(expected_data) parser = digital.packet_headerparser_b(32, tagname) sink = blocks.message_debug() diff --git a/gr-digital/python/qa_pfb_clock_sync.py b/gr-digital/python/qa_pfb_clock_sync.py index 4d0276bcd6..3db1fd5581 100755 --- a/gr-digital/python/qa_pfb_clock_sync.py +++ b/gr-digital/python/qa_pfb_clock_sync.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2011 Free Software Foundation, Inc. +# Copyright 2011,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -23,6 +23,7 @@ from gnuradio import gr, gr_unittest import filter_swig as filter import digital_swig as digital +import blocks_swig as blocks import random, cmath class test_pfb_clock_sync(gr_unittest.TestCase): @@ -54,7 +55,7 @@ class test_pfb_clock_sync(gr_unittest.TestCase): osps) data = 10000*[complex(1,0), complex(-1,0)] - self.src = gr.vector_source_c(data, False) + self.src = blocks.vector_source_c(data, False) # pulse shaping interpolation filter rrc_taps = filter.firdes.root_raised_cosine( @@ -65,7 +66,7 @@ class test_pfb_clock_sync(gr_unittest.TestCase): ntaps) self.rrc_filter = filter.pfb_arb_resampler_ccf(sps, rrc_taps) - self.snk = gr.vector_sink_c() + self.snk = blocks.vector_sink_c() self.tb.connect(self.src, self.rrc_filter, self.test, self.snk) self.tb.run() @@ -107,7 +108,7 @@ class test_pfb_clock_sync(gr_unittest.TestCase): osps) data = 10000*[1, -1] - self.src = gr.vector_source_f(data, False) + self.src = blocks.vector_source_f(data, False) # pulse shaping interpolation filter rrc_taps = filter.firdes.root_raised_cosine( @@ -118,7 +119,7 @@ class test_pfb_clock_sync(gr_unittest.TestCase): ntaps) self.rrc_filter = filter.pfb_arb_resampler_fff(sps, rrc_taps) - self.snk = gr.vector_sink_f() + self.snk = blocks.vector_sink_f() self.tb.connect(self.src, self.rrc_filter, self.test, self.snk) self.tb.run() diff --git a/gr-digital/python/qa_pn_correlator_cc.py b/gr-digital/python/qa_pn_correlator_cc.py index 53633d04fa..14d6bcfbe1 100755 --- a/gr-digital/python/qa_pn_correlator_cc.py +++ b/gr-digital/python/qa_pn_correlator_cc.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2007,2010,2012 Free Software Foundation, Inc. +# Copyright 2007,2010,2012,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -39,10 +39,10 @@ class test_pn_correlator_cc(gr_unittest.TestCase): degree = 10 length = 2**degree-1 src = digital.glfsr_source_f(degree) - head = gr.head(gr.sizeof_float, length*length) + head = blocks.head(gr.sizeof_float, length*length) f2c = blocks.float_to_complex() corr = digital.pn_correlator_cc(degree) - dst = gr.vector_sink_c() + dst = blocks.vector_sink_c() self.tb.connect(src, head, f2c, corr, dst) self.tb.run() data = dst.data() diff --git a/gr-digital/python/qa_probe_density.py b/gr-digital/python/qa_probe_density.py index f42f00a7f7..45d651ec1c 100755 --- a/gr-digital/python/qa_probe_density.py +++ b/gr-digital/python/qa_probe_density.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2012 Free Software Foundation, Inc. +# Copyright 2012,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -22,6 +22,7 @@ from gnuradio import gr, gr_unittest import digital_swig as digital +import blocks_swig as blocks class test_probe_density(gr_unittest.TestCase): @@ -34,7 +35,7 @@ class test_probe_density(gr_unittest.TestCase): def test_001(self): src_data = [0, 1, 0, 1] expected_data = 1 - src = gr.vector_source_b(src_data) + src = blocks.vector_source_b(src_data) op = digital.probe_density_b(1) self.tb.connect(src, op) self.tb.run() @@ -46,7 +47,7 @@ class test_probe_density(gr_unittest.TestCase): def test_002(self): src_data = [1, 1, 1, 1] expected_data = 1 - src = gr.vector_source_b(src_data) + src = blocks.vector_source_b(src_data) op = digital.probe_density_b(0.01) self.tb.connect(src, op) self.tb.run() @@ -57,7 +58,7 @@ class test_probe_density(gr_unittest.TestCase): def test_003(self): src_data = [0, 1, 0, 1, 0, 1, 0, 1, 0, 1] expected_data = 0.95243 - src = gr.vector_source_b(src_data) + src = blocks.vector_source_b(src_data) op = digital.probe_density_b(0.01) self.tb.connect(src, op) self.tb.run() diff --git a/gr-digital/python/qa_scale_tags.py b/gr-digital/python/qa_scale_tags.py index deee775579..2008b0c3eb 100755 --- a/gr-digital/python/qa_scale_tags.py +++ b/gr-digital/python/qa_scale_tags.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -# Copyright 2012 Free Software Foundation, Inc. +# Copyright 2012,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -45,10 +45,10 @@ class qa_scale_tags (gr_unittest.TestCase): tagname = "packet_length" data, tags = tagged_streams.packets_to_vectors(packets, tagname) tb = gr.top_block() - src = gr.vector_source_b(data, False, 1, tags) + src = blocks.vector_source_b(data, False, 1, tags) tag_scaler = digital.scale_tags(1, tagname, 2) unpacker = blocks.packed_to_unpacked_bb(4, blocks.GR_MSB_FIRST) - snk = gr.vector_sink_b() + snk = blocks.vector_sink_b() tb.connect(src, unpacker, tag_scaler, snk) tb.run() packets = tagged_streams.vectors_to_packets(snk.data(), snk.tags(), tagname) diff --git a/gr-digital/python/qa_scrambler.py b/gr-digital/python/qa_scrambler.py index 3127a7c1e6..b4980e7816 100755 --- a/gr-digital/python/qa_scrambler.py +++ b/gr-digital/python/qa_scrambler.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2008,2010,2012 Free Software Foundation, Inc. +# Copyright 2008,2010,2012,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -22,6 +22,7 @@ from gnuradio import gr, gr_unittest import digital_swig as digital +import blocks_swig as blocks class test_scrambler(gr_unittest.TestCase): @@ -33,30 +34,30 @@ class test_scrambler(gr_unittest.TestCase): def test_scrambler_descrambler(self): src_data = (1,)*1000 - src = gr.vector_source_b(src_data, False) + src = blocks.vector_source_b(src_data, False) scrambler = digital.scrambler_bb(0x8a, 0x7F, 7) # CCSDS 7-bit scrambler descrambler = digital.descrambler_bb(0x8a, 0x7F, 7) - dst = gr.vector_sink_b() + dst = blocks.vector_sink_b() self.tb.connect(src, scrambler, descrambler, dst) self.tb.run() self.assertEqual(tuple(src_data[:-8]), dst.data()[8:]) # skip garbage during synchronization def test_additive_scrambler(self): src_data = (1,)*1000 - src = gr.vector_source_b(src_data, False) + src = blocks.vector_source_b(src_data, False) scrambler = digital.additive_scrambler_bb(0x8a, 0x7f, 7) descrambler = digital.additive_scrambler_bb(0x8a, 0x7f, 7) - dst = gr.vector_sink_b() + dst = blocks.vector_sink_b() self.tb.connect(src, scrambler, descrambler, dst) self.tb.run() self.assertEqual(src_data, dst.data()) def test_additive_scrambler_reset(self): src_data = (1,)*1000 - src = gr.vector_source_b(src_data, False) + src = blocks.vector_source_b(src_data, False) scrambler = digital.additive_scrambler_bb(0x8a, 0x7f, 7, 100) descrambler = digital.additive_scrambler_bb(0x8a, 0x7f, 7, 100) - dst = gr.vector_sink_b() + dst = blocks.vector_sink_b() self.tb.connect(src, scrambler, descrambler, dst) self.tb.run() self.assertEqual(src_data, dst.data()) diff --git a/gr-digital/python/qa_simple_correlator.py b/gr-digital/python/qa_simple_correlator.py index ff0faeb415..57312ff0dd 100755 --- a/gr-digital/python/qa_simple_correlator.py +++ b/gr-digital/python/qa_simple_correlator.py @@ -44,7 +44,7 @@ class test_simple_correlator(gr_unittest.TestCase): # Just using a RRC for some basic filter shape taps = filter.firdes.root_raised_cosine(8, 8, 1.0, 0.5, 21) - src = gr.vector_source_b(expected_result) + src = blocks.vector_source_b(expected_result) frame = digital.simple_framer(4) unpack = blocks.packed_to_unpacked_bb(1, gr.GR_MSB_FIRST) expand = filter.interp_fir_filter_fff(8, taps) @@ -52,7 +52,7 @@ class test_simple_correlator(gr_unittest.TestCase): mult2 = blocks.multiply_const_ff(2) sub1 = blocks.add_const_ff(-1) op = digital.simple_correlator(4) - dst = gr.vector_sink_b() + dst = blocks.vector_sink_b() self.tb.connect(src, frame, unpack, b2f, mult2, sub1, expand) self.tb.connect(expand, op, dst) self.tb.run() diff --git a/gr-digital/python/qa_simple_framer.py b/gr-digital/python/qa_simple_framer.py index f8c894da28..f598b393f2 100755 --- a/gr-digital/python/qa_simple_framer.py +++ b/gr-digital/python/qa_simple_framer.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2004,2007,2010,2012 Free Software Foundation, Inc. +# Copyright 2004,2007,2010,2012,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -22,6 +22,7 @@ from gnuradio import gr, gr_unittest import digital_swig as digital +import blocks_swig as blocks import math class test_simple_framer(gr_unittest.TestCase): @@ -44,9 +45,9 @@ class test_simple_framer(gr_unittest.TestCase): 0xac, 0xdd, 0xa4, 0xe2, 0xf2, 0x8c, 0x20, 0xfc, 0x02, 0x88, 0x99, 0xaa, 0xbb, 0x55, 0xac, 0xdd, 0xa4, 0xe2, 0xf2, 0x8c, 0x20, 0xfc, 0x03, 0xcc, 0xdd, 0xee, 0xff, 0x55) - src = gr.vector_source_b(src_data) + src = blocks.vector_source_b(src_data) op = digital.simple_framer(4) - dst = gr.vector_sink_b() + dst = blocks.vector_sink_b() self.tb.connect(src, op) self.tb.connect(op, dst) self.tb.run() diff --git a/gr-digital/python/qa_ts_insert_zeros.py b/gr-digital/python/qa_ts_insert_zeros.py index d13a4c1c2b..2af6832cf5 100644 --- a/gr-digital/python/qa_ts_insert_zeros.py +++ b/gr-digital/python/qa_ts_insert_zeros.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -# Copyright 2012 Free Software Foundation, Inc. +# Copyright 2012,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -38,15 +38,15 @@ class qa_ts_insert_zeros (gr_unittest.TestCase): tagname = "packet_length" data, tags = tagged_streams.packets_to_vectors(packets, tagname) tb = gr.top_block() - src = gr.vector_source_c(data, False, 1, tags) + src = blocks.vector_source_c(data, False, 1, tags) rate_in = 16000 rate_out = 48000 ratio = float(rate_out) / rate_in throttle1 = blocks.throttle(gr.sizeof_gr_complex, rate_in) insert_zeros = digital.ts_insert_zeros_cc(tagname) throttle2 = blocks.throttle(gr.sizeof_gr_complex, rate_out) - head = gr.head(gr.sizeof_gr_complex, int(n_packets * packet_length * ratio*2)) - snk = gr.vector_sink_c() + head = blocks.head(gr.sizeof_gr_complex, int(n_packets * packet_length * ratio*2)) + snk = blocks.vector_sink_c() tb.connect(src, throttle1, insert_zeros, throttle2, head, snk) tb.run() data = snk.data() diff --git a/gr-fec/python/qa_ecc_ccsds_27.py b/gr-fec/python/qa_ecc_ccsds_27.py index 52615abe23..895e683345 100755 --- a/gr-fec/python/qa_ecc_ccsds_27.py +++ b/gr-fec/python/qa_ecc_ccsds_27.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2004,2007,2010 Free Software Foundation, Inc. +# Copyright 2004,2007,2010,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -35,13 +35,13 @@ class test_ccsds_27 (gr_unittest.TestCase): def xtest_ccsds_27 (self): src_data = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10) expected = (0, 0, 0, 0, 1, 2, 3, 4, 5, 6) - src = gr.vector_source_b(src_data) + src = blocks.vector_source_b(src_data) enc = fec.encode_ccsds_27_bb() b2f = blocks.char_to_float() add = blocks.add_const_ff(-0.5) mul = blocks.multiply_const_ff(2.0) dec = fec.decode_ccsds_27_fb() - dst = gr.vector_sink_b() + dst = blocks.vector_sink_b() self.tb.connect(src, enc, b2f, add, mul, dec, dst) self.tb.run() dst_data = dst.data() diff --git a/gr-fft/python/qa_fft.py b/gr-fft/python/qa_fft.py index 0a66a2c1fc..c90eea69c5 100755 --- a/gr-fft/python/qa_fft.py +++ b/gr-fft/python/qa_fft.py @@ -87,11 +87,11 @@ class test_fft(gr_unittest.TestCase): (689.48553466796875-918.2142333984375j), (1646.539306640625-1694.1956787109375j)) - src = gr.vector_source_c(src_data) + src = blocks.vector_source_c(src_data) s2v = blocks.stream_to_vector(gr.sizeof_gr_complex, fft_size) op = fft.fft_vcc(fft_size, True, [], False) v2s = blocks.vector_to_stream(gr.sizeof_gr_complex, fft_size) - dst = gr.vector_sink_c() + dst = blocks.vector_sink_c() tb.connect(src, s2v, op, v2s, dst) tb.run() result_data = dst.data() @@ -141,11 +141,11 @@ class test_fft(gr_unittest.TestCase): expected_result = tuple([complex(primes[2*i], primes[2*i+1]) for i in range(fft_size)]) - src = gr.vector_source_c(src_data) + src = blocks.vector_source_c(src_data) s2v = blocks.stream_to_vector(gr.sizeof_gr_complex, fft_size) op = fft.fft_vcc(fft_size, False, [], False) v2s = blocks.vector_to_stream(gr.sizeof_gr_complex, fft_size) - dst = gr.vector_sink_c() + dst = blocks.vector_sink_c() tb.connect(src, s2v, op, v2s, dst) tb.run() result_data = dst.data() @@ -199,11 +199,11 @@ class test_fft(gr_unittest.TestCase): nthreads = 2 - src = gr.vector_source_c(src_data) + src = blocks.vector_source_c(src_data) s2v = blocks.stream_to_vector(gr.sizeof_gr_complex, fft_size) op = fft.fft_vcc(fft_size, False, [], False, nthreads) v2s = blocks.vector_to_stream(gr.sizeof_gr_complex, fft_size) - dst = gr.vector_sink_c() + dst = blocks.vector_sink_c() tb.connect(src, s2v, op, v2s, dst) tb.run() result_data = dst.data() diff --git a/gr-fft/python/qa_goertzel.py b/gr-fft/python/qa_goertzel.py index 27f9d370e1..33f1413b6d 100755 --- a/gr-fft/python/qa_goertzel.py +++ b/gr-fft/python/qa_goertzel.py @@ -23,6 +23,7 @@ from gnuradio import gr, gr_unittest from math import pi, cos import fft_swig as fft +import blocks_swig as blocks class test_goertzel(gr_unittest.TestCase): @@ -36,9 +37,9 @@ class test_goertzel(gr_unittest.TestCase): return [cos(2*pi*x*freq/rate) for x in range(rate)] def transform(self, src_data, rate, freq): - src = gr.vector_source_f(src_data, False) + src = blocks.vector_source_f(src_data, False) dft = fft.goertzel_fc(rate, rate, freq) - dst = gr.vector_sink_c() + dst = blocks.vector_sink_c() self.tb.connect(src, dft, dst) self.tb.run() return dst.data() diff --git a/gr-filter/examples/benchmark_filters.py b/gr-filter/examples/benchmark_filters.py index 5fd012bcc4..011147190b 100755 --- a/gr-filter/examples/benchmark_filters.py +++ b/gr-filter/examples/benchmark_filters.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2005,2006,2007 Free Software Foundation, Inc. +# Copyright 2005-2007,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -24,6 +24,7 @@ import time import random from optparse import OptionParser from gnuradio import gr +from gnuradio import blocks from gnuradio.eng_option import eng_option def make_random_complex_tuple(L): @@ -38,10 +39,10 @@ def benchmark(name, creator, dec, ntaps, total_test_size, block_size): tb = gr.top_block() taps = make_random_complex_tuple(ntaps) - src = gr.vector_source_c(make_random_complex_tuple(block_size), True) - head = gr.head(gr.sizeof_gr_complex, int(total_test_size)) + src = blocks.vector_source_c(make_random_complex_tuple(block_size), True) + head = blocks.head(gr.sizeof_gr_complex, int(total_test_size)) op = creator(dec, taps) - dst = gr.null_sink(gr.sizeof_gr_complex) + dst = blocks.null_sink(gr.sizeof_gr_complex) tb.connect(src, head, op, dst) start = time.time() tb.run() diff --git a/gr-filter/examples/channelize.py b/gr-filter/examples/channelize.py index 77d3c21968..e70817e873 100755 --- a/gr-filter/examples/channelize.py +++ b/gr-filter/examples/channelize.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2009,2012 Free Software Foundation, Inc. +# Copyright 2009,2012,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -76,13 +76,13 @@ class pfb_top_block(gr.top_block): self.signals.append(analog.sig_source_c(self._ifs, analog.GR_SIN_WAVE, f, 1)) self.connect(self.signals[i], (self.add,i)) - self.head = gr.head(gr.sizeof_gr_complex, self._N) + self.head = blocks.head(gr.sizeof_gr_complex, self._N) # Construct the channelizer filter self.pfb = filter.pfb.channelizer_ccf(self._M, self._taps, 1) # Construct a vector sink for the input signal to the channelizer - self.snk_i = gr.vector_sink_c() + self.snk_i = blocks.vector_sink_c() # Connect the blocks self.connect(self.add, self.head, self.pfb) @@ -94,7 +94,7 @@ class pfb_top_block(gr.top_block): # Create a vector sink for each of M output channels of the filter and connect it self.snks = list() for i in xrange(self._M): - self.snks.append(gr.vector_sink_c()) + self.snks.append(blocks.vector_sink_c()) self.connect((self.pfb, i), self.snks[i]) diff --git a/gr-filter/examples/chirp_channelize.py b/gr-filter/examples/chirp_channelize.py index d4d2f8e238..aedd5c4892 100755 --- a/gr-filter/examples/chirp_channelize.py +++ b/gr-filter/examples/chirp_channelize.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2009,2012 Free Software Foundation, Inc. +# Copyright 2009,2012,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -70,20 +70,20 @@ class pfb_top_block(gr.top_block): else: amp = 100 data = scipy.arange(0, amp, amp/float(self._N)) - self.vco_input = gr.vector_source_f(data, False) + self.vco_input = blocks.vector_source_f(data, False) # Build a VCO controlled by either the sinusoid or single chirp tone # Then convert this to a complex signal self.vco = blocks.vco_f(self._fs, 225, 1) self.f2c = blocks.float_to_complex() - self.head = gr.head(gr.sizeof_gr_complex, self._N) + self.head = blocks.head(gr.sizeof_gr_complex, self._N) # Construct the channelizer filter self.pfb = filter.pfb.channelizer_ccf(self._M, self._taps) # Construct a vector sink for the input signal to the channelizer - self.snk_i = gr.vector_sink_c() + self.snk_i = blocks.vector_sink_c() # Connect the blocks self.connect(self.vco_input, self.vco, self.f2c) @@ -93,7 +93,7 @@ class pfb_top_block(gr.top_block): # Create a vector sink for each of M output channels of the filter and connect it self.snks = list() for i in xrange(self._M): - self.snks.append(gr.vector_sink_c()) + self.snks.append(blocks.vector_sink_c()) self.connect((self.pfb, i), self.snks[i]) diff --git a/gr-filter/examples/decimate.py b/gr-filter/examples/decimate.py index 56ed7edff1..675073a431 100755 --- a/gr-filter/examples/decimate.py +++ b/gr-filter/examples/decimate.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2009,2012 Free Software Foundation, Inc. +# Copyright 2009,2012,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -75,7 +75,7 @@ class pfb_top_block(gr.top_block): self.signals.append(analog.sig_source_c(self._fs, analog.GR_SIN_WAVE, freqs[i], 1)) self.connect(self.signals[i], (self.add,i)) - self.head = gr.head(gr.sizeof_gr_complex, self._N) + self.head = blocks.head(gr.sizeof_gr_complex, self._N) # Construct a PFB decimator filter self.pfb = filter.pfb.decimator_ccf(self._decim, self._taps, 0) @@ -83,14 +83,14 @@ class pfb_top_block(gr.top_block): # Construct a standard FIR decimating filter self.dec = filter.fir_filter_ccf(self._decim, self._taps) - self.snk_i = gr.vector_sink_c() + self.snk_i = blocks.vector_sink_c() # Connect the blocks self.connect(self.add, self.head, self.pfb) self.connect(self.add, self.snk_i) # Create the sink for the decimated siganl - self.snk = gr.vector_sink_c() + self.snk = blocks.vector_sink_c() self.connect(self.pfb, self.snk) diff --git a/gr-filter/examples/fft_filter_ccc.py b/gr-filter/examples/fft_filter_ccc.py index 676e7d9f16..aaa3c6e6eb 100755 --- a/gr-filter/examples/fft_filter_ccc.py +++ b/gr-filter/examples/fft_filter_ccc.py @@ -2,6 +2,7 @@ from gnuradio import gr, filter from gnuradio import analog +from gnuradio import blocks from gnuradio import eng_notation from gnuradio.eng_option import eng_option from optparse import OptionParser @@ -35,12 +36,12 @@ class example_fft_filter_ccc(gr.top_block): print "Num. Taps: ", len(taps) self.src = analog.noise_source_c(analog.GR_GAUSSIAN, 1) - self.head = gr.head(gr.sizeof_gr_complex, self._nsamps) + self.head = blocks.head(gr.sizeof_gr_complex, self._nsamps) self.filt0 = filter.fft_filter_ccc(self._decim, taps) - self.vsnk_src = gr.vector_sink_c() - self.vsnk_out = gr.vector_sink_c() + self.vsnk_src = blocks.vector_sink_c() + self.vsnk_out = blocks.vector_sink_c() self.connect(self.src, self.head, self.vsnk_src) self.connect(self.head, self.filt0, self.vsnk_out) diff --git a/gr-filter/examples/fir_filter_ccc.py b/gr-filter/examples/fir_filter_ccc.py index 6e68fc0af7..0991124b8d 100755 --- a/gr-filter/examples/fir_filter_ccc.py +++ b/gr-filter/examples/fir_filter_ccc.py @@ -2,6 +2,7 @@ from gnuradio import gr, filter from gnuradio import analog +from gnuradio import blocks from gnuradio import eng_notation from gnuradio.eng_option import eng_option from optparse import OptionParser @@ -32,12 +33,12 @@ class example_fir_filter_ccc(gr.top_block): print "Num. Taps: ", len(taps) self.src = analog.noise_source_c(analog.GR_GAUSSIAN, 1) - self.head = gr.head(gr.sizeof_gr_complex, self._nsamps) + self.head = blocks.head(gr.sizeof_gr_complex, self._nsamps) self.filt0 = filter.fir_filter_ccc(self._decim, taps) - self.vsnk_src = gr.vector_sink_c() - self.vsnk_out = gr.vector_sink_c() + self.vsnk_src = blocks.vector_sink_c() + self.vsnk_out = blocks.vector_sink_c() self.connect(self.src, self.head, self.vsnk_src) self.connect(self.head, self.filt0, self.vsnk_out) diff --git a/gr-filter/examples/fir_filter_fff.py b/gr-filter/examples/fir_filter_fff.py index a1a8ab9573..549b543498 100755 --- a/gr-filter/examples/fir_filter_fff.py +++ b/gr-filter/examples/fir_filter_fff.py @@ -2,6 +2,7 @@ from gnuradio import gr, filter from gnuradio import analog +from gnuradio import blocks from gnuradio import eng_notation from gnuradio.eng_option import eng_option from optparse import OptionParser @@ -32,12 +33,12 @@ class example_fir_filter_fff(gr.top_block): print "Num. Taps: ", len(taps) self.src = analog.noise_source_f(analog.GR_GAUSSIAN, 1) - self.head = gr.head(gr.sizeof_float, self._nsamps) + self.head = blocks.head(gr.sizeof_float, self._nsamps) self.filt0 = filter.fir_filter_fff(self._decim, taps) - self.vsnk_src = gr.vector_sink_f() - self.vsnk_out = gr.vector_sink_f() + self.vsnk_src = blocks.vector_sink_f() + self.vsnk_out = blocks.vector_sink_f() self.connect(self.src, self.head, self.vsnk_src) self.connect(self.head, self.filt0, self.vsnk_out) diff --git a/gr-filter/examples/interpolate.py b/gr-filter/examples/interpolate.py index e0d4cc14b1..40bab7b1f1 100755 --- a/gr-filter/examples/interpolate.py +++ b/gr-filter/examples/interpolate.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2009,2012 Free Software Foundation, Inc. +# Copyright 2009,2012,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -89,14 +89,14 @@ class pfb_top_block(gr.top_block): self.signal2 = analog.sig_source_c(self._fs, analog.GR_SIN_WAVE, freq2, 0.5) self.signal = blocks.add_cc() - self.head = gr.head(gr.sizeof_gr_complex, self._N) + self.head = blocks.head(gr.sizeof_gr_complex, self._N) # Construct the PFB interpolator filter self.pfb = filter.pfb.interpolator_ccf(self._interp, self._taps) # Construct the PFB arbitrary resampler filter self.pfb_ar = filter.pfb.arb_resampler_ccf(self._ainterp, self._taps2, flt_size) - self.snk_i = gr.vector_sink_c() + self.snk_i = blocks.vector_sink_c() #self.pfb_ar.pfb.print_taps() #self.pfb.pfb.print_taps() @@ -109,8 +109,8 @@ class pfb_top_block(gr.top_block): self.connect(self.signal, self.snk_i) # Create the sink for the interpolated signals - self.snk1 = gr.vector_sink_c() - self.snk2 = gr.vector_sink_c() + self.snk1 = blocks.vector_sink_c() + self.snk2 = blocks.vector_sink_c() self.connect(self.pfb, self.snk1) self.connect(self.pfb_ar, self.snk2) diff --git a/gr-filter/examples/reconstruction.py b/gr-filter/examples/reconstruction.py index 75c224e79c..85704bda2b 100755 --- a/gr-filter/examples/reconstruction.py +++ b/gr-filter/examples/reconstruction.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2010,2012 Free Software Foundation, Inc. +# Copyright 2010,2012,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -22,6 +22,7 @@ from gnuradio import gr, digital from gnuradio import filter +from gnuradio import blocks try: from gnuradio import channels @@ -68,7 +69,7 @@ def main(): data = scipy.random.randint(0, 256, N) rrc_taps = filter.firdes.root_raised_cosine(1, 2, 1, 0.35, 41) - src = gr.vector_source_b(data.astype(scipy.uint8).tolist(), False) + src = blocks.vector_source_b(data.astype(scipy.uint8).tolist(), False) mod = digital.bpsk_mod(samples_per_symbol=2) chan = filter.channel_model(npwr) rrc = filter.fft_filter_ccc(1, rrc_taps) @@ -79,8 +80,8 @@ def main(): # Put the pieces back together again syn_taps = [nchans*t for t in proto_taps] synthesizer = filter.pfb_synthesizer_ccf(nchans, syn_taps, True) - src_snk = gr.vector_sink_c() - snk = gr.vector_sink_c() + src_snk = blocks.vector_sink_c() + snk = blocks.vector_sink_c() # Remap the location of the channels # Can be done in synth or channelizer (watch out for rotattions in @@ -96,7 +97,7 @@ def main(): for i in xrange(nchans): tb.connect((channelizer,i), (synthesizer, i)) - vsnk.append(gr.vector_sink_c()) + vsnk.append(blocks.vector_sink_c()) tb.connect((channelizer,i), vsnk[i]) tb.connect(synthesizer, snk) diff --git a/gr-filter/examples/resampler.py b/gr-filter/examples/resampler.py index c2a24116fc..e329f062d0 100755 --- a/gr-filter/examples/resampler.py +++ b/gr-filter/examples/resampler.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2009,2012 Free Software Foundation, Inc. +# Copyright 2009,2012,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -22,6 +22,7 @@ from gnuradio import gr from gnuradio import filter +from gnuradio import blocks import sys try: @@ -54,7 +55,7 @@ class mytb(gr.top_block): self.src = analog.sig_source_c(fs_in, analog.GR_SIN_WAVE, fc, 1) #self.src = analog.noise_source_c(analog.GR_GAUSSIAN, 1) - self.head = gr.head(gr.sizeof_gr_complex, N) + self.head = blocks.head(gr.sizeof_gr_complex, N) # A resampler with our taps self.resamp_0 = filter.pfb.arb_resampler_ccf(rerate, taps, @@ -67,9 +68,9 @@ class mytb(gr.top_block): # specify the out-of-band rejection (default=80). self.resamp_1 = filter.pfb.arb_resampler_ccf(rerate) - self.snk_in = gr.vector_sink_c() - self.snk_0 = gr.vector_sink_c() - self.snk_1 = gr.vector_sink_c() + self.snk_in = blocks.vector_sink_c() + self.snk_0 = blocks.vector_sink_c() + self.snk_1 = blocks.vector_sink_c() self.connect(self.src, self.head, self.snk_in) self.connect(self.head, self.resamp_0, self.snk_0) diff --git a/gr-filter/examples/synth_filter.py b/gr-filter/examples/synth_filter.py index 505141614a..5382127b35 100755 --- a/gr-filter/examples/synth_filter.py +++ b/gr-filter/examples/synth_filter.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2010,2012 Free Software Foundation, Inc. +# Copyright 2010,2012,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -22,6 +22,7 @@ from gnuradio import gr from gnuradio import filter +from gnuradio import blocks import sys try: @@ -60,8 +61,8 @@ def main(): len(taps)/nchans) filtbank = filter.pfb_synthesizer_ccf(nchans, taps) - head = gr.head(gr.sizeof_gr_complex, N) - snk = gr.vector_sink_c() + head = blocks.head(gr.sizeof_gr_complex, N) + snk = blocks.vector_sink_c() tb = gr.top_block() tb.connect(filtbank, head, snk) diff --git a/gr-filter/examples/synth_to_chan.py b/gr-filter/examples/synth_to_chan.py index 5ea4d8ee47..9e682021b7 100755 --- a/gr-filter/examples/synth_to_chan.py +++ b/gr-filter/examples/synth_to_chan.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2010,2012 Free Software Foundation, Inc. +# Copyright 2010,2012,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -68,10 +68,10 @@ def main(): channelizer = filter.pfb.channelizer_ccf(nchans, chtaps) noise_level = 0.01 - head = gr.head(gr.sizeof_gr_complex, N) + head = blocks.head(gr.sizeof_gr_complex, N) noise = analog.noise_source_c(analog.GR_GAUSSIAN, noise_level) addnoise = blocks.add_cc() - snk_synth = gr.vector_sink_c() + snk_synth = blocks.vector_sink_c() tb = gr.top_block() @@ -85,7 +85,7 @@ def main(): tb.connect(si, fmtx[i], (filtbank, i)) for i in xrange(nchans): - snk.append(gr.vector_sink_c()) + snk.append(blocks.vector_sink_c()) tb.connect((channelizer, i), snk[i]) tb.run() diff --git a/gr-filter/include/filter/freq_xlating_fir_filter_XXX.h.t b/gr-filter/include/filter/freq_xlating_fir_filter_XXX.h.t index 88e15f823d..7aa4a55cc8 100644 --- a/gr-filter/include/filter/freq_xlating_fir_filter_XXX.h.t +++ b/gr-filter/include/filter/freq_xlating_fir_filter_XXX.h.t @@ -30,7 +30,6 @@ #include <filter/api.h> #include <gr_sync_decimator.h> -#include <gr_rotator.h> namespace gr { namespace filter { diff --git a/gr-filter/lib/CMakeLists.txt b/gr-filter/lib/CMakeLists.txt index 5fa06701d7..3164e7ad54 100644 --- a/gr-filter/lib/CMakeLists.txt +++ b/gr-filter/lib/CMakeLists.txt @@ -94,6 +94,7 @@ include_directories( ${CMAKE_CURRENT_BINARY_DIR} ${GR_FILTER_INCLUDE_DIRS} ${GR_FFT_INCLUDE_DIRS} + ${GR_BLOCKS_INCLUDE_DIRS} ${GNURADIO_CORE_INCLUDE_DIRS} ${VOLK_INCLUDE_DIRS} ${GRUEL_INCLUDE_DIRS} @@ -163,6 +164,7 @@ endif(MSVC) list(APPEND filter_libs gnuradio-core gnuradio-fft + gnuradio-blocks volk ${Boost_LIBRARIES} ) diff --git a/gr-filter/lib/freq_xlating_fir_filter_XXX_impl.h.t b/gr-filter/lib/freq_xlating_fir_filter_XXX_impl.h.t index 0cf976d582..00222cac00 100644 --- a/gr-filter/lib/freq_xlating_fir_filter_XXX_impl.h.t +++ b/gr-filter/lib/freq_xlating_fir_filter_XXX_impl.h.t @@ -31,6 +31,7 @@ #include <filter/api.h> #include <filter/fir_filter.h> #include <filter/@BASE_NAME@.h> +#include <blocks/rotator.h> namespace gr { namespace filter { @@ -40,7 +41,7 @@ namespace gr { protected: std::vector<@TAP_TYPE@> d_proto_taps; kernel::@CFIR_TYPE@ *d_composite_fir; - gr_rotator d_r; + blocks::rotator d_r; double d_center_freq; double d_sampling_freq; bool d_updated; diff --git a/gr-filter/python/qa_adaptive_fir_filter.py b/gr-filter/python/qa_adaptive_fir_filter.py index cadce52044..e8233f76ae 100755 --- a/gr-filter/python/qa_adaptive_fir_filter.py +++ b/gr-filter/python/qa_adaptive_fir_filter.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2008,2010,2012 Free Software Foundation, Inc. +# Copyright 2008,2010,2012,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -21,6 +21,7 @@ from gnuradio import gr, gr_unittest import filter_swig as filter +import blocks_swig as blocks class test_adaptive_filter(gr_unittest.TestCase): @@ -61,9 +62,9 @@ class test_adaptive_filter(gr_unittest.TestCase): (50+50j), (50+50j), (50+50j), (50+50j), (50+50j), (50+50j), (50+50j), (50+50j), (50+50j), (50+50j), (50+50j), (50+50j)) - src = gr.vector_source_c(src_data) + src = blocks.vector_source_c(src_data) op = filter.adaptive_fir_ccf("test", 1, 20*[0.5, 0.5]) - dst = gr.vector_sink_c() + dst = blocks.vector_sink_c() self.tb.connect(src, op, dst) self.tb.run() result_data = dst.data() @@ -80,9 +81,9 @@ class test_adaptive_filter(gr_unittest.TestCase): (50+50j), (50+50j), (50+50j), (50+50j), (50+50j), (50+50j), (50+50j), (50+50j), (50+50j)) - src = gr.vector_source_c(src_data) + src = blocks.vector_source_c(src_data) op = filter.adaptive_fir_ccf("test", 4, 20*[0.5, 0.5]) - dst = gr.vector_sink_c() + dst = blocks.vector_sink_c() self.tb.connect(src, op, dst) self.tb.run() result_data = dst.data() @@ -124,9 +125,9 @@ class test_adaptive_filter(gr_unittest.TestCase): (-50+150j), (-50+150j), (-50+150j), (-50+150j), (-50+150j), (-50+150j), (-50+150j), (-50+150j), (-50+150j), (-50+150j), (-50+150j), (-50+150j), (-50+150j), (-50+150j), (-50+150j)) - src = gr.vector_source_c(src_data) + src = blocks.vector_source_c(src_data) op = filter.adaptive_fir_ccc("test", 1, 20*[0.5+1j, 0.5+1j]) - dst = gr.vector_sink_c() + dst = blocks.vector_sink_c() self.tb.connect(src, op, dst) self.tb.run() result_data = dst.data() @@ -146,9 +147,9 @@ class test_adaptive_filter(gr_unittest.TestCase): (-50+150j), (-50+150j), (-50+150j), (-50+150j), (-50+150j), (-50+150j), (-50+150j), (-50+150j), (-50+150j), (-50+150j), (-50+150j)) - src = gr.vector_source_c(src_data) + src = blocks.vector_source_c(src_data) op = filter.adaptive_fir_ccc("test", 4, 20*[0.5+1j, 0.5+1j]) - dst = gr.vector_sink_c() + dst = blocks.vector_sink_c() self.tb.connect(src, op, dst) self.tb.run() result_data = dst.data() diff --git a/gr-filter/python/qa_dc_blocker.py b/gr-filter/python/qa_dc_blocker.py index b9df06b453..29a05fb550 100755 --- a/gr-filter/python/qa_dc_blocker.py +++ b/gr-filter/python/qa_dc_blocker.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2011,2012 Free Software Foundation, Inc. +# Copyright 2011-2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -22,6 +22,7 @@ from gnuradio import gr, gr_unittest import filter_swig as filter +import blocks_swig as blocks class test_dc_blocker(gr_unittest.TestCase): @@ -38,9 +39,9 @@ class test_dc_blocker(gr_unittest.TestCase): (0.979156494140625+0j), (-0.02081298828125+0j), (-0.02072429656982422+0j)) - src = gr.vector_source_c(src_data) + src = blocks.vector_source_c(src_data) op = filter.dc_blocker_cc(32, True) - dst = gr.vector_sink_c() + dst = blocks.vector_sink_c() self.tb.connect (src, op, dst) self.tb.run() @@ -56,9 +57,9 @@ class test_dc_blocker(gr_unittest.TestCase): (0.96875+0j), (-0.0302734375+0j), (-0.029296875+0j)) - src = gr.vector_source_c(src_data) + src = blocks.vector_source_c(src_data) op = filter.dc_blocker_cc(32, False) - dst = gr.vector_sink_c() + dst = blocks.vector_sink_c() self.tb.connect (src, op, dst) self.tb.run() @@ -75,9 +76,9 @@ class test_dc_blocker(gr_unittest.TestCase): (0.979156494140625), (-0.02081298828125), (-0.02072429656982422)) - src = gr.vector_source_f(src_data) + src = blocks.vector_source_f(src_data) op = filter.dc_blocker_ff(32, True) - dst = gr.vector_sink_f() + dst = blocks.vector_sink_f() self.tb.connect (src, op, dst) self.tb.run() @@ -93,9 +94,9 @@ class test_dc_blocker(gr_unittest.TestCase): (0.96875), (-0.0302734375), (-0.029296875)) - src = gr.vector_source_f(src_data) + src = blocks.vector_source_f(src_data) op = filter.dc_blocker_ff(32, False) - dst = gr.vector_sink_f() + dst = blocks.vector_sink_f() self.tb.connect (src, op, dst) self.tb.run() diff --git a/gr-filter/python/qa_fft_filter.py b/gr-filter/python/qa_fft_filter.py index cb5416373f..9e0008d7c6 100755 --- a/gr-filter/python/qa_fft_filter.py +++ b/gr-filter/python/qa_fft_filter.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2004,2005,2007,2010,2012 Free Software Foundation, Inc. +# Copyright 2004,2005,2007,2010,2012,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -22,6 +22,7 @@ from gnuradio import gr, gr_unittest import filter_swig as filter +import blocks_swig as blocks import sys import random @@ -44,10 +45,10 @@ def reference_filter_ccc(dec, taps, input): compute result using conventional fir filter """ tb = gr.top_block() - #src = gr.vector_source_c(((0,) * (len(taps) - 1)) + input) - src = gr.vector_source_c(input) + #src = blocks.vector_source_c(((0,) * (len(taps) - 1)) + input) + src = blocks.vector_source_c(input) op = filter.fir_filter_ccc(dec, taps) - dst = gr.vector_sink_c() + dst = blocks.vector_sink_c() tb.connect(src, op, dst) tb.run() return dst.data() @@ -57,10 +58,10 @@ def reference_filter_fff(dec, taps, input): compute result using conventional fir filter """ tb = gr.top_block() - #src = gr.vector_source_f(((0,) * (len(taps) - 1)) + input) - src = gr.vector_source_f(input) + #src = blocks.vector_source_f(((0,) * (len(taps) - 1)) + input) + src = blocks.vector_source_f(input) op = filter.fir_filter_fff(dec, taps) - dst = gr.vector_sink_f() + dst = blocks.vector_sink_f() tb.connect(src, op, dst) tb.run() return dst.data() @@ -96,9 +97,9 @@ class test_fft_filter(gr_unittest.TestCase): src_data = (0,1,2,3,4,5,6,7) taps = (1,) expected_result = tuple([complex(x) for x in (0,1,2,3,4,5,6,7)]) - src = gr.vector_source_c(src_data) + src = blocks.vector_source_c(src_data) op = filter.fft_filter_ccc(1, taps) - dst = gr.vector_sink_c() + dst = blocks.vector_sink_c() tb.connect(src, op, dst) tb.run() result_data = dst.data() @@ -114,9 +115,9 @@ class test_fft_filter(gr_unittest.TestCase): taps = (2,) nthreads = 2 expected_result = tuple([2 * complex(x) for x in (0,1,2,3,4,5,6,7)]) - src = gr.vector_source_c(src_data) + src = blocks.vector_source_c(src_data) op = filter.fft_filter_ccc(1, taps, nthreads) - dst = gr.vector_sink_c() + dst = blocks.vector_sink_c() tb.connect(src, op, dst) tb.run() result_data = dst.data() @@ -129,9 +130,9 @@ class test_fft_filter(gr_unittest.TestCase): src_data = (0,1,2,3,4,5,6,7) taps = (2,) expected_result = tuple([2 * complex(x) for x in (0,1,2,3,4,5,6,7)]) - src = gr.vector_source_c(src_data) + src = blocks.vector_source_c(src_data) op = filter.fft_filter_ccc(1, taps) - dst = gr.vector_sink_c() + dst = blocks.vector_sink_c() tb.connect(src, op, dst) tb.run() result_data = dst.data() @@ -150,9 +151,9 @@ class test_fft_filter(gr_unittest.TestCase): taps = make_random_complex_tuple(ntaps) expected_result = reference_filter_ccc(1, taps, src_data) - src = gr.vector_source_c(src_data) + src = blocks.vector_source_c(src_data) op = filter.fft_filter_ccc(1, taps) - dst = gr.vector_sink_c() + dst = blocks.vector_sink_c() tb = gr.top_block() tb.connect(src, op, dst) tb.run() @@ -171,9 +172,9 @@ class test_fft_filter(gr_unittest.TestCase): taps = make_random_complex_tuple(ntaps) expected_result = reference_filter_ccc(dec, taps, src_data) - src = gr.vector_source_c(src_data) + src = blocks.vector_source_c(src_data) op = filter.fft_filter_ccc(dec, taps) - dst = gr.vector_sink_c() + dst = blocks.vector_sink_c() tb = gr.top_block() tb.connect(src, op, dst) tb.run() @@ -195,9 +196,9 @@ class test_fft_filter(gr_unittest.TestCase): taps = make_random_complex_tuple(ntaps) expected_result = reference_filter_ccc(dec, taps, src_data) - src = gr.vector_source_c(src_data) + src = blocks.vector_source_c(src_data) op = filter.fft_filter_ccc(dec, taps, nthreads) - dst = gr.vector_sink_c() + dst = blocks.vector_sink_c() tb = gr.top_block() tb.connect(src, op, dst) tb.run() @@ -215,9 +216,9 @@ class test_fft_filter(gr_unittest.TestCase): src_data = (0,1,2,3,4,5,6,7) taps = (1,) expected_result = tuple([float(x) for x in (0,1,2,3,4,5,6,7)]) - src = gr.vector_source_f(src_data) + src = blocks.vector_source_f(src_data) op = filter.fft_filter_fff(1, taps) - dst = gr.vector_sink_f() + dst = blocks.vector_sink_f() tb.connect(src, op, dst) tb.run() result_data = dst.data() @@ -231,9 +232,9 @@ class test_fft_filter(gr_unittest.TestCase): src_data = (0,1,2,3,4,5,6,7) taps = (2,) expected_result = tuple([2 * float(x) for x in (0,1,2,3,4,5,6,7)]) - src = gr.vector_source_f(src_data) + src = blocks.vector_source_f(src_data) op = filter.fft_filter_fff(1, taps) - dst = gr.vector_sink_f() + dst = blocks.vector_sink_f() tb.connect(src, op, dst) tb.run() result_data = dst.data() @@ -248,9 +249,9 @@ class test_fft_filter(gr_unittest.TestCase): taps = (2,) nthreads = 2 expected_result = tuple([2 * float(x) for x in (0,1,2,3,4,5,6,7)]) - src = gr.vector_source_f(src_data) + src = blocks.vector_source_f(src_data) op = filter.fft_filter_fff(1, taps, nthreads) - dst = gr.vector_sink_f() + dst = blocks.vector_sink_f() tb.connect(src, op, dst) tb.run() result_data = dst.data() @@ -266,9 +267,9 @@ class test_fft_filter(gr_unittest.TestCase): taps = make_random_float_tuple(ntaps) expected_result = reference_filter_fff(1, taps, src_data) - src = gr.vector_source_f(src_data) + src = blocks.vector_source_f(src_data) op = filter.fft_filter_fff(1, taps) - dst = gr.vector_sink_f() + dst = blocks.vector_sink_f() tb = gr.top_block() tb.connect(src, op, dst) tb.run() @@ -296,9 +297,9 @@ class test_fft_filter(gr_unittest.TestCase): taps = make_random_float_tuple(ntaps) expected_result = reference_filter_fff(1, taps, src_data) - src = gr.vector_source_f(src_data) + src = blocks.vector_source_f(src_data) op = filter.fft_filter_fff(1, taps) - dst = gr.vector_sink_f() + dst = blocks.vector_sink_f() tb = gr.top_block() tb.connect(src, op, dst) tb.run() @@ -317,9 +318,9 @@ class test_fft_filter(gr_unittest.TestCase): taps = make_random_float_tuple(ntaps) expected_result = reference_filter_fff(dec, taps, src_data) - src = gr.vector_source_f(src_data) + src = blocks.vector_source_f(src_data) op = filter.fft_filter_fff(dec, taps) - dst = gr.vector_sink_f() + dst = blocks.vector_sink_f() tb = gr.top_block() tb.connect(src, op, dst) tb.run() @@ -340,9 +341,9 @@ class test_fft_filter(gr_unittest.TestCase): taps = make_random_float_tuple(ntaps) expected_result = reference_filter_fff(dec, taps, src_data) - src = gr.vector_source_f(src_data) + src = blocks.vector_source_f(src_data) op = filter.fft_filter_fff(dec, taps, nthreads) - dst = gr.vector_sink_f() + dst = blocks.vector_sink_f() tb = gr.top_block() tb.connect(src, op, dst) tb.run() diff --git a/gr-filter/python/qa_filter_delay_fc.py b/gr-filter/python/qa_filter_delay_fc.py index 420d6fb05f..9ec1d9d582 100755 --- a/gr-filter/python/qa_filter_delay_fc.py +++ b/gr-filter/python/qa_filter_delay_fc.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2004,2007,2010,2012 Free Software Foundation, Inc. +# Copyright 2004,2007,2010,2012,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -22,6 +22,7 @@ from gnuradio import gr, gr_unittest import filter_swig as filter +import blocks_swig as blocks import math def sin_source_f(samp_rate, freq, amp, N): @@ -114,8 +115,8 @@ class test_filter_delay_fc(gr_unittest.TestCase): ntaps = 51 N = int(ntaps + sampling_freq * 0.10) data = sin_source_f(sampling_freq, sampling_freq * 0.10, 1.0, N) - src1 = gr.vector_source_f(data) - dst2 = gr.vector_sink_c() + src1 = blocks.vector_source_f(data) + dst2 = blocks.vector_sink_c() # calculate taps taps = filter.firdes_hilbert(ntaps) @@ -205,8 +206,8 @@ class test_filter_delay_fc(gr_unittest.TestCase): ntaps = 51 N = int(ntaps + sampling_freq * 0.10) data = sin_source_f(sampling_freq, sampling_freq * 0.10, 1.0, N) - src1 = gr.vector_source_f(data) - dst2 = gr.vector_sink_c() + src1 = blocks.vector_source_f(data) + dst2 = blocks.vector_sink_c() # calculate taps taps = filter.firdes_hilbert(ntaps) @@ -298,13 +299,13 @@ class test_filter_delay_fc(gr_unittest.TestCase): data1 = sin_source_f(sampling_freq, sampling_freq * 0.10, 1.0, N) data2 = cos_source_f(sampling_freq, sampling_freq * 0.10, 1.0, N) - src1 = gr.vector_source_f(data1) - src2 = gr.vector_source_f(data2) + src1 = blocks.vector_source_f(data1) + src2 = blocks.vector_source_f(data2) taps = filter.firdes_hilbert(ntaps) hd = filter.filter_delay_fc(taps) - dst2 = gr.vector_sink_c() + dst2 = blocks.vector_sink_c() tb.connect(src1, (hd,0)) tb.connect(src2, (hd,1)) diff --git a/gr-filter/python/qa_fir_filter.py b/gr-filter/python/qa_fir_filter.py index 2a61498a26..0b44f1cac4 100755 --- a/gr-filter/python/qa_fir_filter.py +++ b/gr-filter/python/qa_fir_filter.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2008,2010,2012 Free Software Foundation, Inc. +# Copyright 2008,2010,2012,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -21,6 +21,7 @@ from gnuradio import gr, gr_unittest import filter_swig as filter +import blocks_swig as blocks class test_filter(gr_unittest.TestCase): @@ -55,9 +56,9 @@ class test_filter(gr_unittest.TestCase): 50.0, 50.0, 50.0, 50.0, 50.0, 50.0, 50.0, 50.0, 50.0, 50.0, 50.0, 50.0, 50.0, 50.0, 50.0, 50.0, 50.0, 50.0, 50.0) - src = gr.vector_source_f(src_data) + src = blocks.vector_source_f(src_data) op = filter.fir_filter_fff(1, 20*[0.5, 0.5]) - dst = gr.vector_sink_f() + dst = blocks.vector_sink_f() self.tb.connect(src, op, dst) self.tb.run() result_data = dst.data() @@ -70,9 +71,9 @@ class test_filter(gr_unittest.TestCase): 50.0, 50.0, 50.0, 50.0, 50.0, 50.0, 50.0, 50.0, 50.0, 50.0, 50.0, 50.0, 50.0, 50.0, 50.0, 50.0, 50.0, 50.0, 50.0, 50.0, 50.0, 50.0, 50.0, 50.0) - src = gr.vector_source_f(src_data) + src = blocks.vector_source_f(src_data) op = filter.fir_filter_fff(4, 20*[0.5, 0.5]) - dst = gr.vector_sink_f() + dst = blocks.vector_sink_f() self.tb.connect(src, op, dst) self.tb.run() result_data = dst.data() @@ -109,9 +110,9 @@ class test_filter(gr_unittest.TestCase): (50+50j), (50+50j), (50+50j), (50+50j), (50+50j), (50+50j), (50+50j), (50+50j), (50+50j), (50+50j), (50+50j), (50+50j)) - src = gr.vector_source_c(src_data) + src = blocks.vector_source_c(src_data) op = filter.fir_filter_ccf(1, 20*[0.5, 0.5]) - dst = gr.vector_sink_c() + dst = blocks.vector_sink_c() self.tb.connect(src, op, dst) self.tb.run() result_data = dst.data() @@ -128,9 +129,9 @@ class test_filter(gr_unittest.TestCase): (50+50j), (50+50j), (50+50j), (50+50j), (50+50j), (50+50j), (50+50j), (50+50j), (50+50j)) - src = gr.vector_source_c(src_data) + src = blocks.vector_source_c(src_data) op = filter.fir_filter_ccf(4, 20*[0.5, 0.5]) - dst = gr.vector_sink_c() + dst = blocks.vector_sink_c() self.tb.connect(src, op, dst) self.tb.run() result_data = dst.data() @@ -172,9 +173,9 @@ class test_filter(gr_unittest.TestCase): (-50+150j), (-50+150j), (-50+150j), (-50+150j), (-50+150j), (-50+150j), (-50+150j), (-50+150j), (-50+150j), (-50+150j), (-50+150j), (-50+150j), (-50+150j), (-50+150j), (-50+150j)) - src = gr.vector_source_c(src_data) + src = blocks.vector_source_c(src_data) op = filter.fir_filter_ccc(1, 20*[0.5+1j, 0.5+1j]) - dst = gr.vector_sink_c() + dst = blocks.vector_sink_c() self.tb.connect(src, op, dst) self.tb.run() result_data = dst.data() @@ -188,9 +189,9 @@ class test_filter(gr_unittest.TestCase): expected_data = ((7.537424837948042e-20+7.537424837948042e-20j), (9.131923434324563e-05+9.131923434324563e-05j), (0.0003317668742965907+0.0003317668742965907j), (0.0007230418268591166+0.0007230418268591166j), (0.0012087896466255188+0.0012087896466255188j), (0.0013292605290189385+0.0013292605290189385j), (0.001120875240303576+0.001120875240303576j), (0.000744672492146492+0.000744672492146492j), (0.000429437990533188+0.000429437990533188j), (2.283908543176949e-05+2.283908543176949e-05j), (-0.0002245186478830874-0.0002245186478830874j), (-0.0001157080550910905-0.0001157080550910905j), (0.00041409023106098175+0.00041409023106098175j), (0.0009017843985930085+0.0009017843985930085j), (0.0012520025484263897+0.0012520025484263897j), (0.0014116164529696107+0.0014116164529696107j), (0.001393353333696723+0.001393353333696723j), (0.000912194955162704+0.000912194955162704j), (0.00022649182938039303+0.00022649182938039303j), (-0.00031363096786662936-0.00031363096786662936j), (-0.0003966730728279799-0.0003966730728279799j), (-0.00023757052258588374-0.00023757052258588374j), (0.00021952332463115454+0.00021952332463115454j), (0.0009092430118471384+0.0009092430118471384j), (0.001662317430600524+0.001662317430600524j), (0.0019024648936465383+0.0019024648936465383j), (0.0015955769922584295+0.0015955769922584295j), (0.0009144138311967254+0.0009144138311967254j), (0.0001872836146503687+0.0001872836146503687j), (-0.000581968342885375-0.000581968342885375j), (-0.0009886166080832481-0.0009886166080832481j), (-0.0007480768254026771-0.0007480768254026771j), (0.00018211957649327815+0.00018211957649327815j), (0.0012042406015098095+0.0012042406015098095j), (0.0020200139842927456+0.0020200139842927456j), (0.0023816542234271765+0.0023816542234271765j), (0.002195809967815876+0.002195809967815876j), (0.0012113333214074373+0.0012113333214074373j), (-0.00014088614261709154-0.00014088614261709154j), (-0.0012574587017297745-0.0012574587017297745j)) taps = filter.firdes.low_pass(1, 1, 0.1, 0.01) - src = gr.vector_source_c(src_data) + src = blocks.vector_source_c(src_data) op = filter.fir_filter_ccc(1, taps) - dst = gr.vector_sink_c() + dst = blocks.vector_sink_c() self.tb.connect(src, op, dst) self.tb.run() result_data = dst.data() @@ -209,9 +210,9 @@ class test_filter(gr_unittest.TestCase): (-50+150j), (-50+150j), (-50+150j), (-50+150j), (-50+150j), (-50+150j), (-50+150j), (-50+150j), (-50+150j), (-50+150j), (-50+150j)) - src = gr.vector_source_c(src_data) + src = blocks.vector_source_c(src_data) op = filter.fir_filter_ccc(4, 20*[0.5+1j, 0.5+1j]) - dst = gr.vector_sink_c() + dst = blocks.vector_sink_c() self.tb.connect(src, op, dst) self.tb.run() result_data = dst.data() @@ -252,9 +253,9 @@ class test_filter(gr_unittest.TestCase): (50+100j), (50+100j), (50+100j), (50+100j), (50+100j), (50+100j), (50+100j), (50+100j), (50+100j), (50+100j), (50+100j), (50+100j), (50+100j), (50+100j), (50+100j)) - src = gr.vector_source_s(src_data) + src = blocks.vector_source_s(src_data) op = filter.fir_filter_scc(1, 20*[0.5+1j, 0.5+1j]) - dst = gr.vector_sink_c() + dst = blocks.vector_sink_c() self.tb.connect(src, op, dst) self.tb.run() result_data = dst.data() @@ -271,9 +272,9 @@ class test_filter(gr_unittest.TestCase): (50+100j), (50+100j), (50+100j), (50+100j), (50+100j), (50+100j), (50+100j), (50+100j), (50+100j), (50+100j), (50+100j), (50+100j), (50+100j), (50+100j), (50+100j)) - src = gr.vector_source_s(src_data) + src = blocks.vector_source_s(src_data) op = filter.fir_filter_scc(4, 20*[0.5+1j, 0.5+1j]) - dst = gr.vector_sink_c() + dst = blocks.vector_sink_c() self.tb.connect(src, op, dst) self.tb.run() result_data = dst.data() @@ -291,9 +292,9 @@ class test_filter(gr_unittest.TestCase): 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50) - src = gr.vector_source_f(src_data) + src = blocks.vector_source_f(src_data) op = filter.fir_filter_fsf(1, 20*[0.5, 0.5]) - dst = gr.vector_sink_s() + dst = blocks.vector_sink_s() self.tb.connect(src, op, dst) self.tb.run() result_data = dst.data() @@ -305,9 +306,9 @@ class test_filter(gr_unittest.TestCase): expected_data = (0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50) - src = gr.vector_source_f(src_data) + src = blocks.vector_source_f(src_data) op = filter.fir_filter_fsf(4, 20*[0.5, 0.5]) - dst = gr.vector_sink_s() + dst = blocks.vector_sink_s() self.tb.connect(src, op, dst) self.tb.run() result_data = dst.data() diff --git a/gr-filter/python/qa_fractional_interpolator.py b/gr-filter/python/qa_fractional_interpolator.py index ab4cc4cf9a..177458a47a 100755 --- a/gr-filter/python/qa_fractional_interpolator.py +++ b/gr-filter/python/qa_fractional_interpolator.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2007,2010,2012 Free Software Foundation, Inc. +# Copyright 2007,2010,2012,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -22,6 +22,7 @@ from gnuradio import gr, gr_unittest import filter_swig as filter +import blocks_swig as blocks import math def sig_source_f(samp_rate, freq, amp, N): @@ -50,9 +51,9 @@ class test_fractional_resampler(gr_unittest.TestCase): freq = 10 data = sig_source_f(fs, freq, 1, N) - signal = gr.vector_source_f(data) + signal = blocks.vector_source_f(data) op = filter.fractional_interpolator_ff(0, rrate) - snk = gr.vector_sink_f() + snk = blocks.vector_sink_f() self.tb.connect(signal, op, snk) self.tb.run() @@ -76,9 +77,9 @@ class test_fractional_resampler(gr_unittest.TestCase): freq = 10 data = sig_source_c(fs, freq, 1, N) - signal = gr.vector_source_c(data) + signal = blocks.vector_source_c(data) op = filter.fractional_interpolator_cc(0.0, rrate) - snk = gr.vector_sink_c() + snk = blocks.vector_sink_c() self.tb.connect(signal, op, snk) self.tb.run() diff --git a/gr-filter/python/qa_freq_xlating_fir_filter.py b/gr-filter/python/qa_freq_xlating_fir_filter.py index ee38eb7dff..6fdff372af 100755 --- a/gr-filter/python/qa_freq_xlating_fir_filter.py +++ b/gr-filter/python/qa_freq_xlating_fir_filter.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2008,2010,2012 Free Software Foundation, Inc. +# Copyright 2008,2010,2012,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -21,6 +21,7 @@ from gnuradio import gr, gr_unittest import filter_swig as filter +import blocks_swig as blocks import cmath, math class test_freq_xlating_filter(gr_unittest.TestCase): @@ -102,9 +103,9 @@ class test_freq_xlating_filter(gr_unittest.TestCase): (-0.0016229727771133184+0.0028335191309452057j), (-0.0010890064295381308+0.0037298379465937614j), (-0.00012392725329846144+0.0027196139562875032j)) - src = gr.vector_source_c(self.src_data) + src = blocks.vector_source_c(self.src_data) op = filter.freq_xlating_fir_filter_ccf(1, self.taps, self.fc, self.fs) - dst = gr.vector_sink_c() + dst = blocks.vector_sink_c() self.tb.connect(src, op, dst) self.tb.run() result_data = dst.data() @@ -132,9 +133,9 @@ class test_freq_xlating_filter(gr_unittest.TestCase): (-0.002173811662942171+0.007211671676486731j), (0.0022051059640944004-0.00402153329923749j), (-0.0011226903880015016+0.0009080505697056651j)) - src = gr.vector_source_c(self.src_data) + src = blocks.vector_source_c(self.src_data) op = filter.freq_xlating_fir_filter_ccf(4, self.taps, self.fc, self.fs) - dst = gr.vector_sink_c() + dst = blocks.vector_sink_c() self.tb.connect(src, op, dst) self.tb.run() result_data = dst.data() @@ -162,9 +163,9 @@ class test_freq_xlating_filter(gr_unittest.TestCase): (0.000998671515845-0.00135387131013j), (0.00104933069088-0.00243046949618j), (0.000765930046327-0.0026717747096j)) - src = gr.vector_source_c(self.src_data) + src = blocks.vector_source_c(self.src_data) op = filter.freq_xlating_fir_filter_ccc(1, self.taps, self.fc, self.fs) - dst = gr.vector_sink_c() + dst = blocks.vector_sink_c() self.tb.connect(src, op, dst) self.tb.run() result_data = dst.data() @@ -192,9 +193,9 @@ class test_freq_xlating_filter(gr_unittest.TestCase): (-0.00180401885882+0.00427213776857j), (-0.00122803344857+0.00427243299782j), (0.000414476031438-0.000383919978049j)) - src = gr.vector_source_c(self.src_data) + src = blocks.vector_source_c(self.src_data) op = filter.freq_xlating_fir_filter_ccc(4, self.taps, self.fc, self.fs) - dst = gr.vector_sink_c() + dst = blocks.vector_sink_c() self.tb.connect(src, op, dst) self.tb.run() result_data = dst.data() @@ -222,9 +223,9 @@ class test_freq_xlating_filter(gr_unittest.TestCase): (0.000185727752978-0.000154630601173j), (-0.000141745767905-0.000120098840853j), (-3.9850056055e-07+0.000168364742422j)) - src = gr.vector_source_f(self.src_data) + src = blocks.vector_source_f(self.src_data) op = filter.freq_xlating_fir_filter_fcf(1, self.taps, self.fc, self.fs) - dst = gr.vector_sink_c() + dst = blocks.vector_sink_c() self.tb.connect(src, op, dst) self.tb.run() result_data = dst.data() @@ -252,9 +253,9 @@ class test_freq_xlating_filter(gr_unittest.TestCase): (-0.00010601492977-0.00015005269961j), (-0.000204817260965+0.000160534662427j), (0.000114742244477+0.000205190313864j)) - src = gr.vector_source_f(self.src_data) + src = blocks.vector_source_f(self.src_data) op = filter.freq_xlating_fir_filter_fcf(4, self.taps, self.fc, self.fs) - dst = gr.vector_sink_c() + dst = blocks.vector_sink_c() self.tb.connect(src, op, dst) self.tb.run() result_data = dst.data() @@ -282,9 +283,9 @@ class test_freq_xlating_filter(gr_unittest.TestCase): (-0.000193948610104+0.000113364716526j), (0.000134820176754+0.000142527525895j), (4.74465123261e-05-0.000175131688593j)) - src = gr.vector_source_f(self.src_data) + src = blocks.vector_source_f(self.src_data) op = filter.freq_xlating_fir_filter_fcc(1, self.taps, self.fc, self.fs) - dst = gr.vector_sink_c() + dst = blocks.vector_sink_c() self.tb.connect(src, op, dst) self.tb.run() result_data = dst.data() @@ -312,9 +313,9 @@ class test_freq_xlating_filter(gr_unittest.TestCase): (0.000215422536712+0.000116706112749j), (0.000224391726078-0.000156330308528j), (-5.96956087975e-05-0.000211163976928j)) - src = gr.vector_source_f(self.src_data) + src = blocks.vector_source_f(self.src_data) op = filter.freq_xlating_fir_filter_fcc(4, self.taps, self.fc, self.fs) - dst = gr.vector_sink_c() + dst = blocks.vector_sink_c() self.tb.connect(src, op, dst) self.tb.run() result_data = dst.data() @@ -342,9 +343,9 @@ class test_freq_xlating_filter(gr_unittest.TestCase): (0.128281414509+0.0677760615945j), (0.0748447552323+0.0619902014732j), (0.0512856245041+0.0775099247694j)) - src = gr.vector_source_s(self.src_data) + src = blocks.vector_source_s(self.src_data) op = filter.freq_xlating_fir_filter_scf(1, self.taps, self.fc, self.fs) - dst = gr.vector_sink_c() + dst = blocks.vector_sink_c() self.tb.connect(src, op, dst) self.tb.run() result_data = dst.data() @@ -372,9 +373,9 @@ class test_freq_xlating_filter(gr_unittest.TestCase): (-0.0770940706134-0.230615705252j), (-0.103762261569-0.0382265634835j), (0.11808334291+0.104863762856j)) - src = gr.vector_source_s(self.src_data) + src = blocks.vector_source_s(self.src_data) op = filter.freq_xlating_fir_filter_scf(4, self.taps, self.fc, self.fs) - dst = gr.vector_sink_c() + dst = blocks.vector_sink_c() self.tb.connect(src, op, dst) self.tb.run() result_data = dst.data() @@ -402,9 +403,9 @@ class test_freq_xlating_filter(gr_unittest.TestCase): (-0.0151527002454+0.036265052855j), (0.0199296213686+0.0452499426901j), (0.0122985243797+0.0143278446048j)) - src = gr.vector_source_s(self.src_data) + src = blocks.vector_source_s(self.src_data) op = filter.freq_xlating_fir_filter_scc(1, self.taps, self.fc, self.fs) - dst = gr.vector_sink_c() + dst = blocks.vector_sink_c() self.tb.connect(src, op, dst) self.tb.run() result_data = dst.data() @@ -432,9 +433,9 @@ class test_freq_xlating_filter(gr_unittest.TestCase): (-0.0108893103898-0.0875638127327j), (0.00204296782613-0.0721434056759j), (-0.00527479872108-0.00698097236454j)) - src = gr.vector_source_s(self.src_data) + src = blocks.vector_source_s(self.src_data) op = filter.freq_xlating_fir_filter_scc(4, self.taps, self.fc, self.fs) - dst = gr.vector_sink_c() + dst = blocks.vector_sink_c() self.tb.connect(src, op, dst) self.tb.run() result_data = dst.data() diff --git a/gr-filter/python/qa_hilbert.py b/gr-filter/python/qa_hilbert.py index c3522ed192..9af77e8314 100755 --- a/gr-filter/python/qa_hilbert.py +++ b/gr-filter/python/qa_hilbert.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2004,2007,2010,2012 Free Software Foundation, Inc. +# Copyright 2004,2007,2010,2012,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -22,6 +22,7 @@ from gnuradio import gr, gr_unittest import filter_swig as filter +import blocks_swig as blocks import math def sig_source_f(samp_rate, freq, amp, N): @@ -107,10 +108,10 @@ class test_hilbert(gr_unittest.TestCase): N = int(ntaps + sampling_freq * 0.10) data = sig_source_f(sampling_freq, sampling_freq * 0.10, 1.0, N) - src1 = gr.vector_source_f(data) + src1 = blocks.vector_source_f(data) hilb = filter.hilbert_fc(ntaps) - dst1 = gr.vector_sink_c() + dst1 = blocks.vector_sink_c() tb.connect(src1, hilb) tb.connect(hilb, dst1) tb.run() diff --git a/gr-filter/python/qa_iir_filter.py b/gr-filter/python/qa_iir_filter.py index 645c4b66e7..e341a74c03 100755 --- a/gr-filter/python/qa_iir_filter.py +++ b/gr-filter/python/qa_iir_filter.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2004,2007,2010 Free Software Foundation, Inc. +# Copyright 2004,2007,2010,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -22,6 +22,7 @@ from gnuradio import gr, gr_unittest import filter_swig as filter +import blocks_swig as blocks class test_iir_filter(gr_unittest.TestCase): @@ -36,9 +37,9 @@ class test_iir_filter(gr_unittest.TestCase): fftaps = () fbtaps = () expected_result = (0, 0, 0, 0, 0, 0, 0, 0) - src = gr.vector_source_f(src_data) + src = blocks.vector_source_f(src_data) op = filter.iir_filter_ffd(fftaps, fbtaps) - dst = gr.vector_sink_f() + dst = blocks.vector_sink_f() self.tb.connect(src, op) self.tb.connect(op, dst) self.tb.run() @@ -50,9 +51,9 @@ class test_iir_filter(gr_unittest.TestCase): fftaps = (2,) fbtaps = (0,) expected_result = (2, 4, 6, 8, 10, 12, 14, 16) - src = gr.vector_source_f(src_data) + src = blocks.vector_source_f(src_data) op = filter.iir_filter_ffd(fftaps, fbtaps) - dst = gr.vector_sink_f() + dst = blocks.vector_sink_f() self.tb.connect(src, op) self.tb.connect(op, dst) self.tb.run() @@ -64,9 +65,9 @@ class test_iir_filter(gr_unittest.TestCase): fftaps = (2, 11) fbtaps = (0, 0) expected_result = (2, 15, 28, 41, 54, 67, 80, 93) - src = gr.vector_source_f(src_data) + src = blocks.vector_source_f(src_data) op = filter.iir_filter_ffd(fftaps, fbtaps) - dst = gr.vector_sink_f() + dst = blocks.vector_sink_f() self.tb.connect(src, op) self.tb.connect(op, dst) self.tb.run() @@ -78,9 +79,9 @@ class test_iir_filter(gr_unittest.TestCase): fftaps = (2, 11) fbtaps = (0, -1) expected_result = (2, 13, 15, 26, 28, 39, 41, 52) - src = gr.vector_source_f(src_data) + src = blocks.vector_source_f(src_data) op = filter.iir_filter_ffd(fftaps, fbtaps) - dst = gr.vector_sink_f() + dst = blocks.vector_sink_f() self.tb.connect(src, op) self.tb.connect(op, dst) self.tb.run() @@ -92,9 +93,9 @@ class test_iir_filter(gr_unittest.TestCase): fftaps = (2, 11, 0) fbtaps = (0, -1, 3) expected_result = (2, 13, 21, 59, 58, 186, 68, 583) - src = gr.vector_source_f(src_data) + src = blocks.vector_source_f(src_data) op = filter.iir_filter_ffd(fftaps, fbtaps) - dst = gr.vector_sink_f() + dst = blocks.vector_sink_f() self.tb.connect(src, op) self.tb.connect(op, dst) self.tb.run() @@ -106,12 +107,12 @@ class test_iir_filter(gr_unittest.TestCase): expected_result = (2, 13, 21, 59, 58, 186, 68, 583) fftaps = (2, 1) fbtaps = (0, -1) - src = gr.vector_source_f(src_data) + src = blocks.vector_source_f(src_data) op = filter.iir_filter_ffd(fftaps, fbtaps) fftaps = (2, 11, 0) fbtaps = (0, -1, 3) op.set_taps(fftaps, fbtaps) - dst = gr.vector_sink_f() + dst = blocks.vector_sink_f() self.tb.connect(src, op) self.tb.connect(op, dst) self.tb.run() @@ -123,12 +124,12 @@ class test_iir_filter(gr_unittest.TestCase): expected_result = (2,2,5,5,8,8,11,11) fftaps = (2, 1) fbtaps = (0, -1) - src = gr.vector_source_f(src_data) + src = blocks.vector_source_f(src_data) op = filter.iir_filter_ffd(fftaps, fbtaps) fftaps = (2,0,1) fbtaps = (0, -1) op.set_taps(fftaps, fbtaps) - dst = gr.vector_sink_f() + dst = blocks.vector_sink_f() self.tb.connect(src, op) self.tb.connect(op, dst) self.tb.run() @@ -140,12 +141,12 @@ class test_iir_filter(gr_unittest.TestCase): expected_result = (2,4,4,10,18,14,26,56) fftaps = (2,) fbtaps = (0, 1) - src = gr.vector_source_f(src_data) + src = blocks.vector_source_f(src_data) op = filter.iir_filter_ffd(fftaps, fbtaps) fftaps_data = (1) fbtaps = (0,0, -1,3) op.set_taps(fftaps, fbtaps) - dst = gr.vector_sink_f() + dst = blocks.vector_sink_f() self.tb.connect(src, op) self.tb.connect(op, dst) self.tb.run() diff --git a/gr-filter/python/qa_interp_fir_filter.py b/gr-filter/python/qa_interp_fir_filter.py index 839330539b..243ac7fac6 100755 --- a/gr-filter/python/qa_interp_fir_filter.py +++ b/gr-filter/python/qa_interp_fir_filter.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2004,2007,2010,2012 Free Software Foundation, Inc. +# Copyright 2004,2007,2010,2012,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -22,6 +22,7 @@ from gnuradio import gr, gr_unittest import filter_swig as filter +import blocks_swig as blocks import math class test_interp_fir_filter(gr_unittest.TestCase): @@ -45,9 +46,9 @@ class test_interp_fir_filter(gr_unittest.TestCase): 1300,13017,130170) expected_result = tuple([float(x) for x in xr]) - src = gr.vector_source_f(src_data) + src = blocks.vector_source_f(src_data) op = filter.interp_fir_filter_fff(interpolation, taps) - dst = gr.vector_sink_f() + dst = blocks.vector_sink_f() self.tb.connect(src, op) self.tb.connect(op, dst) self.tb.run() diff --git a/gr-filter/python/qa_pfb_arb_resampler.py b/gr-filter/python/qa_pfb_arb_resampler.py index 98272013ef..504fc815ce 100755 --- a/gr-filter/python/qa_pfb_arb_resampler.py +++ b/gr-filter/python/qa_pfb_arb_resampler.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2012 Free Software Foundation, Inc. +# Copyright 2012,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -22,6 +22,7 @@ from gnuradio import gr, gr_unittest import filter_swig as filter +import blocks_swig as blocks import math def sig_source_c(samp_rate, freq, amp, N): @@ -55,9 +56,9 @@ class test_pfb_arb_resampler(gr_unittest.TestCase): freq = 100 data = sig_source_f(fs, freq, 1, N) - signal = gr.vector_source_f(data) + signal = blocks.vector_source_f(data) pfb = filter.pfb_arb_resampler_fff(rrate, taps) - snk = gr.vector_sink_f() + snk = blocks.vector_sink_f() self.tb.connect(signal, pfb, snk) self.tb.run() @@ -84,9 +85,9 @@ class test_pfb_arb_resampler(gr_unittest.TestCase): freq = 100 data = sig_source_c(fs, freq, 1, N) - signal = gr.vector_source_c(data) + signal = blocks.vector_source_c(data) pfb = filter.pfb_arb_resampler_ccf(rrate, taps) - snk = gr.vector_sink_c() + snk = blocks.vector_sink_c() self.tb.connect(signal, pfb, snk) self.tb.run() diff --git a/gr-filter/python/qa_pfb_channelizer.py b/gr-filter/python/qa_pfb_channelizer.py index 519afa0458..472aa5a73c 100755 --- a/gr-filter/python/qa_pfb_channelizer.py +++ b/gr-filter/python/qa_pfb_channelizer.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2012 Free Software Foundation, Inc. +# Copyright 2012,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -55,7 +55,7 @@ class test_pfb_channelizer(gr_unittest.TestCase): for i in xrange(len(freqs)): f = freqs[i] + (M/2-M+i+1)*fs data = sig_source_c(ifs, f, 1, N) - signals.append(gr.vector_source_c(data)) + signals.append(blocks.vector_source_c(data)) self.tb.connect(signals[i], (add,i)) s2ss = blocks.stream_to_streams(gr.sizeof_gr_complex, M) @@ -65,7 +65,7 @@ class test_pfb_channelizer(gr_unittest.TestCase): snks = list() for i in xrange(M): - snks.append(gr.vector_sink_c()) + snks.append(blocks.vector_sink_c()) self.tb.connect((s2ss,i), (pfb,i)) self.tb.connect((pfb, i), snks[i]) diff --git a/gr-filter/python/qa_pfb_decimator.py b/gr-filter/python/qa_pfb_decimator.py index d20b2fa856..783be05486 100755 --- a/gr-filter/python/qa_pfb_decimator.py +++ b/gr-filter/python/qa_pfb_decimator.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2012 Free Software Foundation, Inc. +# Copyright 2012,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -56,13 +56,13 @@ class test_pfb_decimator(gr_unittest.TestCase): for i in xrange(len(freqs)): f = freqs[i] + (M/2-M+i+1)*fs data = sig_source_c(ifs, f, 1, N) - signals.append(gr.vector_source_c(data)) + signals.append(blocks.vector_source_c(data)) self.tb.connect(signals[i], (add,i)) - head = gr.head(gr.sizeof_gr_complex, N) + head = blocks.head(gr.sizeof_gr_complex, N) s2ss = blocks.stream_to_streams(gr.sizeof_gr_complex, M) pfb = filter.pfb_decimator_ccf(M, taps, channel) - snk = gr.vector_sink_c() + snk = blocks.vector_sink_c() self.tb.connect(add, head, s2ss) for i in xrange(M): @@ -102,12 +102,12 @@ class test_pfb_decimator(gr_unittest.TestCase): for i in xrange(len(freqs)): f = freqs[i] + (M/2-M+i+1)*fs data = sig_source_c(ifs, f, 1, N) - signals.append(gr.vector_source_c(data)) + signals.append(blocks.vector_source_c(data)) self.tb.connect(signals[i], (add,i)) s2ss = blocks.stream_to_streams(gr.sizeof_gr_complex, M) pfb = filter.pfb_decimator_ccf(M, taps, channel) - snk = gr.vector_sink_c() + snk = blocks.vector_sink_c() self.tb.connect(add, s2ss) for i in xrange(M): diff --git a/gr-filter/python/qa_pfb_interpolator.py b/gr-filter/python/qa_pfb_interpolator.py index ffaeee3f68..6788dbf203 100755 --- a/gr-filter/python/qa_pfb_interpolator.py +++ b/gr-filter/python/qa_pfb_interpolator.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2012 Free Software Foundation, Inc. +# Copyright 2012,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -22,6 +22,7 @@ from gnuradio import gr, gr_unittest import filter_swig as filter +import blocks_swig as blocks import math def sig_source_c(samp_rate, freq, amp, N): @@ -50,9 +51,9 @@ class test_pfb_interpolator(gr_unittest.TestCase): freq = 100 data = sig_source_c(fs, freq, 1, N) - signal = gr.vector_source_c(data) + signal = blocks.vector_source_c(data) pfb = filter.pfb_interpolator_ccf(M, taps) - snk = gr.vector_sink_c() + snk = blocks.vector_sink_c() self.tb.connect(signal, pfb) self.tb.connect(pfb, snk) diff --git a/gr-filter/python/qa_pfb_synthesizer.py b/gr-filter/python/qa_pfb_synthesizer.py index 2da02b58d3..aa3c697b93 100755 --- a/gr-filter/python/qa_pfb_synthesizer.py +++ b/gr-filter/python/qa_pfb_synthesizer.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2012 Free Software Foundation, Inc. +# Copyright 2012,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -22,6 +22,7 @@ from gnuradio import gr, gr_unittest import filter_swig as filter +import blocks_swig as blocks import math def sig_source_c(samp_rate, freq, amp, N): @@ -52,10 +53,10 @@ class test_pfb_synthesizer(gr_unittest.TestCase): freqs = [0, 100, 200, -200, -100] for i in xrange(len(freqs)): data = sig_source_c(fs, freqs[i], 1, N) - signals.append(gr.vector_source_c(data)) + signals.append(blocks.vector_source_c(data)) pfb = filter.pfb_synthesizer_ccf(M, taps) - snk = gr.vector_sink_c() + snk = blocks.vector_sink_c() for i in xrange(M): self.tb.connect(signals[i], (pfb,i)) diff --git a/gr-filter/python/qa_rational_resampler.py b/gr-filter/python/qa_rational_resampler.py index eb86ef5425..76930ba052 100755 --- a/gr-filter/python/qa_rational_resampler.py +++ b/gr-filter/python/qa_rational_resampler.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2005,2006,2007,2010 Free Software Foundation, Inc. +# Copyright 2005-2007,2010,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -22,6 +22,7 @@ from gnuradio import gr, gr_unittest import filter_swig as filter +import blocks_swig as blocks import math import random import sys @@ -37,9 +38,9 @@ def random_floats(n): def reference_dec_filter(src_data, decim, taps): tb = gr.top_block() - src = gr.vector_source_f(src_data) + src = blocks.vector_source_f(src_data) op = filter.fir_filter_fff(decim, taps) - dst = gr.vector_sink_f() + dst = blocks.vector_sink_f() tb.connect(src, op, dst) tb.run() result_data = dst.data() @@ -48,9 +49,9 @@ def reference_dec_filter(src_data, decim, taps): def reference_interp_filter(src_data, interp, taps): tb = gr.top_block() - src = gr.vector_source_f(src_data) + src = blocks.vector_source_f(src_data) op = filter.interp_fir_filter_fff(interp, taps) - dst = gr.vector_sink_f() + dst = blocks.vector_sink_f() tb.connect(src, op, dst) tb.run() result_data = dst.data() @@ -59,10 +60,10 @@ def reference_interp_filter(src_data, interp, taps): def reference_interp_dec_filter(src_data, interp, decim, taps): tb = gr.top_block() - src = gr.vector_source_f(src_data) + src = blocks.vector_source_f(src_data) up = filter.interp_fir_filter_fff(interp, (1,)) dn = filter.fir_filter_fff(decim, taps) - dst = gr.vector_sink_f() + dst = blocks.vector_sink_f() tb.connect(src, up, dn, dst) tb.run() result_data = dst.data() @@ -86,9 +87,9 @@ class test_rational_resampler (gr_unittest.TestCase): expected_result = tuple([float(x) for x in xr]) tb = gr.top_block() - src = gr.vector_source_f(src_data) + src = blocks.vector_source_f(src_data) op = filter.rational_resampler_base_fff(1, 1, taps) - dst = gr.vector_sink_f() + dst = blocks.vector_sink_f() tb.connect(src, op) tb.connect(op, dst) tb.run() @@ -109,9 +110,9 @@ class test_rational_resampler (gr_unittest.TestCase): expected_result = tuple([float(x) for x in xr]) tb = gr.top_block() - src = gr.vector_source_f(src_data) + src = blocks.vector_source_f(src_data) op = filter.rational_resampler_base_fff(interpolation, 1, taps) - dst = gr.vector_sink_f() + dst = blocks.vector_sink_f() tb.connect(src, op) tb.connect(op, dst) tb.run() @@ -126,9 +127,9 @@ class test_rational_resampler (gr_unittest.TestCase): expected_result = reference_interp_filter(src_data, interpolation, taps) tb = gr.top_block() - src = gr.vector_source_f(src_data) + src = blocks.vector_source_f(src_data) op = filter.rational_resampler_base_fff(interpolation, 1, taps) - dst = gr.vector_sink_f() + dst = blocks.vector_sink_f() tb.connect(src, op) tb.connect(op, dst) tb.run() @@ -146,9 +147,9 @@ class test_rational_resampler (gr_unittest.TestCase): expected_result = reference_dec_filter(src_data, decimation, taps) tb = gr.top_block() - src = gr.vector_source_f(src_data) + src = blocks.vector_source_f(src_data) op = filter.rational_resampler_base_fff(1, decimation, taps) - dst = gr.vector_sink_f() + dst = blocks.vector_sink_f() tb.connect(src, op) tb.connect(op, dst) tb.run() @@ -176,9 +177,9 @@ class test_rational_resampler (gr_unittest.TestCase): expected_result = reference_dec_filter(src_data, decim, taps) tb = gr.top_block() - src = gr.vector_source_f(src_data) + src = blocks.vector_source_f(src_data) op = filter.rational_resampler_base_fff(1, decim, taps) - dst = gr.vector_sink_f() + dst = blocks.vector_sink_f() tb.connect(src, op, dst) tb.run() tb = None @@ -210,9 +211,9 @@ class test_rational_resampler (gr_unittest.TestCase): expected_result = reference_interp_filter(src_data, interp, taps) tb = gr.top_block() - src = gr.vector_source_f(src_data) + src = blocks.vector_source_f(src_data) op = filter.rational_resampler_base_fff(interp, 1, taps) - dst = gr.vector_sink_f() + dst = blocks.vector_sink_f() tb.connect(src, op, dst) tb.run() tb = None @@ -238,9 +239,9 @@ class test_rational_resampler (gr_unittest.TestCase): expected_result = reference_interp_dec_filter(src_data, interp, decimation, taps) tb = gr.top_block() - src = gr.vector_source_f(src_data) + src = blocks.vector_source_f(src_data) op = filter.rational_resampler_base_fff(interp, decimation, taps) - dst = gr.vector_sink_f() + dst = blocks.vector_sink_f() tb.connect(src, op) tb.connect(op, dst) tb.run() diff --git a/gr-filter/python/qa_single_pole_iir.py b/gr-filter/python/qa_single_pole_iir.py index d28ab643fd..bc2d54c959 100755 --- a/gr-filter/python/qa_single_pole_iir.py +++ b/gr-filter/python/qa_single_pole_iir.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2005,2007,2010 Free Software Foundation, Inc. +# Copyright 2005,2007,2010,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -35,9 +35,9 @@ class test_single_pole_iir_filter(gr_unittest.TestCase): def test_ff_001(self): src_data = (0, 1000, 2000, 3000, 4000, 5000) expected_result = src_data - src = gr.vector_source_f(src_data) + src = blocks.vector_source_f(src_data) op = filter.single_pole_iir_filter_ff(1.0) - dst = gr.vector_sink_f() + dst = blocks.vector_sink_f() self.tb.connect(src, op, dst) self.tb.run() result_data = dst.data() @@ -46,9 +46,9 @@ class test_single_pole_iir_filter(gr_unittest.TestCase): def test_ff_002(self): src_data = (0, 1000, 2000, 3000, 4000, 5000) expected_result = (0, 125, 359.375, 689.453125, 1103.271484, 1590.36255) - src = gr.vector_source_f(src_data) + src = blocks.vector_source_f(src_data) op = filter.single_pole_iir_filter_ff(0.125) - dst = gr.vector_sink_f() + dst = blocks.vector_sink_f() self.tb.connect(src, op, dst) self.tb.run() result_data = dst.data() @@ -58,11 +58,11 @@ class test_single_pole_iir_filter(gr_unittest.TestCase): block_size = 2 src_data = (0, 1000, 2000, 3000, 4000, 5000) expected_result = (0, 125, 250, 484.375, 718.75, 1048.828125) - src = gr.vector_source_f(src_data) + src = blocks.vector_source_f(src_data) s2p = blocks.stream_to_vector(gr.sizeof_float, block_size) op = filter.single_pole_iir_filter_ff (0.125, block_size) p2s = blocks.vector_to_stream(gr.sizeof_float, block_size) - dst = gr.vector_sink_f() + dst = blocks.vector_sink_f() self.tb.connect(src, s2p, op, p2s, dst) self.tb.run() result_data = dst.data() @@ -71,9 +71,9 @@ class test_single_pole_iir_filter(gr_unittest.TestCase): def test_cc_001(self): src_data = (0+0j, 1000+1000j, 2000+2000j, 3000+3000j, 4000+4000j, 5000+5000j) expected_result = src_data - src = gr.vector_source_c(src_data) + src = blocks.vector_source_c(src_data) op = filter.single_pole_iir_filter_cc(1.0) - dst = gr.vector_sink_c() + dst = blocks.vector_sink_c() self.tb.connect(src, op, dst) self.tb.run() result_data = dst.data() @@ -85,9 +85,9 @@ class test_single_pole_iir_filter(gr_unittest.TestCase): expected_result = (complex(0,0), complex(125,-125), complex(359.375,-359.375), complex(689.453125,-689.453125), complex(1103.271484,-1103.271484), complex(1590.36255,-1590.36255)) - src = gr.vector_source_c(src_data) + src = blocks.vector_source_c(src_data) op = filter.single_pole_iir_filter_cc(0.125) - dst = gr.vector_sink_c() + dst = blocks.vector_sink_c() self.tb.connect(src, op, dst) self.tb.run() result_data = dst.data() @@ -100,11 +100,11 @@ class test_single_pole_iir_filter(gr_unittest.TestCase): expected_result = (complex(0,0), complex(125,-125), complex(250,-250), complex(484.375,-484.375), complex(718.75,-718.75), complex(1048.828125,-1048.828125)) - src = gr.vector_source_c(src_data) + src = blocks.vector_source_c(src_data) s2p = blocks.stream_to_vector(gr.sizeof_gr_complex, block_size) op = filter.single_pole_iir_filter_cc(0.125, block_size) p2s = blocks.vector_to_stream(gr.sizeof_gr_complex, block_size) - dst = gr.vector_sink_c() + dst = blocks.vector_sink_c() self.tb.connect(src, s2p, op, p2s, dst) self.tb.run() result_data = dst.data() diff --git a/gr-howto-write-a-block/apps/howto_square.grc b/gr-howto-write-a-block/apps/howto_square.grc index 1f3324e4eb..ee2c8db271 100644 --- a/gr-howto-write-a-block/apps/howto_square.grc +++ b/gr-howto-write-a-block/apps/howto_square.grc @@ -209,7 +209,7 @@ </param> </block> <block> - <key>gr_vector_source_x</key> + <key>blocks_vector_source_x</key> <param> <key>id</key> <value>src</value> diff --git a/gr-howto-write-a-block/apps/howto_square.py b/gr-howto-write-a-block/apps/howto_square.py index fd03b74c42..4a9bfe3f8e 100755 --- a/gr-howto-write-a-block/apps/howto_square.py +++ b/gr-howto-write-a-block/apps/howto_square.py @@ -30,7 +30,7 @@ class howto_square(grc_wxgui.top_block_gui): # Blocks ################################################## self.thr = blocks.throttle(gr.sizeof_float*1, samp_rate) - self.src = gr.vector_source_f(([float(n)-50 for n in range(100)]), True, 1) + self.src = blocks.vector_source_f(([float(n)-50 for n in range(100)]), True, 1) self.sqr = howto.square_ff() self.sink2 = scopesink2.scope_sink_f( self.GetWin(), diff --git a/gr-howto-write-a-block/lib/qa_square2_ff.cc b/gr-howto-write-a-block/lib/qa_square2_ff.cc index 672e75691b..b73c7ce1d7 100644 --- a/gr-howto-write-a-block/lib/qa_square2_ff.cc +++ b/gr-howto-write-a-block/lib/qa_square2_ff.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2011,2012 Free Software Foundation, Inc. + * Copyright 2011-2013 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -24,8 +24,8 @@ #include <vector> #include <gr_top_block.h> -#include <gr_vector_source_f.h> -#include <gr_vector_sink_f.h> +#include <blocks/vector_source_f.h> +#include <blocks/vector_sink_f.h> #include <howto/square2_ff.h> namespace gr { @@ -43,8 +43,8 @@ namespace gr { } gr_top_block_sptr tb = gr_make_top_block("dial_tone"); - gr_vector_source_f_sptr src = gr_make_vector_source_f(data); - gr_vector_sink_f_sptr snk = gr_make_vector_sink_f(); + gr::blocks::vector_source_f::sptr src = gr::blocks::vector_source_f::make(data); + gr::blocks::vector_sink_f::sptr snk = gr::blocks::vector_sink_f::make(); square2_ff::sptr op = square2_ff::make(); diff --git a/gr-howto-write-a-block/lib/qa_square_ff.cc b/gr-howto-write-a-block/lib/qa_square_ff.cc index dedd934e16..a8e7ac2b92 100644 --- a/gr-howto-write-a-block/lib/qa_square_ff.cc +++ b/gr-howto-write-a-block/lib/qa_square_ff.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2011,2012 Free Software Foundation, Inc. + * Copyright 2011-2013 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -24,8 +24,8 @@ #include <vector> #include <gr_top_block.h> -#include <gr_vector_source_f.h> -#include <gr_vector_sink_f.h> +#include <blocks/vector_source_f.h> +#include <blocks/vector_sink_f.h> #include <howto/square_ff.h> namespace gr { @@ -43,8 +43,8 @@ namespace gr { } gr_top_block_sptr tb = gr_make_top_block("dial_tone"); - gr_vector_source_f_sptr src = gr_make_vector_source_f(data); - gr_vector_sink_f_sptr snk = gr_make_vector_sink_f(); + gr::blocks::vector_source_f::sptr src = gr::blocks::vector_source_f::make(data); + gr::blocks::vector_sink_f::sptr snk = gr::blocks::vector_sink_f::make(); square_ff::sptr op = square_ff::make(); diff --git a/gr-howto-write-a-block/python/qa_howto.py b/gr-howto-write-a-block/python/qa_howto.py index 203b06922b..7b58c35f4d 100644 --- a/gr-howto-write-a-block/python/qa_howto.py +++ b/gr-howto-write-a-block/python/qa_howto.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2004,2007,2012 Free Software Foundation, Inc. +# Copyright 2004,2007,2012,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -21,6 +21,7 @@ # from gnuradio import gr, gr_unittest +from gnuradio import blocks import howto_swig as howto from square3_ff import square3_ff @@ -35,9 +36,9 @@ class qa_howto(gr_unittest.TestCase): def test_001_square_ff(self): src_data = (-3, 4, -5.5, 2, 3) expected_result = (9, 16, 30.25, 4, 9) - src = gr.vector_source_f(src_data) + src = blocks.vector_source_f(src_data) sqr = howto.square_ff() - dst = gr.vector_sink_f() + dst = blocks.vector_sink_f() self.tb.connect(src, sqr) self.tb.connect(sqr, dst) self.tb.run() @@ -47,9 +48,9 @@ class qa_howto(gr_unittest.TestCase): def test_002_square2_ff(self): src_data = (-3, 4, -5.5, 2, 3) expected_result = (9, 16, 30.25, 4, 9) - src = gr.vector_source_f(src_data) + src = blocks.vector_source_f(src_data) sqr = howto.square2_ff() - dst = gr.vector_sink_f() + dst = blocks.vector_sink_f() self.tb.connect(src, sqr) self.tb.connect(sqr, dst) self.tb.run() @@ -59,9 +60,9 @@ class qa_howto(gr_unittest.TestCase): def test_003_square3_ff (self): src_data = (-3, 4, -5.5, 2, 3) expected_result = (9, 16, 30.25, 4, 9) - src = gr.vector_source_f (src_data) + src = blocks.vector_source_f (src_data) sqr = square3_ff () - dst = gr.vector_sink_f () + dst = blocks.vector_sink_f () self.tb.connect (src, sqr) self.tb.connect (sqr, dst) self.tb.run () diff --git a/gr-pager/apps/usrp_flex_all b/gr-pager/apps/usrp_flex_all index 58fcc0af45..4d950866f0 100755 --- a/gr-pager/apps/usrp_flex_all +++ b/gr-pager/apps/usrp_flex_all @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2006,2007,2009 Free Software Foundation, Inc. +# Copyright 2006,2007,2009,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -105,7 +105,7 @@ class app_top_block(gr.top_block): freq = options.freq-(self.nchan-i)*25e3 if (freq < 929.0e6 or freq > 932.0e6): - self.connect((self.bank, i), gr.null_sink(gr.sizeof_gr_complex)) + self.connect((self.bank, i), blocks.null_sink(gr.sizeof_gr_complex)) else: self.connect((self.bank, i), pager.flex_demod(queue, freq, options.verbose, options.log)) if options.log: diff --git a/gr-pager/apps/usrp_rx_flex.grc b/gr-pager/apps/usrp_rx_flex.grc index 79312a4148..b6833aa526 100644 --- a/gr-pager/apps/usrp_rx_flex.grc +++ b/gr-pager/apps/usrp_rx_flex.grc @@ -1523,10 +1523,10 @@ </param> </block> <block> - <key>gr_null_sink</key> + <key>blocks_null_sink</key> <param> <key>id</key> - <value>gr_null_sink_0</value> + <value>blocks_null_sink_0</value> </param> <param> <key>_enabled</key> @@ -1607,10 +1607,10 @@ </param> </block> <block> - <key>gr_null_sink</key> + <key>blocks_null_sink</key> <param> <key>id</key> - <value>gr_null_sink_0_0</value> + <value>blocks_null_sink_0_0</value> </param> <param> <key>_enabled</key> @@ -1634,10 +1634,10 @@ </param> </block> <block> - <key>gr_null_sink</key> + <key>blocks_null_sink</key> <param> <key>id</key> - <value>gr_null_sink_0_1</value> + <value>blocks_null_sink_0_1</value> </param> <param> <key>_enabled</key> @@ -1661,10 +1661,10 @@ </param> </block> <block> - <key>gr_null_sink</key> + <key>blocks_null_sink</key> <param> <key>id</key> - <value>gr_null_sink_0_2</value> + <value>blocks_null_sink_0_2</value> </param> <param> <key>_enabled</key> @@ -1779,25 +1779,25 @@ </connection> <connection> <source_block_id>pager_flex_deinterleave_0</source_block_id> - <sink_block_id>gr_null_sink_0</sink_block_id> + <sink_block_id>blocks_null_sink_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> <source_block_id>pager_flex_deinterleave_0_1_0</source_block_id> - <sink_block_id>gr_null_sink_0_0</sink_block_id> + <sink_block_id>blocks_null_sink_0_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> <source_block_id>pager_flex_deinterleave_0_1</source_block_id> - <sink_block_id>gr_null_sink_0_1</sink_block_id> + <sink_block_id>blocks_null_sink_0_1</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> <source_block_id>pager_flex_deinterleave_0_0</source_block_id> - <sink_block_id>gr_null_sink_0_2</sink_block_id> + <sink_block_id>blocks_null_sink_0_2</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> diff --git a/gr-pager/apps/usrp_rx_flex.py b/gr-pager/apps/usrp_rx_flex.py index 6bb93ee756..4de4ded9c4 100755 --- a/gr-pager/apps/usrp_rx_flex.py +++ b/gr-pager/apps/usrp_rx_flex.py @@ -7,6 +7,7 @@ from gnuradio import eng_notation from gnuradio import gr +from gnuradio import blocks from gnuradio import filter from gnuradio import pager from gnuradio.eng_option import eng_option @@ -175,10 +176,10 @@ class usrp_rx_flex(grc_wxgui.top_block_gui): ################################################## self.fm_demod = gr.quadrature_demod_cf(demod_k) self.gr_freq_xlating_fir_filter_xxx_0 = gr.freq_xlating_fir_filter_ccc(channel_decim, (channel_taps), band_freq-freq+offset, sample_rate) - self.gr_null_sink_0 = gr.null_sink(gr.sizeof_int*1) - self.gr_null_sink_0_0 = gr.null_sink(gr.sizeof_int*1) - self.gr_null_sink_0_1 = gr.null_sink(gr.sizeof_int*1) - self.gr_null_sink_0_2 = gr.null_sink(gr.sizeof_int*1) + self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_int*1) + self.blocks_null_sink_0_0 = blocks.null_sink(gr.sizeof_int*1) + self.blocks_null_sink_0_1 = blocks.null_sink(gr.sizeof_int*1) + self.blocks_null_sink_0_2 = blocks.null_sink(gr.sizeof_int*1) self.pager_flex_deinterleave_0 = pager.flex_deinterleave() self.pager_flex_deinterleave_0_0 = pager.flex_deinterleave() self.pager_flex_deinterleave_0_1 = pager.flex_deinterleave() @@ -255,10 +256,10 @@ class usrp_rx_flex(grc_wxgui.top_block_gui): self.connect((self.pager_flex_sync_0, 2), (self.pager_flex_deinterleave_0_1, 0)) self.connect((self.pager_flex_sync_0, 0), (self.pager_flex_deinterleave_0, 0)) self.connect((self.pager_flex_sync_0, 3), (self.pager_flex_deinterleave_0_0, 0)) - self.connect((self.pager_flex_deinterleave_0, 0), (self.gr_null_sink_0, 0)) - self.connect((self.pager_flex_deinterleave_0_1_0, 0), (self.gr_null_sink_0_0, 0)) - self.connect((self.pager_flex_deinterleave_0_1, 0), (self.gr_null_sink_0_1, 0)) - self.connect((self.pager_flex_deinterleave_0_0, 0), (self.gr_null_sink_0_2, 0)) + self.connect((self.pager_flex_deinterleave_0, 0), (self.blocks_null_sink_0, 0)) + self.connect((self.pager_flex_deinterleave_0_1_0, 0), (self.blocks_null_sink_0_0, 0)) + self.connect((self.pager_flex_deinterleave_0_1, 0), (self.blocks_null_sink_0_1, 0)) + self.connect((self.pager_flex_deinterleave_0_0, 0), (self.blocks_null_sink_0_2, 0)) def set_config_filename(self, config_filename): self.config_filename = config_filename diff --git a/gr-qtgui/apps/gr_constellation_plot b/gr-qtgui/apps/gr_constellation_plot index 0687443218..559b643c53 100755 --- a/gr-qtgui/apps/gr_constellation_plot +++ b/gr-qtgui/apps/gr_constellation_plot @@ -21,6 +21,7 @@ # from gnuradio import gr +from gnuradio import blocks from gnuradio.eng_option import eng_option from optparse import OptionParser import os, sys @@ -67,7 +68,7 @@ class my_top_block(gr.top_block): self.qapp = QtGui.QApplication(sys.argv) - self.skip = gr.skiphead(gr.sizeof_gr_complex, self._start) + self.skip = blocks.skiphead(gr.sizeof_gr_complex, self._start) self.gui_snk = qtgui.const_sink_c(self._nsamps, "GNU Radio Constellation Plot", self._nsigs) @@ -77,7 +78,7 @@ class my_top_block(gr.top_block): self._data_max = -sys.maxint - 1 for f in filelist: data,_min,_max = read_samples_c(f, self._start, self._nsamps) - self.srcs.append(gr.vector_source_c(data)) + self.srcs.append(blocks.vector_source_c(data)) if(_min < self._data_min): self._data_min = _min diff --git a/gr-qtgui/apps/gr_psd_plot_c b/gr-qtgui/apps/gr_psd_plot_c index f2789ef34b..6ade908bd4 100755 --- a/gr-qtgui/apps/gr_psd_plot_c +++ b/gr-qtgui/apps/gr_psd_plot_c @@ -21,6 +21,7 @@ # from gnuradio import gr +from gnuradio import blocks from gnuradio import filter import scipy @@ -46,7 +47,7 @@ class psd_plot_c(plot_base.plot_base): self.read_samples = plot_base.read_samples_c self.dsize = gr.sizeof_gr_complex - self.src_type = gr.vector_source_c + self.src_type = blocks.vector_source_c self.gui_snk = qtgui.freq_sink_c(self._psd_size, filter.firdes.WIN_BLACKMAN_hARRIS, self._center_freq, self._samp_rate, "GNU Radio PSD Plot", self._nsigs) diff --git a/gr-qtgui/apps/gr_psd_plot_f b/gr-qtgui/apps/gr_psd_plot_f index c6b70baf27..792b04290b 100755 --- a/gr-qtgui/apps/gr_psd_plot_f +++ b/gr-qtgui/apps/gr_psd_plot_f @@ -21,6 +21,7 @@ # from gnuradio import gr +from gnuradio import blocks from gnuradio import filter import scipy @@ -46,7 +47,7 @@ class psd_plot_f(plot_base.plot_base): self.read_samples = plot_base.read_samples_f self.dsize = gr.sizeof_float - self.src_type = gr.vector_source_f + self.src_type = blocks.vector_source_f self.gui_snk = qtgui.freq_sink_f(self._psd_size, filter.firdes.WIN_BLACKMAN_hARRIS, self._center_freq, self._samp_rate, "GNU Radio PSD Plot", self._nsigs) diff --git a/gr-qtgui/apps/gr_spectrogram_plot_c b/gr-qtgui/apps/gr_spectrogram_plot_c index 059f65cd99..bb4fad1b7a 100755 --- a/gr-qtgui/apps/gr_spectrogram_plot_c +++ b/gr-qtgui/apps/gr_spectrogram_plot_c @@ -21,6 +21,7 @@ # from gnuradio import gr +from gnuradio import blocks from gnuradio import filter import scipy @@ -46,7 +47,7 @@ class spectrogram_plot_c(plot_base.plot_base): self.read_samples = plot_base.read_samples_c self.dsize = gr.sizeof_gr_complex - self.src_type = gr.vector_source_c + self.src_type = blocks.vector_source_c self.gui_snk = qtgui.waterfall_sink_c(self._psd_size, filter.firdes.WIN_BLACKMAN_hARRIS, self._center_freq, self._samp_rate, "GNU Radio Spectrogram Plot", self._nsigs) diff --git a/gr-qtgui/apps/gr_spectrogram_plot_f b/gr-qtgui/apps/gr_spectrogram_plot_f index be9c981532..dcb0305bf5 100755 --- a/gr-qtgui/apps/gr_spectrogram_plot_f +++ b/gr-qtgui/apps/gr_spectrogram_plot_f @@ -21,6 +21,7 @@ # from gnuradio import gr +from gnuradio import blocks from gnuradio import filter import scipy @@ -46,7 +47,7 @@ class spectrogram_plot_f(plot_base.plot_base): self.read_samples = plot_base.read_samples_f self.dsize = gr.sizeof_float - self.src_type = gr.vector_source_f + self.src_type = blocks.vector_source_f self.gui_snk = qtgui.waterfall_sink_f(self._psd_size, filter.firdes.WIN_BLACKMAN_hARRIS, self._center_freq, self._samp_rate, "GNU Radio Spectrogram Plot", self._nsigs) diff --git a/gr-qtgui/apps/gr_time_plot_c b/gr-qtgui/apps/gr_time_plot_c index a7c39a24b9..174b3ee1ed 100755 --- a/gr-qtgui/apps/gr_time_plot_c +++ b/gr-qtgui/apps/gr_time_plot_c @@ -21,6 +21,7 @@ # from gnuradio import gr +from gnuradio import blocks import scipy try: @@ -45,7 +46,7 @@ class plot_time_c(plot_base.plot_base): auto_scale) self.read_samples = plot_base.read_samples_c self.dsize = gr.sizeof_gr_complex - self.src_type = gr.vector_source_c + self.src_type = blocks.vector_source_c self.gui_snk = qtgui.time_sink_c(self._nsamps, self._samp_rate, "GNU Radio Time Plot", self._nsigs) self._nsigs *= 2 # complex plots have real/imag diff --git a/gr-qtgui/apps/gr_time_plot_f b/gr-qtgui/apps/gr_time_plot_f index 9b29709b10..9140b61220 100755 --- a/gr-qtgui/apps/gr_time_plot_f +++ b/gr-qtgui/apps/gr_time_plot_f @@ -21,6 +21,7 @@ # from gnuradio import gr +from gnuradio import blocks import scipy try: @@ -45,7 +46,7 @@ class plot_time_f(plot_base.plot_base): auto_scale) self.read_samples = plot_base.read_samples_f self.dsize = gr.sizeof_float - self.src_type = gr.vector_source_f + self.src_type = blocks.vector_source_f self.gui_snk = qtgui.time_sink_f(self._nsamps, self._samp_rate, "GNU Radio Time Plot", self._nsigs) self.setup() diff --git a/gr-qtgui/apps/gr_time_raster_b b/gr-qtgui/apps/gr_time_raster_b index a326a126c4..3e81c317d6 100755 --- a/gr-qtgui/apps/gr_time_raster_b +++ b/gr-qtgui/apps/gr_time_raster_b @@ -21,6 +21,7 @@ # from gnuradio import gr +from gnuradio import blocks import scipy try: @@ -48,7 +49,7 @@ class plot_time_raster_b(plot_base.plot_base): self._ncols = ncols self.read_samples = plot_base.read_samples_b self.dsize = gr.sizeof_char - self.src_type = gr.vector_source_b + self.src_type = blocks.vector_source_b self.gui_snk = qtgui.time_raster_sink_b(self._samp_rate, self._nrows, self._ncols, [], [], "GNU Radio Time Plot", self._nsigs) self.setup() diff --git a/gr-qtgui/apps/gr_time_raster_f b/gr-qtgui/apps/gr_time_raster_f index a6cb897c0b..6b5e5c20e9 100755 --- a/gr-qtgui/apps/gr_time_raster_f +++ b/gr-qtgui/apps/gr_time_raster_f @@ -21,6 +21,7 @@ # from gnuradio import gr +from gnuradio import blocks import scipy try: @@ -48,7 +49,7 @@ class plot_time_raster_f(plot_base.plot_base): self._ncols = ncols self.read_samples = plot_base.read_samples_f self.dsize = gr.sizeof_float - self.src_type = gr.vector_source_f + self.src_type = blocks.vector_source_f self.gui_snk = qtgui.time_raster_sink_f(self._samp_rate, self._nrows, self._ncols, [], [], "GNU Radio Time Plot", self._nsigs) self.setup() diff --git a/gr-qtgui/apps/plot_base.py b/gr-qtgui/apps/plot_base.py index 52c888cff3..b279e1e977 100644 --- a/gr-qtgui/apps/plot_base.py +++ b/gr-qtgui/apps/plot_base.py @@ -91,7 +91,7 @@ def read_samples_b(filename, start, in_size, min_size=0): scipy.int8, gr.sizeof_char) # Bit of a hack since we want to read the data as signed ints, but - # the gr.vector_source_b will only accept unsigned. We read in as + # the blocks.vector_source_b will only accept unsigned. We read in as # signed, do our min/max and things on that, then convert here. d = scipy.array(d, dtype=scipy.uint8).tolist() return d,mn,mx @@ -122,7 +122,7 @@ class source_ints_to_float(gr.hier_block2): gr.hier_block2.__init__(self, "ints_to_floats", gr.io_signature(0, 0, 0), gr.io_signature(1, 1, gr.sizeof_float)) - self.src = gr.vector_source_i(data) + self.src = blocks.vector_source_i(data) self.cvt = blocks.int_to_float() self.connect(self.src, self.cvt, self) @@ -134,7 +134,7 @@ class source_shorts_to_float(gr.hier_block2): gr.hier_block2.__init__(self, "shorts_to_floats", gr.io_signature(0, 0, 0), gr.io_signature(1, 1, gr.sizeof_float)) - self.src = gr.vector_source_s(data) + self.src = blocks.vector_source_s(data) self.cvt = blocks.short_to_float() self.connect(self.src, self.cvt, self) @@ -146,7 +146,7 @@ class source_chars_to_float(gr.hier_block2): gr.hier_block2.__init__(self, "chars_to_floats", gr.io_signature(0, 0, 0), gr.io_signature(1, 1, gr.sizeof_float)) - self.src = gr.vector_source_b(data) + self.src = blocks.vector_source_b(data) self.cvt = blocks.char_to_float() self.connect(self.src, self.cvt, self) diff --git a/gr-qtgui/apps/plot_psd_base.py b/gr-qtgui/apps/plot_psd_base.py index a4a6cb871a..bb1567e014 100644 --- a/gr-qtgui/apps/plot_psd_base.py +++ b/gr-qtgui/apps/plot_psd_base.py @@ -72,7 +72,7 @@ class plot_base(gr.top_block): self.qapp = QtGui.QApplication(sys.argv) def setup(self): - self.skip = gr.skiphead(self.dsize, self._start) + self.skip = blocks.skiphead(self.dsize, self._start) n = 0 self.srcs = list() diff --git a/gr-qtgui/apps/plot_spectrogram_base.py b/gr-qtgui/apps/plot_spectrogram_base.py index adfbfd032f..a3fdf65117 100644 --- a/gr-qtgui/apps/plot_spectrogram_base.py +++ b/gr-qtgui/apps/plot_spectrogram_base.py @@ -72,7 +72,7 @@ class plot_base(gr.top_block): self.qapp = QtGui.QApplication(sys.argv) def setup(self): - self.skip = gr.skiphead(self.dsize, self._start) + self.skip = blocks.skiphead(self.dsize, self._start) n = 0 self.srcs = list() diff --git a/gr-qtgui/apps/plot_time_base.py b/gr-qtgui/apps/plot_time_base.py index c80bace1b6..942500c627 100644 --- a/gr-qtgui/apps/plot_time_base.py +++ b/gr-qtgui/apps/plot_time_base.py @@ -71,7 +71,7 @@ class plot_base(gr.top_block): self.qapp = QtGui.QApplication(sys.argv) def setup(self): - self.skip = gr.skiphead(self.dsize, self._start) + self.skip = blocks.skiphead(self.dsize, self._start) n = 0 self.srcs = list() diff --git a/gr-qtgui/apps/plot_time_raster_base.py b/gr-qtgui/apps/plot_time_raster_base.py index ff3cc2869d..2fc498ba28 100644 --- a/gr-qtgui/apps/plot_time_raster_base.py +++ b/gr-qtgui/apps/plot_time_raster_base.py @@ -71,7 +71,7 @@ class plot_base(gr.top_block): self.qapp = QtGui.QApplication(sys.argv) def setup(self): - self.skip = gr.skiphead(self.dsize, self._start) + self.skip = blocks.skiphead(self.dsize, self._start) n = 0 self.srcs = list() diff --git a/gr-qtgui/apps/qt_digital.py b/gr-qtgui/apps/qt_digital.py index 445d6d4fc1..fef4f448b4 100755 --- a/gr-qtgui/apps/qt_digital.py +++ b/gr-qtgui/apps/qt_digital.py @@ -182,7 +182,7 @@ class my_top_block(gr.top_block): fftsize = 2048 self.data = scipy.random.randint(0, 255, 1000) - self.src = gr.vector_source_b(self.data.tolist(), True) + self.src = blocks.vector_source_b(self.data.tolist(), True) self.mod = digital.dqpsk_mod(self.gray_code, samples_per_symbol=self.sps, excess_bw=self.excess_bw, diff --git a/gr-qtgui/examples/pyqt_time_raster_b.py b/gr-qtgui/examples/pyqt_time_raster_b.py index b29403819d..4cad9de601 100755 --- a/gr-qtgui/examples/pyqt_time_raster_b.py +++ b/gr-qtgui/examples/pyqt_time_raster_b.py @@ -22,6 +22,7 @@ from gnuradio import gr from gnuradio import blocks +from gnuradio import blocks import sys try: @@ -58,10 +59,10 @@ class my_top_block(gr.top_block): nrows = 100 fs = 200 - src0 = gr.vector_source_b(data0, True) - src1 = gr.vector_source_b(data1, True) + src0 = blocks.vector_source_b(data0, True) + src1 = blocks.vector_source_b(data1, True) thr = blocks.throttle(gr.sizeof_char, 50000) - head = gr.head(gr.sizeof_char, 10000000) + head = blocks.head(gr.sizeof_char, 10000000) self.snk1 = qtgui.time_raster_sink_b(fs, nrows, ncols, [], [], "Time Raster Example", 2) diff --git a/gr-qtgui/examples/pyqt_time_raster_f.py b/gr-qtgui/examples/pyqt_time_raster_f.py index 957e694b38..c5261520db 100755 --- a/gr-qtgui/examples/pyqt_time_raster_f.py +++ b/gr-qtgui/examples/pyqt_time_raster_f.py @@ -58,10 +58,10 @@ class my_top_block(gr.top_block): nrows = 100 fs = 200 - src0 = gr.vector_source_f(data0, True) - src1 = gr.vector_source_f(data1, True) + src0 = blocks.vector_source_f(data0, True) + src1 = blocks.vector_source_f(data1, True) thr = blocks.throttle(gr.sizeof_float, 50000) - hed = gr.head(gr.sizeof_float, 10000000) + hed = blocks.head(gr.sizeof_float, 10000000) self.snk1 = qtgui.time_raster_sink_f(fs, nrows, ncols, [], [], "Float Time Raster Example", 2) diff --git a/gr-shd/apps/shd_rx_cfile b/gr-shd/apps/shd_rx_cfile index ceae858343..37eec05e0e 100755 --- a/gr-shd/apps/shd_rx_cfile +++ b/gr-shd/apps/shd_rx_cfile @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2011 Free Software Foundation, Inc. +# Copyright 2011,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -82,10 +82,10 @@ class rx_cfile_block(gr.top_block): self.connect(self._src, self._sink) else: if options.output_shorts: - self._head = gr.head(gr.sizeof_short*2, + self._head = blocks.head(gr.sizeof_short*2, int(options.nsamples)) else: - self._head = gr.head(gr.sizeof_gr_complex, + self._head = blocks.head(gr.sizeof_gr_complex, int(options.nsamples)) self.connect(self._src, self._head, self._sink) diff --git a/gr-trellis/doc/gr-trellis.xml b/gr-trellis/doc/gr-trellis.xml index 42bd54b32c..a835a2543a 100644 --- a/gr-trellis/doc/gr-trellis.xml +++ b/gr-trellis/doc/gr-trellis.xml @@ -571,7 +571,7 @@ and an initial state (which is set to 0 in this example). <programlisting> 15 # TX 16 src = gr.lfsr_32k_source_s() - 17 src_head = gr.head (gr.sizeof_short,Kb/16) # packet size in shorts + 17 src_head = blocks.head (gr.sizeof_short,Kb/16) # packet size in shorts 18 s2fsmi = blocks.packed_to_unpacked_ss(bitspersymbol,gr.GR_MSB_FIRST) # unpack shorts to symbols compatible with the FSM input cardinality 19 enc = trellis.encoder_ss(f,0) # initial state = 0 </programlisting> @@ -803,7 +803,7 @@ L being the channel length. This is sufficient to drive the initial and final st 22 for i in range(L): # first/last L symbols set to 0 23 packet[i] = 0 24 packet[len(packet)-i-1] = 0 - 25 src = gr.vector_source_s(packet,False) + 25 src = blocks.vector_source_s(packet,False) 26 mod = digital.chunks_to_symbols_sf(modulation[1],modulation[0]) </programlisting> @@ -826,11 +826,11 @@ Also note that the first L observations are irrelevant and thus can be skipped. </para> <programlisting> 33 # RX - 34 skip = gr.skiphead(gr.sizeof_float, L) # skip the first L samples since you know they are coming from the L zero symbols + 34 skip = blocks.skiphead(gr.sizeof_float, L) # skip the first L samples since you know they are coming from the L zero symbols 35 #metrics = trellis.metrics_f(f.O(),dimensionality,tot_constellation,trellis.TRELLIS_EUCLIDEAN) # data preprocessing to generate metrics for Viterbi 36 #va = trellis.viterbi_s(f,K+L,0,0) # Put -1 if the Initial/Final states are not set. 37 va = trellis.viterbi_combined_s(f,K+L,0,0,dimensionality,tot_constellation,trellis.TRELLIS_EUCLIDEAN) # using viterbi_combined_s instead of metrics_f/viterbi_s allows larger packet lengths because metrics_f is complaining for not being able to allocate large buffers. This is due to the large f.O() in this application... - 38 dst = gr.vector_sink_s() + 38 dst = blocks.vector_sink_s() </programlisting> <para> diff --git a/gr-trellis/doc/test_tcm.py b/gr-trellis/doc/test_tcm.py index aa84f55bee..6bfa083ae2 100644 --- a/gr-trellis/doc/test_tcm.py +++ b/gr-trellis/doc/test_tcm.py @@ -20,7 +20,7 @@ def run_test (f,Kb,bitspersymbol,K,dimensionality,constellation,N0,seed): # TX src = gr.lfsr_32k_source_s() - src_head = gr.head (gr.sizeof_short,Kb/16) # packet size in shorts + src_head = blocks.head (gr.sizeof_short,Kb/16) # packet size in shorts s2fsmi = blocks.packed_to_unpacked_ss(bitspersymbol,gr.GR_MSB_FIRST) # unpack shorts to symbols compatible with the FSM input cardinality enc = trellis.encoder_ss(f,0) # initial state = 0 mod = digital.chunks_to_symbols_sf(constellation,dimensionality) diff --git a/gr-trellis/doc/test_tcm.py.xml b/gr-trellis/doc/test_tcm.py.xml index 96a8042ff7..c66363098b 100644 --- a/gr-trellis/doc/test_tcm.py.xml +++ b/gr-trellis/doc/test_tcm.py.xml @@ -16,7 +16,7 @@ 14 15 # TX 16 src = gr.lfsr_32k_source_s() - 17 src_head = gr.head (gr.sizeof_short,Kb/16) # packet size in shorts + 17 src_head = blocks.head (gr.sizeof_short,Kb/16) # packet size in shorts 18 s2fsmi = blocks.packed_to_unpacked_ss(bitspersymbol,gr.GR_MSB_FIRST) # unpack shorts to symbols compatible with the FSM input cardinality 19 enc = trellis.encoder_ss(f,0) # initial state = 0 20 mod = digital.chunks_to_symbols_sf(constellation,dimensionality) diff --git a/gr-trellis/doc/test_viterbi_equalization1.py b/gr-trellis/doc/test_viterbi_equalization1.py index d53e2b3304..c1a831d0bb 100755 --- a/gr-trellis/doc/test_viterbi_equalization1.py +++ b/gr-trellis/doc/test_viterbi_equalization1.py @@ -28,7 +28,7 @@ def run_test (f,Kb,bitspersymbol,K,channel,modulation,dimensionality,tot_constel for i in range(L): # first/last L symbols set to 0 packet[i] = 0 packet[len(packet)-i-1] = 0 - src = gr.vector_source_s(packet,False) + src = blocks.vector_source_s(packet,False) mod = digital.chunks_to_symbols_sf(modulation[1],modulation[0]) # CHANNEL @@ -37,11 +37,11 @@ def run_test (f,Kb,bitspersymbol,K,channel,modulation,dimensionality,tot_constel noise = analog.noise_source_f(analog.GR_GAUSSIAN,math.sqrt(N0/2),seed) # RX - skip = gr.skiphead(gr.sizeof_float, L) # skip the first L samples since you know they are coming from the L zero symbols + skip = blocks.skiphead(gr.sizeof_float, L) # skip the first L samples since you know they are coming from the L zero symbols #metrics = trellis.metrics_f(f.O(),dimensionality,tot_constellation,digital.TRELLIS_EUCLIDEAN) # data preprocessing to generate metrics for Viterbi #va = trellis.viterbi_s(f,K+L,0,0) # Put -1 if the Initial/Final states are not set. va = trellis.viterbi_combined_s(f,K+L,0,0,dimensionality,tot_constellation,digital.TRELLIS_EUCLIDEAN) # using viterbi_combined_s instead of metrics_f/viterbi_s allows larger packet lengths because metrics_f is complaining for not being able to allocate large buffers. This is due to the large f.O() in this application... - dst = gr.vector_sink_s() + dst = blocks.vector_sink_s() tb.connect (src,mod) tb.connect (mod,isi,(add,0)) diff --git a/gr-trellis/doc/test_viterbi_equalization1.py.xml b/gr-trellis/doc/test_viterbi_equalization1.py.xml index 5aca46ab35..9179f4f156 100644 --- a/gr-trellis/doc/test_viterbi_equalization1.py.xml +++ b/gr-trellis/doc/test_viterbi_equalization1.py.xml @@ -24,7 +24,7 @@ 22 for i in range(L): # first/last L symbols set to 0 23 packet[i] = 0 24 packet[len(packet)-i-1] = 0 - 25 src = gr.vector_source_s(packet,False) + 25 src = blocks.vector_source_s(packet,False) 26 mod = digital.chunks_to_symbols_sf(modulation[1],modulation[0]) 27 28 # CHANNEL @@ -33,11 +33,11 @@ 31 noise = analog.noise_source_f(analog.GR_GAUSSIAN,math.sqrt(N0/2),seed) 32 33 # RX - 34 skip = gr.skiphead(gr.sizeof_float, L) # skip the first L samples since you know they are coming from the L zero symbols + 34 skip = blocks.skiphead(gr.sizeof_float, L) # skip the first L samples since you know they are coming from the L zero symbols 35 #metrics = trellis.metrics_f(f.O(),dimensionality,tot_constellation,trellis.TRELLIS_EUCLIDEAN) # data preprocessing to generate metrics for Viterbi 36 #va = trellis.viterbi_s(f,K+L,0,0) # Put -1 if the Initial/Final states are not set. 37 va = trellis.viterbi_combined_s(f,K+L,0,0,dimensionality,tot_constellation,trellis.TRELLIS_EUCLIDEAN) # using viterbi_combined_s instead of metrics_f/viterbi_s allows larger packet lengths because metrics_f is complaining for not being able to allocate large buffers. This is due to the large f.O() in this application... - 38 dst = gr.vector_sink_s() + 38 dst = blocks.vector_sink_s() 39 40 tb.connect (src,mod) 41 tb.connect (mod,isi,(add,0)) diff --git a/gr-trellis/examples/python/test_cpm.py b/gr-trellis/examples/python/test_cpm.py index 8d1e2024c1..99b75a7dd1 100755 --- a/gr-trellis/examples/python/test_cpm.py +++ b/gr-trellis/examples/python/test_cpm.py @@ -93,7 +93,7 @@ def run_test(seed,blocksize): ################################################## # Blocks ################################################## - random_source_x_0 = gr.vector_source_b(data.tolist(), False) + random_source_x_0 = blocks.vector_source_b(data.tolist(), False) digital_chunks_to_symbols_xx_0 = digital.chunks_to_symbols_bf((-1, 1), 1) filter_interp_fir_filter_xxx_0 = filter.interp_fir_filter_fff(Q, p) analog_frequency_modulator_fc_0 = analog.frequency_modulator_fc(2*math.pi*h*(1.0/Q)) @@ -107,11 +107,11 @@ def run_test(seed,blocksize): filter_fir_filter_xxx_0_0 = filter.fir_filter_ccc(Q, MF[0].conjugate()) filter_fir_filter_xxx_0_0_0 = filter.fir_filter_ccc(Q, MF[1].conjugate()) blocks_streams_to_stream_0 = blocks.streams_to_stream(gr.sizeof_gr_complex*1, int(N)) - gr_skiphead_0 = gr.skiphead(gr.sizeof_gr_complex*1, int(N*(1+0))) + blocks_skiphead_0 = blocks.skiphead(gr.sizeof_gr_complex*1, int(N*(1+0))) viterbi = trellis.viterbi_combined_cb(f, head+blocksize+tail, 0, -1, int(N), constellation, digital.TRELLIS_EUCLIDEAN) - gr_vector_sink_x_0 = gr.vector_sink_b() + blocks_vector_sink_x_0 = blocks.vector_sink_b() ################################################## # Connections @@ -127,13 +127,13 @@ def run_test(seed,blocksize): tb.connect((blocks_multiply_vxx_0, 0), (filter_fir_filter_xxx_0_0_0, 0)) tb.connect((filter_fir_filter_xxx_0_0, 0), (blocks_streams_to_stream_0, 0)) tb.connect((filter_fir_filter_xxx_0_0_0, 0), (blocks_streams_to_stream_0, 1)) - tb.connect((blocks_streams_to_stream_0, 0), (gr_skiphead_0, 0)) - tb.connect((gr_skiphead_0, 0), (viterbi, 0)) - tb.connect((viterbi, 0), (gr_vector_sink_x_0, 0)) + tb.connect((blocks_streams_to_stream_0, 0), (blocks_skiphead_0, 0)) + tb.connect((blocks_skiphead_0, 0), (viterbi, 0)) + tb.connect((viterbi, 0), (blocks_vector_sink_x_0, 0)) tb.run() - dataest = gr_vector_sink_x_0.data() + dataest = blocks_vector_sink_x_0.data() #print data #print numpy.array(dataest) perr = 0 diff --git a/gr-trellis/examples/python/test_pccc_turbo1.py b/gr-trellis/examples/python/test_pccc_turbo1.py index bb596f1818..8234726be0 100755 --- a/gr-trellis/examples/python/test_pccc_turbo1.py +++ b/gr-trellis/examples/python/test_pccc_turbo1.py @@ -20,11 +20,11 @@ def run_test (fo,fi,interleaver,Kb,bitspersymbol,K,dimensionality,constellation, # TX src = gr.lfsr_32k_source_s() - src_head = gr.head (gr.sizeof_short,Kb/16) # packet size in shorts + src_head = blocks.head (gr.sizeof_short,Kb/16) # packet size in shorts s2fsmi = blocks.packed_to_unpacked_ss(bitspersymbol,gr.GR_MSB_FIRST) # unpack shorts to symbols compatible with the outer FSM input cardinality - #src = gr.vector_source_s([0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1],False) + #src = blocks.vector_source_s([0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1],False) enc = trellis.pccc_encoder_ss(fo,0,fi,0,interleaver,K) - code = gr.vector_sink_s() + code = blocks.vector_sink_s() mod = digital.chunks_to_symbols_sf(constellation,dimensionality) # CHANNEL diff --git a/gr-trellis/examples/python/test_sccc_hard.py b/gr-trellis/examples/python/test_sccc_hard.py index ec1fdd1bc5..6cb85111a3 100755 --- a/gr-trellis/examples/python/test_sccc_hard.py +++ b/gr-trellis/examples/python/test_sccc_hard.py @@ -20,7 +20,7 @@ def run_test (fo,fi,interleaver,Kb,bitspersymbol,K,dimensionality,constellation, # TX src = gr.lfsr_32k_source_s() - src_head = gr.head (gr.sizeof_short,Kb/16) # packet size in shorts + src_head = blocks.head(gr.sizeof_short,Kb/16) # packet size in shorts s2fsmi = blocks.packed_to_unpacked_ss(bitspersymbol,gr.GR_MSB_FIRST) # unpack shorts to symbols compatible with the outer FSM input cardinality enc_out = trellis.encoder_ss(fo,0) # initial state = 0 inter = trellis.permutation(interleaver.K(),interleaver.INTER(),1,gr.sizeof_short) diff --git a/gr-trellis/examples/python/test_sccc_soft.py b/gr-trellis/examples/python/test_sccc_soft.py index f663c9befd..782d2f9134 100755 --- a/gr-trellis/examples/python/test_sccc_soft.py +++ b/gr-trellis/examples/python/test_sccc_soft.py @@ -20,7 +20,7 @@ def run_test (fo,fi,interleaver,Kb,bitspersymbol,K,dimensionality,constellation, # TX src = gr.lfsr_32k_source_s() - src_head = gr.head (gr.sizeof_short,Kb/16) # packet size in shorts + src_head = blocks.head (gr.sizeof_short,Kb/16) # packet size in shorts s2fsmi = blocks.packed_to_unpacked_ss(bitspersymbol,gr.GR_MSB_FIRST) # unpack shorts to symbols compatible with the outer FSM input cardinality enc_out = trellis.encoder_ss(fo,0) # initial state = 0 inter = trellis.permutation(interleaver.K(),interleaver.INTER(),1,gr.sizeof_short) @@ -33,7 +33,7 @@ def run_test (fo,fi,interleaver,Kb,bitspersymbol,K,dimensionality,constellation, # RX metrics_in = trellis.metrics_f(fi.O(),dimensionality,constellation,digital.TRELLIS_EUCLIDEAN) # data preprocessing to generate metrics for innner Viterbi - gnd = gr.vector_source_f([0],True); + gnd = blocks.vector_source_f([0],True); siso_in = trellis.siso_f(fi,K,0,-1,True,False,trellis.TRELLIS_MIN_SUM) # Put -1 if the Initial/Final states are not set. deinter = trellis.permutation(interleaver.K(),interleaver.DEINTER(),fi.I(),gr.sizeof_float) va_out = trellis.viterbi_s(fo,K,0,-1) # Put -1 if the Initial/Final states are not set. diff --git a/gr-trellis/examples/python/test_sccc_turbo.py b/gr-trellis/examples/python/test_sccc_turbo.py index cd974e9941..2a1e742a3b 100755 --- a/gr-trellis/examples/python/test_sccc_turbo.py +++ b/gr-trellis/examples/python/test_sccc_turbo.py @@ -17,7 +17,7 @@ except ImportError: def make_rx(tb,fo,fi,dimensionality,constellation,K,interleaver,IT,Es,N0,type): metrics_in = trellis.metrics_f(fi.O(),dimensionality,constellation,digital.TRELLIS_EUCLIDEAN) # data preprocessing to generate metrics for innner Viterbi scale = blocks.multiply_const_ff(1.0/N0) - gnd = gr.vector_source_f([0],True); + gnd = blocks.vector_source_f([0],True); inter=[] deinter=[] @@ -60,7 +60,7 @@ def run_test (fo,fi,interleaver,Kb,bitspersymbol,K,dimensionality,constellation, # TX src = gr.lfsr_32k_source_s() - src_head = gr.head (gr.sizeof_short,Kb/16) # packet size in shorts + src_head = blocks.head(gr.sizeof_short,Kb/16) # packet size in shorts s2fsmi = blocks.packed_to_unpacked_ss(bitspersymbol,gr.GR_MSB_FIRST) # unpack shorts to symbols compatible with the outer FSM input cardinality enc_out = trellis.encoder_ss(fo,0) # initial state = 0 inter = trellis.permutation(interleaver.K(),interleaver.INTER(),1,gr.sizeof_short) diff --git a/gr-trellis/examples/python/test_sccc_turbo1.py b/gr-trellis/examples/python/test_sccc_turbo1.py index 93833ec7df..6c5a01d681 100755 --- a/gr-trellis/examples/python/test_sccc_turbo1.py +++ b/gr-trellis/examples/python/test_sccc_turbo1.py @@ -19,7 +19,7 @@ def run_test (fo,fi,interleaver,Kb,bitspersymbol,K,dimensionality,constellation, # TX src = gr.lfsr_32k_source_s() - src_head = gr.head (gr.sizeof_short,Kb/16) # packet size in shorts + src_head = blocks.head(gr.sizeof_short,Kb/16) # packet size in shorts s2fsmi = blocks.packed_to_unpacked_ss(bitspersymbol,gr.GR_MSB_FIRST) # unpack shorts to symbols compatible with the outer FSM input cardinality enc = trellis.sccc_encoder_ss(fo,0,fi,0,interleaver,K) mod = digital.chunks_to_symbols_sf(constellation,dimensionality) diff --git a/gr-trellis/examples/python/test_sccc_turbo2.py b/gr-trellis/examples/python/test_sccc_turbo2.py index 116a2ca6b2..40b8e03260 100755 --- a/gr-trellis/examples/python/test_sccc_turbo2.py +++ b/gr-trellis/examples/python/test_sccc_turbo2.py @@ -19,7 +19,7 @@ def run_test (fo,fi,interleaver,Kb,bitspersymbol,K,dimensionality,constellation, # TX src = gr.lfsr_32k_source_s() - src_head = gr.head (gr.sizeof_short,Kb/16) # packet size in shorts + src_head = blocks.head(gr.sizeof_short,Kb/16) # packet size in shorts s2fsmi = blocks.packed_to_unpacked_ss(bitspersymbol,gr.GR_MSB_FIRST) # unpack shorts to symbols compatible with the outer FSM input cardinality enc = trellis.sccc_encoder_ss(fo,0,fi,0,interleaver,K) mod = digital.chunks_to_symbols_sf(constellation,dimensionality) diff --git a/gr-trellis/examples/python/test_tcm.py b/gr-trellis/examples/python/test_tcm.py index 8a815ae12a..79e2958842 100755 --- a/gr-trellis/examples/python/test_tcm.py +++ b/gr-trellis/examples/python/test_tcm.py @@ -24,9 +24,9 @@ def run_test (f,Kb,bitspersymbol,K,dimensionality,constellation,N0,seed): #packet = [0]*Kb #for i in range(Kb-1*16): # last 16 bits = 0 to drive the final state to 0 #packet[i] = random.randint(0, 1) # random 0s and 1s - #src = gr.vector_source_s(packet,False) + #src = blocks.vector_source_s(packet,False) src = gr.lfsr_32k_source_s() - src_head = gr.head (gr.sizeof_short,Kb/16) # packet size in shorts + src_head = blocks.head(gr.sizeof_short,Kb/16) # packet size in shorts #b2s = blocks.unpacked_to_packed_ss(1,gr.GR_MSB_FIRST) # pack bits in shorts s2fsmi = blocks.packed_to_unpacked_ss(bitspersymbol,gr.GR_MSB_FIRST) # unpack shorts to symbols compatible with the FSM input cardinality enc = trellis.encoder_ss(f,0) # initial state = 0 @@ -41,7 +41,7 @@ def run_test (f,Kb,bitspersymbol,K,dimensionality,constellation,N0,seed): va = trellis.viterbi_s(f,K,0,-1) # Put -1 if the Initial/Final states are not set. fsmi2s = blocks.unpacked_to_packed_ss(bitspersymbol,gr.GR_MSB_FIRST) # pack FSM input symbols to shorts #s2b = blocks.packed_to_unpacked_ss(1,gr.GR_MSB_FIRST) # unpack shorts to bits - #dst = gr.vector_sink_s(); + #dst = blocks.vector_sink_s(); dst = gr.check_lfsr_32k_s() diff --git a/gr-trellis/examples/python/test_tcm_bit.py b/gr-trellis/examples/python/test_tcm_bit.py index 6308df1d09..f921584ab9 100755 --- a/gr-trellis/examples/python/test_tcm_bit.py +++ b/gr-trellis/examples/python/test_tcm_bit.py @@ -24,9 +24,9 @@ def run_test (f,Kb,bitspersymbol,K,dimensionality,constellation,N0,seed): # this for loop is TOO slow!!! for i in range(Kb-1*16): # last 16 bits = 0 to drive the final state to 0 packet[i] = random.randint(0, 1) # random 0s and 1s - src = gr.vector_source_s(packet,False) + src = blocks.vector_source_s(packet,False) #src = gr.lfsr_32k_source_s() - #src_head = gr.head (gr.sizeof_short,Kb/16) # packet size in shorts + #src_head = blocks.head (gr.sizeof_short,Kb/16) # packet size in shorts b2s = blocks.unpacked_to_packed_ss(1,gr.GR_MSB_FIRST) # pack bits in shorts s2fsmi = blocks.packed_to_unpacked_ss(bitspersymbol,gr.GR_MSB_FIRST) # unpack shorts to symbols compatible with the FSM input cardinality enc = trellis.encoder_ss(f,0) # initial state = 0 @@ -43,7 +43,7 @@ def run_test (f,Kb,bitspersymbol,K,dimensionality,constellation,N0,seed): va = trellis.viterbi_s(f,K,0,-1) # Put -1 if the Initial/Final states are not set. fsmi2s = blocks.unpacked_to_packed_ss(bitspersymbol,gr.GR_MSB_FIRST) # pack FSM input symbols to shorts s2b = blocks.packed_to_unpacked_ss(1,gr.GR_MSB_FIRST) # unpack shorts to bits - dst = gr.vector_sink_s(); + dst = blocks.vector_sink_s(); #dst = gr.check_lfsr_32k_s(); diff --git a/gr-trellis/examples/python/test_tcm_combined.py b/gr-trellis/examples/python/test_tcm_combined.py index 198d038ce3..5bce13899b 100755 --- a/gr-trellis/examples/python/test_tcm_combined.py +++ b/gr-trellis/examples/python/test_tcm_combined.py @@ -20,7 +20,7 @@ def run_test (f,Kb,bitspersymbol,K,dimensionality,constellation,N0,seed): # TX src = gr.lfsr_32k_source_s() - src_head = gr.head (gr.sizeof_short,Kb/16) # packet size in shorts + src_head = blocks.head(gr.sizeof_short,Kb/16) # packet size in shorts s2fsmi = blocks.packed_to_unpacked_ss(bitspersymbol,gr.GR_MSB_FIRST) # unpack shorts to symbols compatible with the FSM input cardinality enc = trellis.encoder_ss(f,0) # initial state = 0 mod = digital.chunks_to_symbols_sf(constellation,dimensionality) diff --git a/gr-trellis/examples/python/test_tcm_parallel.py b/gr-trellis/examples/python/test_tcm_parallel.py index d2527956e9..f87b12c444 100755 --- a/gr-trellis/examples/python/test_tcm_parallel.py +++ b/gr-trellis/examples/python/test_tcm_parallel.py @@ -20,7 +20,7 @@ def run_test (f,Kb,bitspersymbol,K,dimensionality,constellation,N0,seed,P): # TX src = gr.lfsr_32k_source_s() - src_head = gr.head (gr.sizeof_short,Kb/16*P) # packet size in shorts + src_head = blocks.head(gr.sizeof_short,Kb/16*P) # packet size in shorts s2fsmi=blocks.packed_to_unpacked_ss(bitspersymbol,gr.GR_MSB_FIRST) # unpack shorts to symbols compatible with the FSM input cardinality s2p = blocks.stream_to_streams(gr.sizeof_short,P) # serial to parallel enc = trellis.encoder_ss(f,0) # initiali state = 0 diff --git a/gr-trellis/examples/python/test_turbo_equalization.py b/gr-trellis/examples/python/test_turbo_equalization.py index 41361fd3db..c82d8dcb41 100755 --- a/gr-trellis/examples/python/test_turbo_equalization.py +++ b/gr-trellis/examples/python/test_turbo_equalization.py @@ -16,7 +16,7 @@ except ImportError: def make_rx(tb,fo,fi,dimensionality,tot_constellation,K,interleaver,IT,Es,N0,type): metrics_in = trellis.metrics_f(fi.O(),dimensionality,tot_constellation,digital.TRELLIS_EUCLIDEAN) # data preprocessing to generate metrics for innner SISO scale = blocks.multiply_const_ff(1.0/N0) - gnd = gr.vector_source_f([0],True); + gnd = blocks.vector_source_f([0],True); inter=[] deinter=[] @@ -58,7 +58,7 @@ def run_test (fo,fi,interleaver,Kb,bitspersymbol,K,dimensionality,tot_constellat # TX src = gr.lfsr_32k_source_s() - src_head = gr.head (gr.sizeof_short,Kb/16) # packet size in shorts + src_head = blocks.head(gr.sizeof_short,Kb/16) # packet size in shorts s2fsmi = blocks.packed_to_unpacked_ss(bitspersymbol,gr.GR_MSB_FIRST) # unpack shorts to symbols compatible with the iouter FSM input cardinality enc_out = trellis.encoder_ss(fo,0) # initial state = 0 inter = trellis.permutation(interleaver.K(),interleaver.INTER(),1,gr.sizeof_short) diff --git a/gr-trellis/examples/python/test_turbo_equalization1.py b/gr-trellis/examples/python/test_turbo_equalization1.py index ae7e3e374b..5ff21ec757 100755 --- a/gr-trellis/examples/python/test_turbo_equalization1.py +++ b/gr-trellis/examples/python/test_turbo_equalization1.py @@ -17,7 +17,7 @@ except ImportError: def make_rx(tb,fo,fi,dimensionality,tot_constellation,K,interleaver,IT,Es,N0,type): metrics_in = trellis.metrics_f(fi.O(),dimensionality,tot_constellation,digital.TRELLIS_EUCLIDEAN) # data preprocessing to generate metrics for innner SISO scale = blocks.multiply_const_ff(1.0/N0) - gnd = gr.vector_source_f([0],True); + gnd = blocks.vector_source_f([0],True); inter=[] deinter=[] @@ -64,7 +64,7 @@ def run_test (fo,fi,interleaver,Kb,bitspersymbol,K,channel,modulation,dimensiona random.seed(seed) for i in range(len(packet)): packet[i] = random.randint(0, 2**bitspersymbol - 1) # random symbols - src = gr.vector_source_s(packet,False) + src = blocks.vector_source_s(packet,False) enc_out = trellis.encoder_ss(fo,0) # initial state = 0 inter = trellis.permutation(interleaver.K(),interleaver.INTER(),1,gr.sizeof_short) mod = digital.chunks_to_symbols_sf(modulation[1],modulation[0]) @@ -76,7 +76,7 @@ def run_test (fo,fi,interleaver,Kb,bitspersymbol,K,channel,modulation,dimensiona # RX (head,tail) = make_rx(tb,fo,fi,dimensionality,tot_constellation,K,interleaver,IT,Es,N0,trellis.TRELLIS_MIN_SUM) - dst = gr.vector_sink_s(); + dst = blocks.vector_sink_s(); tb.connect (src,enc_out,inter,mod) tb.connect (mod,isi,(add,0)) diff --git a/gr-trellis/examples/python/test_turbo_equalization2.py b/gr-trellis/examples/python/test_turbo_equalization2.py index eed5675fe5..c2af9fbfca 100755 --- a/gr-trellis/examples/python/test_turbo_equalization2.py +++ b/gr-trellis/examples/python/test_turbo_equalization2.py @@ -16,7 +16,7 @@ except ImportError: def make_rx(tb,fo,fi,dimensionality,tot_constellation,K,interleaver,IT,Es,N0,type): scale = blocks.multiply_const_ff(math.sqrt(1.0/N0)) - gnd = gr.vector_source_f([0],True); + gnd = blocks.vector_source_f([0],True); inter=[] deinter=[] @@ -62,7 +62,7 @@ def run_test (fo,fi,interleaver,Kb,bitspersymbol,K,channel,modulation,dimensiona random.seed(seed) for i in range(len(packet)): packet[i] = random.randint(0, 2**bitspersymbol - 1) # random symbols - src = gr.vector_source_s(packet,False) + src = blocks.vector_source_s(packet,False) enc_out = trellis.encoder_ss(fo,0) # initial state = 0 inter = trellis.permutation(interleaver.K(),interleaver.INTER(),1,gr.sizeof_short) mod = digital.chunks_to_symbols_sf(modulation[1],modulation[0]) @@ -74,7 +74,7 @@ def run_test (fo,fi,interleaver,Kb,bitspersymbol,K,channel,modulation,dimensiona # RX (head,tail) = make_rx(tb,fo,fi,dimensionality,tot_constellation,K,interleaver,IT,Es,N0,trellis.TRELLIS_MIN_SUM) - dst = gr.vector_sink_s(); + dst = blocks.vector_sink_s(); tb.connect (src,enc_out,inter,mod) tb.connect (mod,isi,(add,0)) diff --git a/gr-trellis/examples/python/test_viterbi_equalization.py b/gr-trellis/examples/python/test_viterbi_equalization.py index f83125136c..f1e61f90cb 100755 --- a/gr-trellis/examples/python/test_viterbi_equalization.py +++ b/gr-trellis/examples/python/test_viterbi_equalization.py @@ -18,7 +18,7 @@ def run_test (f,Kb,bitspersymbol,K,dimensionality,tot_constellation,N0,seed): # TX src = gr.lfsr_32k_source_s() - src_head = gr.head (gr.sizeof_short,Kb/16) # packet size in shorts + src_head = blocks.head (gr.sizeof_short,Kb/16) # packet size in shorts s2fsmi = blocks.packed_to_unpacked_ss(bitspersymbol,gr.GR_MSB_FIRST) # unpack shorts to symbols compatible with the FSM input cardinality enc = trellis.encoder_ss(f,0) # initial state = 0 # essentially here we implement the combination of modulation and channel as a memoryless modulation (the memory induced by the channel is hidden in the FSM) diff --git a/gr-trellis/examples/python/test_viterbi_equalization1.py b/gr-trellis/examples/python/test_viterbi_equalization1.py index df46046ae3..baa6a27f1b 100755 --- a/gr-trellis/examples/python/test_viterbi_equalization1.py +++ b/gr-trellis/examples/python/test_viterbi_equalization1.py @@ -27,7 +27,7 @@ def run_test (f,Kb,bitspersymbol,K,channel,modulation,dimensionality,tot_constel for i in range(L): # first/last L symbols set to 0 packet[i] = 0 packet[len(packet)-i-1] = 0 - src = gr.vector_source_s(packet,False) + src = blocks.vector_source_s(packet,False) mod = digital.chunks_to_symbols_sf(modulation[1],modulation[0]) # CHANNEL @@ -36,11 +36,11 @@ def run_test (f,Kb,bitspersymbol,K,channel,modulation,dimensionality,tot_constel noise = analog.noise_source_f(analog.GR_GAUSSIAN,math.sqrt(N0/2),seed) # RX - skip = gr.skiphead(gr.sizeof_float, L) # skip the first L samples since you know they are coming from the L zero symbols + skip = blocks.skiphead(gr.sizeof_float, L) # skip the first L samples since you know they are coming from the L zero symbols #metrics = trellis.metrics_f(f.O(),dimensionality,tot_constellation,digital.TRELLIS_EUCLIDEAN) # data preprocessing to generate metrics for Viterbi #va = trellis.viterbi_s(f,K+L,-1,0) # Put -1 if the Initial/Final states are not set. va = trellis.viterbi_combined_fs(f,K+L,0,0,dimensionality,tot_constellation,digital.TRELLIS_EUCLIDEAN) # using viterbi_combined_fs instead of metrics_f/viterbi_s allows larger packet lengths because metrics_f is complaining for not being able to allocate large buffers. This is due to the large f.O() in this application... - dst = gr.vector_sink_s() + dst = blocks.vector_sink_s() tb.connect (src,mod) tb.connect (mod,isi,(add,0)) diff --git a/gr-trellis/python/qa_trellis.py b/gr-trellis/python/qa_trellis.py index 983a749af6..07097f906c 100755 --- a/gr-trellis/python/qa_trellis.py +++ b/gr-trellis/python/qa_trellis.py @@ -108,7 +108,7 @@ class trellis_tb(gr.top_block): # TX src = gr.lfsr_32k_source_s() # packet size in shorts - src_head = gr.head (gr.sizeof_short, packet_size/16) + src_head = blocks.head(gr.sizeof_short, packet_size/16) # unpack shorts to symbols compatible with the FSM input cardinality s2fsmi = blocks.packed_to_unpacked_ss(bitspersymbol, gr.GR_MSB_FIRST) # initial FSM state = 0 diff --git a/gr-uhd/apps/uhd_rx_cfile b/gr-uhd/apps/uhd_rx_cfile index f9ed392564..5531bb35b8 100755 --- a/gr-uhd/apps/uhd_rx_cfile +++ b/gr-uhd/apps/uhd_rx_cfile @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2012 Free Software Foundation, Inc. +# Copyright 2012,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -83,9 +83,9 @@ class rx_cfile_block(gr.top_block): self.connect(self._u, self._sink) else: if options.output_shorts: - self._head = gr.head(gr.sizeof_short*2, int(options.nsamples)) + self._head = blocks.head(gr.sizeof_short*2, int(options.nsamples)) else: - self._head = gr.head(gr.sizeof_gr_complex, int(options.nsamples)) + self._head = blocks.head(gr.sizeof_gr_complex, int(options.nsamples)) self.connect(self._u, self._head, self._sink) diff --git a/gr-uhd/examples/grc/uhd_rx_dpsk.grc b/gr-uhd/examples/grc/uhd_rx_dpsk.grc index 73848ff3cd..b40c541629 100644 --- a/gr-uhd/examples/grc/uhd_rx_dpsk.grc +++ b/gr-uhd/examples/grc/uhd_rx_dpsk.grc @@ -310,10 +310,10 @@ </param> </block> <block> - <key>gr_null_sink</key> + <key>blocks_null_sink</key> <param> <key>id</key> - <value>gr_null_sink_0</value> + <value>blocks_null_sink_0</value> </param> <param> <key>_enabled</key> @@ -1406,7 +1406,7 @@ </block> <connection> <source_block_id>digital_dxpsk_demod_0</source_block_id> - <sink_block_id>gr_null_sink_0</sink_block_id> + <sink_block_id>blocks_null_sink_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> diff --git a/gr-uhd/examples/python/max_power.py b/gr-uhd/examples/python/max_power.py index 79fe120641..e1504e5ea2 100755 --- a/gr-uhd/examples/python/max_power.py +++ b/gr-uhd/examples/python/max_power.py @@ -27,6 +27,7 @@ Setup USRP for maximum power consumption. from gnuradio import gr from gnuradio import analog +from gnuradio import blocks from gnuradio import uhd from gnuradio.eng_option import eng_option from optparse import OptionParser @@ -95,7 +96,7 @@ class build_block(gr.top_block): self.u_rx = uhd.usrp_source(device_addr=args, io_type=uhd.io_type.COMPLEX_FLOAT32, num_channels=rx_nchan) - self.rx_dst0 = gr.null_sink(gr.sizeof_gr_complex) + self.rx_dst0 = blocks.null_sink(gr.sizeof_gr_complex) self.u_rx.set_samp_rate(MAX_RATE) diff --git a/gr-uhd/examples/python/usrp_tv_rcv.py b/gr-uhd/examples/python/usrp_tv_rcv.py index d94b651660..301840f41d 100755 --- a/gr-uhd/examples/python/usrp_tv_rcv.py +++ b/gr-uhd/examples/python/usrp_tv_rcv.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2005-2007,2011,2012 Free Software Foundation, Inc. +# Copyright 2005-2007,2011-2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -226,7 +226,7 @@ class tv_rx_block (stdgui2.std_top_block): elif process_type=='do_nullsink': #self.connect (self.src, self.am_demod,self.invert_and_scale,f2uc,video_sink) c2r=blocks.complex_to_real() - nullsink=gr.null_sink(gr.sizeof_float) + nullsink=blocks.null_sink(gr.sizeof_float) self.connect (self.src, c2r,nullsink) #video_sink) elif process_type=='do_tv_sync_corr': frame_size=width*height #int(usrp_rate/25.0) diff --git a/gr-uhd/examples/python/usrp_tv_rcv_nogui.py b/gr-uhd/examples/python/usrp_tv_rcv_nogui.py index 13395cef46..80e2e1c17a 100755 --- a/gr-uhd/examples/python/usrp_tv_rcv_nogui.py +++ b/gr-uhd/examples/python/usrp_tv_rcv_nogui.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2005-2007,2011 Free Software Foundation, Inc. +# Copyright 2005-2007,2011,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -202,7 +202,7 @@ class my_top_block(gr.top_block): if options.nframes is None: self.connect(self.src, self.agc) else: - self.head = gr.head(gr.sizeof_gr_complex, int(options.nframes*width*height)) + self.head = blocks.head(gr.sizeof_gr_complex, int(options.nframes*width*height)) self.connect(self.src, self.head, self.agc) self.connect (self.agc, self.am_demod, self.invert_and_scale, diff --git a/gr-vocoder/python/qa_alaw_vocoder.py b/gr-vocoder/python/qa_alaw_vocoder.py index a8d65409e5..50b5f8844a 100755 --- a/gr-vocoder/python/qa_alaw_vocoder.py +++ b/gr-vocoder/python/qa_alaw_vocoder.py @@ -21,7 +21,8 @@ # from gnuradio import gr, gr_unittest -from vocoder_swig import * +import vocoder_swig as vocoder +import blocks_swig as blocks class test_alaw_vocoder (gr_unittest.TestCase): @@ -34,10 +35,10 @@ class test_alaw_vocoder (gr_unittest.TestCase): def test001_module_load (self): data = (8,24,40,56,72,88,104,120,136,152,168,184, 200,216,232,248,264,280,296,312,328,344) - src = gr.vector_source_s(data) - enc = alaw_encode_sb() - dec = alaw_decode_bs() - snk = gr.vector_sink_s() + src = blocks.vector_source_s(data) + enc = vocoder.alaw_encode_sb() + dec = vocoder.alaw_decode_bs() + snk = blocks.vector_sink_s() self.tb.connect(src, enc, dec, snk) self.tb.run() actual_result = snk.data() diff --git a/gr-vocoder/python/qa_codec2_vocoder.py b/gr-vocoder/python/qa_codec2_vocoder.py index 7f38904459..83dbc2eb87 100755 --- a/gr-vocoder/python/qa_codec2_vocoder.py +++ b/gr-vocoder/python/qa_codec2_vocoder.py @@ -21,7 +21,8 @@ # from gnuradio import gr, gr_unittest -from vocoder_swig import * +import vocoder_swig as vocoder +import blocks_swig as blocks class test_codec2_vocoder (gr_unittest.TestCase): @@ -45,10 +46,10 @@ class test_codec2_vocoder (gr_unittest.TestCase): 31,-82,-98,-51,6,93,104,44,-5,-84,-107,-44,45,102,104, 15,-47,-107,-126,-87,-11,89,93,13,-95,-136,-187,-70, -167,216,-70,-103,175,-284,-486) - src = gr.vector_source_s(data) - enc = codec2_encode_sp() - dec = codec2_decode_ps() - snk = gr.vector_sink_s() + src = blocks.vector_source_s(data) + enc = vocoder.codec2_encode_sp() + dec = vocoder.codec2_decode_ps() + snk = blocks.vector_sink_s() self.tb.connect(src, enc, dec, snk) self.tb.run() actual_result = snk.data() diff --git a/gr-vocoder/python/qa_cvsd_vocoder.py b/gr-vocoder/python/qa_cvsd_vocoder.py index 42cb7f19b9..548c877526 100755 --- a/gr-vocoder/python/qa_cvsd_vocoder.py +++ b/gr-vocoder/python/qa_cvsd_vocoder.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2007,2010,2011 Free Software Foundation, Inc. +# Copyright 2007,2010,2011,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -21,8 +21,8 @@ # from gnuradio import gr, gr_unittest -from vocoder_swig import * -from cvsd import * +import vocoder_swig as vocoder +import cvsd import blocks_swig as blocks import filter_swig as filter @@ -35,10 +35,10 @@ class test_cvsd_vocoder (gr_unittest.TestCase): self.tb = None def test001_module_load (self): - raw_enc = cvsd_encode_sb() - raw_dec = cvsd_decode_bs() - hb_enc = cvsd_encode_fb() - hb_dec = cvsd_decode_bf() + raw_enc = vocoder.cvsd_encode_sb() + raw_dec = vocoder.cvsd_decode_bs() + hb_enc = cvsd.cvsd_encode_fb() + hb_dec = cvsd.cvsd_decode_bf() """ Disable for now @@ -100,20 +100,20 @@ class test_cvsd_vocoder (gr_unittest.TestCase): # WARNING: not importing analog in this QA code. # If we enable this, we can probably just create a sin with numpy. src = analog.sig_source_f(sample_rate, analog.GR_SIN_WAVE, 200, 1, 0) - head = gr.head(gr.sizeof_float, 100) + head = blocks.head(gr.sizeof_float, 100) src_scale = blocks.multiply_const_ff(scale_factor) interp = filter.rational_resampler_fff(8, 1) f2s = blocks.float_to_short() - enc = cvsd_vocoder.encode_sb() - dec = cvsd_vocoder.decode_bs() + enc = vocoder.cvsd_vocoder.encode_sb() + dec = vocoder.cvsd_vocoder.decode_bs() s2f = blocks.short_to_float() decim = filter.rational_resampler_fff(1, 8) sink_scale = blocks.multiply_const_ff(1.0/scale_factor) - sink = gr.vector_sink_f() + sink = blocks.vector_sink_f() self.tb.connect(src, src_scale, interp, f2s, enc) self.tb.connect(enc, dec, s2f, decim, sink_scale, head, sink) diff --git a/gr-vocoder/python/qa_g721_vocoder.py b/gr-vocoder/python/qa_g721_vocoder.py index e6ac04e155..ed53771076 100755 --- a/gr-vocoder/python/qa_g721_vocoder.py +++ b/gr-vocoder/python/qa_g721_vocoder.py @@ -21,7 +21,8 @@ # from gnuradio import gr, gr_unittest -from vocoder_swig import * +import vocoder_swig as vocoder +import blocks_swig as blocks class test_g721_vocoder (gr_unittest.TestCase): @@ -34,10 +35,10 @@ class test_g721_vocoder (gr_unittest.TestCase): def test001_module_load (self): data = (8,24,36,52,56,64,76,88,104,124,132,148,172, 196,220,244,280,320,372,416,468,524,580,648) - src = gr.vector_source_s(data) - enc = g721_encode_sb() - dec = g721_decode_bs() - snk = gr.vector_sink_s() + src = blocks.vector_source_s(data) + enc = vocoder.g721_encode_sb() + dec = vocoder.g721_decode_bs() + snk = blocks.vector_sink_s() self.tb.connect(src, enc, dec, snk) self.tb.run() actual_result = snk.data() diff --git a/gr-vocoder/python/qa_g723_24_vocoder.py b/gr-vocoder/python/qa_g723_24_vocoder.py index eda9ed86bd..f473e85677 100755 --- a/gr-vocoder/python/qa_g723_24_vocoder.py +++ b/gr-vocoder/python/qa_g723_24_vocoder.py @@ -21,7 +21,8 @@ # from gnuradio import gr, gr_unittest -from vocoder_swig import * +import vocoder_swig as vocoder +import blocks_swig as blocks class test_g723_24_vocoder (gr_unittest.TestCase): @@ -33,10 +34,10 @@ class test_g723_24_vocoder (gr_unittest.TestCase): def test001_module_load (self): data = (0,16,36,40,68,104,148,220,320,512) - src = gr.vector_source_s(data) - enc = g723_24_encode_sb() - dec = g723_24_decode_bs() - snk = gr.vector_sink_s() + src = blocks.vector_source_s(data) + enc = vocoder.g723_24_encode_sb() + dec = vocoder.g723_24_decode_bs() + snk = blocks.vector_sink_s() self.tb.connect(src, enc, dec, snk) self.tb.run() actual_result = snk.data() diff --git a/gr-vocoder/python/qa_g723_40_vocoder.py b/gr-vocoder/python/qa_g723_40_vocoder.py index db6b7538f3..e7ca4587b7 100755 --- a/gr-vocoder/python/qa_g723_40_vocoder.py +++ b/gr-vocoder/python/qa_g723_40_vocoder.py @@ -21,7 +21,8 @@ # from gnuradio import gr, gr_unittest -from vocoder_swig import * +import vocoder_swig as vocoder +import blocks_swig as blocks class test_g723_40_vocoder (gr_unittest.TestCase): @@ -33,10 +34,10 @@ class test_g723_40_vocoder (gr_unittest.TestCase): def test001_module_load (self): data = (0,8,36,72,100,152,228,316,404,528) - src = gr.vector_source_s(data) - enc = g723_40_encode_sb() - dec = g723_40_decode_bs() - snk = gr.vector_sink_s() + src = blocks.vector_source_s(data) + enc = vocoder.g723_40_encode_sb() + dec = vocoder.g723_40_decode_bs() + snk = blocks.vector_sink_s() self.tb.connect(src, enc, dec, snk) self.tb.run() actual_result = snk.data() diff --git a/gr-vocoder/python/qa_gsm_full_rate.py b/gr-vocoder/python/qa_gsm_full_rate.py index 4a7692ecd4..a62781ea94 100755 --- a/gr-vocoder/python/qa_gsm_full_rate.py +++ b/gr-vocoder/python/qa_gsm_full_rate.py @@ -21,7 +21,8 @@ # from gnuradio import gr, gr_unittest -import vocoder_swig +import vocoder_swig as vocoder +import blocks_swig as blocks class test_gsm_vocoder (gr_unittest.TestCase): @@ -47,10 +48,10 @@ class test_gsm_vocoder (gr_unittest.TestCase): 680,600,240,168,112,408,488,472,608,480,240,232, 208,288,480,600,616,520,176,88,184,296,392,584, 656,552,248,160,144,336,432,512,608,664) - src = gr.vector_source_s(data) - enc = vocoder_swig.gsm_fr_encode_sp() - dec = vocoder_swig.gsm_fr_decode_ps() - snk = gr.vector_sink_s() + src = blocks.vector_source_s(data) + enc = vocoder.gsm_fr_encode_sp() + dec = vocoder.gsm_fr_decode_ps() + snk = blocks.vector_sink_s() self.tb.connect(src, enc, dec, snk) self.tb.run() actual_result = snk.data() diff --git a/gr-vocoder/python/qa_ulaw_vocoder.py b/gr-vocoder/python/qa_ulaw_vocoder.py index a87aae762c..a030e065cc 100755 --- a/gr-vocoder/python/qa_ulaw_vocoder.py +++ b/gr-vocoder/python/qa_ulaw_vocoder.py @@ -21,7 +21,8 @@ # from gnuradio import gr, gr_unittest -from vocoder_swig import * +import vocoder_swig as vocoder +import blocks_swig as blocks class test_ulaw_vocoder (gr_unittest.TestCase): @@ -34,10 +35,10 @@ class test_ulaw_vocoder (gr_unittest.TestCase): def test001_module_load (self): data = (8,24,40,56,72,88,104,120,132,148,164,180, 196,212,228,244,260,276,292,308,324,340) - src = gr.vector_source_s(data) - enc = ulaw_encode_sb() - dec = ulaw_decode_bs() - snk = gr.vector_sink_s() + src = blocks.vector_source_s(data) + enc = vocoder.ulaw_encode_sb() + dec = vocoder.ulaw_decode_bs() + snk = blocks.vector_sink_s() self.tb.connect(src, enc, dec, snk) self.tb.run() actual_result = snk.data() diff --git a/gr-wavelet/python/qa_classify.py b/gr-wavelet/python/qa_classify.py index c2972c92f2..8dfc6ca5f9 100755 --- a/gr-wavelet/python/qa_classify.py +++ b/gr-wavelet/python/qa_classify.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2008,2010 Free Software Foundation, Inc. +# Copyright 2008,2010,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -51,8 +51,8 @@ class test_classify(gr_unittest.TestCase): # def test_000_(self): # src_data = numpy.zeros(10) # trg_data = numpy.zeros(10) -# src = gr.vector_source_f(src_data) -# dst = gr.vector_sink_f() +# src = blocks.vector_source_f(src_data) +# dst = blocks.vector_sink_f() # self.tb.connect(src, dst) # self.tb.run() # rsl_data = dst.data() @@ -66,8 +66,8 @@ class test_classify(gr_unittest.TestCase): def test_001_(self): src_data = numpy.array([-1.0, 1.0, -1.0, 1.0]) trg_data = src_data * 0.5 - src = gr.vector_source_f(src_data) - dst = gr.vector_sink_f() + src = blocks.vector_source_f(src_data) + dst = blocks.vector_sink_f() rail = analog.rail_ff(-0.5, 0.5) self.tb.connect(src, rail) self.tb.connect(rail, dst) @@ -88,9 +88,9 @@ class test_classify(gr_unittest.TestCase): -1.0/5.0]) trg_data = copy.deepcopy(src_data) - src = gr.vector_source_f(src_data, False, len(src_data)) + src = blocks.vector_source_f(src_data, False, len(src_data)) st = blocks.stretch_ff(-1.0/5.0, len(src_data)) - dst = gr.vector_sink_f(len(src_data)) + dst = blocks.vector_sink_f(len(src_data)) self.tb.connect(src, st) self.tb.connect(st, dst) self.tb.run() @@ -107,9 +107,9 @@ class test_classify(gr_unittest.TestCase): trg_grid = copy.deepcopy(src_grid) src_data = (0.0, 1.0, 0.0, 1.0, 0.0) - src = gr.vector_source_f(src_data, False, len(src_grid)) + src = blocks.vector_source_f(src_data, False, len(src_grid)) sq = wavelet_swig.squash_ff(src_grid, trg_grid) - dst = gr.vector_sink_f(len(trg_grid)) + dst = blocks.vector_sink_f(len(trg_grid)) self.tb.connect(src, sq) self.tb.connect(sq, dst) self.tb.run() @@ -133,10 +133,10 @@ class test_classify(gr_unittest.TestCase): # c = w.transform_forward(b, ws) # d = w.transform_inverse(c, ws) # -# src = gr.vector_source_f(b, False, n) +# src = blocks.vector_source_f(b, False, n) # wv = wavelet_swig.wavelet_ff(n, o, True) # -# dst = gr.vector_sink_f(n) +# dst = blocks.vector_sink_f(n) # self.tb.connect(src, wv) # self.tb.connect(wv, dst) # self.tb.run() @@ -162,9 +162,9 @@ class test_classify(gr_unittest.TestCase): wvps[e] = scl*sqr(dwav[k:k+(01<<e)]).sum() k += 01<<e - src = gr.vector_source_f(src_data, False, len(src_data)) + src = blocks.vector_source_f(src_data, False, len(src_data)) kon = wavelet_swig.wvps_ff(len(src_data)) - dst = gr.vector_sink_f(int(math.ceil(math.log(len(src_data), 2)))) + dst = blocks.vector_sink_f(int(math.ceil(math.log(len(src_data), 2)))) self.tb.connect(src, kon) self.tb.connect(kon, dst) diff --git a/gr-wxgui/python/common.py b/gr-wxgui/python/common.py index 57fc530f88..48a62a28ab 100644 --- a/gr-wxgui/python/common.py +++ b/gr-wxgui/python/common.py @@ -24,6 +24,7 @@ ################################################## import wx from gnuradio import gr +from gnuradio import blocks RUN_ALWAYS = gr.prefs().get_bool ('wxgui', 'run_always', False) @@ -47,7 +48,7 @@ class wxgui_hb(object): """ try: assert points[0] == self or points[0][0] == self - copy = gr.copy(self._hb.input_signature().sizeof_stream_item(0)) + copy = blocks.copy(self._hb.input_signature().sizeof_stream_item(0)) handler = self._handler_factory(copy.set_enabled) if RUN_ALWAYS == False: handler(False) #initially disable the copy block diff --git a/grc/blocks/CMakeLists.txt b/grc/blocks/CMakeLists.txt index 879c69a8ec..98b6512a09 100644 --- a/grc/blocks/CMakeLists.txt +++ b/grc/blocks/CMakeLists.txt @@ -20,13 +20,4 @@ ######################################################################## file(GLOB xml_files "*.xml") -# Force out the controlport GRC blocks if we've disabled it. -if(NOT ENABLE_GR_CTRLPORT) - list(REMOVE_ITEM xml_files - ${CMAKE_CURRENT_SOURCE_DIR}/gr_ctrlport_viewer.xml - ${CMAKE_CURRENT_SOURCE_DIR}/gr_ctrlport_probe_c.xml - ${CMAKE_CURRENT_SOURCE_DIR}/gr_ctrlport_probe2_c.xml - ) -endif(NOT ENABLE_GR_CTRLPORT) - install(FILES ${xml_files} DESTINATION ${GRC_BLOCKS_DIR} COMPONENT "grc") diff --git a/grc/blocks/block_tree.xml b/grc/blocks/block_tree.xml index e9da1ec880..9614c6ae02 100644 --- a/grc/blocks/block_tree.xml +++ b/grc/blocks/block_tree.xml @@ -8,31 +8,19 @@ <name></name> <!-- Blank for Root Name --> <cat> <name>Sources</name> - <block>gr_vector_source_x</block> <block>random_source_x</block> - <block>gr_null_source</block> <block>blks2_tcp_source</block> <block>pad_source</block> <block>virtual_source</block> </cat> <cat> <name>Sinks</name> - <block>gr_vector_sink_x</block> - <block>gr_null_sink</block> <block>blks2_tcp_sink</block> <block>pad_sink</block> <block>virtual_sink</block> </cat> <cat> - <name>Operators</name> - <block>gr_vector_insert_x</block> - <block>gr_endian_swap</block> - </cat> - <cat> <name>Synchronizers</name> - - <block>gr_mpsk_sync_cc</block> - <block>blks2_packet_decoder</block> <block>blks2_packet_encoder</block> </cat> @@ -58,13 +46,6 @@ <block>blks2_valve</block> <block>blks2_error_rate</block> - <block>gr_head</block> - <block>gr_skiphead</block> - - <block>gr_kludge_copy</block> - <block>gr_copy</block> - <block>gr_nop</block> - <block>xmlrpc_server</block> <block>xmlrpc_client</block> </cat> diff --git a/grc/blocks/gr_feedforward_agc_cc.xml b/grc/blocks/gr_feedforward_agc_cc.xml deleted file mode 100644 index 24e80953f4..0000000000 --- a/grc/blocks/gr_feedforward_agc_cc.xml +++ /dev/null @@ -1,32 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##Feed Forward AGC -################################################### - --> -<block> - <name>Feed Forward AGC</name> - <key>gr_feedforward_agc_cc</key> - <import>from gnuradio import gr</import> - <make>gr.feedforward_agc_cc($num_samples, $reference)</make> - <param> - <name>Num Samples</name> - <key>num_samples</key> - <value>1024</value> - <type>int</type> - </param> - <param> - <name>Reference</name> - <key>reference</key> - <value>1.0</value> - <type>real</type> - </param> - <sink> - <name>in</name> - <type>complex</type> - </sink> - <source> - <name>out</name> - <type>complex</type> - </source> -</block> diff --git a/grc/blocks/gr_kludge_copy.xml b/grc/blocks/gr_kludge_copy.xml deleted file mode 100644 index 8058b082db..0000000000 --- a/grc/blocks/gr_kludge_copy.xml +++ /dev/null @@ -1,68 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##Kludge Copy -################################################### - --> -<block> - <name>Kludge Copy</name> - <key>gr_kludge_copy</key> - <import>from gnuradio import gr</import> - <make>gr.kludge_copy($type.size*$vlen)</make> - <param> - <name>Type</name> - <key>type</key> - <type>enum</type> - <option> - <name>Complex</name> - <key>complex</key> - <opt>size:gr.sizeof_gr_complex</opt> - </option> - <option> - <name>Float</name> - <key>float</key> - <opt>size:gr.sizeof_float</opt> - </option> - <option> - <name>Int</name> - <key>int</key> - <opt>size:gr.sizeof_int</opt> - </option> - <option> - <name>Short</name> - <key>short</key> - <opt>size:gr.sizeof_short</opt> - </option> - <option> - <name>Byte</name> - <key>byte</key> - <opt>size:gr.sizeof_char</opt> - </option> - </param> - <param> - <name>Num Ports</name> - <key>num_ports</key> - <value>1</value> - <type>int</type> - </param> - <param> - <name>Vec Length</name> - <key>vlen</key> - <value>1</value> - <type>int</type> - </param> - <check>$num_ports > 0</check> - <check>$vlen > 0</check> - <sink> - <name>in</name> - <type>$type</type> - <vlen>$vlen</vlen> - <nports>$num_ports</nports> - </sink> - <source> - <name>out</name> - <type>$type</type> - <vlen>$vlen</vlen> - <nports>$num_ports</nports> - </source> -</block> diff --git a/grc/blocks/gr_mpsk_sync_cc.xml b/grc/blocks/gr_mpsk_sync_cc.xml deleted file mode 100644 index fd08f8340b..0000000000 --- a/grc/blocks/gr_mpsk_sync_cc.xml +++ /dev/null @@ -1,69 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##MPSK Sync -################################################### - --> -<block> - <name>MPSK Sync</name> - <key>gr_mpsk_sync_cc</key> - <import>from gnuradio import gr</import> - <make>gr.mpsk_sync_cc($alpha, $beta, $max_freq, $min_freq, $ref_phase, $omega, $gain_omega, $mu, $gain_mu)</make> - <callback>set_mu($mu)</callback> - <callback>set_gain_mu($gain_mu)</callback> - <callback>set_omega($omega)</callback> - <callback>set_gain_omega($gain_omega)</callback> - <param> - <name>Alpha</name> - <key>alpha</key> - <type>real</type> - </param> - <param> - <name>Beta</name> - <key>beta</key> - <type>real</type> - </param> - <param> - <name>Max Freq</name> - <key>max_freq</key> - <type>real</type> - </param> - <param> - <name>Min Freq</name> - <key>min_freq</key> - <type>real</type> - </param> - <param> - <name>Reference Phase</name> - <key>ref_phase</key> - <type>real</type> - </param> - <param> - <name>Omega</name> - <key>omega</key> - <type>real</type> - </param> - <param> - <name>Gain Omega</name> - <key>gain_omega</key> - <type>real</type> - </param> - <param> - <name>Mu</name> - <key>mu</key> - <type>real</type> - </param> - <param> - <name>Gain Mu</name> - <key>gain_mu</key> - <type>real</type> - </param> - <sink> - <name>in</name> - <type>complex</type> - </sink> - <source> - <name>out</name> - <type>complex</type> - </source> -</block> diff --git a/grc/blocks/random_source_x.xml b/grc/blocks/random_source_x.xml index 800bae7167..f826c77d16 100644 --- a/grc/blocks/random_source_x.xml +++ b/grc/blocks/random_source_x.xml @@ -10,7 +10,7 @@ <key>random_source_x</key> <import>from gnuradio import gr</import> <import>import numpy</import> - <make>gr.vector_source_$(type.fcn)(map(int, numpy.random.randint($min, $max, $num_samps)), $repeat)</make> + <make>blocks.vector_source_$(type.fcn)(map(int, numpy.random.randint($min, $max, $num_samps)), $repeat)</make> <param> <name>Output Type</name> <key>type</key> diff --git a/grc/grc_gnuradio/blks2/packet.py b/grc/grc_gnuradio/blks2/packet.py index eeadfb4a60..4c7bd235dd 100644 --- a/grc/grc_gnuradio/blks2/packet.py +++ b/grc/grc_gnuradio/blks2/packet.py @@ -1,4 +1,4 @@ -# Copyright 2008, 2009, 2012 Free Software Foundation, Inc. +# Copyright 2008,2009,2012-2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -236,10 +236,12 @@ class packet_demod_base(gr.hier_block2): self.connect(self, packet_sink) self.connect(msg_source, self) if packet_sink._hb.output_signature().sizeof_stream_item(0): - self.connect(packet_sink, gr.null_sink(packet_sink._hb.output_signature().sizeof_stream_item(0))) + self.connect(packet_sink, + blocks.null_sink(packet_sink._hb.output_signature().sizeof_stream_item(0))) def recv_pkt(self, ok, payload): - msg = blocks.message_from_string(payload, 0, self._item_size_out, len(payload)/self._item_size_out) + msg = blocks.message_from_string(payload, 0, self._item_size_out, + len(payload)/self._item_size_out) if ok: self._msgq_out.insert_tail(msg) class packet_demod_b(packet_demod_base): _item_size_out = gr.sizeof_char diff --git a/grc/grc_gnuradio/blks2/selector.py b/grc/grc_gnuradio/blks2/selector.py index f6a8aa79b1..bc393f84b6 100644 --- a/grc/grc_gnuradio/blks2/selector.py +++ b/grc/grc_gnuradio/blks2/selector.py @@ -1,5 +1,5 @@ # -# Copyright 2008 Free Software Foundation, Inc. +# Copyright 2008,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -20,6 +20,7 @@ # from gnuradio import gr +from gnuradio import blocks class selector(gr.hier_block2): """A hier2 block with N inputs and M outputs, where data is only forwarded through input n to output m.""" @@ -40,12 +41,13 @@ class selector(gr.hier_block2): gr.io_signature(num_outputs, num_outputs, item_size), ) #terminator blocks for unused inputs and outputs - self.input_terminators = [gr.null_sink(item_size) for i in range(num_inputs)] - self.output_terminators = [gr.head(item_size, 0) for i in range(num_outputs)] - self.copy = gr.kludge_copy(item_size) + self.input_terminators = [blocks.null_sink(item_size) for i in range(num_inputs)] + self.output_terminators = [blocks.head(item_size, 0) for i in range(num_outputs)] + self.copy = blocks.copy(item_size) #connections for i in range(num_inputs): self.connect((self, i), self.input_terminators[i]) - for i in range(num_outputs): self.connect(gr.null_source(item_size), self.output_terminators[i], (self, i)) + for i in range(num_outputs): self.connect(blocks.null_source(item_size), + self.output_terminators[i], (self, i)) self.item_size = item_size self.input_index = input_index self.output_index = output_index diff --git a/grc/todo.txt b/grc/todo.txt index 1205b3ff6d..cedea72aa3 100644 --- a/grc/todo.txt +++ b/grc/todo.txt @@ -12,11 +12,6 @@ * packet mod: whitening offset * wx min window size in options block * gr_adaptive_fir_ccf -* ofdm - * gr_ofdm_bpsk_demapper - * gr_ofdm_demapper_vcb - * gr_ofdm_frame_sink - * gr_ofdm_mapper_bcv * size params for the graphical sinks * callbacks for set average on fft, waterfall, number sinks * add units to params: Sps, Hz, dB... |