aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/usrp1/clock_ctrl.cpp
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2011-05-03 16:55:27 -0700
committerJosh Blum <josh@joshknows.com>2011-05-03 16:55:27 -0700
commit4e0b42afcbbf1067cef2ad530f3b162e5a35771b (patch)
tree708547b217482a6404f2c75ad7ab19a69a74dc9e /host/lib/usrp/usrp1/clock_ctrl.cpp
parente75919bc9e1cb1b5f8f69b5a5aabed9b3a1a53d9 (diff)
parentb4fc0d61bb6cbd1a5614745bab9aeb0abc22cb6f (diff)
downloaduhd-4e0b42afcbbf1067cef2ad530f3b162e5a35771b.tar.gz
uhd-4e0b42afcbbf1067cef2ad530f3b162e5a35771b.tar.bz2
uhd-4e0b42afcbbf1067cef2ad530f3b162e5a35771b.zip
Merge branch 'master' into next
Diffstat (limited to 'host/lib/usrp/usrp1/clock_ctrl.cpp')
-rw-r--r--host/lib/usrp/usrp1/clock_ctrl.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/host/lib/usrp/usrp1/clock_ctrl.cpp b/host/lib/usrp/usrp1/clock_ctrl.cpp
index df5353b54..154e6a316 100644
--- a/host/lib/usrp/usrp1/clock_ctrl.cpp
+++ b/host/lib/usrp/usrp1/clock_ctrl.cpp
@@ -16,6 +16,9 @@
//
#include "clock_ctrl.hpp"
+#include <boost/lexical_cast.hpp>
+#include <boost/format.hpp>
+#include <iostream>
using namespace uhd;
@@ -31,6 +34,17 @@ class usrp1_clock_ctrl_impl : public usrp1_clock_ctrl {
public:
usrp1_clock_ctrl_impl(usrp1_iface::sptr iface): _iface(iface){
this->set_master_clock_freq(default_master_clock_rate);
+ try{
+ if (not _iface->mb_eeprom["mcr"].empty()){
+ std::cout << "Read FPGA clock rate from EEPROM setting." << std::endl;
+ const double master_clock_rate = boost::lexical_cast<double>(_iface->mb_eeprom["mcr"]);
+ std::cout << boost::format("Initializing FPGA clock to %fMHz...") % (master_clock_rate/1e6) << std::endl;
+ this->set_master_clock_freq(master_clock_rate);
+ }
+ }
+ catch(const std::exception &e){
+ std::cerr << "Error setting FPGA clock rate from EEPROM: " << e.what() << std::endl;
+ }
}
void set_master_clock_freq(double freq){