commit-gnuradio
[Top][All Lists]
Advanced

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

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


From: gnychis
Subject: [Commit-gnuradio] r6021 - in gnuradio/branches/developers/gnychis/inband: pmt/src/lib usrp/host/lib/inband
Date: Wed, 18 Jul 2007 15:46:01 -0600 (MDT)

Author: gnychis
Date: 2007-07-18 15:46:01 -0600 (Wed, 18 Jul 2007)
New Revision: 6021

Modified:
   gnuradio/branches/developers/gnychis/inband/pmt/src/lib/pmt.cc
   gnuradio/branches/developers/gnychis/inband/pmt/src/lib/pmt.h
   
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_inband_usb_packet.h
Log:
Adding functionality to read SPI read subpackets, used by the TX stub to
generate a fake response.

Needed to add a pmt list of length 6 to handle response.


Modified: gnuradio/branches/developers/gnychis/inband/pmt/src/lib/pmt.cc
===================================================================
--- gnuradio/branches/developers/gnychis/inband/pmt/src/lib/pmt.cc      
2007-07-18 21:20:27 UTC (rev 6020)
+++ gnuradio/branches/developers/gnychis/inband/pmt/src/lib/pmt.cc      
2007-07-18 21:46:01 UTC (rev 6021)
@@ -961,6 +961,12 @@
 }
 
 pmt_t
+pmt_list6(pmt_t x1, pmt_t x2, pmt_t x3, pmt_t x4, pmt_t x5, pmt_t x6)
+{
+  return pmt_cons(x1, pmt_cons(x2, pmt_cons(x3, pmt_cons(x4, pmt_cons(x5, 
pmt_cons(x6, PMT_NIL))))));
+}
+
+pmt_t
 pmt_caar(pmt_t pair)
 {
   return (pmt_car(pmt_car(pair)));

Modified: gnuradio/branches/developers/gnychis/inband/pmt/src/lib/pmt.h
===================================================================
--- gnuradio/branches/developers/gnychis/inband/pmt/src/lib/pmt.h       
2007-07-18 21:20:27 UTC (rev 6020)
+++ gnuradio/branches/developers/gnychis/inband/pmt/src/lib/pmt.h       
2007-07-18 21:46:01 UTC (rev 6021)
@@ -599,10 +599,17 @@
 pmt_t pmt_list4(pmt_t x1, pmt_t x2, pmt_t x3, pmt_t x4);
 
 /*!
- * \brief Return a list of length 4 containing \p x1, \p x2, \p x3, \p x4, \p 
x5
+ * \brief Return a list of length 5 containing \p x1, \p x2, \p x3, \p x4, \p 
x5
  */
 pmt_t pmt_list5(pmt_t x1, pmt_t x2, pmt_t x3, pmt_t x4, pmt_t x5);
 
+/*!
+ * \brief Return a list of length 6 containing \p x1, \p x2, \p x3, \p x4, \p
+ * x5, \p x6
+ */
+pmt_t pmt_list6(pmt_t x1, pmt_t x2, pmt_t x3, pmt_t x4, pmt_t x5, pmt_t x6);
+
+
 /*
  * ------------------------------------------------------------------------
  *                          read / write

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-18 21:20:27 UTC (rev 6020)
+++ 
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_inband_usb_packet.h
   2007-07-18 21:46:01 UTC (rev 6021)
@@ -842,8 +842,23 @@
       }
 
       case OP_SPI_READ:
-        return PMT_NIL;
+      {
+        // Read the RID from the first word, the rest is mbz
+        pmt_t rid       = pmt_from_long((subpkt >> CS_RID_SHIFT) & 
CS_RID_MASK);
 
+        // Continue at the next word...
+        uint32_t word  = usrp_to_host_u32(*((uint32_t *)(d_payload + 
payload_offset + 4)));
+        pmt_t enables   = pmt_from_long((word >> CS_SPIENABLES_SHIFT) & 
CS_SPIENABLES_MASK);
+        pmt_t format    = pmt_from_long((word >> CS_SPIFORMAT_SHIFT) & 
CS_SPIFORMAT_MASK);
+        pmt_t opt       = pmt_from_long((word >> CS_SPIOPT_SHIFT) & 
CS_SPIOPT_MASK);
+
+        // The number of bytes is the only thing to read in the next word
+        word  = usrp_to_host_u32(*((uint32_t *)(d_payload + payload_offset + 
8)));
+        pmt_t n_bytes   = pmt_from_long((word >> CS_SPINBYTES_SHIFT) & 
CS_SPINBYTES_MASK);
+
+        return pmt_list6(s_op_spi_read, rid, enables, format, opt, n_bytes);
+      }
+
       case OP_DELAY:
       {
         pmt_t ticks = pmt_from_long((subpkt >> CS_DELAY_SHIFT) & 
CS_DELAY_MASK);





reply via email to

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