diff options
author | Martin Braun <martin.braun@kit.edu> | 2013-03-18 15:16:29 +0100 |
---|---|---|
committer | Martin Braun <martin.braun@kit.edu> | 2013-03-18 15:16:29 +0100 |
commit | 3dc8a421e97707dcd3fde09fb615a6da7fe47de5 (patch) | |
tree | f7e123dd3724d55a8741f2b61302b0d0c5254a15 /gr-digital | |
parent | 055a847a850ff03af48bfc18a80a00ad34735d8c (diff) |
digital: cleaned out debugging blocks
Diffstat (limited to 'gr-digital')
-rw-r--r-- | gr-digital/examples/ofdm/ofdm_bugsquatch.py | 22 | ||||
-rw-r--r-- | gr-digital/grc/digital_scale_tags.xml | 31 | ||||
-rw-r--r-- | gr-digital/include/digital/CMakeLists.txt | 3 | ||||
-rw-r--r-- | gr-digital/include/digital/scale_tags.h | 58 | ||||
-rw-r--r-- | gr-digital/include/digital/tagged_stream_check.h | 55 | ||||
-rw-r--r-- | gr-digital/include/digital/ts_insert_zeros_cc.h | 55 | ||||
-rw-r--r-- | gr-digital/lib/CMakeLists.txt | 3 | ||||
-rw-r--r-- | gr-digital/lib/scale_tags_impl.cc | 84 | ||||
-rw-r--r-- | gr-digital/lib/scale_tags_impl.h | 51 | ||||
-rw-r--r-- | gr-digital/lib/tagged_stream_check_impl.cc | 112 | ||||
-rw-r--r-- | gr-digital/lib/tagged_stream_check_impl.h | 53 | ||||
-rw-r--r-- | gr-digital/lib/ts_insert_zeros_cc_impl.cc | 130 | ||||
-rw-r--r-- | gr-digital/lib/ts_insert_zeros_cc_impl.h | 54 | ||||
-rwxr-xr-x | gr-digital/python/qa_ofdm_sync_sc_cfb.py | 2 | ||||
-rwxr-xr-x | gr-digital/python/qa_scale_tags.py | 56 | ||||
-rw-r--r-- | gr-digital/python/qa_ts_insert_zeros.py | 77 | ||||
-rw-r--r-- | gr-digital/swig/digital_swig.i | 9 |
17 files changed, 0 insertions, 855 deletions
diff --git a/gr-digital/examples/ofdm/ofdm_bugsquatch.py b/gr-digital/examples/ofdm/ofdm_bugsquatch.py deleted file mode 100644 index 3b900fb46b..0000000000 --- a/gr-digital/examples/ofdm/ofdm_bugsquatch.py +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env python - -from gnuradio import gr, digital -from gnuradio.digital.utils import tagged_streams -import random - -if __name__ == '__main__': - tb = gr.top_block() - fft_len = 64 - cp_len = 16 - length_tag_name = "length" - src = gr.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) - 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) - tb.run() - diff --git a/gr-digital/grc/digital_scale_tags.xml b/gr-digital/grc/digital_scale_tags.xml deleted file mode 100644 index 3e80ee21fe..0000000000 --- a/gr-digital/grc/digital_scale_tags.xml +++ /dev/null @@ -1,31 +0,0 @@ -<block> - <name>Tag Scaler</name> - <key>digital_scale_tags</key> - <category>digital</category> - <import>from gnuradio import digital</import> - <make>digital.scale_tags($item_size, $tag_name, $scale_factor)</make> - <param> - <name>Item size</name> - <key>item_size</key> - <type>int</type> - </param> - <param> - <name>Tag Name</name> - <key>tag_name</key> - <type>string</type> - </param> - <param> - <name>Scale Factor</name> - <key>scale_factor</key> - <type>real</type> - </param> - <!--FIXME type should be choosable--> - <sink> - <name>in</name> - <type>byte</type> - </sink> - <source> - <name>out</name> - <type>byte</type> - </source> -</block> diff --git a/gr-digital/include/digital/CMakeLists.txt b/gr-digital/include/digital/CMakeLists.txt index 7926ae3234..1042517294 100644 --- a/gr-digital/include/digital/CMakeLists.txt +++ b/gr-digital/include/digital/CMakeLists.txt @@ -32,9 +32,6 @@ install(FILES packet_header_default.h packet_header_ofdm.h packet_headergenerator_bb.h - scale_tags.h - tagged_stream_check.h - ts_insert_zeros_cc.h packet_headerparser_b.h header_payload_demux.h DESTINATION ${GR_INCLUDE_DIR}/gnuradio/digital diff --git a/gr-digital/include/digital/scale_tags.h b/gr-digital/include/digital/scale_tags.h deleted file mode 100644 index 8a9e3efba4..0000000000 --- a/gr-digital/include/digital/scale_tags.h +++ /dev/null @@ -1,58 +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_DIGITAL_SCALE_TAGS_H -#define INCLUDED_DIGITAL_SCALE_TAGS_H - -#include <digital_ofdm_equalizer_base.h> // FIXME: Error without this line. No idea why. -#include <digital/api.h> -#include <gr_sync_block.h> - -namespace gr { - namespace digital { - - /*! - * \brief <+description of block+> - * \ingroup block - * - */ - class DIGITAL_API scale_tags : virtual public gr_sync_block - { - public: - typedef boost::shared_ptr<scale_tags> sptr; - - /*! - * \brief Return a shared_ptr to a new instance of digital::scale_tags. - * - * To avoid accidental use of raw pointers, digital::scale_tags's - * constructor is in a private implementation - * class. digital::scale_tags::make is the public interface for - * creating new instances. - */ - static sptr make(size_t itemsize, const std::string&, float scale_factor); - }; - - } // namespace digital -} // namespace gr - -#endif /* INCLUDED_DIGITAL_SCALE_TAGS_H */ - diff --git a/gr-digital/include/digital/tagged_stream_check.h b/gr-digital/include/digital/tagged_stream_check.h deleted file mode 100644 index 73b44a5bb9..0000000000 --- a/gr-digital/include/digital/tagged_stream_check.h +++ /dev/null @@ -1,55 +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_DIGITAL_TAGGED_STREAM_CHECK_H -#define INCLUDED_DIGITAL_TAGGED_STREAM_CHECK_H - -#include <digital_ofdm_equalizer_base.h> // FIXME: Error without this line. No idea why. -#include <digital/api.h> -#include <gr_sync_block.h> - - -namespace gr { - namespace digital { - - /*! - * \brief Checks a tagged stream to make sure it's valid. - * - * \description - * Produces error messages if the tags in a tagged stream aren't where - * they should be. - * - * \ingroup digital - * - */ - class DIGITAL_API tagged_stream_check : virtual public gr_sync_block - { - public: - typedef boost::shared_ptr<tagged_stream_check> sptr; - static sptr make(size_t itemsize, const std::string &lengthtagname); - }; - - } // namespace digital -} // namespace gr - -#endif /* INCLUDED_DIGITAL_TAGGED_STREAM_CHECK_H */ - diff --git a/gr-digital/include/digital/ts_insert_zeros_cc.h b/gr-digital/include/digital/ts_insert_zeros_cc.h deleted file mode 100644 index 299062eb50..0000000000 --- a/gr-digital/include/digital/ts_insert_zeros_cc.h +++ /dev/null @@ -1,55 +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_DIGITAL_TS_INSERT_ZEROS_CC_H -#define INCLUDED_DIGITAL_TS_INSERT_ZEROS_CC_H - -#include <digital_ofdm_equalizer_base.h> // FIXME: Error without this line. No idea why. -#include <digital/api.h> -#include <gr_block.h> -#include <string> - - -namespace gr { - namespace digital { - - /*! - * \brief Inserts zeros between the packets of a tagged stream. - * - * \description - * Outputs zeros if a packet is not yet ready at the input, otherwise - * passes packets through. - * - * \ingroup digital - * - */ - class DIGITAL_API ts_insert_zeros_cc : virtual public gr_block - { - public: - typedef boost::shared_ptr<ts_insert_zeros_cc> sptr; - static sptr make(const std::string &lengthtagname); - }; - } // namespace digital -} // namespace gr - -#endif /* INCLUDED_DIGITAL_TS_INSERT_ZEROS_CC_H */ - diff --git a/gr-digital/lib/CMakeLists.txt b/gr-digital/lib/CMakeLists.txt index d1193f8fed..42340b6c2a 100644 --- a/gr-digital/lib/CMakeLists.txt +++ b/gr-digital/lib/CMakeLists.txt @@ -154,9 +154,6 @@ list(APPEND gr_digital_sources packet_header_ofdm.cc packet_headergenerator_bb_impl.cc packet_headerparser_b_impl.cc - scale_tags_impl.cc - tagged_stream_check_impl.cc - ts_insert_zeros_cc_impl.cc header_payload_demux_impl.cc digital_simple_correlator.cc ) diff --git a/gr-digital/lib/scale_tags_impl.cc b/gr-digital/lib/scale_tags_impl.cc deleted file mode 100644 index 05c4635f74..0000000000 --- a/gr-digital/lib/scale_tags_impl.cc +++ /dev/null @@ -1,84 +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_io_signature.h> -#include "scale_tags_impl.h" - -namespace gr { - namespace digital { - - scale_tags::sptr - scale_tags::make(size_t itemsize, const std::string& tagname, float scale_factor) - { - return gnuradio::get_initial_sptr (new scale_tags_impl(itemsize, tagname, scale_factor)); - } - - /* - * The private constructor - */ - scale_tags_impl::scale_tags_impl(size_t itemsize, const std::string& tagname, float scale_factor) - : gr_sync_block("scale_tags", - gr_make_io_signature(1, 1, itemsize), - gr_make_io_signature(1, 1, itemsize)), - d_itemsize(itemsize), - d_tagname(tagname), - d_scale_factor(scale_factor) - { - set_tag_propagation_policy(TPP_DONT); - } - - /* - * Our virtual destructor. - */ - scale_tags_impl::~scale_tags_impl() - { - } - - int - scale_tags_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]; - std::vector<gr_tag_t> tags; - this->get_tags_in_range(tags, 0, nitems_read(0), nitems_read(0)+noutput_items); - //const size_t ninput_items = noutput_items; //assumption for sync block, this can change - for (unsigned int j = 0; j < tags.size(); j++) { - long value = pmt::pmt_to_long(tags[j].value); - if (pmt::pmt_symbol_to_string(tags[j].key) == d_tagname) { - value = long(value*d_scale_factor); - } - this->add_item_tag(0, tags[j].offset, tags[j].key, pmt::pmt_from_long(value)); - } - memcpy((void *) out, (const void *) in, noutput_items*d_itemsize); - - // Tell runtime system how many output items we produced. - return noutput_items; - } - - } /* namespace digital */ -} /* namespace gr */ - diff --git a/gr-digital/lib/scale_tags_impl.h b/gr-digital/lib/scale_tags_impl.h deleted file mode 100644 index 667cda36eb..0000000000 --- a/gr-digital/lib/scale_tags_impl.h +++ /dev/null @@ -1,51 +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_DIGITAL_SCALE_TAGS_IMPL_H -#define INCLUDED_DIGITAL_SCALE_TAGS_IMPL_H - -#include <digital/scale_tags.h> - -namespace gr { - namespace digital { - - class scale_tags_impl : public scale_tags - { - private: - size_t d_itemsize; - std::string d_tagname; - float d_scale_factor; - - public: - scale_tags_impl(size_t itemsize, const std::string&, float scale_factor); - ~scale_tags_impl(); - - // Where all the action really happens - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - }; - - } // namespace digital -} // namespace gr - -#endif /* INCLUDED_DIGITAL_SCALE_TAGS_IMPL_H */ - diff --git a/gr-digital/lib/tagged_stream_check_impl.cc b/gr-digital/lib/tagged_stream_check_impl.cc deleted file mode 100644 index 732493f0ec..0000000000 --- a/gr-digital/lib/tagged_stream_check_impl.cc +++ /dev/null @@ -1,112 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2012 <+YOU OR YOUR COMPANY+>. - * - * This 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. - * - * This software 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 software; 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_io_signature.h> -#include "tagged_stream_check_impl.h" -#include <iostream> -#include <vector> -#include <algorithm> -#include <string> -#include <sstream> - -namespace gr { - namespace digital { - - bool sort_tag_by_offset(gr_tag_t const & L, gr_tag_t const & R) { - return L.offset < R.offset; - } - - tagged_stream_check::sptr - tagged_stream_check::make(size_t itemsize, const std::string &lengthtagname) - { - return gnuradio::get_initial_sptr (new tagged_stream_check_impl(itemsize, lengthtagname)); - } - - /* - * The private constructor - */ - tagged_stream_check_impl::tagged_stream_check_impl(size_t itemsize, const std::string &lengthtagname) - : gr_sync_block("tagged_stream_check", - gr_make_io_signature(1, 1, itemsize), - gr_make_io_signature(1, 1, itemsize)), - d_lengthtagname(lengthtagname), d_itemsize(itemsize) - { - d_expected_offset = 0; - d_last_offset = 0; - } - - /* - * Our virtual destructor. - */ - tagged_stream_check_impl::~tagged_stream_check_impl() - { - } - - int - tagged_stream_check_impl::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) - { - char *out = (char *) output_items[0]; - const char *in = (const char*) input_items[0]; - // Find all the length tags - std::vector<gr_tag_t> tags; - std::vector<gr_tag_t> lengthtags; - this->get_tags_in_range(tags, 0, nitems_read(0), nitems_read(0)+noutput_items); - for (unsigned int j = 0; j < tags.size(); j++) { - if (pmt::pmt_symbol_to_string(tags[j].key) == d_lengthtagname) { - lengthtags.push_back(tags[j]); - } - } - // If there are no lengthtags then check that we weren't expecting one. - if (lengthtags.size() == 0) { - if (d_expected_offset < nitems_read(0)+noutput_items) { - std::ostringstream ss; - ss << "ERROR: "<<this->unique_id()<<" Expected a lengthtag at offset="<<d_expected_offset<<" but didn't find it"; - std::cout << ss.str() << std::endl; - } - } - // Sort them and make sure the lengthtags are in the proper places. - sort(lengthtags.begin(), lengthtags.end(), sort_tag_by_offset); - for (unsigned int j = 0; j < lengthtags.size(); j++) { - if (lengthtags[j].offset != d_expected_offset) { - std::cout << "****************************" << std::endl; - std::cout << "ERROR: "<<this->unique_id()<<" offset: " << lengthtags[j].offset << " The last tag had a length of " << d_expected_offset - d_last_offset << " but we got a length of " << lengthtags[j].offset - d_last_offset << std::endl; - } - long packet_length = pmt::pmt_to_long(lengthtags[j].value); - std::cout << "INFO: "<<this->unique_id()<<" offset: " << lengthtags[j].offset << std::endl; - d_expected_offset = lengthtags[j].offset + packet_length; - d_last_offset = lengthtags[j].offset; - } - memcpy((void *) out, (const void *) in, noutput_items*d_itemsize); - std::ostringstream ss; - ss << "checker: Produced data from " << nitems_read(0) << " to " << nitems_read(0) + noutput_items; - std::cout << ss.str() << std::endl; - return noutput_items; - } - - - } /* namespace digital */ -} /* namespace gr */ - diff --git a/gr-digital/lib/tagged_stream_check_impl.h b/gr-digital/lib/tagged_stream_check_impl.h deleted file mode 100644 index 0b0dfe5b1a..0000000000 --- a/gr-digital/lib/tagged_stream_check_impl.h +++ /dev/null @@ -1,53 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2012 <+YOU OR YOUR COMPANY+>. - * - * This 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. - * - * This software 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 software; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef INCLUDED_DIGITAL_TAGGED_STREAM_CHECK_IMPL_H -#define INCLUDED_DIGITAL_TAGGED_STREAM_CHECK_IMPL_H - -#include <digital/tagged_stream_check.h> -#include <vector> - -namespace gr { - namespace digital { - - class tagged_stream_check_impl : public tagged_stream_check - { - private: - const std::string d_lengthtagname; - size_t d_itemsize; - uint64_t d_expected_offset; - uint64_t d_last_offset; - - public: - tagged_stream_check_impl(size_t itemsize, const std::string &lengthtagname); - ~tagged_stream_check_impl(); - - // Where all the action really happens - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - }; - - } // namespace digital -} // namespace gr - -#endif - diff --git a/gr-digital/lib/ts_insert_zeros_cc_impl.cc b/gr-digital/lib/ts_insert_zeros_cc_impl.cc deleted file mode 100644 index 6c40a81f86..0000000000 --- a/gr-digital/lib/ts_insert_zeros_cc_impl.cc +++ /dev/null @@ -1,130 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2012 <+YOU OR YOUR COMPANY+>. - * - * This 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. - * - * This software 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 software; 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_io_signature.h> -#include "ts_insert_zeros_cc_impl.h" -#include <iostream> -#include <vector> -#include <algorithm> -#include <string> -#include <sstream> - -namespace gr { - namespace digital { - - ts_insert_zeros_cc::sptr - ts_insert_zeros_cc::make(const std::string &lengthtagname) - { - return gnuradio::get_initial_sptr (new ts_insert_zeros_cc_impl(lengthtagname)); - } - - /* - * The private constructor - */ - ts_insert_zeros_cc_impl::ts_insert_zeros_cc_impl(const std::string &lengthtagname) - : gr_block("ts_insert_zeros_cc", - gr_make_io_signature(1, 1, sizeof(gr_complex)), - gr_make_io_signature(1, 1, sizeof(gr_complex))), - d_lengthtagname(lengthtagname) - { - } - - /* - * Our virtual destructor. - */ - ts_insert_zeros_cc_impl::~ts_insert_zeros_cc_impl() - { - } - - void - ts_insert_zeros_cc_impl::forecast(int noutput_items, gr_vector_int &ninput_items_required) - { - ninput_items_required[0] = 0; - } - - int - ts_insert_zeros_cc_impl::general_work ( - int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items - ) - { - gr_complex *out = (gr_complex *) output_items[0]; - const gr_complex*in = (const gr_complex*) input_items[0]; - - if (ninput_items[0]) { - // Check if we have an entire packet. - long packet_length = 0; - std::vector<gr_tag_t> tags; - // Get any tags associated with the first item on the input. - this->get_tags_in_range(tags, 0, nitems_read(0), nitems_read(0)+1); - for (unsigned int j = 0; j < tags.size(); j++) { - if (pmt::pmt_symbol_to_string(tags[j].key) == d_lengthtagname) { - packet_length = pmt::pmt_to_long(tags[j].value); - } - } - if (!packet_length) { - throw std::runtime_error("no tag"); - } - if (ninput_items[0] < packet_length ) { - // We don't have enough input to produce a packet. - // Produces zeros instead. - } else { - // We have enough input. - if (noutput_items < packet_length) { - // But we don't have enough output space. - // We don't want to produce zeros, so return. - set_output_multiple(packet_length); - return 0; - } else { - // And we have enough output space. - // Produce the packet. - std::vector<gr_tag_t> tags; - this->get_tags_in_range(tags, 0, nitems_read(0), nitems_read(0)+packet_length); - for (unsigned int j = 0; j < tags.size(); j++) { - const uint64_t offset = tags[j].offset - nitems_read(0) + nitems_written(0); - this->add_item_tag(0, offset, tags[j].key, tags[j].value); - } - if (noutput_items < packet_length) { - throw std::runtime_error("Not enough room in the output buffer."); - } - memcpy(out, in, packet_length*sizeof(gr_complex)); - consume(0, packet_length); - return packet_length; - } - } - } - // We're just producing zeros. - // Either we have no input data, or not an entire packet yet. - for (int i=0; i<noutput_items; i++) { - out[i] = 0; - } - return noutput_items; - } - - - } /* namespace digital */ -} /* namespace gr */ - diff --git a/gr-digital/lib/ts_insert_zeros_cc_impl.h b/gr-digital/lib/ts_insert_zeros_cc_impl.h deleted file mode 100644 index 4bdfbfe9fd..0000000000 --- a/gr-digital/lib/ts_insert_zeros_cc_impl.h +++ /dev/null @@ -1,54 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2012 <+YOU OR YOUR COMPANY+>. - * - * This 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. - * - * This software 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 software; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef INCLUDED_DIGITAL_TS_INSERT_ZEROS_CC_IMPL_H -#define INCLUDED_DIGITAL_TS_INSERT_ZEROS_CC_IMPL_H - -#include <digital/ts_insert_zeros_cc.h> -#include <vector> - -namespace gr { - namespace digital { - - class ts_insert_zeros_cc_impl : public ts_insert_zeros_cc - { - private: - const std::string d_lengthtagname; - - public: - ts_insert_zeros_cc_impl(const std::string &lengthtagname); - ~ts_insert_zeros_cc_impl(); - - void forecast(int noutput_items, gr_vector_int &ninput_items_required); - - // Where all the action really happens - 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 digital -} // namespace gr - -#endif - diff --git a/gr-digital/python/qa_ofdm_sync_sc_cfb.py b/gr-digital/python/qa_ofdm_sync_sc_cfb.py index 36123509e9..bed8e9c3ae 100755 --- a/gr-digital/python/qa_ofdm_sync_sc_cfb.py +++ b/gr-digital/python/qa_ofdm_sync_sc_cfb.py @@ -170,8 +170,6 @@ Detection error was: %d """ % (numpy.sum(sink_detect.data()) - n_bursts) #rate_out = 48000 #ratio = float(rate_out) / rate_in #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)) #add = gr.add_cc() diff --git a/gr-digital/python/qa_scale_tags.py b/gr-digital/python/qa_scale_tags.py deleted file mode 100755 index 85903b27e1..0000000000 --- a/gr-digital/python/qa_scale_tags.py +++ /dev/null @@ -1,56 +0,0 @@ -#!/usr/bin/env python -# 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. -# - -import time -import itertools - -from gnuradio import gr, gr_unittest -try: import pmt -except: from gruel import pmt -import digital_swig as digital -from utils import tagged_streams - -class qa_scale_tags (gr_unittest.TestCase): - - def test_utils(self): - packets = ((1, 2, 3), (4, 5, 6, 7, 8), (9, 10)) - tagname = "vector_length" - data, tags = tagged_streams.packets_to_vectors(packets, tagname) - new_packets = tagged_streams.vectors_to_packets(data, tags, tagname) - for np, op in zip(new_packets, packets): - for n, o in zip(np, op): - self.assertEqual(n, o) - - def test_001_t (self): - packets = ((1, 2, 3), (4, 5, 6, 7, 8), (9, 10)) - 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) - tag_scaler = digital.scale_tags(1, tagname, 2) - unpacker = gr.packed_to_unpacked_bb(4, gr.GR_MSB_FIRST) - snk = gr.vector_sink_b() - tb.connect(src, unpacker, tag_scaler, snk) - tb.run() - packets = tagged_streams.vectors_to_packets(snk.data(), snk.tags(), tagname) - -if __name__ == '__main__': - gr_unittest.run(qa_scale_tags, "qa_scale_tags.xml") diff --git a/gr-digital/python/qa_ts_insert_zeros.py b/gr-digital/python/qa_ts_insert_zeros.py deleted file mode 100644 index 9e71e8df28..0000000000 --- a/gr-digital/python/qa_ts_insert_zeros.py +++ /dev/null @@ -1,77 +0,0 @@ -#!/usr/bin/env python -# 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. -# - -import time -import itertools - -from gnuradio import gr, gr_unittest -try: import pmt -except: from gruel import pmt -import digital_swig as digital -from utils import tagged_streams - -class qa_ts_insert_zeros (gr_unittest.TestCase): - - def test_one(self): - n_packets = 10 - packet_length = 1000 - packets = [[i]*packet_length for i in range(1, n_packets+1)] - 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) - rate_in = 16000 - rate_out = 48000 - ratio = float(rate_out) / rate_in - 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) - head = gr.head(gr.sizeof_gr_complex, int(n_packets * packet_length * ratio*2)) - snk = gr.vector_sink_c() - tb.connect(src, throttle1, insert_zeros, throttle2, head, snk) - tb.run() - data = snk.data() - state = 1 - pos = 0 - last_non_zero = 0 - for i, d in enumerate(data): - if d != 0: - last_non_zero = i - if pos == 0: - if (d == state): - pos = pos + 1 - elif (d != 0): - raise ValueError("Invalid") - elif pos > 0: - if (d != state): - raise ValueError("Invalid") - pos = pos + 1 - if pos == packet_length: - state += 1 - pos = 0 - min_ratio = ratio-1 - max_ratio = ratio+1 - self.assertEqual(state-1, n_packets) - self.assertTrue(last_non_zero > min_ratio*packet_length*n_packets) - self.assertTrue(last_non_zero < max_ratio*packet_length*n_packets) - -if __name__ == '__main__': - gr_unittest.run(qa_ts_insert_zeros, "qa_ts_insert_zeros.xml") diff --git a/gr-digital/swig/digital_swig.i b/gr-digital/swig/digital_swig.i index 655a2598d7..2f36e13c8e 100644 --- a/gr-digital/swig/digital_swig.i +++ b/gr-digital/swig/digital_swig.i @@ -95,9 +95,6 @@ enum snr_est_type_t { #include "digital/packet_header_ofdm.h" #include "digital/packet_headergenerator_bb.h" #include "digital/ofdm_serializer_vcc.h" -#include "digital/scale_tags.h" -#include "digital/tagged_stream_check.h" -#include "digital/ts_insert_zeros_cc.h" #include "digital/packet_headerparser_b.h" #include "digital/header_payload_demux.h" #include "digital_simple_correlator.h" @@ -154,12 +151,6 @@ enum snr_est_type_t { %include "digital_ofdm_equalizer_static.i" %include "digital/ofdm_frame_equalizer_vcvc.h" GR_SWIG_BLOCK_MAGIC2(digital, ofdm_frame_equalizer_vcvc); -%include "digital/scale_tags.h" -GR_SWIG_BLOCK_MAGIC2(digital, scale_tags); -%include "digital/tagged_stream_check.h" -GR_SWIG_BLOCK_MAGIC2(digital, tagged_stream_check); -%include "digital/ts_insert_zeros_cc.h" -GR_SWIG_BLOCK_MAGIC2(digital, ts_insert_zeros_cc); %include "digital/packet_header_default.h" %include "digital/packet_header_ofdm.h" |