From 54e8b566f6d1efecfd5fdc2c14bb287fd551089e Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Thu, 1 Apr 2010 16:01:46 -0700 Subject: Moved usrp specific things into usrp directories and namespaces. Renamed simple device to simple usrp (it was usrp specific). Moved tune helper to usrp dir for same reason. --- host/include/uhd/CMakeLists.txt | 1 - host/include/uhd/simple_device.hpp | 97 ---------------------------------- host/include/uhd/usrp/CMakeLists.txt | 5 ++ host/include/uhd/usrp/simple_usrp.hpp | 97 ++++++++++++++++++++++++++++++++++ host/include/uhd/usrp/tune_helper.hpp | 79 +++++++++++++++++++++++++++ host/include/uhd/utils/CMakeLists.txt | 1 - host/include/uhd/utils/props.hpp | 6 +-- host/include/uhd/utils/tune_helper.hpp | 79 --------------------------- 8 files changed, 184 insertions(+), 181 deletions(-) delete mode 100644 host/include/uhd/simple_device.hpp create mode 100644 host/include/uhd/usrp/simple_usrp.hpp create mode 100644 host/include/uhd/usrp/tune_helper.hpp delete mode 100644 host/include/uhd/utils/tune_helper.hpp (limited to 'host/include') diff --git a/host/include/uhd/CMakeLists.txt b/host/include/uhd/CMakeLists.txt index 1c5202caa..d63062032 100644 --- a/host/include/uhd/CMakeLists.txt +++ b/host/include/uhd/CMakeLists.txt @@ -24,7 +24,6 @@ ADD_SUBDIRECTORY(utils) INSTALL(FILES config.hpp device.hpp - simple_device.hpp wax.hpp DESTINATION ${INCLUDE_DIR}/uhd ) diff --git a/host/include/uhd/simple_device.hpp b/host/include/uhd/simple_device.hpp deleted file mode 100644 index 52928367a..000000000 --- a/host/include/uhd/simple_device.hpp +++ /dev/null @@ -1,97 +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 . -// - -#ifndef INCLUDED_UHD_SIMPLE_DEVICE_HPP -#define INCLUDED_UHD_SIMPLE_DEVICE_HPP - -#include -#include -#include -#include -#include -#include -#include -#include - -namespace uhd{ - -/*! - * The simple UHD device class: - * A simple device facilitates ease-of-use for most use-case scenarios. - * The wrapper provides convenience functions to tune the devices - * as well as to set the dboard gains, antennas, and other properties. - */ -class UHD_API simple_device : boost::noncopyable{ -public: - typedef boost::shared_ptr sptr; - static sptr make(const std::string &args); - - virtual device::sptr get_device(void) = 0; - - virtual std::string get_name(void) = 0; - - /******************************************************************* - * Timing - ******************************************************************/ - virtual void set_time_now(const time_spec_t &time_spec) = 0; - virtual void set_time_next_pps(const time_spec_t &time_spec) = 0; - - /******************************************************************* - * Streaming - ******************************************************************/ - virtual void issue_stream_cmd(const stream_cmd_t &stream_cmd) = 0; - - /******************************************************************* - * RX methods - ******************************************************************/ - virtual void set_rx_rate(double rate) = 0; - virtual double get_rx_rate(void) = 0; - virtual std::vector get_rx_rates(void) = 0; - - virtual tune_result_t set_rx_freq(double freq) = 0; - virtual freq_range_t get_rx_freq_range(void) = 0; - - virtual void set_rx_gain(float gain) = 0; - virtual float get_rx_gain(void) = 0; - virtual gain_range_t get_rx_gain_range(void) = 0; - - virtual void set_rx_antenna(const std::string &ant) = 0; - virtual std::string get_rx_antenna(void) = 0; - virtual std::vector get_rx_antennas(void) = 0; - - /******************************************************************* - * TX methods - ******************************************************************/ - virtual void set_tx_rate(double rate) = 0; - virtual double get_tx_rate(void) = 0; - virtual std::vector get_tx_rates(void) = 0; - - virtual tune_result_t set_tx_freq(double freq) = 0; - virtual freq_range_t get_tx_freq_range(void) = 0; - - virtual void set_tx_gain(float gain) = 0; - virtual float get_tx_gain(void) = 0; - virtual gain_range_t get_tx_gain_range(void) = 0; - - virtual void set_tx_antenna(const std::string &ant) = 0; - virtual std::string get_tx_antenna(void) = 0; - virtual std::vector get_tx_antennas(void) = 0; -}; - -} //namespace uhd - -#endif /* INCLUDED_UHD_SIMPLE_DEVICE_HPP */ diff --git a/host/include/uhd/usrp/CMakeLists.txt b/host/include/uhd/usrp/CMakeLists.txt index d0f385f13..7815a4fb9 100644 --- a/host/include/uhd/usrp/CMakeLists.txt +++ b/host/include/uhd/usrp/CMakeLists.txt @@ -33,5 +33,10 @@ INSTALL(FILES ### usrp headers ### usrp1e.hpp usrp2.hpp + + ### utilities ### + tune_helper.hpp + simple_usrp.hpp + DESTINATION ${INCLUDE_DIR}/uhd/usrp ) diff --git a/host/include/uhd/usrp/simple_usrp.hpp b/host/include/uhd/usrp/simple_usrp.hpp new file mode 100644 index 000000000..dea1cabda --- /dev/null +++ b/host/include/uhd/usrp/simple_usrp.hpp @@ -0,0 +1,97 @@ +// +// 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 . +// + +#ifndef INCLUDED_UHD_USRP_SIMPLE_USRP_HPP +#define INCLUDED_UHD_USRP_SIMPLE_USRP_HPP + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace uhd{ namespace usrp{ + +/*! + * The simple USRP device class: + * A simple usrp facilitates ease-of-use for most use-case scenarios. + * The wrapper provides convenience functions to tune the devices + * as well as to set the dboard gains, antennas, and other properties. + */ +class UHD_API simple_usrp : boost::noncopyable{ +public: + typedef boost::shared_ptr sptr; + static sptr make(const std::string &args); + + virtual device::sptr get_device(void) = 0; + + virtual std::string get_name(void) = 0; + + /******************************************************************* + * Timing + ******************************************************************/ + virtual void set_time_now(const time_spec_t &time_spec) = 0; + virtual void set_time_next_pps(const time_spec_t &time_spec) = 0; + + /******************************************************************* + * Streaming + ******************************************************************/ + virtual void issue_stream_cmd(const stream_cmd_t &stream_cmd) = 0; + + /******************************************************************* + * RX methods + ******************************************************************/ + virtual void set_rx_rate(double rate) = 0; + virtual double get_rx_rate(void) = 0; + virtual std::vector get_rx_rates(void) = 0; + + virtual tune_result_t set_rx_freq(double freq) = 0; + virtual freq_range_t get_rx_freq_range(void) = 0; + + virtual void set_rx_gain(float gain) = 0; + virtual float get_rx_gain(void) = 0; + virtual gain_range_t get_rx_gain_range(void) = 0; + + virtual void set_rx_antenna(const std::string &ant) = 0; + virtual std::string get_rx_antenna(void) = 0; + virtual std::vector get_rx_antennas(void) = 0; + + /******************************************************************* + * TX methods + ******************************************************************/ + virtual void set_tx_rate(double rate) = 0; + virtual double get_tx_rate(void) = 0; + virtual std::vector get_tx_rates(void) = 0; + + virtual tune_result_t set_tx_freq(double freq) = 0; + virtual freq_range_t get_tx_freq_range(void) = 0; + + virtual void set_tx_gain(float gain) = 0; + virtual float get_tx_gain(void) = 0; + virtual gain_range_t get_tx_gain_range(void) = 0; + + virtual void set_tx_antenna(const std::string &ant) = 0; + virtual std::string get_tx_antenna(void) = 0; + virtual std::vector get_tx_antennas(void) = 0; +}; + +}} + +#endif /* INCLUDED_UHD_USRP_SIMPLE_USRP_HPP */ diff --git a/host/include/uhd/usrp/tune_helper.hpp b/host/include/uhd/usrp/tune_helper.hpp new file mode 100644 index 000000000..f1e276d4f --- /dev/null +++ b/host/include/uhd/usrp/tune_helper.hpp @@ -0,0 +1,79 @@ +// +// 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 . +// + +#ifndef INCLUDED_UHD_USRP_TUNE_HELPER_HPP +#define INCLUDED_UHD_USRP_TUNE_HELPER_HPP + +#include +#include +#include + +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 ddc properties object (with "if_rate", "bb_rate", "freq") + * \param target_freq the desired center frequency + * \param lo_offset an offset for the subdevice IF from center + * \return a tune result struct + */ +UHD_API tune_result_t tune_rx_subdev_and_ddc( + wax::obj subdev, wax::obj ddc, + double target_freq, double lo_offset +); + +/*! + * Tune a rx chain to the desired frequency: + * Same as the above, except the LO offset + * is calculated based on the subdevice and BW. + */ +UHD_API tune_result_t tune_rx_subdev_and_ddc( + wax::obj subdev, wax::obj ddc, double target_freq +); + +/*! + * 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 duc properties object (with "if_rate", "bb_rate", "freq") + * \param target_freq the desired center frequency + * \param lo_offset an offset for the subdevice IF from center + * \return a tune result struct + */ +UHD_API tune_result_t tune_tx_subdev_and_duc( + wax::obj subdev, wax::obj duc, + double target_freq, double lo_offset +); + +/*! + * Tune a tx chain to the desired frequency: + * Same as the above, except the LO offset + * is calculated based on the subdevice and BW. + */ +UHD_API tune_result_t tune_tx_subdev_and_duc( + wax::obj subdev, wax::obj duc, double target_freq +); + +}} + +#endif /* INCLUDED_UHD_USRP_TUNE_HELPER_HPP */ diff --git a/host/include/uhd/utils/CMakeLists.txt b/host/include/uhd/utils/CMakeLists.txt index 2bb72e31d..2831ab0b0 100644 --- a/host/include/uhd/utils/CMakeLists.txt +++ b/host/include/uhd/utils/CMakeLists.txt @@ -22,6 +22,5 @@ INSTALL(FILES props.hpp safe_main.hpp static.hpp - tune_helper.hpp DESTINATION ${INCLUDE_DIR}/uhd/utils ) diff --git a/host/include/uhd/utils/props.hpp b/host/include/uhd/utils/props.hpp index fdbc17d1c..6be0b2ce5 100644 --- a/host/include/uhd/utils/props.hpp +++ b/host/include/uhd/utils/props.hpp @@ -15,8 +15,8 @@ // along with this program. If not, see . // -#ifndef INCLUDED_UHD_USRP_PROPS_COMMON_HPP -#define INCLUDED_UHD_USRP_PROPS_COMMON_HPP +#ifndef INCLUDED_UHD_UTILS_PROPS_HPP +#define INCLUDED_UHD_UTILS_PROPS_HPP #include #include @@ -45,4 +45,4 @@ namespace uhd{ } //namespace uhd -#endif /* INCLUDED_UHD_USRP_PROPS_COMMON_HPP */ +#endif /* INCLUDED_UHD_UTILS_PROPS_HPP */ diff --git a/host/include/uhd/utils/tune_helper.hpp b/host/include/uhd/utils/tune_helper.hpp deleted file mode 100644 index 958d1eceb..000000000 --- a/host/include/uhd/utils/tune_helper.hpp +++ /dev/null @@ -1,79 +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 . -// - -#ifndef INCLUDED_UHD_UTILS_TUNE_HELPER_HPP -#define INCLUDED_UHD_UTILS_TUNE_HELPER_HPP - -#include -#include -#include - -namespace uhd{ - -/*! - * 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 ddc properties object (with "if_rate", "bb_rate", "freq") - * \param target_freq the desired center frequency - * \param lo_offset an offset for the subdevice IF from center - * \return a tune result struct - */ -UHD_API tune_result_t tune_rx_subdev_and_ddc( - wax::obj subdev, wax::obj ddc, - double target_freq, double lo_offset -); - -/*! - * Tune a rx chain to the desired frequency: - * Same as the above, except the LO offset - * is calculated based on the subdevice and BW. - */ -UHD_API tune_result_t tune_rx_subdev_and_ddc( - wax::obj subdev, wax::obj ddc, double target_freq -); - -/*! - * 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 duc properties object (with "if_rate", "bb_rate", "freq") - * \param target_freq the desired center frequency - * \param lo_offset an offset for the subdevice IF from center - * \return a tune result struct - */ -UHD_API tune_result_t tune_tx_subdev_and_duc( - wax::obj subdev, wax::obj duc, - double target_freq, double lo_offset -); - -/*! - * Tune a tx chain to the desired frequency: - * Same as the above, except the LO offset - * is calculated based on the subdevice and BW. - */ -UHD_API tune_result_t tune_tx_subdev_and_duc( - wax::obj subdev, wax::obj duc, double target_freq -); - -} //namespace uhd - -#endif /* INCLUDED_UHD_UTILS_TUNE_HELPER_HPP */ -- cgit v1.2.3