[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r5157 - gnuradio/branches/developers/gnychis/inband/us
From: |
gnychis |
Subject: |
[Commit-gnuradio] r5157 - gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband |
Date: |
Fri, 27 Apr 2007 13:00:11 -0600 (MDT) |
Author: gnychis
Date: 2007-04-27 13:00:11 -0600 (Fri, 27 Apr 2007)
New Revision: 5157
Removed:
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/qa_inband_usrp_server.mbh
Modified:
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/Makefile.am
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/qa_inband_usrp_server.cc
Log:
removing the src and sink from the channel test code and moved everything to
the top level block
Modified:
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/Makefile.am
===================================================================
---
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/Makefile.am
2007-04-27 18:35:40 UTC (rev 5156)
+++
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/Makefile.am
2007-04-27 19:00:11 UTC (rev 5157)
@@ -64,15 +64,10 @@
# ------------------------------------------------------------------------
# Build the qa code in its own library
-qa_inband_usrp_server_mbh.cc : qa_inband_usrp_server.mbh
- $(COMPILE_MBH) qa_inband_usrp_server.mbh qa_inband_usrp_server_mbh.cc
-
-
libusrp_inband_qa_la_SOURCES = \
qa_inband.cc \
qa_inband_packet_prims.cc \
- qa_inband_usrp_server.cc \
- qa_inband_usrp_server_mbh.cc
+ qa_inband_usrp_server.cc
# magic flags
libusrp_inband_qa_la_LDFLAGS = $(NO_UNDEFINED) -avoid-version
Modified:
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/qa_inband_usrp_server.cc
===================================================================
---
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/qa_inband_usrp_server.cc
2007-04-27 18:35:40 UTC (rev 5156)
+++
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/qa_inband_usrp_server.cc
2007-04-27 19:00:11 UTC (rev 5157)
@@ -38,114 +38,66 @@
//
----------------------------------------------------------------------------------------------
-class qa_alloc_src : public mb_mblock
+class qa_alloc_top : public mb_mblock
{
- mb_port_sptr d_cs_top;
- mb_port_sptr d_cs;
+ mb_port_sptr d_tx;
+ mb_port_sptr d_rx;
- mb_port_sptr d_out;
+ long d_nmsgs_to_recv;
+ long d_nrecvd;
- long d_capacity_rqstd;
- pmt_t d_expected_result;
-
public:
- qa_alloc_src(mb_runtime *runtime, const std::string &instance_name, pmt_t
user_arg);
+ qa_alloc_top(mb_runtime *runtime, const std::string &instance_name, pmt_t
user_arg);
+ ~qa_alloc_top();
+ void initial_transition();
void handle_message(mb_message_sptr msg);
protected:
- void request_capacity();
+ void check_message(mb_message_sptr msg);
};
-qa_alloc_src::qa_alloc_src(mb_runtime *runtime, const std::string
&instance_name, pmt_t user_arg)
+qa_alloc_top::qa_alloc_top(mb_runtime *runtime, const std::string
&instance_name, pmt_t user_arg)
: mb_mblock(runtime, instance_name, user_arg)
{
- d_cs_top = define_port("cs_top", "qa-alloc-cs", true, mb_port::EXTERNAL);
- d_cs = define_port("cs", "qa-alloc-cs", true, mb_port::EXTERNAL);
-
- d_out = define_port("out", "usrp-tx", false, mb_port::EXTERNAL);
+ d_tx = define_port("tx0", "usrp-tx", false, mb_port::INTERNAL);
+ define_component("server", "usrp_server", PMT_F);
+ connect("self", "tx0", "server", "tx0");
}
-void
-qa_alloc_src::handle_message(mb_message_sptr msg)
-{
- pmt_t data = msg->data();
+qa_alloc_top::~qa_alloc_top(){}
- if ((pmt_eq(msg->port_id(), d_cs_top->port_symbol())
- || pmt_eq(msg->port_id(), d_cs->port_symbol()))
- && pmt_eq(msg->signal(), s_send_allocate_channel)){
-
- d_capacity_rqstd = pmt_to_long(pmt_nth(0, data));
- d_expected_result = pmt_nth(1, data);
-
- request_capacity();
- }
-
- if (pmt_eq(msg->port_id(), d_out->port_symbol())
- && pmt_eq(msg->signal(), s_response_allocate_channel)){
-
- d_cs->send(msg->signal(), data);
- }
-}
-
void
-qa_alloc_src::request_capacity()
+qa_alloc_top::initial_transition()
{
- std::cout << "Sending capacity request of " << d_capacity_rqstd << "\n";
- d_out->send(s_cmd_allocate_channel, pmt_list2(d_expected_result,
pmt_from_long(d_capacity_rqstd)));
-}
-REGISTER_MBLOCK_CLASS(qa_alloc_src);
+ d_nmsgs_to_recv = 2;
-//
----------------------------------------------------------------------------------------------
+ // should be able to allocate 100 bytes
+ d_tx->send(s_cmd_allocate_channel, pmt_list2(PMT_T, pmt_from_long(100)));
-class qa_alloc_sink : public mb_mblock
-{
- static const size_t MAX_MSGS = 1 * 1024 * 1024;
-
- mb_port_sptr d_in0;
-
- long d_nmsgs_to_recv;
- long d_nrecvd;
-
- public:
- qa_alloc_sink(mb_runtime *runtime, const std::string &instance_name, pmt_t
user_arg);
- void handle_message(mb_message_sptr msg);
-
- protected:
- void check_message(mb_message_sptr msg);
-};
-
-qa_alloc_sink::qa_alloc_sink(mb_runtime *runtime, const std::string
&instance_name, pmt_t user_arg)
- : mb_mblock(runtime, instance_name, user_arg),
- d_nrecvd(0)
-{
- d_nmsgs_to_recv = pmt_to_long(pmt_nth(0, user_arg));
-
-
- if (d_nmsgs_to_recv > (long) MAX_MSGS)
- throw std::out_of_range("qa_alloc_sink: nmsgs_to_recv is too big");
-
- d_in0 = define_port("in", "qa-alloc-cs", false, mb_port::EXTERNAL);
+ // should not be able to allocate max capacity after 100 bytes were allocated
+ d_tx->send(s_cmd_allocate_channel, pmt_list2(PMT_F,
pmt_from_long(usrp_server::max_capacity())));
}
void
-qa_alloc_sink::handle_message(mb_message_sptr msg)
+qa_alloc_top::handle_message(mb_message_sptr msg)
{
- if (pmt_eq(msg->port_id(), d_in0->port_symbol())
- && pmt_eq(msg->signal(), s_response_allocate_channel)){
-
+ pmt_t data = msg->data();
+
+ if (pmt_eq(msg->port_id(), d_tx->port_symbol())
+ && pmt_eq(msg->signal(), s_response_allocate_channel)){
check_message(msg);
}
}
void
-qa_alloc_sink::check_message(mb_message_sptr msg)
+qa_alloc_top::check_message(mb_message_sptr msg)
{
pmt_t data = msg->data();
pmt_t expected_result = pmt_nth(0, data);
pmt_t result = pmt_nth(1, data);
-
+
d_nrecvd++;
if(!pmt_eq(expected_result, result))
@@ -157,51 +109,6 @@
shutdown_all(PMT_T);
}
-REGISTER_MBLOCK_CLASS(qa_alloc_sink);
-
-//
----------------------------------------------------------------------------------------------
-
-class qa_alloc_top : public mb_mblock
-{
- mb_port_sptr d_cs;
-
- public:
- qa_alloc_top(mb_runtime *runtime, const std::string &instance_name, pmt_t
user_arg);
- ~qa_alloc_top();
- void initial_transition();
- void handle_message(mb_message_sptr msg);
-};
-
-qa_alloc_top::qa_alloc_top(mb_runtime *runtime, const std::string
&instance_name, pmt_t user_arg)
- : mb_mblock(runtime, instance_name, user_arg)
-{
- d_cs = define_port("cs", "qa-alloc-cs", false, mb_port::INTERNAL);
-
- define_component("server", "usrp_server", PMT_F);
- define_component("src", "qa_alloc_src", PMT_F);
- define_component("sink", "qa_alloc_sink", pmt_list1(pmt_from_long(2))); //
number of expected responses
-
- connect("self", "cs", "src", "cs_top");
- connect("src", "out", "server", "tx0");
- connect("src", "cs", "sink", "in");
-}
-
-qa_alloc_top::~qa_alloc_top(){}
-
-void
-qa_alloc_top::initial_transition()
-{
- // should be able to allocate 100 bytes
- d_cs->send(s_send_allocate_channel, pmt_list2(pmt_from_long(100), PMT_T));
- // should not be able to allocate max capacity after 100 bytes were allocated
- d_cs->send(s_send_allocate_channel,
pmt_list2(pmt_from_long(usrp_server::max_capacity()), PMT_F));
-}
-
-void
-qa_alloc_top::handle_message(mb_message_sptr msg)
-{
-}
-
REGISTER_MBLOCK_CLASS(qa_alloc_top);
Deleted:
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/qa_inband_usrp_server.mbh
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r5157 - gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband,
gnychis <=