[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r6400 - gnuradio/branches/developers/gnychis/inband/us
From: |
gnychis |
Subject: |
[Commit-gnuradio] r6400 - gnuradio/branches/developers/gnychis/inband/usrp/host/apps-inband |
Date: |
Tue, 11 Sep 2007 12:16:48 -0600 (MDT) |
Author: gnychis
Date: 2007-09-11 12:16:48 -0600 (Tue, 11 Sep 2007)
New Revision: 6400
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/gmac.mbh
gnuradio/branches/developers/gnychis/inband/usrp/host/apps-inband/gmac_symbols.h
gnuradio/branches/developers/gnychis/inband/usrp/host/apps-inband/test_gmac_tx.cc
Log:
Adding in ability to change carrier sense threshold without changing the state
of the carrier sense (enabled/disabled)
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 17:35:26 UTC (rev 6399)
+++ gnuradio/branches/developers/gnychis/inband/usrp/host/apps-inband/gmac.cc
2007-09-11 18:16:48 UTC (rev 6400)
@@ -228,6 +228,12 @@
handle_cmd_carrier_sense_enable(data);
return;
}
+
+ //------- CARRIER SENSE THRESHOLD -----------------------------------//
+ if(pmt_eq(event, s_cmd_carrier_sense_threshold)) {
+ handle_cmd_carrier_sense_threshold(data);
+ return;
+ }
//------- DISABLE CARRIER SENSE -------------------------------------//
if(pmt_eq(event, s_cmd_carrier_sense_disable)) {
@@ -618,4 +624,23 @@
set_carrier_sense(false, d_cs_thresh, invocation_handle);
}
+// When the app requests that the threshold changes, the state of the carrier
+// sense should not change. If it was enabled, it should remain enabled.
+// Likewise if it was disabled.
+void gmac::handle_cmd_carrier_sense_threshold(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(d_carrier_sense, l_threshold, invocation_handle);
+}
+
REGISTER_MBLOCK_CLASS(gmac);
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 17:35:26 UTC (rev 6399)
+++ gnuradio/branches/developers/gnychis/inband/usrp/host/apps-inband/gmac.h
2007-09-11 18:16:48 UTC (rev 6400)
@@ -55,6 +55,7 @@
bool d_carrier_sense;
long d_cs_thresh;
+ long d_cs_deadline;
enum FPGA_REGISTERS {
REG_CS_THRESH = 1
@@ -80,6 +81,7 @@
void handle_response_xmit_raw_frame(pmt_t data);
bool carrier_sense_pkt(pmt_t pkt_properties);
void handle_cmd_carrier_sense_enable(pmt_t data);
+ void handle_cmd_carrier_sense_threshold(pmt_t data);
void handle_cmd_carrier_sense_disable(pmt_t data);
};
Modified:
gnuradio/branches/developers/gnychis/inband/usrp/host/apps-inband/gmac.mbh
===================================================================
--- gnuradio/branches/developers/gnychis/inband/usrp/host/apps-inband/gmac.mbh
2007-09-11 17:35:26 UTC (rev 6399)
+++ gnuradio/branches/developers/gnychis/inband/usrp/host/apps-inband/gmac.mbh
2007-09-11 18:16:48 UTC (rev 6400)
@@ -121,7 +121,8 @@
;; Threshold represents the carrier sense threshold based on the digital
;; reading out of the DAC. If the threshold is set to PMT_NIL then the
;; MAC will use averaging to determine an appropriate threshold.
- (cmd-carrier-sense-enable invocation-handle threshold)
+ (cmd-carrier-sense-enable invocation-handle threshold deadline)
+ (cmd-carrier-sense-threshold invocation-handle threshold)
(cmd-carrier-sense-disable invocation-handle)
;; Setting the number of fast transmission retries on a failure before
@@ -135,6 +136,7 @@
(response-gmac-initialized invocation-handle status)
(response-carrier-sense-enable invocation-handle status)
+ (response-carrier-sense-threshold invocation-handle status)
(response-carrier-sense-disable invocation-handle status)
(response-set-tx-retries invocation-handle status)
Modified:
gnuradio/branches/developers/gnychis/inband/usrp/host/apps-inband/gmac_symbols.h
===================================================================
---
gnuradio/branches/developers/gnychis/inband/usrp/host/apps-inband/gmac_symbols.h
2007-09-11 17:35:26 UTC (rev 6399)
+++
gnuradio/branches/developers/gnychis/inband/usrp/host/apps-inband/gmac_symbols.h
2007-09-11 18:16:48 UTC (rev 6400)
@@ -33,10 +33,12 @@
// CS
static pmt_t s_cmd_carrier_sense_enable =
pmt_intern("cmd-carrier-sense-enable");
+static pmt_t s_cmd_carrier_sense_threshold =
pmt_intern("cmd-carrier-sense-threshold");
static pmt_t s_cmd_carrier_sense_disable =
pmt_intern("cmd-carrier-sense-disable");
static pmt_t s_cmd_set_tx_retries = pmt_intern("cmd-set-tx-retries");
static pmt_t s_response_gmac_initialized =
pmt_intern("response-gmac-initialized");
static pmt_t s_response_carrier_sense_enable =
pmt_intern("response-carrier-sense-enable");
+static pmt_t s_response_carrier_sense_treshold =
pmt_intern("response-carrier-sense-threshold");
static pmt_t s_response_carrier_sense_disable =
pmt_intern("response-carrier-sense-disable");
static pmt_t s_response_set_tx_retries = pmt_intern("response-set-tx-retries");
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 17:35:26 UTC (rev 6399)
+++
gnuradio/branches/developers/gnychis/inband/usrp/host/apps-inband/test_gmac_tx.cc
2007-09-11 18:16:48 UTC (rev 6400)
@@ -242,24 +242,41 @@
// 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 > 35000) {
-// pmt_dict_set(tx_properties,
-// pmt_intern("carrier-sense"),
-// PMT_NIL);
-// }
-//
-// if(d_nframes_xmitted == 40000) {
-// d_cs->send(s_cmd_carrier_sense_enable,
-// pmt_list2(PMT_NIL,
-// pmt_from_long(100)));
-// }
+ if(d_nframes_xmitted > 25000) {
+ pmt_dict_set(tx_properties,
+ pmt_intern("carrier-sense"),
+ PMT_F);
+ }
+ if(d_nframes_xmitted > 35000) {
+ pmt_dict_set(tx_properties,
+ pmt_intern("carrier-sense"),
+ PMT_NIL);
+ }
+
+ if(d_nframes_xmitted == 45000) {
+ d_cs->send(s_cmd_carrier_sense_threshold,
+ pmt_list2(PMT_NIL,
+ pmt_from_long(100)));
+ }
+
+ if(d_nframes_xmitted == 60000) {
+ d_cs->send(s_cmd_carrier_sense_threshold,
+ pmt_list2(PMT_NIL,
+ pmt_from_long(25)));
+ }
+
+ if(d_nframes_xmitted == 75000) {
+ d_cs->send(s_cmd_carrier_sense_disable,
+ pmt_list1(PMT_NIL));
+ }
+
+ if(d_nframes_xmitted > 90000) {
+ pmt_dict_set(tx_properties,
+ pmt_intern("carrier-sense"),
+ PMT_T);
+ }
+
pmt_t timestamp = pmt_from_long(0xffffffff); // NOW
d_tx->send(s_cmd_tx_pkt,
pmt_list4(PMT_NIL, // invocation-handle
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r6400 - gnuradio/branches/developers/gnychis/inband/usrp/host/apps-inband,
gnychis <=