Start_rx_streaming_at patch

Hi

A while ago, Doug G. wrote on this group that he had written a
patch to create a function start_rx_streaming_at, which is like
start_rx_streaming but begins at a specified time synchronized with
the PPS, and that the patch could be found at http://drop.io/9eljrue

Yesterday I downloaded the patch and tried applying it to gnuradio-3.2
without success. Of the half dozen or so changes in the patch only the
last
one succeeded. Here is a typical exchange from that attempt:

 patch -p2 < usrp2-rx_at-sync_rx_at.patch
 can't find file to patch at input line 5
 Perhaps you used the wrong -p or --strip option?
 The text leading up to this was:
 --------------------------
 |Index: usrp2/firmware/apps/serdes_txrx.c
 |===================================================================
 |--- usrp2/firmware/apps/serdes_txrx.c  (revision 11171)
 |+++ usrp2/firmware/apps/serdes_txrx.c  (working copy)
 --------------------------
 File to patch:

at this point, I type in: usrp2/firmware/apps/serdes_txrx.c
and it continues:

 patching file usrp2/firmware/apps/serdes_txrx.c
 Hunk #1 FAILED at 183.
 1 out of 1 hunk FAILED -- saving rejects to file

usrp2/firmware/apps/serdes_txrx.c.rej

the reject file contains:

 ***************
 *** 183,188 ****
     restart_streaming();
   }


   void
   stop_rx_cmd(void)
 --- 183,192 ----
     restart_streaming();
   }

 + void start_rx_streaming_at_cmd(const u2_mac_addr_t *host,

op_start_rx_streaming_t *p, uint32_t time)
+ {}
+ void restart_streaming_at(uint32_t time)
+ {}

   void
   stop_rx_cmd(void)

and as far as I can tell by looking, the 6 lines of context exactly
match lines 183-188 in the file
usrp2/firmware/apps/serdes_txrx.c

So then just to see if it made a difference, I downloaded gnuradio-3.2.2
but patch didn’t work there either.

Then I emailed Doug at [email protected]
mailto:[email protected]
and it bounced. Does anybody know what I’m doing wrong here?

Thanks
Bruce

Bruce,
I haven’t maintained the patch, so I’m not sure if it still applies
cleanly to the latest release of gnuradio - but from the error message
it may just be you’re using the wrong ‘-p’ level. I’m usually applying
patches in the top-level directory of the gnuradio tree, so I use -p0.
The email to to me bounced as you swapped an underscore for the period.
Doug

On Thu, Sep 17, 2009 at 11:28 AM, Bruce McGuffin [email protected]
wrote:

one succeeded. Here is a typical exchange from that attempt:

the reject file contains:
restart_streaming();

Thanks
Bruce


Discuss-gnuradio mailing list
[email protected]
Discuss-gnuradio Info Page


Doug G.
[email protected]

Hi Bruce,

I applied the patch with the Gnuradio version 3.2.2 and with the -p0
command
on my Kubuntu 9.04 machine lately and it works well.

Cheers,

Christoph

Am Donnerstag, 17. September 2009 18:09:20 schrieb Douglas G.:

Bruce,
In the firmware directory the important files are the app_common_v2.c
and .h file, and txrx.c (serdes_txrx.c and a bunch of the others I
think are mainly for testing). It looks like the host code (i.e. the
patches to libusrp2) all applied successfully, which is good. I have
been using that code, so if you are able to manually apply the patch
(i.e. go in and figure out where the changes need to happen - there’s
a couple added functions, and some changes made in the control loop of
app_common and txrx). My patch added code to serdes_txrx,
mimo_tx_slave, and factorytest only because I added a function
declaration in app_common_v2, and so I needed a NOP definition in
those .c files for the build to be successful.
In this end this patch was just a hack to get the functionality I
needed until the switchover to the VRT code on the USRP2 - so yes, it
works (i.e. it will wait to start streaming rx samples back until the
fpga clock/counter reaches the specified number), but it’s not meant
to be the long-term solution.
Doug

On Thu, Sep 17, 2009 at 1:30 PM, Bruce McGuffin [email protected]
wrote:

patching file usrp2/firmware/apps/serdes_txrx.c
usrp2/firmware/apps/app_common_v2.h.rej
patching file usrp2/host/include/usrp2/usrp2.h
Are these patches still useful? That is, if I went through the files by hand
and made
the changes, would I wind up with usable code?

Thanks
Bruce


Doug G.
[email protected]

Doug

I tried a bunch of different p levels. At -p0 it finds the files right
away, but
still fails to update them.

Redoing patch with -p0 I get:

 [mcguffin@edinburgh gnuradio-3.2]$ patch -p0 <

usrp2-rx_at-sync_rx_at.patch
patching file usrp2/firmware/apps/serdes_txrx.c
Hunk #1 FAILED at 183.
1 out of 1 hunk FAILED – saving rejects to file
usrp2/firmware/apps/serdes_txrx.c.rej
patching file usrp2/firmware/apps/app_common_v2.c
Hunk #1 FAILED at 477.
1 out of 1 hunk FAILED – saving rejects to file
usrp2/firmware/apps/app_common_v2.c.rej
patching file usrp2/firmware/apps/app_common_v2.h
Hunk #1 FAILED at 55.
1 out of 1 hunk FAILED – saving rejects to file
usrp2/firmware/apps/app_common_v2.h.rej
patching file usrp2/firmware/apps/txrx.c
Hunk #1 FAILED at 158.
Hunk #2 FAILED at 211.
2 out of 2 hunks FAILED – saving rejects to file
usrp2/firmware/apps/txrx.c.rej
patching file usrp2/firmware/apps/factory_test.c
patching file usrp2/firmware/apps/mimo_tx_slave.c
Hunk #1 FAILED at 191.
1 out of 1 hunk FAILED – saving rejects to file
usrp2/firmware/apps/mimo_tx_slave.c.rej
patching file usrp2/host/include/usrp2/usrp2.h
Hunk #1 succeeded at 172 (offset -5 lines).
patching file usrp2/host/lib/usrp2_impl.cc
patching file usrp2/host/lib/usrp2_impl.h
patching file usrp2/host/lib/usrp2.cc
patching file usrp2/host/lib/control.h

So I guess it worked on more than just the last file, as I originally
said, but still
didn’t manage to update what look like essential files. e.g.
serdes_txrx.

Are these patches still useful? That is, if I went through the files by
hand and made
the changes, would I wind up with usable code?

Thanks
Bruce

Bruce,
If you’re referring to the internals of the USRP2, you’d have to look
through the firmware (txrx.c would be the place to start) and fpga
code to see how/when things get reset. If you just want to reset the
clock/counter according to an external input (e.g. 1PPS from a
GPSDO/etc.) you can call the sync_to_pps() command.
Start_rx_streaming_at() only addresses the need to begin streaming at
a specific time relative to the last clock reset (e.g. via
sync_to_pps(), or when the USRP2 got turned on, or when it last rolled
over). It takes an uint32 as argument, which corresponds to the fpga’s
clock count - as that increments at 100MHz, each tick is 10ns. So
you’re basically specifying the number of 10ns ticks since the last
clock reset (or rollover) to start at.
For the VRT code - it’s in development now, but I’d have to let
someone more involved comment on it’s status. There’s code in:
http://gnuradio.org/cgit/gnuradio.git/tree/vrt and
http://gnuradio.org/cgit/gnuradio.git/tree/gr-vrt. The last
announcement about it - apparently the plan was to get it working with
some development hardware, and then port it over to the USRP2. If
you’re more concerned about the internals of the USRP2 though
(buffers, etc.) that may not affect you at all - the VRT is just about
the transport mechanism between the host pc and the usrp2.
Hope that helps,
Doug

On Thu, Sep 17, 2009 at 3:30 PM, Bruce McGuffin [email protected]
wrote:

that gives an offset from the most recent sync to PPS?

What is this VRT code? And when will it be available?

Thanks
Bruce


Doug G.
[email protected]

Doug

And what is VRT code?

I googled VRT, but the choices I got were:
Vestibular Rehabilitation Therapy
Vulnerability Research Team
Vlaamse Radio- en Televisieomroep (my personal favorite)
or
Video Round Table

Bruce

Bruce McGuffin wrote:

Video Round Table
http://www.digitalif.org/

Philip

Doug

What I really want most right now, is a usrp2 function that resets all
the
buffers, data storage, counters, etc at the start of a data collect.
Does
start_rx_streaming_at do that? (Later I’ll also need it to allow me to
set
the start time.)

And how is the start time specified? Is it just a 32 (64?) bit unsigned
integer
that gives an offset from the most recent sync to PPS?

What is this VRT code? And when will it be available?

Thanks
Bruce

And what is VRT code?

I think that VRT is also referred to as VITA.

I think Pentek | Upper Saddle River, NJ - May 12, 2008
may be a start.

//Mattias