[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r6402 - gnuradio/branches/developers/gnychis/inband/us
From: |
gnychis |
Subject: |
[Commit-gnuradio] r6402 - gnuradio/branches/developers/gnychis/inband/usrp/host/apps-inband |
Date: |
Tue, 11 Sep 2007 12:24:43 -0600 (MDT) |
Author: gnychis
Date: 2007-09-11 12:24:42 -0600 (Tue, 11 Sep 2007)
New Revision: 6402
Modified:
gnuradio/branches/developers/gnychis/inband/usrp/host/apps-inband/gmac.cc
gnuradio/branches/developers/gnychis/inband/usrp/host/apps-inband/gmac.h
Log:
Work in progress on adding a carrier sense deadline.
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 18:21:51 UTC (rev 6401)
+++ gnuradio/branches/developers/gnychis/inband/usrp/host/apps-inband/gmac.cc
2007-09-11 18:24:42 UTC (rev 6402)
@@ -392,8 +392,9 @@
// The initial state is the INIT state.
d_state = INIT_GMAC;
- // Set carrier sense to enabled by default with the specified threshold
- set_carrier_sense(true, 25, PMT_NIL);
+ // Set carrier sense to enabled by default with the specified threshold and
+ // the deadline to 0 -- which is wait forever.
+ set_carrier_sense(true, 25, 0, PMT_NIL);
// Can now notify the application that we are initialized
d_cs->send(s_response_gmac_initialized,
@@ -410,7 +411,7 @@
//
// We currently do not wait for the successful response for the write to
// register command, we assume it will succeed else the MAC must
-void gmac::set_carrier_sense(bool toggle, long threshold, pmt_t invocation)
+void gmac::set_carrier_sense(bool toggle, long threshold, long deadline, pmt_t
invocation)
{
d_carrier_sense = toggle;
@@ -429,6 +430,20 @@
std::cout << "[GMAC] Changing CS threshold: " << d_cs_thresh <<
std::endl;
}
+ if(deadline != d_cs_deadline) {
+ d_us_tx->send(s_cmd_to_control_channel, // C/S packet
+ pmt_list2(invocation, // invoc handle
+ pmt_list1(
+ pmt_list2(s_op_write_reg,
+ pmt_list2(
+ pmt_from_long(REG_CS_DEADLINE),
+ pmt_from_long(deadline))))));
+ d_cs_deadline = deadline;
+
+ if(verbose)
+ std::cout << "[GMAC] Changing CS deadline: " << d_cs_deadline <<
std::endl;
+ }
+
if(verbose)
std::cout << "[GMAC] Setting carrier sense to " << toggle << std::endl;
}
@@ -599,7 +614,8 @@
{
pmt_t invocation_handle = pmt_nth(0, data);
pmt_t threshold = pmt_nth(1, data);
- long l_threshold;
+ pmt_t deadline = pmt_nth(2, data);
+ long l_threshold, l_deadline;
// FIXME: for now, if threshold is NIL, we do not change the threshold.
// This should be replaced with an averaging algorithm
@@ -607,8 +623,14 @@
l_threshold = d_cs_thresh;
else
l_threshold = pmt_to_long(threshold);
+
+ // If the deadline is NIL, we do not change the value
+ if(pmt_eqv(threshold, PMT_NIL))
+ l_deadline = d_cs_deadline;
+ else
+ l_deadline = pmt_to_long(deadline);
- set_carrier_sense(true, l_threshold, invocation_handle);
+ set_carrier_sense(true, l_threshold, l_deadline, invocation_handle);
}
// This method is called when an incoming disable carrier sense command is sent
@@ -621,12 +643,13 @@
// We don't change the threshold, we leave it as is because the application
// did not request that it changes, only to disable carrier sense.
- set_carrier_sense(false, d_cs_thresh, invocation_handle);
+ set_carrier_sense(false, d_cs_thresh, d_cs_deadline, 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.
+// Likewise if it was disabled. The deadline value should also remain
+// unchanged.
void gmac::handle_cmd_carrier_sense_threshold(pmt_t data)
{
pmt_t invocation_handle = pmt_nth(0, data);
@@ -640,7 +663,7 @@
else
l_threshold = pmt_to_long(threshold);
- set_carrier_sense(d_carrier_sense, l_threshold, invocation_handle);
+ set_carrier_sense(d_carrier_sense, l_threshold, d_cs_deadline,
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 18:21:51 UTC (rev 6401)
+++ gnuradio/branches/developers/gnychis/inband/usrp/host/apps-inband/gmac.h
2007-09-11 18:24:42 UTC (rev 6402)
@@ -58,7 +58,8 @@
long d_cs_deadline;
enum FPGA_REGISTERS {
- REG_CS_THRESH = 1
+ REG_CS_THRESH = 1,
+ REG_CS_DEADLINE = 2
};
public:
@@ -70,7 +71,7 @@
void define_ports();
void initialize_usrp();
void initialize_gmac();
- void set_carrier_sense(bool toggle, long threshold, pmt_t invocation);
+ void set_carrier_sense(bool toggle, long threshold, long deadline, pmt_t
invocation);
void allocate_channels();
void enter_receiving();
void enter_idle();
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r6402 - gnuradio/branches/developers/gnychis/inband/usrp/host/apps-inband,
gnychis <=