diff options
author | Tom Rondeau <trondeau@vt.edu> | 2012-12-03 19:43:50 -0500 |
---|---|---|
committer | Tom Rondeau <trondeau@vt.edu> | 2012-12-03 19:43:50 -0500 |
commit | 406e881106de9ce5d09fa6f4c24e08d8ef63cb49 (patch) | |
tree | cc2426035b9910855aa464b5f21784e0efb20202 /gr-digital | |
parent | 1fea3358fbb5796ca50475e55dd7f0d443f1cd73 (diff) |
ctrlport: fixing up controlport integration into gnuradio-core for merge with next.
Diffstat (limited to 'gr-digital')
-rw-r--r-- | gr-digital/lib/CMakeLists.txt | 9 | ||||
-rw-r--r-- | gr-digital/lib/pfb_clock_sync_ccf_impl.cc | 68 | ||||
-rw-r--r-- | gr-digital/lib/pfb_clock_sync_ccf_impl.h | 17 | ||||
-rw-r--r-- | gr-digital/swig/CMakeLists.txt | 11 |
4 files changed, 103 insertions, 2 deletions
diff --git a/gr-digital/lib/CMakeLists.txt b/gr-digital/lib/CMakeLists.txt index 5951d9e004..b25d5754a2 100644 --- a/gr-digital/lib/CMakeLists.txt +++ b/gr-digital/lib/CMakeLists.txt @@ -33,6 +33,10 @@ include_directories( include_directories(${Boost_INCLUDE_DIRS}) link_directories(${Boost_LIBRARY_DIRS}) +if(ENABLE_GR_CTRLPORT) + GR_ADD_COND_DEF(ENABLE_GR_CTRLPORT) +endif(ENABLE_GR_CTRLPORT) + ######################################################################## # generate helper scripts to expand templated files ######################################################################## @@ -156,9 +160,10 @@ list(APPEND digital_libs ${Boost_LIBRARIES} ) + add_library(gnuradio-digital SHARED ${digital_sources}) target_link_libraries(gnuradio-digital ${digital_libs}) GR_LIBRARY_FOO(gnuradio-digital RUNTIME_COMPONENT "digital_runtime" DEVEL_COMPONENT "digital_devel") -add_dependencies(gnuradio-digital +add_dependencies(gnuradio-digital digital_generated_includes digital_generated_swigs - gnuradio-filter gnuradio-analog) + gnuradio-core gnuradio-filter gnuradio-analog) diff --git a/gr-digital/lib/pfb_clock_sync_ccf_impl.cc b/gr-digital/lib/pfb_clock_sync_ccf_impl.cc index 8749567fa2..815ef3cfdd 100644 --- a/gr-digital/lib/pfb_clock_sync_ccf_impl.cc +++ b/gr-digital/lib/pfb_clock_sync_ccf_impl.cc @@ -65,6 +65,8 @@ namespace gr { d_max_dev(max_rate_deviation), d_osps(osps), d_error(0), d_out_idx(0) { + setup_rpc(); + d_nfilters = filter_size; d_sps = floor(sps); @@ -193,6 +195,24 @@ namespace gr { return d_rate_f; } + float + pfb_clock_sync_ccf_impl::error() const + { + return d_error; + } + + float + pfb_clock_sync_ccf_impl::rate() const + { + return d_rate_f; + } + + float + pfb_clock_sync_ccf_impl::phase() const + { + return d_k; + } + /******************************************************************* *******************************************************************/ @@ -435,5 +455,53 @@ namespace gr { return i; } + void + pfb_clock_sync_ccf_impl::setup_rpc() + { +#ifdef ENABLE_GR_CTRLPORT + // Getters + add_rpc_variable( + rpcbasic_sptr(new rpcbasic_register_get<pfb_clock_sync_ccf_impl, float>( + d_name, "error", this, unique_id(), + &pfb_clock_sync_ccf_impl::error, + pmt::mp(-2.0f), pmt::mp(2.0f), pmt::mp(0.0f), + "", "Error signal of loop", + RPC_PRIVLVL_MIN, DISPTIMESERIESF))); + + add_rpc_variable( + rpcbasic_sptr(new rpcbasic_register_get<pfb_clock_sync_ccf_impl, float>( + d_name, "rate", this, unique_id(), + &pfb_clock_sync_ccf_impl::rate, + pmt::mp(-2.0f), pmt::mp(2.0f), pmt::mp(0.0f), + "", "Rate change of phase", + RPC_PRIVLVL_MIN, DISPTIMESERIESF))); + + add_rpc_variable( + rpcbasic_sptr(new rpcbasic_register_get<pfb_clock_sync_ccf_impl, float>( + d_name, "phase", this, unique_id(), + &pfb_clock_sync_ccf_impl::phase, + pmt::mp(0), pmt::mp((int)d_nfilters), pmt::mp(0), + "", "Current filter phase arm", + RPC_PRIVLVL_MIN, DISPTIMESERIESF))); + + add_rpc_variable( + rpcbasic_sptr(new rpcbasic_register_get<pfb_clock_sync_ccf_impl, float>( + d_name, "loop bw", this, unique_id(), + &pfb_clock_sync_ccf_impl::loop_bandwidth, + pmt::mp(0.0f), pmt::mp(1.0f), pmt::mp(0.0f), + "", "Loop bandwidth", + RPC_PRIVLVL_MIN, DISPNULL))); + + // Setters + add_rpc_variable( + rpcbasic_sptr(new rpcbasic_register_set<pfb_clock_sync_ccf_impl, float>( + d_name, "loop bw", this, unique_id(), + &pfb_clock_sync_ccf_impl::set_loop_bandwidth, + pmt::mp(0.0f), pmt::mp(1.0f), pmt::mp(0.0f), + "", "Loop bandwidth", + RPC_PRIVLVL_MIN, DISPNULL))); +#endif /* ENABLE_GR_CTRLPORT */ + } + } /* namespace digital */ } /* namespace gr */ diff --git a/gr-digital/lib/pfb_clock_sync_ccf_impl.h b/gr-digital/lib/pfb_clock_sync_ccf_impl.h index 16cf80f046..e5eef37645 100644 --- a/gr-digital/lib/pfb_clock_sync_ccf_impl.h +++ b/gr-digital/lib/pfb_clock_sync_ccf_impl.h @@ -58,6 +58,8 @@ namespace gr { float d_error; int d_out_idx; + void setup_rpc(); + void create_diff_taps(const std::vector<float> &newtaps, std::vector<float> &difftaps); @@ -98,6 +100,21 @@ namespace gr { float beta() const; float clock_rate() const; + /*! + * \brief Returns the current error of the control loop. + */ + float error() const; + + /*! + * \brief Returns the current rate of the control loop. + */ + float rate() const; + + /*! + * \brief Returns the current phase arm of the control loop. + */ + float phase() const; + /******************************************************************* *******************************************************************/ diff --git a/gr-digital/swig/CMakeLists.txt b/gr-digital/swig/CMakeLists.txt index 5ec34008aa..58b95fa69b 100644 --- a/gr-digital/swig/CMakeLists.txt +++ b/gr-digital/swig/CMakeLists.txt @@ -30,6 +30,17 @@ set(GR_SWIG_INCLUDE_DIRS ${GNURADIO_CORE_SWIG_INCLUDE_DIRS} ) +set(GR_SWIG_LIBRARIES gnuradio-digital gnuradio-filter) + +if(ENABLE_GR_CTRLPORT) + set(GR_SWIG_INCLUDE_DIRS ${GR_SWIG_INCLUDE_DIRS} + ${GR_CTRLPORT_INCLUDE_DIRS} + ) + + set(GR_SWIG_LIBRARIES ${GR_SWIG_LIBRARIES} gnuradio-ctrlport) +endif(ENABLE_GR_CTRLPORT) + +set(GR_SWIG_TARGET_DEPS digital_generated_includes core_swig) set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/digital_swig_doc.i) set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../lib) |