Hi,

attached are some small cleanups for the inband code. Some are just cosmetic 
changes, some give some small performance improvement (dont disassemble a 
list and assemble the same list again, just pass it on ...)

Regards,

Stefan

-- 
Stefan Brüns  /  Bergstraße 21  /  52062 Aachen
mailto:lurch at gmx.li  http://www.kawo1.rwth-aachen.de/~lurchi/
   phone: +49 241 53809034     mobile: +49 151 50412019
Index: usrp/host/lib/inband/usrp_tx.cc
===================================================================
--- usrp/host/lib/inband/usrp_tx.cc	(revision 10276)
+++ usrp/host/lib/inband/usrp_tx.cc	(working copy)
@@ -127,12 +127,11 @@
 	       pmt_list3(invocation_handle, PMT_F, channel));
   }
     
-  long n_packets = 
-    static_cast<long>(std::ceil(n_bytes / (double)transport_pkt::max_pkt_size()));
+  if(d_disk_write) {
+    for(int i=0; i < n_packets; i++) {
+      long n_packets = 
+        static_cast<long>(std::ceil(n_bytes / (double)transport_pkt::max_pkt_size()));
 
-  for(int i=0; i < n_packets; i++) {
-    
-    if(d_disk_write) {
       if(pkts[i].chan() == CONTROL_CHAN)
         d_cs_ofile.write((const char *)&pkts[i], transport_pkt::max_pkt_size());
       else
Index: usrp/host/lib/inband/usrp_server.cc
===================================================================
--- usrp/host/lib/inband/usrp_server.cc	(revision 10276)
+++ usrp/host/lib/inband/usrp_server.cc	(working copy)
@@ -215,8 +215,8 @@
     //-------------- USRP OPEN ------------------//
     if(pmt_eq(event, s_response_usrp_open)) {
       // pass the response back over the regular CS port
-      pmt_t status = pmt_nth(1, data);
-      d_cs->send(s_response_open, pmt_list2(invocation_handle, status));
+      status = pmt_nth(1, data);
+      d_cs->send(s_response_open, data);
 
       //reset_all_registers();
       //initialize_registers();
@@ -231,8 +231,8 @@
     }
     //------------- USRP CLOSE -------------------//
     else if (pmt_eq(event, s_response_usrp_close)) {
-      pmt_t status = pmt_nth(1, data);
-      d_cs->send(s_response_close, pmt_list2(invocation_handle, status));
+      status = pmt_nth(1, data);
+      d_cs->send(s_response_close, data);
 
       if(pmt_eqv(status,PMT_T)) {
         d_opened = false;
@@ -246,7 +246,6 @@
     //--------------- USRP WRITE --------------//
     else if (pmt_eq(event, s_response_usrp_write)) {
       
-      pmt_t status = pmt_nth(1, data);
       long channel = pmt_to_long(pmt_nth(2, data));
       long port;
 
@@ -257,6 +256,7 @@
 
       // Find the port through the owner of the channel
       if((port = tx_port_index(d_chaninfo_tx[channel].owner)) !=-1 )
+        status = pmt_nth(1, data);
         d_tx[port]->send(s_response_xmit_raw_frame, 
                          pmt_list2(invocation_handle, status));
       return;
@@ -264,7 +264,7 @@
     //--------------- USRP READ ---------------//
     else if (pmt_eq(event, s_response_usrp_read)) {
 
-      pmt_t status = pmt_nth(1, data);
+      status = pmt_nth(1, data);
 
       if(!pmt_eqv(status, PMT_T)) {
         std::cerr << "[USRP_SERVER] Error receiving packet\n";
Index: usrp/host/lib/inband/usrp_usb_interface.cc
===================================================================
--- usrp/host/lib/inband/usrp_usb_interface.cc	(revision 10276)
+++ usrp/host/lib/inband/usrp_usb_interface.cc	(working copy)
@@ -239,16 +239,7 @@
   if (pmt_eq(port_id, d_tx_cs->port_symbol())) {	
 
     if(pmt_eq(event, s_response_usrp_tx_write))  {
-
-      pmt_t invocation_handle = pmt_nth(0, data);
-      pmt_t status = pmt_nth(1, data);
-      pmt_t channel = pmt_nth(2, data);
-
-      d_cs->send(s_response_usrp_write,
-                 pmt_list3(invocation_handle,
-                           status,
-                           channel));
-
+      d_cs->send(s_response_usrp_write, data);
       return;
     }
 
@@ -458,8 +449,6 @@
 void
 usrp_usb_interface::handle_cmd_start_reading(pmt_t data)
 {
-  pmt_t invocation_handle = pmt_nth(0, data);
-  
   if(verbose)
     std::cout << "[USRP_USB_INTERFACE] Starting RX...\n";
 
_______________________________________________
Discuss-gnuradio mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio

Reply via email to