[Top][All Lists]

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

Re: [Discuss-gnuradio] Input items vs Output items

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

I should have added, the packet decoding is based on Volkers rather nifty 
gr-ax25, which I think is based on earlier implementations so I don't think 
that is where the bug is. I have heavily modified that code as I am using BPSK 
demodulator but the hdlc parts are the same. 


-----Original Message-----
From: Mike Willis [mailto:address@hidden 
Sent: 18 April 2015 13:58
To: GNURadio Discussion List
Subject: Input items vs Output items

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 useful.

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]