[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r5637 - gnuradio/branches/developers/eb/ibu/usrp/host/
From: |
eb |
Subject: |
[Commit-gnuradio] r5637 - gnuradio/branches/developers/eb/ibu/usrp/host/lib/inband |
Date: |
Sun, 3 Jun 2007 12:46:27 -0600 (MDT) |
Author: eb
Date: 2007-06-03 12:46:27 -0600 (Sun, 03 Jun 2007)
New Revision: 5637
Modified:
gnuradio/branches/developers/eb/ibu/usrp/host/lib/inband/Makefile.am
gnuradio/branches/developers/eb/ibu/usrp/host/lib/inband/usrp_usb_interface.cc
gnuradio/branches/developers/eb/ibu/usrp/host/lib/inband/usrp_usb_interface_stub.cc
gnuradio/branches/developers/eb/ibu/usrp/host/lib/inband/usrp_usb_interface_stub.h
Log:
work-in-progress
Modified: gnuradio/branches/developers/eb/ibu/usrp/host/lib/inband/Makefile.am
===================================================================
--- gnuradio/branches/developers/eb/ibu/usrp/host/lib/inband/Makefile.am
2007-06-03 16:12:05 UTC (rev 5636)
+++ gnuradio/branches/developers/eb/ibu/usrp/host/lib/inband/Makefile.am
2007-06-03 18:46:27 UTC (rev 5637)
@@ -57,15 +57,15 @@
libusrp_inband_la_LDFLAGS = $(NO_UNDEFINED) -version-info 0:0:0
-libusrp_inband_la_LIBADD = \
- $(MBLOCK_LA) \
- $(USRP_LA) \
+libusrp_inband_la_LIBADD = \
+ $(MBLOCK_LA) \
+ $(top_builddir)/usrp/host/lib/legacy/libusrp.la \
-lstdc++
include_HEADERS = \
usrp_server.h \
usrp_usb_interface.h \
- usrp_inband_usb_packet.h \
+ usrp_inband_usb_packet.h \
usrp_usb_interface_stub.h
noinst_HEADERS = \
Modified:
gnuradio/branches/developers/eb/ibu/usrp/host/lib/inband/usrp_usb_interface.cc
===================================================================
---
gnuradio/branches/developers/eb/ibu/usrp/host/lib/inband/usrp_usb_interface.cc
2007-06-03 16:12:05 UTC (rev 5636)
+++
gnuradio/branches/developers/eb/ibu/usrp/host/lib/inband/usrp_usb_interface.cc
2007-06-03 18:46:27 UTC (rev 5637)
@@ -29,6 +29,7 @@
#include <usrp_usb_interface.h>
#include <usrp_inband_usb_packet.h>
#include "usrp_standard.h"
+#include <stdio.h>
typedef usrp_inband_usb_packet transport_pkt;
@@ -122,13 +123,15 @@
// Open up a standard RX and TX for communication with the USRP
- d_utx = usrp_standard_tx::make (which_usrp,
- 16, // interp = 32.0MB/s
- d_ntx_chan,
- -1, // mux
- 4096, // USB block size
- 16); // number of blocks for async transfers
-
+ d_utx = usrp_standard_tx::make(which_usrp,
+ 32, // 128/32 -> 4MS/s
+ 1, // 1 channel
+ -1, // mux
+ 4096, // USB block size
+ 16, // nblocks for async transfers
+ "usrp_inband_usb.rbf"
+ );
+
if(d_utx==0) {
if (verbose)
std::cout << "[USRP_USB_INTERFACE] Failed to open TX\n";
@@ -137,7 +140,7 @@
return;
}
- if(!d_utx->set_tx_freq (0,0)) { // try setting center freq to 0
+ if(!d_utx->set_tx_freq (0,10e6)) { // try setting center freq to 0
if (verbose)
std::cout << "[USRP_USB_INTERFACE] Failed to set center frequency on
TX\n";
reply_data = pmt_list2(invocation_handle, PMT_F);
@@ -150,13 +153,14 @@
if (verbose)
std::cout << "[USRP_USB_INTERFACE] Setup TX channel\n";
- d_urx = usrp_standard_rx::make (which_usrp,
- 16, // interp = 32.0MB/s
- d_nrx_chan,
- -1, // mux
- 0, // set blank mode to start
- 4096, // USB block size
- 16); // number of blocks for async transfers
+ d_urx =
+ usrp_standard_rx::make (which_usrp,
+ 16, // interp = 4MS/s
+ 1, // nchan
+ -1, // mux
+ 0, // set blank mode to start
+ 4096, // USB block size
+ 16); // number of blocks for async transfers
if(!d_urx) {
if (verbose)
@@ -166,7 +170,7 @@
return;
}
- if(!d_urx->set_rx_freq (0,0)) { // try setting center freq to 0
+ if(!d_urx->set_rx_freq (0, 10e6)) {
if (verbose)
std::cout << "[usrp_server] Failed to set center frequency on RX\n";
reply_data = pmt_list2(invocation_handle, PMT_F);
@@ -174,7 +178,7 @@
return;
}
- d_urx->start(); // FIXME: currently causing a hang
+ d_urx->start();
if (verbose)
std::cout << "[USRP_USB_INTERFACE] Setup RX channel\n";
@@ -188,21 +192,24 @@
pmt_t invocation_handle = pmt_nth(0, data);
long channel = pmt_to_long(pmt_nth(1, data));
pmt_t v_packets = pmt_nth(2, data);
- long n_bytes = pmt_to_long(pmt_nth(3, data));
- size_t psize;
+ size_t n_bytes;
bool underrun; // this will need to go, as it is taken care of in the
packet headers
- transport_pkt *pkts = (transport_pkt *)
pmt_u8vector_writeable_elements(v_packets, psize);
+ transport_pkt *pkts = (transport_pkt *)
pmt_u8vector_writeable_elements(v_packets, n_bytes);
int ret = d_utx->write (pkts, n_bytes, &underrun);
- if (ret == n_bytes) {
+ if (0 && underrun)
+ fprintf(stderr, "uU");
+
+ if (ret == (int) n_bytes) {
if (verbose)
std::cout << "[usrp_server] Write of " << n_bytes << " successful\n";
// need to respond with the channel so the USRP server knows who to
forward the result of
// the write to by looking up the owner of the channel
- d_cs->send(s_response_usrp_write, pmt_list3(invocation_handle,
pmt_from_long(channel), PMT_T));
+ d_cs->send(s_response_usrp_write,
+ pmt_list3(invocation_handle, pmt_from_long(channel), PMT_T));
}
else {
if (verbose)
@@ -224,8 +231,10 @@
std::cout << "[usrp_usb_interface] Handling close request for USRP\n";
delete d_utx;
+ d_utx = 0;
delete d_urx;
+ d_urx = 0;
d_cs->send(s_response_usrp_close, pmt_list2(invocation_handle, PMT_T));
Modified:
gnuradio/branches/developers/eb/ibu/usrp/host/lib/inband/usrp_usb_interface_stub.cc
===================================================================
---
gnuradio/branches/developers/eb/ibu/usrp/host/lib/inband/usrp_usb_interface_stub.cc
2007-06-03 16:12:05 UTC (rev 5636)
+++
gnuradio/branches/developers/eb/ibu/usrp/host/lib/inband/usrp_usb_interface_stub.cc
2007-06-03 18:46:27 UTC (rev 5637)
@@ -23,6 +23,7 @@
#include <config.h>
#endif
#include <iostream>
+#include <fstream>
#include <vector>
#include <usb.h>
#include <mb_class_registry.h>
@@ -47,7 +48,8 @@
// need to take number of TX and RX channels as parameter
usrp_usb_interface_stub::usrp_usb_interface_stub(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-interface-cs", true, mb_port::EXTERNAL);
@@ -57,11 +59,17 @@
d_utx = NULL;
d_urx = NULL;
+
+ // d_disk_write=true;
+
+ if(d_disk_write)
+ ofile.open("pdump.dat",std::ios::binary|std::ios::out);
}
usrp_usb_interface_stub::~usrp_usb_interface_stub()
{
-
+ if(d_disk_write)
+ ofile.close();
}
void
@@ -130,13 +138,28 @@
usrp_usb_interface_stub::handle_cmd_write(pmt_t data)
{
pmt_t invocation_handle = pmt_nth(0, data);
- pmt_t channel = pmt_nth(1, data);
+ long channel = pmt_to_long(pmt_nth(1, data));
+ pmt_t v_packets = pmt_nth(2, data);
+ long n_bytes = pmt_to_long(pmt_nth(3, data));
- d_cs->send(s_response_usrp_write, pmt_list3(invocation_handle, channel,
PMT_T));
+ size_t psize;
+ bool underrun; // this will need to go, as it is taken care of in the
packet headers
+
+ d_cs->send(s_response_usrp_write, pmt_list3(invocation_handle,
pmt_from_long(channel), PMT_T));
if (verbose)
std::cout << "[USRP_USB_INTERFACE_STUB] Successful write\n";
+ if (d_disk_write) {
+
+ long n_packets = static_cast<long>(std::ceil(n_bytes /
(double)transport_pkt::max_payload()));
+ transport_pkt *pkts = (transport_pkt *)
pmt_u8vector_writeable_elements(v_packets, psize);
+
+ for(int i=0; i<(int)n_packets; i++)
+ ofile.write((const char*) pkts[i].payload(), pkts[i].payload_len());
+
+ }
+
return;
}
Modified:
gnuradio/branches/developers/eb/ibu/usrp/host/lib/inband/usrp_usb_interface_stub.h
===================================================================
---
gnuradio/branches/developers/eb/ibu/usrp/host/lib/inband/usrp_usb_interface_stub.h
2007-06-03 16:12:05 UTC (rev 5636)
+++
gnuradio/branches/developers/eb/ibu/usrp/host/lib/inband/usrp_usb_interface_stub.h
2007-06-03 18:46:27 UTC (rev 5637)
@@ -23,6 +23,7 @@
#include <mb_mblock.h>
#include <vector>
+#include <fstream>
#include "usrp_standard.h"
/*!
@@ -40,6 +41,9 @@
long d_ntx_chan;
long d_nrx_chan;
+ long d_disk_write;
+ std::ofstream ofile;
+
public:
usrp_usb_interface_stub(mb_runtime *rt, const std::string &instance_name,
pmt_t user_arg);
~usrp_usb_interface_stub();
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r5637 - gnuradio/branches/developers/eb/ibu/usrp/host/lib/inband,
eb <=