commit-gnuradio
[Top][All Lists]
Advanced

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

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


From: gnychis
Subject: [Commit-gnuradio] r5717 - gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband
Date: Wed, 6 Jun 2007 16:41:30 -0600 (MDT)

Author: gnychis
Date: 2007-06-06 16:41:29 -0600 (Wed, 06 Jun 2007)
New Revision: 5717

Modified:
   
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/qa_inband_usrp_server.cc
Log:
Cleaned up allocation QA code


Modified: 
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/qa_inband_usrp_server.cc
===================================================================
--- 
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/qa_inband_usrp_server.cc
   2007-06-06 22:35:12 UTC (rev 5716)
+++ 
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/qa_inband_usrp_server.cc
   2007-06-06 22:41:29 UTC (rev 5717)
@@ -122,14 +122,27 @@
 qa_alloc_top::initial_transition()
 {
   // Allocations should fail before open
-  d_tx->send(s_cmd_allocate_channel, 
pmt_list2(pmt_list2(s_response_allocate_channel,PMT_F), pmt_from_long(1)));
-  d_rx->send(s_cmd_allocate_channel, 
pmt_list2(pmt_list2(s_response_allocate_channel,PMT_F), pmt_from_long(1)));
+  d_tx->send(s_cmd_allocate_channel, 
+             pmt_list2(pmt_list2(s_response_allocate_channel, PMT_F), 
+                       pmt_from_long(1)));
 
+  d_rx->send(s_cmd_allocate_channel, 
+             pmt_list2(pmt_list2(s_response_allocate_channel,PMT_F), 
+                       pmt_from_long(1)));
+
   // Retrieve information about the USRP, then run tests
-  d_cs->send(s_cmd_open, pmt_list2(pmt_list2(s_response_open,PMT_T), 
pmt_from_long(0)));
-  d_cs->send(s_cmd_max_capacity, 
pmt_list1(pmt_list2(s_response_max_capacity,PMT_T)));
-  d_cs->send(s_cmd_ntx_chan, pmt_list1(pmt_list2(s_response_ntx_chan,PMT_T)));
-  d_cs->send(s_cmd_nrx_chan, pmt_list1(pmt_list2(s_response_nrx_chan,PMT_T)));
+  d_cs->send(s_cmd_open, 
+             pmt_list2(pmt_list2(s_response_open, PMT_T), 
+             pmt_from_long(0)));
+
+  d_cs->send(s_cmd_max_capacity, 
+             pmt_list1(pmt_list2(s_response_max_capacity, PMT_T)));
+  
+  d_cs->send(s_cmd_ntx_chan, 
+             pmt_list1(pmt_list2(s_response_ntx_chan, PMT_T)));
+  
+  d_cs->send(s_cmd_nrx_chan, 
+             pmt_list1(pmt_list2(s_response_nrx_chan,PMT_T)));
 }
 
 void
@@ -137,34 +150,55 @@
 {
   if(verbose)
     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)));
+  d_tx->send(s_cmd_allocate_channel, 
+             pmt_list2(PMT_T, pmt_from_long(1)));
   
   // should not be able to allocate max capacity after 100 bytes were allocated
-  d_tx->send(s_cmd_allocate_channel, 
pmt_list2(pmt_from_long(usrp_server::RQSTD_CAPACITY_UNAVAIL), 
pmt_from_long(d_max_capacity)));  
+  d_tx->send(s_cmd_allocate_channel, 
+             pmt_list2(pmt_from_long(usrp_server::RQSTD_CAPACITY_UNAVAIL), 
+                       pmt_from_long(d_max_capacity)));  
   
-  // keep allocating a little more until all of the channels are used and test 
the error response
-  // we start at 1 since we've already allocated 1 channel
+  // keep allocating a little more until all of the channels are used and test
+  // the error response we start at 1 since we've already allocated 1 channel
   for(int i=1; i < d_ntx_chan; i++) {
+
     if(verbose)
       std::cout << "[qa_alloc_top] Sent allocation request...\n";
+  
     d_tx->send(s_cmd_allocate_channel, pmt_list2(PMT_T, pmt_from_long(1)));
+
     d_nmsgs_to_recv++;
   }
-  d_tx->send(s_cmd_allocate_channel, 
pmt_list2(pmt_from_long(usrp_server::CHANNEL_UNAVAIL), pmt_from_long(1)));
 
+  // No more channels after allocating all of them is expected
+  d_tx->send(s_cmd_allocate_channel, 
+             pmt_list2(pmt_from_long(usrp_server::CHANNEL_UNAVAIL), 
+                       pmt_from_long(1)));
+
   // test out the same on the RX side
   d_rx->send(s_cmd_allocate_channel, pmt_list2(PMT_T, pmt_from_long(1)));
-  d_rx->send(s_cmd_allocate_channel, 
pmt_list2(pmt_from_long(usrp_server::RQSTD_CAPACITY_UNAVAIL), 
pmt_from_long(d_max_capacity)));  
 
+  d_rx->send(s_cmd_allocate_channel, 
+             pmt_list2(pmt_from_long(usrp_server::RQSTD_CAPACITY_UNAVAIL), 
+                       pmt_from_long(d_max_capacity)));  
+
   for(int i=1; i < d_nrx_chan; i++) {
+    
     d_rx->send(s_cmd_allocate_channel, pmt_list2(PMT_T, pmt_from_long(1)));
+    
     d_nmsgs_to_recv++;
   }
-  d_rx->send(s_cmd_allocate_channel, 
pmt_list2(pmt_from_long(usrp_server::CHANNEL_UNAVAIL), pmt_from_long(1)));
 
-  // when all is said and done, there should be d_ntx_chan+d_ntx_chan bytes 
allocated
-  d_cs->send(s_cmd_current_capacity_allocation, 
pmt_list1(pmt_from_long(d_ntx_chan+d_nrx_chan)));
+  d_rx->send(s_cmd_allocate_channel, 
+             pmt_list2(pmt_from_long(usrp_server::CHANNEL_UNAVAIL), 
+             pmt_from_long(1)));
+
+  // when all is said and done, there should be d_ntx_chan+d_ntx_chan bytes
+  // allocated
+  d_cs->send(s_cmd_current_capacity_allocation, 
+             pmt_list1(pmt_from_long(d_ntx_chan+d_nrx_chan)));
 }
 
 void
@@ -182,17 +216,20 @@
     if(pmt_eq(msg->signal(), s_response_max_capacity)) {
       d_max_capacity = pmt_to_long(pmt_nth(2, data));
       if(verbose)
-        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));
       if(verbose)
-        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));
       if(verbose)
-        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);
@@ -229,7 +266,8 @@
     return;
   } else {
     if(verbose)
-      std::cout << "[qa_alloc_top] Received expected response for message " << 
d_nrecvd << " (" << event << ")\n";
+      std::cout << "[qa_alloc_top] Received expected response for message " 
+                << d_nrecvd << " (" << event << ")\n";
   }
 
   if(d_nrecvd == d_nmsgs_to_recv)





reply via email to

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