commit-gnuradio
[Top][All Lists]
Advanced

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

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


From: gnychis
Subject: [Commit-gnuradio] r5171 - gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband
Date: Fri, 27 Apr 2007 19:03:35 -0600 (MDT)

Author: gnychis
Date: 2007-04-27 19:03:34 -0600 (Fri, 27 Apr 2007)
New Revision: 5171

Modified:
   
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/qa_inband_usrp_server.cc
   
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_server.cc
   
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_server.h
Log:
more testing of the channel allocation

added responses to determine the exact reason for failure of allocation commands

fixed a bug in the RX side where it was reading the TX channel information


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-04-28 00:59:11 UTC (rev 5170)
+++ 
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/qa_inband_usrp_server.cc
   2007-04-28 01:03:34 UTC (rev 5171)
@@ -59,9 +59,6 @@
 qa_alloc_top::qa_alloc_top(mb_runtime *runtime, const std::string 
&instance_name, pmt_t user_arg)
   : mb_mblock(runtime, instance_name, user_arg)
 { 
-  d_tx = define_port("tx0", "usrp-tx", false, mb_port::INTERNAL);
-  define_component("server", "usrp_server", PMT_F);
-  connect("self", "tx0", "server", "tx0");
 }
 
 qa_alloc_top::~qa_alloc_top(){}
@@ -69,14 +66,30 @@
 void
 qa_alloc_top::initial_transition()
 {
+  d_nmsgs_to_recv = 8;
 
-  d_nmsgs_to_recv = 2;
+  // Test the TX side
+  d_tx = define_port("tx0", "usrp-tx", false, mb_port::INTERNAL);
+  define_component("server", "usrp_server", PMT_F);
+  connect("self", "tx0", "server", "tx0");
 
   // should be able to allocate 100 bytes
   d_tx->send(s_cmd_allocate_channel, pmt_list2(PMT_T, pmt_from_long(100)));
+  
+  // 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(usrp_server::max_capacity())));  
+  
+  // allocate a little more until all of the channels are used and
+  d_tx->send(s_cmd_allocate_channel, pmt_list2(PMT_T, pmt_from_long(100)));
+  d_tx->send(s_cmd_allocate_channel, 
pmt_list2(pmt_from_long(usrp_server::CHANNEL_UNAVAIL), 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_F, 
pmt_from_long(usrp_server::max_capacity())));  
+  // test out the same on the RX side
+  d_rx = define_port("rx0", "usrp-rx", false, mb_port::INTERNAL);
+  connect("self", "rx0", "server", "rx0");
+  d_rx->send(s_cmd_allocate_channel, pmt_list2(PMT_T, pmt_from_long(100)));
+  d_rx->send(s_cmd_allocate_channel, 
pmt_list2(pmt_from_long(usrp_server::RQSTD_CAPACITY_UNAVAIL), 
pmt_from_long(usrp_server::max_capacity())));  
+  d_rx->send(s_cmd_allocate_channel, pmt_list2(PMT_T, pmt_from_long(100)));
+  d_rx->send(s_cmd_allocate_channel, 
pmt_list2(pmt_from_long(usrp_server::CHANNEL_UNAVAIL), pmt_from_long(1)));
 }
 
 void
@@ -84,7 +97,8 @@
 {
   pmt_t data = msg->data();
 
-  if (pmt_eq(msg->port_id(), d_tx->port_symbol())
+  if ((pmt_eq(msg->port_id(), d_tx->port_symbol())
+       || pmt_eq(msg->port_id(), d_rx->port_symbol()))
        && pmt_eq(msg->signal(), s_response_allocate_channel)){
     check_message(msg);
   }
@@ -100,10 +114,13 @@
   
   d_nrecvd++;
 
-  if(!pmt_eq(expected_result, result))
+
+  if(!pmt_eqv(expected_result, result)) {
+    std::cout << "Got: " << result << " Expected: " << expected_result << "\n";
     shutdown_all(PMT_F);
-  else
+  } else {
     std::cout << "Received expected response for message " << d_nrecvd << "\n";
+  }
 
   if(d_nrecvd == d_nmsgs_to_recv)
     shutdown_all(PMT_T);

Modified: 
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_server.cc
===================================================================
--- 
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_server.cc 
    2007-04-28 00:59:11 UTC (rev 5170)
+++ 
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_server.cc 
    2007-04-28 01:03:34 UTC (rev 5171)
@@ -215,7 +215,7 @@
 
     // Check capacity exists
     if((D_USB_CAPACITY - current_capacity_allocation()) < rqstd_capacity) {
-      reply_data = pmt_list3(invocation_handle, PMT_F, PMT_NIL);  // no 
capacity available
+      reply_data = pmt_list3(invocation_handle, 
pmt_from_long(RQSTD_CAPACITY_UNAVAIL), PMT_NIL);  // no capacity available
       d_tx[port]->send(s_response_allocate_channel, reply_data);
       return;
     }
@@ -231,8 +231,10 @@
       }
     }
 
-    reply_data = pmt_list3(invocation_handle, PMT_F, PMT_NIL);  // no free TX 
chan found
-    d_tx[port]->send(invocation_handle, reply_data);
+    std::cout << "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);
     return;
   }
   
@@ -240,23 +242,24 @@
   if((port = rx_port_index(port_id)) != -1) {
     
     if((D_USB_CAPACITY - current_capacity_allocation()) < rqstd_capacity) {
-      reply_data = pmt_list3(invocation_handle, PMT_F, PMT_NIL);  // no 
capacity available
-      d_rx[port]->send(invocation_handle, reply_data);
+      reply_data = pmt_list3(invocation_handle, 
pmt_from_long(RQSTD_CAPACITY_UNAVAIL), PMT_NIL);  // no capacity available
+      d_rx[port]->send(s_response_allocate_channel, reply_data);
       return;
     }
 
-    for(chan=0; chan < d_ntx_chan; chan++) {
-      if(d_chaninfo_tx[chan].owner == PMT_NIL) {
-        d_chaninfo_tx[chan].owner = port_id;
-        d_chaninfo_tx[chan].assigned_capacity = rqstd_capacity;
+    for(chan=0; chan < d_nrx_chan; chan++) {
+      if(d_chaninfo_rx[chan].owner == PMT_NIL) {
+        d_chaninfo_rx[chan].owner = port_id;
+        d_chaninfo_rx[chan].assigned_capacity = rqstd_capacity;
         reply_data = pmt_list3(invocation_handle, PMT_T, pmt_from_long(chan));
-        d_rx[port]->send(invocation_handle, reply_data);
+        d_rx[port]->send(s_response_allocate_channel, reply_data);
         return;
       }
     }
 
-    reply_data = pmt_list3(invocation_handle, PMT_F, PMT_NIL);  // no free RX 
chan found
-    d_rx[port]->send(invocation_handle, reply_data);
+    std::cout << "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;
   }
 }

Modified: 
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_server.h
===================================================================
--- 
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_server.h  
    2007-04-28 00:59:11 UTC (rev 5170)
+++ 
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_server.h  
    2007-04-28 01:03:34 UTC (rev 5171)
@@ -31,6 +31,11 @@
 {
 public:
 
+  enum error_codes {
+    RQSTD_CAPACITY_UNAVAIL = 0,
+    CHANNEL_UNAVAIL = 1
+  };
+
   // our ports
   enum port_types {
     RX_PORT = 0,





reply via email to

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