commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] r9279 - gnuradio/branches/developers/trondeau/dbs/gr-u


From: trondeau
Subject: [Commit-gnuradio] r9279 - gnuradio/branches/developers/trondeau/dbs/gr-usrp/src
Date: Wed, 13 Aug 2008 23:05:17 -0600 (MDT)

Author: trondeau
Date: 2008-08-13 23:05:16 -0600 (Wed, 13 Aug 2008)
New Revision: 9279

Modified:
   gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/usrp1_base.cc
   gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/usrp1_base.h
   gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/usrp1_base.i
Log:
cleaning up

Modified: gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/usrp1_base.cc
===================================================================
--- gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/usrp1_base.cc 
2008-08-14 05:01:09 UTC (rev 9278)
+++ gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/usrp1_base.cc 
2008-08-14 05:05:16 UTC (rev 9279)
@@ -51,14 +51,14 @@
 
 
 
-usrp1_base::usrp1_base(const std::string &name, gr_io_signature_sptr insig, 
gr_io_signature_sptr outsig)
+usrp1_base::usrp1_base(const std::string &name, gr_io_signature_sptr insig,
+                      gr_io_signature_sptr outsig)
   : gr_sync_block (name, insig, outsig)
 {
 }
 
 usrp1_base::~usrp1_base ()
 {
-  //delete d_usrp;
 }
 
 int
@@ -75,7 +75,6 @@
   struct usb_device *d = usrp_find_device(which);
   if(!d) {
     throw std::runtime_error("Unable to find USRP");
-    //raise RuntimeError, "Unable to find USRP #%d" % (which,);
   }
  
   return usrp_hw_rev(d);
@@ -87,7 +86,6 @@
   int v = _look_for_usrp(which);
   if(!((v == 2) || (v = 4))) {
     throw std::runtime_error("Sorry, unsupported USRP revision");
-    // raise RuntimeError, "Sorry, unsupported USRP revision (rev=%d)" % (v,)
   }
 }
 
@@ -310,7 +308,7 @@
 
//******************************************************************************/
 
 struct subdev_spec
-pick_tx_subdevice(usrp1_base &u)
+pick_tx_subdevice(usrp_basic *u)
 {
   /*
     The user didn't specify a tx subdevice on the command line.
@@ -330,7 +328,7 @@
 }
 
 struct subdev_spec
-pick_rx_subdevice(usrp1_base &u)
+pick_rx_subdevice(usrp_basic *u)
 {
   /*
     The user didn't specify an rx subdevice on the command line.
@@ -354,7 +352,7 @@
 }
 
 struct subdev_spec 
-pick_subdev(usrp1_base &u, int candidates[], int ncandidates)
+pick_subdev(usrp_basic *u, int candidates[], int ncandidates)
 {
   /*
     @param u:          usrp instance
@@ -364,8 +362,8 @@
 
   struct subdev_spec ss;
   
-  int db0 = u.db(0)[0]->dbid();
-  int db1 = u.db(1)[0]->dbid();
+  int db0 = u->db(0)[0]->dbid();
+  int db1 = u->db(1)[0]->dbid();
   for(int i=0; i < ncandidates; i++) {
     if(candidates[i] == db0) {
       ss.side = 0;
@@ -389,6 +387,5 @@
     return ss;
   }
   
-  throw "No suitable daughterboard found!";
-  //raise RuntimeError, "No suitable daughterboard found!";
+  throw std::runtime_error("No suitable daughterboard found!");
 }

Modified: gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/usrp1_base.h
===================================================================
--- gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/usrp1_base.h  
2008-08-14 05:01:09 UTC (rev 9278)
+++ gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/usrp1_base.h  
2008-08-14 05:05:16 UTC (rev 9279)
@@ -35,11 +35,6 @@
 #include <iostream>
 #include <db_base.h>
 
-//#define FPGA_MODE_NORMAL   usrp_standard_rx::FPGA_MODE_NORMAL
-//#define FPGA_MODE_LOOPBACK usrp_standard_rx::FPGA_MODE_LOOPBACK
-//#define FPGA_MODE_COUNTING usrp_standard_rx::FPGA_MODE_COUNTING
-
-
 class truth_table_element_t 
 {
 public:
@@ -69,7 +64,6 @@
  protected:
   usrp_standard_common *d_usrp;
   int d_fpga_caps;
-  //db1_base *d_db[2];
 
   usrp1_base (const std::string &name, gr_io_signature_sptr insig, 
gr_io_signature_sptr outsig);
 
@@ -79,8 +73,9 @@
 
   virtual ~usrp1_base ();
 
-  std::vector<db_base_sptr> db(int which) { throw std::runtime_error("db() 
called from base class."); }
-
+  virtual std::vector<db_base_sptr> db(int which) 
+  { throw std::runtime_error("db called from base class\n"); }
+  
   virtual int determine_tx_mux_value(const std::vector<int> &subdev_spec) 
   { throw std::runtime_error("determing_tx_value called from base class\n"); }
   virtual int determine_rx_mux_value(const std::vector<int> &subdev_spec) 
@@ -96,11 +91,14 @@
 
   virtual void set_verbose (bool verbose) {}
 
-  // FIXME: throw exceptions properly
-  virtual bool set_tx_freq (int channel, double freq) { throw 
std::runtime_error("set_tx_freq called from base class\n"); } 
-  virtual bool set_rx_freq (int channel, double freq) { throw 
std::runtime_error("set_rx_freq called from base class\n"); }
-  virtual double tx_freq (int channel) const { throw 
std::runtime_error("tx_freq called from base class\n"); }
-  virtual double rx_freq (int channel) const { throw 
std::runtime_error("rx_freq called from base class\n"); }
+  virtual bool set_tx_freq (int channel, double freq) 
+  { throw std::runtime_error("set_tx_freq called from base class\n"); } 
+  virtual bool set_rx_freq (int channel, double freq) 
+  { throw std::runtime_error("set_rx_freq called from base class\n"); }
+  virtual double tx_freq (int channel) const 
+  { throw std::runtime_error("tx_freq called from base class\n"); }
+  virtual double rx_freq (int channel) const
+  { throw std::runtime_error("rx_freq called from base class\n"); }
 
   /*!
    * \brief Set Programmable Gain Amplifier (PGA)
@@ -399,8 +397,8 @@
   int spec;
 };
 
-struct subdev_spec pick_tx_subdevice(usrp1_base &u);
-struct subdev_spec pick_rx_subdevice(usrp1_base &u);
-struct subdev_spec pick_subdev(usrp1_base &u, int candidates[], int 
ncandidates);
+struct subdev_spec pick_tx_subdevice(usrp_basic *u);
+struct subdev_spec pick_rx_subdevice(usrp_basic *u);
+struct subdev_spec pick_subdev(usrp_basic *u, int candidates[], int 
ncandidates);
 
 #endif /* INCLUDED_USRP1_BASE_H */

Modified: gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/usrp1_base.i
===================================================================
--- gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/usrp1_base.i  
2008-08-14 05:01:09 UTC (rev 9278)
+++ gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/usrp1_base.i  
2008-08-14 05:05:16 UTC (rev 9279)
@@ -38,19 +38,19 @@
   int d_fpga_caps;
   
  protected:
-  usrp1_base () {}
-
+  usrp1_base ();
+  
  public:
   //! magic value used on alternate register read interfaces
   static const int READ_FAILED = -99999;
 
   virtual ~usrp1_base ();
 
-  std::vector<db_base_sptr> db(int which);
+  virtual std::vector<db_base_sptr> db(int which);
 
-  int determine_tx_mux_value(const std::vector<int> &subdev_spec);
-  int determine_rx_mux_value(const std::vector<int> &subdev_spec);
-  db_base_sptr selected_subdev(const std::vector<int> &subdev_spec);
+  virtual int determine_tx_mux_value(const std::vector<int> &subdev_spec);
+  virtual int determine_rx_mux_value(const std::vector<int> &subdev_spec);
+  virtual db_base_sptr selected_subdev(const std::vector<int> &subdev_spec);
 
   virtual bool start() {return false;}
   virtual bool stop() {return false;}
@@ -101,11 +101,12 @@
   virtual bool _write_spi (int optional_header, int enables, int format, 
std::string buf);
   virtual std::string _read_spi (int optional_header, int enables, int format, 
int len);
 
-  //tune_result tune(int chan, db_base *subdev, float target_freq);
-  
   bool has_rx_halfband();
   bool has_tx_halfband();
   int  nddc();
   int  nduc();
 };
 
+struct subdev_spec pick_tx_subdevice(usrp_basic *u);
+struct subdev_spec pick_rx_subdevice(usrp_basic *u);
+struct subdev_spec pick_subdev(usrp_basic *u, int candidates[], int 
ncandidates);





reply via email to

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