diff options
-rw-r--r-- | cmake/Modules/GrBoost.cmake | 19 | ||||
-rw-r--r-- | gr-uhd/doc/uhd.dox | 8 | ||||
-rw-r--r-- | gr-uhd/lib/usrp_sink_impl.cc | 8 | ||||
-rw-r--r-- | gr-uhd/lib/usrp_source_impl.cc | 8 |
4 files changed, 37 insertions, 6 deletions
diff --git a/cmake/Modules/GrBoost.cmake b/cmake/Modules/GrBoost.cmake index 1cf8e65a11..39a78c5b86 100644 --- a/cmake/Modules/GrBoost.cmake +++ b/cmake/Modules/GrBoost.cmake @@ -39,9 +39,24 @@ if(UNIX AND NOT BOOST_ROOT AND EXISTS "/usr/lib64") list(APPEND BOOST_LIBRARYDIR "/usr/lib64") #fedora 64-bit fix endif(UNIX AND NOT BOOST_ROOT AND EXISTS "/usr/lib64") -if(MSVC) - set(BOOST_REQUIRED_COMPONENTS ${BOOST_REQUIRED_COMPONENTS} chrono) +if(WIN32) + #The following libraries are either used indirectly, + #or conditionally within the various core components. + #We explicitly list the libraries here because they + #are either required in environments MSVC and MINGW + #or linked-in automatically via header inclusion. + + #However, this is not robust; and its recommended that + #these libraries should be listed in the main components + #list once the minimum version of boost had been bumped + #to a version which always contains these components. + list(APPEND BOOST_REQUIRED_COMPONENTS + atomic + chrono + ) +endif(WIN32) +if(MSVC) if (NOT DEFINED BOOST_ALL_DYN_LINK) set(BOOST_ALL_DYN_LINK TRUE) endif() diff --git a/gr-uhd/doc/uhd.dox b/gr-uhd/doc/uhd.dox index 27a1475566..a3de8e3a24 100644 --- a/gr-uhd/doc/uhd.dox +++ b/gr-uhd/doc/uhd.dox @@ -57,8 +57,8 @@ which automatically sets the PMT types. Assume we only want to set the frequency (i.e. the second channel). In this case, we must construct a dictionary: \code{.cpp} pmt::pmt_t command = pmt::make_dict(); -pmt::dict_add(command, pmt::mp("freq"), pmt::mp(1.1e9)); // Specify frequency -pmt::dict_add(command, pmt::mp("chan"), pmt::mp(1)); // Specify channel +command = pmt::dict_add(command, pmt::mp("freq"), pmt::mp(1.1e9)); // Specify frequency +command = pmt::dict_add(command, pmt::mp("chan"), pmt::mp(1)); // Specify channel // Now pass 'command' into the USRP block's command port \endcode @@ -72,8 +72,8 @@ The main difference is that we can add more properties to the same command PMT, e.g. as such: \code{.cpp} // 'command' is the same PMT as in the previous example -pmt::dict_add(command, pmt::mp("gain"), pmt::mp(23.0)); // Specify gain -pmt::dict_add(command, pmt::mp("antenna"), pmt::mp("TX/RX")); // Switch antenna +command = pmt::dict_add(command, pmt::mp("gain"), pmt::mp(23.0)); // Specify gain +command = pmt::dict_add(command, pmt::mp("antenna"), pmt::mp("TX/RX")); // Switch antenna // Now pass 'command' into the USRP block's command port \endcode When the USRP block interprets this command PMT, all properties will be diff --git a/gr-uhd/lib/usrp_sink_impl.cc b/gr-uhd/lib/usrp_sink_impl.cc index 6288b80cc8..8798a6860c 100644 --- a/gr-uhd/lib/usrp_sink_impl.cc +++ b/gr-uhd/lib/usrp_sink_impl.cc @@ -141,12 +141,16 @@ namespace gr { void usrp_sink_impl::set_normalized_gain(double norm_gain, size_t chan) { +#ifdef UHD_USRP_MULTI_USRP_NORMALIZED_GAIN + _dev->set_normalized_tx_gain(norm_gain, chan); +#else if (norm_gain > 1.0 || norm_gain < 0.0) { throw std::runtime_error("Normalized gain out of range, must be in [0, 1]."); } ::uhd::gain_range_t gain_range = get_gain_range(chan); double abs_gain = (norm_gain * (gain_range.stop() - gain_range.start())) + gain_range.start(); set_gain(abs_gain, chan); +#endif } double @@ -166,6 +170,9 @@ namespace gr { double usrp_sink_impl::get_normalized_gain(size_t chan) { +#ifdef UHD_USRP_MULTI_USRP_NORMALIZED_GAIN + return _dev->get_normalized_tx_gain(chan); +#else ::uhd::gain_range_t gain_range = get_gain_range(chan); double norm_gain = (get_gain(chan) - gain_range.start()) / @@ -174,6 +181,7 @@ namespace gr { if (norm_gain > 1.0) return 1.0; if (norm_gain < 0.0) return 0.0; return norm_gain; +#endif } std::vector<std::string> diff --git a/gr-uhd/lib/usrp_source_impl.cc b/gr-uhd/lib/usrp_source_impl.cc index c840c43db1..a4ff3107b6 100644 --- a/gr-uhd/lib/usrp_source_impl.cc +++ b/gr-uhd/lib/usrp_source_impl.cc @@ -154,12 +154,16 @@ namespace gr { void usrp_source_impl::set_normalized_gain(double norm_gain, size_t chan) { +#ifdef UHD_USRP_MULTI_USRP_NORMALIZED_GAIN + _dev->set_normalized_rx_gain(norm_gain, chan); +#else if (norm_gain > 1.0 || norm_gain < 0.0) { throw std::runtime_error("Normalized gain out of range, must be in [0, 1]."); } ::uhd::gain_range_t gain_range = get_gain_range(chan); double abs_gain = (norm_gain * (gain_range.stop() - gain_range.start())) + gain_range.start(); set_gain(abs_gain, chan); +#endif } double @@ -179,6 +183,9 @@ namespace gr { double usrp_source_impl::get_normalized_gain(size_t chan) { +#ifdef UHD_USRP_MULTI_USRP_NORMALIZED_GAIN + return _dev->get_normalized_rx_gain(chan); +#else ::uhd::gain_range_t gain_range = get_gain_range(chan); double norm_gain = (get_gain(chan) - gain_range.start()) / @@ -187,6 +194,7 @@ namespace gr { if (norm_gain > 1.0) return 1.0; if (norm_gain < 0.0) return 0.0; return norm_gain; +#endif } std::vector<std::string> |