Forum: GNU Radio usrp1_source_base, usrp_standard_rx::read, and 512 nbytes

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
815d7689c14621a2a5ed60b8bcde29b8?d=identicon&s=25 Chris Stankevitz (Guest)
on 2008-12-10 21:38
(Received via mailing list)
usrp1_source_base.cc has this chunk of code that reads from
usrp_standard_rx:

//----------
while (output_index < noutput_items)
{
   int nbytes = ninput_bytes_reqd_for_noutput_items (
     noutput_items - output_index);

   nbytes = std::min (nbytes, BUFSIZE);

   int result_nbytes = d_usrp->read (buf, nbytes, &overrun);
//----------

Question: What guarantees that nbytes is a multiple of 512?

According to usrp_basic.h, nbytes must be a multiple of 512.  It seems
to me that nouput_items would need to be specially crafted upstream so
that nbytes is a multiple of 512.

Thank you,

Chris
D0072e69d706bb3ca211d33a1b536e2c?d=identicon&s=25 Johnathan Corgan (Guest)
on 2008-12-11 16:10
(Received via mailing list)
On Wed, 2008-12-10 at 12:37 -0800, Chris Stankevitz wrote:
>
>    int result_nbytes = d_usrp->read (buf, nbytes, &overrun);
> //----------
>
> Question: What guarantees that nbytes is a multiple of 512?

In the usrp1_source_base constructor, a call is made to
set_output_multiple(n), which tells the scheduler to only call the work
function to produce a multiple of n samples:

http://gnuradio.org/trac/browser/gnuradio/trunk/gr...

-Johnathan
This topic is locked and can not be replied to.