commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] r5858 - gnuradio/branches/developers/gnychis/inband/us


From: gnychis
Subject: [Commit-gnuradio] r5858 - gnuradio/branches/developers/gnychis/inband/usrp/host/apps
Date: Wed, 27 Jun 2007 12:55:54 -0600 (MDT)

Author: gnychis
Date: 2007-06-27 12:55:51 -0600 (Wed, 27 Jun 2007)
New Revision: 5858

Modified:
   
gnuradio/branches/developers/gnychis/inband/usrp/host/apps/test_usrp_inband_ping.cc
   
gnuradio/branches/developers/gnychis/inband/usrp/host/apps/test_usrp_inband_rx.cc
   
gnuradio/branches/developers/gnychis/inband/usrp/host/apps/test_usrp_inband_tx.cc
Log:
Updating the old TX and RX tests to setup the RBF and interpolation rates


Modified: 
gnuradio/branches/developers/gnychis/inband/usrp/host/apps/test_usrp_inband_ping.cc
===================================================================
--- 
gnuradio/branches/developers/gnychis/inband/usrp/host/apps/test_usrp_inband_ping.cc
 2007-06-27 18:26:04 UTC (rev 5857)
+++ 
gnuradio/branches/developers/gnychis/inband/usrp/host/apps/test_usrp_inband_ping.cc
 2007-06-27 18:55:51 UTC (rev 5858)
@@ -60,11 +60,15 @@
 
   pmt_t   d_which_usrp; // The USRP to use for the test
 
+  long    d_warm_msgs;  // The number of messages to 'warm' the USRP
+  long    d_warm_recvd; // The number of msgs received in the 'warm' state
+
   // Keep track of current state
   enum state_t {
     INIT,
     OPENING_USRP,
     ALLOCATING_CHANNELS,
+    WARMING_USRP,
     PINGING,
     CLOSING_CHANNELS,
     CLOSING_USRP,
@@ -80,6 +84,7 @@
  protected:
   void opening_usrp();
   void allocating_channels();
+  void enter_warming_usrp();
   void enter_pinging();
   void build_and_send_ping();
   void closing_channels();
@@ -205,7 +210,7 @@
 
           // If the RX has also been allocated already, we can continue
           if(!pmt_eqv(d_rx_chan, PMT_NIL)) 
-            enter_pinging();
+            enter_warming_usrp();
 
           return;
         }
@@ -232,7 +237,7 @@
 
           // If the TX has also been allocated already, we can continue
           if(!pmt_eqv(d_tx_chan, PMT_NIL)) 
-            enter_pinging();
+            enter_warming_usrp();
 
           return;
         }
@@ -244,6 +249,28 @@
 
       goto unhandled;
 
+    //----------------------- WARMING USRP --------------------//
+    // The FX2 seems to need some amount of data to be buffered
+    // before it begins reading.  We use this state to simply
+    // warm up the USRP before benchmarking pings.
+    case WARMING_USRP:
+
+      // We really don't care about the responses from the
+      // control channel in the warming stage, but once we receive
+      // the proper number of responses we switch states.
+      if(pmt_eq(event, s_response_from_control_channel)
+          && pmt_eq(d_rx->port_symbol(), port_id))
+      {
+        d_warm_recvd++;
+
+        if(d_warm_recvd > d_warm_msgs)
+          enter_pinging();
+
+        return;
+      }
+
+      goto unhandled;
+
     case PINGING:
       goto unhandled;
 
@@ -295,14 +322,51 @@
 void
 test_usrp_inband_ping::allocating_channels()
 {
+  d_state = ALLOCATING_CHANNELS;
+
   long capacity = (long) 16e6;
   d_tx->send(s_cmd_allocate_channel, pmt_list2(PMT_T, 
pmt_from_long(capacity)));
   d_rx->send(s_cmd_allocate_channel, pmt_list2(PMT_T, 
pmt_from_long(capacity)));
-  d_state = ALLOCATING_CHANNELS;
 }
 
+// The USRP needs some amount of initial data to pass a buffering point such
+// that it begins to pull and read data from the FX2.  We send an arbitrary
+// amount of data to start the pipeline, which are just pings.
 void
+test_usrp_inband_ping::enter_warming_usrp()
+{
+  d_state = WARMING_USRP;
+
+  for(int i=0; i < d_warm_msgs; i++)
+    build_and_send_ping();
+}
+
+void
 test_usrp_inband_ping::enter_pinging()
 {
+  d_state = PINGING;
   
+  if(verbose)
+    std::cout << "[TEST_USRP_INBAND_PING] Running ping tests\n";
+
 }
+
+// Pings are sent over the TX channel using the signal 'cmd-to-control-channel'
+// to the USRP server.  Within this message there can be infinite subpackets
+// stored as a list (the second parameter) and sent.  The only subpacket we 
send
+// is a ping, interpreted by the 'op-ping-fixed' signal.
+void
+test_usrp_inband_ping::build_and_send_ping()
+{
+  
+  d_tx->send(s_cmd_to_control_channel,    // USRP server signal
+             pmt_list2(PMT_NIL,           // invocation handle 
+                       pmt_list1(pmt_list3(s_op_ping_fixed, 
+                                           PMT_NIL, 
+                                           PMT_NIL))));
+
+  if(verbose)
+    std::cout << "[TEST_USRP_INBAND_PING] Ping!!" << std::endl;
+}
+
+REGISTER_MBLOCK_CLASS(test_usrp_inband_ping);

Modified: 
gnuradio/branches/developers/gnychis/inband/usrp/host/apps/test_usrp_inband_rx.cc
===================================================================
--- 
gnuradio/branches/developers/gnychis/inband/usrp/host/apps/test_usrp_inband_rx.cc
   2007-06-27 18:26:04 UTC (rev 5857)
+++ 
gnuradio/branches/developers/gnychis/inband/usrp/host/apps/test_usrp_inband_rx.cc
   2007-06-27 18:55:51 UTC (rev 5858)
@@ -120,15 +120,29 @@
   // Test the TX side
 
   // Pass a dictionary to usrp_server which specifies which interface to use, 
the stub or USRP
-  pmt_t usrp_server_dict = pmt_make_dict();
+  pmt_t usrp_dict = pmt_make_dict();
 
   if(fake_usrp_p)
-    pmt_dict_set(usrp_server_dict, 
+    pmt_dict_set(usrp_dict, 
                  pmt_intern("fake-usrp"),
                             PMT_T);
+  
+  // Specify the RBF to use
+  pmt_dict_set(usrp_dict,
+               pmt_intern("rbf"),
+               pmt_intern("last3.rbf"));
 
-  define_component("server", "usrp_server", usrp_server_dict);
+  // 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));
+
+  define_component("server", "usrp_server", usrp_dict);
+
   connect("self", "rx0", "server", "rx0");
   connect("self", "cs", "server", "cs");
 

Modified: 
gnuradio/branches/developers/gnychis/inband/usrp/host/apps/test_usrp_inband_tx.cc
===================================================================
--- 
gnuradio/branches/developers/gnychis/inband/usrp/host/apps/test_usrp_inband_tx.cc
   2007-06-27 18:26:04 UTC (rev 5857)
+++ 
gnuradio/branches/developers/gnychis/inband/usrp/host/apps/test_usrp_inband_tx.cc
   2007-06-27 18:55:51 UTC (rev 5858)
@@ -117,7 +117,21 @@
                  pmt_intern("fake-usrp"),
                             PMT_T);
   }
+  
+  // Specify the RBF to use
+  pmt_dict_set(usrp_dict,
+               pmt_intern("rbf"),
+               pmt_intern("last3.rbf"));
 
+  // 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));
+
   define_component("server", "usrp_server", usrp_dict);
 
   connect("self", "tx0", "server", "tx0");





reply via email to

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