summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2010-03-27 14:27:55 -0700
committerJosh Blum <josh@joshknows.com>2010-03-27 14:27:55 -0700
commitb71d0cbea9e1e107eeb1da51ef14fe6b9e983ee6 (patch)
treef0b8e41990c2600cac35467b3dcfbfed097d86cc
parent52df9afd679fd0f42edeef29f0bbc0d7bd76559e (diff)
downloaduhd-b71d0cbea9e1e107eeb1da51ef14fe6b9e983ee6.tar.gz
uhd-b71d0cbea9e1e107eeb1da51ef14fe6b9e983ee6.tar.bz2
uhd-b71d0cbea9e1e107eeb1da51ef14fe6b9e983ee6.zip
refactored types.hpp into types directory
-rw-r--r--host/include/uhd/CMakeLists.txt6
-rw-r--r--host/include/uhd/device.hpp4
-rw-r--r--host/include/uhd/metadata.hpp61
-rw-r--r--host/include/uhd/simple_device.hpp4
-rw-r--r--host/include/uhd/transport/vrt.hpp2
-rw-r--r--host/include/uhd/types.hpp119
-rw-r--r--host/include/uhd/types/CMakeLists.txt30
-rw-r--r--host/include/uhd/types/clock_config.hpp50
-rw-r--r--host/include/uhd/types/device_addr.hpp (renamed from host/include/uhd/device_addr.hpp)44
-rw-r--r--host/include/uhd/types/dict.hpp (renamed from host/include/uhd/dict.hpp)6
-rw-r--r--host/include/uhd/types/mac_addr.hpp (renamed from host/lib/metadata.cpp)36
-rw-r--r--host/include/uhd/types/metadata.hpp61
-rw-r--r--host/include/uhd/types/ranges.hpp46
-rw-r--r--host/include/uhd/types/stream_cmd.hpp56
-rw-r--r--host/include/uhd/types/time_spec.hpp (renamed from host/include/uhd/time_spec.hpp)6
-rw-r--r--host/include/uhd/types/tune_result.hpp44
-rw-r--r--host/lib/CMakeLists.txt3
-rw-r--r--host/lib/device.cpp6
-rw-r--r--host/lib/device_addr.cpp86
-rw-r--r--host/lib/gain_handler.cpp24
-rw-r--r--host/lib/simple_device.cpp5
-rw-r--r--host/lib/time_spec.cpp35
-rw-r--r--host/lib/types.cpp113
-rw-r--r--host/lib/usrp/dboard/basic.cpp26
-rw-r--r--host/lib/usrp/dboard_manager.cpp2
-rw-r--r--host/lib/usrp/usrp2/dboard_impl.cpp1
-rw-r--r--host/lib/usrp/usrp2/dsp_impl.cpp6
-rw-r--r--host/lib/usrp/usrp2/mboard_impl.cpp3
-rw-r--r--host/lib/usrp/usrp2/usrp2_impl.hpp10
-rw-r--r--host/test/addr_test.cpp5
-rw-r--r--host/test/gain_handler_test.cpp22
-rw-r--r--host/utils/discover_usrps.cpp2
32 files changed, 494 insertions, 430 deletions
diff --git a/host/include/uhd/CMakeLists.txt b/host/include/uhd/CMakeLists.txt
index 2203ea83e..0cebea095 100644
--- a/host/include/uhd/CMakeLists.txt
+++ b/host/include/uhd/CMakeLists.txt
@@ -17,20 +17,16 @@
ADD_SUBDIRECTORY(transport)
+ADD_SUBDIRECTORY(types)
ADD_SUBDIRECTORY(usrp)
ADD_SUBDIRECTORY(utils)
INSTALL(FILES
config.hpp
device.hpp
- device_addr.hpp
- dict.hpp
gain_handler.hpp
- metadata.hpp
props.hpp
simple_device.hpp
- time_spec.hpp
- types.hpp
wax.hpp
DESTINATION ${INCLUDE_DIR}/uhd
)
diff --git a/host/include/uhd/device.hpp b/host/include/uhd/device.hpp
index 13b40febe..bab8afca6 100644
--- a/host/include/uhd/device.hpp
+++ b/host/include/uhd/device.hpp
@@ -19,9 +19,9 @@
#define INCLUDED_UHD_DEVICE_HPP
#include <uhd/config.hpp>
-#include <uhd/device_addr.hpp>
+#include <uhd/types/device_addr.hpp>
+#include <uhd/types/metadata.hpp>
#include <uhd/props.hpp>
-#include <uhd/metadata.hpp>
#include <uhd/wax.hpp>
#include <boost/utility.hpp>
#include <boost/shared_ptr.hpp>
diff --git a/host/include/uhd/metadata.hpp b/host/include/uhd/metadata.hpp
deleted file mode 100644
index 6d80f070d..000000000
--- a/host/include/uhd/metadata.hpp
+++ /dev/null
@@ -1,61 +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_METADATA_HPP
-#define INCLUDED_UHD_METADATA_HPP
-
-#include <uhd/config.hpp>
-#include <uhd/time_spec.hpp>
-
-namespace uhd{
-
-/*!
- * RX metadata structure for describing sent IF data.
- * Includes stream ID, time specification, and fragmentation flags.
- * The receive routines will convert IF data headers into metadata.
- */
-struct UHD_API rx_metadata_t{
- boost::uint32_t stream_id;
- time_spec_t time_spec;
- bool has_stream_id;
- bool has_time_spec;
- bool is_fragment;
-
- //default constructor
- rx_metadata_t(void);
-};
-
-/*!
- * TX metadata structure for describing received IF data.
- * Includes stream ID, time specification, and burst flags.
- * The send routines will convert the metadata to IF data headers.
- */
-struct UHD_API tx_metadata_t{
- boost::uint32_t stream_id;
- time_spec_t time_spec;
- bool has_stream_id;
- bool has_time_spec;
- bool start_of_burst;
- bool end_of_burst;
-
- //default constructor
- tx_metadata_t(void);
-};
-
-} //namespace uhd
-
-#endif /* INCLUDED_UHD_METADATA_HPP */
diff --git a/host/include/uhd/simple_device.hpp b/host/include/uhd/simple_device.hpp
index bbe0258c7..52928367a 100644
--- a/host/include/uhd/simple_device.hpp
+++ b/host/include/uhd/simple_device.hpp
@@ -20,7 +20,9 @@
#include <uhd/config.hpp>
#include <uhd/device.hpp>
-#include <uhd/types.hpp>
+#include <uhd/types/ranges.hpp>
+#include <uhd/types/stream_cmd.hpp>
+#include <uhd/types/tune_result.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/utility.hpp>
#include <vector>
diff --git a/host/include/uhd/transport/vrt.hpp b/host/include/uhd/transport/vrt.hpp
index db2c57eba..04945b347 100644
--- a/host/include/uhd/transport/vrt.hpp
+++ b/host/include/uhd/transport/vrt.hpp
@@ -19,7 +19,7 @@
#define INCLUDED_UHD_TRANSPORT_VRT_HPP
#include <uhd/config.hpp>
-#include <uhd/metadata.hpp>
+#include <uhd/types/metadata.hpp>
#include <cstddef>
namespace uhd{ namespace transport{
diff --git a/host/include/uhd/types.hpp b/host/include/uhd/types.hpp
deleted file mode 100644
index 3ad3dae82..000000000
--- a/host/include/uhd/types.hpp
+++ /dev/null
@@ -1,119 +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_TYPES_HPP
-#define INCLUDED_UHD_TYPES_HPP
-
-#include <uhd/config.hpp>
-#include <uhd/time_spec.hpp>
-#include <string>
-
-namespace uhd{
-
- typedef float gain_t; //TODO REMOVE
- typedef double freq_t; //TODO REMOVE
-
- /*!
- * The gain range struct describes possible gain settings.
- * The mimumum gain, maximum gain, and step size are in dB.
- */
- struct UHD_API gain_range_t{
- float min, max, step;
- gain_range_t(float min = 0.0, float max = 0.0, float step = 0.0);
- };
-
- /*!
- * The frequency range struct describes possible frequency settings.
- * Because tuning is very granular (sub-Hz), step size is not listed.
- * The mimumum frequency and maximum frequency are in Hz.
- */
- struct UHD_API freq_range_t{
- double min, max;
- freq_range_t(double min = 0.0, double max = 0.0);
- };
-
- /*!
- * The tune result struct holds result of a 2-phase tuning:
- * The struct hold the result of tuning the dboard as
- * the target and actual intermediate frequency.
- * The struct hold the result of tuning the DDC/DUC as
- * the target and actual digital converter frequency.
- * It also tell us weather or not the spectrum is inverted.
- */
- struct UHD_API tune_result_t{
- double target_inter_freq;
- double actual_inter_freq;
- double target_dxc_freq;
- double actual_dxc_freq;
- bool spectrum_inverted;
- tune_result_t(void);
- };
-
- /*!
- * Clock configuration settings:
- * The source for the 10MHz reference clock.
- * The source and polarity for the PPS clock.
- */
- struct UHD_API clock_config_t{
- enum ref_source_t {
- REF_INT, //internal reference
- REF_SMA, //external sma port
- REF_MIMO //mimo cable (usrp2 only)
- } ref_source;
- enum pps_source_t {
- PPS_INT, //there is no internal
- PPS_SMA, //external sma port
- PPS_MIMO //mimo cable (usrp2 only)
- } pps_source;
- enum pps_polarity_t {
- PPS_NEG, //negative edge
- PPS_POS //positive edge
- } pps_polarity;
- clock_config_t(void);
- };
-
- /*!
- * Command struct for configuration and control of streaming:
- *
- * A stream command defines how the device sends samples to the host.
- * Streaming is controlled by submitting a stream command to the rx dsp.
- * Granular control over what the device streams to the host can be
- * achieved through submission of multiple (carefully-crafted) commands.
- *
- * The stream_now parameter controls when the stream begins.
- * When true, the device will begin streaming ASAP. When false,
- * the device will begin streaming at a time specified by time_spec.
- *
- * The continuous parameter controls the number of samples received.
- * When true, the device continues streaming indefinitely. When false,
- * the device will stream the number of samples specified by num_samps.
- *
- * Standard usage case:
- * To start continuous streaming, set stream_now to true and continuous to true.
- * To end continuous streaming, set stream_now to true and continuous to false.
- */
- struct UHD_API stream_cmd_t{
- bool stream_now;
- time_spec_t time_spec;
- bool continuous;
- size_t num_samps;
- stream_cmd_t(void);
- };
-
-} //namespace uhd
-
-#endif /* INCLUDED_UHD_TYPES_HPP */
diff --git a/host/include/uhd/types/CMakeLists.txt b/host/include/uhd/types/CMakeLists.txt
new file mode 100644
index 000000000..10262dd65
--- /dev/null
+++ b/host/include/uhd/types/CMakeLists.txt
@@ -0,0 +1,30 @@
+#
+# 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/>.
+#
+
+
+INSTALL(FILES
+ clock_config.hpp
+ device_addr.hpp
+ dict.hpp
+ mac_addr.hpp
+ metadata.hpp
+ ranges.hpp
+ stream_cmd.hpp
+ time_spec.hpp
+ tune_result.hpp
+ DESTINATION ${INCLUDE_DIR}/uhd/types
+)
diff --git a/host/include/uhd/types/clock_config.hpp b/host/include/uhd/types/clock_config.hpp
new file mode 100644
index 000000000..8b2fea016
--- /dev/null
+++ b/host/include/uhd/types/clock_config.hpp
@@ -0,0 +1,50 @@
+//
+// 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_TYPES_CLOCK_CONFIG_HPP
+#define INCLUDED_UHD_TYPES_CLOCK_CONFIG_HPP
+
+#include <uhd/config.hpp>
+
+namespace uhd{
+
+ /*!
+ * Clock configuration settings:
+ * The source for the 10MHz reference clock.
+ * The source and polarity for the PPS clock.
+ */
+ struct UHD_API clock_config_t{
+ enum ref_source_t {
+ REF_INT, //internal reference
+ REF_SMA, //external sma port
+ REF_MIMO //mimo cable (usrp2 only)
+ } ref_source;
+ enum pps_source_t {
+ PPS_INT, //there is no internal
+ PPS_SMA, //external sma port
+ PPS_MIMO //mimo cable (usrp2 only)
+ } pps_source;
+ enum pps_polarity_t {
+ PPS_NEG, //negative edge
+ PPS_POS //positive edge
+ } pps_polarity;
+ clock_config_t(void);
+ };
+
+} //namespace uhd
+
+#endif /* INCLUDED_UHD_TYPES_CLOCK_CONFIG_HPP */
diff --git a/host/include/uhd/device_addr.hpp b/host/include/uhd/types/device_addr.hpp
index 7673faff0..d32dfa77e 100644
--- a/host/include/uhd/device_addr.hpp
+++ b/host/include/uhd/types/device_addr.hpp
@@ -15,29 +15,17 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
-#ifndef INCLUDED_UHD_DEVICE_ADDR_HPP
-#define INCLUDED_UHD_DEVICE_ADDR_HPP
+#ifndef INCLUDED_UHD_TYPES_DEVICE_ADDR_HPP
+#define INCLUDED_UHD_TYPES_DEVICE_ADDR_HPP
#include <uhd/config.hpp>
-#include <uhd/dict.hpp>
-#include <boost/cstdint.hpp>
-#include <string>
-#include <iostream>
+#include <uhd/types/dict.hpp>
#include <vector>
+#include <string>
namespace uhd{
/*!
- * Wrapper for an ethernet mac address.
- * Provides conversion between string and binary formats.
- */
- struct UHD_API mac_addr_t{
- boost::uint8_t mac_addr[6];
- mac_addr_t(const std::string &mac_addr_str = "00:00:00:00:00:00");
- std::string to_string(void) const;
- };
-
- /*!
* The device address args are just a mapping of key/value string pairs.
* When left empty, the discovery routine will try to find all usrps.
* The discovery can be narrowed down by specifying the transport type arguments.
@@ -45,25 +33,13 @@ namespace uhd{
* For example, to access a specific usrp2 one would specify the transport type
* ("type", "udp") and the transport args ("addr", "<resolvable_hostname_or_addr>").
*/
- typedef dict<std::string, std::string> device_addr_t;
- typedef std::vector<device_addr_t> device_addrs_t;
+ class UHD_API device_addr_t : public dict<std::string, std::string>{
+ public: std::string to_string(void) const;
+ };
- /*!
- * Function to turn a device address into a string.
- * Just having the operator<< below should be sufficient.
- * However, boost format seems to complain with the %
- * and this is just easier because it works.
- * \param device_addr a device address instance
- * \return the string representation
- */
- namespace device_addr{
- UHD_API std::string to_string(const device_addr_t &device_addr);
- }
+ //handy typedef for a vector of device addresses
+ typedef std::vector<device_addr_t> device_addrs_t;
} //namespace uhd
-//ability to use types with stream operators
-UHD_API std::ostream& operator<<(std::ostream &, const uhd::device_addr_t &);
-UHD_API std::ostream& operator<<(std::ostream &, const uhd::mac_addr_t &);
-
-#endif /* INCLUDED_UHD_DEVICE_ADDR_HPP */
+#endif /* INCLUDED_UHD_TYPES_DEVICE_ADDR_HPP */
diff --git a/host/include/uhd/dict.hpp b/host/include/uhd/types/dict.hpp
index f08493952..5b9883704 100644
--- a/host/include/uhd/dict.hpp
+++ b/host/include/uhd/types/dict.hpp
@@ -15,8 +15,8 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
-#ifndef INCLUDED_UHD_DICT_HPP
-#define INCLUDED_UHD_DICT_HPP
+#ifndef INCLUDED_UHD_TYPES_DICT_HPP
+#define INCLUDED_UHD_TYPES_DICT_HPP
#include <list>
#include <vector>
@@ -151,4 +151,4 @@ namespace uhd{
} //namespace uhd
-#endif /* INCLUDED_UHD_DICT_HPP */
+#endif /* INCLUDED_UHD_TYPES_DICT_HPP */
diff --git a/host/lib/metadata.cpp b/host/include/uhd/types/mac_addr.hpp
index 40fdb7c73..2cac7d343 100644
--- a/host/lib/metadata.cpp
+++ b/host/include/uhd/types/mac_addr.hpp
@@ -15,23 +15,25 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
-#include <uhd/metadata.hpp>
+#ifndef INCLUDED_UHD_TYPES_MAC_ADDR_HPP
+#define INCLUDED_UHD_TYPES_MAC_ADDR_HPP
-using namespace uhd;
+#include <uhd/config.hpp>
+#include <boost/cstdint.hpp>
+#include <string>
-rx_metadata_t::rx_metadata_t(void){
- stream_id = 0;
- has_stream_id = false;
- time_spec = time_spec_t();
- has_time_spec = false;
- is_fragment = false;
-}
+namespace uhd{
-tx_metadata_t::tx_metadata_t(void){
- stream_id = 0;
- has_stream_id = false;
- time_spec = time_spec_t();
- has_time_spec = false;
- start_of_burst = false;
- end_of_burst = false;
-}
+ /*!
+ * Wrapper for an ethernet mac address.
+ * Provides conversion between string and binary formats.
+ */
+ struct UHD_API mac_addr_t{
+ boost::uint8_t mac_addr[6];
+ mac_addr_t(const std::string &mac_addr_str = "00:00:00:00:00:00");
+ std::string to_string(void) const;
+ };
+
+} //namespace uhd
+
+#endif /* INCLUDED_UHD_TYPES_MAC_ADDR_HPP */
diff --git a/host/include/uhd/types/metadata.hpp b/host/include/uhd/types/metadata.hpp
new file mode 100644
index 000000000..6e93040d9
--- /dev/null
+++ b/host/include/uhd/types/metadata.hpp
@@ -0,0 +1,61 @@
+//
+// 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_TYPES_METADATA_HPP
+#define INCLUDED_UHD_TYPES_METADATA_HPP
+
+#include <uhd/config.hpp>
+#include <uhd/types/time_spec.hpp>
+
+namespace uhd{
+
+ /*!
+ * RX metadata structure for describing sent IF data.
+ * Includes stream ID, time specification, and fragmentation flags.
+ * The receive routines will convert IF data headers into metadata.
+ */
+ struct UHD_API rx_metadata_t{
+ boost::uint32_t stream_id;
+ time_spec_t time_spec;
+ bool has_stream_id;
+ bool has_time_spec;
+ bool is_fragment;
+
+ //default constructor
+ rx_metadata_t(void);
+ };
+
+ /*!
+ * TX metadata structure for describing received IF data.
+ * Includes stream ID, time specification, and burst flags.
+ * The send routines will convert the metadata to IF data headers.
+ */
+ struct UHD_API tx_metadata_t{
+ boost::uint32_t stream_id;
+ time_spec_t time_spec;
+ bool has_stream_id;
+ bool has_time_spec;
+ bool start_of_burst;
+ bool end_of_burst;
+
+ //default constructor
+ tx_metadata_t(void);
+ };
+
+} //namespace uhd
+
+#endif /* INCLUDED_UHD_TYPES_METADATA_HPP */
diff --git a/host/include/uhd/types/ranges.hpp b/host/include/uhd/types/ranges.hpp
new file mode 100644
index 000000000..a2057d1c8
--- /dev/null
+++ b/host/include/uhd/types/ranges.hpp
@@ -0,0 +1,46 @@
+//
+// 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_TYPES_RANGES_HPP
+#define INCLUDED_UHD_TYPES_RANGES_HPP
+
+#include <uhd/config.hpp>
+
+namespace uhd{
+
+ /*!
+ * The gain range struct describes possible gain settings.
+ * The mimumum gain, maximum gain, and step size are in dB.
+ */
+ struct UHD_API gain_range_t{
+ float min, max, step;
+ gain_range_t(float min = 0.0, float max = 0.0, float step = 0.0);
+ };
+
+ /*!
+ * The frequency range struct describes possible frequency settings.
+ * Because tuning is very granular (sub-Hz), step size is not listed.
+ * The mimumum frequency and maximum frequency are in Hz.
+ */
+ struct UHD_API freq_range_t{
+ double min, max;
+ freq_range_t(double min = 0.0, double max = 0.0);
+ };
+
+} //namespace uhd
+
+#endif /* INCLUDED_UHD_TYPES_RANGES_HPP */
diff --git a/host/include/uhd/types/stream_cmd.hpp b/host/include/uhd/types/stream_cmd.hpp
new file mode 100644
index 000000000..97a6b73ce
--- /dev/null
+++ b/host/include/uhd/types/stream_cmd.hpp
@@ -0,0 +1,56 @@
+//
+// 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_TYPES_STREAM_CMD_HPP
+#define INCLUDED_UHD_TYPES_STREAM_CMD_HPP
+
+#include <uhd/config.hpp>
+#include <uhd/types/time_spec.hpp>
+
+namespace uhd{
+
+ /*!
+ * Command struct for configuration and control of streaming:
+ *
+ * A stream command defines how the device sends samples to the host.
+ * Streaming is controlled by submitting a stream command to the rx dsp.
+ * Granular control over what the device streams to the host can be
+ * achieved through submission of multiple (carefully-crafted) commands.
+ *
+ * The stream_now parameter controls when the stream begins.
+ * When true, the device will begin streaming ASAP. When false,
+ * the device will begin streaming at a time specified by time_spec.
+ *
+ * The continuous parameter controls the number of samples received.
+ * When true, the device continues streaming indefinitely. When false,
+ * the device will stream the number of samples specified by num_samps.
+ *
+ * Standard usage case:
+ * To start continuous streaming, set stream_now to true and continuous to true.
+ * To end continuous streaming, set stream_now to true and continuous to false.
+ */
+ struct UHD_API stream_cmd_t{
+ bool stream_now;
+ time_spec_t time_spec;
+ bool continuous;
+ size_t num_samps;
+ stream_cmd_t(void);
+ };
+
+} //namespace uhd
+
+#endif /* INCLUDED_UHD_TYPES_STREAM_CMD_HPP */
diff --git a/host/include/uhd/time_spec.hpp b/host/include/uhd/types/time_spec.hpp
index e863746ba..8c8f2bc25 100644
--- a/host/include/uhd/time_spec.hpp
+++ b/host/include/uhd/types/time_spec.hpp
@@ -15,8 +15,8 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
-#ifndef INCLUDED_UHD_TIME_SPEC_HPP
-#define INCLUDED_UHD_TIME_SPEC_HPP
+#ifndef INCLUDED_UHD_TYPES_TIME_SPEC_HPP
+#define INCLUDED_UHD_TYPES_TIME_SPEC_HPP
#include <uhd/config.hpp>
#include <boost/cstdint.hpp>
@@ -52,4 +52,4 @@ namespace uhd{
} //namespace uhd
-#endif /* INCLUDED_UHD_TIME_SPEC_HPP */
+#endif /* INCLUDED_UHD_TYPES_TIME_SPEC_HPP */
diff --git a/host/include/uhd/types/tune_result.hpp b/host/include/uhd/types/tune_result.hpp
new file mode 100644
index 000000000..31742e1af
--- /dev/null
+++ b/host/include/uhd/types/tune_result.hpp
@@ -0,0 +1,44 @@
+//
+// 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_TYPES_TUNE_RESULT_HPP
+#define INCLUDED_UHD_TYPES_TUNE_RESULT_HPP
+
+#include <uhd/config.hpp>
+
+namespace uhd{
+
+ /*!
+ * The tune result struct holds result of a 2-phase tuning:
+ * The struct hold the result of tuning the dboard as
+ * the target and actual intermediate frequency.
+ * The struct hold the result of tuning the DDC/DUC as
+ * the target and actual digital converter frequency.
+ * It also tell us weather or not the spectrum is inverted.
+ */
+ struct UHD_API tune_result_t{
+ double target_inter_freq;
+ double actual_inter_freq;
+ double target_dxc_freq;
+ double actual_dxc_freq;
+ bool spectrum_inverted;
+ tune_result_t(void);
+ };
+
+} //namespace uhd
+
+#endif /* INCLUDED_UHD_TYPES_TUNE_RESULT_HPP */
diff --git a/host/lib/CMakeLists.txt b/host/lib/CMakeLists.txt
index 170d1d3bf..1eceb53ea 100644
--- a/host/lib/CMakeLists.txt
+++ b/host/lib/CMakeLists.txt
@@ -20,12 +20,9 @@
########################################################################
SET(libuhd_sources
device.cpp
- device_addr.cpp
gain_handler.cpp
load_modules.cpp
- metadata.cpp
simple_device.cpp
- time_spec.cpp
types.cpp
wax.cpp
transport/if_addrs.cpp
diff --git a/host/lib/device.cpp b/host/lib/device.cpp
index 0bdbf5f23..833e7a0da 100644
--- a/host/lib/device.cpp
+++ b/host/lib/device.cpp
@@ -16,7 +16,7 @@
//
#include <uhd/device.hpp>
-#include <uhd/dict.hpp>
+#include <uhd/types/dict.hpp>
#include <uhd/utils/assert.hpp>
#include <uhd/utils/static.hpp>
#include <boost/foreach.hpp>
@@ -110,14 +110,14 @@ device::sptr device::make(const device_addr_t &hint, size_t which){
//check that we found any devices
if (dev_addr_makers.size() == 0){
throw std::runtime_error(str(
- boost::format("No devices found for ----->\n%s") % device_addr::to_string(hint)
+ boost::format("No devices found for ----->\n%s") % hint.to_string()
));
}
//check that the which index is valid
if (dev_addr_makers.size() <= which){
throw std::runtime_error(str(
- boost::format("No device at index %d for ----->\n%s") % which % device_addr::to_string(hint)
+ boost::format("No device at index %d for ----->\n%s") % which % hint.to_string()
));
}
diff --git a/host/lib/device_addr.cpp b/host/lib/device_addr.cpp
deleted file mode 100644
index d26bb4b9d..000000000
--- a/host/lib/device_addr.cpp
+++ /dev/null
@@ -1,86 +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/>.
-//
-
-#include <uhd/device_addr.hpp>
-#include <sstream>
-#include <cstring>
-#include <stdexcept>
-#include <boost/format.hpp>
-#include <boost/algorithm/string.hpp>
-#include <boost/foreach.hpp>
-
-//----------------------- u2 mac addr wrapper ------------------------//
-uhd::mac_addr_t::mac_addr_t(const std::string &mac_addr_str_){
- std::string mac_addr_str = (mac_addr_str_ == "")? "ff:ff:ff:ff:ff:ff" : mac_addr_str_;
-
- //ether_aton_r(str.c_str(), &mac_addr);
- boost::uint8_t p[6] = {0x00, 0x50, 0xC2, 0x85, 0x30, 0x00}; // Matt's IAB
-
- try{
- //only allow patterns of xx:xx or xx:xx:xx:xx:xx:xx
- //the IAB above will fill in for the shorter pattern
- if (mac_addr_str.size() != 5 and mac_addr_str.size() != 17)
- throw std::runtime_error("expected exactly 5 or 17 characters");
-
- //split the mac addr hex string at the colons
- std::vector<std::string> hex_strs;
- boost::split(hex_strs, mac_addr_str, boost::is_any_of(":"));
- for (size_t i = 0; i < hex_strs.size(); i++){
- int hex_num;
- std::istringstream iss(hex_strs[i]);
- iss >> std::hex >> hex_num;
- p[i] = boost::uint8_t(hex_num);
- }
-
- }
- catch(std::exception const& e){
- throw std::runtime_error(str(
- boost::format("Invalid mac address: %s\n\t%s") % mac_addr_str % e.what()
- ));
- }
-
- memcpy(&mac_addr, p, sizeof(mac_addr));
-}
-
-std::string uhd::mac_addr_t::to_string(void) const{
- //ether_ntoa_r(&mac_addr, addr_buf);
- const boost::uint8_t *p = reinterpret_cast<const boost::uint8_t *>(&mac_addr);
- return str(
- boost::format("%02x:%02x:%02x:%02x:%02x:%02x")
- % int(p[0]) % int(p[1]) % int(p[2])
- % int(p[3]) % int(p[4]) % int(p[5])
- );
-}
-
-std::ostream& operator<<(std::ostream &os, const uhd::mac_addr_t &x){
- os << x.to_string();
- return os;
-}
-
-//----------------------- usrp device_addr_t wrapper -------------------------//
-std::string uhd::device_addr::to_string(const uhd::device_addr_t &device_addr){
- std::stringstream ss;
- BOOST_FOREACH(std::string key, device_addr.get_keys()){
- ss << boost::format("%s: %s") % key % device_addr[key] << std::endl;
- }
- return ss.str();
-}
-
-std::ostream& operator<<(std::ostream &os, const uhd::device_addr_t &device_addr){
- os << uhd::device_addr::to_string(device_addr);
- return os;
-}
diff --git a/host/lib/gain_handler.cpp b/host/lib/gain_handler.cpp
index 7b3dd266c..a6ae06c50 100644
--- a/host/lib/gain_handler.cpp
+++ b/host/lib/gain_handler.cpp
@@ -17,7 +17,7 @@
#include <uhd/gain_handler.hpp>
#include <uhd/utils/assert.hpp>
-#include <uhd/types.hpp>
+#include <uhd/types/ranges.hpp>
#include <uhd/props.hpp>
#include <boost/assign/list_of.hpp>
#include <boost/foreach.hpp>
@@ -47,7 +47,7 @@ private:
is_equal_t _is_equal;
prop_names_t get_gain_names(void);
- gain_t get_overall_gain_val(void);
+ float get_overall_gain_val(void);
gain_range_t get_overall_gain_range(void);
template <class T> T get_named_prop(const wax::obj &prop, const std::string &name){
return _link[named_prop_t(prop, name)].as<T>();
@@ -90,21 +90,21 @@ prop_names_t gain_handler_impl::get_gain_names(void){
return _link[_props.names].as<prop_names_t>();
}
-gain_t gain_handler_impl::get_overall_gain_val(void){
- gain_t gain_val = 0;
+float gain_handler_impl::get_overall_gain_val(void){
+ float gain_val = 0;
BOOST_FOREACH(std::string name, get_gain_names()){
- gain_val += get_named_prop<gain_t>(_props.value, name);
+ gain_val += get_named_prop<float>(_props.value, name);
}
return gain_val;
}
gain_range_t gain_handler_impl::get_overall_gain_range(void){
- gain_t gain_min = 0, gain_max = 0, gain_step = 0;
+ float gain_min = 0, gain_max = 0, gain_step = 0;
BOOST_FOREACH(std::string name, get_gain_names()){
- gain_range_t gain_tmp = get_named_prop<gain_range_t>(_props.range, name);
- gain_min += gain_tmp.min;
- gain_max += gain_tmp.max;
- gain_step = std::max(gain_step, gain_tmp.step);
+ gain_range_t floatmp = get_named_prop<gain_range_t>(_props.range, name);
+ gain_min += floatmp.min;
+ gain_max += floatmp.max;
+ gain_step = std::max(gain_step, floatmp.step);
}
return gain_range_t(gain_min, gain_max, gain_step);
}
@@ -145,7 +145,7 @@ bool gain_handler_impl::intercept_set(const wax::obj &key_, const wax::obj &val)
//not a gain value key... dont handle
if (not _is_equal(key, _props.value)) return false;
- gain_t gain_val = val.as<gain_t>();
+ float gain_val = val.as<float>();
//not a wildcard... dont handle (but check name and range)
if (name != ""){
@@ -164,7 +164,7 @@ bool gain_handler_impl::intercept_set(const wax::obj &key_, const wax::obj &val)
gain_range_t gain = get_named_prop<gain_range_t>(_props.range, name);
//clip g to be within the allowed range
- gain_t g = std::min(std::max(gain_val, gain.min), gain.max);
+ float g = std::min(std::max(gain_val, gain.min), gain.max);
//set g to be a multiple of the step size
g -= std::fmod(g, gain.step);
//set g to be the new gain
diff --git a/host/lib/simple_device.cpp b/host/lib/simple_device.cpp
index 0eb69d9fa..95bc8fecc 100644
--- a/host/lib/simple_device.cpp
+++ b/host/lib/simple_device.cpp
@@ -19,7 +19,6 @@
#include <uhd/utils/assert.hpp>
#include <uhd/utils/algorithm.hpp>
#include <uhd/props.hpp>
-#include <uhd/types.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/foreach.hpp>
#include <boost/format.hpp>
@@ -208,7 +207,7 @@ public:
}
float get_rx_gain(void){
- return _rx_subdev[SUBDEV_PROP_GAIN].as<gain_t>();
+ return _rx_subdev[SUBDEV_PROP_GAIN].as<float>();
}
gain_range_t get_rx_gain_range(void){
@@ -264,7 +263,7 @@ public:
}
float get_tx_gain(void){
- return _tx_subdev[SUBDEV_PROP_GAIN].as<gain_t>();
+ return _tx_subdev[SUBDEV_PROP_GAIN].as<float>();
}
gain_range_t get_tx_gain_range(void){
diff --git a/host/lib/time_spec.cpp b/host/lib/time_spec.cpp
deleted file mode 100644
index 98bf28077..000000000
--- a/host/lib/time_spec.cpp
+++ /dev/null
@@ -1,35 +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/>.
-//
-
-#include <uhd/time_spec.hpp>
-
-using namespace uhd;
-
-time_spec_t::time_spec_t(boost::uint32_t new_secs, boost::uint32_t new_ticks){
- secs = new_secs;
- ticks = new_ticks;
-}
-
-static const boost::posix_time::ptime epoch(boost::gregorian::date(1970,1,1));
-static double time_tick_rate = double(boost::posix_time::time_duration::ticks_per_second());
-
-time_spec_t::time_spec_t(boost::posix_time::ptime time, double tick_rate){
- boost::posix_time::time_duration td = time - epoch;
- secs = boost::uint32_t(td.total_seconds());
- double time_ticks_per_device_ticks = time_tick_rate/tick_rate;
- ticks = boost::uint32_t(td.fractional_seconds()/time_ticks_per_device_ticks);
-}
diff --git a/host/lib/types.cpp b/host/lib/types.cpp
index 273f87a2d..bd5dc8e26 100644
--- a/host/lib/types.cpp
+++ b/host/lib/types.cpp
@@ -15,12 +15,23 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
-#include <uhd/types.hpp>
+#include <uhd/types/ranges.hpp>
+#include <uhd/types/tune_result.hpp>
+#include <uhd/types/clock_config.hpp>
+#include <uhd/types/stream_cmd.hpp>
+#include <uhd/types/metadata.hpp>
+#include <uhd/types/time_spec.hpp>
+#include <uhd/types/device_addr.hpp>
+#include <uhd/types/mac_addr.hpp>
+#include <boost/algorithm/string.hpp>
+#include <boost/foreach.hpp>
+#include <boost/format.hpp>
+#include <stdexcept>
using namespace uhd;
/***********************************************************************
- * gain range
+ * ranges
**********************************************************************/
gain_range_t::gain_range_t(float min_, float max_, float step_){
min = min_;
@@ -28,9 +39,6 @@ gain_range_t::gain_range_t(float min_, float max_, float step_){
step = step_;
}
-/***********************************************************************
- * freq range
- **********************************************************************/
freq_range_t::freq_range_t(double min_, double max_){
min = min_;
max = max_;
@@ -64,3 +72,98 @@ stream_cmd_t::stream_cmd_t(void){
continuous = false;
num_samps = 0;
}
+
+/***********************************************************************
+ * metadata
+ **********************************************************************/
+rx_metadata_t::rx_metadata_t(void){
+ stream_id = 0;
+ has_stream_id = false;
+ time_spec = time_spec_t();
+ has_time_spec = false;
+ is_fragment = false;
+}
+
+tx_metadata_t::tx_metadata_t(void){
+ stream_id = 0;
+ has_stream_id = false;
+ time_spec = time_spec_t();
+ has_time_spec = false;
+ start_of_burst = false;
+ end_of_burst = false;
+}
+
+/***********************************************************************
+ * time spec
+ **********************************************************************/
+time_spec_t::time_spec_t(boost::uint32_t new_secs, boost::uint32_t new_ticks){
+ secs = new_secs;
+ ticks = new_ticks;
+}
+
+static const boost::posix_time::ptime epoch(boost::gregorian::date(1970,1,1));
+static double time_tick_rate = double(boost::posix_time::time_duration::ticks_per_second());
+
+time_spec_t::time_spec_t(boost::posix_time::ptime time, double tick_rate){
+ boost::posix_time::time_duration td = time - epoch;
+ secs = boost::uint32_t(td.total_seconds());
+ double time_ticks_per_device_ticks = time_tick_rate/tick_rate;
+ ticks = boost::uint32_t(td.fractional_seconds()/time_ticks_per_device_ticks);
+}
+
+/***********************************************************************
+ * device addr
+ **********************************************************************/
+std::string device_addr_t::to_string(void) const{
+ const device_addr_t &device_addr = *this;
+ std::stringstream ss;
+ BOOST_FOREACH(std::string key, device_addr.get_keys()){
+ ss << boost::format("%s: %s") % key % device_addr[key] << std::endl;
+ }
+ return ss.str();
+}
+
+/***********************************************************************
+ * mac addr
+ **********************************************************************/
+uhd::mac_addr_t::mac_addr_t(const std::string &mac_addr_str_){
+ std::string mac_addr_str = (mac_addr_str_ == "")? "ff:ff:ff:ff:ff:ff" : mac_addr_str_;
+
+ //ether_aton_r(str.c_str(), &mac_addr);
+ boost::uint8_t p[6] = {0x00, 0x50, 0xC2, 0x85, 0x30, 0x00}; // Matt's IAB
+
+ try{
+ //only allow patterns of xx:xx or xx:xx:xx:xx:xx:xx
+ //the IAB above will fill in for the shorter pattern
+ if (mac_addr_str.size() != 5 and mac_addr_str.size() != 17)
+ throw std::runtime_error("expected exactly 5 or 17 characters");
+
+ //split the mac addr hex string at the colons
+ std::vector<std::string> hex_strs;
+ boost::split(hex_strs, mac_addr_str, boost::is_any_of(":"));
+ for (size_t i = 0; i < hex_strs.size(); i++){
+ int hex_num;
+ std::istringstream iss(hex_strs[i]);
+ iss >> std::hex >> hex_num;
+ p[i] = boost::uint8_t(hex_num);
+ }
+
+ }
+ catch(std::exception const& e){
+ throw std::runtime_error(str(
+ boost::format("Invalid mac address: %s\n\t%s") % mac_addr_str % e.what()
+ ));
+ }
+
+ memcpy(&mac_addr, p, sizeof(mac_addr));
+}
+
+std::string uhd::mac_addr_t::to_string(void) const{
+ //ether_ntoa_r(&mac_addr, addr_buf);
+ const boost::uint8_t *p = reinterpret_cast<const boost::uint8_t *>(&mac_addr);
+ return str(
+ boost::format("%02x:%02x:%02x:%02x:%02x:%02x")
+ % int(p[0]) % int(p[1]) % int(p[2])
+ % int(p[3]) % int(p[4]) % int(p[5])
+ );
+}
diff --git a/host/lib/usrp/dboard/basic.cpp b/host/lib/usrp/dboard/basic.cpp
index 07cb8d11c..2f29c8e0c 100644
--- a/host/lib/usrp/dboard/basic.cpp
+++ b/host/lib/usrp/dboard/basic.cpp
@@ -16,7 +16,7 @@
//
#include <uhd/props.hpp>
-#include <uhd/types.hpp>
+#include <uhd/types/ranges.hpp>
#include <uhd/utils/assert.hpp>
#include <uhd/utils/static.hpp>
#include <uhd/usrp/dboard_base.hpp>
@@ -34,26 +34,26 @@ using namespace boost::assign;
**********************************************************************/
class basic_rx : public rx_dboard_base{
public:
- basic_rx(ctor_args_t const& args, freq_t max_freq);
+ basic_rx(ctor_args_t const& args, double max_freq);
~basic_rx(void);
void rx_get(const wax::obj &key, wax::obj &val);
void rx_set(const wax::obj &key, const wax::obj &val);
private:
- freq_t _max_freq;
+ double _max_freq;
};
class basic_tx : public tx_dboard_base{
public:
- basic_tx(ctor_args_t const& args, freq_t max_freq);
+ basic_tx(ctor_args_t const& args, double max_freq);
~basic_tx(void);
void tx_get(const wax::obj &key, wax::obj &val);
void tx_set(const wax::obj &key, const wax::obj &val);
private:
- freq_t _max_freq;
+ double _max_freq;
};
/***********************************************************************
@@ -85,7 +85,7 @@ UHD_STATIC_BLOCK(reg_dboards){
/***********************************************************************
* Basic and LF RX dboard
**********************************************************************/
-basic_rx::basic_rx(ctor_args_t const& args, freq_t max_freq) : rx_dboard_base(args){
+basic_rx::basic_rx(ctor_args_t const& args, double max_freq) : rx_dboard_base(args){
_max_freq = max_freq;
// set the gpios to safe values (all inputs)
get_interface()->set_gpio_ddr(dboard_interface::GPIO_RX_BANK, 0x0000, 0xffff);
@@ -113,7 +113,7 @@ void basic_rx::rx_get(const wax::obj &key_, wax::obj &val){
return;
case SUBDEV_PROP_GAIN:
- val = gain_t(0);
+ val = float(0);
return;
case SUBDEV_PROP_GAIN_RANGE:
@@ -125,7 +125,7 @@ void basic_rx::rx_get(const wax::obj &key_, wax::obj &val){
return;
case SUBDEV_PROP_FREQ:
- val = freq_t(0);
+ val = double(0);
return;
case SUBDEV_PROP_FREQ_RANGE:
@@ -164,7 +164,7 @@ void basic_rx::rx_set(const wax::obj &key_, const wax::obj &val){
switch(key.as<subdev_prop_t>()){
case SUBDEV_PROP_GAIN:
- ASSERT_THROW(val.as<gain_t>() == gain_t(0));
+ ASSERT_THROW(val.as<float>() == float(0));
return;
case SUBDEV_PROP_ANTENNA:
@@ -196,7 +196,7 @@ void basic_rx::rx_set(const wax::obj &key_, const wax::obj &val){
/***********************************************************************
* Basic and LF TX dboard
**********************************************************************/
-basic_tx::basic_tx(ctor_args_t const& args, freq_t max_freq) : tx_dboard_base(args){
+basic_tx::basic_tx(ctor_args_t const& args, double max_freq) : tx_dboard_base(args){
_max_freq = max_freq;
// set the gpios to safe values (all inputs)
get_interface()->set_gpio_ddr(dboard_interface::GPIO_TX_BANK, 0x0000, 0xffff);
@@ -221,7 +221,7 @@ void basic_tx::tx_get(const wax::obj &key_, wax::obj &val){
return;
case SUBDEV_PROP_GAIN:
- val = gain_t(0);
+ val = float(0);
return;
case SUBDEV_PROP_GAIN_RANGE:
@@ -233,7 +233,7 @@ void basic_tx::tx_get(const wax::obj &key_, wax::obj &val){
return;
case SUBDEV_PROP_FREQ:
- val = freq_t(0);
+ val = double(0);
return;
case SUBDEV_PROP_FREQ_RANGE:
@@ -272,7 +272,7 @@ void basic_tx::tx_set(const wax::obj &key_, const wax::obj &val){
switch(key.as<subdev_prop_t>()){
case SUBDEV_PROP_GAIN:
- ASSERT_THROW(val.as<gain_t>() == gain_t(0));
+ ASSERT_THROW(val.as<float>() == float(0));
return;
case SUBDEV_PROP_ANTENNA:
diff --git a/host/lib/usrp/dboard_manager.cpp b/host/lib/usrp/dboard_manager.cpp
index 0f2189cd1..bc9bfbf14 100644
--- a/host/lib/usrp/dboard_manager.cpp
+++ b/host/lib/usrp/dboard_manager.cpp
@@ -19,7 +19,7 @@
#include <uhd/gain_handler.hpp>
#include <uhd/utils/static.hpp>
#include <uhd/utils/assert.hpp>
-#include <uhd/dict.hpp>
+#include <uhd/types/dict.hpp>
#include <boost/tuple/tuple.hpp>
#include <boost/format.hpp>
#include <boost/bind.hpp>
diff --git a/host/lib/usrp/usrp2/dboard_impl.cpp b/host/lib/usrp/usrp2/dboard_impl.cpp
index 6b49ff29d..fd72aeaa4 100644
--- a/host/lib/usrp/usrp2/dboard_impl.cpp
+++ b/host/lib/usrp/usrp2/dboard_impl.cpp
@@ -16,6 +16,7 @@
//
#include <uhd/utils/assert.hpp>
+#include <uhd/types/clock_config.hpp>
#include <boost/format.hpp>
#include "usrp2_impl.hpp"
diff --git a/host/lib/usrp/usrp2/dsp_impl.cpp b/host/lib/usrp/usrp2/dsp_impl.cpp
index 654096d14..40ef06a8c 100644
--- a/host/lib/usrp/usrp2/dsp_impl.cpp
+++ b/host/lib/usrp/usrp2/dsp_impl.cpp
@@ -35,7 +35,7 @@ template <class T> T log2(T num){
/***********************************************************************
* DDC Helper Methods
**********************************************************************/
-static boost::uint32_t calculate_freq_word_and_update_actual_freq(freq_t &freq, freq_t clock_freq){
+static boost::uint32_t calculate_freq_word_and_update_actual_freq(double &freq, double clock_freq){
double scale_factor = std::pow(2.0, 32);
//calculate the freq register word
@@ -163,7 +163,7 @@ void usrp2_impl::ddc_set(const wax::obj &key, const wax::obj &val){
return;
}
else if (key_name == "freq"){
- freq_t new_freq = val.as<freq_t>();
+ double new_freq = val.as<double>();
ASSERT_THROW(new_freq <= get_master_clock_freq()/2.0);
ASSERT_THROW(new_freq >= -get_master_clock_freq()/2.0);
_ddc_freq = new_freq; //shadow
@@ -283,7 +283,7 @@ void usrp2_impl::duc_set(const wax::obj &key, const wax::obj &val){
return;
}
else if (key_name == "freq"){
- freq_t new_freq = val.as<freq_t>();
+ double new_freq = val.as<double>();
ASSERT_THROW(new_freq <= get_master_clock_freq()/2.0);
ASSERT_THROW(new_freq >= -get_master_clock_freq()/2.0);
_duc_freq = new_freq; //shadow
diff --git a/host/lib/usrp/usrp2/mboard_impl.cpp b/host/lib/usrp/usrp2/mboard_impl.cpp
index e4706dcf0..b6919a738 100644
--- a/host/lib/usrp/usrp2/mboard_impl.cpp
+++ b/host/lib/usrp/usrp2/mboard_impl.cpp
@@ -16,6 +16,7 @@
//
#include <uhd/utils/assert.hpp>
+#include <uhd/types/mac_addr.hpp>
#include "usrp2_impl.hpp"
using namespace uhd;
@@ -168,7 +169,7 @@ void usrp2_impl::mboard_get(const wax::obj &key_, wax::obj &val){
return;
case MBOARD_PROP_CLOCK_RATE:
- val = freq_t(get_master_clock_freq());
+ val = double(get_master_clock_freq());
return;
case MBOARD_PROP_RX_DSP:
diff --git a/host/lib/usrp/usrp2/usrp2_impl.hpp b/host/lib/usrp/usrp2/usrp2_impl.hpp
index 3a2963c5a..6535e7049 100644
--- a/host/lib/usrp/usrp2/usrp2_impl.hpp
+++ b/host/lib/usrp/usrp2/usrp2_impl.hpp
@@ -19,9 +19,9 @@
#define INCLUDED_USRP2_IMPL_HPP
#include <uhd/usrp/usrp2.hpp>
-#include <uhd/dict.hpp>
-#include <uhd/types.hpp>
-#include <uhd/time_spec.hpp>
+#include <uhd/types/dict.hpp>
+#include <uhd/types/stream_cmd.hpp>
+#include <uhd/types/clock_config.hpp>
#include <boost/asio.hpp>
#include <boost/thread.hpp>
#include <boost/shared_ptr.hpp>
@@ -173,14 +173,14 @@ private:
//methods and shadows for the ddc dsp
std::vector<size_t> _allowed_decim_and_interp_rates;
size_t _ddc_decim;
- uhd::freq_t _ddc_freq;
+ double _ddc_freq;
void init_ddc_config(void);
void update_ddc_config(void);
void issue_ddc_stream_cmd(const uhd::stream_cmd_t &stream_cmd);
//methods and shadows for the duc dsp
size_t _duc_interp;
- uhd::freq_t _duc_freq;
+ double _duc_freq;
void init_duc_config(void);
void update_duc_config(void);
diff --git a/host/test/addr_test.cpp b/host/test/addr_test.cpp
index 148aee015..0c8f63b0a 100644
--- a/host/test/addr_test.cpp
+++ b/host/test/addr_test.cpp
@@ -16,13 +16,14 @@
//
#include <boost/test/unit_test.hpp>
-#include <uhd/device_addr.hpp>
+#include <uhd/types/mac_addr.hpp>
+#include <iostream>
BOOST_AUTO_TEST_CASE(test_mac_addr){
std::cout << "Testing mac addr..." << std::endl;
const std::string mac_addr_str("00:01:23:45:67:89");
uhd::mac_addr_t mac_addr(mac_addr_str);
std::cout << "Input: " << mac_addr_str << std::endl;
- std::cout << "Output: " << mac_addr << std::endl;
+ std::cout << "Output: " << mac_addr.to_string() << std::endl;
BOOST_CHECK_EQUAL(mac_addr_str, mac_addr.to_string());
}
diff --git a/host/test/gain_handler_test.cpp b/host/test/gain_handler_test.cpp
index 47acb30f0..e13063e06 100644
--- a/host/test/gain_handler_test.cpp
+++ b/host/test/gain_handler_test.cpp
@@ -17,9 +17,9 @@
#include <boost/test/unit_test.hpp>
#include <uhd/gain_handler.hpp>
-#include <uhd/types.hpp>
+#include <uhd/types/ranges.hpp>
+#include <uhd/types/dict.hpp>
#include <uhd/props.hpp>
-#include <uhd/dict.hpp>
#include <boost/bind.hpp>
#include <iostream>
@@ -84,7 +84,7 @@ private:
//handle the get request conditioned on the key
switch(key.as<prop_t>()){
case PROP_GAIN_VALUE:
- _gain_values[name] = val.as<gain_t>();
+ _gain_values[name] = val.as<float>();
return;
case PROP_GAIN_RANGE:
@@ -94,7 +94,7 @@ private:
}
gain_handler::sptr _gain_handler;
- uhd::dict<std::string, gain_t> _gain_values;
+ uhd::dict<std::string, float> _gain_values;
uhd::dict<std::string, gain_range_t> _gain_ranges;
};
@@ -104,18 +104,18 @@ BOOST_AUTO_TEST_CASE(test_gain_handler){
gainful_obj go0;
BOOST_CHECK_THROW(
- go0[named_prop_t(PROP_GAIN_VALUE, "fail")].as<gain_t>(),
+ go0[named_prop_t(PROP_GAIN_VALUE, "fail")].as<float>(),
std::exception
);
std::cout << "verifying the overall min, max, step" << std::endl;
gain_range_t gain = go0[PROP_GAIN_RANGE].as<gain_range_t>();
- BOOST_CHECK_EQUAL(gain.min, gain_t(-10));
- BOOST_CHECK_EQUAL(gain.max, gain_t(100));
- BOOST_CHECK_EQUAL(gain.step, gain_t(1.5));
+ BOOST_CHECK_EQUAL(gain.min, float(-10));
+ BOOST_CHECK_EQUAL(gain.max, float(100));
+ BOOST_CHECK_EQUAL(gain.step, float(1.5));
std::cout << "verifying the overall gain" << std::endl;
- go0[named_prop_t(PROP_GAIN_VALUE, "g0")] = gain_t(-5);
- go0[named_prop_t(PROP_GAIN_VALUE, "g1")] = gain_t(30);
- BOOST_CHECK_EQUAL(go0[PROP_GAIN_VALUE].as<gain_t>(), gain_t(25));
+ go0[named_prop_t(PROP_GAIN_VALUE, "g0")] = float(-5);
+ go0[named_prop_t(PROP_GAIN_VALUE, "g1")] = float(30);
+ BOOST_CHECK_EQUAL(go0[PROP_GAIN_VALUE].as<float>(), float(25));
}
diff --git a/host/utils/discover_usrps.cpp b/host/utils/discover_usrps.cpp
index dc2b845bc..72c5b8822 100644
--- a/host/utils/discover_usrps.cpp
+++ b/host/utils/discover_usrps.cpp
@@ -63,7 +63,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
std::cout << "--------------------------------------------------" << std::endl;
std::cout << "-- USRP Device " << i << std::endl;
std::cout << "--------------------------------------------------" << std::endl;
- std::cout << device_addrs[i] << std::endl << std::endl;
+ std::cout << device_addrs[i].to_string() << std::endl << std::endl;
uhd::device::make(device_addrs[i]); //test make
}