commit-gnuradio
[Top][All Lists]
Advanced

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

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


From: gnychis
Subject: [Commit-gnuradio] r6140 - gnuradio/branches/developers/gnychis/inband/usrp/host/apps
Date: Wed, 15 Aug 2007 11:44:18 -0600 (MDT)

Author: gnychis
Date: 2007-08-15 11:44:16 -0600 (Wed, 15 Aug 2007)
New Revision: 6140

Modified:
   
gnuradio/branches/developers/gnychis/inband/usrp/host/apps/test_usrp_inband_registers.cc
Log:
Working read/write registers, get proper response back from USRP


Modified: 
gnuradio/branches/developers/gnychis/inband/usrp/host/apps/test_usrp_inband_registers.cc
===================================================================
--- 
gnuradio/branches/developers/gnychis/inband/usrp/host/apps/test_usrp_inband_registers.cc
    2007-08-15 06:18:03 UTC (rev 6139)
+++ 
gnuradio/branches/developers/gnychis/inband/usrp/host/apps/test_usrp_inband_registers.cc
    2007-08-15 17:44:16 UTC (rev 6140)
@@ -88,6 +88,7 @@
   void read_register();
   void closing_channels();
   void closing_usrp();
+  void enter_receiving();
 };
 
 
@@ -117,7 +118,7 @@
   // Specify the RBF to use
   pmt_dict_set(usrp_dict,
                pmt_intern("rbf"),
-               pmt_intern("tmac7.rbf"));
+               pmt_intern("terminator4.rbf"));
 
   // Set TX and RX interpolations
   pmt_dict_set(usrp_dict,
@@ -212,8 +213,10 @@
                       << " on channel " << d_tx_chan << std::endl;
 
           // If the RX has also been allocated already, we can continue
-          if(!pmt_eqv(d_rx_chan, PMT_NIL)) 
+          if(!pmt_eqv(d_rx_chan, PMT_NIL)) {
+            enter_receiving();
             write_register();
+          }
 
           return;
         }
@@ -239,8 +242,10 @@
                       << " on channel " << d_rx_chan << std::endl;
 
           // If the TX has also been allocated already, we can continue
-          if(!pmt_eqv(d_tx_chan, PMT_NIL)) 
+          if(!pmt_eqv(d_tx_chan, PMT_NIL)) {
+            enter_receiving();
             write_register();
+          }
 
           return;
         }
@@ -290,8 +295,8 @@
           if(verbose)
             std::cout << "[TEST_USRP_INBAND_REGISTERS] Received read reg reply 
"
                       << "("
-                      << "RID: " << rid
-                      << "Reg: " << reg_num
+                      << "RID: " << rid << ", " 
+                      << "Reg: " << reg_num << ", "
                       << "Val: " << reg_val
                       << ")\n";
           
@@ -325,7 +330,7 @@
 
  // Received an unhandled message for a specific state
  unhandled:
-  if(verbose)
+  if(verbose && !pmt_eq(event, s_response_recv_raw_samples))
     std::cout << "test_usrp_inband_tx: unhandled msg: " << msg
               << "in state "<< d_state << std::endl;
 
@@ -367,7 +372,7 @@
 {
   d_state = WRITE_REGISTER;
 
-  long reg = 13;
+  long reg = 0;
 
   d_tx->send(s_cmd_to_control_channel,    // C/S packet
              pmt_list2(PMT_NIL,           // invoc handle
@@ -382,31 +387,6 @@
               << reg << std::endl;
 
   read_register();  // immediately transition to read the register
-  
-  d_tx->send(s_cmd_to_control_channel,
-             pmt_list2(PMT_NIL,
-                       pmt_list1(
-                            pmt_list2(s_op_ping_fixed, 
-                                      pmt_list2(pmt_from_long(3), 
-                                      pmt_from_long(0))))));
-  d_tx->send(s_cmd_to_control_channel,
-             pmt_list2(PMT_NIL,
-                       pmt_list1(
-                            pmt_list2(s_op_ping_fixed, 
-                                      pmt_list2(pmt_from_long(3), 
-                                      pmt_from_long(0))))));
-  d_tx->send(s_cmd_to_control_channel,
-             pmt_list2(PMT_NIL,
-                       pmt_list1(
-                            pmt_list2(s_op_ping_fixed, 
-                                      pmt_list2(pmt_from_long(3), 
-                                      pmt_from_long(0))))));
-  d_tx->send(s_cmd_to_control_channel,
-             pmt_list2(PMT_NIL,
-                       pmt_list1(
-                            pmt_list2(s_op_ping_fixed, 
-                                      pmt_list2(pmt_from_long(3), 
-                                      pmt_from_long(0))))));
 }
 
 // After writing to the register, we want to read the value back and ensure 
that
@@ -416,7 +396,7 @@
 {
   d_state = READ_REGISTER;
 
-  long reg = 13;
+  long reg = 0;
 
   d_tx->send(s_cmd_to_control_channel,    // C/S packet
              pmt_list2(PMT_NIL,           // invoc handle
@@ -425,10 +405,18 @@
                                       pmt_list2(
                                       pmt_from_long(0),   // rid 
                                       pmt_from_long(reg))))));
-
   if(verbose)
     std::cout << "[TEST_USRP_INBAND_REGISTERS] Reading from register " 
               << reg << std::endl;
 }
 
+// Used to enter the receiving state
+void
+test_usrp_inband_registers::enter_receiving()
+{
+  d_rx->send(s_cmd_start_recv_raw_samples,
+             pmt_list2(PMT_F,
+                       d_rx_chan));
+}
+
 REGISTER_MBLOCK_CLASS(test_usrp_inband_registers);





reply via email to

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