commit-gnuradio
[Top][All Lists]
Advanced

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

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


From: gnychis
Subject: [Commit-gnuradio] r6686 - gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband
Date: Wed, 24 Oct 2007 13:25:01 -0600 (MDT)

Author: gnychis
Date: 2007-10-24 13:24:59 -0600 (Wed, 24 Oct 2007)
New Revision: 6686

Modified:
   
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:
Adding in some temporary code to check the initialization of the registers using
the new register read/writes


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-24 15:17:47 UTC (rev 6685)
+++ 
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_server.cc 
    2007-10-24 19:24:59 UTC (rev 6686)
@@ -41,7 +41,7 @@
 
 typedef usrp_inband_usb_packet transport_pkt;   // makes conversion to gigabit 
easy
 
-const static bool verbose = false;
+const static bool verbose = true;
 
 static std::string
 str(long x)
@@ -1512,8 +1512,94 @@
   set_register(FR_RX_FREQ_2, 0);
   set_register(FR_RX_FREQ_3, 0);
 
+  // DEBUGGING
+  check_register_initialization();
 }
 
+// FIXME: used for debugging to determine if all the registers are actually
+// being set correctly
+void
+usrp_server::check_register_initialization()
+{
+  // RX mode to normal (0)
+  read_register(FR_MODE);
+
+  // FPGA debugging?
+  if(d_fpga_debug) {
+    read_register(FR_DEBUG_EN);
+    // FIXME: need to figure out exact register writes to control daughterboard
+    // pins that need to be written to
+  } else {
+    read_register(FR_DEBUG_EN);
+  }
+
+  // Set the transmit sample rate divisor, which is 4-1
+  read_register(FR_TX_SAMPLE_RATE_DIV);
+
+  // Dboard IO buffer and register settings
+  read_register(FR_OE_0);
+  read_register(FR_IO_0);
+  read_register(FR_OE_1);
+  read_register(FR_IO_1);
+  read_register(FR_OE_2);
+  read_register(FR_IO_2);
+  read_register(FR_OE_3);
+  read_register(FR_IO_3);
+
+  // zero Tx side Auto Transmit/Receive regs
+  read_register(FR_ATR_MASK_0); 
+  read_register(FR_ATR_TXVAL_0);
+  read_register(FR_ATR_RXVAL_0);
+  read_register(FR_ATR_MASK_1); 
+  read_register(FR_ATR_TXVAL_1);
+  read_register(FR_ATR_RXVAL_1);
+  read_register(FR_ATR_MASK_2);
+  read_register(FR_ATR_TXVAL_2);
+  read_register(FR_ATR_RXVAL_2);
+  read_register(FR_ATR_MASK_3);
+  read_register(FR_ATR_TXVAL_3);
+  read_register(FR_ATR_RXVAL_3);
+
+  // Configure TX mux, this is a hacked value
+  read_register(FR_TX_MUX);
+
+  // Set the interpolation rate, which is the rate divided by 4, minus 1
+  read_register(FR_INTERP_RATE);
+
+  // Apparently this register changes again
+  read_register(FR_TX_MUX);
+
+  // Set the receive sample rate divisor, which is 2-1
+  read_register(FR_RX_SAMPLE_RATE_DIV);
+
+  // DC offset
+  read_register(FR_DC_OFFSET_CL_EN);
+
+  // Reset the DC correction offsets
+  read_register(FR_ADC_OFFSET_0);
+  read_register(FR_ADC_OFFSET_1);
+
+  // Some hard-coded RX configuration
+  read_register(FR_RX_FORMAT);
+  read_register(FR_RX_MUX);
+
+  // RX decimation rate is divided by two, then subtract 1
+  read_register(FR_DECIM_RATE);
+
+  // More hard coding
+  read_register(FR_RX_MUX);
+
+  // Resetting RX registers
+  read_register(FR_RX_PHASE_0);
+  read_register(FR_RX_PHASE_1);
+  read_register(FR_RX_PHASE_2);
+  read_register(FR_RX_PHASE_3);
+  read_register(FR_RX_FREQ_0);
+  read_register(FR_RX_FREQ_1);
+  read_register(FR_RX_FREQ_2);
+  read_register(FR_RX_FREQ_3);
+}
+
 // THIS IS ONLY FOR INTERNAL USRP_SERVER USAGE
 void
 usrp_server::set_register(long reg, long val)
@@ -1525,4 +1611,14 @@
                                   pmt_from_long(val))))));
 }
 
+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))))));
+}
+
 REGISTER_MBLOCK_CLASS(usrp_server);

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-10-24 15:17:47 UTC (rev 6685)
+++ 
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_server.h  
    2007-10-24 19:24:59 UTC (rev 6686)
@@ -123,6 +123,8 @@
   long next_rid();
   void initialize_registers();
   void set_register(long reg, long val);
+  void read_register(long reg);
+  void check_register_initialization();
 };
 
 #endif /* INCLUDED_USRP_SERVER_H */





reply via email to

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