summaryrefslogtreecommitdiff
path: root/gsm-tvoid/src
diff options
context:
space:
mode:
Diffstat (limited to 'gsm-tvoid/src')
-rwxr-xr-xgsm-tvoid/src/lib/gsm.i9
-rwxr-xr-xgsm-tvoid/src/lib/gsm_burst.cc59
-rwxr-xr-xgsm-tvoid/src/lib/gsm_burst.h17
-rwxr-xr-xgsm-tvoid/src/python/gsm_scan.py25
4 files changed, 78 insertions, 32 deletions
diff --git a/gsm-tvoid/src/lib/gsm.i b/gsm-tvoid/src/lib/gsm.i
index 0ddd8b2..af644d9 100755
--- a/gsm-tvoid/src/lib/gsm.i
+++ b/gsm-tvoid/src/lib/gsm.i
@@ -16,6 +16,9 @@
// ----------------------------------------------------------------
+#define OPT_TEST_HOP_SPEED 0x00000001
+
+
#define PRINT_NOTHING 0x00000000
#define PRINT_EVERYTHING 0x7FFFFFFF //7 for SWIG overflow check work around
#define PRINT_BITS 0x00000001
@@ -66,6 +69,8 @@ public:
unsigned long d_clock_options;
unsigned long d_print_options;
+ unsigned long d_test_options;
+
EQ_TYPE d_equalizer_type;
//stats
@@ -80,6 +85,10 @@ public:
long next_arfcn;
+ //hop testing
+ long d_hop_good_arfcn;
+ long d_hop_bad_arfcn;
+
int sync_state();
float last_freq_offset(void);
float mean_freq_offset(void);
diff --git a/gsm-tvoid/src/lib/gsm_burst.cc b/gsm-tvoid/src/lib/gsm_burst.cc
index 6d02ea6..176b1ad 100755
--- a/gsm-tvoid/src/lib/gsm_burst.cc
+++ b/gsm-tvoid/src/lib/gsm_burst.cc
@@ -17,6 +17,9 @@ gsm_burst::gsm_burst (gr_feval_ll *t) :
p_tuner(t),
d_clock_options(DEFAULT_CLK_OPTS),
d_print_options(0),
+ d_test_options(0),
+ d_hop_good_arfcn(1),
+ d_hop_bad_arfcn(2),
d_equalizer_type(EQ_FIXED_DFE)
{
@@ -33,15 +36,17 @@ gsm_burst::gsm_burst (gr_feval_ll *t) :
tsync[i] = 2.0*SYNC_BITS[i] - 1.0;
}
+ diff_encode(tsync,corr_sync,N_SYNC_BITS);
+
+/*
fprintf(stderr," Sync: ");
print_bits(tsync,N_SYNC_BITS);
fprintf(stderr,"\n");
- diff_encode(tsync,corr_sync,N_SYNC_BITS);
fprintf(stderr,"DSync: ");
print_bits(corr_sync,N_SYNC_BITS);
fprintf(stderr,"\n\n");
-
+*/
for (int i=0; i < 10; i++) {
for (int j=0; j < N_TRAIN_BITS; j++) {
@@ -49,9 +54,11 @@ gsm_burst::gsm_burst (gr_feval_ll *t) :
}
diff_encode(tsync,corr_train_seq[i],N_TRAIN_BITS);
+/*
fprintf(stderr,"TSC%d: ",i);
print_bits(corr_train_seq[i],N_TRAIN_BITS);
fprintf(stderr,"\n");
+*/
}
/* Initialize GSM Stack */
@@ -650,7 +657,6 @@ int gsm_burst::get_burst(void)
d_ts = 0; //TODO: check this
break;
case SCH:
-#ifndef TEST_TUNE_TIMING
//TODO: it would be better to adjust tuning on first FCCH (for better SCH detection),
// but tuning can run away with false FCCHs
// Some logic to retune back to original offset on false FCCH might work
@@ -661,7 +667,6 @@ int gsm_burst::get_burst(void)
p_tuner->calleval(BURST_CB_SYNC_OFFSET);
}
-#endif
d_burst_count++;
d_sch_count++;
d_last_sch = d_burst_count;
@@ -704,35 +709,39 @@ int gsm_burst::get_burst(void)
/////////////////////
//start tune testing
-#ifdef TEST_TUNE_TIMING
-
+#ifdef TEST_HOP_SPEED
static int good_count = -1; //-1: wait sch, >=0: got sch, counting
static int wait_count = 0;
+
+ if (OPT_TEST_HOP_SPEED & d_test_options ) {
+ //have we started counting?
+ if ( good_count >= 0 ) {
+
+ if (UNKNOWN == d_burst_type) {
+ if (good_count >= 0) {
+ fprintf(stdout,"good_count: %d\n",good_count);
- if (UNKNOWN == d_burst_type) {
- if (good_count >= 0) {
- fprintf(stdout,"good_count: %d\n",good_count);
-
- if (p_tuner) {
- next_arfcn = TEST_TUNE_GOOD_ARFCN;
- p_tuner->calleval(BURST_CB_TUNE);
+ if (p_tuner) {
+ next_arfcn = d_hop_good_arfcn;
+ p_tuner->calleval(BURST_CB_TUNE);
+ }
+ }
+ good_count = -1; // start again at resync
+
+ } else {
+ //count good bursts
+ good_count++;
}
- }
- good_count = -1; // start again at resync
-
- } else {
-
- if (good_count >= 0 ) {
- good_count++;
- }
-
- if (SCH == d_burst_type) {
- if ((good_count < 0) && (++wait_count > 20)) { // get some good syncs before trying again
+
+ } else {
+ //haven't started counting
+ // get some good syncs before trying again
+ if ((SCH == d_burst_type) && (++wait_count > 5)) {
fprintf(stdout,"restarting good_count\n");
good_count = wait_count = 0;
//tune away
if (p_tuner) {
- next_arfcn = TEST_TUNE_EMPTY_ARFCN;
+ next_arfcn = d_hop_bad_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 6a206b1..9287a1d 100755
--- a/gsm-tvoid/src/lib/gsm_burst.h
+++ b/gsm-tvoid/src/lib/gsm_burst.h
@@ -13,10 +13,10 @@
//Testing Modes
//Tune test measures hopping latency by hopping between good and empty ARFCNs
-#undef TEST_TUNE_TIMING
-#define TEST_TUNE_GOOD_ARFCN 658
-#define TEST_TUNE_EMPTY_ARFCN 655
+#define TEST_HOP_SPEED
+//Test Options
+#define OPT_TEST_HOP_SPEED 0x00000001
//Console printing options
#define PRINT_NOTHING 0x00000000
@@ -59,7 +59,8 @@
// G T D1 TS D2 T G
// Start ^
-#define MAX_SYNC_WAIT 32 //Number of missed bursts before reverting to WAIT_FCCH.
+//#define MAX_SYNC_WAIT 32 //Number of missed bursts before reverting to WAIT_FCCH.
+#define MAX_SYNC_WAIT 64 //Number of missed bursts before reverting to WAIT_FCCH.
#define MAX_CORR_DIST 7 // 4 + 3 = 1/2 GUARD + TAIL
#define SCH_CORR_THRESHOLD 0.80
@@ -166,11 +167,15 @@ public:
long d_total_count;
////// Options
+ unsigned long d_test_options;
unsigned long d_clock_options;
unsigned long d_print_options;
EQ_TYPE d_equalizer_type;
-
-
+
+ //Hop speed info
+ long d_hop_good_arfcn;
+ long d_hop_bad_arfcn;
+
//Methods
void full_reset(void);
diff --git a/gsm-tvoid/src/python/gsm_scan.py b/gsm-tvoid/src/python/gsm_scan.py
index 478b460..6e00a8e 100755
--- a/gsm-tvoid/src/python/gsm_scan.py
+++ b/gsm-tvoid/src/python/gsm_scan.py
@@ -72,7 +72,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";
@@ -218,6 +218,13 @@ class app_flow_graph(stdgui.gui_flow_graph):
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)):
@@ -486,6 +493,22 @@ 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
+
+ options.tuning = 'h' #hopping only, no offset
+
+ 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):
personal git repositories of Harald Welte. Your mileage may vary