commit-gnuradio
[Top][All Lists]
Advanced

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

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


From: gnychis
Subject: [Commit-gnuradio] r6707 - gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband
Date: Fri, 26 Oct 2007 13:41:32 -0600 (MDT)

Author: gnychis
Date: 2007-10-26 13:41:32 -0600 (Fri, 26 Oct 2007)
New Revision: 6707

Modified:
   
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_server.cc
Log:
Changes to fix improper re-assignment of RIDs


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-10-26 17:42:59 UTC (rev 6706)
+++ 
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_server.cc 
    2007-10-26 19:41:32 UTC (rev 6707)
@@ -1222,6 +1222,9 @@
         return;
 
       pmt_t owner = d_rids[srid].owner;
+      
+      // Return the RID
+      d_rids[srid].owner = PMT_NIL;
 
       // FIXME: should be 1 response for all subpackets here ?
       if((port = tx_port_index(owner)) != -1)
@@ -1257,6 +1260,9 @@
         return;
       
       pmt_t owner = d_rids[srid].owner;
+      
+      // Return the RID
+      d_rids[srid].owner = PMT_NIL;
 
       // FIXME: should be 1 response for all subpackets here ?
       if((port = tx_port_index(owner)) != -1)
@@ -1293,6 +1299,9 @@
         return;
 
       pmt_t owner = d_rids[srid].owner;
+      
+      // Return the RID
+      d_rids[srid].owner = PMT_NIL;
 
       if((port = tx_port_index(owner)) != -1)
         d_tx[port]->send(s_response_from_control_channel,
@@ -1326,6 +1335,9 @@
         return;
 
       pmt_t owner = d_rids[srid].owner;
+      
+      // Return the RID
+      d_rids[srid].owner = PMT_NIL;
 
       if((port = tx_port_index(owner)) != -1)
         d_tx[port]->send(s_response_from_control_channel,
@@ -1418,6 +1430,7 @@
     if(pmt_eqv(d_rids[i].owner, PMT_NIL))
       return i;
 
+  std::cout << "[USRP_SERVER] No RIDs left\n";
   return -1;
 }
 
@@ -1513,6 +1526,13 @@
   set_register(FR_RX_FREQ_2, 0);
   set_register(FR_RX_FREQ_3, 0);
 
+  // Enable debug bus
+  set_register(FR_DEBUG_EN, 0xf);
+  set_register(FR_OE_0, -1);
+  set_register(FR_OE_1, -1);
+  set_register(FR_OE_2, -1);
+  set_register(FR_OE_3, -1);
+
   // DEBUGGING
   //check_register_initialization();
 }
@@ -1609,14 +1629,6 @@
 }
 
 // THIS IS ONLY FOR INTERNAL USRP_SERVER USAGE
-//
-// This function needs to create its own USB packet and not use
-// handle_cmd_to_control_channel because in many cases such as initialization,
-// the number of register writes needed are more than the number of RID's.  If
-// there are no RID's left for use then handle_cmd_to_control_channel() will
-// throw away the request.  This allows usrp_server to generate its own 
register
-// writes without eating up RID's, since usrp_server does not really care about
-// the response.
 void
 usrp_server::set_register(long reg, long val)
 {
@@ -1637,16 +1649,28 @@
                             v_packet));
 }
 
-// Only for internal usrp_server usage.  Structed the same way as
-// set_register().
+// Only for internal usrp_server usage.  
+//
+// This function should create its own USB packet and not use
+// handle_cmd_to_control_channel to take RID's. 
 void
 usrp_server::read_register(long reg)
 {
-  handle_cmd_to_control_channel(d_tx[0], d_chaninfo_tx,
-    pmt_list2(PMT_NIL,  // empty invoc handle
-              pmt_list1(pmt_list2(s_op_read_reg,
-                        pmt_list2(pmt_from_long(0),
-                                  pmt_from_long(reg))))));
+  size_t psize;
+  long payload_len = 0;
+
+  pmt_t v_packet = pmt_make_u8vector(sizeof(transport_pkt), 0);
+  transport_pkt *pkt = (transport_pkt *) 
pmt_u8vector_writeable_elements(v_packet, psize);
+  
+  pkt->set_header(0, CONTROL_CHAN, 0, payload_len);
+  pkt->set_timestamp(0xffffffff);
+
+  pkt->cs_read_reg(0, reg);
+
+  d_cs_usrp->send(s_cmd_usrp_write, 
+                  pmt_list3(PMT_NIL, 
+                            pmt_from_long(CONTROL_CHAN), 
+                            v_packet));
 }
 
 REGISTER_MBLOCK_CLASS(usrp_server);





reply via email to

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