commit-gnuradio
[Top][All Lists]
Advanced

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

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


From: gnychis
Subject: [Commit-gnuradio] r6384 - gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband
Date: Mon, 10 Sep 2007 13:29:39 -0600 (MDT)

Author: gnychis
Date: 2007-09-10 13:29:39 -0600 (Mon, 10 Sep 2007)
New Revision: 6384

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_server.cc
   
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_server.mbh
Log:
Making some more perminent changes to support carrier sense.

TX packets now carrier a dictionary to support functionality on a per packet
basis... such as carrier sense.  Else, the USRP server needs additional state
which I don't think is the proper solution.


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-09-10 19:27:12 UTC (rev 6383)
+++ 
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_inband_usb_packet.h
   2007-09-10 19:29:39 UTC (rev 6384)
@@ -64,8 +64,9 @@
     FL_DROPPED        = 0x20000000,
     FL_START_OF_BURST = 0x10000000,
     FL_END_OF_BURST   = 0x08000000,
+    FL_CARRIER_SENSE  = 0x04000000,
 
-    FL_ALL_FLAGS      = 0xf8000000
+    FL_ALL_FLAGS      = 0xfc000000
   };
 
   static const int FL_OVERRUN_SHIFT = 31;

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-09-10 19:27:12 UTC (rev 6383)
+++ 
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_server.cc 
    2007-09-10 19:29:39 UTC (rev 6384)
@@ -596,11 +596,26 @@
   long channel = pmt_to_long(pmt_nth(1, data));
   const void *samples = pmt_uniform_vector_elements(pmt_nth(2, data), n_bytes);
   long timestamp = pmt_to_long(pmt_nth(3, data));
+  pmt_t properties = pmt_nth(4, data);
   
   // Ensure the channel is valid and the caller owns the port
   if(!check_valid(port, channel, chan_info,
                   pmt_list2(s_response_xmit_raw_frame, invocation_handle)))
     return;
+
+  // Read information from the properties of the packet
+  bool carrier_sense = false;
+  if(pmt_is_dict(properties)) {
+
+    // Check if carrier sense is enabled for the frame
+    if(pmt_t p_carrier_sense = pmt_dict_ref(properties, 
+                                            pmt_intern("carrier-sense"), 
+                                            PMT_NIL)) {
+      if(pmt_eqv(p_carrier_sense, PMT_T)) 
+        carrier_sense = true;
+    }
+  }
+
   
   // Determine the number of packets to allocate contiguous memory for
   // bursting over the USB and get a pointer to the memory to be used in
@@ -619,8 +634,16 @@
       std::min((long)(n_bytes-(n*max_payload_len)), (long)max_payload_len);
   
     if(n == 0) { // first packet gets start of burst flag and timestamp
-      pkts[n].set_header(pkts[n].FL_START_OF_BURST, channel, 0, payload_len);
+      
+      if(carrier_sense)
+        pkts[n].set_header(pkts[n].FL_START_OF_BURST 
+                           | pkts[n].FL_CARRIER_SENSE, 
+                           channel, 0, payload_len);
+      else
+        pkts[n].set_header(pkts[n].FL_START_OF_BURST, channel, 0, payload_len);
+
       pkts[n].set_timestamp(timestamp);
+    
     } else {
       pkts[n].set_header(0, channel, 0, payload_len);
       pkts[n].set_timestamp(0xffffffff);

Modified: 
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_server.mbh
===================================================================
--- 
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_server.mbh
    2007-09-10 19:27:12 UTC (rev 6383)
+++ 
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_server.mbh
    2007-09-10 19:29:39 UTC (rev 6384)
@@ -144,7 +144,7 @@
 
   (:outgoing
 
-   (cmd-xmit-raw-frame invocation-handle channel samples timestamp)
+   (cmd-xmit-raw-frame invocation-handle channel samples timestamp properties)
 
    ;; The argument channel must be an integer.  It specifies the
    ;; channel on which the frame of samples will be be sent.





reply via email to

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