summaryrefslogtreecommitdiffstats
path: root/host
diff options
context:
space:
mode:
authorNick Foster <nick@ettus.com>2011-09-01 12:48:16 -0700
committerJosh Blum <josh@joshknows.com>2011-09-23 16:46:26 -0700
commitb998964ca78e3d7927c82680c167aebf9cabae73 (patch)
treee971460694fc71a7224ee3a93e38af68d7aa6d08 /host
parentd5d448eb8f19d73c7abbef5d5a49e9c4cd24fee2 (diff)
downloaduhd-b998964ca78e3d7927c82680c167aebf9cabae73.tar.gz
uhd-b998964ca78e3d7927c82680c167aebf9cabae73.tar.bz2
uhd-b998964ca78e3d7927c82680c167aebf9cabae73.zip
B100: unshadow dboard clock rates so you can set master freq after init and still tune ok
Diffstat (limited to 'host')
-rw-r--r--host/lib/usrp/b100/clock_ctrl.cpp2
-rw-r--r--host/lib/usrp/b100/clock_ctrl.hpp12
-rw-r--r--host/lib/usrp/b100/dboard_iface.cpp14
3 files changed, 21 insertions, 7 deletions
diff --git a/host/lib/usrp/b100/clock_ctrl.cpp b/host/lib/usrp/b100/clock_ctrl.cpp
index b1e12773e..df1442420 100644
--- a/host/lib/usrp/b100/clock_ctrl.cpp
+++ b/host/lib/usrp/b100/clock_ctrl.cpp
@@ -159,7 +159,7 @@ static clock_settings_type get_clock_settings(double rate){
}
}
- throw uhd::runtime_error(str(boost::format(
+ throw uhd::value_error(str(boost::format(
"USRP-B100 clock control: could not calculate settings for clock rate %fMHz"
) % (rate/1e6)));
}
diff --git a/host/lib/usrp/b100/clock_ctrl.hpp b/host/lib/usrp/b100/clock_ctrl.hpp
index 5ef231281..68c24bdce 100644
--- a/host/lib/usrp/b100/clock_ctrl.hpp
+++ b/host/lib/usrp/b100/clock_ctrl.hpp
@@ -78,6 +78,18 @@ public:
* \throw exception when rate cannot be achieved
*/
virtual void set_tx_dboard_clock_rate(double rate) = 0;
+
+ /*!
+ * Get the current rx dboard clock rate.
+ * \return the clock rate in Hz
+ */
+ virtual double get_rx_clock_rate(void) = 0;
+
+ /*!
+ * Get the current tx dboard clock rate.
+ * \return the clock rate in Hz
+ */
+ virtual double get_tx_clock_rate(void) = 0;
/*!
* Enable/disable the FPGA clock.
diff --git a/host/lib/usrp/b100/dboard_iface.cpp b/host/lib/usrp/b100/dboard_iface.cpp
index 33c4b355d..229215a4e 100644
--- a/host/lib/usrp/b100/dboard_iface.cpp
+++ b/host/lib/usrp/b100/dboard_iface.cpp
@@ -104,7 +104,6 @@ private:
spi_iface::sptr _spi_iface;
b100_clock_ctrl::sptr _clock;
b100_codec_ctrl::sptr _codec;
- uhd::dict<unit_t, double> _clock_rates;
};
/***********************************************************************
@@ -124,7 +123,6 @@ dboard_iface::sptr make_b100_dboard_iface(
* Clock Rates
**********************************************************************/
void b100_dboard_iface::set_clock_rate(unit_t unit, double rate){
- _clock_rates[unit] = rate;
switch(unit){
case UNIT_RX: return _clock->set_rx_dboard_clock_rate(rate);
case UNIT_TX: return _clock->set_tx_dboard_clock_rate(rate);
@@ -140,7 +138,11 @@ std::vector<double> b100_dboard_iface::get_clock_rates(unit_t unit){
}
double b100_dboard_iface::get_clock_rate(unit_t unit){
- return _clock_rates[unit];
+ switch(unit){
+ case UNIT_RX: return _clock->get_rx_clock_rate();
+ case UNIT_TX: return _clock->get_tx_clock_rate();
+ }
+ UHD_THROW_INVALID_CODE_PATH();
}
void b100_dboard_iface::set_clock_enabled(unit_t unit, bool enb){
@@ -244,7 +246,7 @@ static boost::uint32_t unit_to_otw_spi_dev(dboard_iface::unit_t unit){
case dboard_iface::UNIT_TX: return B100_SPI_SS_TX_DB;
case dboard_iface::UNIT_RX: return B100_SPI_SS_RX_DB;
}
- throw std::invalid_argument("unknown unit type");
+ UHD_THROW_INVALID_CODE_PATH();
}
void b100_dboard_iface::write_spi(
@@ -253,7 +255,7 @@ void b100_dboard_iface::write_spi(
boost::uint32_t data,
size_t num_bits
){
- _spi_iface->transact_spi(unit_to_otw_spi_dev(unit), config, data, num_bits, false /*no rb*/);
+ _spi_iface->write_spi(unit_to_otw_spi_dev(unit), config, data, num_bits);
}
boost::uint32_t b100_dboard_iface::read_write_spi(
@@ -262,7 +264,7 @@ boost::uint32_t b100_dboard_iface::read_write_spi(
boost::uint32_t data,
size_t num_bits
){
- return _spi_iface->transact_spi(unit_to_otw_spi_dev(unit), config, data, num_bits, true /*rb*/);
+ return _spi_iface->read_spi(unit_to_otw_spi_dev(unit), config, data, num_bits);
}
/***********************************************************************