kludge the legacy: usrp subdevice 2, the 3rd subdevice
authorjblum <jblum@221aa14e-8319-0410-a670-987f0aec2ac5>
Tue, 17 Feb 2009 02:33:08 +0000 (02:33 +0000)
committerjblum <jblum@221aa14e-8319-0410-a670-987f0aec2ac5>
Tue, 17 Feb 2009 02:33:08 +0000 (02:33 +0000)
git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@10448 221aa14e-8319-0410-a670-987f0aec2ac5

gnuradio-core/src/python/gnuradio/eng_option.py
grc/data/platforms/python/blocks/usrp_dual_source_x.xml
grc/data/platforms/python/blocks/usrp_simple_source_x.xml
grc/src/grc_gnuradio/usrp/common.py
grc/src/grc_gnuradio/usrp/dual_usrp.py
usrp/host/lib/legacy/db_basic.cc
usrp/host/lib/legacy/db_boards.cc
usrp/host/lib/legacy/usrp_standard.cc

index 40367d0d6218120e95571ae2c73a6be3fa53cd7e..09c3e1d87771a0a5a26ea2ce0f52b2f62a8def06 100644 (file)
@@ -63,13 +63,13 @@ def check_subdev (option, opt, value):
 
     @returns a 2-tuple (0|1, 0|1)
     """
-    d = { 'A'   : (0, 0),  'A:0' : (0, 0),  'A:1' : (0, 1),
-          'B'   : (1, 0),  'B:0' : (1, 0),  'B:1' : (1, 1) }
+    d = { 'A' : (0, 0), 'A:0' : (0, 0), 'A:1' : (0, 1), 'A:2' : (0, 2),
+          'B' : (1, 0), 'B:0' : (1, 0), 'B:1' : (1, 1), 'B:2' : (1, 2) }
     try:
         return d[value.upper()]
     except:
         raise OptionValueError(
-            "option %s: invalid subdev: '%r', must be one of A, B, A:0, A:1, B:0, B:1" % (opt, value))
+            "option %s: invalid subdev: '%r', must be one of %s" % (opt, value, ', '.join(sorted(d.keys()))))
 
 class eng_option (Option):
     TYPES = Option.TYPES + ("eng_float", "intx", "subdev")
index c37ae877c166e6dbb3daef7bf279862dbfa2fc4f..7d510f7be971bf4e379a941c84da791d45d407f1 100644 (file)
@@ -8,7 +8,7 @@
        <name>USRP Dual Source</name>
        <key>usrp_dual_source_x</key>
        <import>from grc_gnuradio import usrp as grc_usrp</import>
-       <make>grc_usrp.dual_source_$(type.fcn)(which=$which, side_a='$rx_ant_a.side', rx_ant_a='$rx_ant_a.rx_ant', side_b='$rx_ant_b.side', rx_ant_b='$rx_ant_b.rx_ant')
+       <make>grc_usrp.dual_source_$(type.fcn)(which=$which, rx_ant_a='$rx_ant_a', rx_ant_b='$rx_ant_b')
 #if $format.eval
 self.$(id).set_format(width=$format.width, shift=$format.shift)
 #end if
@@ -97,39 +97,29 @@ self.$(id).set_gain_b($gain_b)</make>
                <key>rx_ant_a</key>
                <type>enum</type>
                <option>
-                       <name>Side A, RXA</name>
-                       <key>A_RXA</key>
-                       <opt>side:A</opt>
-                       <opt>rx_ant:RXA</opt>
+                       <name>RXA</name>
+                       <key>RXA</key>
                        <opt>flex:</opt>
                </option>
                <option>
-                       <name>Side A, RXB</name>
-                       <key>A_RXB</key>
-                       <opt>side:A</opt>
-                       <opt>rx_ant:RXB</opt>
+                       <name>RXB</name>
+                       <key>RXB</key>
                        <opt>flex:</opt>
                </option>
                <option>
-                       <name>Side A, TX/RX</name>
-                       <key>A_TXRX</key>
-                       <opt>side:A</opt>
-                       <opt>rx_ant:TX/RX</opt>
-                       <opt>flex:1</opt>
+                       <name>RXAB</name>
+                       <key>RXAB</key>
+                       <opt>flex:</opt>
                </option>
                <option>
-                       <name>Side A, RX2</name>
-                       <key>A_RX2</key>
-                       <opt>side:A</opt>
-                       <opt>rx_ant:RX2</opt>
+                       <name>TX/RX</name>
+                       <key>TX/RX</key>
                        <opt>flex:1</opt>
                </option>
                <option>
-                       <name>Side B, RXA</name>
-                       <key>B_RXA</key>
-                       <opt>side:B</opt>
-                       <opt>rx_ant:RXA</opt>
-                       <opt>flex:</opt>
+                       <name>RX2</name>
+                       <key>RX2</key>
+                       <opt>flex:1</opt>
                </option>
        </param>
 <!--
@@ -142,42 +132,31 @@ self.$(id).set_gain_b($gain_b)</make>
                <key>rx_ant_b</key>
                <type>enum</type>
                <option>
-                       <name>Side B, RXA</name>
-                       <key>B_RXA</key>
-                       <opt>side:B</opt>
-                       <opt>rx_ant:RXA</opt>
+                       <name>RXA</name>
+                       <key>RXA</key>
                        <opt>flex:</opt>
                </option>
                <option>
-                       <name>Side B, RXB</name>
-                       <key>B_RXB</key>
-                       <opt>side:B</opt>
-                       <opt>rx_ant:RXB</opt>
+                       <name>RXB</name>
+                       <key>RXB</key>
                        <opt>flex:</opt>
                </option>
                <option>
-                       <name>Side B, TX/RX</name>
-                       <key>B_TXRX</key>
-                       <opt>side:B</opt>
-                       <opt>rx_ant:TX/RX</opt>
-                       <opt>flex:1</opt>
+                       <name>RXAB</name>
+                       <key>RXAB</key>
+                       <opt>flex:</opt>
                </option>
                <option>
-                       <name>Side B, RX2</name>
-                       <key>B_RX2</key>
-                       <opt>side:B</opt>
-                       <opt>rx_ant:RX2</opt>
+                       <name>TX/RX</name>
+                       <key>TX/RX</key>
                        <opt>flex:1</opt>
                </option>
                <option>
-                       <name>Side A, RXB</name>
-                       <key>A_RXB</key>
-                       <opt>side:A</opt>
-                       <opt>rx_ant:RXB</opt>
-                       <opt>flex:</opt>
+                       <name>RX2</name>
+                       <key>RX2</key>
+                       <opt>flex:1</opt>
                </option>
        </param>
-       <check>'$rx_ant_a' != '$rx_ant_b'</check>
        <source>
                <name>Aout</name>
                <type>$type</type>
@@ -191,10 +170,7 @@ The USRP source outputs 64 Megasamples per second / decimation.
 
 The "Receive Antenna Setting" selects one of the SMA connectors as the data source. \
 Flex RF boards use the "TX/RX" and "RX2" settings. \
-Basic RX and LFRX use the "RXA" and "RXB" settings. \
+Basic RX and LFRX use the "RXA", "RXB", and "RXAB" settings. \
 All other boards use the "RXA" setting.
-
-Flex RF boards only: If enabled, "Auto Transmit/Receive Switching" handles the preference for transmit packets vs receive packets. \
-By default, "Auto TR" is disabled.
        </doc>
 </block>
index 3fe6566d9b773c45e4359d6f6c874e4fad161715..6efe330d0159638c05541b838e24c2af7eeacc0e 100644 (file)
@@ -102,6 +102,11 @@ self.$(id).set_gain($gain)</make>
                        <key>RXB</key>
                        <opt>flex:</opt>
                </option>
+               <option>
+                       <name>RXAB</name>
+                       <key>RXAB</key>
+                       <opt>flex:</opt>
+               </option>
                <option>
                        <name>TX/RX</name>
                        <key>TX/RX</key>
@@ -137,12 +142,9 @@ The USRP source outputs 64 Megasamples per second / decimation.
 
 The "Receive Antenna Setting" selects one of the SMA connectors as the data source. \
 Flex RF boards use the "TX/RX" and "RX2" settings. \
-Basic RX and LFRX use the "RXA" and "RXB" settings. \
+Basic RX and LFRX use the "RXA", "RXB", and "RXAB" settings. \
 All other boards use the "RXA" setting.
 
-Flex RF boards only: If enabled, "Auto Transmit/Receive Switching" handles the preference for transmit packets vs receive packets. \
-By default, "Auto TR" is disabled.
-
 With the format set to 8 bits and the halfband filters disabled, the USRP can acheive a decimation rate of 4. \
 Disabling the halfband filters requires a special USRP firmware without halfband filters or TX paths. \
 For this reason, the USRP cannot transmit with the halfband filters disabled.
index 33eda351c8302e77cd3bc5eb0924f4615a661a01..65c1e7e296689b328e67dd160ee11f71f65f05e1 100644 (file)
@@ -63,10 +63,13 @@ def to_spec(side, rx_ant='RXA'):
        Convert the side to a spec number.
        @param side A or B
        @param rx_ant antenna type
-       @return the spec (0/1, 0/1)
+       @return the spec (0/1, 0/1/2)
        """
-       try: return (
-               {'A': 0, 'B': 1}[side.upper()], #side spec is 0 for A, 1 for B
-               rx_ant.upper() == 'RXB' and 1 or 0, #subdev spec is 1 for RXB
-       )
+       #determine the side spec
+       try: side_spec = {'A': 0, 'B': 1}[side.upper()]
        except: raise ValueError, 'Side A or B expected.'
+       #determine the subdevice spec
+       if rx_ant.upper() == 'RXB': subdev_spec = 1
+       elif rx_ant.upper() == 'RXAB': subdev_spec = 2
+       else: subdev_spec = 0
+       return (side_spec, subdev_spec)
index dd1e4605e511f5b17a2b507c5ea887183c5b5f19..47449ae788778ef2bb7dcd319a5a875cdd693ccd 100644 (file)
@@ -27,13 +27,11 @@ from gnuradio import gr, usrp
 class _dual_source(gr.hier_block2):
        """A dual usrp source of IO type short or complex."""
 
-       def __init__(self, which, side_a='A', rx_ant_a='RXA', side_b='B', rx_ant_b='RXA'):
+       def __init__(self, which, rx_ant_a='RXA', rx_ant_b='RXA'):
                """
                USRP dual source contructor.
                @param which the unit number
-               @param side_a A or B
                @param rx_ant_a the antenna choice
-               @param side_b A or B
                @param rx_ant_b the antenna choice
                """
                #initialize hier2 block
@@ -44,12 +42,12 @@ class _dual_source(gr.hier_block2):
                )
                #create usrp object
                self._make_usrp(which=which, nchan=2)
-               #get the mux for output A
-               subdev_spec_a = common.to_spec(side_a, rx_ant_a)
+               #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 output B
-               subdev_spec_b = common.to_spec(side_b, rx_ant_b)
+               #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
index 9c37c438e8ab587e5b3b8f3b3bb958e4b03e1bc0..4bafc9396a66cf52665bb9a79360fc372b34fa76 100644 (file)
@@ -197,7 +197,7 @@ db_basic_rx::is_quadrature()
 
   // This bit of info is useful when setting up the USRP Rx mux register.
   
-  return false;
+  return (d_subdev == 2);
 }
 
 
index 1ba8b0e7fc2b5318ca6b490638b37e120af691a1..2498f3c66a17d91819b4f9fd50ab5aad3e640253 100644 (file)
@@ -46,6 +46,7 @@ instantiate_dbs(int dbid, usrp_basic_sptr usrp, int which_side)
   case(USRP_DBID_BASIC_RX):
     db.push_back(db_base_sptr(new db_basic_rx(usrp, which_side, 0)));
     db.push_back(db_base_sptr(new db_basic_rx(usrp, which_side, 1)));
+    db.push_back(db_base_sptr(new db_basic_rx(usrp, which_side, 2)));
     break;
 
   case(USRP_DBID_LF_TX):
@@ -55,6 +56,7 @@ instantiate_dbs(int dbid, usrp_basic_sptr usrp, int which_side)
   case(USRP_DBID_LF_RX):
     db.push_back(db_base_sptr(new db_lf_rx(usrp, which_side, 0)));
     db.push_back(db_base_sptr(new db_lf_rx(usrp, which_side, 1)));
+    db.push_back(db_base_sptr(new db_lf_rx(usrp, which_side, 2)));
     break;
     
   case(USRP_DBID_DBS_RX):
index 2cc08a8fd873ea5e8bad357b58b1e9589a9aa869..d2360cc6f729f1aa8a06e4363a51cf3f81fa15b7 100644 (file)
@@ -585,32 +585,24 @@ usrp_standard_rx::determine_rx_mux_value(const usrp_subdev_spec &ss)
   // classes for the selected side.
   std::vector<db_base_sptr> db = this->db(ss.side);
   
-  unsigned int subdev0_uses, subdev1_uses, uses;
+  unsigned int 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.size() > 1)                   // more than 1 subdevice?
-    subdev1_uses = 0x2;               // uses A/D 1 only
-  else
-    subdev1_uses = 0x0;               // uses no A/D (doesn't exist)
-  
-  if(ss.subdev == 0)
-    uses = subdev0_uses;
+  if(db[ss.subdev]->is_quadrature())
+    uses = 0x3;               // uses A/D 0 and 1
+  else if (ss.subdev == 0)
+    uses = 0x1;               // uses A/D 0 only
   else if(ss.subdev == 1)
-    uses = subdev1_uses;
+    uses = 0x2;               // uses A/D 1 only
   else
-    throw std::invalid_argument("subdev_spec");
-
+    uses = 0x0;               // uses no A/D (doesn't exist)
+  
   if(uses == 0){
-    throw std::runtime_error("Daughterboard doesn't have a subdevice 1");
+    throw std::runtime_error("Determine RX Mux Error");
   }
   
-  bool swap_iq = db[0]->i_and_q_swapped();
+  bool swap_iq = db[ss.subdev]->i_and_q_swapped();
   
   truth_table_element truth_table[8] = {
     // (side, uses, swap_iq) : mux_val
@@ -959,7 +951,7 @@ usrp_standard_tx::determine_tx_mux_value(const usrp_subdev_spec &ss)
 
   std::vector<db_base_sptr> db = this->db(ss.side);
   
-  if(db[0]->i_and_q_swapped()) {
+  if(db[ss.subdev]->i_and_q_swapped()) {
     unsigned int mask[2] = {0x0089, 0x8900};
     return mask[ss.side];
   }