commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] r5926 - in gnuradio/branches/developers/gnychis/inband


From: gnychis
Subject: [Commit-gnuradio] r5926 - in gnuradio/branches/developers/gnychis/inband/usrp/host: apps lib/inband
Date: Fri, 6 Jul 2007 11:55:54 -0600 (MDT)

Author: gnychis
Date: 2007-07-06 11:55:54 -0600 (Fri, 06 Jul 2007)
New Revision: 5926

Modified:
   
gnuradio/branches/developers/gnychis/inband/usrp/host/apps/test_usrp_inband_rx.cc
   
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/qa_inband_usrp_server.cc
   
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_inband_usb_packet.h
   
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_server.cc
Log:
All I2C commands now tested which includes read, write, and read reply.

Fixed bug in returning the number of bytes in an I2C read reply, needed to shift
and mask it out.


Modified: 
gnuradio/branches/developers/gnychis/inband/usrp/host/apps/test_usrp_inband_rx.cc
===================================================================
--- 
gnuradio/branches/developers/gnychis/inband/usrp/host/apps/test_usrp_inband_rx.cc
   2007-07-06 17:11:49 UTC (rev 5925)
+++ 
gnuradio/branches/developers/gnychis/inband/usrp/host/apps/test_usrp_inband_rx.cc
   2007-07-06 17:55:54 UTC (rev 5926)
@@ -130,7 +130,7 @@
   // Specify the RBF to use
   pmt_dict_set(usrp_dict,
                pmt_intern("rbf"),
-               pmt_intern("leo3.rbf"));
+               pmt_intern("leo4.rbf"));
 
   // Set TX and RX interpolations
   pmt_dict_set(usrp_dict,

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-07-06 17:11:49 UTC (rev 5925)
+++ 
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/qa_inband_usrp_server.cc
   2007-07-06 17:55:54 UTC (rev 5926)
@@ -1105,7 +1105,7 @@
   : mb_mblock(runtime, instance_name, user_arg)
 { 
   d_nrecvd=0;
-  d_nmsgs_to_recv = 7;
+  d_nmsgs_to_recv = 8;
   d_nstatus=0;
   d_nstatus_to_recv = 50;
   
@@ -1214,9 +1214,11 @@
   pmt_t i2c_data = pmt_make_u8vector(8, 0xff);
 
   subpackets = pmt_list2(
-                        pmt_list2(s_op_delay, pmt_list1(pmt_from_long(0x7))),
                         pmt_list2(s_op_i2c_write, 
-                                  pmt_list2(pmt_from_long(8), i2c_data))
+                                  pmt_list2(pmt_from_long(8), i2c_data)),
+                        pmt_list2(s_op_i2c_read,
+                                  pmt_list3(PMT_NIL, pmt_from_long(9), 
pmt_from_long(1)))
+
                      );
 
   d_tx->send(s_cmd_to_control_channel, 

Modified: 
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_inband_usb_packet.h
===================================================================
--- 
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_inband_usb_packet.h
   2007-07-06 17:11:49 UTC (rev 5925)
+++ 
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_inband_usb_packet.h
   2007-07-06 17:55:54 UTC (rev 5926)
@@ -502,8 +502,11 @@
 
     int i2c_len = i2c_data_len + 2;
 
-    if((MAX_PAYLOAD - p_len) < (i2c_len + CS_FIXED_LEN))
+    if((MAX_PAYLOAD - p_len) < (i2c_len + CS_FIXED_LEN)) {
+      std::cout << "(" << MAX_PAYLOAD << " - " << p_len << ") < ("
+                << i2c_len << " + " << CS_FIXED_LEN << ")\n";
       return false;
+    }
     
     uint32_t word0 = 0;
     
@@ -649,6 +652,7 @@
         
         // The number of bytes is in the next word
         uint32_t bytes  = usrp_to_host_u32(*((uint32_t *)(d_payload + 
payload_offset + 4)));
+        bytes = (bytes >> CS_I2CREADBYTES_SHIFT) & CS_I2CREADBYTES_MASK;
         pmt_t i2c_bytes = pmt_from_long(bytes);
 
         return pmt_list4(s_op_i2c_read, rid, i2c_addr, i2c_bytes);

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-07-06 17:11:49 UTC (rev 5925)
+++ 
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_server.cc 
    2007-07-06 17:55:54 UTC (rev 5926)
@@ -826,6 +826,8 @@
     }
 
     //--------- I2C WRITE -----------//
+    // FIXME: could check that byte count does not exceed 2^8 which
+    // is the max length in the subpacket for # of bytes to read.
     if(pmt_eq(subp_cmd, s_op_i2c_write)) {
       
       long i2c_addr = pmt_to_long(pmt_nth(0, subp_data));
@@ -1125,7 +1127,8 @@
         std::cout << "[USRP_SERVER] Found i2c read reply "
                   << "("
                   << "RID: " << rid << ", "
-                  << "Addr: " << i2c_addr
+                  << "Addr: " << i2c_addr << ", "
+                  << "Data: " << i2c_data
                   << ")\n";
 
       // Do some bounds checking to avoid seg faults





reply via email to

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