aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/x300/x300_dboard_iface.cpp
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2015-04-10 18:39:45 -0700
committerMartin Braun <martin.braun@ettus.com>2015-04-10 18:39:45 -0700
commitddae9468b9f69fcbc91c4f8cbffc0b7d69b79b4c (patch)
treed2b9422fa68315ff1b001c9fa60baeb6752ae59b /host/lib/usrp/x300/x300_dboard_iface.cpp
parent1f41782b564da36e31f41e2561f2778e36986baf (diff)
parentf23e7bcc47f86ffb431aee43abe670e3e5e31647 (diff)
downloaduhd-ddae9468b9f69fcbc91c4f8cbffc0b7d69b79b4c.tar.gz
uhd-ddae9468b9f69fcbc91c4f8cbffc0b7d69b79b4c.tar.bz2
uhd-ddae9468b9f69fcbc91c4f8cbffc0b7d69b79b4c.zip
Merge branch 'maint'
Diffstat (limited to 'host/lib/usrp/x300/x300_dboard_iface.cpp')
-rw-r--r--host/lib/usrp/x300/x300_dboard_iface.cpp28
1 files changed, 20 insertions, 8 deletions
diff --git a/host/lib/usrp/x300/x300_dboard_iface.cpp b/host/lib/usrp/x300/x300_dboard_iface.cpp
index c286e805a..502630109 100644
--- a/host/lib/usrp/x300/x300_dboard_iface.cpp
+++ b/host/lib/usrp/x300/x300_dboard_iface.cpp
@@ -111,12 +111,12 @@ x300_dboard_iface::x300_dboard_iface(const x300_dboard_iface_config_t &config):
this->_write_aux_dac(unit);
}
+ _clock_rates[UNIT_RX] = _config.clock->get_dboard_rate(_config.which_rx_clk);
+ _clock_rates[UNIT_TX] = _config.clock->get_dboard_rate(_config.which_tx_clk);
+
this->set_clock_enabled(UNIT_RX, false);
this->set_clock_enabled(UNIT_TX, false);
- this->set_clock_rate(UNIT_RX, _config.clock->get_master_clock_rate());
- this->set_clock_rate(UNIT_TX, _config.clock->get_master_clock_rate());
-
//some test code
/*
@@ -153,16 +153,20 @@ x300_dboard_iface::~x300_dboard_iface(void)
**********************************************************************/
void x300_dboard_iface::set_clock_rate(unit_t unit, double rate)
{
- _clock_rates[unit] = rate; //set to shadow
+ // Just return if the requested rate is already set
+ if (std::fabs(_clock_rates[unit] - rate) < std::numeric_limits<double>::epsilon())
+ return;
+
switch(unit)
{
case UNIT_RX:
_config.clock->set_dboard_rate(_config.which_rx_clk, rate);
- return;
+ break;
case UNIT_TX:
_config.clock->set_dboard_rate(_config.which_tx_clk, rate);
- return;
+ break;
}
+ _clock_rates[unit] = rate; //set to shadow
}
double x300_dboard_iface::get_clock_rate(unit_t unit)
@@ -183,9 +187,17 @@ std::vector<double> x300_dboard_iface::get_clock_rates(unit_t unit)
}
}
-void x300_dboard_iface::set_clock_enabled(UHD_UNUSED(unit_t unit), UHD_UNUSED(bool enb))
+void x300_dboard_iface::set_clock_enabled(unit_t unit, bool enb)
{
- // TODO Variable DBoard clock control needs to be implemented for X300.
+ switch(unit)
+ {
+ case UNIT_RX:
+ return _config.clock->enable_dboard_clock(_config.which_rx_clk, enb);
+ case UNIT_TX:
+ return _config.clock->enable_dboard_clock(_config.which_tx_clk, enb);
+ default:
+ UHD_THROW_INVALID_CODE_PATH();
+ }
}
double x300_dboard_iface::get_codec_rate(unit_t)