commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] r5853 - in gnuradio/branches/developers/gnychis/inband


From: gnychis
Subject: [Commit-gnuradio] r5853 - in gnuradio/branches/developers/gnychis/inband/usrp/host: apps lib/inband
Date: Wed, 27 Jun 2007 08:44:17 -0600 (MDT)

Author: gnychis
Date: 2007-06-27 08:44:14 -0600 (Wed, 27 Jun 2007)
New Revision: 5853

Modified:
   
gnuradio/branches/developers/gnychis/inband/usrp/host/apps/test_usrp_inband_cs.cc
   
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_usb_interface.cc
   
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_usb_interface.h
Log:
Allowing the application to set the interpolation rates and RBF file without
changing and recompiling usrp_usb_interface now


Modified: 
gnuradio/branches/developers/gnychis/inband/usrp/host/apps/test_usrp_inband_cs.cc
===================================================================
--- 
gnuradio/branches/developers/gnychis/inband/usrp/host/apps/test_usrp_inband_cs.cc
   2007-06-27 06:05:46 UTC (rev 5852)
+++ 
gnuradio/branches/developers/gnychis/inband/usrp/host/apps/test_usrp_inband_cs.cc
   2007-06-27 14:44:14 UTC (rev 5853)
@@ -37,6 +37,7 @@
 #include <ui_nco.h>
 #include <stdio.h>
 #include <string.h>
+#include <sys/time.h>
 #include <iostream>
 
 #include <symbols_usrp_server_cs.h>
@@ -45,6 +46,8 @@
 #include <symbols_usrp_tx.h>
 #include <symbols_usrp_rx.h>
 
+#define NBPING  10
+
 static bool verbose = false;
 
 class test_usrp_cs : public mb_mblock
@@ -55,6 +58,8 @@
   pmt_t                d_tx_chan;      // returned tx channel handle
   pmt_t                d_rx_chan;      // returned tx channel handle
 
+  struct timeval times[NBPING];
+
   enum state_t {
     INIT,
     OPENING_USRP,
@@ -127,6 +132,20 @@
                             PMT_T);
   }
 
+  // Set TX and RX interpolations
+  pmt_dict_set(usrp_dict,
+               pmt_intern("interp-tx"),
+               pmt_from_long(128));
+
+  pmt_dict_set(usrp_dict,
+               pmt_intern("interp-rx"),
+               pmt_from_long(16));
+
+  // Specify the RBF to use
+  pmt_dict_set(usrp_dict,
+               pmt_intern("rbf"),
+               pmt_intern("last3.rbf"));
+
   define_component("server", "usrp_server", usrp_dict);
 
   connect("self", "tx0", "server", "tx0");
@@ -335,23 +354,24 @@
     std::cout << "[TEST_USRP_INBAND_CS] Beginning transmission\n";
 
   sleep(1);
-//  build_and_send_ping();
-//  build_and_send_ping();
-//  build_and_send_ping();
-//  build_and_send_ping();
-//  build_and_send_ping();
-//  build_and_send_ping();
-//  build_and_send_ping();
-//  build_and_send_ping();
-//  build_and_send_ping();
-//  build_and_send_ping();
 
   build_and_send_next_frame(); // fire off 4 to start pipeline
   build_and_send_next_frame();
   build_and_send_next_frame();
   build_and_send_next_frame();
   
-  build_and_send_ping();
+  struct timezone tz;
+
+  for (int i(0); i < NBPING; i++)
+  {
+        
+    struct timeval *tv = (struct timeval*)malloc(sizeof(struct timeval));
+    gettimeofday(tv, &tz);
+    times[i] = *tv;
+    build_and_send_ping();
+
+    free(tv);
+  }
 }
 
 void

Modified: 
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_usb_interface.cc
===================================================================
--- 
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_usb_interface.cc
      2007-06-27 06:05:46 UTC (rev 5852)
+++ 
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_usb_interface.cc
      2007-06-27 14:44:14 UTC (rev 5853)
@@ -43,13 +43,16 @@
 #include <symbols_usrp_tx_cs.h>
 #include <symbols_usrp_rx_cs.h>
 
-static const bool verbose = false;
+static const bool verbose = true;
 
 // need to take number of TX and RX channels as parameter
 usrp_usb_interface::usrp_usb_interface(mb_runtime *rt, const std::string 
&instance_name, pmt_t user_arg)
   : mb_mblock(rt, instance_name, user_arg),
   d_fpga_debug(false),
-  d_fake_usrp(false)
+  d_fake_usrp(false),
+  d_interp_tx(16),
+  d_interp_rx(16),
+  d_rbf("inband_tx_rx.rbf")
 {
   // Dictionary for arguments to all of the components
   pmt_t usrp_dict = user_arg;
@@ -71,14 +74,47 @@
       }
     }
 
+    // Read the TX interpolations
+    if(pmt_t interp_tx = pmt_dict_ref(usrp_dict, 
+                                      pmt_intern("interp-tx"), 
+                                      PMT_NIL)) {
+      if(!pmt_eqv(interp_tx, PMT_NIL)) 
+        d_interp_tx = pmt_to_long(interp_tx);
+    }
+    
+    // Read the RX interpolations
+    if(pmt_t interp_rx = pmt_dict_ref(usrp_dict, 
+                                      pmt_intern("interp-rx"), 
+                                      PMT_NIL)) {
+      if(!pmt_eqv(interp_rx, PMT_NIL)) 
+        d_interp_rx = pmt_to_long(interp_rx);
+    }
+
+    // Read the RBF
+    if(pmt_t rbf = pmt_dict_ref(usrp_dict, 
+                                pmt_intern("rbf"), 
+                                PMT_NIL)) {
+      if(!pmt_eqv(rbf, PMT_NIL)) 
+        d_rbf = pmt_symbol_to_string(rbf);
+    }
   }
   
   if (verbose) {
+    std::cout << "[USRP_USB_INTERFACE] Setting USRP RBF to " 
+              << d_rbf << std::endl;
+    
+    std::cout << "[USRP_USB_INTERFACE] Setting TX interpolation to " 
+              << d_interp_tx << std::endl;
+          
+    std::cout << "[USRP_USB_INTERFACE] Setting RX interpolation to " 
+              << d_interp_rx << std::endl;
+
     std::cout << "[USRP_USB_INTERFACE] Using TX interface: " 
               << tx_interface << "\n";
 
     std::cout << "[USRP_USB_INTERFACE] Using RX interface: " 
               << rx_interface << "\n";
+
   }
 
   d_cs = define_port("cs", "usrp-interface-cs", true, mb_port::EXTERNAL);      
@@ -202,7 +238,7 @@
   }
 
  unhandled:
-  std::cout << "[usrp_usb_interface] unhandled msg: " << msg << std::endl;
+  std::cout << "[USRP_USB_INTERFACE] unhandled msg: " << msg << std::endl;
 }
 
 void
@@ -222,16 +258,13 @@
 
   // Open up a standard RX and TX for communication with the USRP
    
-  std::string rbf = "last3.rbf";
-  //std::string rbf = "";
-
   d_utx = usrp_standard_tx::make(which_usrp,
-                                128,           // 128/32 -> 4MS/s
-                                1,             // 1 channel
-                                -1,            // mux
-                                4096,          // USB block size
-                                16,            // nblocks for async transfers
-                                rbf
+                                d_interp_tx,
+                                1,                     // 1 channel
+                                -1,          // mux
+                                4096,        // USB block size
+                                16,          // nblocks for async transfers
+                                d_rbf
                                 );
   
   if(d_utx==0) {
@@ -257,13 +290,13 @@
 
   d_urx =
     usrp_standard_rx::make (which_usrp,
-                           16,         // interp = 4MS/s
-                           1,          // nchan
-                           -1,         // mux
-                           0,          // set blank mode to start
-                           4096,       // USB block size
-                           16,        // number of blocks for async transfers
-          rbf);
+                           d_interp_rx,                
+                           1,                  // nchan
+                           -1,           // mux
+                           0,            // set blank mode to start
+                           4096,         // USB block size
+                           16,           // number of blocks for async 
transfers
+          d_rbf);
 
   if(!d_urx) {
     if (verbose)
@@ -324,7 +357,7 @@
   pmt_t invocation_handle = pmt_nth(0, data);
   
   if(verbose)
-    std::cout << "[usrp_usb_interface] Starting RX...\n";
+    std::cout << "[USRP_USB_INTERFACE] Starting RX...\n";
 
   if(!d_fake_usrp)
     d_urx->start();
@@ -343,12 +376,12 @@
   
   if(!d_fake_usrp) {
     if(verbose)
-      std::cout << "[usrp_usb_interface] Stopping RX...\n";
+      std::cout << "[USRP_USB_INTERFACE] Stopping RX...\n";
     d_urx->stop();
   }
   else {
     if(verbose)
-      std::cout << "[usrp_usb_interface] Stopping fake RX...\n";
+      std::cout << "[USRP_USB_INTERFACE] Stopping fake RX...\n";
     usrp_rx_stop = true;  // extern to communicate with stub to wait
   }
 
@@ -366,7 +399,7 @@
   }
   
   if (verbose)
-    std::cout << "[usrp_usb_interface] Handling close request for USRP\n";
+    std::cout << "[USRP_USB_INTERFACE] Handling close request for USRP\n";
 
   delete d_utx;
   d_utx = 0;

Modified: 
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_usb_interface.h
===================================================================
--- 
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_usb_interface.h
       2007-06-27 06:05:46 UTC (rev 5852)
+++ 
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_usb_interface.h
       2007-06-27 14:44:14 UTC (rev 5853)
@@ -46,6 +46,11 @@
 
   bool d_fake_usrp;
 
+  long d_interp_tx;
+  long d_interp_rx;
+
+  std::string d_rbf;
+
  public:
   usrp_usb_interface(mb_runtime *rt, const std::string &instance_name, pmt_t 
user_arg);
   ~usrp_usb_interface();





reply via email to

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