diff options
Diffstat (limited to 'host/include')
-rw-r--r-- | host/include/uhd/usrp/dboard_iface.hpp | 39 | ||||
-rw-r--r-- | host/include/uhd/usrp/dboard_manager.hpp | 21 | ||||
-rw-r--r-- | host/include/uhd/utils/CMakeLists.txt | 1 | ||||
-rw-r--r-- | host/include/uhd/utils/thread_priority.hpp | 58 |
4 files changed, 113 insertions, 6 deletions
diff --git a/host/include/uhd/usrp/dboard_iface.hpp b/host/include/uhd/usrp/dboard_iface.hpp index 7ecfcd3c0..caf1e6ee6 100644 --- a/host/include/uhd/usrp/dboard_iface.hpp +++ b/host/include/uhd/usrp/dboard_iface.hpp @@ -22,6 +22,7 @@ #include <uhd/types/serial.hpp> #include <boost/shared_ptr.hpp> #include <boost/cstdint.hpp> +#include <vector> namespace uhd{ namespace usrp{ @@ -35,13 +36,13 @@ class UHD_API dboard_iface{ public: typedef boost::shared_ptr<dboard_iface> sptr; - //tells the host which unit to use + //! tells the host which unit to use enum unit_t{ UNIT_RX = 'r', UNIT_TX = 't' }; - //possible atr registers + //! possible atr registers enum atr_reg_t{ ATR_REG_IDLE = 'i', ATR_REG_TX_ONLY = 't', @@ -49,6 +50,20 @@ public: ATR_REG_FULL_DUPLEX = 'f' }; + //! aux dac selection enums (per unit) + enum aux_dac_t{ + AUX_DAC_A = 'a', + AUX_DAC_B = 'b', + AUX_DAC_C = 'c', + AUX_DAC_D = 'd' + }; + + //! aux adc selection enums (per unit) + enum aux_adc_t{ + AUX_ADC_A = 'a', + AUX_ADC_B = 'b' + }; + /*! * Write to an aux dac. * @@ -56,7 +71,7 @@ public: * \param which_dac the dac index 0, 1, 2, 3... * \param value the value in volts */ - virtual void write_aux_dac(unit_t unit, int which_dac, float value) = 0; + virtual void write_aux_dac(unit_t unit, aux_dac_t which_dac, float value) = 0; /*! * Read from an aux adc. @@ -65,7 +80,7 @@ public: * \param which_adc the adc index 0, 1, 2, 3... * \return the value in volts */ - virtual float read_aux_adc(unit_t unit, int which_adc) = 0; + virtual float read_aux_adc(unit_t unit, aux_adc_t which_adc) = 0; /*! * Set a daughterboard output pin control source. @@ -159,6 +174,14 @@ public: ) = 0; /*! + * Set the rate of a dboard clock. + * + * \param unit which unit rx or tx + * \param rate the clock rate in Hz + */ + virtual void set_clock_rate(unit_t unit, double rate) = 0; + + /*! * Get the rate of a dboard clock. * * \param unit which unit rx or tx @@ -167,6 +190,14 @@ public: virtual double get_clock_rate(unit_t unit) = 0; /*! + * Get a list of possible rates for the dboard clock. + * + * \param unit which unit rx or tx + * \return a list of clock rates in Hz + */ + virtual std::vector<double> get_clock_rates(unit_t unit) = 0; + + /*! * Enable or disable a dboard clock. * * \param unit which unit rx or tx diff --git a/host/include/uhd/usrp/dboard_manager.hpp b/host/include/uhd/usrp/dboard_manager.hpp index b84fee4e7..e5831d4cf 100644 --- a/host/include/uhd/usrp/dboard_manager.hpp +++ b/host/include/uhd/usrp/dboard_manager.hpp @@ -40,7 +40,7 @@ public: typedef dboard_base::sptr(*dboard_ctor_t)(dboard_base::ctor_args_t); /*! - * Register a dboard into the system. + * Register a rx or tx dboard into the system. * For single subdevice boards, omit subdev_names. * \param dboard_id the dboard id (rx or tx) * \param dboard_ctor the dboard constructor function pointer @@ -48,7 +48,24 @@ public: * \param subdev_names the names of the subdevs on this dboard */ static void register_dboard( - dboard_id_t dboard_id, + const dboard_id_t &dboard_id, + dboard_ctor_t dboard_ctor, + const std::string &name, + const prop_names_t &subdev_names = prop_names_t(1, "") + ); + + /*! + * Register an xcvr dboard into the system. + * For single subdevice boards, omit subdev_names. + * \param rx_dboard_id the rx unit dboard id + * \param tx_dboard_id the tx unit dboard id + * \param dboard_ctor the dboard constructor function pointer + * \param name the canonical name for the dboard represented + * \param subdev_names the names of the subdevs on this dboard + */ + static void register_dboard( + const dboard_id_t &rx_dboard_id, + const dboard_id_t &tx_dboard_id, dboard_ctor_t dboard_ctor, const std::string &name, const prop_names_t &subdev_names = prop_names_t(1, "") diff --git a/host/include/uhd/utils/CMakeLists.txt b/host/include/uhd/utils/CMakeLists.txt index 3684fd6e7..c98eec639 100644 --- a/host/include/uhd/utils/CMakeLists.txt +++ b/host/include/uhd/utils/CMakeLists.txt @@ -25,5 +25,6 @@ INSTALL(FILES props.hpp safe_main.hpp static.hpp + thread_priority.hpp DESTINATION ${INCLUDE_DIR}/uhd/utils ) diff --git a/host/include/uhd/utils/thread_priority.hpp b/host/include/uhd/utils/thread_priority.hpp new file mode 100644 index 000000000..988fc3012 --- /dev/null +++ b/host/include/uhd/utils/thread_priority.hpp @@ -0,0 +1,58 @@ +// +// 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_UTILS_THREAD_PRIORITY_HPP +#define INCLUDED_UHD_UTILS_THREAD_PRIORITY_HPP + +#include <uhd/config.hpp> + +namespace uhd{ + + static const float default_thread_priority = float(0.5); + + /*! + * Set the scheduling priority on the current thread. + * + * A new thread or calling process should make this call + * with the defailts this to enable realtime scheduling. + * + * A priority of zero corresponds to normal priority. + * Positive priority values are higher than normal. + * Negative priority values are lower than normal. + * + * \param priority a value between -1 and 1 + * \param realtime true to use realtime mode + * \throw exception on set priority failure + */ + UHD_API void set_thread_priority( + float priority = default_thread_priority, + bool realtime = true + ); + + /*! + * Set the scheduling priority on the current thread. + * Same as set_thread_priority but does not throw on failure. + * \return true on success, false on failure + */ + UHD_API bool set_thread_priority_safe( + float priority = default_thread_priority, + bool realtime = true + ); + +} //namespace uhd + +#endif /* INCLUDED_UHD_UTILS_THREAD_PRIORITY_HPP */ |