[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r5804 - in gnuradio/branches/developers/gnychis/inband
From: |
gnychis |
Subject: |
[Commit-gnuradio] r5804 - in gnuradio/branches/developers/gnychis/inband/usrp/host: apps lib/inband |
Date: |
Wed, 20 Jun 2007 12:47:19 -0600 (MDT) |
Author: gnychis
Date: 2007-06-20 12:47:19 -0600 (Wed, 20 Jun 2007)
New Revision: 5804
Added:
gnuradio/branches/developers/gnychis/inband/usrp/host/apps/read_packets.cc
Modified:
gnuradio/branches/developers/gnychis/inband/usrp/host/apps/Makefile.am
gnuradio/branches/developers/gnychis/inband/usrp/host/apps/test_usrp_inband_rx.cc
gnuradio/branches/developers/gnychis/inband/usrp/host/apps/test_usrp_inband_tx.cc
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_rx.cc
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_rx.h
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:
Checking in two bug fixes in usrp_server which cause a seg fault when packet
length is 0 or greater than the max payload size
Checking in small program to help debug the RX side: read_packets, which reads
the rx_raw.dat file output frmo usrp_rx.cc if enabled.
Modified: gnuradio/branches/developers/gnychis/inband/usrp/host/apps/Makefile.am
===================================================================
--- gnuradio/branches/developers/gnychis/inband/usrp/host/apps/Makefile.am
2007-06-20 18:43:08 UTC (rev 5803)
+++ gnuradio/branches/developers/gnychis/inband/usrp/host/apps/Makefile.am
2007-06-20 18:47:19 UTC (rev 5804)
@@ -35,7 +35,8 @@
test_usrp_inband_tx \
test_usrp_inband_rx \
test_usrp_standard_rx \
- test_usrp_standard_tx
+ test_usrp_standard_tx \
+ read_packets
noinst_HEADERS = \
time_stuff.h \
@@ -67,3 +68,5 @@
test_usrp_inband_rx_SOURCES = test_usrp_inband_rx.cc time_stuff.c
ui_sincos.c
test_usrp_inband_rx_LDADD = $(USRP_LA)
+read_packets_SOURCES = read_packets.cc
+read_packets_LDADD = $(USRP_LA)
Added:
gnuradio/branches/developers/gnychis/inband/usrp/host/apps/read_packets.cc
===================================================================
--- gnuradio/branches/developers/gnychis/inband/usrp/host/apps/read_packets.cc
(rev 0)
+++ gnuradio/branches/developers/gnychis/inband/usrp/host/apps/read_packets.cc
2007-06-20 18:47:19 UTC (rev 5804)
@@ -0,0 +1,73 @@
+/* -*- 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 <iostream>
+#include <usrp_inband_usb_packet.h>
+#include <mb_class_registry.h>
+#include <vector>
+#include <usrp_usb_interface.h>
+#include <fstream>
+
+typedef usrp_inband_usb_packet transport_pkt; // makes conversion to gigabit
easy
+
+int main() {
+
+ std::ifstream infile;
+
+ unsigned int pkt_size = transport_pkt::max_pkt_size();
+ unsigned int pkt_num=0;
+
+ transport_pkt *pkt;
+ char pkt_data[pkt_size]; // allocate the number of bytes for a
single packet
+
+ pkt = (transport_pkt *)pkt_data; // makes operations cleaner to read
+
+
+ // Open the file and read the packets, dumping information
+ infile.open("rx_raw.dat",std::ios::binary|std::ios::in);
+
+ while(!infile.eof()) {
+
+ // read 1 packet in to the memory
+ infile.read(pkt_data, pkt_size);
+
+ printf("Packet %u\n", pkt_num);
+ printf("\tchannel: \t0x%x\n", pkt->chan());
+ printf("\ttimestamp: \t0x%x\n", pkt->timestamp());
+ printf("\tlength: \t%u\n", pkt->payload_len());
+
+ printf("\tpayload: \n");
+ //for(int i=0; i < pkt->payload_len(); i++)
+ for(int i=0; i < pkt->max_payload(); i++)
+ printf("\t%d\t0x%x\n", i, *(pkt->payload()+i));
+ //printf("\t\t0x%x\n", pkt->payload()+i);
+
+ printf("\n\n");
+
+ pkt_num++;
+
+ }
+
+}
Modified:
gnuradio/branches/developers/gnychis/inband/usrp/host/apps/test_usrp_inband_rx.cc
===================================================================
---
gnuradio/branches/developers/gnychis/inband/usrp/host/apps/test_usrp_inband_rx.cc
2007-06-20 18:43:08 UTC (rev 5803)
+++
gnuradio/branches/developers/gnychis/inband/usrp/host/apps/test_usrp_inband_rx.cc
2007-06-20 18:47:19 UTC (rev 5804)
@@ -109,8 +109,8 @@
d_rx = define_port("rx0", "usrp-rx", false, mb_port::INTERNAL);
d_cs = define_port("cs", "usrp-server-cs", false, mb_port::INTERNAL);
- bool fake_usrp_p = true;
- //bool fake_usrp_p = false;
+ //bool fake_usrp_p = true;
+ bool fake_usrp_p = false;
// Test the TX side
Modified:
gnuradio/branches/developers/gnychis/inband/usrp/host/apps/test_usrp_inband_tx.cc
===================================================================
---
gnuradio/branches/developers/gnychis/inband/usrp/host/apps/test_usrp_inband_tx.cc
2007-06-20 18:43:08 UTC (rev 5803)
+++
gnuradio/branches/developers/gnychis/inband/usrp/host/apps/test_usrp_inband_tx.cc
2007-06-20 18:47:19 UTC (rev 5804)
@@ -111,8 +111,9 @@
d_state(INIT), d_nsamples_to_send((long) 40e6),
d_nsamples_xmitted(0),
d_nframes_xmitted(0),
- d_samples_per_frame((long)(126 * 3.5)), // non-full packet
- //d_samples_per_frame((long)(126 * 4)), // full packet
+ //d_samples_per_frame((long)(126)),
+ //d_samples_per_frame((long)(126 * 3.5)), // non-full packet
+ d_samples_per_frame((long)(126 * 4)), // full packet
d_done_sending(false),
d_amplitude(16384)
{
@@ -121,8 +122,8 @@
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;
- //bool fake_usrp_p = false;
+ //bool fake_usrp_p = true;
+ bool fake_usrp_p = false;
// Test the TX side
@@ -307,7 +308,7 @@
// allocate the uniform vector for the samples
// FIXME perhaps hold on to this between calls
-#if 1
+#if 0
long nsamples_this_frame =
std::min(d_nsamples_to_send - d_nsamples_xmitted,
d_samples_per_frame);
Modified:
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_rx.cc
===================================================================
--- gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_rx.cc
2007-06-20 18:43:08 UTC (rev 5803)
+++ gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_rx.cc
2007-06-20 18:47:19 UTC (rev 5804)
@@ -42,14 +42,22 @@
static pmt_t s_response_usrp_rx_read = pmt_intern("response-usrp-rx-read");
usrp_rx::usrp_rx(mb_runtime *rt, const std::string &instance_name, pmt_t
user_arg)
- : mb_mblock(rt, instance_name, user_arg)
+ : mb_mblock(rt, instance_name, user_arg),
+ d_disk_write(false)
{
d_cs = define_port("cs", "usrp-rx-cs", true, mb_port::EXTERNAL);
+ d_disk_write=true;
+
+ if(d_disk_write)
+ d_ofile.open("rx_raw.dat",std::ios::binary|std::ios::out);
+
}
usrp_rx::~usrp_rx()
{
+ if(d_disk_write)
+ d_ofile.close();
}
void
@@ -111,6 +119,9 @@
pmt_list3(PMT_NIL, PMT_T, v_pkt));
if(verbose)
std::cout << "[usrp_rx] Read 1 packet\n";
+
+ if(d_disk_write)
+ d_ofile.write((const char *)pkt, transport_pkt::max_pkt_size());
}
}
Modified:
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_rx.h
===================================================================
--- gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_rx.h
2007-06-20 18:43:08 UTC (rev 5803)
+++ gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_rx.h
2007-06-20 18:47:19 UTC (rev 5804)
@@ -22,6 +22,7 @@
#define INCLUDED_USRP_RX_H
#include <mb_mblock.h>
+#include <fstream>
class usrp_standard_rx;
@@ -33,6 +34,9 @@
mb_port_sptr d_cs;
usrp_standard_rx *d_urx;
+ bool d_disk_write;
+ std::ofstream d_ofile;
+
public:
usrp_rx(mb_runtime *rt, const std::string &instance_name, pmt_t user_arg);
~usrp_rx();
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-06-20 18:43:08 UTC (rev 5803)
+++
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_server.cc
2007-06-20 18:47:19 UTC (rev 5804)
@@ -779,6 +779,10 @@
long payload_len = pkt->payload_len();
long port;
+ // Ignore packets which seem to have incorrect size or size 0
+ if(payload_len > pkt->max_payload() || payload_len == 0)
+ return;
+
if((port = rx_port_index(d_chaninfo_rx[channel].owner)) == -1)
return; // Don't know where to send the sample... possibility on abrupt
close
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-06-20 18:43:08 UTC (rev 5803)
+++
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_usb_interface.cc
2007-06-20 18:47:19 UTC (rev 5804)
@@ -238,11 +238,11 @@
// Open up a standard RX and TX for communication with the USRP
- //std::string rbf = "usrp_inband_usb.rbf";
- std::string rbf = "";
+ std::string rbf = "blah.rbf";
+ //std::string rbf = "";
d_utx = usrp_standard_tx::make(which_usrp,
- 32, // 128/32 -> 4MS/s
+ 128, // 128/32 -> 4MS/s
1, // 1 channel
-1, // mux
4096, // USB block size
@@ -278,7 +278,8 @@
-1, // mux
0, // set blank mode to start
4096, // USB block size
- 16); // number of blocks for async transfers
+ 16, // number of blocks for async transfers
+ rbf);
if(!d_urx) {
if (verbose)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r5804 - in gnuradio/branches/developers/gnychis/inband/usrp/host: apps lib/inband,
gnychis <=