commit-gnuradio
[Top][All Lists]
Advanced

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

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


From: gnychis
Subject: [Commit-gnuradio] r6653 - in gnuradio/branches/developers/gnychis/inband/usrp/host: apps-inband lib/inband
Date: Thu, 18 Oct 2007 11:16:39 -0600 (MDT)

Author: gnychis
Date: 2007-10-18 11:16:39 -0600 (Thu, 18 Oct 2007)
New Revision: 6653

Modified:
   
gnuradio/branches/developers/gnychis/inband/usrp/host/apps-inband/test_usrp_inband_rx.cc
   
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_rx_stub.cc
   
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_rx_stub.h
   
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_usb_interface.cc
Log:
Now passing the usrp_dict, which contains all of the information about the USRP
setup, down to the lowest level blocks also incase they are ever of use.

The stub now uses the dictionary to read the RX decimation rate for
implementation of some flow control.


Modified: 
gnuradio/branches/developers/gnychis/inband/usrp/host/apps-inband/test_usrp_inband_rx.cc
===================================================================
--- 
gnuradio/branches/developers/gnychis/inband/usrp/host/apps-inband/test_usrp_inband_rx.cc
    2007-10-18 15:44:49 UTC (rev 6652)
+++ 
gnuradio/branches/developers/gnychis/inband/usrp/host/apps-inband/test_usrp_inband_rx.cc
    2007-10-18 17:16:39 UTC (rev 6653)
@@ -91,12 +91,19 @@
     d_samples_recvd(0),
     d_samples_to_recv(20e6)
 { 
-  
   d_rx = define_port("rx0", "usrp-rx", false, mb_port::INTERNAL);
   d_cs = define_port("cs", "usrp-server-cs", false, mb_port::INTERNAL);
   
   // Pass a dictionary to usrp_server which specifies which interface to use, 
the stub or USRP
   pmt_t usrp_dict = pmt_make_dict();
+  
+  // To test the application without a USRP
+  bool fake_usrp_p = true;
+  if(fake_usrp_p) {
+    pmt_dict_set(usrp_dict, 
+                 pmt_intern("fake-usrp"),
+                            PMT_T);
+  }
 
   // Specify the RBF to use
   pmt_dict_set(usrp_dict,

Modified: 
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_rx_stub.cc
===================================================================
--- 
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_rx_stub.cc
    2007-10-18 15:44:49 UTC (rev 6652)
+++ 
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_rx_stub.cc
    2007-10-18 17:16:39 UTC (rev 6653)
@@ -40,7 +40,7 @@
 
 typedef usrp_inband_usb_packet transport_pkt;
 
-static const bool verbose = false;
+static const bool verbose = true;
 
 bool usrp_rx_stop_stub;
 
@@ -51,15 +51,32 @@
 usrp_rx_stub::usrp_rx_stub(mb_runtime *rt, const std::string &instance_name, 
pmt_t user_arg)
   : mb_mblock(rt, instance_name, user_arg),
     d_samples_per_frame((long)(126)),
+    d_decim_rx(128),
     d_amplitude(16384),
     d_disk_write(false)
 {
+
+  // Information about the rates are passed all the way from the app in the 
form
+  // of a dictionary.  We use this to read the RX decimation rate and compute
+  // the approximate number of MS/s as a form of flow control for the stub.
+  pmt_t usrp_dict = user_arg;
+
+  if (pmt_is_dict(usrp_dict)) {
+    // Read the RX decimation rate
+    if(pmt_t decim_rx = pmt_dict_ref(usrp_dict, 
+                                      pmt_intern("decim-rx"), 
+                                      PMT_NIL)) {
+      if(!pmt_eqv(decim_rx, PMT_NIL)) 
+        d_decim_rx = pmt_to_long(decim_rx);
+    }
+  }
+
   d_cs = define_port("cs", "usrp-rx-cs", true, mb_port::EXTERNAL);
   
   // initialize NCO
   double freq = 100e3;
   int interp = 32;                         // 32 -> 4MS/s
-  double sample_rate = 128e6 / interp; 
+  double sample_rate = 64e6 / interp;  
   d_nco.set_freq(2*M_PI * freq/sample_rate);
 
   //d_disk_write = true;
@@ -94,7 +111,8 @@
   if(pmt_eq(port_id, d_cs->port_symbol())) {
 
     if(verbose)
-      std::cout << "[USRP_RX_STUB] Starting...\n";
+      std::cout << "[USRP_RX_STUB] Starting with decim @ " 
+                << d_decim_rx << std::endl;
     
     if(pmt_eqv(event, s_cmd_usrp_rx_start_reading))
       read_and_respond(data);

Modified: 
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_rx_stub.h
===================================================================
--- 
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_rx_stub.h 
    2007-10-18 15:44:49 UTC (rev 6652)
+++ 
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_rx_stub.h 
    2007-10-18 17:16:39 UTC (rev 6653)
@@ -45,6 +45,7 @@
   usrp_standard_rx* d_urx;
   
   long         d_samples_per_frame;
+  long    d_decim_rx;
   
   // for generating sine wave output
   ui_nco<float,float>  d_nco;

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-10-18 15:44:49 UTC (rev 6652)
+++ 
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_usb_interface.cc
      2007-10-18 17:16:39 UTC (rev 6653)
@@ -87,7 +87,7 @@
         d_interp_tx = pmt_to_long(interp_tx);
     }
     
-    // Read the RX interpolations
+    // Read the RX decimation rate
     if(pmt_t decim_rx = pmt_dict_ref(usrp_dict, 
                                       pmt_intern("decim-rx"), 
                                       PMT_NIL)) {
@@ -135,8 +135,8 @@
   d_tx_cs = define_port("tx_cs", "usrp-tx-cs", false, mb_port::INTERNAL);      
 
   // Connect to TX and RX
-  define_component("tx", tx_interface, PMT_F);
-  define_component("rx", rx_interface, PMT_F);
+  define_component("tx", tx_interface, usrp_dict);
+  define_component("rx", rx_interface, usrp_dict);
   connect("self", "rx_cs", "rx", "cs");
   connect("self", "tx_cs", "tx", "cs");
   





reply via email to

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