commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] r5854 - gnuradio/branches/developers/gnychis/inband/us


From: gnychis
Subject: [Commit-gnuradio] r5854 - gnuradio/branches/developers/gnychis/inband/usrp/host/apps
Date: Wed, 27 Jun 2007 10:16:47 -0600 (MDT)

Author: gnychis
Date: 2007-06-27 10:16:47 -0600 (Wed, 27 Jun 2007)
New Revision: 5854

Added:
   
gnuradio/branches/developers/gnychis/inband/usrp/host/apps/test_usrp_inband_ping.cc
Modified:
   gnuradio/branches/developers/gnychis/inband/usrp/host/apps/Makefile.am
   
gnuradio/branches/developers/gnychis/inband/usrp/host/apps/test_usrp_inband_cs.cc
Log:
Adding in a new inband test for pinging which will basically benchmark the
inband delay between the host and USRP.  The code will eventually move to USRP
server to synchronize to the USRP clock for proper timestamps.


Modified: gnuradio/branches/developers/gnychis/inband/usrp/host/apps/Makefile.am
===================================================================
--- gnuradio/branches/developers/gnychis/inband/usrp/host/apps/Makefile.am      
2007-06-27 14:44:14 UTC (rev 5853)
+++ gnuradio/branches/developers/gnychis/inband/usrp/host/apps/Makefile.am      
2007-06-27 16:16:47 UTC (rev 5854)
@@ -33,6 +33,7 @@
 noinst_PROGRAMS =                      \
        check_order_quickly             \
        test_usrp_inband_cs             \
+       test_usrp_inband_ping           \
        test_usrp_inband_rx             \
        test_usrp_inband_tx             \
        test_usrp_standard_rx           \
@@ -66,6 +67,9 @@
 test_usrp_inband_cs_SOURCES    = test_usrp_inband_cs.cc time_stuff.c 
ui_sincos.c
 test_usrp_inband_cs_LDADD      = $(USRP_LA)
 
+test_usrp_inband_ping_SOURCES  = test_usrp_inband_ping.cc time_stuff.c
+test_usrp_inband_ping_LDADD    = $(USRP_LA)
+
 test_usrp_inband_tx_SOURCES    = test_usrp_inband_tx.cc time_stuff.c 
ui_sincos.c
 test_usrp_inband_tx_LDADD      = $(USRP_LA)
 

Modified: 
gnuradio/branches/developers/gnychis/inband/usrp/host/apps/test_usrp_inband_cs.cc
===================================================================
--- 
gnuradio/branches/developers/gnychis/inband/usrp/host/apps/test_usrp_inband_cs.cc
   2007-06-27 14:44:14 UTC (rev 5853)
+++ 
gnuradio/branches/developers/gnychis/inband/usrp/host/apps/test_usrp_inband_cs.cc
   2007-06-27 16:16:47 UTC (rev 5854)
@@ -365,7 +365,7 @@
   for (int i(0); i < NBPING; i++)
   {
         
-    struct timeval *tv = (struct timeval*)malloc(sizeof(struct timeval));
+    struct timeval *tv = (struct timeval*)calloc(1, sizeof(struct timeval));
     gettimeofday(tv, &tz);
     times[i] = *tv;
     build_and_send_ping();

Added: 
gnuradio/branches/developers/gnychis/inband/usrp/host/apps/test_usrp_inband_ping.cc
===================================================================
--- 
gnuradio/branches/developers/gnychis/inband/usrp/host/apps/test_usrp_inband_ping.cc
                         (rev 0)
+++ 
gnuradio/branches/developers/gnychis/inband/usrp/host/apps/test_usrp_inband_ping.cc
 2007-06-27 16:16:47 UTC (rev 5854)
@@ -0,0 +1,158 @@
+/* -*- 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 <mb_mblock.h>
+#include <mb_runtime.h>
+#include <mb_runtime_nop.h>            // QA only
+#include <mb_protocol_class.h>
+#include <mb_exception.h>
+#include <mb_msg_queue.h>
+#include <mb_message.h>
+#include <mb_mblock_impl.h>
+#include <mb_msg_accepter.h>
+#include <mb_class_registry.h>
+#include <pmt.h>
+#include <stdio.h>
+#include <string.h>
+#include <sys/time.h>
+#include <iostream>
+
+// Include the symbols needed for communication with USRP server
+#include <symbols_usrp_server_cs.h>
+#include <symbols_usrp_channel.h>
+#include <symbols_usrp_low_level_cs.h>
+#include <symbols_usrp_tx.h>
+#include <symbols_usrp_rx.h>
+
+static bool verbose = false;
+
+class test_usrp_inband_ping : public mb_mblock
+{
+
+  mb_port_sptr  d_tx;   // Ports connected to the USRP server
+  mb_port_sptr  d_rx;
+  mb_port_sptr  d_cs;
+
+  pmt_t   d_tx_chan;    // Returned channel from TX allocation
+  pmt_t   d_rx_chan;    // Returned channel from RX allocation
+
+  pmt_t   d_which_usrp; // The USRP to use for the test
+
+  // Keep track of current state
+  enum state_t {
+    INIT,
+    OPENING_USRP,
+    ALLOCATING_CHANNELS,
+    PINGING,
+    CLOSING_CHANNELS,
+    CLOSING_USRP,
+  };
+  state_t d_state;
+
+ public:
+  test_usrp_inband_ping(mb_runtime *runtime, const std::string &instance_name, 
pmt_t user_arg);
+  ~test_usrp_inband_ping();
+  void initial_transition();
+  void handle_message(mb_message_sptr msg);
+
+ protected:
+  void opening_usrp();
+  void allocating_channels();
+  void build_and_send_ping();
+  void closing_channels();
+  void closing_usrp();
+};
+
+
+int
+main (int argc, char **argv)
+{
+  // handle any command line args here
+
+  mb_runtime_sptr rt = mb_make_runtime();
+  pmt_t result = PMT_NIL;
+
+  rt->run("top", "test_usrp_inband_ping", PMT_F, &result);
+}
+
+
+test_usrp_inband_ping::test_usrp_inband_ping(mb_runtime *runtime, const 
std::string &instance_name, pmt_t user_arg)
+  : mb_mblock(runtime, instance_name, user_arg),
+  d_tx_chan(PMT_NIL),
+  d_rx_chan(PMT_NIL),
+  d_which_usrp(pmt_from_long(0)),
+  d_state(INIT)
+{
+  
+  // A dictionary is used to pass parameters to the USRP
+  pmt_t usrp_dict = pmt_make_dict();
+
+  // Specify the RBF to use
+  pmt_dict_set(usrp_dict,
+               pmt_intern("rbf"),
+               pmt_intern("last3.rbf"));
+
+  // Set TX and RX interpolations
+  pmt_dict_set(usrp_dict,
+               pmt_intern("interp-tx"),
+               pmt_from_long(128));
+
+  pmt_dict_set(usrp_dict,
+               pmt_intern("interp-rx"),
+               pmt_from_long(16));
+
+  // Create an instance of USRP server and connect ports
+  define_component("server", "usrp_server", usrp_dict);
+  connect("self", "tx0", "server", "tx0");
+  connect("self", "rx0", "server", "rx0");
+  connect("self", "cs", "server", "cs");
+
+}
+
+test_usrp_inband_ping::~test_usrp_inband_ping()
+{
+}
+
+void
+test_usrp_inband_ping::initial_transition()
+{
+  opening_usrp();
+}
+
+// Sends a command to USRP server to open up a connection to the
+// specified USRP, which is defaulted to USRP 0 on the system
+void
+test_usrp_inband_ping::opening_usrp()
+{
+  d_cs->send(s_cmd_open, pmt_list2(PMT_NIL, d_which_usrp));
+  d_state = OPENING_USRP;
+}
+
+void
+test_usrp_inband_ping::handle_message(mb_message_sptr msg)
+{
+
+}
+





reply via email to

[Prev in Thread] Current Thread [Next in Thread]