summaryrefslogtreecommitdiff
path: root/gsm-tvoid/src
diff options
context:
space:
mode:
authorleo <leo@brix.(none)>2008-04-18 00:53:39 +0100
committerleo <leo@brix.(none)>2008-04-18 00:53:39 +0100
commitae813e4258cddb8442aa64c097bbf94f9bb0671d (patch)
tree46469d3f13fea188767d1d3f941951b3d12546a0 /gsm-tvoid/src
parent1160a9850752e6abb9a9a96ec4a3b7db6474dca0 (diff)
patch 20080411
Diffstat (limited to 'gsm-tvoid/src')
-rwxr-xr-xgsm-tvoid/src/lib/Makefile.am4
-rwxr-xr-xgsm-tvoid/src/lib/gsm.i25
-rwxr-xr-xgsm-tvoid/src/lib/gsm_burst.cc99
-rwxr-xr-xgsm-tvoid/src/lib/gsm_burst.h54
-rwxr-xr-xgsm-tvoid/src/lib/gsm_burst_cf.cc109
-rwxr-xr-xgsm-tvoid/src/lib/gsm_burst_cf.h10
-rwxr-xr-xgsm-tvoid/src/lib/gsm_burst_ff.cc37
-rwxr-xr-xgsm-tvoid/src/lib/gsm_burst_ff.h6
8 files changed, 223 insertions, 121 deletions
diff --git a/gsm-tvoid/src/lib/Makefile.am b/gsm-tvoid/src/lib/Makefile.am
index f4072d9..e8f093f 100755
--- a/gsm-tvoid/src/lib/Makefile.am
+++ b/gsm-tvoid/src/lib/Makefile.am
@@ -47,7 +47,8 @@ _gsm_la_SOURCES = \
gsm.cc \
gsm_burst.cc \
gsm_burst_ff.cc \
- gsm_burst_cf.cc
+ gsm_burst_cf.cc \
+ gsm_burst_sink_c.cc
# magic flags
@@ -74,6 +75,7 @@ grinclude_HEADERS = \
system.h \
gsm_burst_ff.h \
gsm_burst_cf.h \
+ gsm_burst_sink_c.h \
gsm_constants.h
diff --git a/gsm-tvoid/src/lib/gsm.i b/gsm-tvoid/src/lib/gsm.i
index d990e8b..106e378 100755
--- a/gsm-tvoid/src/lib/gsm.i
+++ b/gsm-tvoid/src/lib/gsm.i
@@ -9,6 +9,7 @@
//#include "gsm_burst.h"
#include "gsm_burst_ff.h"
#include "gsm_burst_cf.h"
+#include "gsm_burst_sink_c.h"
//#include <stdexcept>
%}
@@ -43,6 +44,10 @@
#define CLK_CORR_TRACK 0x00000010 //adjust timing based on correlation offsets
+#define BURST_CB_SYNC_OFFSET 1
+#define BURST_CB_ADJ_OFFSET 2
+#define BURST_CB_TUNE 3
+
//EQ options
enum EQ_TYPE {
EQ_NONE,
@@ -73,6 +78,8 @@ public:
long d_unknown_count;
long d_total_count;
+ long next_arfcn;
+
int sync_state();
float last_freq_offset(void);
double mean_freq_offset(void);
@@ -81,24 +88,32 @@ public:
void full_reset(void);
protected:
- gsm_burst();
+ gsm_burst(gr_feval_ll *);
};
GR_SWIG_BLOCK_MAGIC(gsm,burst_ff);
-gsm_burst_ff_sptr gsm_make_burst_ff ();
+gsm_burst_ff_sptr gsm_make_burst_ff (gr_feval_ll *);
class gsm_burst_ff : public gr_block, public gsm_burst {
private:
- gsm_burst_ff ();
+ gsm_burst_ff (gr_feval_ll *);
};
GR_SWIG_BLOCK_MAGIC(gsm,burst_cf);
-gsm_burst_cf_sptr gsm_make_burst_cf (float);
+gsm_burst_cf_sptr gsm_make_burst_cf (gr_feval_ll *,float);
class gsm_burst_cf : public gr_block, public gsm_burst {
private:
- gsm_burst_cf (float);
+ gsm_burst_cf (gr_feval_ll *,float);
+};
+
+GR_SWIG_BLOCK_MAGIC(gsm,burst_sink_c);
+gsm_burst_sink_c_sptr gsm_make_burst_sink_c(gr_feval_ll *,float);
+
+class gsm_burst_sink_c : public gr_sync_block, public gsm_burst {
+private:
+ gsm_burst_sink_c (gr_feval_ll *,float);
};
diff --git a/gsm-tvoid/src/lib/gsm_burst.cc b/gsm-tvoid/src/lib/gsm_burst.cc
index b862d69..c7f0acc 100755
--- a/gsm-tvoid/src/lib/gsm_burst.cc
+++ b/gsm-tvoid/src/lib/gsm_burst.cc
@@ -13,12 +13,15 @@
#include "gsmstack.h"
-gsm_burst::gsm_burst () :
+gsm_burst::gsm_burst (gr_feval_ll *t) :
+ p_tuner(t),
d_clock_options(DEFAULT_CLK_OPTS),
d_print_options(0),
d_equalizer_type(EQ_FIXED_DFE)
{
+// fprintf(stderr,"gsm_burst: enter constructor (t=%8.8x)\n",(unsigned int)t);
+
// M_PI = M_PI; //4.0 * atan(1.0);
full_reset();
@@ -194,7 +197,17 @@ void gsm_burst::print_burst(void)
int print = 0;
//fprintf(stderr,"p=%8.8X ", d_print_options);
-
+
+ if ( PRINT_GSM_DECODE & d_print_options ) {
+
+ /*
+ * Pass information to GSM stack. GSM stack will try to extract
+ * information (fn, layer 2 messages, ...)
+ */
+ diff_decode_burst();
+ GS_process(&d_gs_ctx, d_ts, d_burst_type, d_decoded_burst);
+ }
+
if ( PRINT_EVERYTHING == d_print_options )
print = 1;
else if ( (!d_ts) && (d_print_options & PRINT_TS0) )
@@ -221,18 +234,7 @@ void gsm_burst::print_burst(void)
fprintf(stderr," ");
}
-
- if ( PRINT_GSM_DECODE == d_print_options ) {
-
- /*
- * Pass information to GSM stack. GSM stack will try to extract
- * information (fn, layer 2 messages, ...)
- */
- diff_decode_burst();
- GS_process(&d_gs_ctx, d_ts, d_burst_type, d_decoded_burst);
- }
-
if (print) {
fprintf(stderr,"%d/%d/%+d/%lu/%lu ",
@@ -275,7 +277,7 @@ void gsm_burst::print_burst(void)
break;
}
- fprintf(stderr,"\n");
+ fprintf(stderr,"\n");
//print the correlation pattern for visual inspection
@@ -348,14 +350,15 @@ void gsm_burst::shift_burst(int shift_bits)
//of the mean phase from pi/2.
void gsm_burst::calc_freq_offset(void)
{
- int start = d_burst_start + 10;
- int end = d_burst_start + USEFUL_BITS - 10;
+ const int padding = 20;
+ int start = d_burst_start + padding;
+ int end = d_burst_start + USEFUL_BITS - padding;
float sum = 0.0;
for (int j = start; j <= end; j++) {
sum += d_burst_buffer[j];
}
- float mean = sum / ((float)USEFUL_BITS - 20.0);
+ float mean = sum / ((float)USEFUL_BITS - (2.0 * (float)padding) );
float p_off = mean - (M_PI / 2);
d_freq_offset = p_off * 1625000.0 / (12.0 * M_PI);
@@ -466,7 +469,8 @@ float gsm_burst::correlate_pattern(const float *pattern,const int pat_size,const
corr = 0.0;
for (int i = 1; i < pat_size; i++) { //Start a 1 to skip first bit due to diff encoding
//d_corr[j+distance] += d_burst_buffer[center+i+j] * pattern[i];
- corr += SIGNUM(d_burst_buffer[center+i+j]) * pattern[i]; //binary corr/sliced
+ //corr += SIGNUM(d_burst_buffer[center+i+j]) * pattern[i]; //binary corr/sliced
+ corr += d_burst_buffer[center+i+j] * pattern[i];
}
corr /= pat_size - 1; //normalize, -1 for skipped first bit
if (corr > d_corr_max) {
@@ -609,8 +613,9 @@ int gsm_burst::get_burst(void)
case PARTIAL_SCH:
d_sync_state = WAIT_SCH;
break;
- case SCH:
- d_sync_state = SYNCHRONIZED;
+ //case SCH:
+ //let the burst type switch handle this so it knows if new or old sync
+ // d_sync_state = SYNCHRONIZED;
break;
default:
break;
@@ -645,6 +650,18 @@ int gsm_burst::get_burst(void)
d_ts = 0; //TODO: check this
break;
case SCH:
+#ifndef TEST_TUNE_TIMING
+ //TODO: it would be better to adjust tuning on first FCCH (for better SCH detection),
+ // but tuning can run away with false FCCHs
+ // Some logic to retune back to original offset on false FCCH might work
+ if (p_tuner) {
+ if (SYNCHRONIZED == d_sync_state)
+ p_tuner->calleval(BURST_CB_ADJ_OFFSET);
+ else
+ p_tuner->calleval(BURST_CB_SYNC_OFFSET);
+
+ }
+#endif
d_burst_count++;
d_sch_count++;
d_last_sch = d_burst_count;
@@ -672,7 +689,6 @@ int gsm_burst::get_burst(void)
d_last_good = d_burst_count;
}
-
//Check for loss of sync
int bursts_since_good = d_burst_count - d_last_good;
if (bursts_since_good > MAX_SYNC_WAIT) {
@@ -686,6 +702,47 @@ int gsm_burst::get_burst(void)
//print info
print_burst();
+ /////////////////////
+ //start tune testing
+#ifdef TEST_TUNE_TIMING
+
+ static int good_count = -1; //-1: wait sch, >=0: got sch, counting
+ static int wait_count = 0;
+
+ if (UNKNOWN == d_burst_type) {
+ if (good_count >= 0) {
+ fprintf(stdout,"good_count: %d\n",good_count);
+
+ if (p_tuner) {
+ next_arfcn = TEST_TUNE_GOOD_ARFCN;
+ p_tuner->calleval(BURST_CB_TUNE);
+ }
+ }
+ good_count = -1; // start again at resync
+
+ } else {
+
+ if (good_count >= 0 ) {
+ good_count++;
+ }
+
+ if (SCH == d_burst_type) {
+ if ((good_count < 0) && (++wait_count > 20)) { // get some good syncs before trying again
+ fprintf(stdout,"restarting good_count\n");
+ good_count = wait_count = 0;
+ //tune away
+ if (p_tuner) {
+ next_arfcn = TEST_TUNE_EMPTY_ARFCN;
+ p_tuner->calleval(BURST_CB_TUNE);
+ }
+ }
+ }
+ }
+#endif
+ //end tune testing
+ /////////////////////
+
+
//Adjust the buffer write position to align on MAX_CORR_DIST
if ( d_clock_options & CLK_CORR_TRACK )
d_bbuf_pos += MAX_CORR_DIST - d_burst_start;
diff --git a/gsm-tvoid/src/lib/gsm_burst.h b/gsm-tvoid/src/lib/gsm_burst.h
index def20e0..48fafac 100755
--- a/gsm-tvoid/src/lib/gsm_burst.h
+++ b/gsm-tvoid/src/lib/gsm_burst.h
@@ -8,10 +8,15 @@
#include "gsm_constants.h"
#include <gr_math.h>
-//#include <Python.h> //for callback testing
#include <gr_feval.h>
#include "gsmstack.h"
+//Testing Modes
+//Tune test measures hopping latency by hopping between good and empty ARFCNs
+#undef TEST_TUNE_TIMING
+#define TEST_TUNE_GOOD_ARFCN 658
+#define TEST_TUNE_EMPTY_ARFCN 655
+
//Console printing options
#define PRINT_NOTHING 0x00000000
@@ -73,13 +78,18 @@ enum EQ_TYPE {
EQ_VITERBI
};
+#define BURST_CB_SYNC_OFFSET 1
+#define BURST_CB_ADJ_OFFSET 2
+#define BURST_CB_TUNE 3
+
+
class gsm_burst;
class gsm_burst
{
protected:
- gsm_burst();
+ gsm_burst(gr_feval_ll *t);
//Burst Buffer: Storage for burst data
float d_burst_buffer[BBUF_SIZE];
@@ -116,30 +126,33 @@ protected:
double d_freq_off_sum;
double d_freq_off_weight;
+ gr_feval_ll *p_tuner;
+
//////// Methods
int get_burst(void);
BURST_TYPE get_fcch_burst(void);
BURST_TYPE get_sch_burst(void);
BURST_TYPE get_norm_burst(void);
- void shift_burst(int);
- void calc_freq_offset(void);
- void equalize(void);
- float correlate_pattern(const float *,const int,const int,const int);
- void diff_decode_burst(void);
+ virtual void shift_burst(int);
+ void calc_freq_offset(void);
+ virtual void equalize(void);
+ float correlate_pattern(const float *,const int,const int,const int);
+ void diff_decode_burst(void);
- void sync_reset(void);
+ void sync_reset(void);
- void print_bits(const float *data,int length);
- void print_hex(const unsigned char *data,int length);
- void soft2hardbit(char *dst, const float *data, int len);
- void print_burst(void);
+ void print_bits(const float *data,int length);
+ void print_hex(const unsigned char *data,int length);
- void diff_encode(const float *in,float *out,int length,float lastbit = 1.0);
- void diff_decode(const float *in,float *out,int length,float lastbit = 1.0);
+// void soft2hardbit(char *dst, const float *data, int len); //need this?
+ void print_burst(void);
+
+ void diff_encode(const float *in,float *out,int length,float lastbit = 1.0);
+ void diff_decode(const float *in,float *out,int length,float lastbit = 1.0);
public:
- ~gsm_burst ();
+ virtual ~gsm_burst ();
////// General Stats
//TODO: Maybe there should be a burst_stats class?
@@ -157,12 +170,17 @@ public:
unsigned long d_print_options;
EQ_TYPE d_equalizer_type;
- int sync_state() { return d_sync_state;}
- float last_freq_offset() {return d_freq_offset;}
- double mean_freq_offset(void);
//Methods
void full_reset(void);
+
+ int sync_state() { return d_sync_state;}
+
+ //Frequency
+ float last_freq_offset() {return d_freq_offset;}
+ double mean_freq_offset(void);
+
+ long next_arfcn;
};
diff --git a/gsm-tvoid/src/lib/gsm_burst_cf.cc b/gsm-tvoid/src/lib/gsm_burst_cf.cc
index a91c569..a584cd6 100755
--- a/gsm-tvoid/src/lib/gsm_burst_cf.cc
+++ b/gsm-tvoid/src/lib/gsm_burst_cf.cc
@@ -9,21 +9,23 @@
#include <stdio.h>
#include <gri_mmse_fir_interpolator_cc.h>
-gsm_burst_cf_sptr gsm_make_burst_cf (float sample_rate)
+gsm_burst_cf_sptr gsm_make_burst_cf (gr_feval_ll *t,float sample_rate)
{
- return gsm_burst_cf_sptr (new gsm_burst_cf (sample_rate));
+ return gsm_burst_cf_sptr (new gsm_burst_cf (t,sample_rate));
}
static const int MIN_IN = 1; // minimum number of input streams
static const int MAX_IN = 1; // maximum number of input streams
-static const int MIN_OUT = 1; // minimum number of output streams
+static const int MIN_OUT = 0; // minimum number of output streams
static const int MAX_OUT = 1; // maximum number of output streams
-gsm_burst_cf::gsm_burst_cf (float sample_rate) :
+gsm_burst_cf::gsm_burst_cf (gr_feval_ll *t, float sample_rate) :
+ gsm_burst(t),
gr_block ( "burst_cf",
gr_make_io_signature (MIN_IN, MAX_IN, sizeof (gr_complex)),
gr_make_io_signature (MIN_OUT, MAX_OUT, USEFUL_BITS * sizeof (float))),
d_clock_counter(0.0),
+ d_mu(0.5),
d_last_sample(0.0,0.0),
d_interp(new gri_mmse_fir_interpolator_cc())
@@ -36,7 +38,7 @@ gsm_burst_cf::gsm_burst_cf (float sample_rate) :
fprintf(stderr,"Sample interval : %e\n",d_sample_interval);
fprintf(stderr,"Relative sample rate : %g\n",d_relative_sample_rate);
- set_history(4);
+ set_history(4); //need history for interpolator
}
@@ -63,41 +65,39 @@ int gsm_burst_cf::general_work (int noutput_items,
int ii=0;
int rval = 0; //default to no output
+ int do_output = output_items.size() > 0 ? 1 : 0;
int ninput = ninput_items[0];
//fprintf(stderr,"#i=%d/#o=%d",n_input,noutput_items);
- int ni = ninput - d_interp->ntaps(); // interpolator need -4/+3 samples NTAPS = 8
+ int ni = ninput - d_interp->ntaps() - 16; // interpolator need -4/+3 samples NTAPS = 8 , - 16 for safety margin
while (( rval < noutput_items) && ( ii < ni ) ) {
//clock symbols
//TODO: this is very basic and can be improved. Need tracking...
//TODO: use burst_start offsets as timing feedback
//TODO: save complex samples for Viterbi EQ
- if ( d_clock_counter >= GSM_SYMBOL_PERIOD) {
-
- d_clock_counter -= GSM_SYMBOL_PERIOD; //reset clock for next sample, keep the remainder
-
- //float mu = 1.0 - d_clock_counter / GSM_SYMBOL_PERIOD;
- float mu = d_clock_counter / GSM_SYMBOL_PERIOD;
- gr_complex sample = d_interp->interpolate (&in[ii], mu); //FIXME: this seems noisy, make sure it is being used correctly
+
+ //from m&m
+ gr_complex sample = d_interp->interpolate (&in[ii], d_mu); //FIXME: this seems noisy, make sure it is being used correctly
+
+ gr_complex conjprod = sample * conj(d_last_sample);
+ float diff_angle = gr_fast_atan2f(imag(conjprod), real(conjprod));
- gr_complex conjprod = sample * conj(d_last_sample);
- float diff_angle = gr_fast_atan2f(imag(conjprod), real(conjprod));
+ d_last_sample = sample;
- d_last_sample = sample;
-
- assert(d_bbuf_pos <= BBUF_SIZE );
-
- if (d_bbuf_pos >= 0) //could be negative offset from burst alignment. TODO: perhaps better just to add some padding to the buffer
- d_burst_buffer[d_bbuf_pos] = diff_angle;
-
- d_bbuf_pos++;
-
- if ( d_bbuf_pos >= BBUF_SIZE ) {
-
- if (get_burst()) {
- //found a burst, send to output
+ assert(d_bbuf_pos <= BBUF_SIZE );
+
+ if (d_bbuf_pos >= 0) //could be negative offset from burst alignment. TODO: perhaps better just to add some padding to the buffer
+ d_burst_buffer[d_bbuf_pos] = diff_angle;
+
+ d_bbuf_pos++;
+
+ if ( d_bbuf_pos >= BBUF_SIZE ) {
+
+ if (get_burst()) {
+ //found a burst, send to output
+ if (do_output) {
//ensure that output data is in range
int b = d_burst_start;
if (b < 0)
@@ -106,31 +106,36 @@ int gsm_burst_cf::general_work (int noutput_items,
b = 2 * MAX_CORR_DIST - 1;
memcpy(out+rval*USEFUL_BITS, d_burst_buffer + b, USEFUL_BITS*sizeof(float));
- rval++;
-
- switch ( d_clock_options & QB_MASK ) {
- case QB_QUARTER: //extra 1/4 bit each burst
- d_clock_counter -= GSM_SYMBOL_PERIOD / 4.0;
- break;
- case QB_FULL04: //extra bit on timeslot 0 & 4
- if (!(d_ts%4))
- d_clock_counter -= GSM_SYMBOL_PERIOD;
- break;
- case QB_NONE: //don't adjust for quarter bits at all
- default:
- break;
- }
-
- d_last_burst_s_count = d_sample_count;
-
- //fprintf(stderr,"clock: %f, pos: %d\n",d_clock_counter,d_bbuf_pos);
}
- }
- }
-
- d_clock_counter += d_sample_interval;
- d_sample_count++;
- ii++;
+ rval++;
+
+ switch ( d_clock_options & QB_MASK ) {
+ case QB_QUARTER: //extra 1/4 bit each burst
+ d_mu -= d_relative_sample_rate / 4.0;
+ //d_clock_counter -= GSM_SYMBOL_PERIOD / 4.0;
+ break;
+ case QB_FULL04: //extra bit on timeslot 0 & 4
+ if (!(d_ts%4))
+ d_mu -= d_relative_sample_rate;
+ //d_clock_counter -= GSM_SYMBOL_PERIOD;
+ break;
+ case QB_NONE: //don't adjust for quarter bits at all
+ default:
+ break;
+ }
+
+ d_last_burst_s_count = d_sample_count;
+
+ //fprintf(stderr,"clock: %f, pos: %d\n",d_clock_counter,d_bbuf_pos);
+ }
+ }
+
+ //TODO: timing adjust
+ //d_mu = d_mu + d_omega + d_gain_mu * mm_val;
+ d_mu += d_relative_sample_rate;
+ ii += (int)floor(d_mu);
+ d_sample_count += (int)floor(d_mu);
+ d_mu -= floor(d_mu);
}
//fprintf(stderr,"/ii=%d/rval=%d\n",ii,rval);
diff --git a/gsm-tvoid/src/lib/gsm_burst_cf.h b/gsm-tvoid/src/lib/gsm_burst_cf.h
index 33f61f6..40ccc83 100755
--- a/gsm-tvoid/src/lib/gsm_burst_cf.h
+++ b/gsm-tvoid/src/lib/gsm_burst_cf.h
@@ -8,7 +8,7 @@ class gsm_burst_cf;
typedef boost::shared_ptr<gsm_burst_cf> gsm_burst_cf_sptr;
-gsm_burst_cf_sptr gsm_make_burst_cf(float);
+gsm_burst_cf_sptr gsm_make_burst_cf(gr_feval_ll *,float);
class gri_mmse_fir_interpolator_cc;
@@ -16,15 +16,17 @@ class gsm_burst_cf : public gr_block, public gsm_burst
{
private:
- friend gsm_burst_cf_sptr gsm_make_burst_cf(float);
- gsm_burst_cf(float);
+ friend gsm_burst_cf_sptr gsm_make_burst_cf(gr_feval_ll *,float);
+ gsm_burst_cf(gr_feval_ll *,float);
//clocking parameters
- float d_relative_sample_rate;
double d_sample_interval;
double d_clock_counter;
gr_complex d_last_sample;
+ float d_relative_sample_rate; //omega
+ float d_mu;
+
gri_mmse_fir_interpolator_cc *d_interp; //sub-sample interpolator from GR
public:
diff --git a/gsm-tvoid/src/lib/gsm_burst_ff.cc b/gsm-tvoid/src/lib/gsm_burst_ff.cc
index 2980829..dd449f1 100755
--- a/gsm-tvoid/src/lib/gsm_burst_ff.cc
+++ b/gsm-tvoid/src/lib/gsm_burst_ff.cc
@@ -9,17 +9,18 @@
#include <stdio.h>
#include <gri_mmse_fir_interpolator_cc.h>
-gsm_burst_ff_sptr gsm_make_burst_ff ()
+gsm_burst_ff_sptr gsm_make_burst_ff (gr_feval_ll *t)
{
- return gsm_burst_ff_sptr (new gsm_burst_ff());
+ return gsm_burst_ff_sptr (new gsm_burst_ff(t));
}
static const int MIN_IN = 1; // minimum number of input streams
static const int MAX_IN = 1; // maximum number of input streams
-static const int MIN_OUT = 1; // minimum number of output streams
+static const int MIN_OUT = 0; // minimum number of output streams
static const int MAX_OUT = 1; // maximum number of output streams
-gsm_burst_ff::gsm_burst_ff () :
+gsm_burst_ff::gsm_burst_ff (gr_feval_ll *t) :
+ gsm_burst(t),
gr_block( "burst_ff",
gr_make_io_signature (MIN_IN, MAX_IN, sizeof (float)),
gr_make_io_signature (MIN_OUT, MAX_OUT, USEFUL_BITS * sizeof (float)))
@@ -37,7 +38,7 @@ void gsm_burst_ff::forecast (int noutput_items, gr_vector_int &ninput_items_requ
{
unsigned ninputs = ninput_items_required.size ();
for (unsigned i = 0; i < ninputs; i++)
- ninput_items_required[i] = noutput_items * BBUF_SIZE + history();
+ ninput_items_required[i] = noutput_items * BBUF_SIZE;
}
@@ -51,9 +52,10 @@ int gsm_burst_ff::general_work (int noutput_items,
int ii=0;
int rval = 0; //default to no output
-
+ int do_output = output_items.size() > 0 ? 1 : 0;
+
int n_input = ninput_items[0];
- //fprintf(stderr,"#i=%d/#o=%d",n_input,noutput_items);
+// fprintf(stderr,"out=%8.8x/#i=%d/#o=%d",(unsigned)out,n_input,noutput_items);
while (( rval < noutput_items) && ( ii < n_input ) ) {
@@ -68,15 +70,16 @@ int gsm_burst_ff::general_work (int noutput_items,
if (get_burst()) {
//found a burst, send to output
-
- //ensure that output data is in range
- int b = d_burst_start;
- if (b < 0)
- b = 0;
- else if (b >= 2 * MAX_CORR_DIST)
- b = 2 * MAX_CORR_DIST - 1;
-
- memcpy(out+rval*USEFUL_BITS, d_burst_buffer + b, USEFUL_BITS*sizeof(float));
+ if (do_output) {
+ //ensure that output data is in range
+ int b = d_burst_start;
+ if (b < 0)
+ b = 0;
+ else if (b >= 2 * MAX_CORR_DIST)
+ b = 2 * MAX_CORR_DIST - 1;
+
+ memcpy(out+rval*USEFUL_BITS, d_burst_buffer + b, USEFUL_BITS*sizeof(float));
+ }
rval++;
switch ( d_clock_options & QB_MASK ) {
@@ -98,7 +101,7 @@ int gsm_burst_ff::general_work (int noutput_items,
ii++;
}
- //fprintf(stderr,"/ii=%d/rval=%d\n",ii,rval);
+// fprintf(stderr,"/ii=%d/rval=%d\n",ii,rval);
consume_each (ii);
diff --git a/gsm-tvoid/src/lib/gsm_burst_ff.h b/gsm-tvoid/src/lib/gsm_burst_ff.h
index 30c10dc..8ca61ef 100755
--- a/gsm-tvoid/src/lib/gsm_burst_ff.h
+++ b/gsm-tvoid/src/lib/gsm_burst_ff.h
@@ -8,14 +8,14 @@ class gsm_burst_ff;
typedef boost::shared_ptr<gsm_burst_ff> gsm_burst_ff_sptr;
-gsm_burst_ff_sptr gsm_make_burst_ff();
+gsm_burst_ff_sptr gsm_make_burst_ff(gr_feval_ll *);
class gsm_burst_ff : public gr_block, public gsm_burst
{
private:
- friend gsm_burst_ff_sptr gsm_make_burst_ff();
- gsm_burst_ff();
+ friend gsm_burst_ff_sptr gsm_make_burst_ff(gr_feval_ll *);
+ gsm_burst_ff(gr_feval_ll *t);
public:
~gsm_burst_ff ();
personal git repositories of Harald Welte. Your mileage may vary