commit-gnuradio
[Top][All Lists]
Advanced

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

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


From: gnychis
Subject: [Commit-gnuradio] r6120 - gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband
Date: Mon, 6 Aug 2007 09:29:32 -0600 (MDT)

Author: gnychis
Date: 2007-08-06 09:29:32 -0600 (Mon, 06 Aug 2007)
New Revision: 6120

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:
Fixing outgoing RID's to be split with 3 bits for the user specified RID, and 3
bits for USRP server to add a marking for demuxing.  This only includes the
outgoing fix.


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-08-06 14:45:02 UTC (rev 6119)
+++ 
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_server.cc 
    2007-08-06 15:29:32 UTC (rev 6120)
@@ -708,17 +708,23 @@
     //--------- PING FIXED --------------//
     if(pmt_eq(subp_cmd, s_op_ping_fixed)) {
 
-      long pingval = pmt_to_long(pmt_nth(1, subp_data));
+      long urid     = pmt_to_long(pmt_nth(0, subp_data));
+      long pingval  = pmt_to_long(pmt_nth(1, subp_data));
 
       // USRP server sets request ID's to keep track of which application gets
       // what response back.  We do not handle wrap around, if we wrap before 
we
-      // got responses then they will be lost.
-      long rid = d_op_ping_fixed_rid++ % D_OP_PING_FIXED_MAX_RID;
+      // got responses then they will be lost.  The higher 3 bits will be the
+      // user specified RID value, and the lower 3 bits will be the USRP server
+      // marking.
+      long srid = d_op_ping_fixed_rid++ % D_OP_PING_FIXED_MAX_RID;
+      long rid = (
+          ((urid & 0x07) << 3)
+        | ((srid & 0x07)));
 
       // We use a vector to store the owner of the ping request and will use it
       // to send the request on any RX port they own.  There is currently no 
way
       // for the requester to specify the RX port to receive the response on.
-      d_op_ping_fixed_owners[rid] = port->port_symbol();
+      d_op_ping_fixed_owners[srid] = port->port_symbol();
 
       // Adds a ping after the previous command in the pkt
       if(!pkt->cs_ping(rid, pingval))
@@ -729,7 +735,7 @@
                                   v_packet));
 
         // Return the RID
-        d_op_ping_fixed_owners[rid] = PMT_NIL;
+        d_op_ping_fixed_owners[srid] = PMT_NIL;
         d_op_ping_fixed_rid--;
 
         goto new_packet;
@@ -737,7 +743,7 @@
 
       if(verbose)
         std::cout << "[USRP_SERVER] Received ping command request"
-                  << " assigning RID " << rid << std::endl;
+                  << " assigning RID " << srid << std::endl;
 
     }
   
@@ -785,11 +791,16 @@
     //------------ READ REG --------------//
     if(pmt_eq(subp_cmd, s_op_read_reg)) {
       
-      long reg_num = pmt_to_long(pmt_nth(1, subp_data));
+      long urid     = pmt_to_long(pmt_nth(0, subp_data));
+      long reg_num  = pmt_to_long(pmt_nth(1, subp_data));
 
-      long rid = d_op_read_reg_rid++ % D_OP_READ_REG_MAX_RID;
-      d_op_read_reg_owners[rid] = port->port_symbol();
+      long srid = d_op_read_reg_rid++ % D_OP_READ_REG_MAX_RID;
+      long rid = (
+          ((urid & 0x07) << 3)
+        | ((srid & 0x07)));
 
+      d_op_read_reg_owners[srid] = port->port_symbol();
+
       if(!pkt->cs_read_reg(rid, reg_num))
       {
         d_cs_usrp->send(s_cmd_usrp_write, 
@@ -798,7 +809,7 @@
                                   v_packet));
 
         // Return the rid
-        d_op_read_reg_owners[rid] = PMT_NIL;
+        d_op_read_reg_owners[srid] = PMT_NIL;
         d_op_read_reg_rid--;
         
         goto new_packet;
@@ -806,7 +817,7 @@
       
       if(verbose)
         std::cout << "[USRP_SERVER] Received read register request"
-                  << " assigning RID " << rid << std::endl;
+                  << " assigning RID " << srid << std::endl;
     }
     
     //------------ DELAY --------------//
@@ -859,12 +870,17 @@
     //----------- I2C Read -------------//
     if(pmt_eq(subp_cmd, s_op_i2c_read)) {
       
-      long i2c_addr = pmt_to_long(pmt_nth(1, subp_data));
-      long i2c_bytes = pmt_to_long(pmt_nth(2, subp_data));
+      long urid       = pmt_to_long(pmt_nth(0, subp_data));
+      long i2c_addr   = pmt_to_long(pmt_nth(1, subp_data));
+      long i2c_bytes  = pmt_to_long(pmt_nth(2, subp_data));
 
-      long rid = d_op_i2c_read_rid++ % D_OP_I2C_READ_MAX_RID;
-      d_op_i2c_read_owners[rid] = port->port_symbol();
+      long srid = d_op_i2c_read_rid++ % D_OP_I2C_READ_MAX_RID;
+      long rid = (
+          ((urid & 0x07) << 3)
+        | ((srid & 0x07)));
 
+      d_op_i2c_read_owners[srid] = port->port_symbol();
+
       if(!pkt->cs_i2c_read(rid, i2c_addr, i2c_bytes))
       {
         
@@ -873,7 +889,7 @@
                                   pmt_from_long(channel), 
                                   v_packet));
 
-        d_op_i2c_read_owners[rid] = PMT_NIL;
+        d_op_i2c_read_owners[srid] = PMT_NIL;
         d_op_i2c_read_rid--;
 
         goto new_packet;
@@ -913,14 +929,19 @@
     //--------- SPI READ -----------//
     if(pmt_eq(subp_cmd, s_op_spi_read)) {
       
+      long urid     = pmt_to_long(pmt_nth(0, subp_data));
+      long enables  = pmt_to_long(pmt_nth(1, subp_data));
+      long format   = pmt_to_long(pmt_nth(2, subp_data));
+      long opt      = pmt_to_long(pmt_nth(3, subp_data));
+      long n_bytes  = pmt_to_long(pmt_nth(4, subp_data));
+      
       // Generate an RID for the READ
-      long rid = d_op_spi_read_rid % D_OP_SPI_READ_MAX_RID;
-      d_op_spi_read_owners[rid] = port->port_symbol();
+      long srid = d_op_spi_read_rid % D_OP_SPI_READ_MAX_RID;
+      long rid = (
+          ((urid & 0x07) << 3)
+        | ((srid & 0x07)));
       
-      long enables = pmt_to_long(pmt_nth(1, subp_data));
-      long format = pmt_to_long(pmt_nth(2, subp_data));
-      long opt = pmt_to_long(pmt_nth(3, subp_data));
-      long n_bytes = pmt_to_long(pmt_nth(4, subp_data));
+      d_op_spi_read_owners[srid] = port->port_symbol();
 
       // Make the USB packet
       if(!pkt->cs_spi_read(rid, enables, format, opt, n_bytes))
@@ -931,7 +952,7 @@
                                   v_packet));
         
         // Return the rid
-        d_op_spi_read_owners[rid] = PMT_NIL;
+        d_op_spi_read_owners[srid] = PMT_NIL;
         d_op_spi_read_rid--;
 
         goto new_packet;

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-08-06 14:45:02 UTC (rev 6119)
+++ 
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_server.h  
    2007-08-06 15:29:32 UTC (rev 6120)
@@ -60,19 +60,19 @@
 
   // USRP server assigns and keeps track of request IDs.  
   long d_op_ping_fixed_rid;
-  static const long D_OP_PING_FIXED_MAX_RID = 64;
+  static const long D_OP_PING_FIXED_MAX_RID = 8;
   std::vector<pmt_t> d_op_ping_fixed_owners;
   
   long d_op_read_reg_rid;
-  static const long D_OP_READ_REG_MAX_RID = 64;
+  static const long D_OP_READ_REG_MAX_RID = 8;
   std::vector<pmt_t> d_op_read_reg_owners;
 
   long d_op_i2c_read_rid;
-  static const long D_OP_I2C_READ_MAX_RID = 64;
+  static const long D_OP_I2C_READ_MAX_RID = 8;
   std::vector<pmt_t> d_op_i2c_read_owners;
 
   long d_op_spi_read_rid;
-  static const long D_OP_SPI_READ_MAX_RID = 64;
+  static const long D_OP_SPI_READ_MAX_RID = 8;
   std::vector<pmt_t> d_op_spi_read_owners;
 
   struct channel_info {





reply via email to

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