commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] r10233 - gnuradio/branches/developers/gnychis/inband_d


From: gnychis
Subject: [Commit-gnuradio] r10233 - gnuradio/branches/developers/gnychis/inband_dboard/usrp/host/lib/inband
Date: Thu, 15 Jan 2009 13:51:42 -0700 (MST)

Author: gnychis
Date: 2009-01-15 13:51:41 -0700 (Thu, 15 Jan 2009)
New Revision: 10233

Modified:
   
gnuradio/branches/developers/gnychis/inband_dboard/usrp/host/lib/inband/usrp_usb_interface.cc
   
gnuradio/branches/developers/gnychis/inband_dboard/usrp/host/lib/inband/usrp_usb_interface.h
Log:
adding in code for picking the TX and RX daughterboards

Modified: 
gnuradio/branches/developers/gnychis/inband_dboard/usrp/host/lib/inband/usrp_usb_interface.cc
===================================================================
--- 
gnuradio/branches/developers/gnychis/inband_dboard/usrp/host/lib/inband/usrp_usb_interface.cc
       2009-01-15 11:10:55 UTC (rev 10232)
+++ 
gnuradio/branches/developers/gnychis/inband_dboard/usrp/host/lib/inband/usrp_usb_interface.cc
       2009-01-15 20:51:41 UTC (rev 10233)
@@ -36,6 +36,7 @@
 #include "usrp_tx.h"
 #include "usrp_standard.h"
 #include <stdio.h>
+#include <usrp_dbid.h>
 
 typedef usrp_inband_usb_packet transport_pkt;
 
@@ -290,6 +291,8 @@
                                 16,          // nblocks for async transfers
                                 d_rbf
                                 );
+
+  d_ub_tx = d_utx;
   
   if(d_utx==0) {
     if (verbose)
@@ -486,5 +489,61 @@
   shutdown_all(PMT_T);
 }
 
+usrp_subdev_spec
+usrp_usb_interface::pick_rx_subdevice()
+{
+  int dbids[] = {
+    USRP_DBID_FLEX_400_RX,
+    USRP_DBID_FLEX_900_RX,
+    USRP_DBID_FLEX_1200_RX,
+    USRP_DBID_FLEX_2400_RX,
+    USRP_DBID_TV_RX,
+    USRP_DBID_TV_RX_REV_2,
+    USRP_DBID_DBS_RX,
+    USRP_DBID_DBS_RX_REV_2_1,
+    USRP_DBID_BASIC_RX
+  };
 
+  std::vector<int> candidates(dbids, dbids+(sizeof(dbids)/sizeof(int)));
+  return pick_subdev(d_ub_rx, candidates);
+}
+
+usrp_subdev_spec
+usrp_usb_interface::pick_tx_subdevice()
+{
+  int dbids[] = {
+    USRP_DBID_FLEX_400_TX,
+    USRP_DBID_FLEX_900_TX,
+    USRP_DBID_FLEX_1200_TX,
+    USRP_DBID_FLEX_2400_TX,
+    USRP_DBID_BASIC_TX
+  };
+
+  std::vector<int> candidates(dbids, dbids+(sizeof(dbids)/sizeof(int)));
+  return pick_subdev(d_ub_tx, candidates);
+}
+
+usrp_subdev_spec
+usrp_usb_interface::pick_subdev(boost::shared_ptr<usrp_basic> d_usrp_basic, 
std::vector<int> candidates)
+{
+  int dbid0 = d_usrp_basic->selected_subdev(usrp_subdev_spec(0, 0))->dbid();
+  int dbid1 = d_usrp_basic->selected_subdev(usrp_subdev_spec(1, 0))->dbid();
+
+  for (int i = 0; i < candidates.size(); i++) {
+    int dbid = candidates[i];
+    if (dbid0 == dbid)
+      return usrp_subdev_spec(0, 0);
+    if (dbid1 == dbid)
+      return usrp_subdev_spec(1, 0);
+  }
+
+  if (dbid0 >= 0)
+    return usrp_subdev_spec(0, 0);
+  if (dbid1 >= 0)
+    return usrp_subdev_spec(1, 0);
+
+  throw std::runtime_error("No suitable daughterboard found!");
+}
+
+
 REGISTER_MBLOCK_CLASS(usrp_usb_interface);

Modified: 
gnuradio/branches/developers/gnychis/inband_dboard/usrp/host/lib/inband/usrp_usb_interface.h
===================================================================
--- 
gnuradio/branches/developers/gnychis/inband_dboard/usrp/host/lib/inband/usrp_usb_interface.h
        2009-01-15 11:10:55 UTC (rev 10232)
+++ 
gnuradio/branches/developers/gnychis/inband_dboard/usrp/host/lib/inband/usrp_usb_interface.h
        2009-01-15 20:51:41 UTC (rev 10233)
@@ -34,6 +34,9 @@
 
   usrp_standard_tx_sptr d_utx;
   usrp_standard_rx_sptr d_urx;
+
+  boost::shared_ptr<usrp_basic> d_ub_tx;
+  boost::shared_ptr<usrp_basic> d_ub_rx;
   
   mb_port_sptr d_cs;
   mb_port_sptr  d_rx_cs;
@@ -58,6 +61,9 @@
   ~usrp_usb_interface();
   void initial_transition();
   void handle_message(mb_message_sptr msg);
+  usrp_subdev_spec pick_rx_subdevice();
+  usrp_subdev_spec pick_tx_subdevice();
+  usrp_subdev_spec pick_subdev(boost::shared_ptr<usrp_basic> d_usrp_basic, 
std::vector<int> candidates);
 
  private:
   void handle_cmd_open(pmt_t data);





reply via email to

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