[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r6387 - gnuradio/branches/developers/gnychis/inband/us
From: |
gnychis |
Subject: |
[Commit-gnuradio] r6387 - gnuradio/branches/developers/gnychis/inband/usrp/host/apps-inband |
Date: |
Mon, 10 Sep 2007 14:53:26 -0600 (MDT) |
Author: gnychis
Date: 2007-09-10 14:53:25 -0600 (Mon, 10 Sep 2007)
New Revision: 6387
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 GMAC, added CS initialization
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-10 20:21:08 UTC (rev 6386)
+++ gnuradio/branches/developers/gnychis/inband/usrp/host/apps-inband/gmac.cc
2007-09-10 20:53:25 UTC (rev 6387)
@@ -52,8 +52,92 @@
: mb_mblock(rt, instance_name, user_arg)
{
+ // When the MAC layer is initialized, we must connect to the USRP and setup
+ // channels. We begin by defining ports to connect to the 'usrp_server'
block
+ // and then initialize the USRP by opening it through the 'usrp_server.'
+
+ // Initialize the ports
+ define_ports();
+
+ // Initialize the connection to the USRP
+ initialize_usrp();
+
+ // Initialize the MAC layer
+ initialize_gmac();
}
gmac::~gmac()
{
}
+
+// The MAC layer connects to 'usrp_server' which has a control/status channel,
+// a TX, and an RX port. The MAC layer can then relay TX/RX data back and
+// forth to the application, or a physical layer once available.
+void gmac::define_ports()
+{
+ d_tx = define_port("tx0", "usrp-tx", false, mb_port::INTERNAL);
+ d_rx = define_port("rx0", "usrp-rx", false, mb_port::INTERNAL);
+ d_cs = define_port("cs", "usrp-server-cs", false, mb_port::INTERNAL);
+}
+
+// To initialize the USRP we must pass several parameters to 'usrp_server' such
+// as the RBF to use, and the interpolation/decimation rate. The MAC layer
will
+// then pass these parameters to the block with a message to establish the
+// connection to the USRP.
+void gmac::initialize_usrp()
+{
+
+ // The initialization parameters are passed to usrp_server via a PMT
+ // dictionary.
+ pmt_t usrp_dict = pmt_make_dict();
+
+ // Specify the RBF to use
+ pmt_dict_set(usrp_dict,
+ pmt_intern("rbf"),
+ pmt_intern("cs1.rbf"));
+
+ pmt_dict_set(usrp_dict,
+ pmt_intern("interp-tx"),
+ pmt_from_long(128));
+
+ pmt_dict_set(usrp_dict,
+ pmt_intern("decim-rx"),
+ pmt_from_long(16));
+
+ // Center frequency
+ pmt_dict_set(usrp_dict,
+ pmt_intern("rf-freq"),
+ pmt_from_long(10e6));
+
+ define_component("server", "usrp_server", usrp_dict);
+}
+
+// In the initialization state of the MAC layer we set default values for
+// several functionalities.
+void gmac::initialize_gmac()
+{
+
+ // Set carrier sense to enabled by default with the specified threshold
+ set_carrier_sense(true, 21, PMT_NIL);
+
+}
+
+// Method for setting the carrier sense and an associated threshold which is
+// written to a register on the FPGA, which it will read if the CS flag is set
+// and perform carrier sense based on.
+//
+// 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)
+{
+ d_carrier_sense = toggle;
+ d_cs_thresh = threshold;
+
+ d_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_THRESH),
+ pmt_from_long(d_cs_thresh))))));
+}
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-10 20:21:08 UTC (rev 6386)
+++ gnuradio/branches/developers/gnychis/inband/usrp/host/apps-inband/gmac.h
2007-09-10 20:53:25 UTC (rev 6387)
@@ -32,12 +32,23 @@
mb_port_sptr d_cs;
mb_port_sptr d_tx;
mb_port_sptr d_rx;
+
+ bool d_carrier_sense;
+ long d_cs_thresh;
+
+ enum FPGA_REGISTERS {
+ REG_CS_THRESH = 1
+ };
public:
gmac(mb_runtime *rt, const std::string &instance_name, pmt_t user_arg);
~gmac();
private:
+ void define_ports();
+ void initialize_usrp();
+ void initialize_gmac();
+ void set_carrier_sense(bool toggle, long threshold, pmt_t invocation);
};
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r6387 - gnuradio/branches/developers/gnychis/inband/usrp/host/apps-inband,
gnychis <=