diff --git a/grc/digitalhf_vector_early_late_cc.xml b/grc/digitalhf_vector_early_late_cc.xml new file mode 100644 index 0000000..ffcd40e --- /dev/null +++ b/grc/digitalhf_vector_early_late_cc.xml @@ -0,0 +1,47 @@ + + + vector_early_late_cc + digitalhf_vector_early_late_cc + [digitalhf] + import digitalhf + digitalhf.vector_early_late_cc($sps,$alpha) + set_mu($mu) + + + SPS + sps + int + + + + alpha + alpha + float + + + + + in + complex + + + + + out + complex + + + + diff --git a/include/digitalhf/vector_early_late_cc.h b/include/digitalhf/vector_early_late_cc.h new file mode 100644 index 0000000..117e0b4 --- /dev/null +++ b/include/digitalhf/vector_early_late_cc.h @@ -0,0 +1,58 @@ +/* -*- c++ -*- */ +/* + * Copyright 2018 hcab14@gmail.com. + * + * 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_DIGITALHF_VECTOR_EARLY_LATE_CC_H +#define INCLUDED_DIGITALHF_VECTOR_EARLY_LATE_CC_H + +#include +#include + +namespace gr { +namespace digitalhf { + +/*! + * \brief <+description of block+> + * \ingroup digitalhf + * + */ +class DIGITALHF_API vector_early_late_cc : virtual public gr::block +{ + public: + typedef boost::shared_ptr sptr; + + /*! + * \brief Return a shared_ptr to a new instance of digitalhf::vector_early_late_cc. + * + * To avoid accidental use of raw pointers, digitalhf::vector_early_late_cc's + * constructor is in a private implementation + * class. digitalhf::vector_early_late_cc::make is the public interface for + * creating new instances. + */ + static sptr make(unsigned sps, // samples per symbols + float alpha); // filter parameter + +}; + +} // namespace digitalhf +} // namespace gr + +#endif /* INCLUDED_DIGITALHF_VECTOR_EARLY_LATE_CC_H */ + diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index a08ad7e..a0a944e 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -32,7 +32,11 @@ list(APPEND digitalhf_sources viterbi29_impl.cc viterbi39_impl.cc viterbi48_impl.cc - vector_pll_cc_impl.cc) + vector_pll_cc_impl.cc + vector_early_late_cc_impl.cc + lms.cc + rls.cc + ) set(digitalhf_sources "${digitalhf_sources}" PARENT_SCOPE) if(NOT digitalhf_sources) diff --git a/lib/vector_early_late_cc_impl.cc b/lib/vector_early_late_cc_impl.cc new file mode 100644 index 0000000..cd1a1ca --- /dev/null +++ b/lib/vector_early_late_cc_impl.cc @@ -0,0 +1,122 @@ +/* -*- c++ -*- */ +/* + * Copyright 2018 hcab14@gmail.com. + * + * 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 + +#include +#include +#include + +#include "vector_early_late_cc_impl.h" + +namespace gr { +namespace digitalhf { + +vector_early_late_cc::sptr +vector_early_late_cc::make(unsigned sps, + float alpha) +{ + return gnuradio::get_initial_sptr + (new vector_early_late_cc_impl(sps, alpha)); +} + +/* + * The private constructor + */ +vector_early_late_cc_impl::vector_early_late_cc_impl(unsigned sps, + float alpha) + : gr::block("vector_early_late_cc", + gr::io_signature::make(1, 1, sizeof(gr_complex)), + gr::io_signature::make(1, 1, sizeof(gr_complex))) + , _sps(sps) + , _alpha(alpha) + , _counter(0) + , _err(0.0f) + , _t(0.0f) +{ + GR_LOG_DECLARE_LOGPTR(d_logger); + GR_LOG_ASSIGN_LOGPTR(d_logger, "vector_early_late_cc"); + + // -sps/2 ... -1 0 1 ... sps/2 + // [ early ] [ late ] + set_history(1 + sps); +} + +vector_early_late_cc_impl::~vector_early_late_cc_impl() +{ +} + +int +vector_early_late_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::thread::scoped_lock lock(d_setlock); + + gr_complex const *in = (gr_complex const *)input_items[0]; + gr_complex *out = (gr_complex *)output_items[0]; + + int const nin = ninput_items[0] - _sps; +// std::cout << "vector_early_late_cc_impl::general_work nin,sps= " << " " << nin << " " << _sps << " " << history() << std::endl; + assert(nin > 1); + if (nin < 1) + return 0; + + int nout = 0; + int nin_processed = 0; + int i = history(); + for (; i