commit-gnuradio
[Top][All Lists]
Advanced

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

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


From: gnychis
Subject: [Commit-gnuradio] r6398 - gnuradio/branches/developers/gnychis/inband/usrp/host/apps-inband
Date: Tue, 11 Sep 2007 09:51:30 -0600 (MDT)

Author: gnychis
Date: 2007-09-11 09:51:30 -0600 (Tue, 11 Sep 2007)
New Revision: 6398

Modified:
   gnuradio/branches/developers/gnychis/inband/usrp/host/apps-inband/gmac.cc
   gnuradio/branches/developers/gnychis/inband/usrp/host/apps-inband/gmac.h
   
gnuradio/branches/developers/gnychis/inband/usrp/host/apps-inband/test_gmac_tx.cc
Log:
Adding ability to enable carrier sense through a C/S command to GMAC


Modified: 
gnuradio/branches/developers/gnychis/inband/usrp/host/apps-inband/gmac.cc
===================================================================
--- gnuradio/branches/developers/gnychis/inband/usrp/host/apps-inband/gmac.cc   
2007-09-11 15:32:18 UTC (rev 6397)
+++ gnuradio/branches/developers/gnychis/inband/usrp/host/apps-inband/gmac.cc   
2007-09-11 15:51:30 UTC (rev 6398)
@@ -222,6 +222,12 @@
 
       //--------- CS PORT ---------------------------------------------------//
       if(pmt_eq(d_cs->port_symbol(), port_id)) {
+        
+        //------- ENABLE CARRIER SENSE --------------------------------------//
+        if(pmt_eq(event, s_cmd_enable_carrier_sense)) {
+          handle_cmd_enable_carrier_sense(data);
+          return;
+        }
 
         //------- DISABLE CARRIER SENSE -------------------------------------//
         if(pmt_eq(event, s_cmd_disable_carrier_sense)) {
@@ -579,6 +585,26 @@
 
 }
 
+// This method is envoked by an incoming cmd-enable-carrier-sense signal on the
+// C/S port.  It can be used to re-adjust the threshold or simply enabled
+// carrier sense.  When a threshold is not provided, the MAC will use an
+// averaging algorithm to determine the threshold (in the future).
+void gmac::handle_cmd_enable_carrier_sense(pmt_t data)
+{
+  pmt_t invocation_handle = pmt_nth(0, data);
+  pmt_t threshold = pmt_nth(1, data);
+  long l_threshold;
+
+  // FIXME: for now, if threshold is NIL, we do not change the threshold.
+  // This should be replaced with an averaging algorithm
+  if(pmt_eqv(threshold, PMT_NIL))
+    l_threshold = d_cs_thresh;
+  else
+    l_threshold = pmt_to_long(threshold);
+  
+  set_carrier_sense(true, l_threshold, invocation_handle);
+}
+
 // This method is called when an incoming disable carrier sense command is sent
 // over the control status channel.  It so far does not ellicit a response, 
this
 // needs to be added correctly.  It needs to wait for the response for the C/S

Modified: 
gnuradio/branches/developers/gnychis/inband/usrp/host/apps-inband/gmac.h
===================================================================
--- gnuradio/branches/developers/gnychis/inband/usrp/host/apps-inband/gmac.h    
2007-09-11 15:32:18 UTC (rev 6397)
+++ gnuradio/branches/developers/gnychis/inband/usrp/host/apps-inband/gmac.h    
2007-09-11 15:51:30 UTC (rev 6398)
@@ -79,6 +79,7 @@
   void handle_cmd_tx_pkt(pmt_t data);
   void handle_response_xmit_raw_frame(pmt_t data);
   bool carrier_sense_pkt(pmt_t pkt_properties);
+  void handle_cmd_enable_carrier_sense(pmt_t data);
   void handle_cmd_disable_carrier_sense(pmt_t data);
  
 };

Modified: 
gnuradio/branches/developers/gnychis/inband/usrp/host/apps-inband/test_gmac_tx.cc
===================================================================
--- 
gnuradio/branches/developers/gnychis/inband/usrp/host/apps-inband/test_gmac_tx.cc
   2007-09-11 15:32:18 UTC (rev 6397)
+++ 
gnuradio/branches/developers/gnychis/inband/usrp/host/apps-inband/test_gmac_tx.cc
   2007-09-11 15:51:30 UTC (rev 6398)
@@ -241,23 +241,25 @@
     
   // Per packet properties
   pmt_t tx_properties = pmt_make_dict();
-
+    
   if(d_nframes_xmitted > 25000) {
     pmt_dict_set(tx_properties,
                  pmt_intern("carrier-sense"),
                  PMT_F);
   }
 
-  if(d_nframes_xmitted > 40000) {
+  if(d_nframes_xmitted > 35000) {
     pmt_dict_set(tx_properties,
                  pmt_intern("carrier-sense"),
                  PMT_NIL);
   }
-//
-//  if(d_nframes_xmitted > 60000) {
-//    d_cs->send(s_cmd_disable_carrier_sense, pmt_list1(PMT_NIL));
-//  }
 
+  if(d_nframes_xmitted == 40000) {
+    d_cs->send(s_cmd_enable_carrier_sense, 
+               pmt_list2(PMT_NIL,
+                         pmt_from_long(100)));
+  }
+
   pmt_t timestamp = pmt_from_long(0xffffffff); // NOW
   d_tx->send(s_cmd_tx_pkt,
             pmt_list4(PMT_NIL,   // invocation-handle





reply via email to

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