[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r5523 - gnuradio/branches/developers/gnychis/inband/us
From: |
gnychis |
Subject: |
[Commit-gnuradio] r5523 - gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband |
Date: |
Tue, 22 May 2007 23:23:50 -0600 (MDT) |
Author: gnychis
Date: 2007-05-22 23:23:50 -0600 (Tue, 22 May 2007)
New Revision: 5523
Added:
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/test_usrp_inband.cc
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
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_server.cc
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_usb_interface.cc
Log:
Adding in new usrp inband test that is seperate from the CppUnit tests since
this is not only a GNU Radio test, but a test with the USRP which is not
required for GNU Radio.
Code is incomplete, checking it in to check it out on a local machine with a
USRP for testing
Modified:
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/Makefile.am
===================================================================
---
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/Makefile.am
2007-05-23 04:57:49 UTC (rev 5522)
+++
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/Makefile.am
2007-05-23 05:23:50 UTC (rev 5523)
@@ -94,11 +94,15 @@
# ------------------------------------------------------------------------
noinst_PROGRAMS = \
- test_inband
+ test_inband \
+ test_usrp_inband
test_inband_SOURCES = test_inband.cc
test_inband_LDADD = libusrp_inband-qa.la
+test_usrp_inband_SOURCES = test_usrp_inband.cc
+test_usrp_inband_LDADD = libusrp_inband-qa.la
+
MOSTLYCLEANFILES = \
$(BUILT_SOURCES) *~ *.pyc
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-05-23 04:57:49 UTC (rev 5522)
+++
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/qa_inband_usrp_server.cc
2007-05-23 05:23:50 UTC (rev 5523)
@@ -38,6 +38,8 @@
typedef usrp_inband_usb_packet transport_pkt; // makes conversion to gigabit
easy
+static pmt_t s_cmd_open = pmt_intern("cmd-open");
+static pmt_t s_response_open = pmt_intern("response-open");
static pmt_t s_cmd_allocate_channel = pmt_intern("cmd-allocate-channel");
static pmt_t s_response_allocate_channel =
pmt_intern("response-allocate-channel");
static pmt_t s_send_allocate_channel = pmt_intern("send-allocate-channel");
Added:
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/test_usrp_inband.cc
===================================================================
---
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/test_usrp_inband.cc
(rev 0)
+++
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/test_usrp_inband.cc
2007-05-23 05:23:50 UTC (rev 5523)
@@ -0,0 +1,137 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdio.h>
+#include <iostream>
+#include <usrp_inband_usb_packet.h>
+#include <mb_mblock.h>
+#include <mb_runtime.h>
+#include <mb_protocol_class.h>
+#include <mb_class_registry.h>
+#include <pmt.h>
+
+typedef usrp_inband_usb_packet transport_pkt;
+
+// Signal set for the USRP server
+static pmt_t s_cmd_open = pmt_intern("cmd-open");
+static pmt_t s_response_open = pmt_intern("response-open");
+static pmt_t s_cmd_allocate_channel = pmt_intern("cmd-allocate-channel");
+static pmt_t s_response_allocate_channel =
pmt_intern("response-allocate-channel");
+static pmt_t s_send_allocate_channel = pmt_intern("send-allocate-channel");
+static pmt_t s_cmd_deallocate_channel = pmt_intern("cmd-deallocate-channel");
+static pmt_t s_response_deallocate_channel =
pmt_intern("response-deallocate-channel");
+static pmt_t s_send_deallocate_channel = pmt_intern("send-deallocate-channel");
+static pmt_t s_cmd_max_capacity = pmt_intern("cmd-max-capacity");
+static pmt_t s_response_max_capacity = pmt_intern("response-max-capacity");
+static pmt_t s_cmd_ntx_chan = pmt_intern("cmd-ntx-chan");
+static pmt_t s_cmd_nrx_chan = pmt_intern("cmd-nrx-chan");
+static pmt_t s_response_ntx_chan = pmt_intern("response-ntx-chan");
+static pmt_t s_response_nrx_chan = pmt_intern("response-nrx-chan");
+static pmt_t s_cmd_current_capacity_allocation =
pmt_intern("cmd-current-capacity-allocation");
+static pmt_t s_response_current_capacity_allocation =
pmt_intern("response-current-capacity-allocation");
+static pmt_t s_cmd_xmit_raw_frame = pmt_intern("cmd-xmit-raw-frame");
+static pmt_t s_response_xmit_raw_frame = pmt_intern("response-xmit-raw-frame");
+
+int
+main(int argc, char **argv)
+{
+ std::cout << "[test_usrp_inband] Starting...\n";
+
+ mb_runtime_sptr rt = mb_make_runtime();
+ pmt_t result = PMT_T;
+
+ rt->run("top", "test_usrp_inband_top", PMT_F, &result);
+}
+
+class test_usrp_inband_top : public mb_mblock
+{
+ mb_port_sptr d_tx;
+ mb_port_sptr d_cs;
+
+ public:
+ test_usrp_inband_top(mb_runtime *runtime, const std::string &instance_name,
pmt_t user_arg);
+ ~test_usrp_inband_top();
+ void initial_transition();
+ void handle_message(mb_message_sptr msg);
+
+ protected:
+ void check_message(mb_message_sptr msg);
+ void run_tests();
+};
+
+test_usrp_inband_top::test_usrp_inband_top(mb_runtime *runtime, const
std::string &instance_name, pmt_t user_arg)
+ : mb_mblock(runtime, instance_name, user_arg)
+{
+ std::cout << "[TEST_USRP_INBAND_TOP] Initializing...\n";
+
+ d_tx = define_port("tx0", "usrp-tx", false, mb_port::INTERNAL);
+ d_cs = define_port("cs", "usrp-server-cs", false, mb_port::INTERNAL);
+
+ // Test the TX side
+ define_component("server", "usrp_server", PMT_F);
+ connect("self", "tx0", "server", "tx0");
+ connect("self", "cs", "server", "cs");
+}
+
+test_usrp_inband_top::~test_usrp_inband_top()
+{
+}
+
+void
+test_usrp_inband_top::initial_transition()
+{
+ pmt_t usrp = pmt_from_long(1);
+
+ d_cs->send(s_cmd_open, pmt_list2(PMT_NIL, usrp));
+}
+
+void
+test_usrp_inband_top::handle_message(mb_message_sptr msg)
+{
+ pmt_t event = msg->signal(); // the "name" of the message
+ pmt_t port_id = msg->port_id(); // which port it came in on
+ pmt_t data = msg->data();
+ pmt_t metadata = msg->metadata();
+
+
+ if (pmt_eq(port_id, d_cs->port_symbol())) { // message came in on our
control/status port
+
+ //---------- OPEN RESPONSE ----------//
+ if (pmt_eq(event, s_response_open)) {
+ pmt_t status = pmt_nth(1, data);
+
+ if(pmt_eq(status, PMT_T)) {
+ std::cout << "[TEST_USRP_INBAND_TOP] Success opening USRP\n";
+ }
+ else {
+ std::cout << "[TEST_USRP_INBAND_TOP] Received error message opening
USRP\n";
+ }
+ }
+
+ }
+
+}
+
+REGISTER_MBLOCK_CLASS(test_usrp_inband_top);
Property changes on:
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/test_usrp_inband.cc
___________________________________________________________________
Name: svn:eol-style
+ native
Modified:
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_server.cc
===================================================================
---
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_server.cc
2007-05-23 04:57:49 UTC (rev 5522)
+++
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_server.cc
2007-05-23 05:23:50 UTC (rev 5523)
@@ -32,7 +32,7 @@
typedef usrp_inband_usb_packet transport_pkt; // makes conversion to gigabit
easy
-#define FAKE_USRP_TESTS
+//#define FAKE_USRP_TESTS
// FIXME We should machine generate these by a simple preprocessor run over
this file
//
@@ -232,6 +232,8 @@
if (pmt_eq(port_id, d_cs->port_symbol())){ // message came in on our
control/status port
if (pmt_eq(event, s_cmd_open)){
+
+ std::cout << "[USRP_SERVER] Received open msg\n";
// extract args from data
invocation_handle = pmt_nth(0, data);
long which_usrp = pmt_to_long(pmt_nth(1, data)); // integer usrp id,
usually 0
@@ -245,7 +247,7 @@
#else
- d_cs_usrp->send(s_cmd_open, pmt_list2(PMT_NIL,
pmt_from_long(which_usrp)));
+ d_cs_usrp->send(s_cmd_usrp_open, pmt_list2(PMT_NIL,
pmt_from_long(which_usrp)));
#endif
@@ -283,17 +285,19 @@
// A message from the USRP CS, which should *only* be responses
if (pmt_eq(port_id, d_cs_usrp->port_symbol())) {
-
+
if(pmt_eq(event, s_response_usrp_open)) {
// pass the response back over the regular CS port
invocation_handle = pmt_nth(0, data);
pmt_t status = pmt_nth(1, data);
d_cs->send(s_response_open, pmt_list2(invocation_handle, status));
+ return;
}
else if (pmt_eq(event, s_response_usrp_close)) {
invocation_handle = pmt_nth(0, data);
pmt_t status = pmt_nth(1, data);
d_cs->send(s_response_open, pmt_list2(invocation_handle, status));
+ return;
}
else if (pmt_eq(event, s_response_usrp_write)) {
@@ -304,8 +308,10 @@
// Find the port through the owner of the channel
long port = tx_port_index(d_chaninfo_tx[channel].owner);
d_tx[port]->send(s_response_xmit_raw_frame, pmt_list2(invocation_handle,
status));
-
+ return;
}
+
+ goto unhandled;
}
if (pmt_eq(event, s_cmd_allocate_channel)){
@@ -550,7 +556,7 @@
#else
// The actual response to the write will be generated by a
s_response_usrp_write
- d_cs_usrp->send(s_cmd_usrp_write, pmt_list3(PMT_NIL, channel, v_packets,
pmt_from_long(n_bytes)));
+ d_cs_usrp->send(s_cmd_usrp_write, pmt_list4(PMT_NIL,
pmt_from_long(channel), v_packets, pmt_from_long(n_bytes)));
#endif
Modified:
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_usb_interface.cc
===================================================================
---
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_usb_interface.cc
2007-05-23 04:57:49 UTC (rev 5522)
+++
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_usb_interface.cc
2007-05-23 05:23:50 UTC (rev 5523)
@@ -119,7 +119,7 @@
long which_usrp = pmt_to_long(pmt_nth(1, data));
pmt_t reply_data;
- std::cout << "[usrp_usb_interface] Handling open request for USRP " <<
which_usrp << "\n";
+ std::cout << "[USRP_USB_INTERFACE] Handling open request for USRP " <<
which_usrp << "\n";
// Open up a standard RX and TX for communication with the USRP
@@ -134,14 +134,14 @@
16); // number of blocks for async transfers
if(!d_utx[chan]) {
- std::cout << "[usrp_server] Failed to open channel " << chan << "\n";
+ std::cout << "[USRP_USB_INTERFACE] Failed to open channel " << chan <<
"\n";
reply_data = pmt_list2(invocation_handle, PMT_F);
d_cs->send(s_response_usrp_open, reply_data);
return;
}
if(!d_utx[chan]->set_tx_freq (0,0)) { // try setting center freq to 0
- std::cout << "[usrp_server] Failed to set center frequency on channel "
<< chan << "\n";
+ std::cout << "[USRP_USB_INTERFACE] Failed to set center frequency on
channel " << chan << "\n";
reply_data = pmt_list2(invocation_handle, PMT_F);
d_cs->send(s_response_usrp_open, reply_data);
return;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r5523 - gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband,
gnychis <=