From f2b560d5f8d19bf6bbd86802e03f061ecede78ec Mon Sep 17 00:00:00 2001
From: Josh Blum <josh@joshknows.com>
Date: Fri, 4 Jun 2010 12:16:09 -0700
Subject: Prepend usrp2 onto the helper classes in usrp2 impl to avoid symbol
 conflicts.

---
 host/lib/usrp/usrp2/clock_ctrl.cpp | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

(limited to 'host/lib/usrp/usrp2/clock_ctrl.cpp')

diff --git a/host/lib/usrp/usrp2/clock_ctrl.cpp b/host/lib/usrp/usrp2/clock_ctrl.cpp
index 4c5207203..94920143d 100644
--- a/host/lib/usrp/usrp2/clock_ctrl.cpp
+++ b/host/lib/usrp/usrp2/clock_ctrl.cpp
@@ -25,9 +25,9 @@ using namespace uhd;
 /*!
  * A usrp2 clock control specific to the ad9510 ic.
  */
-class clock_ctrl_impl : public clock_ctrl{
+class usrp2_clock_ctrl_impl : public usrp2_clock_ctrl{
 public:
-    clock_ctrl_impl(usrp2_iface::sptr iface){
+    usrp2_clock_ctrl_impl(usrp2_iface::sptr iface){
         _iface = iface;
 
         _ad9510_regs.cp_current_setting = ad9510_regs_t::CP_CURRENT_SETTING_3_0MA;
@@ -68,7 +68,7 @@ public:
 
     }
 
-    ~clock_ctrl_impl(void){
+    ~usrp2_clock_ctrl_impl(void){
         /* private clock enables, must be set here */
         this->enable_dac_clock(false);
         this->enable_adc_clock(false);
@@ -158,6 +158,6 @@ private:
 /***********************************************************************
  * Public make function for the ad9510 clock control
  **********************************************************************/
-clock_ctrl::sptr clock_ctrl::make(usrp2_iface::sptr iface){
-    return sptr(new clock_ctrl_impl(iface));
+usrp2_clock_ctrl::sptr usrp2_clock_ctrl::make(usrp2_iface::sptr iface){
+    return sptr(new usrp2_clock_ctrl_impl(iface));
 }
-- 
cgit v1.2.3


From 4f0736ef7ce93d58f0768d99257b2624d5711490 Mon Sep 17 00:00:00 2001
From: Josh Blum <josh@joshknows.com>
Date: Fri, 4 Jun 2010 12:32:06 -0700
Subject: move get clock rate into clock control

---
 host/lib/usrp/usrp2/clock_ctrl.cpp   | 4 ++++
 host/lib/usrp/usrp2/clock_ctrl.hpp   | 6 ++++++
 host/lib/usrp/usrp2/dboard_iface.cpp | 2 +-
 host/lib/usrp/usrp2/usrp2_iface.cpp  | 7 -------
 host/lib/usrp/usrp2/usrp2_iface.hpp  | 6 ------
 host/lib/usrp/usrp2/usrp2_impl.hpp   | 4 ++--
 6 files changed, 13 insertions(+), 16 deletions(-)

(limited to 'host/lib/usrp/usrp2/clock_ctrl.cpp')

diff --git a/host/lib/usrp/usrp2/clock_ctrl.cpp b/host/lib/usrp/usrp2/clock_ctrl.cpp
index 94920143d..d9baa66cf 100644
--- a/host/lib/usrp/usrp2/clock_ctrl.cpp
+++ b/host/lib/usrp/usrp2/clock_ctrl.cpp
@@ -110,6 +110,10 @@ public:
         this->update_regs();
     }
 
+    double get_master_clock_rate(void){
+        return 100e6;
+    }
+
 private:
     /*!
      * Write a single register to the spi regs.
diff --git a/host/lib/usrp/usrp2/clock_ctrl.hpp b/host/lib/usrp/usrp2/clock_ctrl.hpp
index 122b5e633..0ad8d9532 100644
--- a/host/lib/usrp/usrp2/clock_ctrl.hpp
+++ b/host/lib/usrp/usrp2/clock_ctrl.hpp
@@ -33,6 +33,12 @@ public:
      */
     static sptr make(usrp2_iface::sptr iface);
 
+    /*!
+     * Get the master clock frequency for the fpga.
+     * \return the clock frequency in Hz
+     */
+    virtual double get_master_clock_rate(void) = 0;
+
     /*!
      * Enable/disable the rx dboard clock.
      * \param enb true to enable
diff --git a/host/lib/usrp/usrp2/dboard_iface.cpp b/host/lib/usrp/usrp2/dboard_iface.cpp
index 5933f8e40..feee0a970 100644
--- a/host/lib/usrp/usrp2/dboard_iface.cpp
+++ b/host/lib/usrp/usrp2/dboard_iface.cpp
@@ -117,7 +117,7 @@ usrp2_dboard_iface::~usrp2_dboard_iface(void){
  * Clocks
  **********************************************************************/
 double usrp2_dboard_iface::get_clock_rate(unit_t){
-    return _iface->get_master_clock_freq();
+    return _clock_ctrl->get_master_clock_rate();
 }
 
 void usrp2_dboard_iface::set_clock_enabled(unit_t unit, bool enb){
diff --git a/host/lib/usrp/usrp2/usrp2_iface.cpp b/host/lib/usrp/usrp2/usrp2_iface.cpp
index e12c84d45..6e0d3266a 100644
--- a/host/lib/usrp/usrp2/usrp2_iface.cpp
+++ b/host/lib/usrp/usrp2/usrp2_iface.cpp
@@ -166,13 +166,6 @@ public:
         throw std::runtime_error("usrp2 no control response");
     }
 
-/***********************************************************************
- * Master Clock! Ahhhhh
- **********************************************************************/
-    double get_master_clock_freq(void){
-        return 100e6;
-    }
-
 private:
     //this lovely lady makes it all possible
     transport::udp_simple::sptr _ctrl_transport;
diff --git a/host/lib/usrp/usrp2/usrp2_iface.hpp b/host/lib/usrp/usrp2/usrp2_iface.hpp
index caf6623e2..7b2a3a89d 100644
--- a/host/lib/usrp/usrp2/usrp2_iface.hpp
+++ b/host/lib/usrp/usrp2/usrp2_iface.hpp
@@ -108,12 +108,6 @@ public:
         size_t num_bits,
         bool readback
     ) = 0;
-
-    /*!
-     * Get the master clock frequency.
-     * \return the frequency in Hz
-     */
-    virtual double get_master_clock_freq(void) = 0;
 };
 
 #endif /* INCLUDED_USRP2_IFACE_HPP */
diff --git a/host/lib/usrp/usrp2/usrp2_impl.hpp b/host/lib/usrp/usrp2/usrp2_impl.hpp
index 90306a85f..6ad151a0a 100644
--- a/host/lib/usrp/usrp2/usrp2_impl.hpp
+++ b/host/lib/usrp/usrp2/usrp2_impl.hpp
@@ -124,8 +124,8 @@ public:
     );
 
 private:
-    double get_master_clock_freq(void){
-        return _iface->get_master_clock_freq();
+    inline double get_master_clock_freq(void){
+        return _clock_ctrl->get_master_clock_rate();
     }
 
     //device properties interface
-- 
cgit v1.2.3