discuss-gnuradio
[Top][All Lists]
Advanced

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

Re: [Discuss-gnuradio] Scheduling a block even with no input items RE: F


From: Activecat
Subject: Re: [Discuss-gnuradio] Scheduling a block even with no input items RE: Flow graph blocking when doing 2x1 transmission
Date: Tue, 3 Jun 2014 23:08:02 +0800


On Tue, Jun 3, 2014 at 9:59 PM, David Halls <address@hidden> wrote:
The problem with using 'sob', 'eob' is because I have two inputs to the USRP UHD sink. One is constantly transmitting and has items coming in from time=0, but the other has no input items from time=0, they only arrive later on. As a result the sink seems to block waiting for items on *both* inputs before it will transmit anything. I don't want the USRP to have to wait for the second stream to be populated before it transmits anything...


Create a general block with two inputs and two outputs.
The two outputs connect to the USRP UHD sink. The first input connects to the constantly transmitting source while the second input connects to the non-consistent source.

In your forecast function:

   ninput_items_required[0] = noutput_items;
   ninput_items_required[1] = 0;


Then in your general_work function:

  const gr_complex *in0 = (const gr_complex*) input_items[0];
  const gr_complex *in1 = (const gr_complex*) input_items[1];
  gr_complex *out0 = (gr_complex*) output_items[0];
  gr_complex *out1 = (gr_complex*) output_items[1];

  for (int i=0; i < noutput_items; i++)
      out0[i] = in0[i];

  for (int i=0; i < ninput_items[1]; i++)
      out1[i] = in1[i]

  for (int i=ninput_items[1]; i < noutput_items; i++)
      out1[i] = 0.0;     // here you fill in the zeros, but won't over-filled.

  consume( 0, noutput_items);
  consume( 1, ninput_items[1]);  

  return noutput_items;


Hope this helps !

reply via email to

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