From e623985d7bed48ea54ab06635e2e25c6f77f3808 Mon Sep 17 00:00:00 2001 From: tvoid Date: Sat, 5 Apr 2008 13:51:31 -0600 Subject: - removed tuning callback cruft - Added printing options for "(d)ecoded hex for gamdecode" - Fixed print flags for normal, dummy bursts --- gsm-tvoid/src/lib/gsm.i | 16 +++--- gsm-tvoid/src/lib/gsm_burst.cc | 115 +++++++------------------------------- gsm-tvoid/src/lib/gsm_burst.h | 36 +----------- gsm-tvoid/src/lib/gsm_burst_cf.cc | 8 +-- gsm-tvoid/src/lib/gsm_burst_cf.h | 6 +- gsm-tvoid/src/lib/gsm_burst_ff.cc | 10 ++-- gsm-tvoid/src/lib/gsm_burst_ff.h | 6 +- gsm-tvoid/src/python/gsm_scan.py | 42 +++++--------- 8 files changed, 57 insertions(+), 182 deletions(-) mode change 100644 => 100755 gsm-tvoid/src/lib/gsm_burst_cf.cc mode change 100644 => 100755 gsm-tvoid/src/lib/gsm_burst_cf.h mode change 100644 => 100755 gsm-tvoid/src/lib/gsm_burst_ff.cc mode change 100644 => 100755 gsm-tvoid/src/lib/gsm_burst_ff.h (limited to 'gsm-tvoid') diff --git a/gsm-tvoid/src/lib/gsm.i b/gsm-tvoid/src/lib/gsm.i index a362421..d990e8b 100755 --- a/gsm-tvoid/src/lib/gsm.i +++ b/gsm-tvoid/src/lib/gsm.i @@ -31,6 +31,8 @@ #define PRINT_DUMMY 0x00000100 #define PRINT_NORMAL 0x00000200 +#define PRINT_GSM_DECODE 0x00000400 + #define PRINT_HEX 0x00001000 //Timing/clock options @@ -76,31 +78,27 @@ public: double mean_freq_offset(void); //Methods - //void set_tuner_callback(gsm_tuner_callback *); - //void set_tuner_callback(gr_feval_dd *); - void full_reset(void); protected: -// gsm_tuner_callback *p_tuner; - gsm_burst(gr_feval_dd *); + gsm_burst(); }; GR_SWIG_BLOCK_MAGIC(gsm,burst_ff); -gsm_burst_ff_sptr gsm_make_burst_ff (gr_feval_dd *); +gsm_burst_ff_sptr gsm_make_burst_ff (); class gsm_burst_ff : public gr_block, public gsm_burst { private: - gsm_burst_ff (gr_feval_dd *); + gsm_burst_ff (); }; GR_SWIG_BLOCK_MAGIC(gsm,burst_cf); -gsm_burst_cf_sptr gsm_make_burst_cf (gr_feval_dd *,float); +gsm_burst_cf_sptr gsm_make_burst_cf (float); class gsm_burst_cf : public gr_block, public gsm_burst { private: - gsm_burst_cf (gr_feval_dd *,float); + gsm_burst_cf (float); }; diff --git a/gsm-tvoid/src/lib/gsm_burst.cc b/gsm-tvoid/src/lib/gsm_burst.cc index ff5fac1..67d0886 100755 --- a/gsm-tvoid/src/lib/gsm_burst.cc +++ b/gsm-tvoid/src/lib/gsm_burst.cc @@ -12,84 +12,15 @@ #include "system.h" #include "gsmstack.h" -/* -void do_tuner_callback(gsm_tuner_callback *t, double f) -{ - if (t) t->do_tune(f); -} - - -//this should be overridden by a python class -void gsm_tuner_callback::tune(double x) { - printf("t1: %f\n",x); -} - -void gsm_tuner_callback::do_tune(double x) { - printf("do_"); - tune(x); -} - - -void gsm_burst::set_tuner_callback(gsm_tuner_callback *f) { - printf("set_tuner_callback: %8.8x\n",(unsigned int)f); - p_tuner = f; -} -*/ - -/* -void gsm_burst::set_tuner_callback(gr_feval_dd *t) { - p_tuner = t; -} -*/ - -/* -void gsm_burst::set_status_callback(PSTAT_FUNC func, void *clientdata) { - p_stat_func = func; - stat_func_data = clientdata; -} - -void gsm_burst::py_set_status_callback(PyObject *pyfunc) { - //set_status_callback(PythonCallBack, (void *) pyfunc); - stat_func_data = (void *) pyfunc; - Py_INCREF(pyfunc); -} -*/ - - -/* -static void PythonCallBack(int a, void *clientdata) -{ - PyObject *func, *arglist, *result; -// long int dres = 0; - - func = (PyObject *) clientdata; // Get Python function - arglist = Py_BuildValue("(i)",a); // Build argument list - result = PyEval_CallObject(func,arglist); // Call Python - Py_DECREF(arglist); // Trash arglist -// if (result) { // If no errors, return double -// dres = PyInt_AsLong(result); -// } - Py_XDECREF(result); -// return dres; -} -*/ -gsm_burst::gsm_burst (gr_feval_dd *t) : +gsm_burst::gsm_burst () : d_clock_options(DEFAULT_CLK_OPTS), d_print_options(0), d_equalizer_type(EQ_FIXED_DFE) { - printf("gsm_burst: enter constructor (t=%8.8x)\n",(unsigned int)t); - // M_PI = M_PI; //4.0 * atan(1.0); - //p_stat_func = 0; - //stat_func_data = 0; - - //p_callback = 0; - p_tuner = t; - full_reset(); //encode sync bits @@ -289,22 +220,26 @@ void gsm_burst::print_burst(void) fprintf(stderr," "); } - /* - * Pass information to GSM stack. GSM stack will try to extract - * information (fn, layer 2 messages, ...) - */ - - char buf[156]; - /* In hardbits include the 3 trial bits */ - /* FIXME: access burst has 8 trail bits? what is d_burst_start - * set to? make sure we start at the right position here. - */ - soft2hardbit(buf, d_burst_buffer + d_burst_start - 3, 156); - /* GS_process will differentially decode the data and then - * extract SCH infos (and later bcch infos). - */ - GS_process(&d_gs_ctx, d_ts, d_burst_type, buf); + if ( PRINT_GSM_DECODE == d_print_options ) { + + /* + * Pass information to GSM stack. GSM stack will try to extract + * information (fn, layer 2 messages, ...) + */ + + char buf[156]; + /* In hardbits include the 3 trial bits */ + /* FIXME: access burst has 8 trail bits? what is d_burst_start + * set to? make sure we start at the right position here. + */ + soft2hardbit(buf, d_burst_buffer + d_burst_start - 3, 156); + /* GS_process will differentially decode the data and then + * extract SCH infos (and later bcch infos). + */ + GS_process(&d_gs_ctx, d_ts, d_burst_type, buf); + } + if (print) { fprintf(stderr,"%d/%d/%+d/%lu/%lu ", @@ -754,16 +689,6 @@ int gsm_burst::get_burst(void) if (got_burst) { d_total_count++; - //do callback - //do_tuner_callback(p_tuner,1.0); - //if (p_callback) - if (p_tuner) - //p_tuner->eval(1.0); - p_tuner->calleval(1.0); - //p_tuner->do_tune(1.0); - //PythonCallBack(STAT_GOT_BURST,stat_func_data); - //(*p_stat_func)(STAT_GOT_BURST,stat_func_data); - //p_callback->(1.0); //print info print_burst(); diff --git a/gsm-tvoid/src/lib/gsm_burst.h b/gsm-tvoid/src/lib/gsm_burst.h index b5313c4..def20e0 100755 --- a/gsm-tvoid/src/lib/gsm_burst.h +++ b/gsm-tvoid/src/lib/gsm_burst.h @@ -30,6 +30,8 @@ #define PRINT_DUMMY 0x00000100 #define PRINT_NORMAL 0x00000200 +#define PRINT_GSM_DECODE 0x00000400 + #define PRINT_HEX 0x00001000 //Timing/clock options @@ -71,28 +73,13 @@ enum EQ_TYPE { EQ_VITERBI }; -//typedef void (*PSTAT_FUNC)(int, void *); -//#define STAT_GOT_BURST 1 -//double gr_feval_callback(gr_feval_dd *f, double x); - -/* -class gsm_tuner_callback { -protected: - virtual void tune(double x); - -public: - virtual void do_tune(double x); -}; -*/ -//void do_tuner_callback(gsm_tuner_callback *t, double f); - class gsm_burst; class gsm_burst { protected: - gsm_burst(gr_feval_dd *t); + gsm_burst(); //Burst Buffer: Storage for burst data float d_burst_buffer[BBUF_SIZE]; @@ -129,12 +116,6 @@ protected: double d_freq_off_sum; double d_freq_off_weight; - //PSTAT_FUNC p_stat_func; - //void *stat_func_data; - - gr_feval_dd *p_tuner; - //gsm_tuner_callback *p_tuner; - //////// Methods int get_burst(void); BURST_TYPE get_fcch_burst(void); @@ -160,17 +141,6 @@ protected: public: ~gsm_burst (); - //Set status callback function, needed for quick tune() - //void py_set_status_callback(PyObject *pyfunc); - //void set_status_callback(PSTAT_FUNC func, void *clientdata); - - //void set_tuner_callback(gr_feval_dd *t); - - //use swig directors to privide a python override - //virtual void notify_status(int status); - - //void set_tuner_callback(gsm_tuner_callback *f); - ////// General Stats //TODO: Maybe there should be a burst_stats class? long d_sync_loss_count; diff --git a/gsm-tvoid/src/lib/gsm_burst_cf.cc b/gsm-tvoid/src/lib/gsm_burst_cf.cc old mode 100644 new mode 100755 index f08424d..a91c569 --- a/gsm-tvoid/src/lib/gsm_burst_cf.cc +++ b/gsm-tvoid/src/lib/gsm_burst_cf.cc @@ -9,9 +9,9 @@ #include #include -gsm_burst_cf_sptr gsm_make_burst_cf (gr_feval_dd *t,float sample_rate) +gsm_burst_cf_sptr gsm_make_burst_cf (float sample_rate) { - return gsm_burst_cf_sptr (new gsm_burst_cf (t,sample_rate)); + return gsm_burst_cf_sptr (new gsm_burst_cf (sample_rate)); } static const int MIN_IN = 1; // minimum number of input streams @@ -19,17 +19,15 @@ 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 MAX_OUT = 1; // maximum number of output streams -gsm_burst_cf::gsm_burst_cf (gr_feval_dd *t, float sample_rate) : +gsm_burst_cf::gsm_burst_cf (float sample_rate) : 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))), - gsm_burst(t), d_clock_counter(0.0), d_last_sample(0.0,0.0), d_interp(new gri_mmse_fir_interpolator_cc()) { - printf("gsm_burst_cf: enter constructor\n"); //clocking parameters d_sample_interval = 1.0 / sample_rate; diff --git a/gsm-tvoid/src/lib/gsm_burst_cf.h b/gsm-tvoid/src/lib/gsm_burst_cf.h old mode 100644 new mode 100755 index fe742c4..33f61f6 --- 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_sptr; -gsm_burst_cf_sptr gsm_make_burst_cf(gr_feval_dd *,float); +gsm_burst_cf_sptr gsm_make_burst_cf(float); class gri_mmse_fir_interpolator_cc; @@ -16,8 +16,8 @@ class gsm_burst_cf : public gr_block, public gsm_burst { private: - friend gsm_burst_cf_sptr gsm_make_burst_cf(gr_feval_dd *,float); - gsm_burst_cf(gr_feval_dd *,float); + friend gsm_burst_cf_sptr gsm_make_burst_cf(float); + gsm_burst_cf(float); //clocking parameters float d_relative_sample_rate; diff --git a/gsm-tvoid/src/lib/gsm_burst_ff.cc b/gsm-tvoid/src/lib/gsm_burst_ff.cc old mode 100644 new mode 100755 index 25f9421..2980829 --- a/gsm-tvoid/src/lib/gsm_burst_ff.cc +++ b/gsm-tvoid/src/lib/gsm_burst_ff.cc @@ -9,9 +9,9 @@ #include #include -gsm_burst_ff_sptr gsm_make_burst_ff (gr_feval_dd *t) +gsm_burst_ff_sptr gsm_make_burst_ff () { - return gsm_burst_ff_sptr (new gsm_burst_ff(t)); + return gsm_burst_ff_sptr (new gsm_burst_ff()); } static const int MIN_IN = 1; // minimum number of input streams @@ -19,13 +19,11 @@ 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 MAX_OUT = 1; // maximum number of output streams -gsm_burst_ff::gsm_burst_ff (gr_feval_dd *t) : +gsm_burst_ff::gsm_burst_ff () : 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))), - gsm_burst(t) + gr_make_io_signature (MIN_OUT, MAX_OUT, USEFUL_BITS * sizeof (float))) { - printf("gsm_burst_ff: enter constructor\n"); set_history(1); diff --git a/gsm-tvoid/src/lib/gsm_burst_ff.h b/gsm-tvoid/src/lib/gsm_burst_ff.h old mode 100644 new mode 100755 index 30047f2..30c10dc --- 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_sptr; -gsm_burst_ff_sptr gsm_make_burst_ff(gr_feval_dd *); +gsm_burst_ff_sptr gsm_make_burst_ff(); class gsm_burst_ff : public gr_block, public gsm_burst { private: - friend gsm_burst_ff_sptr gsm_make_burst_ff(gr_feval_dd *); - gsm_burst_ff(gr_feval_dd *t); + friend gsm_burst_ff_sptr gsm_make_burst_ff(); + gsm_burst_ff(); public: ~gsm_burst_ff (); diff --git a/gsm-tvoid/src/python/gsm_scan.py b/gsm-tvoid/src/python/gsm_scan.py index 432b16e..5d48ce5 100755 --- a/gsm-tvoid/src/python/gsm_scan.py +++ b/gsm-tvoid/src/python/gsm_scan.py @@ -69,29 +69,10 @@ def get_freq_from_arfcn(chan,region): return freq * 1e6 -#class gsm_tuner(gsm.gsm_tuner_callback): -class gsm_tuner(gr.feval_dd): - def __init__(self, fg): - gr.feval_dd.__init__(self) - self.fg = fg - - def eval(self, x): - try: - print "tune: ", x, "\n"; - fg.cb_count += 1 - return 0.0 - - except Exception, e: - print "tune: Exception: ", e - - class app_flow_graph(stdgui.gui_flow_graph): def __init__(self, frame, panel, vbox, argv): stdgui.gui_flow_graph.__init__(self) - #testing - self.cb_count = 0 - self.frame = frame self.panel = panel @@ -104,7 +85,8 @@ class app_flow_graph(stdgui.gui_flow_graph): help="What to print on console. [default=%default]\n" + "(n)othing, (e)verything, (s)tatus, (a)ll Types, (k)nown, (u)nknown, \n" + "TS(0), (F)CCH, (S)CH, (N)ormal, (D)ummy\n" + - "Usefull (b)its, All TS (B)its, (C)orrelation bits, he(x) burst data") + "Usefull (b)its, All TS (B)its, (C)orrelation bits, he(x) burst data, \n" + + "(d)ecoded hex for gsmdecode") #decoder options @@ -235,12 +217,9 @@ class app_flow_graph(stdgui.gui_flow_graph): if self.scopes.count("I"): self.connect(self.u, self.input_fft_scope) - #create a tuner callback - self.tuner = gsm_tuner(self) - # Setup flow based on decoder selection if options.decoder.count("c"): - self.burst = gsm.burst_cf(self.tuner,input_rate) + self.burst = gsm.burst_cf(input_rate) self.connect(self.filter, self.burst) elif options.decoder.count("f"): @@ -257,7 +236,7 @@ class app_flow_graph(stdgui.gui_flow_graph): gain_mu, 0.3) #omega_relative_limit, - self.burst = gsm.burst_ff(self.tuner) + self.burst = gsm.burst_ff() self.connect(self.filter, self.demod, self.clocker, self.burst) if self.scopes.count("d"): @@ -341,10 +320,13 @@ class app_flow_graph(stdgui.gui_flow_graph): popts |= gsm.PRINT_SCH if options.print_console.count('N'): - popts |= gsm.PRINT_SCH + popts |= gsm.PRINT_NORMAL if options.print_console.count('D'): - popts |= gsm.PRINT_SCH + popts |= gsm.PRINT_DUMMY + + if options.print_console.count('d'): + popts |= gsm.PRINT_GSM_DECODE if options.print_console.count('C'): popts |= gsm.PRINT_BITS | gsm.PRINT_CORR_BITS @@ -357,6 +339,11 @@ class app_flow_graph(stdgui.gui_flow_graph): elif options.print_console.count('b'): popts |= gsm.PRINT_BITS + + if options.print_console.count('d'): + popts |= gsm.PRINT_GSM_DECODE + + #TODO: should warn if PRINT_GSM_DECODE is combined with other flags (will corrupt output for gsmdecode) self.burst.d_print_options = popts @@ -496,7 +483,6 @@ class app_flow_graph(stdgui.gui_flow_graph): print 'known_count: ',n_known if n_total: print '%known: ', 100.0 * n_known / n_total - print 'CB count: ',self.cb_count print "" def on_tick(self, evt): -- cgit v1.2.3