commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] r10457 - in gnuradio/trunk: gr-usrp/src grc/scripts gr


From: jblum
Subject: [Commit-gnuradio] r10457 - in gnuradio/trunk: gr-usrp/src grc/scripts grc/src/grc_gnuradio/usrp usrp/host/lib/legacy
Date: Tue, 17 Feb 2009 16:03:39 -0700 (MST)

Author: jblum
Date: 2009-02-17 16:03:39 -0700 (Tue, 17 Feb 2009)
New Revision: 10457

Modified:
   gnuradio/trunk/gr-usrp/src/usrp.i
   gnuradio/trunk/gr-usrp/src/usrp_sink_base.cc
   gnuradio/trunk/gr-usrp/src/usrp_sink_base.h
   gnuradio/trunk/gr-usrp/src/usrp_sink_base.i
   gnuradio/trunk/gr-usrp/src/usrp_source_base.cc
   gnuradio/trunk/gr-usrp/src/usrp_source_base.h
   gnuradio/trunk/gr-usrp/src/usrp_source_base.i
   gnuradio/trunk/grc/scripts/usrp_probe
   gnuradio/trunk/grc/src/grc_gnuradio/usrp/dual_usrp.py
   gnuradio/trunk/grc/src/grc_gnuradio/usrp/simple_usrp.py
   gnuradio/trunk/usrp/host/lib/legacy/usrp_standard.cc
   gnuradio/trunk/usrp/host/lib/legacy/usrp_standard.h
Log:
usrp methods for computing the mux for dual subdevices

Modified: gnuradio/trunk/gr-usrp/src/usrp.i
===================================================================
--- gnuradio/trunk/gr-usrp/src/usrp.i   2009-02-17 19:52:12 UTC (rev 10456)
+++ gnuradio/trunk/gr-usrp/src/usrp.i   2009-02-17 23:03:39 UTC (rev 10457)
@@ -48,14 +48,18 @@
   return self._real_selected_subdev(ss)
 
 # Allow subdev_spec to be tuple
-def __determine_tx_mux_value(self, subdev_spec):
+def __determine_tx_mux_value(self, subdev_spec, subdev_spec_=None):
     ss = usrp_subdev_spec(subdev_spec[0], subdev_spec[1])
-    return self._real_determine_tx_mux_value(ss)
+    if subdev_spec_ is None: return self._real_determine_tx_mux_value(ss)
+    ss_ = usrp_subdev_spec(subdev_spec_[0], subdev_spec_[1])
+    return self._real_determine_tx_mux_value(ss, ss_)
 
 # Allow subdev_spec to be tuple
-def __determine_rx_mux_value(self, subdev_spec):
+def __determine_rx_mux_value(self, subdev_spec, subdev_spec_=None):
     ss = usrp_subdev_spec(subdev_spec[0], subdev_spec[1])
-    return self._real_determine_rx_mux_value(ss)
+    if subdev_spec_ is None: return self._real_determine_rx_mux_value(ss)
+    ss_ = usrp_subdev_spec(subdev_spec_[0], subdev_spec_[1])
+    return self._real_determine_rx_mux_value(ss, ss_)
 
 # Allow subdev_spec to be tuple
 def __pick_subdev(self, candidates=[]):
@@ -86,12 +90,12 @@
     return u.tune(chan, subdev, target_freq)
 
 # Allow to be called as free function
-def determine_tx_mux_value(u, subdev_spec):
-    return u.determine_tx_mux_value(subdev_spec)
+def determine_tx_mux_value(u, subdev_spec, subdev_spec_=None):
+    return u.determine_tx_mux_value(subdev_spec, subdev_spec_)
 
 # Allow to be called as free function
-def determine_rx_mux_value(u, subdev_spec):
-    return u.determine_rx_mux_value(subdev_spec)
+def determine_rx_mux_value(u, subdev_spec, subdev_spec_=None):
+    return u.determine_rx_mux_value(subdev_spec, subdev_spec_)
 
 # Allow to be called as free function
 def selected_subdev(u, subdev_spec):

Modified: gnuradio/trunk/gr-usrp/src/usrp_sink_base.cc
===================================================================
--- gnuradio/trunk/gr-usrp/src/usrp_sink_base.cc        2009-02-17 19:52:12 UTC 
(rev 10456)
+++ gnuradio/trunk/gr-usrp/src/usrp_sink_base.cc        2009-02-17 23:03:39 UTC 
(rev 10457)
@@ -151,6 +151,12 @@
   return d_usrp->determine_tx_mux_value(ss);
 }
 
+int
+usrp_sink_base::determine_tx_mux_value(usrp_subdev_spec ss_a, usrp_subdev_spec 
ss_b)
+{
+  return d_usrp->determine_tx_mux_value(ss_a, ss_b);
+}
+
 bool
 usrp_sink_base::set_tx_freq (int channel, double freq)
 {

Modified: gnuradio/trunk/gr-usrp/src/usrp_sink_base.h
===================================================================
--- gnuradio/trunk/gr-usrp/src/usrp_sink_base.h 2009-02-17 19:52:12 UTC (rev 
10456)
+++ gnuradio/trunk/gr-usrp/src/usrp_sink_base.h 2009-02-17 23:03:39 UTC (rev 
10457)
@@ -88,6 +88,7 @@
   bool set_nchannels (int nchan);
   bool set_mux (int mux);
   int determine_tx_mux_value(usrp_subdev_spec ss);
+  int determine_tx_mux_value(usrp_subdev_spec ss_a, usrp_subdev_spec ss_b);
 
   /*!
    * \brief set the frequency of the digital up converter.

Modified: gnuradio/trunk/gr-usrp/src/usrp_sink_base.i
===================================================================
--- gnuradio/trunk/gr-usrp/src/usrp_sink_base.i 2009-02-17 19:52:12 UTC (rev 
10456)
+++ gnuradio/trunk/gr-usrp/src/usrp_sink_base.i 2009-02-17 23:03:39 UTC (rev 
10457)
@@ -35,6 +35,7 @@
   bool set_mux (int mux);
   %rename(_real_determine_tx_mux_value) determine_tx_mux_value;
   int determine_tx_mux_value(usrp_subdev_spec ss);
+  int determine_tx_mux_value(usrp_subdev_spec ss_a, usrp_subdev_spec ss_b);
   bool set_tx_freq (int channel, double freq);
   long dac_rate() const { return converter_rate(); }
   long dac_freq() const { return converter_rate(); }

Modified: gnuradio/trunk/gr-usrp/src/usrp_source_base.cc
===================================================================
--- gnuradio/trunk/gr-usrp/src/usrp_source_base.cc      2009-02-17 19:52:12 UTC 
(rev 10456)
+++ gnuradio/trunk/gr-usrp/src/usrp_source_base.cc      2009-02-17 23:03:39 UTC 
(rev 10457)
@@ -148,6 +148,12 @@
   return d_usrp->determine_rx_mux_value(ss);
 }
 
+int
+usrp_source_base::determine_rx_mux_value(usrp_subdev_spec ss_a, 
usrp_subdev_spec ss_b)
+{
+  return d_usrp->determine_rx_mux_value(ss_a, ss_b);
+}
+
 bool
 usrp_source_base::set_rx_freq (int channel, double freq)
 {

Modified: gnuradio/trunk/gr-usrp/src/usrp_source_base.h
===================================================================
--- gnuradio/trunk/gr-usrp/src/usrp_source_base.h       2009-02-17 19:52:12 UTC 
(rev 10456)
+++ gnuradio/trunk/gr-usrp/src/usrp_source_base.h       2009-02-17 23:03:39 UTC 
(rev 10457)
@@ -101,6 +101,7 @@
   bool set_nchannels (int nchan);
   bool set_mux (int mux);
   int determine_rx_mux_value(usrp_subdev_spec ss);
+  int determine_rx_mux_value(usrp_subdev_spec ss_a, usrp_subdev_spec ss_b);
 
   /*!
    * \brief set the center frequency of the digital down converter.

Modified: gnuradio/trunk/gr-usrp/src/usrp_source_base.i
===================================================================
--- gnuradio/trunk/gr-usrp/src/usrp_source_base.i       2009-02-17 19:52:12 UTC 
(rev 10456)
+++ gnuradio/trunk/gr-usrp/src/usrp_source_base.i       2009-02-17 23:03:39 UTC 
(rev 10457)
@@ -35,6 +35,7 @@
   bool set_mux (int mux);
   %rename(_real_determine_rx_mux_value) determine_rx_mux_value;
   int determine_rx_mux_value(usrp_subdev_spec ss);
+  int determine_rx_mux_value(usrp_subdev_spec ss_a, usrp_subdev_spec ss_b);
   bool set_rx_freq (int channel, double freq);
   bool set_fpga_mode (int mode);
   bool set_ddc_phase(int channel, int phase);

Modified: gnuradio/trunk/grc/scripts/usrp_probe
===================================================================
--- gnuradio/trunk/grc/scripts/usrp_probe       2009-02-17 19:52:12 UTC (rev 
10456)
+++ gnuradio/trunk/grc/scripts/usrp_probe       2009-02-17 23:03:39 UTC (rev 
10457)
@@ -81,19 +81,14 @@
                """Probe the USRP device and copy the results into the query 
text box."""
                dboard = usrp_dboard_param.evaluate()
                side = {'a': 0, 'b': 1}[dboard[-1]]
-               if dboard.startswith('rx'): #for the rx query, use the source 
and rx methods
-                       make = usrp.source_c
-                       get_mux = usrp.determine_rx_mux_value
-               elif dboard.startswith('tx'): #for the tx query, use the sink 
and tx methods
-                       make = usrp.sink_c
-                       get_mux = usrp.determine_tx_mux_value
+               if dboard.startswith('rx'): make = usrp.source_c
+               elif dboard.startswith('tx'): make = usrp.sink_c
                try:
                        u = make(which=usrp_which_param.evaluate())
                        subdev_spec = (side, 0)
                        subdev = usrp.selected_subdev(u, subdev_spec) #get the 
subdev
                        msg = ">>> USRP Probe\n"
                        msg = "%s\nName:\n\t%s\n"%(msg, str(subdev.name()))
-                       msg = "%s\nAutomated Mux:\n\t0x%08x\n"%(msg, 
0xFFFFFFFFL & long(get_mux(u, subdev_spec))) #ensure that the value is 
displayed as: 8 nibbles, unsigned, hex
                        msg = "%s\nConverter Rate:\n\t%s\n"%(msg, 
u.converter_rate())
                        msg = "%s\nUses Quadrature:\n\t%s\n"%(msg, 
str(subdev.is_quadrature()))
                        gain_min, gain_max, gain_step = subdev.gain_range()

Modified: gnuradio/trunk/grc/src/grc_gnuradio/usrp/dual_usrp.py
===================================================================
--- gnuradio/trunk/grc/src/grc_gnuradio/usrp/dual_usrp.py       2009-02-17 
19:52:12 UTC (rev 10456)
+++ gnuradio/trunk/grc/src/grc_gnuradio/usrp/dual_usrp.py       2009-02-17 
23:03:39 UTC (rev 10457)
@@ -42,16 +42,11 @@
                )
                #create usrp object
                self._make_usrp(which=which, nchan=2)
-               #get the mux for side A
                subdev_spec_a = common.to_spec('A', rx_ant_a)
-               self._subdev_a = usrp.selected_subdev(self._get_u(), 
subdev_spec_a)
-               mux_a = usrp.determine_rx_mux_value(self._get_u(), 
subdev_spec_a)
-               #get the mux for side B
                subdev_spec_b = common.to_spec('B', rx_ant_b)
-               self._subdev_b = usrp.selected_subdev(self._get_u(), 
subdev_spec_b)
-               mux_b = usrp.determine_rx_mux_value(self._get_u(), 
subdev_spec_b)
-               #move the lower byte of the mux b into the second byte of the 
mux a
-               self._get_u().set_mux(((mux_b & 0xff) << 8) | (mux_a - (mux_a & 
0xff00)))
+               
self._get_u().set_mux(self._get_u().determine_rx_mux_value(subdev_spec_a, 
subdev_spec_b))
+               self._subdev_a = self._get_u().selected_subdev(subdev_spec_a)
+               self._subdev_b = self._get_u().selected_subdev(subdev_spec_b)
                #connect
                deinter = gr.deinterleave(self._get_io_size())
                self.connect(self._get_u(), deinter)
@@ -97,16 +92,11 @@
                )
                #create usrp object
                self._make_usrp(which=which, nchan=2)
-               #get the mux for side A
                subdev_spec_a = common.to_spec('A')
-               self._subdev_a = usrp.selected_subdev(self._get_u(), 
subdev_spec_a)
-               mux_a = usrp.determine_tx_mux_value(self._get_u(), 
subdev_spec_a)
-               #get the mux for side B
                subdev_spec_b = common.to_spec('B')
-               self._subdev_b = usrp.selected_subdev(self._get_u(), 
subdev_spec_b)
-               mux_b = usrp.determine_tx_mux_value(self._get_u(), 
subdev_spec_b)
-               #set the mux
-               self._get_u().set_mux(mux_a | mux_b)
+               
self._get_u().set_mux(self._get_u().determine_tx_mux_value(subdev_spec_a, 
subdev_spec_b))
+               self._subdev_a = self._get_u().selected_subdev(subdev_spec_a)
+               self._subdev_b = self._get_u().selected_subdev(subdev_spec_b)
                #connect
                inter = gr.interleave(self._get_io_size())
                self.connect(inter, self._get_u())

Modified: gnuradio/trunk/grc/src/grc_gnuradio/usrp/simple_usrp.py
===================================================================
--- gnuradio/trunk/grc/src/grc_gnuradio/usrp/simple_usrp.py     2009-02-17 
19:52:12 UTC (rev 10456)
+++ gnuradio/trunk/grc/src/grc_gnuradio/usrp/simple_usrp.py     2009-02-17 
23:03:39 UTC (rev 10457)
@@ -46,8 +46,8 @@
                if self._no_hb: self._make_usrp(which=which, nchan=1, 
fpga_filename="std_4rx_0tx.rbf")
                else: self._make_usrp(which=which, nchan=1)
                subdev_spec = common.to_spec(side, rx_ant)
-               
self._get_u().set_mux(usrp.determine_rx_mux_value(self._get_u(), subdev_spec))
-               self._subdev = usrp.selected_subdev(self._get_u(), subdev_spec)
+               
self._get_u().set_mux(self._get_u().determine_rx_mux_value(subdev_spec))
+               self._subdev = self._get_u().selected_subdev(subdev_spec)
                if common.is_flex(rx_ant): 
self._subdev.select_rx_antenna(rx_ant)
                #connect
                self.connect(self._get_u(), self)
@@ -89,8 +89,8 @@
                #create usrp object
                self._make_usrp(which=which, nchan=1)
                subdev_spec = common.to_spec(side)
-               
self._get_u().set_mux(usrp.determine_tx_mux_value(self._get_u(), subdev_spec))
-               self._subdev = usrp.selected_subdev(self._get_u(), subdev_spec)
+               
self._get_u().set_mux(self._get_u().determine_tx_mux_value(subdev_spec))
+               self._subdev = self._get_u().selected_subdev(subdev_spec)
                #connect
                self.connect(self, self._get_u())
 

Modified: gnuradio/trunk/usrp/host/lib/legacy/usrp_standard.cc
===================================================================
--- gnuradio/trunk/usrp/host/lib/legacy/usrp_standard.cc        2009-02-17 
19:52:12 UTC (rev 10456)
+++ gnuradio/trunk/usrp/host/lib/legacy/usrp_standard.cc        2009-02-17 
23:03:39 UTC (rev 10457)
@@ -627,8 +627,23 @@
   throw std::runtime_error("internal error");
 }
 
+int
+usrp_standard_rx::determine_rx_mux_value(const usrp_subdev_spec &ss_a, const 
usrp_subdev_spec &ss_b)
+{
+  if (ss_a.side == ss_b.side && ss_a.subdev == ss_b.subdev){
+    throw std::runtime_error("Cannot compute dual mux, repeated subdevice");
+  }
+  std::vector<db_base_sptr> db_a = this->db(ss_a.side);
+  std::vector<db_base_sptr> db_b = this->db(ss_b.side);
+  if (db_a[ss_a.subdev]->is_quadrature() != 
db_b[ss_b.subdev]->is_quadrature()){
+    throw std::runtime_error("Cannot compute dual mux when mixing quadrature 
and non-quadrature subdevices");
+  }
+  int mux_a = determine_rx_mux_value(ss_a);
+  int mux_b = determine_rx_mux_value(ss_b);
+  //move the lower byte of the mux b into the second byte of the mux a
+  return ((mux_b & 0xff) << 8) | (mux_a & 0xffff00ff);
+}
 
-
 bool
 usrp_standard_rx::set_rx_freq (int channel, double freq)
 {
@@ -961,8 +976,21 @@
   }
 }
 
+int
+usrp_standard_tx::determine_tx_mux_value(const usrp_subdev_spec &ss_a, const 
usrp_subdev_spec &ss_b)
+{
+  if (ss_a.side == ss_b.side && ss_a.subdev == ss_b.subdev){
+    throw std::runtime_error("Cannot compute dual mux, repeated subdevice");
+  }
+  int mux_a = determine_tx_mux_value(ss_a);
+  //Get the mux b:
+  //   DAC0 becomes DAC2
+  //   DAC1 becomes DAC3
+  unsigned int mask[2] = {0x0022, 0x2200};
+  int mux_b = determine_tx_mux_value(ss_b) + mask[ss_b.side];
+  return mux_b | mux_a;
+}
 
-
 #ifdef USE_FPGA_TX_CORDIC
 
 bool

Modified: gnuradio/trunk/usrp/host/lib/legacy/usrp_standard.h
===================================================================
--- gnuradio/trunk/usrp/host/lib/legacy/usrp_standard.h 2009-02-17 19:52:12 UTC 
(rev 10456)
+++ gnuradio/trunk/usrp/host/lib/legacy/usrp_standard.h 2009-02-17 23:03:39 UTC 
(rev 10457)
@@ -179,6 +179,7 @@
    * and the characteristics of the respective daughterboard.
    */
   int determine_rx_mux_value(const usrp_subdev_spec &ss);
+  int determine_rx_mux_value(const usrp_subdev_spec &ss_a, const 
usrp_subdev_spec &ss_b);
 
   /*!
    * \brief set the frequency of the digital down converter.
@@ -389,6 +390,7 @@
    * and the characteristics of the respective daughterboard.
    */
   int determine_tx_mux_value(const usrp_subdev_spec &ss);
+  int determine_tx_mux_value(const usrp_subdev_spec &ss_a, const 
usrp_subdev_spec &ss_b);
 
   /*!
    * \brief set the frequency of the digital up converter.





reply via email to

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