From 8b86cd6d331e370e0c4a2e01510af38a3957694c Mon Sep 17 00:00:00 2001 From: tvoid Date: Tue, 8 Apr 2008 14:44:00 -0600 Subject: -added sync/adjust callback for freq trimming -fixed burst function with no outputs -cleanup some old float testing code --- gsm-tvoid/src/lib/gsm.i | 5 +++-- gsm-tvoid/src/lib/gsm_burst.cc | 8 ++++++-- gsm-tvoid/src/lib/gsm_burst.h | 7 ++++--- gsm-tvoid/src/lib/gsm_burst_cf.cc | 5 +++-- gsm-tvoid/src/lib/gsm_burst_ff.cc | 11 ++++++----- 5 files changed, 22 insertions(+), 14 deletions(-) (limited to 'gsm-tvoid/src/lib') diff --git a/gsm-tvoid/src/lib/gsm.i b/gsm-tvoid/src/lib/gsm.i index 9d653ac..81e9062 100755 --- a/gsm-tvoid/src/lib/gsm.i +++ b/gsm-tvoid/src/lib/gsm.i @@ -43,8 +43,9 @@ #define CLK_CORR_TRACK 0x00000010 //adjust timing based on correlation offsets -#define BURST_CB_ADJ_OFFSET 1 -#define BURST_CB_TUNE 2 +#define BURST_CB_SYNC_OFFSET 1 +#define BURST_CB_ADJ_OFFSET 2 +#define BURST_CB_TUNE 3 //EQ options enum EQ_TYPE { diff --git a/gsm-tvoid/src/lib/gsm_burst.cc b/gsm-tvoid/src/lib/gsm_burst.cc index 97e8682..f18dcae 100755 --- a/gsm-tvoid/src/lib/gsm_burst.cc +++ b/gsm-tvoid/src/lib/gsm_burst.cc @@ -366,7 +366,7 @@ void gsm_burst::calc_freq_offset(void) for (int j = start; j <= end; j++) { sum += d_burst_buffer[j]; } - float mean = sum / ((float)USEFUL_BITS - 2.0 * (float)padding); + 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); @@ -651,7 +651,11 @@ int gsm_burst::get_burst(void) #ifndef TEST_TUNE_TIMING if (p_tuner) { - p_tuner->calleval(BURST_CB_ADJ_OFFSET); + if (SYNCHRONIZED == d_sync_state) + p_tuner->calleval(BURST_CB_ADJ_OFFSET); + else + p_tuner->calleval(BURST_CB_SYNC_OFFSET); + } #endif diff --git a/gsm-tvoid/src/lib/gsm_burst.h b/gsm-tvoid/src/lib/gsm_burst.h index 79d72d6..d6ab381 100755 --- a/gsm-tvoid/src/lib/gsm_burst.h +++ b/gsm-tvoid/src/lib/gsm_burst.h @@ -13,7 +13,7 @@ //Testing Modes //Tune test measures hopping latency by hopping between good and empty ARFCNs -#define TEST_TUNE_TIMING +#undef TEST_TUNE_TIMING #define TEST_TUNE_GOOD_ARFCN 658 #define TEST_TUNE_EMPTY_ARFCN 655 @@ -78,8 +78,9 @@ enum EQ_TYPE { EQ_VITERBI }; -#define BURST_CB_ADJ_OFFSET 1 -#define BURST_CB_TUNE 2 +#define BURST_CB_SYNC_OFFSET 1 +#define BURST_CB_ADJ_OFFSET 2 +#define BURST_CB_TUNE 3 class gsm_burst; diff --git a/gsm-tvoid/src/lib/gsm_burst_cf.cc b/gsm-tvoid/src/lib/gsm_burst_cf.cc index e9fe0fc..a584cd6 100755 --- a/gsm-tvoid/src/lib/gsm_burst_cf.cc +++ b/gsm-tvoid/src/lib/gsm_burst_cf.cc @@ -65,6 +65,7 @@ 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); @@ -96,7 +97,7 @@ int gsm_burst_cf::general_work (int noutput_items, if (get_burst()) { //found a burst, send to output - if (out) { + if (do_output) { //ensure that output data is in range int b = d_burst_start; if (b < 0) @@ -105,8 +106,8 @@ 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++; } + rval++; switch ( d_clock_options & QB_MASK ) { case QB_QUARTER: //extra 1/4 bit each burst diff --git a/gsm-tvoid/src/lib/gsm_burst_ff.cc b/gsm-tvoid/src/lib/gsm_burst_ff.cc index f4aec06..89b513f 100755 --- a/gsm-tvoid/src/lib/gsm_burst_ff.cc +++ b/gsm-tvoid/src/lib/gsm_burst_ff.cc @@ -52,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 ) ) { @@ -69,7 +70,7 @@ int gsm_burst_ff::general_work (int noutput_items, if (get_burst()) { //found a burst, send to output - if (out) { + if (do_output) { //ensure that output data is in range int b = d_burst_start; if (b < 0) @@ -78,8 +79,8 @@ int gsm_burst_ff::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++; } + rval++; switch ( d_clock_options & QB_MASK ) { case QB_QUARTER: //Can't do this in the FF version @@ -100,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); -- cgit v1.2.3