commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] r5626 - gnuradio/branches/developers/eb/ibu/usrp/host/


From: eb
Subject: [Commit-gnuradio] r5626 - gnuradio/branches/developers/eb/ibu/usrp/host/lib/inband
Date: Sat, 2 Jun 2007 21:00:42 -0600 (MDT)

Author: eb
Date: 2007-06-02 21:00:41 -0600 (Sat, 02 Jun 2007)
New Revision: 5626

Modified:
   gnuradio/branches/developers/eb/ibu/usrp/host/lib/inband/
   
gnuradio/branches/developers/eb/ibu/usrp/host/lib/inband/qa_inband_usrp_server.cc
   gnuradio/branches/developers/eb/ibu/usrp/host/lib/inband/test_usrp_inband.cc
   gnuradio/branches/developers/eb/ibu/usrp/host/lib/inband/usrp_server.cc
   
gnuradio/branches/developers/eb/ibu/usrp/host/lib/inband/usrp_usb_interface.cc
   
gnuradio/branches/developers/eb/ibu/usrp/host/lib/inband/usrp_usb_interface_stub.cc
Log:
debugging output surpressed


Property changes on: gnuradio/branches/developers/eb/ibu/usrp/host/lib/inband
___________________________________________________________________
Name: svn:ignore
   - Makefile
Makefile.in
.la
.lo
.deps
.libs
*.la
*.lo
test_fusb
std_paths.h
usrp_dbid.py
usrp_dbid.h
usrp_dbid.cc
usrp_server_mbh.cc
test_inband

   + Makefile
Makefile.in
.la
.lo
.deps
.libs
*.la
*.lo
test_fusb
std_paths.h
usrp_dbid.py
usrp_dbid.h
usrp_dbid.cc
usrp_server_mbh.cc
test_inband
test_usrp_inband
test_usrp_tx
*_mbh.cc


Modified: 
gnuradio/branches/developers/eb/ibu/usrp/host/lib/inband/qa_inband_usrp_server.cc
===================================================================
--- 
gnuradio/branches/developers/eb/ibu/usrp/host/lib/inband/qa_inband_usrp_server.cc
   2007-06-03 01:01:32 UTC (rev 5625)
+++ 
gnuradio/branches/developers/eb/ibu/usrp/host/lib/inband/qa_inband_usrp_server.cc
   2007-06-03 03:00:41 UTC (rev 5626)
@@ -101,10 +101,11 @@
  
   // Use the stub with the usrp_server
   pmt_t usrp_server_dict = pmt_make_dict();
-  pmt_dict_set(usrp_server_dict, pmt_intern("usrp-interface"), 
pmt_intern("usrp_usb_interface_stub"));
+  pmt_dict_set(usrp_server_dict, pmt_intern("usrp-interface"),
+              pmt_intern("usrp_usb_interface_stub"));
 
   // Test the TX side
-  define_component("server", "usrp_server", pmt_list1(usrp_server_dict));
+  define_component("server", "usrp_server", usrp_server_dict);
   connect("self", "tx0", "server", "tx0");
   connect("self", "rx0", "server", "rx0");
   connect("self", "cs", "server", "cs");
@@ -130,7 +131,7 @@
 void
 qa_alloc_top::run_tests()
 {
-  std::cout << "[qa_alloc_top] Starting tests...\n";
+  // std::cout << "[qa_alloc_top] Starting tests...\n";
   // should be able to allocate 1 byte
   d_tx->send(s_cmd_allocate_channel, pmt_list2(PMT_T, pmt_from_long(1)));
   
@@ -173,15 +174,15 @@
       
     if(pmt_eq(msg->signal(), s_response_max_capacity)) {
       d_max_capacity = pmt_to_long(pmt_nth(2, data));
-      std::cout << "[qa_alloc_top] USRP has max capacity of " << 
d_max_capacity << "\n";
+      // std::cout << "[qa_alloc_top] USRP has max capacity of " << 
d_max_capacity << "\n";
     }
     else if(pmt_eq(msg->signal(), s_response_ntx_chan)) {
       d_ntx_chan = pmt_to_long(pmt_nth(2, data));
-      std::cout << "[qa_alloc_top] USRP tx channels: " << d_ntx_chan << "\n";
+      // std::cout << "[qa_alloc_top] USRP tx channels: " << d_ntx_chan << 
"\n";
     }
     else if(pmt_eq(msg->signal(), s_response_nrx_chan)) {
       d_nrx_chan = pmt_to_long(pmt_nth(2, data));
-      std::cout << "[qa_alloc_top] USRP rx channels: " << d_nrx_chan << "\n";
+      // std::cout << "[qa_alloc_top] USRP rx channels: " << d_nrx_chan << 
"\n";
     }
     else if(pmt_eq(msg->signal(), s_response_current_capacity_allocation)) {
       check_message(msg);
@@ -208,10 +209,11 @@
 
 
   if(!pmt_eqv(expected_result, result)) {
-    std::cout << "Got: " << result << " Expected: " << expected_result << "\n";
+    // std::cout << "Got: " << result << " Expected: " << expected_result << 
"\n";
     shutdown_all(PMT_F);
+    return;
   } else {
-    std::cout << "[qa_alloc_top] Received expected response for message " << 
d_nrecvd << "\n";
+    // std::cout << "[qa_alloc_top] Received expected response for message " 
<< d_nrecvd << "\n";
   }
 
   if(d_nrecvd == d_nmsgs_to_recv)
@@ -275,7 +277,7 @@
   pmt_dict_set(usrp_server_dict, pmt_intern("usrp-interface"), 
pmt_intern("usrp_usb_interface_stub"));
 
   // Test the TX side
-  define_component("server", "usrp_server", pmt_list1(usrp_server_dict));
+  define_component("server", "usrp_server", usrp_server_dict);
   connect("self", "tx0", "server", "tx0");
   connect("self", "rx0", "server", "rx0");
   connect("self", "cs", "server", "cs");
@@ -296,7 +298,7 @@
 void
 qa_dealloc_top::allocate_max()
 {
-  std::cout << "[qa_dealloc_top] Max allocating...\n";
+  // std::cout << "[qa_dealloc_top] Max allocating...\n";
 
   // Keep allocating until we hit the maximum number of channels
   for(int i=0; i < d_ntx_chan; i++) {
@@ -364,15 +366,15 @@
       
     if(pmt_eq(msg->signal(), s_response_max_capacity)) {
       d_max_capacity = pmt_to_long(pmt_nth(2, data));
-      std::cout << "[qa_dealloc_top] USRP has max capacity of " << 
d_max_capacity << "\n";
+      // std::cout << "[qa_dealloc_top] USRP has max capacity of " << 
d_max_capacity << "\n";
     }
     else if(pmt_eq(msg->signal(), s_response_ntx_chan)) {
       d_ntx_chan = pmt_to_long(pmt_nth(2, data));
-      std::cout << "[qa_dealloc_top] USRP tx channels: " << d_ntx_chan << "\n";
+      // std::cout << "[qa_dealloc_top] USRP tx channels: " << d_ntx_chan << 
"\n";
     }
     else if(pmt_eq(msg->signal(), s_response_nrx_chan)) {
       d_nrx_chan = pmt_to_long(pmt_nth(2, data));
-      std::cout << "[qa_dealloc_top] USRP rx channels: " << d_nrx_chan << "\n";
+      // std::cout << "[qa_dealloc_top] USRP rx channels: " << d_nrx_chan << 
"\n";
     }
     else if(pmt_eq(msg->signal(), s_response_current_capacity_allocation)) {
       // the final command is a capacity check which should be 0, then we 
shutdown
@@ -403,10 +405,11 @@
   d_ndealloc_recvd++;
 
   if(!pmt_eqv(expected_result, result)) {
-    std::cout << "Got: " << result << " Expected: " << expected_result << "\n";
+    // std::cout << "Got: " << result << " Expected: " << expected_result << 
"\n";
     shutdown_all(PMT_F);
+    return;
   } else {
-    std::cout << "[qa_dealloc_top] Received expected deallocation response for 
message " << d_ndealloc_recvd << "\n";
+    // std::cout << "[qa_dealloc_top] Received expected deallocation response 
for message " << d_ndealloc_recvd << "\n";
   }
 }
 
@@ -422,8 +425,9 @@
   d_nalloc_recvd++;
 
   if(pmt_eqv(status, PMT_F)) {
-    std::cout << "[qa_dealloc_top] Unexpected error response when allocating 
channels\n";
+    // std::cout << "[qa_dealloc_top] Unexpected error response when 
allocating channels\n";
     shutdown_all(PMT_F);
+    return;
   } else {
     // store all of the allocate channel numbers
     if(pmt_eq(msg->port_id(), d_tx->port_symbol()))
@@ -434,14 +438,14 @@
 
   if(d_nalloc_recvd == d_nalloc_to_recv) {
     
-    std::cout << "[qa_dealloc_top] Allocated TX channels: ";
+    // std::cout << "[qa_dealloc_top] Allocated TX channels: ";
     for(int i=0; i < (int)d_tx_chans.size(); i++)
       std::cout << d_tx_chans[i] << " ";
 
-    std::cout << "\n[qa_dealloc_top] Allocated RX channels: ";
+    // std::cout << "\n[qa_dealloc_top] Allocated RX channels: ";
     for(int i=0; i < (int)d_rx_chans.size(); i++)
       std::cout << d_rx_chans[i] << " ";
-    std::cout << "\n";
+    // std::cout << "\n";
 
     deallocate_all();   // once we've allocated all of our channels, try to 
dealloc them
   }
@@ -485,7 +489,7 @@
   pmt_dict_set(usrp_server_dict, pmt_intern("usrp-interface"), 
pmt_intern("usrp_usb_interface_stub"));
 
   // Test the TX side
-  define_component("server", "usrp_server", pmt_list1(usrp_server_dict));
+  define_component("server", "usrp_server", usrp_server_dict);
   connect("self", "cs", "server", "cs");
 }
 
@@ -500,7 +504,7 @@
 void
 qa_open_close_top::run_tests()
 {
-  std::cout << "[qa_open_close_top] Starting tests\n";
+  // std::cout << "[qa_open_close_top] Starting tests\n";
 
   // A close before an open should fail
   d_cs->send(s_cmd_close, pmt_list1(PMT_F));
@@ -546,10 +550,10 @@
   pmt_t result = pmt_nth(1, data);
 
   if(!pmt_eqv(expected_result, result)) {
-    std::cout << "[qa_open_close_top] FAILED check_cs... Got: " << result << " 
Expected: " << expected_result << " for event " << msg->signal() << "\n";
+    // std::cout << "[qa_open_close_top] FAILED check_cs... Got: " << result 
<< " Expected: " << expected_result << " for event " << msg->signal() << "\n";
     shutdown_all(PMT_F);
   } else {
-    std::cout << "[qa_open_close_top] Received expected CS response for 
message (" << msg->signal() << ")\n";
+    // std::cout << "[qa_open_close_top] Received expected CS response for 
message (" << msg->signal() << ")\n";
   }
 
 }
@@ -603,7 +607,7 @@
   pmt_dict_set(usrp_server_dict, pmt_intern("usrp-interface"), 
pmt_intern("usrp_usb_interface_stub"));
 
   // Test the TX side
-  define_component("server", "usrp_server", pmt_list1(usrp_server_dict));
+  define_component("server", "usrp_server", usrp_server_dict);
   connect("self", "tx0", "server", "tx0");
   connect("self", "rx0", "server", "rx0");
   connect("self", "cs", "server", "cs");
@@ -620,7 +624,7 @@
 void
 qa_tx_top::run_tests()
 {
-  std::cout << "[qa_tx_top] Starting tests\n";
+  // std::cout << "[qa_tx_top] Starting tests\n";
 
   // A transmit before an open should fail
   d_tx->send(s_cmd_xmit_raw_frame, pmt_list4(PMT_F, pmt_from_long(0), 
pmt_make_u32vector(transport_pkt::max_payload()/4, 0), pmt_from_long(0)));
@@ -674,8 +678,10 @@
 
   d_nmsg_recvd++;
 
-  if(d_nmsg_to_recv == d_nmsg_recvd)
+  if(d_nmsg_to_recv == d_nmsg_recvd){
     shutdown_all(PMT_T);
+    return;
+  }
 }
 
 void
@@ -687,10 +693,11 @@
   pmt_t result = pmt_nth(1, data);
 
   if(!pmt_eqv(expected_result, result)) {
-    std::cout << "[qa_tx_top] FAILED check_deallocation... Got: " << result << 
" Expected: " << expected_result << "\n";
+    // std::cout << "[qa_tx_top] FAILED check_deallocation... Got: " << result 
<< " Expected: " << expected_result << "\n";
     shutdown_all(PMT_F);
+    return;
   } else {
-    std::cout << "[qa_tx_top] Received expected deallocation response for 
message\n";
+    // std::cout << "[qa_tx_top] Received expected deallocation response for 
message\n";
   }
 }
 
@@ -704,10 +711,11 @@
   pmt_t channel = pmt_nth(2, data);
   
   if(!pmt_eqv(expected_result, result)) {
-    std::cout << "[qa_tx_top] FAILED check_allocation... Got: " << result << " 
Expected: " << expected_result << " for event " << msg->signal() << ")\n";
+    // std::cout << "[qa_tx_top] FAILED check_allocation... Got: " << result 
<< " Expected: " << expected_result << " for event " << msg->signal() << ")\n";
     shutdown_all(PMT_F);
+    return;
   } else {
-    std::cout << "[qa_tx_top] Received expected allocation response for 
message\n";
+    // std::cout << "[qa_tx_top] Received expected allocation response for 
message\n";
   }
   
   if(pmt_eqv(result, PMT_T)) {
@@ -728,10 +736,13 @@
   pmt_t result = pmt_nth(1, data);
   
   if(!pmt_eqv(expected_result, result)) {
-    std::cout << "[qa_tx_top] FAILED check_xmit... Got: " << result << " 
Expected: " << expected_result << " for event " << msg->signal() << ")\n";
+    //std::cout << "[qa_tx_top] FAILED check_xmit... Got: " << result
+    // << " Expected: " << expected_result
+    // << " for event " << msg->signal() << ")\n";
     shutdown_all(PMT_F);
+    return;
   } else {
-    std::cout << "[qa_tx_top] Received expected xmit response for message\n";
+    // std::cout << "[qa_tx_top] Received expected xmit response for 
message\n";
   }
 }
 
@@ -744,10 +755,12 @@
   pmt_t result = pmt_nth(1, data);
 
   if(!pmt_eqv(expected_result, result)) {
-    std::cout << "[qa_tx_top] FAILED check_cs... Got: " << result << " 
Expected: " << expected_result << " for event " << msg->signal() << "\n";
+    // std::cout << "[qa_tx_top] FAILED check_cs... Got: " << result << " 
Expected: " << expected_result << " for event " << msg->signal() << "\n";
     shutdown_all(PMT_F);
+    return;
   } else {
-    std::cout << "[qa_tx_top] Received expected CS response for message (" << 
msg->signal() << ")\n";
+    // std::cout << "[qa_tx_top] Received expected CS response for message ("
+    // << msg->signal() << ")\n";
   }
 
 }
@@ -763,8 +776,8 @@
   mb_runtime_sptr rt = mb_make_runtime();
   pmt_t result = PMT_T;
 
-  std::cout << "\n\n----------------------------\n";
-  std::cout << "    RUNNING OPEN/CLOSE TESTS  \n";
+  // std::cout << "\n\n----------------------------\n";
+  // std::cout << "    RUNNING OPEN/CLOSE TESTS  \n";
 
   rt->run("top", "qa_open_close_top", PMT_F, &result);
 
@@ -777,8 +790,8 @@
   mb_runtime_sptr rt = mb_make_runtime();
   pmt_t result = PMT_T;
 
-  std::cout << "\n\n----------------------------\n";
-  std::cout << "    RUNNING ALLOCATION TESTS  \n";
+  // std::cout << "\n\n----------------------------\n";
+  // std::cout << "    RUNNING ALLOCATION TESTS  \n";
 
   rt->run("top", "qa_alloc_top", PMT_F, &result);
   
@@ -791,8 +804,8 @@
   mb_runtime_sptr rt = mb_make_runtime();
   pmt_t result = PMT_T;
 
-  std::cout << "\n\n----------------------------\n";
-  std::cout << "  RUNNING DEALLOCATION TESTS  \n";
+  // std::cout << "\n\n----------------------------\n";
+  // std::cout << "  RUNNING DEALLOCATION TESTS  \n";
 
   rt->run("top", "qa_dealloc_top", PMT_F, &result);
   
@@ -805,8 +818,8 @@
   mb_runtime_sptr rt = mb_make_runtime();
   pmt_t result = PMT_T;
 
-  std::cout << "\n\n-----------------\n";
-  std::cout << "  RUNNING TX TESTS  \n";
+  // std::cout << "\n\n-----------------\n";
+  // std::cout << "  RUNNING TX TESTS  \n";
 
   rt->run("top", "qa_tx_top", PMT_F, &result);
   

Modified: 
gnuradio/branches/developers/eb/ibu/usrp/host/lib/inband/test_usrp_inband.cc
===================================================================
--- 
gnuradio/branches/developers/eb/ibu/usrp/host/lib/inband/test_usrp_inband.cc    
    2007-06-03 01:01:32 UTC (rev 5625)
+++ 
gnuradio/branches/developers/eb/ibu/usrp/host/lib/inband/test_usrp_inband.cc    
    2007-06-03 03:00:41 UTC (rev 5626)
@@ -156,7 +156,7 @@
   if(fake_usrp_p)
     pmt_dict_set(usrp_server_dict, pmt_intern("usrp-interface"), 
pmt_intern("usrp_usb_interface_stub"));
 
-  define_component("server", "usrp_server", pmt_list1(usrp_server_dict));
+  define_component("server", "usrp_server", usrp_server_dict);
   connect("self", "tx0", "server", "tx0");
   connect("self", "cs", "server", "cs");
 }

Modified: 
gnuradio/branches/developers/eb/ibu/usrp/host/lib/inband/usrp_server.cc
===================================================================
--- gnuradio/branches/developers/eb/ibu/usrp/host/lib/inband/usrp_server.cc     
2007-06-03 01:01:32 UTC (rev 5625)
+++ gnuradio/branches/developers/eb/ibu/usrp/host/lib/inband/usrp_server.cc     
2007-06-03 03:00:41 UTC (rev 5626)
@@ -75,6 +75,9 @@
 static pmt_t s_response_usrp_close = pmt_intern("response-usrp-close");
 static pmt_t s_response_usrp_write = pmt_intern("response-usrp-write");
 
+
+const static bool verbose = false;
+
 static std::string
 str(long x)
 {
@@ -91,17 +94,18 @@
   std::string usrp_interface = "usrp_usb_interface";
 
   // a dictionary is given for usrp server parameters, such as the interface 
to use
-  pmt_t usrp_dict = pmt_nth(0, user_arg);
+  pmt_t usrp_dict = user_arg;
   
-  if(!pmt_eqv(usrp_dict, PMT_NIL)) {
+  if (pmt_is_dict(usrp_dict) && pmt_dict_has_key(usrp_dict, 
pmt_intern("usrp-interface"))){
+    usrp_interface =
+      pmt_symbol_to_string(pmt_dict_ref(usrp_dict,
+                                       pmt_intern("usrp-interface"),
+                                       PMT_NIL));
+  }
 
-    if(pmt_dict_has_key(usrp_dict, pmt_intern("usrp-interface"))) 
-      usrp_interface = pmt_write_string(pmt_dict_ref(usrp_dict, 
pmt_intern("usrp-interface"), PMT_NIL));
+  if (verbose)
+    std::cout << "[USRP_SERVER] Using interface: " << usrp_interface << "\n";
 
-  }
-      
-  std::cout << "[USRP_SERVER] Using interface: " << usrp_interface << "\n";
-
   // control & status port
   d_cs = define_port("cs", "usrp-server-cs", true, mb_port::EXTERNAL); 
   d_cs_usrp = define_port("cs_usrp", "usrp-interface-cs", false, 
mb_port::INTERNAL);   
@@ -166,7 +170,7 @@
   pmt_t reply_data;
   pmt_t status;
 
-  if (1){
+  if (verbose){
     std::cout << "[USRP_SERVER] event: " << event << std::endl;
     std::cout << "[USRP_SERVER] port_id: " << port_id << std::endl;
   }
@@ -228,7 +232,8 @@
 
   // Checking for defer on all other messages
   if(d_defer) {
-    std::cout << "[USRP_SERVER] Received msg while deferring (" << 
msg->signal() << ")\n";
+    if (verbose)
+      std::cout << "[USRP_SERVER] Received msg while deferring (" << 
msg->signal() << ")\n";
     d_defer_queue.push(msg);
     return;
   }
@@ -421,7 +426,8 @@
       }
     }
 
-    std::cout << "[USRP_SERVER] Couldnt find a TX chan\n";
+    if (verbose)
+      std::cout << "[USRP_SERVER] Couldnt find a TX chan\n";
 
     reply_data = pmt_list3(invocation_handle, pmt_from_long(CHANNEL_UNAVAIL), 
PMT_NIL);  // no free TX chan found
     d_tx[port]->send(s_response_allocate_channel, reply_data);
@@ -447,7 +453,8 @@
       }
     }
 
-    std::cout << "[USRP_SERVER] Couldnt find a RX chan\n";
+    if (verbose)
+      std::cout << "[USRP_SERVER] Couldnt find a RX chan\n";
     reply_data = pmt_list3(invocation_handle, pmt_from_long(CHANNEL_UNAVAIL), 
PMT_NIL);  // no free RX chan found
     d_rx[port]->send(s_response_allocate_channel, reply_data);
     return;
@@ -567,7 +574,8 @@
 
     pkts[n_packets-1].set_end_of_burst();   // set the last packet's end of 
burst
 
-    std::cout << "[USRP_SERVER] Received raw frame invocation: " << 
invocation_handle << std::endl;
+    if (verbose)
+      std::cout << "[USRP_SERVER] Received raw frame invocation: " << 
invocation_handle << std::endl;
 
     // The actual response to the write will be generated by a 
s_response_usrp_write
     d_cs_usrp->send(s_cmd_usrp_write, pmt_list4(invocation_handle, 
pmt_from_long(channel), v_packets, 
pmt_from_long(n_packets*transport_pkt::max_pkt_size())));

Modified: 
gnuradio/branches/developers/eb/ibu/usrp/host/lib/inband/usrp_usb_interface.cc
===================================================================
--- 
gnuradio/branches/developers/eb/ibu/usrp/host/lib/inband/usrp_usb_interface.cc  
    2007-06-03 01:01:32 UTC (rev 5625)
+++ 
gnuradio/branches/developers/eb/ibu/usrp/host/lib/inband/usrp_usb_interface.cc  
    2007-06-03 03:00:41 UTC (rev 5626)
@@ -43,6 +43,8 @@
 static pmt_t s_response_usrp_close = pmt_intern("response-usrp-close");
 static pmt_t s_response_usrp_write = pmt_intern("response-usrp-write");
 
+static const bool verbose = false;
+
 // 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)
@@ -115,7 +117,8 @@
   long which_usrp = pmt_to_long(pmt_nth(1, data));
   pmt_t reply_data;
 
-  std::cout << "[USRP_USB_INTERFACE] Handling open request for USRP " << 
which_usrp << "\n";
+  if (verbose)
+    std::cout << "[USRP_USB_INTERFACE] Handling open request for USRP " << 
which_usrp << "\n";
 
   // Open up a standard RX and TX for communication with the USRP
    
@@ -127,14 +130,16 @@
     16);              // number of blocks for async transfers
 
   if(d_utx==0) {
-    std::cout << "[USRP_USB_INTERFACE] Failed to open TX\n";
+    if (verbose)
+      std::cout << "[USRP_USB_INTERFACE] Failed to open TX\n";
     reply_data = pmt_list2(invocation_handle, PMT_F);
     d_cs->send(s_response_usrp_open, reply_data);
     return;
   }
 
   if(!d_utx->set_tx_freq (0,0)) {  // try setting center freq to 0
-    std::cout << "[USRP_USB_INTERFACE] Failed to set center frequency on TX\n";
+    if (verbose)
+      std::cout << "[USRP_USB_INTERFACE] Failed to set center frequency on 
TX\n";
     reply_data = pmt_list2(invocation_handle, PMT_F);
     d_cs->send(s_response_usrp_open, reply_data);
     return;
@@ -142,7 +147,8 @@
 
   d_utx->start();
 
-  std::cout << "[USRP_USB_INTERFACE] Setup TX channel\n";
+  if (verbose)
+    std::cout << "[USRP_USB_INTERFACE] Setup TX channel\n";
 
   d_urx = usrp_standard_rx::make (which_usrp,
     16,               // interp = 32.0MB/s
@@ -153,14 +159,16 @@
     16);              // number of blocks for async transfers
 
   if(!d_urx) {
-    std::cout << "[usrp_server] Failed to open RX\n";
+    if (verbose)
+      std::cout << "[usrp_server] Failed to open RX\n";
     reply_data = pmt_list2(invocation_handle, PMT_F);
     d_cs->send(s_response_usrp_open, reply_data);
     return;
   }
 
   if(!d_urx->set_rx_freq (0,0)) {  // try setting center freq to 0
-    std::cout << "[usrp_server] Failed to set center frequency on RX\n";
+    if (verbose)
+      std::cout << "[usrp_server] Failed to set center frequency on RX\n";
     reply_data = pmt_list2(invocation_handle, PMT_F);
     d_cs->send(s_response_usrp_open, reply_data);
     return;
@@ -168,7 +176,8 @@
 
   d_urx->start();   // FIXME: currently causing a hang
   
-  std::cout << "[USRP_USB_INTERFACE] Setup RX channel\n";
+  if (verbose)
+    std::cout << "[USRP_USB_INTERFACE] Setup RX channel\n";
 
   d_cs->send(s_response_usrp_open, pmt_list2(invocation_handle, PMT_T));
 }
@@ -189,13 +198,15 @@
   int ret = d_utx->write (pkts, n_bytes, &underrun);
 
   if (ret == n_bytes) {
-    std::cout << "[usrp_server] Write of " << n_bytes << " successful\n";
+    if (verbose)
+      std::cout << "[usrp_server] Write of " << n_bytes << " successful\n";
     // need to respond with the channel so the USRP server knows who to 
forward the result of
     // the write to by looking up the owner of the channel
     d_cs->send(s_response_usrp_write, pmt_list3(invocation_handle, 
pmt_from_long(channel), PMT_T));
   }
   else {
-    std::cout << "[usrp_server] Error writing " << n_bytes << " bytes to USB 
bus\n";
+    if (verbose)
+      std::cout << "[usrp_server] Error writing " << n_bytes << " bytes to USB 
bus\n";
     // need to respond with the channel so the USRP server knows who to 
forward the result of
     // the write to by looking up the owner of the channel
     d_cs->send(s_response_usrp_write, pmt_list3(invocation_handle, 
pmt_from_long(channel), PMT_F));
@@ -209,7 +220,8 @@
 {
   pmt_t invocation_handle = pmt_nth(0, data);
   
-  std::cout << "[usrp_usb_interface] Handling close request for USRP\n";
+  if (verbose)
+    std::cout << "[usrp_usb_interface] Handling close request for USRP\n";
 
   delete d_utx;
 

Modified: 
gnuradio/branches/developers/eb/ibu/usrp/host/lib/inband/usrp_usb_interface_stub.cc
===================================================================
--- 
gnuradio/branches/developers/eb/ibu/usrp/host/lib/inband/usrp_usb_interface_stub.cc
 2007-06-03 01:01:32 UTC (rev 5625)
+++ 
gnuradio/branches/developers/eb/ibu/usrp/host/lib/inband/usrp_usb_interface_stub.cc
 2007-06-03 03:00:41 UTC (rev 5626)
@@ -43,6 +43,8 @@
 static pmt_t s_response_usrp_close = pmt_intern("response-usrp-close");
 static pmt_t s_response_usrp_write = pmt_intern("response-usrp-write");
 
+static const bool verbose = false;
+
 // need to take number of TX and RX channels as parameter
 usrp_usb_interface_stub::usrp_usb_interface_stub(mb_runtime *rt, const 
std::string &instance_name, pmt_t user_arg)
   : mb_mblock(rt, instance_name, user_arg)
@@ -116,9 +118,10 @@
   pmt_t rx_mode = pmt_nth(2, data);
   pmt_t reply_data;
 
-  std::cout << "[USRP_USB_INTERFACE_STUB] Handling open request for USRP " << 
which_usrp << "\n";
+  if (verbose)
+    std::cout << "[USRP_USB_INTERFACE_STUB] Handling open request for USRP " 
<< which_usrp << "\n";
 
-  usleep(2 * 1000000);  // artificial time to open the interface
+  usleep(2 * 1000);  // artificial time to open the interface
 
   d_cs->send(s_response_usrp_open, pmt_list2(invocation_handle, PMT_T));
 }
@@ -131,7 +134,8 @@
   
   d_cs->send(s_response_usrp_write, pmt_list3(invocation_handle, channel, 
PMT_T));
 
-  std::cout << "[USRP_USB_INTERFACE_STUB] Successful write\n";
+  if (verbose)
+    std::cout << "[USRP_USB_INTERFACE_STUB] Successful write\n";
 
   return;
 }
@@ -141,7 +145,8 @@
 {
   pmt_t invocation_handle = pmt_nth(0, data);
   
-  std::cout << "[USRP_USB_INTERFACE_STUB] Handling close request for USRP\n";
+  if (verbose)
+    std::cout << "[USRP_USB_INTERFACE_STUB] Handling close request for USRP\n";
 
   d_cs->send(s_response_usrp_close, pmt_list2(invocation_handle, PMT_T));
 





reply via email to

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