diff options
Diffstat (limited to 'gr-digital')
-rw-r--r-- | gr-digital/examples/ofdm/ofdm_bugsquatch.py | 22 | ||||
-rw-r--r-- | gr-digital/include/digital/CMakeLists.txt | 4 | ||||
-rw-r--r-- | gr-digital/include/digital/scale_tags.h | 58 | ||||
-rw-r--r-- | gr-digital/include/digital/tagged_stream_check.h | 53 | ||||
-rw-r--r-- | gr-digital/include/digital/ts_insert_zeros_cc.h | 53 | ||||
-rw-r--r-- | gr-digital/lib/CMakeLists.txt | 4 | ||||
-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 | ||||
-rw-r--r-- | gr-digital/python/CMakeLists.txt | 1 | ||||
-rw-r--r-- | gr-digital/python/__init__.py | 1 | ||||
-rw-r--r-- | gr-digital/python/fftshift.py | 31 | ||||
-rwxr-xr-x | gr-digital/python/qa_ofdm_sync_sc_cfb.py | 6 | ||||
-rwxr-xr-x | gr-digital/python/qa_scale_tags.py | 57 | ||||
-rw-r--r-- | gr-digital/python/qa_ts_insert_zeros.py | 78 | ||||
-rw-r--r-- | gr-digital/swig/digital_swig.i | 12 |
19 files changed, 7 insertions, 857 deletions
diff --git a/gr-digital/examples/ofdm/ofdm_bugsquatch.py b/gr-digital/examples/ofdm/ofdm_bugsquatch.py deleted file mode 100644 index 25c062a772..0000000000 --- a/gr-digital/examples/ofdm/ofdm_bugsquatch.py +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env python - -from gnuradio import gr, digital, blocks -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 = 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 = 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) - tb.run() - diff --git a/gr-digital/include/digital/CMakeLists.txt b/gr-digital/include/digital/CMakeLists.txt index 84f0ef50d0..3babcbad44 100644 --- a/gr-digital/include/digital/CMakeLists.txt +++ b/gr-digital/include/digital/CMakeLists.txt @@ -132,13 +132,11 @@ install(FILES pn_correlator_cc.h probe_density_b.h probe_mpsk_snr_est_c.h - scale_tags.h scrambler_bb.h simple_correlator.h simple_framer.h simple_framer_sync.h - tagged_stream_check.h - ts_insert_zeros_cc.h + header_payload_demux.h DESTINATION ${GR_INCLUDE_DIR}/gnuradio/digital COMPONENT "digital_devel" ) diff --git a/gr-digital/include/digital/scale_tags.h b/gr-digital/include/digital/scale_tags.h deleted file mode 100644 index dfe6f4a823..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 68509bcae6..0000000000 --- a/gr-digital/include/digital/tagged_stream_check.h +++ /dev/null @@ -1,53 +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 588eb300ee..0000000000 --- a/gr-digital/include/digital/ts_insert_zeros_cc.h +++ /dev/null @@ -1,53 +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 7e83b86021..d0a9132250 100644 --- a/gr-digital/lib/CMakeLists.txt +++ b/gr-digital/lib/CMakeLists.txt @@ -167,12 +167,10 @@ list(APPEND digital_sources pn_correlator_cc_impl.cc probe_density_b_impl.cc probe_mpsk_snr_est_c_impl.cc - scale_tags_impl.cc scrambler_bb_impl.cc simple_correlator_impl.cc simple_framer_impl.cc - tagged_stream_check_impl.cc - ts_insert_zeros_cc_impl.cc + header_payload_demux_impl.cc ) #Add Windows DLL resource file if using MSVC diff --git a/gr-digital/lib/scale_tags_impl.cc b/gr-digital/lib/scale_tags_impl.cc deleted file mode 100644 index 33d1002381..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::to_long(tags[j].value); - if (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::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 625645804f..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::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::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 1a78851c18..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::symbol_to_string(tags[j].key) == d_lengthtagname) { - packet_length = 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/CMakeLists.txt b/gr-digital/python/CMakeLists.txt index 4dfaac362a..7846345970 100644 --- a/gr-digital/python/CMakeLists.txt +++ b/gr-digital/python/CMakeLists.txt @@ -28,7 +28,6 @@ GR_PYTHON_INSTALL( bpsk.py cpm.py crc.py - fftshift.py generic_mod_demod.py gmsk.py gfsk.py diff --git a/gr-digital/python/__init__.py b/gr-digital/python/__init__.py index 28b74261f7..6bbe8160e8 100644 --- a/gr-digital/python/__init__.py +++ b/gr-digital/python/__init__.py @@ -42,7 +42,6 @@ from ofdm_sync_fixed import * from ofdm_sync_ml import * from ofdm_sync_pnac import * from ofdm_sync_pn import * -from fftshift import fftshift, ifftshift from ofdm_txrx import ofdm_tx, ofdm_rx import packet_utils diff --git a/gr-digital/python/fftshift.py b/gr-digital/python/fftshift.py deleted file mode 100644 index c8c7c7f140..0000000000 --- a/gr-digital/python/fftshift.py +++ /dev/null @@ -1,31 +0,0 @@ -# -# 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. -# - -# Aliases for fftpack.(i)fftshift() - -from scipy import fftpack - -def fftshift(x): - return fftpack.fftshift(x) - -def ifftshift(x): - return fftpack.ifftshift(x) - diff --git a/gr-digital/python/qa_ofdm_sync_sc_cfb.py b/gr-digital/python/qa_ofdm_sync_sc_cfb.py index d8b5465564..8374595d62 100755 --- a/gr-digital/python/qa_ofdm_sync_sc_cfb.py +++ b/gr-digital/python/qa_ofdm_sync_sc_cfb.py @@ -174,10 +174,8 @@ 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 = blocks.vector_sink_c() - #head = blocks.head(gr.sizeof_gr_complex, int(total_length * ratio*2)) + #sink_countbursts = gr.vector_sink_c() + #head = gr.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 = blocks.vector_sink_f() diff --git a/gr-digital/python/qa_scale_tags.py b/gr-digital/python/qa_scale_tags.py deleted file mode 100755 index 2008b0c3eb..0000000000 --- a/gr-digital/python/qa_scale_tags.py +++ /dev/null @@ -1,57 +0,0 @@ -#!/usr/bin/env python -# 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. -# - -import time -import itertools - -from gnuradio import gr, gr_unittest -try: import pmt -except: from gruel import pmt -import blocks_swig as blocks -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 = 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 = blocks.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 2af6832cf5..0000000000 --- a/gr-digital/python/qa_ts_insert_zeros.py +++ /dev/null @@ -1,78 +0,0 @@ -#!/usr/bin/env python -# 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. -# - -import time -import itertools - -from gnuradio import gr, gr_unittest -try: import pmt -except: from gruel import pmt -import blocks_swig as blocks -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 = 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 = 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() - 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 494bb2f682..b9a9dd617a 100644 --- a/gr-digital/swig/digital_swig.i +++ b/gr-digital/swig/digital_swig.i @@ -101,12 +101,12 @@ #include "digital/pn_correlator_cc.h" #include "digital/probe_density_b.h" #include "digital/probe_mpsk_snr_est_c.h" -#include "digital/scale_tags.h" #include "digital/scrambler_bb.h" #include "digital/simple_correlator.h" #include "digital/simple_framer.h" -#include "digital/tagged_stream_check.h" -#include "digital/ts_insert_zeros_cc.h" +#include "digital/ofdm_serializer_vcc.h" +#include "digital/packet_headerparser_b.h" +#include "digital/header_payload_demux.h" %} %include "digital/additive_scrambler_bb.h" @@ -170,12 +170,9 @@ %include "digital/pn_correlator_cc.h" %include "digital/probe_density_b.h" %include "digital/probe_mpsk_snr_est_c.h" -%include "digital/scale_tags.h" %include "digital/scrambler_bb.h" %include "digital/simple_correlator.h" %include "digital/simple_framer.h" -%include "digital/tagged_stream_check.h" -%include "digital/ts_insert_zeros_cc.h" GR_SWIG_BLOCK_MAGIC2(digital, additive_scrambler_bb); GR_SWIG_BLOCK_MAGIC2(digital, binary_slicer_fb); @@ -228,12 +225,9 @@ GR_SWIG_BLOCK_MAGIC2(digital, pfb_clock_sync_fff); GR_SWIG_BLOCK_MAGIC2(digital, pn_correlator_cc); GR_SWIG_BLOCK_MAGIC2(digital, probe_density_b); GR_SWIG_BLOCK_MAGIC2(digital, probe_mpsk_snr_est_c); -GR_SWIG_BLOCK_MAGIC2(digital, scale_tags); GR_SWIG_BLOCK_MAGIC2(digital, scrambler_bb); GR_SWIG_BLOCK_MAGIC2(digital, simple_correlator); GR_SWIG_BLOCK_MAGIC2(digital, simple_framer); -GR_SWIG_BLOCK_MAGIC2(digital, tagged_stream_check); -GR_SWIG_BLOCK_MAGIC2(digital, ts_insert_zeros_cc); GR_SWIG_BLOCK_MAGIC_FACTORY(digital, cpmmod_bc, gmskmod_bc); |