diff options
author | Tom Rondeau <trondeau@vt.edu> | 2013-03-17 17:03:18 -0400 |
---|---|---|
committer | Tom Rondeau <trondeau@vt.edu> | 2013-03-17 17:13:08 -0400 |
commit | 701d844c1624ac51e3da4f0ef0f5bb346358cab8 (patch) | |
tree | 6ea626d5fe16f884dec9e689d02915634969bebc /gnuradio-core/src/lib | |
parent | d4f6b86a9bdea09c2c158b9982559a727f8c6a0b (diff) |
blocks: moved ctrlport_probes to gr-blocks. Removed from gnuradio-core.
Diffstat (limited to 'gnuradio-core/src/lib')
-rw-r--r-- | gnuradio-core/src/lib/general/CMakeLists.txt | 9 | ||||
-rw-r--r-- | gnuradio-core/src/lib/general/general.i | 12 | ||||
-rw-r--r-- | gnuradio-core/src/lib/general/gr_ctrlport_probe2_c.cc | 156 | ||||
-rw-r--r-- | gnuradio-core/src/lib/general/gr_ctrlport_probe2_c.h | 72 | ||||
-rw-r--r-- | gnuradio-core/src/lib/general/gr_ctrlport_probe2_c.i | 36 | ||||
-rw-r--r-- | gnuradio-core/src/lib/general/gr_ctrlport_probe_c.cc | 96 | ||||
-rw-r--r-- | gnuradio-core/src/lib/general/gr_ctrlport_probe_c.h | 65 | ||||
-rw-r--r-- | gnuradio-core/src/lib/general/gr_ctrlport_probe_c.i | 34 |
8 files changed, 0 insertions, 480 deletions
diff --git a/gnuradio-core/src/lib/general/CMakeLists.txt b/gnuradio-core/src/lib/general/CMakeLists.txt index d1cf08103e..2ef7c11055 100644 --- a/gnuradio-core/src/lib/general/CMakeLists.txt +++ b/gnuradio-core/src/lib/general/CMakeLists.txt @@ -119,15 +119,6 @@ set(gr_core_general_triple_threats gr_test ) -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") diff --git a/gnuradio-core/src/lib/general/general.i b/gnuradio-core/src/lib/general/general.i index b8b803de98..e0c735f100 100644 --- a/gnuradio-core/src/lib/general/general.i +++ b/gnuradio-core/src/lib/general/general.i @@ -51,15 +51,3 @@ %include "complex_vec_test.i" %include "gr_block_gateway.i" %include "gr_endianness.h" - -#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 */ 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.h b/gnuradio-core/src/lib/general/gr_ctrlport_probe_c.h deleted file mode 100644 index 27666ab597..0000000000 --- a/gnuradio-core/src/lib/general/gr_ctrlport_probe_c.h +++ /dev/null @@ -1,65 +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_PROBE_C_H -#define INCLUDED_CTRLPORT_PROBE_C_H - -#include <gr_core_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); -}; - -#endif /* INCLUDED_CTRLPORT_GR_CTRLPORT_PROBE_C_H */ - 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(); -}; - |