[Top][All Lists]

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

Re: [Discuss-gnuradio] usrp_* gains on Mac OS X fixed

From: Eric Blossom
Subject: Re: [Discuss-gnuradio] usrp_* gains on Mac OS X fixed
Date: Wed, 4 Jan 2006 01:30:25 -0800
User-agent: Mutt/1.5.6i

On Tue, Jan 03, 2006 at 02:02:46PM -0800, Jonathan Jacky wrote:
> On Fri, 23 Dec 2005, Eric Blossom wrote:
> >There is a usrp_bytesex.h include file which includes
> >fast implemenations of host_to_usrp_short and usrp_to_host_short.
> >
> >The fix probably ought to go in
> >usrp1_sink_{c,s}::copy_to_usrp_buffer
> >and in usrp1_source_{c,s}::copy_from_usrp_buffer.
> This fix works.  See the PS below for diffs of the code, and the
> PPS for details on the gains before and after the fix.


> I only fixed the _c versions, not the _s versions.  I'm not sure
> what program I could use to test whether the _s versions were working
> properly.  Doesn't the USRP always process complex inputs and outputs?

Yes, but for some purposes (testing mostly) people want the raw samples.
I consider the _s versions experimental, and subject to change/deletion.

> I only fixed the s16 case in usrp1_source_c.cc, not the s8 case.
> Could the s8 case be fixed just by reversing the order of the 2*i+0 and
> 2*i+1 arguments?  What program tests this?

usrp_fft.py or usrp_oscope.py with the -8 option.  
I think the s8 case should work OK as is.

> >The AC_C_BIGENDDIAN test will need to be added to configure.ac to
> >define the stuff that the usrp_bytesex.h include needs to work
> >properly.

You're right, it's already in usrp/configure.ac.
I'll add it to gr-usrp/configure.ac.

> Eric, would you prefer to take it from here, or shall I revise the _s
> files also and make an attempt at revising configure.ac etc.?

Please revise and test the _s file.

> Incidentally, it appears this byte swapping is already handled
> properly in the usrp module.  I find that AC_C_BIGENDIAN already
> appears in my usrp/configure.ac, #define WORDS_BIGENDIAN 1
> already appears in my usrp/config.h and configure, and 
> #define <usrp_bytesex.h> already already appears in several programs 
> in usrp/host/apps, including usrp_test_usrp_standard_{tx,rx}.
> Jon Jacky

> PS - here are the diffs, as reported by cvs diff
> diff -r1.5 usrp1_sink_c.cc
> 30a31,33
> >#include <usrp_bytesex.h>
> >
> 84,85c87,88
> <     dst[2*i + 0] = (short) real (in[i]);      // FIXME saturate?
> <     dst[2*i + 1] = (short) imag (in[i]);      // FIXME saturate?
> ---
> >    dst[2*i + 0] = host_to_usrp_short((short) real (in[i])); // FIXME 
> >    saturate?
> >    dst[2*i + 1] = host_to_usrp_short((short) imag (in[i])); // FIXME 
> >    saturate?
> diff -r1.6 usrp1_source_c.cc
> 30a31,33
> >#include <usrp_bytesex.h>
> >
> 104c107,108
> <       out[i] = gr_complex ((float) s16[2*i+0], (float) s16[2*i+1]);
> ---
> >      out[i] = gr_complex ((float) usrp_to_host_short(s16[2*i+0]),
> >                           (float) usrp_to_host_short(s16[2*i+1]));
> PPS - Here are details on gains before and after the fix

Thanks for testing!

I'll apply your diffs for usrp1_{sink,source}_c.cc


reply via email to

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