commit-gnuradio
[Top][All Lists]
Advanced

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

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


From: gnychis
Subject: [Commit-gnuradio] r6017 - gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband
Date: Wed, 18 Jul 2007 14:53:23 -0600 (MDT)

Author: gnychis
Date: 2007-07-18 14:53:22 -0600 (Wed, 18 Jul 2007)
New Revision: 6017

Modified:
   
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_inband_usb_packet.h
Log:
Ability to read SPI write subpackets for the TX stub to generate a fake response


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 20:38:02 UTC (rev 6016)
+++ 
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_inband_usb_packet.h
   2007-07-18 20:53:22 UTC (rev 6017)
@@ -768,8 +768,24 @@
       }
 
       case OP_SPI_WRITE:
-        return PMT_NIL;
+      {
+        // Nothing interesting in the first word, skip to the next
+        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);
 
+        // From the next word and on is data
+        size_t spi_data_len;
+        pmt_t spi_data  = pmt_make_u8vector(len - 6, 0);   // skip 
rid+mbz+addr = 2 bytes
+        uint8_t *w_data  = 
+            (uint8_t *) pmt_u8vector_writeable_elements(spi_data, 
spi_data_len);
+
+        memcpy(w_data, d_payload + payload_offset + 8, spi_data_len);  // skip 
first 2 words
+
+        return pmt_list5(s_op_spi_write, enables, format, opt, spi_data);
+      }
+
       case OP_SPI_READ:
         return PMT_NIL;
 





reply via email to

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