[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r5628 - in gnuradio/branches/developers/eb/ibu: . usrp
From: |
eb |
Subject: |
[Commit-gnuradio] r5628 - in gnuradio/branches/developers/eb/ibu: . usrp/host/apps |
Date: |
Sat, 2 Jun 2007 21:54:54 -0600 (MDT) |
Author: eb
Date: 2007-06-02 21:54:53 -0600 (Sat, 02 Jun 2007)
New Revision: 5628
Added:
gnuradio/branches/developers/eb/ibu/usrp/host/apps/test_usrp_inband_tx.cc
Modified:
gnuradio/branches/developers/eb/ibu/Makefile.common
gnuradio/branches/developers/eb/ibu/usrp/host/apps/
gnuradio/branches/developers/eb/ibu/usrp/host/apps/Makefile.am
gnuradio/branches/developers/eb/ibu/usrp/host/apps/ui_nco.h
gnuradio/branches/developers/eb/ibu/usrp/host/apps/ui_sincos.c
gnuradio/branches/developers/eb/ibu/usrp/host/apps/ui_sincos.h
Log:
basic outline of test code compiles
Modified: gnuradio/branches/developers/eb/ibu/Makefile.common
===================================================================
--- gnuradio/branches/developers/eb/ibu/Makefile.common 2007-06-03 03:38:58 UTC
(rev 5627)
+++ gnuradio/branches/developers/eb/ibu/Makefile.common 2007-06-03 03:54:53 UTC
(rev 5628)
@@ -76,7 +76,9 @@
USRP_INCLUDES = -I$(top_srcdir)/usrp/host/lib/legacy \
-I$(top_srcdir)/usrp/host/lib/inband \
-I$(top_srcdir)/usrp/firmware/include
-USRP_LA = $(top_builddir)/usrp/host/lib/legacy/libusrp.la
+USRP_LA = \
+ $(top_builddir)/usrp/host/lib/legacy/libusrp.la \
+ $(top_builddir)/usrp/host/lib/inband/libusrp_inband.la
# How to link the PMT library from inside the tree
PMT_INCLUDES = -I$(top_srcdir)/pmt/src/lib
Property changes on: gnuradio/branches/developers/eb/ibu/usrp/host/apps
___________________________________________________________________
Name: svn:ignore
- Makefile
Makefile.in
.la
.lo
.deps
.libs
*.la
*.lo
usrper
usrper2
test_input
test_fusb
test_usrp
test_usrp0
test_usrp_standard_rx
test_usrp_standard_tx
test_usrp_basic_rx
check_order_quickly
usrp_cal_dc_offset
+ Makefile
Makefile.in
.la
.lo
.deps
.libs
*.la
*.lo
usrper
usrper2
test_input
test_fusb
test_usrp
test_usrp0
test_usrp_standard_rx
test_usrp_standard_tx
test_usrp_inband_rx
test_usrp_inband_tx
test_usrp_basic_rx
check_order_quickly
usrp_cal_dc_offset
Modified: gnuradio/branches/developers/eb/ibu/usrp/host/apps/Makefile.am
===================================================================
--- gnuradio/branches/developers/eb/ibu/usrp/host/apps/Makefile.am
2007-06-03 03:38:58 UTC (rev 5627)
+++ gnuradio/branches/developers/eb/ibu/usrp/host/apps/Makefile.am
2007-06-03 03:54:53 UTC (rev 5628)
@@ -21,14 +21,18 @@
include $(top_srcdir)/Makefile.common
-INCLUDES = $(USRP_INCLUDES) $(BOOST_CFLAGS)
+INCLUDES = \
+ $(DEFINES) $(OMNITHREAD_INCLUDES) $(PMT_INCLUDES) $(MBLOCK_INCLUDES) \
+ $(USRP_INCLUDES) $(BOOST_CFLAGS) $(CPPUNIT_INCLUDES)
+
bin_PROGRAMS = \
usrper \
usrp_cal_dc_offset
noinst_PROGRAMS = \
check_order_quickly \
+ test_usrp_inband_tx \
test_usrp_standard_rx \
test_usrp_standard_tx
@@ -53,3 +57,7 @@
usrp_cal_dc_offset_SOURCES = usrp_cal_dc_offset.cc
usrp_cal_dc_offset_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)
+
Added: gnuradio/branches/developers/eb/ibu/usrp/host/apps/test_usrp_inband_tx.cc
===================================================================
--- gnuradio/branches/developers/eb/ibu/usrp/host/apps/test_usrp_inband_tx.cc
(rev 0)
+++ gnuradio/branches/developers/eb/ibu/usrp/host/apps/test_usrp_inband_tx.cc
2007-06-03 03:54:53 UTC (rev 5628)
@@ -0,0 +1,168 @@
+/* -*- 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 <ui_nco.h>
+#include <stdio.h>
+#include <string.h>
+#include <iostream>
+
+// 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_close = pmt_intern("cmd-close");
+static pmt_t s_response_close = pmt_intern("response-close");
+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");
+
+
+class test_usrp_tx : public mb_mblock
+{
+ mb_port_sptr d_tx;
+ mb_port_sptr d_cs;
+
+ pmt_t d_tx_chan; // returned tx channel handle
+
+ enum state_t {
+ INIT,
+ OPENING_USRP,
+ ALLOCATING_CHANNEL,
+ TRANSMITTING,
+ CLOSING_CHANNEL,
+ CLOSE_USRP,
+ };
+
+ state_t d_state;
+
+ // for generating sine wave output
+ ui_nco<float,float> d_nco;
+
+ public:
+ test_usrp_tx(mb_runtime *runtime, const std::string &instance_name, pmt_t
user_arg);
+ ~test_usrp_tx();
+ void initial_transition();
+ void handle_message(mb_message_sptr msg);
+
+ protected:
+ void open_usrp();
+ void close_usrp();
+ void allocate_channel();
+ void send_packets();
+};
+
+test_usrp_tx::test_usrp_tx(mb_runtime *runtime, const std::string
&instance_name, pmt_t user_arg)
+ : mb_mblock(runtime, instance_name, user_arg)
+{
+ std::cout << "[TEST_USRP_TX] 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);
+
+ bool fake_usrp_p = true;
+
+ // Test the TX side
+
+ // Pass a dictionary to usrp_server which specifies which interface to use,
the stub or USRP
+ pmt_t usrp_server_dict = pmt_make_dict();
+
+ if(fake_usrp_p)
+ pmt_dict_set(usrp_server_dict, pmt_intern("usrp-interface"),
+ pmt_intern("usrp_usb_interface_stub"));
+
+ define_component("server", "usrp_server", usrp_server_dict);
+
+ connect("self", "tx0", "server", "tx0");
+ connect("self", "cs", "server", "cs");
+}
+
+test_usrp_tx::~test_usrp_tx()
+{
+}
+
+void
+test_usrp_tx::initial_transition()
+{
+ open_usrp();
+}
+
+void
+test_usrp_tx::handle_message(mb_message_sptr msg)
+{
+}
+
+
+void
+test_usrp_tx::open_usrp()
+{
+ pmt_t which_usrp = pmt_from_long(0);
+
+ d_cs->send(s_cmd_open, pmt_list2(PMT_NIL, which_usrp));
+}
+
+void
+test_usrp_tx::close_usrp()
+{
+ d_cs->send(s_cmd_close, pmt_list1(PMT_NIL));
+}
+
+REGISTER_MBLOCK_CLASS(test_usrp_tx);
+
+
+// ----------------------------------------------------------------
+
+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_tx", PMT_F, &result);
+}
Property changes on:
gnuradio/branches/developers/eb/ibu/usrp/host/apps/test_usrp_inband_tx.cc
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: gnuradio/branches/developers/eb/ibu/usrp/host/apps/ui_nco.h
===================================================================
--- gnuradio/branches/developers/eb/ibu/usrp/host/apps/ui_nco.h 2007-06-03
03:38:58 UTC (rev 5627)
+++ gnuradio/branches/developers/eb/ibu/usrp/host/apps/ui_nco.h 2007-06-03
03:54:53 UTC (rev 5628)
@@ -19,15 +19,18 @@
* the Free Software Foundation, Inc., 51 Franklin Street,
* Boston, MA 02110-1301, USA.
*/
-#ifndef _GR_NCO_H_
-#define _GR_NCO_H_
+#ifndef INCLUDED_UI_NCO_H
+#define INCLUDED_UI_NCO_H
#include <vector>
-#include <gr_sincos.h>
+#include <ui_sincos.h>
#include <cmath>
-#include <gr_complex.h>
+#include <complex>
+typedef std::complex<float> gr_complex;
+
+
/*!
* \brief base class template for Numerically Controlled Oscillator (NCO)
*/
@@ -36,11 +39,11 @@
//FIXME Eventually generalize this to fixed point
template<class o_type, class i_type>
-class gr_nco {
+class ui_nco {
public:
- gr_nco () : phase (0), phase_inc(0) {}
+ ui_nco () : phase (0), phase_inc(0) {}
- virtual ~gr_nco () {}
+ virtual ~ui_nco () {}
// radians
void set_phase (double angle) {
@@ -118,14 +121,14 @@
template<class o_type, class i_type>
void
-gr_nco<o_type,i_type>::sincos (float *sinx, float *cosx) const
+ui_nco<o_type,i_type>::sincos (float *sinx, float *cosx) const
{
- gr_sincosf (phase, sinx, cosx);
+ ui_sincosf (phase, sinx, cosx);
}
template<class o_type, class i_type>
void
-gr_nco<o_type,i_type>::sin (float *output, int noutput_items, double ampl)
+ui_nco<o_type,i_type>::sin (float *output, int noutput_items, double ampl)
{
for (int i = 0; i < noutput_items; i++){
output[i] = (float)(sin () * ampl);
@@ -135,7 +138,7 @@
template<class o_type, class i_type>
void
-gr_nco<o_type,i_type>::cos (float *output, int noutput_items, double ampl)
+ui_nco<o_type,i_type>::cos (float *output, int noutput_items, double ampl)
{
for (int i = 0; i < noutput_items; i++){
output[i] = (float)(cos () * ampl);
@@ -145,7 +148,7 @@
template<class o_type, class i_type>
void
-gr_nco<o_type,i_type>::sin (short *output, int noutput_items, double ampl)
+ui_nco<o_type,i_type>::sin (short *output, int noutput_items, double ampl)
{
for (int i = 0; i < noutput_items; i++){
output[i] = (short)(sin() * ampl);
@@ -155,7 +158,7 @@
template<class o_type, class i_type>
void
-gr_nco<o_type,i_type>::cos (short *output, int noutput_items, double ampl)
+ui_nco<o_type,i_type>::cos (short *output, int noutput_items, double ampl)
{
for (int i = 0; i < noutput_items; i++){
output[i] = (short)(cos () * ampl);
@@ -165,7 +168,7 @@
template<class o_type, class i_type>
void
-gr_nco<o_type,i_type>::sin (int *output, int noutput_items, double ampl)
+ui_nco<o_type,i_type>::sin (int *output, int noutput_items, double ampl)
{
for (int i = 0; i < noutput_items; i++){
output[i] = (int)(sin () * ampl);
@@ -175,7 +178,7 @@
template<class o_type, class i_type>
void
-gr_nco<o_type,i_type>::cos (int *output, int noutput_items, double ampl)
+ui_nco<o_type,i_type>::cos (int *output, int noutput_items, double ampl)
{
for (int i = 0; i < noutput_items; i++){
output[i] = (int)(cos () * ampl);
@@ -185,7 +188,7 @@
template<class o_type, class i_type>
void
-gr_nco<o_type,i_type>::sincos (gr_complex *output, int noutput_items, double
ampl)
+ui_nco<o_type,i_type>::sincos (gr_complex *output, int noutput_items, double
ampl)
{
for (int i = 0; i < noutput_items; i++){
float cosx, sinx;
@@ -194,4 +197,6 @@
step ();
}
}
-#endif /* _NCO_H_ */
+
+#endif /* INCLUDED_UI_NCO_H */
+
Modified: gnuradio/branches/developers/eb/ibu/usrp/host/apps/ui_sincos.c
===================================================================
--- gnuradio/branches/developers/eb/ibu/usrp/host/apps/ui_sincos.c
2007-06-03 03:38:58 UTC (rev 5627)
+++ gnuradio/branches/developers/eb/ibu/usrp/host/apps/ui_sincos.c
2007-06-03 03:54:53 UTC (rev 5628)
@@ -26,7 +26,7 @@
#define _GNU_SOURCE // ask for GNU extensions if available
-#include <gr_sincos.h>
+#include <ui_sincos.h>
#include <math.h>
// ----------------------------------------------------------------
@@ -34,7 +34,7 @@
#if defined (HAVE_SINCOS)
void
-gr_sincos (double x, double *sinx, double *cosx)
+ui_sincos (double x, double *sinx, double *cosx)
{
sincos (x, sinx, cosx);
}
@@ -42,7 +42,7 @@
#else
void
-gr_sincos (double x, double *sinx, double *cosx)
+ui_sincos (double x, double *sinx, double *cosx)
{
*sinx = sin (x);
*cosx = cos (x);
@@ -55,7 +55,7 @@
#if defined (HAVE_SINCOSF)
void
-gr_sincosf (float x, float *sinx, float *cosx)
+ui_sincosf (float x, float *sinx, float *cosx)
{
sincosf (x, sinx, cosx);
}
@@ -63,7 +63,7 @@
#elif defined (HAVE_SINF) && defined (HAVE_COSF)
void
-gr_sincosf (float x, float *sinx, float *cosx)
+ui_sincosf (float x, float *sinx, float *cosx)
{
*sinx = sinf (x);
*cosx = cosf (x);
@@ -72,7 +72,7 @@
#else
void
-gr_sincosf (float x, float *sinx, float *cosx)
+ui_sincosf (float x, float *sinx, float *cosx)
{
*sinx = sin (x);
*cosx = cos (x);
Modified: gnuradio/branches/developers/eb/ibu/usrp/host/apps/ui_sincos.h
===================================================================
--- gnuradio/branches/developers/eb/ibu/usrp/host/apps/ui_sincos.h
2007-06-03 03:38:58 UTC (rev 5627)
+++ gnuradio/branches/developers/eb/ibu/usrp/host/apps/ui_sincos.h
2007-06-03 03:54:53 UTC (rev 5628)
@@ -20,8 +20,8 @@
* Boston, MA 02110-1301, USA.
*/
-#ifndef INCLUDED_GR_SINCOS_H
-#define INCLUDED_GR_SINCOS_H
+#ifndef INCLUDED_UI_SINCOS_H
+#define INCLUDED_UI_SINCOS_H
#ifdef __cplusplus
extern "C" {
@@ -29,11 +29,11 @@
// compute sine and cosine at the same time
-void gr_sincos (double x, double *sin, double *cos);
-void gr_sincosf (float x, float *sin, float *cos);
+void ui_sincos (double x, double *sin, double *cos);
+void ui_sincosf (float x, float *sin, float *cos);
#ifdef __cplusplus
};
#endif
-#endif /* INCLUDED_GR_SINCOS_H */
+#endif /* INCLUDED_UI_SINCOS_H */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r5628 - in gnuradio/branches/developers/eb/ibu: . usrp/host/apps,
eb <=