diff options
author | Josh Blum <josh@joshknows.com> | 2011-06-29 13:23:18 -0700 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2011-06-29 13:23:18 -0700 |
commit | d38757f4656028800e393c91bf3fec1986eb0200 (patch) | |
tree | f4f7b0fe078182b40cf07e6756fb8628feeffd70 | |
parent | 1ade1f94cb5aaf038d4914fb5cece82f055b8f0e (diff) | |
download | uhd-d38757f4656028800e393c91bf3fec1986eb0200.tar.gz uhd-d38757f4656028800e393c91bf3fec1986eb0200.tar.bz2 uhd-d38757f4656028800e393c91bf3fec1986eb0200.zip |
usrp: deleted a bunch on obsoleted files in usrp directory
31 files changed, 37 insertions, 1332 deletions
diff --git a/host/include/uhd/usrp/CMakeLists.txt b/host/include/uhd/usrp/CMakeLists.txt index e441433fd..ba38a67ea 100644 --- a/host/include/uhd/usrp/CMakeLists.txt +++ b/host/include/uhd/usrp/CMakeLists.txt @@ -17,13 +17,6 @@ INSTALL(FILES - #### props headers ### - codec_props.hpp - dboard_props.hpp - device_props.hpp - dsp_props.hpp - mboard_props.hpp - subdev_props.hpp #### dboard headers ### dboard_base.hpp @@ -33,12 +26,9 @@ INSTALL(FILES dboard_manager.hpp ### utilities ### - dsp_utils.hpp gps_ctrl.hpp mboard_eeprom.hpp - misc_utils.hpp subdev_spec.hpp - tune_helper.hpp ### interfaces ### single_usrp.hpp diff --git a/host/include/uhd/usrp/codec_props.hpp b/host/include/uhd/usrp/codec_props.hpp deleted file mode 100644 index b0a79e3f6..000000000 --- a/host/include/uhd/usrp/codec_props.hpp +++ /dev/null @@ -1,42 +0,0 @@ -// -// Copyright 2010-2011 Ettus Research LLC -// -// This program 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 of the License, or -// (at your option) any later version. -// -// This program 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 program. If not, see <http://www.gnu.org/licenses/>. -// - -#ifndef INCLUDED_UHD_USRP_CODEC_PROPS_HPP -#define INCLUDED_UHD_USRP_CODEC_PROPS_HPP - -#include <uhd/utils/props.hpp> - -namespace uhd{ namespace usrp{ - - /*! - * Possible device codec properties: - * A codec is expected to have a rate and gain elements. - * Other properties can be discovered through the others prop. - */ - enum codec_prop_t{ - CODEC_PROP_NAME, //ro, std::string - CODEC_PROP_OTHERS, //ro, prop_names_t - CODEC_PROP_GAIN_I, //rw, double - CODEC_PROP_GAIN_Q , //rw, double - CODEC_PROP_GAIN_RANGE, //ro, gain_range_t - CODEC_PROP_GAIN_NAMES //ro, prop_names_t - }; - - -}} //namespace - -#endif /* INCLUDED_UHD_USRP_CODEC_PROPS_HPP */ diff --git a/host/include/uhd/usrp/dboard_base.hpp b/host/include/uhd/usrp/dboard_base.hpp index 9b75d791f..7e9557a95 100644 --- a/host/include/uhd/usrp/dboard_base.hpp +++ b/host/include/uhd/usrp/dboard_base.hpp @@ -28,6 +28,43 @@ namespace uhd{ namespace usrp{ + /*! + * Possible subdev connection types: + * + * A complex subdevice is physically connected to both channels, + * which may be connected in one of two ways: IQ or QI (swapped). + * + * A real subdevice is only physically connected one channel, + * either only the I channel or only the Q channel. + */ + enum subdev_conn_t{ + SUBDEV_CONN_COMPLEX_IQ = 'C', + SUBDEV_CONN_COMPLEX_QI = 'c', + SUBDEV_CONN_REAL_I = 'R', + SUBDEV_CONN_REAL_Q = 'r' + }; + + /*! + * Possible device subdev properties + */ + enum subdev_prop_t{ + SUBDEV_PROP_NAME, //ro, std::string + SUBDEV_PROP_OTHERS, //ro, prop_names_t + SUBDEV_PROP_SENSOR, //ro, sensor_value_t + SUBDEV_PROP_SENSOR_NAMES, //ro, prop_names_t + SUBDEV_PROP_GAIN, //rw, double + SUBDEV_PROP_GAIN_RANGE, //ro, gain_range_t + SUBDEV_PROP_GAIN_NAMES, //ro, prop_names_t + SUBDEV_PROP_FREQ, //rw, double + SUBDEV_PROP_FREQ_RANGE, //ro, freq_range_t + SUBDEV_PROP_ANTENNA, //rw, std::string + SUBDEV_PROP_ANTENNA_NAMES, //ro, prop_names_t + SUBDEV_PROP_CONNECTION, //ro, subdev_conn_t + SUBDEV_PROP_ENABLED, //rw, bool + SUBDEV_PROP_USE_LO_OFFSET, //ro, bool + SUBDEV_PROP_BANDWIDTH //rw, double + }; + /*! * A daughter board dboard_base class for all dboards. * Only other dboard dboard_base classes should inherit this. diff --git a/host/include/uhd/usrp/dboard_props.hpp b/host/include/uhd/usrp/dboard_props.hpp deleted file mode 100644 index 29211ec8c..000000000 --- a/host/include/uhd/usrp/dboard_props.hpp +++ /dev/null @@ -1,43 +0,0 @@ -// -// Copyright 2010-2011 Ettus Research LLC -// -// This program 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 of the License, or -// (at your option) any later version. -// -// This program 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 program. If not, see <http://www.gnu.org/licenses/>. -// - -#ifndef INCLUDED_UHD_USRP_DBOARD_PROPS_HPP -#define INCLUDED_UHD_USRP_DBOARD_PROPS_HPP - -#include <uhd/utils/props.hpp> - -namespace uhd{ namespace usrp{ - - /*! - * Possible device dboard properties: - * A dboard has an id, one or more subdevices, and a codec. - * A dboard is considered to be unidirectional (RX or TX). - */ - enum dboard_prop_t{ - DBOARD_PROP_NAME, //ro, std::string - DBOARD_PROP_SUBDEV, //ro, wax::obj - DBOARD_PROP_SUBDEV_NAMES, //ro, prop_names_t - DBOARD_PROP_DBOARD_EEPROM, //rw, dboard_eeprom_t - DBOARD_PROP_GBOARD_EEPROM, //rw, dboard_eeprom_t - DBOARD_PROP_DBOARD_IFACE, //ro, dboard_iface::sptr - DBOARD_PROP_CODEC, //ro, wax::obj - DBOARD_PROP_GAIN_GROUP //ro, gain_group - }; - -}} //namespace - -#endif /* INCLUDED_UHD_USRP_DBOARD_PROPS_HPP */ diff --git a/host/include/uhd/usrp/device_props.hpp b/host/include/uhd/usrp/device_props.hpp deleted file mode 100644 index 3c8f7e225..000000000 --- a/host/include/uhd/usrp/device_props.hpp +++ /dev/null @@ -1,39 +0,0 @@ -// -// Copyright 2010-2011 Ettus Research LLC -// -// This program 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 of the License, or -// (at your option) any later version. -// -// This program 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 program. If not, see <http://www.gnu.org/licenses/>. -// - -#ifndef INCLUDED_UHD_USRP_DEVICE_PROPS_HPP -#define INCLUDED_UHD_USRP_DEVICE_PROPS_HPP - -#include <uhd/utils/props.hpp> - -namespace uhd{ namespace usrp{ - - /*! - * Possible device properties: - * In general, a device will have a single mboard. - * In certain mimo applications, multiple boards - * will be present in the interface for configuration. - */ - enum device_prop_t{ - DEVICE_PROP_NAME, //ro, std::string - DEVICE_PROP_MBOARD, //ro, wax::obj - DEVICE_PROP_MBOARD_NAMES, //ro, prop_names_t - }; - -}} //namespace - -#endif /* INCLUDED_UHD_USRP_DEVICE_PROPS_HPP */ diff --git a/host/include/uhd/usrp/dsp_props.hpp b/host/include/uhd/usrp/dsp_props.hpp deleted file mode 100644 index e68e11deb..000000000 --- a/host/include/uhd/usrp/dsp_props.hpp +++ /dev/null @@ -1,50 +0,0 @@ -// -// Copyright 2010-2011 Ettus Research LLC -// -// This program 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 of the License, or -// (at your option) any later version. -// -// This program 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 program. If not, see <http://www.gnu.org/licenses/>. -// - -#ifndef INCLUDED_UHD_USRP_DSP_PROPS_HPP -#define INCLUDED_UHD_USRP_DSP_PROPS_HPP - -#include <uhd/utils/props.hpp> - -namespace uhd{ namespace usrp{ - - /*! - * Possible device dsp properties: - * A dsp is a black box fpga component found between - * the over-the-wire data and the codec pins. - * - * The host rate can be modified to control resampling. - * Resampling can take the form of decimation, interpolation, - * or more complex fractional resampling techniques. - * As usual, read back the host rate after setting it - * to get the actual rate that was set (implementation dependent). - * - * A dsp can also shift the digital stream in frequency. - * Set the shift property and read it back to get actual shift. - */ - enum dsp_prop_t{ - DSP_PROP_NAME, //ro, std::string - DSP_PROP_OTHERS, //ro, prop_names_t - DSP_PROP_STREAM_CMD, //wo, stream_cmd_t - DSP_PROP_FREQ_SHIFT, //rw, double Hz - DSP_PROP_CODEC_RATE, //ro, double Sps - DSP_PROP_HOST_RATE //rw, double Sps - }; - -}} //namespace - -#endif /* INCLUDED_UHD_USRP_DSP_PROPS_HPP */ diff --git a/host/include/uhd/usrp/dsp_utils.hpp b/host/include/uhd/usrp/dsp_utils.hpp deleted file mode 100644 index 5b81ce322..000000000 --- a/host/include/uhd/usrp/dsp_utils.hpp +++ /dev/null @@ -1,96 +0,0 @@ -// -// Copyright 2010 Ettus Research LLC -// -// This program 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 of the License, or -// (at your option) any later version. -// -// This program 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 program. If not, see <http://www.gnu.org/licenses/>. -// - -#ifndef INCLUDED_UHD_USRP_DSP_UTILS_HPP -#define INCLUDED_UHD_USRP_DSP_UTILS_HPP - -#include <uhd/config.hpp> -#include <uhd/types/stream_cmd.hpp> -#include <uhd/usrp/subdev_props.hpp> -#include <boost/cstdint.hpp> - -namespace uhd{ namespace usrp{ - -namespace dsp_type1{ - - /*! - * Calculate the rx mux word from properties. - * \param subdev_conn the subdev connection type - * \return the 32-bit rx mux control word - */ - UHD_API boost::uint32_t calc_rx_mux_word(subdev_conn_t subdev_conn); - - /*! - * Calculate the tx mux word from properties. - * \param subdev_conn the subdev connection type - * \return the 32-bit tx mux control word - */ - UHD_API boost::uint32_t calc_tx_mux_word(subdev_conn_t subdev_conn); - - /*! - * Calculate the cordic word from the frequency and clock rate. - * The frequency will be set to the actual (possible) frequency. - * - * \param freq the requested frequency in Hz - * \param codec_rate the dsp codec rate in Hz - * \return the 32-bit cordic control word - */ - UHD_API boost::uint32_t calc_cordic_word_and_update( - double &freq, double codec_rate - ); - - /*! - * Calculate the CIC filter word from the rate. - * Check if requested decim/interp rate is: - * multiple of 4, enable two halfband filters - * multiple of 2, enable one halfband filter - * handle remainder in CIC - * - * \param rate the requested rate in Sps - * \return the 32-bit cic filter control word - */ - UHD_API boost::uint32_t calc_cic_filter_word(unsigned rate); - - /*! - * Calculate the IQ scale factor word from I and Q components. - * \param i the I component of the scalar - * \param q the Q component of the scalar - * \return the 32-bit scale factor control word - */ - UHD_API boost::uint32_t calc_iq_scale_word( - boost::int16_t i, boost::int16_t q - ); - - /*! - * Calculate the IQ scale factor word from the rate. - * \param rate the requested rate in Sps - * \return the 32-bit scale factor control word - */ - UHD_API boost::uint32_t calc_iq_scale_word(unsigned rate); - - /*! - * Calculate the stream command word from the stream command struct. - * \param stream_cmd the requested stream command with mode, flags, timestamp - * \return the 32-bit stream command word - */ - UHD_API boost::uint32_t calc_stream_cmd_word(const stream_cmd_t &stream_cmd); - -} //namespace dsp_type1 - -}} //namespace - -#endif /* INCLUDED_UHD_USRP_DSP_UTILS_HPP */ diff --git a/host/include/uhd/usrp/mboard_props.hpp b/host/include/uhd/usrp/mboard_props.hpp deleted file mode 100644 index a2580954e..000000000 --- a/host/include/uhd/usrp/mboard_props.hpp +++ /dev/null @@ -1,56 +0,0 @@ -// -// Copyright 2010-2011 Ettus Research LLC -// -// This program 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 of the License, or -// (at your option) any later version. -// -// This program 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 program. If not, see <http://www.gnu.org/licenses/>. -// - -#ifndef INCLUDED_UHD_USRP_MBOARD_PROPS_HPP -#define INCLUDED_UHD_USRP_MBOARD_PROPS_HPP - -#include <uhd/utils/props.hpp> - -namespace uhd{ namespace usrp{ - - /*! - * Possible device mboard properties: - * The general mboard properties are listed below. - * Custom properties can be identified with a string - * and discovered though the others property. - */ - enum mboard_prop_t{ - MBOARD_PROP_NAME, //ro, std::string - MBOARD_PROP_OTHERS, //ro, prop_names_t - MBOARD_PROP_SENSOR, //ro, sensor_value_t - MBOARD_PROP_SENSOR_NAMES, //ro, prop_names_t - MBOARD_PROP_CLOCK_RATE, //rw, double - MBOARD_PROP_RX_DSP, //ro, wax::obj - MBOARD_PROP_RX_DSP_NAMES, //ro, prop_names_t - MBOARD_PROP_TX_DSP, //ro, wax::obj - MBOARD_PROP_TX_DSP_NAMES, //ro, prop_names_t - MBOARD_PROP_RX_DBOARD, //ro, wax::obj - MBOARD_PROP_RX_DBOARD_NAMES, //ro, prop_names_t - MBOARD_PROP_TX_DBOARD, //ro, wax::obj - MBOARD_PROP_TX_DBOARD_NAMES, //ro, prop_names_t - MBOARD_PROP_RX_SUBDEV_SPEC, //rw, subdev_spec_t - MBOARD_PROP_TX_SUBDEV_SPEC, //rw, subdev_spec_t - MBOARD_PROP_CLOCK_CONFIG, //rw, clock_config_t - MBOARD_PROP_TIME_NOW, //rw, time_spec_t - MBOARD_PROP_TIME_PPS, //wo, time_spec_t - MBOARD_PROP_EEPROM_MAP, //wr, mboard_eeprom_t - MBOARD_PROP_IFACE, //ro, mboard_iface::sptr - }; - -}} //namespace - -#endif /* INCLUDED_UHD_USRP_MBOARD_PROPS_HPP */ diff --git a/host/include/uhd/usrp/misc_utils.hpp b/host/include/uhd/usrp/misc_utils.hpp deleted file mode 100644 index 37860a1a5..000000000 --- a/host/include/uhd/usrp/misc_utils.hpp +++ /dev/null @@ -1,71 +0,0 @@ -// -// Copyright 2010 Ettus Research LLC -// -// This program 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 of the License, or -// (at your option) any later version. -// -// This program 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 program. If not, see <http://www.gnu.org/licenses/>. -// - -#ifndef INCLUDED_UHD_USRP_MISC_UTILS_HPP -#define INCLUDED_UHD_USRP_MISC_UTILS_HPP - -#include <uhd/config.hpp> -#include <uhd/wax.hpp> -#include <uhd/usrp/dboard_id.hpp> -#include <uhd/usrp/subdev_spec.hpp> -#include <uhd/utils/gain_group.hpp> - -namespace uhd{ namespace usrp{ - - /*! - * Different policies for gain group prioritization. - */ - enum gain_group_policy_t{ - GAIN_GROUP_POLICY_RX = 'R', - GAIN_GROUP_POLICY_TX = 'T' - }; - - /*! - * Create a gain group that represents the subdevice and its codec. - * \param dboard_id the dboard id for this subdevice - * \param subdev the object with subdevice properties - * \param codec the object with codec properties - * \param gain_group_policy the policy to use - */ - UHD_API gain_group::sptr make_gain_group( - const dboard_id_t &dboard_id, - wax::obj subdev, wax::obj codec, - gain_group_policy_t gain_group_policy - ); - - /*! - * Verify the rx subdevice specification. - * If the subdev spec if empty, automatically fill it. - * \param subdev_spec the subdev spec to verify/fill - * \param mboard the motherboard properties object - * \throw exception when the subdev spec is invalid - */ - UHD_API void verify_rx_subdev_spec(subdev_spec_t &subdev_spec, wax::obj mboard); - - /*! - * Verify the tx subdevice specification. - * If the subdev spec if empty, automatically fill it. - * \param subdev_spec the subdev spec to verify/fill - * \param mboard the motherboard properties object - * \throw exception when the subdev spec is invalid - */ - UHD_API void verify_tx_subdev_spec(subdev_spec_t &subdev_spec, wax::obj mboard); - -}} //namespace - -#endif /* INCLUDED_UHD_USRP_MISC_UTILS_HPP */ - diff --git a/host/include/uhd/usrp/subdev_props.hpp b/host/include/uhd/usrp/subdev_props.hpp deleted file mode 100644 index 40b339703..000000000 --- a/host/include/uhd/usrp/subdev_props.hpp +++ /dev/null @@ -1,64 +0,0 @@ -// -// Copyright 2010-2011 Ettus Research LLC -// -// This program 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 of the License, or -// (at your option) any later version. -// -// This program 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 program. If not, see <http://www.gnu.org/licenses/>. -// - -#ifndef INCLUDED_UHD_USRP_SUBDEV_PROPS_HPP -#define INCLUDED_UHD_USRP_SUBDEV_PROPS_HPP - -#include <uhd/utils/props.hpp> - -namespace uhd{ namespace usrp{ - - /*! - * Possible subdev connection types: - * - * A complex subdevice is physically connected to both channels, - * which may be connected in one of two ways: IQ or QI (swapped). - * - * A real subdevice is only physically connected one channel, - * either only the I channel or only the Q channel. - */ - enum subdev_conn_t{ - SUBDEV_CONN_COMPLEX_IQ = 'C', - SUBDEV_CONN_COMPLEX_QI = 'c', - SUBDEV_CONN_REAL_I = 'R', - SUBDEV_CONN_REAL_Q = 'r' - }; - - /*! - * Possible device subdev properties - */ - enum subdev_prop_t{ - SUBDEV_PROP_NAME, //ro, std::string - SUBDEV_PROP_OTHERS, //ro, prop_names_t - SUBDEV_PROP_SENSOR, //ro, sensor_value_t - SUBDEV_PROP_SENSOR_NAMES, //ro, prop_names_t - SUBDEV_PROP_GAIN, //rw, double - SUBDEV_PROP_GAIN_RANGE, //ro, gain_range_t - SUBDEV_PROP_GAIN_NAMES, //ro, prop_names_t - SUBDEV_PROP_FREQ, //rw, double - SUBDEV_PROP_FREQ_RANGE, //ro, freq_range_t - SUBDEV_PROP_ANTENNA, //rw, std::string - SUBDEV_PROP_ANTENNA_NAMES, //ro, prop_names_t - SUBDEV_PROP_CONNECTION, //ro, subdev_conn_t - SUBDEV_PROP_ENABLED, //rw, bool - SUBDEV_PROP_USE_LO_OFFSET, //ro, bool - SUBDEV_PROP_BANDWIDTH //rw, double - }; - -}} //namespace - -#endif /* INCLUDED_UHD_USRP_SUBDEV_PROPS_HPP */ diff --git a/host/include/uhd/usrp/tune_helper.hpp b/host/include/uhd/usrp/tune_helper.hpp deleted file mode 100644 index 0d468a4e2..000000000 --- a/host/include/uhd/usrp/tune_helper.hpp +++ /dev/null @@ -1,78 +0,0 @@ -// -// Copyright 2010-2011 Ettus Research LLC -// -// This program 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 of the License, or -// (at your option) any later version. -// -// This program 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 program. If not, see <http://www.gnu.org/licenses/>. -// - -#ifndef INCLUDED_UHD_USRP_TUNE_HELPER_HPP -#define INCLUDED_UHD_USRP_TUNE_HELPER_HPP - -#include <uhd/config.hpp> -#include <uhd/wax.hpp> -#include <uhd/types/tune_request.hpp> -#include <uhd/types/tune_result.hpp> - -namespace uhd{ namespace usrp{ - - /*! - * Tune a rx chain to the desired frequency: - * The IF of the subdevice is set as close as possible to - * the given target frequency + the LO offset (when applicable). - * The ddc cordic is setup to bring the IF down to baseband. - * \param subdev the dboard subdevice object with properties - * \param ddc the mboard dsp object with properties - * \param tune_request tune request instructions - * \return a tune result struct - */ - UHD_API tune_result_t tune_rx_subdev_and_dsp( - wax::obj subdev, wax::obj ddc, const tune_request_t &tune_request - ); - - /*! - * Calculate the overall frequency from the combination of dboard IF and DDC shift. - * \param subdev the dboard subdevice object with properties - * \param ddc the mboard dsp object with properties - * \return the overall tune frequency of the system in Hz - */ - UHD_API double derive_freq_from_rx_subdev_and_dsp( - wax::obj subdev, wax::obj ddc - ); - - /*! - * Tune a tx chain to the desired frequency: - * The IF of the subdevice is set as close as possible to - * the given target frequency + the LO offset (when applicable). - * The duc cordic is setup to bring the baseband up to IF. - * \param subdev the dboard subdevice object with properties - * \param duc the mboard dsp object with properties - * \param tune_request tune request instructions - * \return a tune result struct - */ - UHD_API tune_result_t tune_tx_subdev_and_dsp( - wax::obj subdev, wax::obj duc, const tune_request_t &tune_request - ); - - /*! - * Calculate the overall frequency from the combination of dboard IF and DUC shift. - * \param subdev the dboard subdevice object with properties - * \param duc the mboard dsp object with properties - * \return the overall tune frequency of the system in Hz - */ - UHD_API double derive_freq_from_tx_subdev_and_dsp( - wax::obj subdev, wax::obj duc - ); - -}} - -#endif /* INCLUDED_UHD_USRP_TUNE_HELPER_HPP */ diff --git a/host/lib/usrp/CMakeLists.txt b/host/lib/usrp/CMakeLists.txt index 554da369e..21e44509c 100644 --- a/host/lib/usrp/CMakeLists.txt +++ b/host/lib/usrp/CMakeLists.txt @@ -24,13 +24,10 @@ LIBUHD_APPEND_SOURCES( ${CMAKE_CURRENT_SOURCE_DIR}/dboard_id.cpp ${CMAKE_CURRENT_SOURCE_DIR}/dboard_iface.cpp ${CMAKE_CURRENT_SOURCE_DIR}/dboard_manager.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/dsp_utils.cpp ${CMAKE_CURRENT_SOURCE_DIR}/gps_ctrl.cpp ${CMAKE_CURRENT_SOURCE_DIR}/mboard_eeprom.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/misc_utils.cpp ${CMAKE_CURRENT_SOURCE_DIR}/multi_usrp.cpp ${CMAKE_CURRENT_SOURCE_DIR}/subdev_spec.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/tune_helper.cpp ) INCLUDE_SUBDIRECTORY(cores) diff --git a/host/lib/usrp/dboard/db_basic_and_lf.cpp b/host/lib/usrp/dboard/db_basic_and_lf.cpp index 05c989a97..ff93f1d89 100644 --- a/host/lib/usrp/dboard/db_basic_and_lf.cpp +++ b/host/lib/usrp/dboard/db_basic_and_lf.cpp @@ -15,7 +15,6 @@ // along with this program. If not, see <http://www.gnu.org/licenses/>. // -#include <uhd/usrp/subdev_props.hpp> #include <uhd/types/dict.hpp> #include <uhd/types/ranges.hpp> #include <uhd/utils/assert_has.hpp> diff --git a/host/lib/usrp/dboard/db_dbsrx.cpp b/host/lib/usrp/dboard/db_dbsrx.cpp index cfe06db29..c65c52590 100644 --- a/host/lib/usrp/dboard/db_dbsrx.cpp +++ b/host/lib/usrp/dboard/db_dbsrx.cpp @@ -28,7 +28,6 @@ #include <uhd/types/ranges.hpp> #include <uhd/types/sensors.hpp> #include <uhd/types/dict.hpp> -#include <uhd/usrp/subdev_props.hpp> #include <uhd/usrp/dboard_base.hpp> #include <uhd/usrp/dboard_manager.hpp> #include <boost/assign/list_of.hpp> diff --git a/host/lib/usrp/dboard/db_dbsrx2.cpp b/host/lib/usrp/dboard/db_dbsrx2.cpp index aaced7a5d..93bab5aec 100644 --- a/host/lib/usrp/dboard/db_dbsrx2.cpp +++ b/host/lib/usrp/dboard/db_dbsrx2.cpp @@ -25,7 +25,6 @@ #include <uhd/types/ranges.hpp> #include <uhd/types/sensors.hpp> #include <uhd/types/dict.hpp> -#include <uhd/usrp/subdev_props.hpp> #include <uhd/usrp/dboard_base.hpp> #include <uhd/usrp/dboard_manager.hpp> #include <boost/assign/list_of.hpp> diff --git a/host/lib/usrp/dboard/db_rfx.cpp b/host/lib/usrp/dboard/db_rfx.cpp index 61f9130d4..14129ef72 100644 --- a/host/lib/usrp/dboard/db_rfx.cpp +++ b/host/lib/usrp/dboard/db_rfx.cpp @@ -34,7 +34,6 @@ #include "adf4360_regs.hpp" #include <uhd/types/dict.hpp> -#include <uhd/usrp/subdev_props.hpp> #include <uhd/types/ranges.hpp> #include <uhd/types/sensors.hpp> #include <uhd/utils/assert_has.hpp> diff --git a/host/lib/usrp/dboard/db_sbx.cpp b/host/lib/usrp/dboard/db_sbx.cpp index 6ca89b81a..aa9556e77 100644 --- a/host/lib/usrp/dboard/db_sbx.cpp +++ b/host/lib/usrp/dboard/db_sbx.cpp @@ -74,7 +74,6 @@ #include "adf4350_regs.hpp" #include <uhd/types/dict.hpp> -#include <uhd/usrp/subdev_props.hpp> #include <uhd/types/ranges.hpp> #include <uhd/types/sensors.hpp> #include <uhd/utils/assert_has.hpp> diff --git a/host/lib/usrp/dboard/db_tvrx.cpp b/host/lib/usrp/dboard/db_tvrx.cpp index 1ff0fb785..3b8b276e0 100644 --- a/host/lib/usrp/dboard/db_tvrx.cpp +++ b/host/lib/usrp/dboard/db_tvrx.cpp @@ -35,7 +35,6 @@ #include <uhd/types/ranges.hpp> #include <uhd/types/sensors.hpp> #include <uhd/types/dict.hpp> -#include <uhd/usrp/subdev_props.hpp> #include <uhd/usrp/dboard_base.hpp> #include <uhd/usrp/dboard_manager.hpp> #include <boost/assign/list_of.hpp> diff --git a/host/lib/usrp/dboard/db_tvrx2.cpp b/host/lib/usrp/dboard/db_tvrx2.cpp index 39ff90d79..23f203b8c 100644 --- a/host/lib/usrp/dboard/db_tvrx2.cpp +++ b/host/lib/usrp/dboard/db_tvrx2.cpp @@ -59,7 +59,6 @@ #include <uhd/types/ranges.hpp> #include <uhd/types/sensors.hpp> #include <uhd/types/dict.hpp> -#include <uhd/usrp/subdev_props.hpp> #include <uhd/usrp/dboard_base.hpp> #include <uhd/usrp/dboard_manager.hpp> #include <boost/assign/list_of.hpp> diff --git a/host/lib/usrp/dboard/db_unknown.cpp b/host/lib/usrp/dboard/db_unknown.cpp index 19f0f1c71..0587d015c 100644 --- a/host/lib/usrp/dboard/db_unknown.cpp +++ b/host/lib/usrp/dboard/db_unknown.cpp @@ -15,7 +15,6 @@ // along with this program. If not, see <http://www.gnu.org/licenses/>. // -#include <uhd/usrp/subdev_props.hpp> #include <uhd/types/ranges.hpp> #include <uhd/utils/assert_has.hpp> #include <uhd/utils/static.hpp> diff --git a/host/lib/usrp/dboard/db_wbx_common.cpp b/host/lib/usrp/dboard/db_wbx_common.cpp index 1a016e89c..81aba6426 100644 --- a/host/lib/usrp/dboard/db_wbx_common.cpp +++ b/host/lib/usrp/dboard/db_wbx_common.cpp @@ -61,7 +61,6 @@ #include "adf4350_regs.hpp" #include <uhd/utils/log.hpp> #include <uhd/types/dict.hpp> -#include <uhd/usrp/subdev_props.hpp> #include <uhd/types/ranges.hpp> #include <uhd/types/sensors.hpp> #include <uhd/utils/assert_has.hpp> diff --git a/host/lib/usrp/dboard/db_wbx_simple.cpp b/host/lib/usrp/dboard/db_wbx_simple.cpp index 602ce389d..ae466b08a 100644 --- a/host/lib/usrp/dboard/db_wbx_simple.cpp +++ b/host/lib/usrp/dboard/db_wbx_simple.cpp @@ -26,7 +26,6 @@ #include <uhd/utils/static.hpp> #include <uhd/utils/assert_has.hpp> #include <uhd/usrp/dboard_manager.hpp> -#include <uhd/usrp/subdev_props.hpp> #include <boost/assign/list_of.hpp> using namespace uhd; diff --git a/host/lib/usrp/dboard/db_xcvr2450.cpp b/host/lib/usrp/dboard/db_xcvr2450.cpp index fcd05ea04..b88eb2a95 100644 --- a/host/lib/usrp/dboard/db_xcvr2450.cpp +++ b/host/lib/usrp/dboard/db_xcvr2450.cpp @@ -56,7 +56,6 @@ #include <uhd/types/ranges.hpp> #include <uhd/types/sensors.hpp> #include <uhd/types/dict.hpp> -#include <uhd/usrp/subdev_props.hpp> #include <uhd/usrp/dboard_base.hpp> #include <uhd/usrp/dboard_manager.hpp> #include <boost/assign/list_of.hpp> diff --git a/host/lib/usrp/dboard_manager.cpp b/host/lib/usrp/dboard_manager.cpp index 5fa10f215..fae3d35b3 100644 --- a/host/lib/usrp/dboard_manager.cpp +++ b/host/lib/usrp/dboard_manager.cpp @@ -17,7 +17,6 @@ #include "dboard_ctor_args.hpp" #include <uhd/usrp/dboard_manager.hpp> -#include <uhd/usrp/subdev_props.hpp> #include <uhd/utils/msg.hpp> #include <uhd/utils/log.hpp> #include <uhd/utils/safe_call.hpp> diff --git a/host/lib/usrp/dsp_utils.cpp b/host/lib/usrp/dsp_utils.cpp deleted file mode 100644 index 2686e895b..000000000 --- a/host/lib/usrp/dsp_utils.cpp +++ /dev/null @@ -1,141 +0,0 @@ -// -// Copyright 2010-2011 Ettus Research LLC -// -// This program 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 of the License, or -// (at your option) any later version. -// -// This program 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 program. If not, see <http://www.gnu.org/licenses/>. -// - -#include <uhd/usrp/dsp_utils.hpp> -#include <uhd/types/dict.hpp> -#include <uhd/exception.hpp> -#include <boost/assign/list_of.hpp> -#include <boost/tuple/tuple.hpp> -#include <boost/math/special_functions/round.hpp> -#include <boost/math/special_functions/sign.hpp> -#include <algorithm> -#include <cmath> - -using namespace uhd; -using namespace uhd::usrp; - -template <class T> T ceil_log2(T num){ - return std::ceil(std::log(num)/std::log(T(2))); -} - -/*! - * 3 2 1 0 - * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 - * +-------------------------------+-------+-------+-------+-------+ - * | | DDC0Q | DDC0I | - * +-------------------------------+-------+-------+-------+-------+ - */ -boost::uint32_t dsp_type1::calc_rx_mux_word(subdev_conn_t subdev_conn){ - switch(subdev_conn){ - case SUBDEV_CONN_COMPLEX_IQ: return (0x1 << 4) | (0x0 << 0); //DDC0Q=ADC0Q, DDC0I=ADC0I - case SUBDEV_CONN_COMPLEX_QI: return (0x0 << 4) | (0x1 << 0); //DDC0Q=ADC0I, DDC0I=ADC0Q - case SUBDEV_CONN_REAL_I: return (0xf << 4) | (0x0 << 0); //DDC0Q=ZERO, DDC0I=ADC0I - case SUBDEV_CONN_REAL_Q: return (0xf << 4) | (0x1 << 0); //DDC0Q=ZERO, DDC0I=ADC0Q - default: UHD_THROW_INVALID_CODE_PATH(); - } -} - -/*! - * 3 2 1 0 - * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 - * +-------------------------------+-------+-------+-------+-------+ - * | | DAC0Q | DAC0I | - * +-------------------------------+-------+-------+-------+-------+ - */ -boost::uint32_t dsp_type1::calc_tx_mux_word(subdev_conn_t subdev_conn){ - switch(subdev_conn){ - case SUBDEV_CONN_COMPLEX_IQ: return (0x1 << 4) | (0x0 << 0); //DAC0Q=DUC0Q, DAC0I=DUC0I - case SUBDEV_CONN_COMPLEX_QI: return (0x0 << 4) | (0x1 << 0); //DAC0Q=DUC0I, DAC0I=DUC0Q - case SUBDEV_CONN_REAL_I: return (0xf << 4) | (0x0 << 0); //DAC0Q=ZERO, DAC0I=DUC0I - case SUBDEV_CONN_REAL_Q: return (0x0 << 4) | (0xf << 0); //DAC0Q=DUC0I, DAC0I=ZERO - default: UHD_THROW_INVALID_CODE_PATH(); - } -} - -boost::uint32_t dsp_type1::calc_cordic_word_and_update( - double &freq, double codec_rate -){ - //correct for outside of rate (wrap around) - freq = std::fmod(freq, codec_rate); - if (std::abs(freq) > codec_rate/2.0) - freq -= boost::math::sign(freq)*codec_rate; - - //calculate the freq register word (signed) - UHD_ASSERT_THROW(std::abs(freq) <= codec_rate/2.0); - static const double scale_factor = std::pow(2.0, 32); - boost::int32_t freq_word = boost::int32_t(boost::math::round((freq / codec_rate) * scale_factor)); - - //update the actual frequency - freq = (double(freq_word) / scale_factor) * codec_rate; - - return boost::uint32_t(freq_word); -} - -boost::uint32_t dsp_type1::calc_cic_filter_word(unsigned rate){ - int hb0 = 0, hb1 = 0; - if (not (rate & 0x1)){ - hb0 = 1; - rate /= 2; - } - if (not (rate & 0x1)){ - hb1 = 1; - rate /= 2; - } - return (hb1 << 9) | (hb0 << 8) | (rate & 0xff); -} - -boost::uint32_t dsp_type1::calc_iq_scale_word( - boost::int16_t i, boost::int16_t q -){ - return (boost::uint32_t(i) << 16) | (boost::uint32_t(q) << 0); -} - -boost::uint32_t dsp_type1::calc_iq_scale_word(unsigned rate){ - // Calculate CIC interpolation (i.e., without halfband interpolators) - unsigned tmp_rate = calc_cic_filter_word(rate) & 0xff; - - // Calculate closest multiplier constant to reverse gain absent scale multipliers - double rate_cubed = std::pow(double(tmp_rate), 3); - boost::int16_t scale = boost::math::iround((4096*std::pow(2, ceil_log2(rate_cubed)))/(1.65*rate_cubed)); - return calc_iq_scale_word(scale, scale); -} - -boost::uint32_t dsp_type1::calc_stream_cmd_word(const stream_cmd_t &stream_cmd){ - UHD_ASSERT_THROW(stream_cmd.num_samps <= 0x3fffffff); - - //setup the mode to instruction flags - typedef boost::tuple<bool, bool, bool> inst_t; - static const uhd::dict<stream_cmd_t::stream_mode_t, inst_t> mode_to_inst = boost::assign::map_list_of - //reload, chain, samps - (stream_cmd_t::STREAM_MODE_START_CONTINUOUS, inst_t(true, true, false)) - (stream_cmd_t::STREAM_MODE_STOP_CONTINUOUS, inst_t(false, false, false)) - (stream_cmd_t::STREAM_MODE_NUM_SAMPS_AND_DONE, inst_t(false, false, true)) - (stream_cmd_t::STREAM_MODE_NUM_SAMPS_AND_MORE, inst_t(false, true, true)) - ; - - //setup the instruction flag values - bool inst_reload, inst_chain, inst_samps; - boost::tie(inst_reload, inst_chain, inst_samps) = mode_to_inst[stream_cmd.stream_mode]; - - //calculate the word from flags and length - boost::uint32_t word = 0; - word |= boost::uint32_t((stream_cmd.stream_now)? 1 : 0) << 31; - word |= boost::uint32_t((inst_chain)? 1 : 0) << 30; - word |= boost::uint32_t((inst_reload)? 1 : 0) << 29; - word |= (inst_samps)? stream_cmd.num_samps : ((inst_chain)? 1 : 0); - return word; -} diff --git a/host/lib/usrp/misc_utils.cpp b/host/lib/usrp/misc_utils.cpp deleted file mode 100644 index ddcad41cf..000000000 --- a/host/lib/usrp/misc_utils.cpp +++ /dev/null @@ -1,225 +0,0 @@ -// -// Copyright 2010-2011 Ettus Research LLC -// -// This program 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 of the License, or -// (at your option) any later version. -// -// This program 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 program. If not, see <http://www.gnu.org/licenses/>. -// - -#include <uhd/usrp/misc_utils.hpp> -#include <uhd/utils/assert_has.hpp> -#include <uhd/utils/algorithm.hpp> -#include <uhd/utils/gain_group.hpp> -#include <uhd/usrp/dboard_eeprom.hpp> -#include <uhd/usrp/subdev_props.hpp> -#include <uhd/usrp/mboard_props.hpp> -#include <uhd/usrp/dboard_props.hpp> -#include <uhd/usrp/codec_props.hpp> -#include <boost/bind.hpp> -#include <boost/foreach.hpp> -#include <boost/format.hpp> - -using namespace uhd; -using namespace uhd::usrp; - -/*********************************************************************** - * codec gain group helper functions: - * do this so we dont have to bind a templated function - **********************************************************************/ -static gain_range_t get_codec_gain_range(wax::obj codec, const std::string &name){ - return codec[named_prop_t(CODEC_PROP_GAIN_RANGE, name)].as<gain_range_t>(); -} - -static double get_codec_gain_i(wax::obj codec, const std::string &name){ - return codec[named_prop_t(CODEC_PROP_GAIN_I, name)].as<double>(); -} - -static double get_codec_gain_q(wax::obj codec, const std::string &name){ - return codec[named_prop_t(CODEC_PROP_GAIN_Q, name)].as<double>(); -} - -static void set_codec_gain_both(wax::obj codec, const std::string &name, double gain){ - codec[named_prop_t(CODEC_PROP_GAIN_I, name)] = gain; - codec[named_prop_t(CODEC_PROP_GAIN_Q, name)] = gain; -} - -static void set_codec_gain_i(wax::obj codec, const std::string &name, double gain){ - codec[named_prop_t(CODEC_PROP_GAIN_I, name)] = gain; -} - -static void set_codec_gain_q(wax::obj codec, const std::string &name, double gain){ - codec[named_prop_t(CODEC_PROP_GAIN_Q, name)] = gain; -} - -/*********************************************************************** - * subdev gain group helper functions: - * do this so we dont have to bind a templated function - **********************************************************************/ -static double get_subdev_gain(wax::obj subdev, const std::string &name){ - return subdev[named_prop_t(SUBDEV_PROP_GAIN, name)].as<double>(); -} - -static gain_range_t get_subdev_gain_range(wax::obj subdev, const std::string &name){ - return subdev[named_prop_t(SUBDEV_PROP_GAIN_RANGE, name)].as<gain_range_t>(); -} - -static void set_subdev_gain(wax::obj subdev, const std::string &name, double gain){ - subdev[named_prop_t(SUBDEV_PROP_GAIN, name)] = gain; -} - -/*********************************************************************** - * gain group factory function for usrp - **********************************************************************/ -gain_group::sptr usrp::make_gain_group( - const dboard_id_t &dboard_id, - wax::obj subdev, wax::obj codec, - gain_group_policy_t gain_group_policy -){ - const size_t subdev_gain_priority = 1; - const size_t codec_gain_priority = (gain_group_policy == GAIN_GROUP_POLICY_RX)? - (subdev_gain_priority - 1): //RX policy, codec gains fill last (lower priority) - (subdev_gain_priority + 1); //TX policy, codec gains fill first (higher priority) - const std::string subdev_prefix = dboard_id.to_cname() + "-"; - const std::string codec_prefix = (gain_group_policy == GAIN_GROUP_POLICY_RX)? "ADC-" : "DAC-"; - - gain_group::sptr gg = gain_group::make(); - gain_fcns_t fcns; - //add all the subdev gains first (antenna to dsp order) - BOOST_FOREACH(const std::string &name, subdev[SUBDEV_PROP_GAIN_NAMES].as<prop_names_t>()){ - fcns.get_range = boost::bind(&get_subdev_gain_range, subdev, name); - fcns.get_value = boost::bind(&get_subdev_gain, subdev, name); - fcns.set_value = boost::bind(&set_subdev_gain, subdev, name, _1); - gg->register_fcns(subdev_prefix+name, fcns, subdev_gain_priority); - } - //add all the codec gains last (antenna to dsp order) - BOOST_FOREACH(const std::string &name, codec[CODEC_PROP_GAIN_NAMES].as<prop_names_t>()){ - fcns.get_range = boost::bind(&get_codec_gain_range, codec, name); - - //register the value functions depending upon the connection type - switch(subdev[SUBDEV_PROP_CONNECTION].as<subdev_conn_t>()){ - case SUBDEV_CONN_COMPLEX_IQ: - case SUBDEV_CONN_COMPLEX_QI: - fcns.get_value = boost::bind(&get_codec_gain_i, codec, name); //same as Q - fcns.set_value = boost::bind(&set_codec_gain_both, codec, name, _1); //sets both - break; - - case SUBDEV_CONN_REAL_I: - fcns.get_value = boost::bind(&get_codec_gain_i, codec, name); - fcns.set_value = boost::bind(&set_codec_gain_i, codec, name, _1); - break; - - case SUBDEV_CONN_REAL_Q: - fcns.get_value = boost::bind(&get_codec_gain_q, codec, name); - fcns.set_value = boost::bind(&set_codec_gain_q, codec, name, _1); - break; - } - gg->register_fcns(codec_prefix+name, fcns, codec_gain_priority); - } - return gg; -} - -/*********************************************************************** - * verify subdev specs - **********************************************************************/ -static void verify_xx_subdev_spec( - mboard_prop_t dboard_names_prop, - mboard_prop_t dboard_prop, - subdev_spec_t &subdev_spec, - wax::obj mboard, - std::string xx_type -){ - try{ - prop_names_t dboard_names = mboard[dboard_names_prop].as<prop_names_t>(); - UHD_ASSERT_THROW(dboard_names.size() > 0); //well i hope there is a dboard - - //the subdevice specification is empty: handle automatic - if (subdev_spec.empty()){ - BOOST_FOREACH(const std::string &db_name, dboard_names){ - wax::obj dboard = mboard[named_prop_t(dboard_prop, db_name)]; - - //if the dboard slot is populated, take the first subdevice - if (dboard[DBOARD_PROP_DBOARD_EEPROM].as<dboard_eeprom_t>().id != dboard_id_t::none()){ - std::string sd_name = dboard[DBOARD_PROP_SUBDEV_NAMES].as<prop_names_t>().front(); - subdev_spec.push_back(subdev_spec_pair_t(db_name, sd_name)); - break; - } - } - - //didnt find any populated dboards: add the first subdevice - if (subdev_spec.empty()){ - std::string db_name = dboard_names.front(); - wax::obj dboard = mboard[named_prop_t(dboard_prop, db_name)]; - std::string sd_name = dboard[DBOARD_PROP_SUBDEV_NAMES].as<prop_names_t>().front(); - subdev_spec.push_back(subdev_spec_pair_t(db_name, sd_name)); - } - } - - //sanity check that the dboard/subdevice names exist for this mboard - BOOST_FOREACH(subdev_spec_pair_t &pair, subdev_spec){ - //empty db name means select dboard automatically - if (pair.db_name.empty()){ - if (dboard_names.size() != 1) throw uhd::value_error( - "A daughterboard name must be provided for multi-slot motherboards: " + subdev_spec.to_string() - ); - pair.db_name = dboard_names.front(); - } - uhd::assert_has(dboard_names, pair.db_name, xx_type + " dboard name"); - wax::obj dboard = mboard[named_prop_t(dboard_prop, pair.db_name)]; - prop_names_t subdev_names = dboard[DBOARD_PROP_SUBDEV_NAMES].as<prop_names_t>(); - - //empty sd name means select the subdev automatically - if (pair.sd_name.empty()){ - if (subdev_names.size() != 1) throw uhd::value_error( - "A subdevice name must be provided for multi-subdev daughterboards: " + subdev_spec.to_string() - ); - pair.sd_name = subdev_names.front(); - } - uhd::assert_has(subdev_names, pair.sd_name, xx_type + " subdev name"); - } - }catch(const std::exception &e){ - throw uhd::value_error(str(boost::format( - "Validate %s subdev spec failed: %s\n %s" - ) % xx_type % subdev_spec.to_string() % e.what())); - } - - //now use the subdev spec to enable the subdevices in use and vice-versa - BOOST_FOREACH(const std::string &db_name, mboard[dboard_names_prop].as<prop_names_t>()){ - wax::obj dboard = mboard[named_prop_t(dboard_prop, db_name)]; - BOOST_FOREACH(const std::string &sd_name, dboard[DBOARD_PROP_SUBDEV_NAMES].as<prop_names_t>()){ - try{ - bool enable = uhd::has(subdev_spec, subdev_spec_pair_t(db_name, sd_name)); - dboard[named_prop_t(DBOARD_PROP_SUBDEV, sd_name)][SUBDEV_PROP_ENABLED] = enable; - } - catch(const std::exception &e){ - throw uhd::runtime_error(str(boost::format( - "Cannot set enabled property on subdevice %s:%s\n %s" - ) % db_name % sd_name % e.what())); - } - } - } -} - -void usrp::verify_rx_subdev_spec(subdev_spec_t &subdev_spec, wax::obj mboard){ - return verify_xx_subdev_spec( - MBOARD_PROP_RX_DBOARD_NAMES, - MBOARD_PROP_RX_DBOARD, - subdev_spec, mboard, "rx" - ); -} - -void usrp::verify_tx_subdev_spec(subdev_spec_t &subdev_spec, wax::obj mboard){ - return verify_xx_subdev_spec( - MBOARD_PROP_TX_DBOARD_NAMES, - MBOARD_PROP_TX_DBOARD, - subdev_spec, mboard, "tx" - ); -} diff --git a/host/lib/usrp/multi_usrp.cpp b/host/lib/usrp/multi_usrp.cpp index e60a706ad..b62fc8b7f 100644 --- a/host/lib/usrp/multi_usrp.cpp +++ b/host/lib/usrp/multi_usrp.cpp @@ -17,7 +17,6 @@ #include <uhd/property_tree.hpp> #include <uhd/usrp/multi_usrp.hpp> -#include <uhd/usrp/tune_helper.hpp> #include <uhd/usrp/mboard_iface.hpp> #include <uhd/utils/msg.hpp> #include <uhd/exception.hpp> diff --git a/host/lib/usrp/tune_helper.cpp b/host/lib/usrp/tune_helper.cpp deleted file mode 100644 index 264e6c04b..000000000 --- a/host/lib/usrp/tune_helper.cpp +++ /dev/null @@ -1,147 +0,0 @@ -// -// Copyright 2010-2011 Ettus Research LLC -// -// This program 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 of the License, or -// (at your option) any later version. -// -// This program 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 program. If not, see <http://www.gnu.org/licenses/>. -// - -#include <uhd/usrp/tune_helper.hpp> -#include <uhd/usrp/subdev_props.hpp> -#include <uhd/usrp/dsp_props.hpp> -#include <uhd/usrp/dboard_iface.hpp> //unit_t -#include <uhd/utils/algorithm.hpp> -#include <cmath> - -using namespace uhd; -using namespace uhd::usrp; - -/*********************************************************************** - * Tune Helper Functions - **********************************************************************/ -static tune_result_t tune_xx_subdev_and_dsp( - dboard_iface::unit_t unit, - wax::obj subdev, wax::obj dsp, - const tune_request_t &tune_request -){ - wax::obj subdev_freq_proxy = subdev[SUBDEV_PROP_FREQ]; - wax::obj dsp_freq_proxy = dsp[DSP_PROP_FREQ_SHIFT]; - - //------------------------------------------------------------------ - //-- calculate the LO offset, only used with automatic policy - //------------------------------------------------------------------ - double lo_offset = 0.0; - if (subdev[SUBDEV_PROP_USE_LO_OFFSET].as<bool>()){ - //If the local oscillator will be in the passband, use an offset. - //But constrain the LO offset by the width of the filter bandwidth. - double rate = dsp[DSP_PROP_HOST_RATE].as<double>(); - double bw = subdev[SUBDEV_PROP_BANDWIDTH].as<double>(); - if (bw > rate) lo_offset = std::min((bw - rate)/2, rate/2); - } - - //------------------------------------------------------------------ - //-- set the RF frequency depending upon the policy - //------------------------------------------------------------------ - double target_rf_freq = 0.0; - switch (tune_request.rf_freq_policy){ - case tune_request_t::POLICY_AUTO: - target_rf_freq = tune_request.target_freq + lo_offset; - subdev_freq_proxy = target_rf_freq; - break; - - case tune_request_t::POLICY_MANUAL: - target_rf_freq = tune_request.rf_freq; - subdev_freq_proxy = target_rf_freq; - break; - - case tune_request_t::POLICY_NONE: break; //does not set - } - double actual_rf_freq = subdev_freq_proxy.as<double>(); - - //------------------------------------------------------------------ - //-- calculate the dsp freq, only used with automatic policy - //------------------------------------------------------------------ - double target_dsp_freq = actual_rf_freq - tune_request.target_freq; - - //invert the sign on the dsp freq given the following conditions - if (unit == dboard_iface::UNIT_TX) target_dsp_freq *= -1.0; - - //------------------------------------------------------------------ - //-- set the dsp frequency depending upon the dsp frequency policy - //------------------------------------------------------------------ - switch (tune_request.dsp_freq_policy){ - case tune_request_t::POLICY_AUTO: - dsp_freq_proxy = target_dsp_freq; - break; - - case tune_request_t::POLICY_MANUAL: - target_dsp_freq = tune_request.dsp_freq; - dsp_freq_proxy = target_dsp_freq; - break; - - case tune_request_t::POLICY_NONE: break; //does not set - } - double actual_dsp_freq = dsp_freq_proxy.as<double>(); - - //------------------------------------------------------------------ - //-- load and return the tune result - //------------------------------------------------------------------ - tune_result_t tune_result; - tune_result.target_rf_freq = target_rf_freq; - tune_result.actual_rf_freq = actual_rf_freq; - tune_result.target_dsp_freq = target_dsp_freq; - tune_result.actual_dsp_freq = actual_dsp_freq; - return tune_result; -} - -static double derive_freq_from_xx_subdev_and_dsp( - dboard_iface::unit_t unit, wax::obj subdev, wax::obj dsp -){ - //extract actual dsp and IF frequencies - double actual_rf_freq = subdev[SUBDEV_PROP_FREQ].as<double>(); - double actual_dsp_freq = dsp[DSP_PROP_FREQ_SHIFT].as<double>(); - - //invert the sign on the dsp freq given the following conditions - if (unit == dboard_iface::UNIT_TX) actual_dsp_freq *= -1.0; - - return actual_rf_freq - actual_dsp_freq; -} - -/*********************************************************************** - * RX Tune - **********************************************************************/ -tune_result_t usrp::tune_rx_subdev_and_dsp( - wax::obj subdev, wax::obj ddc, const tune_request_t &tune_request -){ - return tune_xx_subdev_and_dsp(dboard_iface::UNIT_RX, subdev, ddc, tune_request); -} - -double usrp::derive_freq_from_rx_subdev_and_dsp( - wax::obj subdev, wax::obj ddc -){ - return derive_freq_from_xx_subdev_and_dsp(dboard_iface::UNIT_RX, subdev, ddc); -} - -/*********************************************************************** - * TX Tune - **********************************************************************/ -tune_result_t usrp::tune_tx_subdev_and_dsp( - wax::obj subdev, wax::obj duc, const tune_request_t &tune_request -){ - return tune_xx_subdev_and_dsp(dboard_iface::UNIT_TX, subdev, duc, tune_request); -} - -double usrp::derive_freq_from_tx_subdev_and_dsp( - wax::obj subdev, wax::obj duc -){ - return derive_freq_from_xx_subdev_and_dsp(dboard_iface::UNIT_TX, subdev, duc); -} diff --git a/host/lib/usrp2/io_impl.cpp b/host/lib/usrp2/io_impl.cpp index a8ca0cd3a..64c099ff6 100644 --- a/host/lib/usrp2/io_impl.cpp +++ b/host/lib/usrp2/io_impl.cpp @@ -22,8 +22,6 @@ #include <uhd/utils/log.hpp> #include <uhd/utils/msg.hpp> #include <uhd/exception.hpp> -#include <uhd/usrp/mboard_props.hpp> -#include <uhd/usrp/dsp_props.hpp> #include <uhd/utils/byteswap.hpp> #include <uhd/utils/thread_priority.hpp> #include <uhd/transport/bounded_buffer.hpp> diff --git a/host/tests/CMakeLists.txt b/host/tests/CMakeLists.txt index 133763591..c97116233 100644 --- a/host/tests/CMakeLists.txt +++ b/host/tests/CMakeLists.txt @@ -33,7 +33,6 @@ SET(test_sources sph_send_test.cpp subdev_spec_test.cpp time_spec_test.cpp - tune_helper_test.cpp vrt_test.cpp wax_test.cpp ) diff --git a/host/tests/tune_helper_test.cpp b/host/tests/tune_helper_test.cpp deleted file mode 100644 index 9147cd310..000000000 --- a/host/tests/tune_helper_test.cpp +++ /dev/null @@ -1,251 +0,0 @@ -// -// Copyright 2010-2011 Ettus Research LLC -// -// This program 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 of the License, or -// (at your option) any later version. -// -// This program 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 program. If not, see <http://www.gnu.org/licenses/>. -// - -#include <boost/test/unit_test.hpp> -#include <uhd/usrp/tune_helper.hpp> -#include <uhd/usrp/subdev_props.hpp> -#include <uhd/usrp/dsp_props.hpp> -#include <uhd/usrp/dsp_utils.hpp> -#include <iostream> - -using namespace uhd; -using namespace uhd::usrp; - -/*********************************************************************** - * Dummy properties objects - **********************************************************************/ -class dummy_subdev : public wax::obj{ -public: - dummy_subdev(double resolution): - _resolution(resolution) - { - /* NOP */ - } -private: - void get(const wax::obj &key, wax::obj &val){ - switch(key.as<subdev_prop_t>()){ - - case SUBDEV_PROP_FREQ: - val = _freq; - return; - - case SUBDEV_PROP_USE_LO_OFFSET: - val = false; - return; - - default: UHD_THROW_PROP_GET_ERROR(); - } - } - - void set(const wax::obj &key, const wax::obj &val){ - switch(key.as<subdev_prop_t>()){ - case SUBDEV_PROP_FREQ: - _freq = _resolution*int(val.as<double>()/_resolution); - return; - - default: UHD_THROW_PROP_SET_ERROR(); - } - } - - double _freq, _resolution; -}; - -class dummy_subdev_basic : public wax::obj{ -private: - void get(const wax::obj &key, wax::obj &val){ - switch(key.as<subdev_prop_t>()){ - - case SUBDEV_PROP_FREQ: - val = double(0.0); //always zero - return; - - case SUBDEV_PROP_USE_LO_OFFSET: - val = false; - return; - - default: UHD_THROW_PROP_GET_ERROR(); - } - } - - void set(const wax::obj &key, const wax::obj &){ - switch(key.as<subdev_prop_t>()){ - case SUBDEV_PROP_FREQ: - // do nothing - return; - - default: UHD_THROW_PROP_SET_ERROR(); - } - } -}; - -class dummy_subdev_bw : public wax::obj{ -private: - void get(const wax::obj &key, wax::obj &val){ - switch(key.as<subdev_prop_t>()){ - - case SUBDEV_PROP_FREQ: - val = _freq; - return; - - case SUBDEV_PROP_USE_LO_OFFSET: - val = true; - return; - - case SUBDEV_PROP_BANDWIDTH: - val = _bandwidth; - return; - - default: UHD_THROW_PROP_GET_ERROR(); - } - } - - void set(const wax::obj &key, const wax::obj &val){ - switch(key.as<subdev_prop_t>()){ - case SUBDEV_PROP_FREQ: - _freq = val.as<double>(); - return; - - case SUBDEV_PROP_BANDWIDTH: - _bandwidth = val.as<double>(); - return; - - default: UHD_THROW_PROP_SET_ERROR(); - } - } - - double _freq, _bandwidth; -}; - -class dummy_dsp : public wax::obj{ -public: - dummy_dsp(double codec_rate): - _codec_rate(codec_rate) - { - /* NOP */ - } -private: - void get(const wax::obj &key_, wax::obj &val){ - named_prop_t key = named_prop_t::extract(key_); - switch(key.as<dsp_prop_t>()){ - case DSP_PROP_CODEC_RATE: - val = _codec_rate; - return; - - case DSP_PROP_HOST_RATE: - val = _host_rate; - return; - - case DSP_PROP_FREQ_SHIFT: - val = _freq_shift; - return; - - default: UHD_THROW_PROP_GET_ERROR(); - } - } - - void set(const wax::obj &key_, const wax::obj &val){ - named_prop_t key = named_prop_t::extract(key_); - switch(key.as<dsp_prop_t>()){ - case DSP_PROP_FREQ_SHIFT: - _freq_shift = val.as<double>(); - dsp_type1::calc_cordic_word_and_update(_freq_shift, _codec_rate); - return; - - case DSP_PROP_HOST_RATE: - _host_rate = val.as<double>(); - return; - - default: UHD_THROW_PROP_SET_ERROR(); - } - } - - double _codec_rate, _freq_shift, _host_rate; -}; - -/*********************************************************************** - * Test cases - **********************************************************************/ -static const double tolerance = 0.001; - -BOOST_AUTO_TEST_CASE(test_tune_helper_rx){ - dummy_subdev subdev(1e6); - dummy_dsp dsp(100e6); - - std::cout << "Testing tune helper RX automatic IF offset" << std::endl; - tune_result_t tr = tune_rx_subdev_and_dsp(subdev.get_link(), dsp.get_link(), 2.3451e9); - std::cout << tr.to_pp_string() << std::endl; - BOOST_CHECK_CLOSE(tr.actual_rf_freq, 2.345e9, tolerance); - BOOST_CHECK_CLOSE(tr.actual_dsp_freq, -100e3, tolerance); - - double freq_derived = derive_freq_from_rx_subdev_and_dsp(subdev.get_link(), dsp.get_link()); - BOOST_CHECK_CLOSE(freq_derived, 2.3451e9, tolerance); -} - -BOOST_AUTO_TEST_CASE(test_tune_helper_tx){ - dummy_subdev subdev(1e6); - dummy_dsp dsp(100e6); - - std::cout << "Testing tune helper TX automatic IF offset" << std::endl; - tune_result_t tr = tune_tx_subdev_and_dsp(subdev.get_link(), dsp.get_link(), 2.3451e9); - std::cout << tr.to_pp_string() << std::endl; - BOOST_CHECK_CLOSE(tr.actual_rf_freq, 2.345e9, tolerance); - BOOST_CHECK_CLOSE(tr.actual_dsp_freq, 100e3, tolerance); - - double freq_derived = derive_freq_from_tx_subdev_and_dsp(subdev.get_link(), dsp.get_link()); - BOOST_CHECK_CLOSE(freq_derived, 2.3451e9, tolerance); -} - -BOOST_AUTO_TEST_CASE(test_tune_helper_rx_nyquist){ - dummy_subdev_basic subdev; - dummy_dsp dsp(100e6); - - std::cout << "Testing tune helper RX dummy basic board" << std::endl; - tune_result_t tr = tune_rx_subdev_and_dsp(subdev.get_link(), dsp.get_link(), 55e6); - std::cout << tr.to_pp_string() << std::endl; - BOOST_CHECK_CLOSE(tr.actual_rf_freq, 0.0, tolerance); - BOOST_CHECK_CLOSE(tr.actual_dsp_freq, 45e6, tolerance); - - double freq_derived = derive_freq_from_rx_subdev_and_dsp(subdev.get_link(), dsp.get_link()); - BOOST_CHECK_CLOSE(freq_derived, -45e6, tolerance); -} - -BOOST_AUTO_TEST_CASE(test_tune_helper_rx_lo_off){ - dummy_subdev_bw subdev; - dummy_dsp dsp(100e6); - tune_result_t tr; - - std::cout << "Testing tune helper RX automatic LO offset B >> fs" << std::endl; - subdev[SUBDEV_PROP_BANDWIDTH] = double(40e6); - dsp[DSP_PROP_HOST_RATE] = double(4e6); - tr = tune_rx_subdev_and_dsp(subdev.get_link(), dsp.get_link(), 2.45e9); - std::cout << tr.to_pp_string() << std::endl; - BOOST_CHECK_CLOSE(tr.actual_rf_freq, 2.45e9+4e6/2, tolerance); - - std::cout << "Testing tune helper RX automatic LO offset B > fs" << std::endl; - subdev[SUBDEV_PROP_BANDWIDTH] = double(40e6); - dsp[DSP_PROP_HOST_RATE] = double(25e6); - tr = tune_rx_subdev_and_dsp(subdev.get_link(), dsp.get_link(), 2.45e9); - std::cout << tr.to_pp_string() << std::endl; - BOOST_CHECK_CLOSE(tr.actual_rf_freq, 2.45e9+(40e6-25e6)/2, tolerance); - - std::cout << "Testing tune helper RX automatic LO offset B < fs" << std::endl; - subdev[SUBDEV_PROP_BANDWIDTH] = double(20e6); - dsp[DSP_PROP_HOST_RATE] = double(25e6); - tr = tune_rx_subdev_and_dsp(subdev.get_link(), dsp.get_link(), 2.45e9); - std::cout << tr.to_pp_string() << std::endl; - BOOST_CHECK_CLOSE(tr.actual_rf_freq, 2.45e9, tolerance); -} |