diff options
-rwxr-xr-x | gsm-tvoid/src/lib/gsm_burst.cc | 11 | ||||
-rwxr-xr-x | gsm-tvoid/src/lib/gsm_burst.h | 6 | ||||
-rwxr-xr-x | gsm-tvoid/src/lib/gsm_burst_cf.cc | 10 | ||||
-rwxr-xr-x | gsm-tvoid/src/lib/gsm_burst_ff.cc | 8 | ||||
-rwxr-xr-x | gsm-tvoid/src/python/gsm_scan.py | 40 |
5 files changed, 54 insertions, 21 deletions
diff --git a/gsm-tvoid/src/lib/gsm_burst.cc b/gsm-tvoid/src/lib/gsm_burst.cc index 00a5a95..97e8682 100755 --- a/gsm-tvoid/src/lib/gsm_burst.cc +++ b/gsm-tvoid/src/lib/gsm_burst.cc @@ -477,7 +477,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) { @@ -647,9 +648,12 @@ int gsm_burst::get_burst(void) d_fcch_count++; calc_freq_offset(); + +#ifndef TEST_TUNE_TIMING if (p_tuner) { p_tuner->calleval(BURST_CB_ADJ_OFFSET); } +#endif d_ts = 0; break; @@ -703,6 +707,7 @@ int gsm_burst::get_burst(void) ///////////////////// //start tune testing #ifdef TEST_TUNE_TIMING + static int good_count = -1; //-1: wait sch, >=0: got sch, counting if (UNKNOWN == d_burst_type) { @@ -710,7 +715,7 @@ int gsm_burst::get_burst(void) fprintf(stdout,"good_count: %d\n",good_count); if (p_tuner) { - next_arfcn = 658; //tune back to the good channel + next_arfcn = TEST_TUNE_GOOD_ARFCN; p_tuner->calleval(BURST_CB_TUNE); } } @@ -728,7 +733,7 @@ int gsm_burst::get_burst(void) good_count = 0; //tune away if (p_tuner) { - next_arfcn = 655; //this should be an empty channel + next_arfcn = TEST_TUNE_EMPTY_ARFCN; p_tuner->calleval(BURST_CB_TUNE); } } diff --git a/gsm-tvoid/src/lib/gsm_burst.h b/gsm-tvoid/src/lib/gsm_burst.h index f1fb26e..79d72d6 100755 --- a/gsm-tvoid/src/lib/gsm_burst.h +++ b/gsm-tvoid/src/lib/gsm_burst.h @@ -11,6 +11,12 @@ #include <gr_feval.h> #include "gsmstack.h" +//Testing Modes +//Tune test measures hopping latency by hopping between good and empty ARFCNs +#define TEST_TUNE_TIMING +#define TEST_TUNE_GOOD_ARFCN 658 +#define TEST_TUNE_EMPTY_ARFCN 655 + //Console printing options #define PRINT_NOTHING 0x00000000 diff --git a/gsm-tvoid/src/lib/gsm_burst_cf.cc b/gsm-tvoid/src/lib/gsm_burst_cf.cc index 821b41f..df182a6 100755 --- a/gsm-tvoid/src/lib/gsm_burst_cf.cc +++ b/gsm-tvoid/src/lib/gsm_burst_cf.cc @@ -16,7 +16,7 @@ gsm_burst_cf_sptr gsm_make_burst_cf (gr_feval_ll *t,float 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 (gr_feval_ll *t, float sample_rate) : @@ -103,9 +103,11 @@ int gsm_burst_cf::general_work (int noutput_items, 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++; - + if (out) { + 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_mu -= d_relative_sample_rate / 4.0; diff --git a/gsm-tvoid/src/lib/gsm_burst_ff.cc b/gsm-tvoid/src/lib/gsm_burst_ff.cc index d73e73d..086f21b 100755 --- a/gsm-tvoid/src/lib/gsm_burst_ff.cc +++ b/gsm-tvoid/src/lib/gsm_burst_ff.cc @@ -16,7 +16,7 @@ gsm_burst_ff_sptr gsm_make_burst_ff (gr_feval_ll *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 (gr_feval_ll *t) : @@ -77,8 +77,10 @@ int gsm_burst_ff::general_work (int noutput_items, 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++; + if (out) { + memcpy(out+rval*USEFUL_BITS, d_burst_buffer + b, USEFUL_BITS*sizeof(float)); + rval++; + } switch ( d_clock_options & QB_MASK ) { case QB_QUARTER: //Can't do this in the FF version diff --git a/gsm-tvoid/src/python/gsm_scan.py b/gsm-tvoid/src/python/gsm_scan.py index 577acf4..9d5cbcf 100755 --- a/gsm-tvoid/src/python/gsm_scan.py +++ b/gsm-tvoid/src/python/gsm_scan.py @@ -195,6 +195,27 @@ class app_flow_graph(stdgui.gui_flow_graph): gsm_symb_rate = 1625000.0 / 6.0 sps = input_rate/gsm_symb_rate + + # Attempt to enable realtime scheduling + r = gr.enable_realtime_scheduling() + if r == gr.RT_OK: + realtime = True + print "Realtime scheduling ENABLED" + else: + realtime = False + print "Realtime scheduling FAILED" + +# if options.fusb_block_size == 0 and options.fusb_nblocks == 0: + if realtime: # be more aggressive + options.fusb_block_size = gr.prefs().get_long('fusb', 'rt_block_size', 1024) + options.fusb_nblocks = gr.prefs().get_long('fusb', 'rt_nblocks', 16) + else: + options.fusb_block_size = gr.prefs().get_long('fusb', 'block_size', 4096) + options.fusb_nblocks = gr.prefs().get_long('fusb', 'nblocks', 16) + + print "fusb_block_size =", options.fusb_block_size + print "fusb_nblocks =", options.fusb_nblocks + # Build the flowgraph # Setup our input source if options.inputfile: @@ -381,27 +402,24 @@ class app_flow_graph(stdgui.gui_flow_graph): self.burst.d_print_options = popts - ########################## - #set burst tuning callback - #self.burst_cb = gsm_tuner() - #self.burst.set_tuner_callback(self.burst_cb) - - # connect the primary path after source - self.v2s = gr.vector_to_stream(gr.sizeof_float,142) #burst output is 142 (USEFUL_BITS) - self.connect(self.burst, self.v2s) # create and connect the scopes that apply to all decoders if self.scopes.count("F"): self.filter_fft_scope = fftsink.fft_sink_c (self, panel, fft_size=1024, sample_rate=input_rate) self.connect(self.filter, self.filter_fft_scope) + # connect the burst output + if self.scopes.count("b") or options.outputfile: + self.v2s = gr.vector_to_stream(gr.sizeof_float,142) #burst output is 142 (USEFUL_BITS) + self.connect(self.burst, self.v2s) +# else: +# self.burst_sink = gr.null_sink(gr.sizeof_float) +# self.connect(self.v2s, self.burst_sink) + #Connect output sinks if self.scopes.count("b"): self.burst_scope = scopesink.scope_sink_f(self, panel, sample_rate=gsm_symb_rate,v_scale=1) self.connect(self.v2s, self.burst_scope) - elif not options.outputfile: - self.burst_sink = gr.null_sink(gr.sizeof_float) - self.connect(self.v2s, self.burst_sink) # setup & connect output file if options.outputfile: |