[Top][All Lists]

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

[Discuss-gnuradio] Input items vs Output items

From: Mike Willis
Subject: [Discuss-gnuradio] Input items vs Output items
Date: Sat, 18 Apr 2015 13:58:04 +0100

I am slightly confused with the way you implement a general work
function - here is my AX25 decoder which takes in bits and outputs
decoded packets in text format as a stream of 8 bit integers. This was
based on the general work example in the GR tutorial.

int ax25_impl::general_work (int noutput_items,
                  gr_vector_int &ninput_items,
                  gr_vector_const_void_star &input_items,
                  gr_vector_void_star &output_items)
int i;
const char *bit = (const char *) input_items[0];
out = (char *) output_items[0];

for (i=0;i <noutput_items; i++)
    hdlc_rxbit( bit[i] );

// Tell runtime system how many output items we produced.
consume_each (noutput_items);
return d_numchars;

I keep a tally of how many characters I output in the class member
variable d_numchars. I do this by initially printing to the "out"
buffer (see above code) with the vsprintf() function and then using
the strlen() function to find out how long the out string is.

It works for a while, perhaps 200-300 packets and then crashes with a
segfault and error 7. I know the crash is related to the number of
output items because if I reduce the number of characters I output it
will run for longer. If I don't output anything its fine, but not very

It gets complicated because the block outputs nothing at all until it
decodes a packet, then it outputs that entire packet, which might be
up to 1000 characters or so.

I think I have made a fundamental error somewhere. Finding it is
proving problematic. I am also confused by ninput_items and
noutput_items variables as to me they appear reversed but that is how
they are in the tutorial.


reply via email to

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