[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r6395 - gnuradio/branches/developers/gnychis/inband/us
From: |
gnychis |
Subject: |
[Commit-gnuradio] r6395 - gnuradio/branches/developers/gnychis/inband/usrp/host/apps-inband |
Date: |
Mon, 10 Sep 2007 20:59:13 -0600 (MDT) |
Author: gnychis
Date: 2007-09-10 20:59:13 -0600 (Mon, 10 Sep 2007)
New Revision: 6395
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:
GMAC now handles packet transmissions and responses back from the USRP server.
This would essentially be replaced by code which passes the data to and from a
physical layer, which then gets passed to usrp_server.
Disabled RX side until the memory leak is found, else the TX side is crippled.
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 02:11:50 UTC (rev 6394)
+++ gnuradio/branches/developers/gnychis/inband/usrp/host/apps-inband/gmac.cc
2007-09-11 02:59:13 UTC (rev 6395)
@@ -104,7 +104,8 @@
// switch states to allocating the channels for use.
case OPENING_USRP:
- if(pmt_eq(event, s_response_open)) {
+ if(pmt_eq(event, s_response_open)
+ && pmt_eq(d_us_cs->port_symbol(), port_id)) {
status = pmt_nth(1, data); // PMT_T or PMT_F
@@ -142,7 +143,7 @@
// If the RX has also been allocated already, we can continue
if(!pmt_eqv(d_us_rx_chan, PMT_NIL)) {
- enter_receiving();
+ //enter_receiving();
initialize_gmac();
}
@@ -170,7 +171,7 @@
// If the TX has also been allocated already, we can continue
if(!pmt_eqv(d_us_tx_chan, PMT_NIL)) {
- enter_receiving();
+ //enter_receiving();
initialize_gmac();
}
@@ -196,6 +197,21 @@
// anything specific. It is still being passive with data between the
// application and the lower layer.
case IDLE:
+
+ //-------- INCOMING PACKET ------------------------------------------- //
+ if(pmt_eq(event, s_cmd_tx_pkt)
+ && pmt_eq(d_tx->port_symbol(), port_id)) {
+ handle_cmd_tx_pkt(data);
+ return;
+ }
+
+ //-------- INCOMING PACKET RESPONSE ---------------------------------- //
+ if(pmt_eq(event, s_response_xmit_raw_frame)
+ && pmt_eq(d_us_tx->port_symbol(), port_id)) {
+ handle_response_xmit_raw_frame(data);
+ return;
+ }
+
goto unhandled;
//------------------------ CLOSING CHANNELS -----------------------------//
@@ -270,7 +286,7 @@
// Received an unhandled message for a specific state
unhandled:
if(0 && verbose && !pmt_eq(event, pmt_intern("%shutdown")))
- std::cout << "test_usrp_inband_us_tx: unhandled msg: " << msg
+ std::cout << "[GMAC] unhandled msg: " << msg
<< "in state "<< d_state << std::endl;
}
@@ -351,6 +367,10 @@
// Can now notify the application that we are initialized
d_cs->send(s_response_gmac_initialized,
pmt_list2(PMT_NIL, PMT_T));
+
+ // The MAC enters an IDLE state where it waits for messages and dispatches
+ // based on them
+ enter_idle();
}
// Method for setting the carrier sense and an associated threshold which is
@@ -446,4 +466,57 @@
d_state = IDLE;
}
+// Handles the transmission of a pkt from the application. The invocation
+// handle is passed on but a response is not given back to the application
until
+// the response is passed from usrp_server. This ensures that the MAC passes
+// back the success or failure. Furthermore, the MAC could decide to
retransmit
+// on a failure based on the result of the packet transmission.
+//
+// This should eventually be connected to a physically layer rather than
+// directly to usrp_server. (d_us_tx should be replaced with a different
+// connection)
+void gmac::handle_cmd_tx_pkt(pmt_t data)
+{
+ pmt_t invocation_handle = pmt_nth(0, data);
+ pmt_t dst = pmt_nth(1, data);
+ pmt_t samples = pmt_nth(2, data);
+ pmt_t properties = pmt_nth(3, data);
+
+ pmt_t timestamp = pmt_from_long(0xffffffff); // NOW
+
+ pmt_t tx_properties = pmt_make_dict();
+
+ // Set the packet to be carrier sensed?
+ if(d_carrier_sense)
+ pmt_dict_set(tx_properties,
+ pmt_intern("carrier-sense"),
+ PMT_T);
+
+
+ // Construct the proper message for USRP server
+ d_us_tx->send(s_cmd_xmit_raw_frame,
+ pmt_list5(invocation_handle,
+ d_us_tx_chan,
+ samples,
+ timestamp,
+ tx_properties));
+
+ if(verbose && 0)
+ std::cout << "[GMAC] Transmitted packet\n";
+}
+
+// Handles a response from the USRP server about the transmission of a frame,
+// whether it was successful or failed. This should eventually be replaced
with
+// a response from the PHY layer. This is where a retransmit could be
+// implemented.
+void gmac::handle_response_xmit_raw_frame(pmt_t data)
+{
+ pmt_t invocation_handle = pmt_nth(0, data);
+ pmt_t status = pmt_nth(1, data);
+
+ d_tx->send(s_response_tx_pkt,
+ pmt_list2(invocation_handle,
+ status));
+}
+
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 02:11:50 UTC (rev 6394)
+++ gnuradio/branches/developers/gnychis/inband/usrp/host/apps-inband/gmac.h
2007-09-11 02:59:13 UTC (rev 6395)
@@ -76,6 +76,8 @@
void close_channels();
void open_usrp();
void close_usrp();
+ void handle_cmd_tx_pkt(pmt_t data);
+ void handle_response_xmit_raw_frame(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 02:11:50 UTC (rev 6394)
+++
gnuradio/branches/developers/gnychis/inband/usrp/host/apps-inband/test_gmac_tx.cc
2007-09-11 02:59:13 UTC (rev 6395)
@@ -160,7 +160,7 @@
return;
}
else {
- error_msg = "bad response-xmit-raw-frame:";
+ error_msg = "bad response-tx-pkt:";
goto bail;
}
}
@@ -179,7 +179,7 @@
// Received an unhandled message for a specific state
unhandled:
if(verbose && !pmt_eq(event, pmt_intern("%shutdown")))
- std::cout << "test_usrp_inband_tx: unhandled msg: " << msg
+ std::cout << "[TEST_GMAC_TX] unhandled msg: " << msg
<< "in state "<< d_state << std::endl;
}
@@ -255,7 +255,7 @@
d_nsamples_xmitted += nsamples_this_frame;
d_nframes_xmitted++;
- if(verbose)
+ if(verbose && 0)
std::cout << "[TEST_GMAC_TX] Transmitted frame\n";
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r6395 - gnuradio/branches/developers/gnychis/inband/usrp/host/apps-inband,
gnychis <=