commit-gnuradio
[Top][All Lists]
Advanced

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

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


From: gnychis
Subject: [Commit-gnuradio] r6018 - gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband
Date: Wed, 18 Jul 2007 15:04:22 -0600 (MDT)

Author: gnychis
Date: 2007-07-18 15:04:21 -0600 (Wed, 18 Jul 2007)
New Revision: 6018

Modified:
   
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_server.cc
   
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_tx_stub.cc
Log:
SPI writes being parsed by the USRP server and the TX stub passively reads them,
no response is needed


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-18 20:53:22 UTC (rev 6017)
+++ 
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_server.cc 
    2007-07-18 21:04:21 UTC (rev 6018)
@@ -878,7 +878,34 @@
       if(verbose)
         std::cout << "[USRP_SERVER] Received I2C read\n";
     }
+    
+    //--------- SPI WRITE -----------//
+    if(pmt_eq(subp_cmd, s_op_spi_write)) {
+      
+      long enables = pmt_to_long(pmt_nth(0, subp_data));
+      long format = pmt_to_long(pmt_nth(1, subp_data));
+      long opt = pmt_to_long(pmt_nth(2, subp_data));
+      pmt_t data = pmt_nth(3, subp_data);
 
+      // Get a readable address to the data which also gives us the length
+      size_t data_len;
+      uint8_t *spi_data = (uint8_t *) pmt_u8vector_writeable_elements(data, 
data_len);
+
+      // Make the USB packet
+      if(!pkt->cs_spi_write(enables, format, opt, spi_data, data_len))
+      {
+        d_cs_usrp->send(s_cmd_usrp_write, 
+                        pmt_list3(invocation_handle, 
+                                  pmt_from_long(channel), 
+                                  v_packet));
+        
+        goto new_packet;
+      }
+      
+      if(verbose)
+        std::cout << "[USRP_SERVER] Received SPI write\n";
+    }
+
     curr_subpkt++;
 
   }

Modified: 
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_tx_stub.cc
===================================================================
--- 
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_tx_stub.cc
    2007-07-18 20:53:22 UTC (rev 6017)
+++ 
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_tx_stub.cc
    2007-07-18 21:04:21 UTC (rev 6018)
@@ -180,8 +180,6 @@
     //----------------- READ REG ------------------//
     if(pmt_eq(op_symbol, s_op_read_reg)) {
 
-      size_t ignore;
-
       long rid = pmt_to_long(pmt_nth(1, sub_packet));
       long reg_num = pmt_to_long(pmt_nth(2, sub_packet));
       long reg_val = 0xdeef;
@@ -277,7 +275,24 @@
                   << "Bytes: " << i2c_bytes
                   << ")\n";
     }
+    
+    //---------------- SPI WRITE ------------------//
+    if(pmt_eq(op_symbol, s_op_spi_write)) {
+      long enables  = pmt_to_long(pmt_nth(1, sub_packet));
+      long format   = pmt_to_long(pmt_nth(2, sub_packet));
+      long opt      = pmt_to_long(pmt_nth(3, sub_packet));
+      pmt_t data    = pmt_nth(4, sub_packet);
 
+      if(verbose)
+        std::cout << "[USRP_TX_STUB] Received spi write command "
+                  << "("
+                  << "Enables: " << enables << ", "
+                  << "Format: " << format << ", "
+                  << "Options: " << opt << ", "
+                  << "Data: " << data
+                  << ")\n";
+    }
+
     // Each subpacket has an unaccounted for 2 bytes which is the opcode
     // and the length field
     curr_payload += len + 2;





reply via email to

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