[Discuss-gnuradio] A question about general_work() function
From:
Dawei Shen
Subject:
[Discuss-gnuradio] A question about general_work() function
Date:
Tue, 10 Oct 2006 12:03:56 -0400
Hello Everyone
I have got a problem which arised from my project. Here is what I want to do: I am trying to implement a Viterbi algorithm. Suppose
"in" is the input stream, I want to use in[0], in[1]....in[6], seven
elements to initialize the Viterbi algorithm. Then from in[7], I start
to use Viterbi algorithm to do tracking. Now the problem comes, in the
"general_work()" function, I did something like this:
int general_work(arg1, arg2, arg3, arg4) { for (int i = 0; i < 7; i++) { use in[i] to intialize the Viterbi algorithm; } for (int i = 8; i < ninput_terms; i++) { use each in[i] to do Viterbi algorithm tracking;
out[n] = something } }
However, the
results told me this is a wrong way. Because the initialization part
(the for i=0, i<7, i++ part) would be executed for many many times. It
appeared to me that the scheduler would try to call the general_work
function for many times and each time it calls it, everything in the
function would be executed from the beginning to the end. For example,
if I write a line
printf("can you see me?\n");
and put it in front of the
first 'for' iteration, I can see the printed output many times. This
thing totally disturbed what I wish to do. Am I understood?
Could anyone provide any help or insights? Thanks in advance.