commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] r6640 - in gnuradio/branches/features/inband-usb/usrp/


From: gnychis
Subject: [Commit-gnuradio] r6640 - in gnuradio/branches/features/inband-usb/usrp/host: apps-inband lib/inband lib/legacy
Date: Tue, 16 Oct 2007 22:25:15 -0600 (MDT)

Author: gnychis
Date: 2007-10-16 22:25:14 -0600 (Tue, 16 Oct 2007)
New Revision: 6640

Modified:
   
gnuradio/branches/features/inband-usb/usrp/host/apps-inband/test_usrp_inband_rx.cc
   
gnuradio/branches/features/inband-usb/usrp/host/apps-inband/test_usrp_inband_tx.cc
   
gnuradio/branches/features/inband-usb/usrp/host/apps-inband/test_usrp_inband_underrun.cc
   gnuradio/branches/features/inband-usb/usrp/host/lib/inband/usrp_rx.cc
   gnuradio/branches/features/inband-usb/usrp/host/lib/inband/usrp_rx.h
   gnuradio/branches/features/inband-usb/usrp/host/lib/inband/usrp_rx_stub.cc
   gnuradio/branches/features/inband-usb/usrp/host/lib/inband/usrp_rx_stub.h
   
gnuradio/branches/features/inband-usb/usrp/host/lib/inband/usrp_usb_interface.cc
   
gnuradio/branches/features/inband-usb/usrp/host/lib/inband/usrp_usb_interface.h
   gnuradio/branches/features/inband-usb/usrp/host/lib/legacy/fusb_linux.cc
Log:
Merge from -r6614:6637 developers/gnychis/inband-profiling to features branch


Modified: 
gnuradio/branches/features/inband-usb/usrp/host/apps-inband/test_usrp_inband_rx.cc
===================================================================
--- 
gnuradio/branches/features/inband-usb/usrp/host/apps-inband/test_usrp_inband_rx.cc
  2007-10-16 22:41:29 UTC (rev 6639)
+++ 
gnuradio/branches/features/inband-usb/usrp/host/apps-inband/test_usrp_inband_rx.cc
  2007-10-17 04:25:14 UTC (rev 6640)
@@ -89,7 +89,7 @@
 test_usrp_rx::test_usrp_rx(mb_runtime *runtime, const std::string 
&instance_name, pmt_t user_arg)
   : mb_mblock(runtime, instance_name, user_arg),
     d_samples_recvd(0),
-    d_samples_to_recv(5e6)
+    d_samples_to_recv(20e6)
 { 
   
   d_rx = define_port("rx0", "usrp-rx", false, mb_port::INTERNAL);
@@ -101,11 +101,11 @@
   // Specify the RBF to use
   pmt_dict_set(usrp_dict,
                pmt_intern("rbf"),
-               pmt_intern("nanocell9.rbf"));
+               pmt_intern("usrp_inband_profiling.rbf"));
 
   pmt_dict_set(usrp_dict,
                pmt_intern("decim-rx"),
-               pmt_from_long(128));
+               pmt_from_long(64));
 
   define_component("server", "usrp_server", usrp_dict);
 
@@ -266,6 +266,7 @@
 void
 test_usrp_rx::close_usrp()
 {
+
   d_cs->send(s_cmd_close, pmt_list1(PMT_NIL));
   d_state = CLOSING_USRP;
   
@@ -327,9 +328,7 @@
 test_usrp_rx::enter_closing_channel()
 {
   d_state = CLOSING_CHANNEL;
-  
-  sleep(2);
-  
+
   d_rx->send(s_cmd_deallocate_channel, pmt_list2(PMT_NIL, d_rx_chan));
   
   if(verbose)
@@ -344,10 +343,9 @@
 int
 main (int argc, char **argv)
 {
-  // handle any command line args here
-
   mb_runtime_sptr rt = mb_make_runtime();
   pmt_t result = PMT_NIL;
 
   rt->run("top", "test_usrp_rx", PMT_F, &result);
+
 }

Modified: 
gnuradio/branches/features/inband-usb/usrp/host/apps-inband/test_usrp_inband_tx.cc
===================================================================
--- 
gnuradio/branches/features/inband-usb/usrp/host/apps-inband/test_usrp_inband_tx.cc
  2007-10-16 22:41:29 UTC (rev 6639)
+++ 
gnuradio/branches/features/inband-usb/usrp/host/apps-inband/test_usrp_inband_tx.cc
  2007-10-17 04:25:14 UTC (rev 6640)
@@ -44,7 +44,7 @@
 #include <symbols_usrp_low_level_cs.h>
 #include <symbols_usrp_tx.h>
 
-static bool verbose = false;
+static bool verbose = true;
 
 class test_usrp_tx : public mb_mblock
 {
@@ -91,11 +91,9 @@
 
 test_usrp_tx::test_usrp_tx(mb_runtime *runtime, const std::string 
&instance_name, pmt_t user_arg)
   : mb_mblock(runtime, instance_name, user_arg),
-    d_state(INIT), d_nsamples_to_send((long) 40e6),
+    d_state(INIT), d_nsamples_to_send((long) 80e6),
     d_nsamples_xmitted(0),
     d_nframes_xmitted(0),
-    //d_samples_per_frame((long)(126)),
-    //d_samples_per_frame((long)(126 * 3.5)),  // non-full packet
     d_samples_per_frame((long)(126 * 4)),      // full packet
     d_done_sending(false),
     d_amplitude(16384)
@@ -121,18 +119,14 @@
   // Specify the RBF to use
   pmt_dict_set(usrp_dict,
                pmt_intern("rbf"),
-               pmt_intern("cs1.rbf"));
+               pmt_intern("usrp_inband_profiling.rbf"));
 
   // Set TX and RX interpolations
   pmt_dict_set(usrp_dict,
                pmt_intern("interp-tx"),
-               pmt_from_long(128));
+               pmt_from_long(64));
 
   pmt_dict_set(usrp_dict,
-               pmt_intern("decim-rx"),
-               pmt_from_long(16));
-  
-  pmt_dict_set(usrp_dict,
                pmt_intern("rf-freq"),
                pmt_from_long(10e6));
 
@@ -178,12 +172,12 @@
     if (pmt_eq(event, s_response_open)){
       status = pmt_nth(1, data);
       if (pmt_eq(status, PMT_T)){
-       allocate_channel();
-       return;
+        allocate_channel();
+        return;
       }
       else {
-       error_msg = "failed to open usrp:";
-       goto bail;
+        error_msg = "failed to open usrp:";
+        goto bail;
       }
     }
     goto unhandled;
@@ -194,12 +188,12 @@
       d_tx_chan = pmt_nth(2, data);
 
       if (pmt_eq(status, PMT_T)){
-       enter_transmitting();
-       return;
+        enter_transmitting();
+        return;
       }
       else {
-       error_msg = "failed to allocate channel:";
-       goto bail;
+        error_msg = "failed to allocate channel:";
+        goto bail;
       }
     }
     goto unhandled;
@@ -210,12 +204,12 @@
       status = pmt_nth(1, data);
 
       if (pmt_eq(status, PMT_T)){
-       handle_xmit_response(handle);
-       return;
+        handle_xmit_response(handle);
+        return;
       }
       else {
-       error_msg = "bad response-xmit-raw-frame:";
-       goto bail;
+        error_msg = "bad response-xmit-raw-frame:";
+        goto bail;
       }
     }
     goto unhandled;
@@ -225,12 +219,12 @@
       status = pmt_nth(1, data);
 
       if (pmt_eq(status, PMT_T)){
-       close_usrp();
-       return;
+        close_usrp();
+        return;
       }
       else {
-       error_msg = "failed to deallocate channel:";
-       goto bail;
+        error_msg = "failed to deallocate channel:";
+        goto bail;
       }
     }
     goto unhandled;
@@ -240,12 +234,12 @@
       status = pmt_nth(1, data);
 
       if (pmt_eq(status, PMT_T)){
-       shutdown_all(PMT_T);
-       return;
+        shutdown_all(PMT_T);
+        return;
       }
       else {
-       error_msg = "failed to close USRP:";
-       goto bail;
+        error_msg = "failed to close USRP:";
+        goto bail;
       }
     }
     goto unhandled;
@@ -274,6 +268,9 @@
 
   d_cs->send(s_cmd_open, pmt_list2(PMT_NIL, which_usrp));
   d_state = OPENING_USRP;
+  
+  if(verbose)
+    std::cout << "[TEST_USRP_INBAND_TX] Opening the USRP\n";
 }
 
 void
@@ -281,6 +278,9 @@
 {
   d_cs->send(s_cmd_close, pmt_list1(PMT_NIL));
   d_state = CLOSING_USRP;
+  
+  if(verbose)
+    std::cout << "[TEST_USRP_INBAND_TX] Closing the USRP\n";
 }
 
 void
@@ -289,6 +289,9 @@
   long capacity = (long) 16e6;
   d_tx->send(s_cmd_allocate_channel, pmt_list2(PMT_T, 
pmt_from_long(capacity)));
   d_state = ALLOCATING_CHANNEL;
+  
+  if(verbose)
+    std::cout << "[TEST_USRP_INBAND_TX] Requesting TX channel allocation\n";
 }
 
 void
@@ -297,15 +300,9 @@
   d_state = TRANSMITTING;
   d_nsamples_xmitted = 0;
   
-  // FIXME: carrier sense hack
-  d_tx->send(s_cmd_to_control_channel,    // C/S packet
-             pmt_list2(PMT_NIL,           // invoc handle
-                       pmt_list1(
-                            pmt_list2(s_op_write_reg, 
-                                      pmt_list2(
-                                      pmt_from_long(1), 
-                                      pmt_from_long(21))))));
-
+  if(verbose)
+    std::cout << "[TEST_USRP_INBAND_TX] Transmitting...\n";
+  
   build_and_send_next_frame(); // fire off 4 to start pipeline
   build_and_send_next_frame();
   build_and_send_next_frame();
@@ -358,9 +355,6 @@
   }
 
   pmt_t tx_properties = pmt_make_dict();
-  pmt_dict_set(tx_properties,
-               pmt_intern("carrier-sense"),
-               PMT_T);
 
   pmt_t timestamp = pmt_from_long(0xffffffff); // NOW
   d_tx->send(s_cmd_xmit_raw_frame,
@@ -373,7 +367,7 @@
   d_nsamples_xmitted += nsamples_this_frame;
   d_nframes_xmitted++;
 
-  if(verbose)
+  if(verbose && 0)
     std::cout << "[TEST_USRP_INBAND_TX] Transmitted frame\n";
 }
 
@@ -396,6 +390,9 @@
   d_state = CLOSING_CHANNEL;
   
   d_tx->send(s_cmd_deallocate_channel, pmt_list2(PMT_NIL, d_tx_chan));
+  
+  if(verbose)
+    std::cout << "[TEST_USRP_INBAND_tX] Deallocating TX channel\n";
 }
 
 REGISTER_MBLOCK_CLASS(test_usrp_tx);

Modified: 
gnuradio/branches/features/inband-usb/usrp/host/apps-inband/test_usrp_inband_underrun.cc
===================================================================
--- 
gnuradio/branches/features/inband-usb/usrp/host/apps-inband/test_usrp_inband_underrun.cc
    2007-10-16 22:41:29 UTC (rev 6639)
+++ 
gnuradio/branches/features/inband-usb/usrp/host/apps-inband/test_usrp_inband_underrun.cc
    2007-10-17 04:25:14 UTC (rev 6640)
@@ -129,7 +129,7 @@
   d_rx_chan(PMT_NIL),
   d_which_usrp(pmt_from_long(0)),
   d_state(INIT),
-  d_nsamples_to_send((long) 20e6),
+  d_nsamples_to_send((long) 27e6),
   d_nsamples_xmitted(0),
   d_nframes_xmitted(0),
   d_samples_per_frame(d_nsamples_to_send),     // full packet
@@ -145,12 +145,12 @@
   // Specify the RBF to use
   pmt_dict_set(usrp_dict,
                pmt_intern("rbf"),
-               pmt_intern("nanocell9.rbf"));
+               pmt_intern("usrp_inband_profiling.rbf"));
 
   // Set TX and RX interpolations
   pmt_dict_set(usrp_dict,
                pmt_intern("interp-tx"),
-               pmt_from_long(8));
+               pmt_from_long(64));
 
   pmt_dict_set(usrp_dict,
                pmt_intern("decim-rx"),
@@ -670,8 +670,6 @@
 {
   d_state = CLOSING_USRP;
 
-  sleep(2);
-
   d_cs->send(s_cmd_close, pmt_list1(PMT_NIL));
 }
 

Modified: gnuradio/branches/features/inband-usb/usrp/host/lib/inband/usrp_rx.cc
===================================================================
--- gnuradio/branches/features/inband-usb/usrp/host/lib/inband/usrp_rx.cc       
2007-10-16 22:41:29 UTC (rev 6639)
+++ gnuradio/branches/features/inband-usb/usrp/host/lib/inband/usrp_rx.cc       
2007-10-17 04:25:14 UTC (rev 6640)
@@ -40,6 +40,8 @@
 
 static const bool verbose = false;
 
+bool usrp_rx_stop;
+
 usrp_rx::usrp_rx(mb_runtime *rt, const std::string &instance_name, pmt_t 
user_arg)
   : mb_mblock(rt, instance_name, user_arg),
     d_disk_write(false)
@@ -52,6 +54,8 @@
     d_ofile.open("rx_data.dat",std::ios::binary|std::ios::out);
     d_cs_ofile.open("rx_cs.dat",std::ios::binary|std::ios::out);
   }
+  
+  usrp_rx_stop = false;
 
 }
 
@@ -104,7 +108,7 @@
     std::cout << "[usrp_rx] Waiting for packets..\n";
 
   // Read by 512 which is packet size and send them back up
-  while(1) {
+  while(!usrp_rx_stop) {
 
     pmt_t v_pkt = pmt_make_u8vector(pkt_size, 0);
     transport_pkt *pkt = 
@@ -124,7 +128,7 @@
 
     d_cs->send(s_response_usrp_rx_read, 
                pmt_list3(PMT_NIL, PMT_T, v_pkt));
-    if(verbose)
+    if(verbose && 0)
       std::cout << "[usrp_rx] Read 1 packet\n";
     
     if(d_disk_write) {
@@ -137,6 +141,13 @@
       d_ofile.flush();
     }
   }
+  
+  usrp_rx_stop = false;
+
+  if(verbose) {
+    std::cout << "[USRP_RX] Stopping...\n";
+    fflush(stdout);
+  }
 }
 
 REGISTER_MBLOCK_CLASS(usrp_rx);

Modified: gnuradio/branches/features/inband-usb/usrp/host/lib/inband/usrp_rx.h
===================================================================
--- gnuradio/branches/features/inband-usb/usrp/host/lib/inband/usrp_rx.h        
2007-10-16 22:41:29 UTC (rev 6639)
+++ gnuradio/branches/features/inband-usb/usrp/host/lib/inband/usrp_rx.h        
2007-10-17 04:25:14 UTC (rev 6640)
@@ -26,6 +26,8 @@
 
 class usrp_standard_rx;
 
+extern bool usrp_rx_stop;   // used to communicate a 'stop' to the RX stub
+
 /*!
  * \brief Implements the low level usb interface to the USRP
  */

Modified: 
gnuradio/branches/features/inband-usb/usrp/host/lib/inband/usrp_rx_stub.cc
===================================================================
--- gnuradio/branches/features/inband-usb/usrp/host/lib/inband/usrp_rx_stub.cc  
2007-10-16 22:41:29 UTC (rev 6639)
+++ gnuradio/branches/features/inband-usb/usrp/host/lib/inband/usrp_rx_stub.cc  
2007-10-17 04:25:14 UTC (rev 6640)
@@ -42,7 +42,7 @@
 
 static const bool verbose = false;
 
-bool usrp_rx_stop;
+bool usrp_rx_stop_stub;
 
 // Used for the fake control packet response code to send the responses back up
 // the RX.  The TX stub dumps responses in to this queue.
@@ -67,7 +67,7 @@
   if(d_disk_write)
     d_ofile.open("raw_rx.dat",std::ios::binary|std::ios::out);
   
-  usrp_rx_stop = false;
+  usrp_rx_stop_stub = false;
 }
 
 usrp_rx_stub::~usrp_rx_stub() 
@@ -105,7 +105,7 @@
 usrp_rx_stub::read_and_respond(pmt_t data)
 {
 
-  while(!usrp_rx_stop) {
+  while(!usrp_rx_stop_stub) {
 
     long nsamples_this_frame = d_samples_per_frame;
 
@@ -173,7 +173,7 @@
 
   }
   
-  usrp_rx_stop = false;
+  usrp_rx_stop_stub = false;
 
   if(verbose)
     std::cout << "[USRP_RX_STUB] Got fake RX stop\n";

Modified: 
gnuradio/branches/features/inband-usb/usrp/host/lib/inband/usrp_rx_stub.h
===================================================================
--- gnuradio/branches/features/inband-usb/usrp/host/lib/inband/usrp_rx_stub.h   
2007-10-16 22:41:29 UTC (rev 6639)
+++ gnuradio/branches/features/inband-usb/usrp/host/lib/inband/usrp_rx_stub.h   
2007-10-17 04:25:14 UTC (rev 6640)
@@ -31,7 +31,7 @@
 
 typedef usrp_inband_usb_packet transport_pkt;
 
-extern bool usrp_rx_stop;   // used to communicate a 'stop' to the RX stub
+extern bool usrp_rx_stop_stub;   // used to communicate a 'stop' to the RX stub
 extern std::queue<pmt_t> d_cs_queue;
 
 /*!

Modified: 
gnuradio/branches/features/inband-usb/usrp/host/lib/inband/usrp_usb_interface.cc
===================================================================
--- 
gnuradio/branches/features/inband-usb/usrp/host/lib/inband/usrp_usb_interface.cc
    2007-10-16 22:41:29 UTC (rev 6639)
+++ 
gnuradio/branches/features/inband-usb/usrp/host/lib/inband/usrp_usb_interface.cc
    2007-10-17 04:25:14 UTC (rev 6640)
@@ -53,6 +53,7 @@
   : mb_mblock(rt, instance_name, user_arg),
   d_fpga_debug(false),
   d_fake_usrp(false),
+  d_rx_reading(false),
   d_interp_tx(128),
   d_decim_rx(128),
   d_rf_freq(10e6),
@@ -381,6 +382,8 @@
 
   d_rx_cs->send(s_cmd_usrp_rx_start_reading, pmt_list2(PMT_NIL, rx_handle));
 
+  d_rx_reading = true;
+
   return;
 }
 
@@ -392,14 +395,17 @@
   if(!d_fake_usrp) {
     if(verbose)
       std::cout << "[USRP_USB_INTERFACE] Stopping RX...\n";
+    usrp_rx_stop = true;
     d_urx->stop();
   }
   else {
     if(verbose)
       std::cout << "[USRP_USB_INTERFACE] Stopping fake RX...\n";
-    usrp_rx_stop = true;  // extern to communicate with stub to wait
+    usrp_rx_stop_stub = true;  // extern to communicate with stub to wait
   }
 
+  d_rx_reading = false;
+
   return;
 }
 
@@ -408,6 +414,9 @@
 {
   pmt_t invocation_handle = pmt_nth(0, data);
 
+  if(d_rx_reading)
+    handle_cmd_stop_reading(PMT_NIL);
+
   if(d_fake_usrp) {
     d_cs->send(s_response_usrp_close, pmt_list2(invocation_handle, PMT_T));
     return;

Modified: 
gnuradio/branches/features/inband-usb/usrp/host/lib/inband/usrp_usb_interface.h
===================================================================
--- 
gnuradio/branches/features/inband-usb/usrp/host/lib/inband/usrp_usb_interface.h 
    2007-10-16 22:41:29 UTC (rev 6639)
+++ 
gnuradio/branches/features/inband-usb/usrp/host/lib/inband/usrp_usb_interface.h 
    2007-10-17 04:25:14 UTC (rev 6640)
@@ -46,6 +46,8 @@
 
   bool d_fake_usrp;
 
+  bool d_rx_reading;
+
   long d_interp_tx;
   long d_decim_rx;
 

Modified: 
gnuradio/branches/features/inband-usb/usrp/host/lib/legacy/fusb_linux.cc
===================================================================
--- gnuradio/branches/features/inband-usb/usrp/host/lib/legacy/fusb_linux.cc    
2007-10-16 22:41:29 UTC (rev 6639)
+++ gnuradio/branches/features/inband-usb/usrp/host/lib/legacy/fusb_linux.cc    
2007-10-17 04:25:14 UTC (rev 6640)
@@ -386,33 +386,28 @@
 {
   if (!d_started)
     return true;
-  
+
   d_devhandle->_cancel_pending_rqsts (this);
-  d_devhandle->_reap (false);
 
+  do {
+    d_devhandle->_reap (false);
+    usbdevfs_urb *urb;
+    while ((urb = completed_list_get ()) != 0)
+      free_list_add (urb);
 
-  usbdevfs_urb *urb;
-  while ((urb = completed_list_get ()) != 0)
-    free_list_add (urb);
+    if (d_write_work_in_progress){
+      free_list_add (d_write_work_in_progress);
+      d_write_work_in_progress = 0;
+    }
 
-  if (d_write_work_in_progress){
-    free_list_add (d_write_work_in_progress);
-    d_write_work_in_progress = 0;
-  }
+    if (d_read_work_in_progress){
+      free_list_add (d_read_work_in_progress);
+      d_read_work_in_progress = 0;
+      d_read_buffer = 0;
+      d_read_buffer_end = 0;
+    }
+  } while (d_free_list.size () != (unsigned) d_nblocks);
 
-  if (d_read_work_in_progress){
-    free_list_add (d_read_work_in_progress);
-    d_read_work_in_progress = 0;
-    d_read_buffer = 0;
-    d_read_buffer_end = 0;
-  }
-
-  if (d_free_list.size () != (unsigned) d_nblocks)
-    fprintf (stderr, "d_free_list.size () = %d, d_nblocks = %d\n",
-            d_free_list.size (), d_nblocks);
-    
-  assert (d_free_list.size () == (unsigned) d_nblocks);
-
   d_started = false;
   return true;
 }





reply via email to

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