summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lib/gsm.i4
-rw-r--r--src/lib/gsm_receiver_cf.cc6
-rw-r--r--src/lib/gsm_receiver_cf.h9
-rwxr-xr-xsrc/python/gsm_receive.py29
4 files changed, 28 insertions, 20 deletions
diff --git a/src/lib/gsm.i b/src/lib/gsm.i
index 8c4d79a..b5a33f2 100644
--- a/src/lib/gsm.i
+++ b/src/lib/gsm.i
@@ -38,12 +38,12 @@
GR_SWIG_BLOCK_MAGIC(gsm,receiver_cf);
-gsm_receiver_cf_sptr gsm_make_receiver_cf ( gr_feval_dd *tuner, int osr);
+gsm_receiver_cf_sptr gsm_make_receiver_cf ( gr_feval_dd *tuner, gr_feval_dd *synchronizer, int osr);
class gsm_receiver_cf : public gr_block
{
private:
- gsm_receiver_cf ( gr_feval_dd *tuner, int osr);
+ gsm_receiver_cf ( gr_feval_dd *tuner, gr_feval_dd *synchronizer, int osr);
};
// ----------------------------------------------------------------
diff --git a/src/lib/gsm_receiver_cf.cc b/src/lib/gsm_receiver_cf.cc
index c9ef010..e314381 100644
--- a/src/lib/gsm_receiver_cf.cc
+++ b/src/lib/gsm_receiver_cf.cc
@@ -72,9 +72,9 @@ typedef std::vector<float> vector_float;
typedef boost::circular_buffer<float> circular_buffer_float;
gsm_receiver_cf_sptr
-gsm_make_receiver_cf(gr_feval_dd *tuner, int osr)
+gsm_make_receiver_cf(gr_feval_dd *tuner, gr_feval_dd *synchronizer, int osr)
{
- return gsm_receiver_cf_sptr(new gsm_receiver_cf(tuner, osr));
+ return gsm_receiver_cf_sptr(new gsm_receiver_cf(tuner, synchronizer, osr));
}
static const int MIN_IN = 1; // mininum number of input streams
@@ -85,7 +85,7 @@ static const int MAX_OUT = 1; // maximum number of output streams
/*
* The private constructor
*/
-gsm_receiver_cf::gsm_receiver_cf(gr_feval_dd *tuner, int osr)
+gsm_receiver_cf::gsm_receiver_cf(gr_feval_dd *tuner, gr_feval_dd *synchronizer, int osr)
: gr_block("gsm_receiver",
gr_make_io_signature(MIN_IN, MAX_IN, sizeof(gr_complex)),
gr_make_io_signature(MIN_OUT, MAX_OUT, 142 * sizeof(float))),
diff --git a/src/lib/gsm_receiver_cf.h b/src/lib/gsm_receiver_cf.h
index 070f9cf..9454997 100644
--- a/src/lib/gsm_receiver_cf.h
+++ b/src/lib/gsm_receiver_cf.h
@@ -37,7 +37,7 @@ class gsm_receiver_cf;
typedef boost::shared_ptr<gsm_receiver_cf> gsm_receiver_cf_sptr;
typedef std::vector<gr_complex> vector_complex;
-gsm_receiver_cf_sptr gsm_make_receiver_cf(gr_feval_dd *tuner, int osr);
+gsm_receiver_cf_sptr gsm_make_receiver_cf(gr_feval_dd *tuner, gr_feval_dd *synchronizer, int osr);
/** GSM Receiver GNU Radio block
*
@@ -61,6 +61,7 @@ class gsm_receiver_cf : public gr_block
gr_complex d_norm_training_seq[TRAIN_SEQ_NUM][N_TRAIN_BITS]; ///<encoded training sequences of a normal bursts and dummy bursts
gr_feval_dd *d_tuner; ///<callback to a python object which is used for frequency tunning
+ gr_feval_dd *d_synchronizer; ///<callback to a python object which is used to correct offset of USRP's internal clock
/** Countes samples consumed by the receiver
*
@@ -103,8 +104,8 @@ class gsm_receiver_cf : public gr_block
// GSM Stack
GS_CTX d_gs_ctx;//TODO: remove it! it'a not right place for a decoder
- friend gsm_receiver_cf_sptr gsm_make_receiver_cf(gr_feval_dd *tuner, int osr);
- gsm_receiver_cf(gr_feval_dd *tuner, int osr);
+ friend gsm_receiver_cf_sptr gsm_make_receiver_cf(gr_feval_dd *tuner, gr_feval_dd *synchronizer, int osr);
+ gsm_receiver_cf(gr_feval_dd *tuner, gr_feval_dd *synchronizer, int osr);
/** Function whis is used to search a FCCH burst and to compute frequency offset before
* "synchronized" state of the receiver
@@ -212,8 +213,6 @@ class gsm_receiver_cf : public gr_block
/**
*
- * @param burst_nr
- * @param burst_binary
*/
void process_normal_burst(burst_counter burst_nr, const unsigned char * burst_binary);
diff --git a/src/python/gsm_receive.py b/src/python/gsm_receive.py
index c7aad62..40c1520 100755
--- a/src/python/gsm_receive.py
+++ b/src/python/gsm_receive.py
@@ -9,23 +9,31 @@ from os import sys
for extdir in ['../../debug/src/lib','../../debug/src/lib/.libs']:
if extdir not in sys.path:
sys.path.append(extdir)
-import gsm
+import gsm
-class tune(gr.feval_dd):
+class tuner(gr.feval_dd):
def __init__(self, top_block):
gr.feval_dd.__init__(self)
self.top_block = top_block
- # self.center_freq = 0
def eval(self, freq_offet):
- # self.center_freq = self.center_freq - freq_offet
- self.top_block.set_frequency(freq_offet)
+ self.top_block.set_center_frequency(freq_offet)
+ return freq_offet
+
+class synchronizer(gr.feval_dd):
+ def __init__(self, top_block):
+ gr.feval_dd.__init__(self)
+ self.top_block = top_block
+
+ def eval(self, timing_offset):
+ self.top_block.set_timing(timing_offset)
return freq_offet
class gsm_receiver_first_blood(gr.top_block):
def __init__(self):
gr.top_block.__init__(self)
(options, args) = self._process_options()
- self.tune_callback = tune(self)
+ self.tuner_callback = tuner(self)
+ self.synchronizer_callback = synchronizer(self)
self.options = options
self.args = args
self._set_rates()
@@ -74,7 +82,7 @@ class gsm_receiver_first_blood(gr.top_block):
return interpolator
def _set_receiver(self):
- receiver = gsm.receiver_cf(self.tune_callback, self.options.osr)
+ receiver = gsm.receiver_cf(self.tuner_callback, self.synchronizer_callback, self.options.osr)
return receiver
def _process_options(self):
@@ -90,9 +98,12 @@ class gsm_receiver_first_blood(gr.top_block):
(options, args) = parser.parse_args ()
return (options, args)
- def set_frequency(self, center_freq):
+ def set_center_frequency(self, center_freq):
self.filtr.set_center_freq(center_freq)
+ def set_timing(self, timing_offset):
+ pass
+
def main():
try:
gsm_receiver_first_blood().run()
@@ -101,5 +112,3 @@ def main():
if __name__ == '__main__':
main()
-
-
personal git repositories of Harald Welte. Your mileage may vary