commit-gnuradio
[Top][All Lists]
Advanced

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

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


From: trondeau
Subject: [Commit-gnuradio] r9304 - gnuradio/branches/developers/trondeau/dbs/gr-usrp/src
Date: Sun, 17 Aug 2008 21:01:54 -0600 (MDT)

Author: trondeau
Date: 2008-08-17 21:01:54 -0600 (Sun, 17 Aug 2008)
New Revision: 9304

Modified:
   gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/usrp1_base.cc
   gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/usrp1_sink.i
   gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/usrp1_sink_base.cc
   gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/usrp1_sink_base.h
Log:
Cleaning up and making same changes as r9303 to sink as to source (untested).

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-18 02:59:26 UTC (rev 9303)
+++ gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/usrp1_base.cc 
2008-08-18 03:01:54 UTC (rev 9304)
@@ -90,155 +90,6 @@
   }
 }
 
-#if 0
-int
-usrp1_base::determine_rx_mux_value(const std::vector<int> &subdev_spec)
-{
-  /*
-    Determine appropriate Rx mux value as a function of the subdevice choosen 
and the
-    characteristics of the respective daughterboard.
-    
-    @param u:           instance of USRP source
-    @param subdev_spec: return value from subdev option parser.  
-    @type  subdev_spec: (side, subdev), where side is 0 or 1 and subdev is 0 
or 1
-    @returns:           the Rx mux value
-  
-    Figure out which A/D's to connect to the DDC.
-    
-    Each daughterboard consists of 1 or 2 subdevices.  (At this time,
-    all but the Basic Rx have a single subdevice.  The Basic Rx
-    has two independent channels, treated as separate subdevices).
-    subdevice 0 of a daughterboard may use 1 or 2 A/D's.  We determine this
-    by checking the is_quadrature() method.  If subdevice 0 uses only a single
-    A/D, it's possible that the daughterboard has a second subdevice, 
subdevice 1,
-    and it uses the second A/D.
-    
-    If the card uses only a single A/D, we wire a zero into the DDC Q input.
-    
-    (side, 0) says connect only the A/D's used by subdevice 0 to the DDC.
-    (side, 1) says connect only the A/D's used by subdevice 1 to the DDC.
-  */
-
-  int side = subdev_spec[0];  // side A = 0, side B = 1
-  int spec = subdev_spec[1];
-
-  if(!((side == 0 || side == 1))) {
-    throw "Invalid subdev_spec";
-    //raise ValueError, "Invalid subdev_spec: %r:" % (subdev_spec,)
-  }
-
-  // This is a tuple of length 1 or 2 containing the subdevice
-  // classes for the selected side.
-  std::vector<db_base_sptr> db = (usrp_standard_rx*)d_usrp->db(side);
-  
-  unsigned int subdev0_uses, subdev1_uses, uses;
-
-  // compute bitmasks of used A/D's
-  
-  if(db[0]->is_quadrature()) {
-    subdev0_uses = 0x3;               // uses A/D 0 and 1
-  }
-  else {
-    subdev0_uses = 0x1;               // uses A/D 0 only
-  }
-
-  if(&db[1] != NULL) {                // test if we have 2 daughterboards
-    subdev1_uses = 0x2;               // uses A/D 1 only
-  }
-  else {
-    subdev1_uses = 0x0;              // uses no A/D (doesn't exist)
-  }
-  
-  if(spec == 0) {
-    uses = subdev0_uses;
-  }
-  else if(spec == 1) {
-    uses = subdev1_uses;
-  }
-  else {
-    throw std::runtime_error("Invalid subdev_spec");
-    //raise ValueError, "Invalid subdev_spec: %r: " % (subdev_spec,);
-  }
-
-  if(uses == 0) {
-    throw std::runtime_error("Daughterboard doesn't have a subdevice 1");
-    //raise RuntimeError, "Daughterboard doesn't have a subdevice 1: %r: " % 
(subdev_spec,);
-  }
-  
-  bool swap_iq = db[0]->i_and_q_swapped();
-  
-  truth_table_element_t truth_table[8] = {
-    // (side, uses, swap_iq) : mux_val
-    truth_table_element_t(0, 0x1, false, 0xf0f0f0f0),
-    truth_table_element_t(0, 0x2, false, 0xf0f0f0f1),
-    truth_table_element_t(0, 0x3, false, 0x00000010),
-    truth_table_element_t(0, 0x3, true,  0x00000001),
-    truth_table_element_t(1, 0x1, false, 0xf0f0f0f2),
-    truth_table_element_t(1, 0x2, false, 0xf0f0f0f3),
-    truth_table_element_t(1, 0x3, false, 0x00000032),
-    truth_table_element_t(1, 0x3, true,  0x00000023)
-  };
-  
-  truth_table_element_t match(side, uses, swap_iq);
-  
-  int i=0;
-  while((i < 8) && (truth_table[i] != match))
-    i++;
-
-  return hexint(truth_table[i].mux_val());
-}
-
-
-int
-usrp1_base::determine_tx_mux_value(const std::vector<int> &subdev_spec)
-{
-  /*
-    Determine appropriate Tx mux value as a function of the subdevice choosen.
-
-    @param u:           instance of USRP source
-    @param subdev_spec: return value from subdev option parser.  
-    @type  subdev_spec: (side, subdev), where side is 0 or 1 and subdev is 0
-    @returns:           the Rx mux value
-  
-    This is simpler than the rx case.  Either you want to talk
-    to side A or side B.  If you want to talk to both sides at once,
-    determine the value manually.
-  */
-
-  int side = subdev_spec[0];  // side A = 0, side B = 1
-  if(!((side == 0) || (side == 1))) {
-    throw "Invalid subdev_spec";
-    //raise ValueError, "Invalid subdev_spec: %r:" % (subdev_spec,)
-  }
-
-  std::vector<db_base_sptr> db = (usrp_standard_tx*)d_usrp->db(side);
-  
-  if(db[0]->i_and_q_swapped()) {
-    unsigned int mask[2] = {0x0089, 0x8900};
-    return hexint(mask[side]);
-  }
-  else {
-    unsigned int mask[2] = {0x0098, 0x9800};
-    return hexint(mask[side]);
-  }
-
-}
- 
-db_base_sptr
-usrp1_base::selected_subdev(const std::vector<int> &subdev_spec)
-{
-  /*
-    Return the user specified daughterboard subdevice.
-    
-    @param subdev_spec: return value from subdev option parser.
-    @type  subdev_spec: (side, subdev), where side is 0 or 1 and subdev is 0 
or 1
-    @returns: an weakref to an instance derived from db_base
-  */
-
-  return d_usrp->db(subdev_spec[0])[subdev_spec[1]];
-}
-#endif
-
 float 
 calc_dxc_freq(float target_freq, float baseband_freq, long fs, bool &inverted)
 {

Modified: gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/usrp1_sink.i
===================================================================
--- gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/usrp1_sink.i  
2008-08-18 02:59:26 UTC (rev 9303)
+++ gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/usrp1_sink.i  
2008-08-18 03:01:54 UTC (rev 9304)
@@ -55,6 +55,8 @@
  public:
   ~usrp1_sink_base ();
 
+  //std::vector<db_base_sptr> db(int which);
+
   bool set_interp_rate (unsigned int rate);
   bool set_nchannels (int nchan);
   bool set_mux (int mux);

Modified: 
gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/usrp1_sink_base.cc
===================================================================
--- gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/usrp1_sink_base.cc    
2008-08-18 02:59:26 UTC (rev 9303)
+++ gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/usrp1_sink_base.cc    
2008-08-18 03:01:54 UTC (rev 9304)
@@ -61,6 +61,41 @@
 {
 }
 
+int
+usrp1_base::determine_tx_mux_value(const std::vector<int> &subdev_spec)
+{
+  /*
+    Determine appropriate Tx mux value as a function of the subdevice choosen.
+
+    @param u:           instance of USRP source
+    @param subdev_spec: return value from subdev option parser.  
+    @type  subdev_spec: (side, subdev), where side is 0 or 1 and subdev is 0
+    @returns:           the Rx mux value
+  
+    This is simpler than the rx case.  Either you want to talk
+    to side A or side B.  If you want to talk to both sides at once,
+    determine the value manually.
+  */
+
+  int side = subdev_spec[0];  // side A = 0, side B = 1
+  if(!((side == 0) || (side == 1))) {
+    throw "Invalid subdev_spec";
+    //raise ValueError, "Invalid subdev_spec: %r:" % (subdev_spec,)
+  }
+
+  std::vector<db_base_sptr> db = (usrp_standard_tx*)d_usrp->db(side);
+  
+  if(db[0]->i_and_q_swapped()) {
+    unsigned int mask[2] = {0x0089, 0x8900};
+    return mask[side];
+  }
+  else {
+    unsigned int mask[2] = {0x0098, 0x9800};
+    return mask[side];
+  }
+
+}
+
 bool 
 usrp1_sink_base::start()
 {
@@ -138,13 +173,13 @@
 }
 
 bool
-usrp1_sink_base::set_nchannels (int nchan)
+usrp1_sink_base::set_nchannels (unsigned int nchan)
 {
   return d_usrp->set_nchannels (nchan);
 }
 
 bool
-usrp1_sink_base::set_mux (int mux)
+usrp1_sink_base::set_mux (unsigned int mux)
 {
   return d_usrp->set_mux (mux);
 }

Modified: 
gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/usrp1_sink_base.h
===================================================================
--- gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/usrp1_sink_base.h     
2008-08-18 02:59:26 UTC (rev 9303)
+++ gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/usrp1_sink_base.h     
2008-08-18 03:01:54 UTC (rev 9304)
@@ -88,8 +88,8 @@
    *   dac_freq () / interp_rate () * nchannels ()
    */
   bool set_interp_rate (unsigned int rate);
-  bool set_nchannels (int nchan);
-  bool set_mux (int mux);
+  bool set_nchannels (unsigned int nchan);
+  bool set_mux (unsigned int mux);
 
   /*!
    * \brief set the frequency of the digital up converter.





reply via email to

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