commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] r10193 - in gnuradio/trunk: gr-usrp/src usrp/host/lib/


From: jcorgan
Subject: [Commit-gnuradio] r10193 - in gnuradio/trunk: gr-usrp/src usrp/host/lib/legacy
Date: Mon, 5 Jan 2009 11:05:17 -0700 (MST)

Author: jcorgan
Date: 2009-01-05 11:05:17 -0700 (Mon, 05 Jan 2009)
New Revision: 10193

Modified:
   gnuradio/trunk/gr-usrp/src/usrp_base.cc
   gnuradio/trunk/gr-usrp/src/usrp_base.h
   gnuradio/trunk/gr-usrp/src/usrp_base.i
   gnuradio/trunk/usrp/host/lib/legacy/usrp_basic.cc
   gnuradio/trunk/usrp/host/lib/legacy/usrp_basic.h
Log:
Allow setting of non-standard FPGA master clock frequency for USRP1

Modified: gnuradio/trunk/gr-usrp/src/usrp_base.cc
===================================================================
--- gnuradio/trunk/gr-usrp/src/usrp_base.cc     2009-01-05 05:04:11 UTC (rev 
10192)
+++ gnuradio/trunk/gr-usrp/src/usrp_base.cc     2009-01-05 18:05:17 UTC (rev 
10193)
@@ -83,6 +83,12 @@
 }
 
 void
+usrp_base::set_fpga_master_clock_freq(long master_clock)
+{
+  d_usrp_basic->set_fpga_master_clock_freq(master_clock);
+}
+
+void
 usrp_base::set_verbose (bool verbose)
 {  
   d_usrp_basic->set_verbose (verbose);

Modified: gnuradio/trunk/gr-usrp/src/usrp_base.h
===================================================================
--- gnuradio/trunk/gr-usrp/src/usrp_base.h      2009-01-05 05:04:11 UTC (rev 
10192)
+++ gnuradio/trunk/gr-usrp/src/usrp_base.h      2009-01-05 18:05:17 UTC (rev 
10193)
@@ -98,8 +98,17 @@
   /*!
    * \brief return frequency of master oscillator on USRP
    */
-  long  fpga_master_clock_freq() const;
+  long fpga_master_clock_freq() const;
 
+  /*!
+   * Tell API that the master oscillator on the USRP is operating at a 
non-standard 
+   * fixed frequency. This is only needed for custom USRP hardware modified to 
+   * operate at a different frequency from the default factory configuration. 
This
+   * function must be called prior to any other API function.
+   * \param master_clock USRP2 FPGA master clock frequency in Hz (10..64 MHz)
+   */
+  void set_fpga_master_clock_freq (long master_clock);
+
   void set_verbose (bool on);
 
   //! magic value used on alternate register read interfaces

Modified: gnuradio/trunk/gr-usrp/src/usrp_base.i
===================================================================
--- gnuradio/trunk/gr-usrp/src/usrp_base.i      2009-01-05 05:04:11 UTC (rev 
10192)
+++ gnuradio/trunk/gr-usrp/src/usrp_base.i      2009-01-05 18:05:17 UTC (rev 
10193)
@@ -38,7 +38,8 @@
   db_base_sptr db(int which_side, int which_dev);
   %rename (_real_selected_subdev) selected_subdev;
   db_base_sptr selected_subdev(usrp_subdev_spec ss);
-  long  fpga_master_clock_freq() const;
+  long fpga_master_clock_freq() const;
+  void set_fpga_master_clock_freq(long master_clock);
   void set_verbose (bool on);
   static const int READ_FAILED = -99999;
   bool write_eeprom (int i2c_addr, int eeprom_offset, const std::string buf);

Modified: gnuradio/trunk/usrp/host/lib/legacy/usrp_basic.cc
===================================================================
--- gnuradio/trunk/usrp/host/lib/legacy/usrp_basic.cc   2009-01-05 05:04:11 UTC 
(rev 10192)
+++ gnuradio/trunk/usrp/host/lib/legacy/usrp_basic.cc   2009-01-05 18:05:17 UTC 
(rev 10193)
@@ -112,7 +112,7 @@
   : d_udh (0),
     d_usb_data_rate (16000000),        // SWAG, see below
     d_bytes_per_poll ((int) (POLLING_INTERVAL * d_usb_data_rate)),
-    d_verbose (false), d_db(2)
+    d_verbose (false), d_fpga_master_clock_freq(64000000), d_db(2)
 {
   /*
    * SWAG: Scientific Wild Ass Guess.

Modified: gnuradio/trunk/usrp/host/lib/legacy/usrp_basic.h
===================================================================
--- gnuradio/trunk/usrp/host/lib/legacy/usrp_basic.h    2009-01-05 05:04:11 UTC 
(rev 10192)
+++ gnuradio/trunk/usrp/host/lib/legacy/usrp_basic.h    2009-01-05 18:05:17 UTC 
(rev 10193)
@@ -1,4 +1,3 @@
-
 /* -*- c++ -*- */
 /*
  * Copyright 2003,2004,2008 Free Software Foundation, Inc.
@@ -69,6 +68,7 @@
   int                   d_usb_data_rate;       // bytes/sec
   int                   d_bytes_per_poll;      // how often to poll for 
overruns
   bool                  d_verbose;
+  long                   d_fpga_master_clock_freq;
 
   static const int      MAX_REGS = 128;
   unsigned int          d_fpga_shadows[MAX_REGS];
@@ -177,9 +177,18 @@
   /*!
    * \brief return frequency of master oscillator on USRP
    */
-  long  fpga_master_clock_freq () const { return 64000000; }
+  long fpga_master_clock_freq () const { return d_fpga_master_clock_freq; }
 
   /*!
+   * Tell API that the master oscillator on the USRP is operating at a 
non-standard 
+   * fixed frequency. This is only needed for custom USRP hardware modified to 
+   * operate at a different frequency from the default factory configuration. 
This
+   * function must be called prior to any other API function.
+   * \param master_clock USRP2 FPGA master clock frequency in Hz (10..64 MHz)
+   */
+  void set_fpga_master_clock_freq (long master_clock) { 
d_fpga_master_clock_freq = master_clock; }
+
+  /*!
    * \returns usb data rate in bytes/sec
    */
   int usb_data_rate () const { return d_usb_data_rate; }





reply via email to

[Prev in Thread] Current Thread [Next in Thread]