aboutsummaryrefslogtreecommitdiffstats
path: root/host/include
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2010-08-15 21:34:16 -0700
committerJosh Blum <josh@joshknows.com>2010-08-15 21:34:16 -0700
commit58519b292b561cbec5eb41c85f85c8c6bd4a06fe (patch)
tree23b2bf3e639640364cc29ff5105977c3a4d2cd17 /host/include
parent7b084e3af206afa20ff5a026ebf5d7e49a755def (diff)
downloaduhd-58519b292b561cbec5eb41c85f85c8c6bd4a06fe.tar.gz
uhd-58519b292b561cbec5eb41c85f85c8c6bd4a06fe.tar.bz2
uhd-58519b292b561cbec5eb41c85f85c8c6bd4a06fe.zip
usrp: moved usrp utils into public include space
Diffstat (limited to 'host/include')
-rw-r--r--host/include/uhd/usrp/CMakeLists.txt2
-rw-r--r--host/include/uhd/usrp/dsp_utils.hpp99
-rw-r--r--host/include/uhd/usrp/misc_utils.hpp54
3 files changed, 155 insertions, 0 deletions
diff --git a/host/include/uhd/usrp/CMakeLists.txt b/host/include/uhd/usrp/CMakeLists.txt
index 76ee24e5f..130956f8a 100644
--- a/host/include/uhd/usrp/CMakeLists.txt
+++ b/host/include/uhd/usrp/CMakeLists.txt
@@ -33,6 +33,8 @@ INSTALL(FILES
dboard_manager.hpp
### utilities ###
+ dsp_utils.hpp
+ misc_utils.hpp
subdev_spec.hpp
tune_helper.hpp
diff --git a/host/include/uhd/usrp/dsp_utils.hpp b/host/include/uhd/usrp/dsp_utils.hpp
new file mode 100644
index 000000000..8ec04dd2f
--- /dev/null
+++ b/host/include/uhd/usrp/dsp_utils.hpp
@@ -0,0 +1,99 @@
+//
+// 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
+ * \param num_samps_continuous number of samples to request in continuous mode
+ * \return the 32-bit stream command word
+ */
+ UHD_API boost::uint32_t calc_stream_cmd_word(
+ const stream_cmd_t &stream_cmd, size_t num_samps_continuous
+ );
+
+} //namespace dsp_type1
+
+}} //namespace
+
+#endif /* INCLUDED_UHD_USRP_DSP_UTILS_HPP */
diff --git a/host/include/uhd/usrp/misc_utils.hpp b/host/include/uhd/usrp/misc_utils.hpp
new file mode 100644
index 000000000..14db80162
--- /dev/null
+++ b/host/include/uhd/usrp/misc_utils.hpp
@@ -0,0 +1,54 @@
+//
+// 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/subdev_spec.hpp>
+#include <uhd/utils/gain_group.hpp>
+
+namespace uhd{ namespace usrp{
+
+ /*!
+ * Create a gain group that represents the subdevice and its codec.
+ */
+ UHD_API gain_group::sptr make_gain_group(wax::obj subdev, wax::obj codec);
+
+ /*!
+ * 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 */
+