diff options
Diffstat (limited to 'gsm-tvoid/src/python')
-rwxr-xr-x | gsm-tvoid/src/python/gsm_scan.py | 80 |
1 files changed, 62 insertions, 18 deletions
diff --git a/gsm-tvoid/src/python/gsm_scan.py b/gsm-tvoid/src/python/gsm_scan.py index 5e3edfc..fab6ce8 100755 --- a/gsm-tvoid/src/python/gsm_scan.py +++ b/gsm-tvoid/src/python/gsm_scan.py @@ -39,7 +39,6 @@ class burst_callback(gr.feval_ll): def eval(self, x): #print "burst_callback: eval(",x,")\n"; try: - #TODO: rework so this will work on file input if gsm.BURST_CB_SYNC_OFFSET == x: #print "burst_callback: SYNC_OFFSET\n"; if self.fg.options.tuning.count("o"): @@ -72,7 +71,7 @@ class burst_callback(gr.feval_ll): self.fg.offset -= self.fg.mean_offset self.fg.set_channel(self.fg.channel) - elif gsm.BURST_CB_TUNE == x and self.fg.options.tuning.count("h"): + elif gsm.BURST_CB_TUNE == x: #print "burst_callback: BURST_CB_TUNE: ARFCN: ", self.fg.burst.next_arfcn, "\n"; if self.fg.options.tuning.count("h"): #print "burst_callback: tuning.\n"; @@ -173,10 +172,10 @@ class app_flow_graph(stdgui.gui_flow_graph): #decoder options - parser.add_option("-D", "--decoder", type="string", default="f", + parser.add_option("-D", "--decoder", type="string", default="c", help="Select decoder block to use. (c)omplex,(f)loat [default=%default]") parser.add_option("-E", "--equalizer", type="string", default="none", - help="Type of equalizer to use. none, fixed-dfe [default=%default]") + help="Type of equalizer to use. none, fixed-dfe, fixed-linear [default=%default]") parser.add_option("-t", "--timing", type="string", default="cn", help="Type of timing techniques to use. [default=%default] \n" + "(n)one, (c)orrelation track, (q)uarter bit, (f)ull04 ") @@ -214,13 +213,20 @@ class app_flow_graph(stdgui.gui_flow_graph): parser.add_option("-g", "--gain", type="eng_float", default=None, help="Set gain in dB (default is midpoint)") parser.add_option("-c", "--channel", type="int", default=1, - help="Tune to GSM ARFCN. Overrides --freq") + help="Tune to GSM ARFCN.") parser.add_option("-r", "--region", type="string", default="u", help="Frequency bands to use for channels. (u)s or (e)urope [default=%default]") + #testing options + parser.add_option("--test-hop-speed",action="store_true", dest="test_hop_speed", + help="Test hopping speed.") + parser.add_option("--hopgood", type="int", default=658, + help="Good ARFCN [default=%default]") + parser.add_option("--hopbad", type="int", default=655, + help="Emtpy ARFCN [default=%default]") (options, args) = parser.parse_args() - if (len(args) != 0) or (not (options.channel or options.inputfile)): + if (len(args) != 0): parser.print_help() sys.exit(1) @@ -228,6 +234,9 @@ class app_flow_graph(stdgui.gui_flow_graph): # print "datafile option cannot be used with USRP options." # sys.exit(1) + if options.test_hop_speed: + options.tuning = 'h' #hopping only, no offset + options.channel = options.hopgood self.options = options self.scopes = options.scopes @@ -280,9 +289,6 @@ class app_flow_graph(stdgui.gui_flow_graph): if options.print_console.count('D'): popts |= gsm.PRINT_DUMMY - if options.print_console.count('C'): - popts |= gsm.PRINT_BITS | gsm.PRINT_CORR_BITS - if options.print_console.count('x'): popts |= gsm.PRINT_BITS | gsm.PRINT_HEX @@ -292,7 +298,10 @@ class app_flow_graph(stdgui.gui_flow_graph): elif options.print_console.count('b'): popts |= gsm.PRINT_BITS - print "Print flags: 0x%8.8x\n" %(popts) + elif options.print_console.count('C'): + popts |= gsm.PRINT_BITS | gsm.PRINT_CORR_BITS + + #print "Print flags: 0x%8.8x\n" %(popts) self.burst.d_print_options = popts @@ -357,12 +366,16 @@ class app_flow_graph(stdgui.gui_flow_graph): print >> sys.stderr, "% offset = ", percent_offset, "clock = ", clock_rate self.clock_rate = clock_rate - self.input_rate = clock_rate / options.decim + self.input_rate = clock_rate / options.decim #TODO: what about usrp value? self.gsm_symb_rate = 1625000.0 / 6.0 self.sps = self.input_rate / self.gsm_symb_rate #################### def setup_filter(self): + #test w/o filter (for buffer latency) + #self.filter = self.source + #return + options = self.options # configure channel filter @@ -394,7 +407,7 @@ class app_flow_graph(stdgui.gui_flow_graph): gain_omega, 0.5, #mu gain_mu, - 0.3) #omega_relative_limit, + 0.5) #omega_relative_limit, self.burst = gsm.burst_ff(self.burst_cb) self.connect(self.filter, self.demod, self.clocker, self.burst) @@ -402,10 +415,12 @@ class app_flow_graph(stdgui.gui_flow_graph): #################### def setup_c_flowgraph(self): #use the sink version if burst scope not selected - if self.scopes.count("b"): - self.burst = gsm.burst_cf(self.burst_cb,input_rate) - else: - self.burst = gsm.burst_sink_c(self.burst_cb,input_rate) +# if self.scopes.count("b"): +# self.burst = gsm.burst_cf(self.burst_cb,self.input_rate) +# else: +# self.burst = gsm.burst_sink_c(self.burst_cb,self.input_rate) + + self.burst = gsm.burst_cf(self.burst_cb,self.input_rate) self.connect(self.filter, self.burst) @@ -418,7 +433,7 @@ class app_flow_graph(stdgui.gui_flow_graph): #Filter FFT if self.scopes.count("F"): - self.filter_fft_scope = fftsink.fft_sink_c (self, self.panel, fft_size=1024, sample_rate=input_rate) + self.filter_fft_scope = fftsink.fft_sink_c (self, self.panel, fft_size=1024, sample_rate=self.input_rate) self.connect(self.filter, self.filter_fft_scope) #Burst Scope @@ -433,15 +448,20 @@ class app_flow_graph(stdgui.gui_flow_graph): self.connect(self.demod, self.demod_scope) if self.scopes.count("c"): + #f_flowgraph self.clocked_scope = scopesink.scope_sink_f(self, self.panel, sample_rate=self.gsm_symb_rate,v_scale=1) self.connect(self.clocker, self.clocked_scope) + #for testing: f_flowgraph2 + #self.clocked_scope = scopesink.scope_sink_c(self, self.panel, sample_rate=self.gsm_symb_rate,v_scale=1) + #self.connect(self.clocker, self.clocked_scope) + #self.connect((self.clocker,1),(self.clocked_scope,1)) #################### def configure_burst_decoder(self): options = self.options # equalizer - eq_types = {'none': gsm.EQ_NONE, 'fixed-dfe': gsm.EQ_FIXED_DFE} + eq_types = {'none': gsm.EQ_NONE, 'fixed-dfe': gsm.EQ_FIXED_DFE, 'fixed-linear': gsm.EQ_FIXED_LINEAR } self.burst.d_equalizer_type = eq_types[options.equalizer] # timing @@ -458,6 +478,20 @@ class app_flow_graph(stdgui.gui_flow_graph): self.burst.d_clock_options = topts + #test modes + testopts = 0 + + if options.test_hop_speed: + testopts |= gsm.OPT_TEST_HOP_SPEED + self.burst.d_hop_good_arfcn = options.hopgood + self.burst.d_hop_bad_arfcn = options.hopbad + + print "!!!!! Enabling Hop Speed Testing (good=%d, bad=%d) !!!!!" % (options.hopgood,options.hopbad) + + self.burst.d_test_options = testopts + #print "Test Options: 0x%8.8x" % (self.burst.d_test_options) + + #################### def setup_flowgraph(self): @@ -630,6 +664,16 @@ class app_flow_graph(stdgui.gui_flow_graph): print >> out, 'known_count: ',n_known if n_total: print >> out, '%known: ', 100.0 * n_known / n_total + + #timing + if self.options.decoder.count("c"): + omega = self.burst.get_omega() + else: + omega = self.clocker.omega() + + percent_sps = omega / self.sps + print >> out, 'omega: %f (%f / %f)' % (omega,self.sps,percent_sps) + print >> out, "" #################### |